@contember/cli-common
Advanced tools
Comparing version 1.3.0-alpha.13 to 1.3.0-beta.1
@@ -1,2 +0,2 @@ | ||
export declare type Argument = { | ||
export type Argument = { | ||
name: string; | ||
@@ -3,0 +3,0 @@ description?: string; |
import { Command } from './Command'; | ||
export declare type CommandFactoryList = { | ||
export type CommandFactoryList = { | ||
[command: string]: () => Command<any, any>; | ||
@@ -4,0 +4,0 @@ }; |
@@ -1,3 +0,3 @@ | ||
export declare type Arguments = Record<string, string | string[] | undefined>; | ||
export declare type Options = Record<string, string | boolean | string[] | undefined>; | ||
export type Arguments = Record<string, string | string[] | undefined>; | ||
export type Options = Record<string, string | boolean | string[] | undefined>; | ||
export declare class Input<Args extends Arguments = Arguments, Opts extends Options = Options> { | ||
@@ -4,0 +4,0 @@ private readonly args; |
@@ -1,2 +0,2 @@ | ||
export declare type Option = { | ||
export type Option = { | ||
name: string; | ||
@@ -3,0 +3,0 @@ description?: string; |
@@ -10,3 +10,3 @@ "use strict"; | ||
OptionMode["VALUE_ARRAY"] = "value_array"; | ||
})(OptionMode = exports.OptionMode || (exports.OptionMode = {})); | ||
})(OptionMode || (exports.OptionMode = OptionMode = {})); | ||
class OptionConfiguration { | ||
@@ -13,0 +13,0 @@ constructor(option) { |
import { Argument } from './Argument'; | ||
import { Option } from './Option'; | ||
export declare type UsageFormat = 'line' | 'short' | 'multiline'; | ||
export declare type UsageFormatOptions = { | ||
export type UsageFormat = 'line' | 'short' | 'multiline'; | ||
export type UsageFormatOptions = { | ||
format?: UsageFormat; | ||
@@ -6,0 +6,0 @@ indent?: string; |
export { Application, Input, Command, CommandManager, CommandConfiguration, CommandFactoryList } from './application'; | ||
export * from './utils'; | ||
export * from './npm'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -25,2 +25,3 @@ "use strict"; | ||
__exportStar(require("./utils"), exports); | ||
__exportStar(require("./npm"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -1,7 +0,7 @@ | ||
export declare type JSONPrimitive = string | number | boolean | null | undefined | unknown; | ||
export declare type JSONValue = JSONPrimitive | JSONObject | JSONArray; | ||
export declare type JSONObject = { | ||
export type JSONPrimitive = string | number | boolean | null | undefined | unknown; | ||
export type JSONValue = JSONPrimitive | JSONObject | JSONArray; | ||
export type JSONObject = { | ||
[member: string]: JSONValue; | ||
}; | ||
export declare type JSONArray = JSONValue[]; | ||
export type JSONArray = JSONValue[]; | ||
//# sourceMappingURL=json.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export declare type PathMapping = Record<string, string>; | ||
export type PathMapping = Record<string, string>; | ||
export declare const resolvePathMappingConfig: (baseDir: string, defaultProjectName: string, config?: PathMapping) => Promise<PathMapping>; | ||
@@ -3,0 +3,0 @@ export declare const getPathFromMapping: (config: PathMapping, name: string) => string | undefined; |
@@ -1,2 +0,2 @@ | ||
export declare const getPackageVersion: () => any; | ||
export declare const getPackageVersion: () => string; | ||
//# sourceMappingURL=version.d.ts.map |
import { ProjectManager } from './ProjectManager'; | ||
import { PathMapping } from './PathMapping'; | ||
import { CliEnv } from '../application'; | ||
import { PackageWorkspace, PackageWorkspaceResolver } from '../npm/PackageWorkspace'; | ||
export interface WorkspaceDirectoryArgument { | ||
workspaceDirectory: string; | ||
} | ||
declare type CreateWorkspaceArgs = { | ||
type CreateWorkspaceArgs = { | ||
workspaceName: string; | ||
@@ -14,3 +15,2 @@ template?: string; | ||
api?: { | ||
version?: string; | ||
configFile?: string; | ||
@@ -28,9 +28,10 @@ }; | ||
readonly config: WorkspaceConfig; | ||
private readonly packageWorkspaceResolver; | ||
readonly projects: ProjectManager; | ||
constructor(directory: string, env: CliEnv, config: WorkspaceConfig); | ||
constructor(directory: string, env: CliEnv, config: WorkspaceConfig, packageWorkspaceResolver: PackageWorkspaceResolver); | ||
static get(workspaceDirectory: string): Promise<Workspace>; | ||
get name(): string; | ||
get adminEnabled(): boolean; | ||
get apiVersion(): string | undefined; | ||
isSingleProjectMode(): boolean; | ||
resolvePackageWorkspace(): Promise<PackageWorkspace>; | ||
} | ||
@@ -37,0 +38,0 @@ export declare const formatWorkspaceConfigPath: (workspaceDirectory: string) => string[]; |
@@ -11,2 +11,8 @@ "use strict"; | ||
const fs_1 = require("./fs"); | ||
const PackageWorkspace_1 = require("../npm/PackageWorkspace"); | ||
const FsManager_1 = require("../npm/FsManager"); | ||
const Yarn_1 = require("../npm/packageManagers/Yarn"); | ||
const YarnClassic_1 = require("../npm/packageManagers/YarnClassic"); | ||
const Pnpm_1 = require("../npm/packageManagers/Pnpm"); | ||
const Npm_1 = require("../npm/packageManagers/Npm"); | ||
const createWorkspace = async ({ workspaceDirectory, workspaceName, template }) => { | ||
@@ -23,6 +29,7 @@ template !== null && template !== void 0 ? template : (template = '@contember/template-workspace'); | ||
class Workspace { | ||
constructor(directory, env, config) { | ||
constructor(directory, env, config, packageWorkspaceResolver) { | ||
this.directory = directory; | ||
this.env = env; | ||
this.config = config; | ||
this.packageWorkspaceResolver = packageWorkspaceResolver; | ||
this.projects = new ProjectManager_1.ProjectManager(this); | ||
@@ -32,3 +39,10 @@ } | ||
const config = await readWorkspaceConfig({ workspaceDirectory }); | ||
return new Workspace(workspaceDirectory, (0, application_1.readCliEnv)(), config); | ||
const fsManager = new FsManager_1.FsManager(); | ||
const packageWorkspaceResolver = new PackageWorkspace_1.PackageWorkspaceResolver(fsManager, [ | ||
new Yarn_1.Yarn(fsManager), | ||
new YarnClassic_1.YarnClassic(fsManager), | ||
new Pnpm_1.Pnpm(fsManager), | ||
new Npm_1.Npm(fsManager), | ||
]); | ||
return new Workspace(workspaceDirectory, (0, application_1.readCliEnv)(), config, packageWorkspaceResolver); | ||
} | ||
@@ -42,9 +56,8 @@ get name() { | ||
} | ||
get apiVersion() { | ||
var _a, _b; | ||
return ((_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.api) === null || _b === void 0 ? void 0 : _b.version) || undefined; | ||
} | ||
isSingleProjectMode() { | ||
return !!this.env.projectName; | ||
} | ||
async resolvePackageWorkspace() { | ||
return await this.packageWorkspaceResolver.resolve(this.directory); | ||
} | ||
} | ||
@@ -51,0 +64,0 @@ exports.Workspace = Workspace; |
{ | ||
"name": "@contember/cli-common", | ||
"version": "1.3.0-alpha.13", | ||
"version": "1.3.0-beta.1", | ||
"license": "Apache-2.0", | ||
@@ -22,2 +22,3 @@ "main": "dist/src/index.js", | ||
"download-tarball": "^2.0.0", | ||
"fast-glob": "^3.2.12", | ||
"fs-extra": "^10.0.0", | ||
@@ -24,0 +25,0 @@ "get-package-json-from-registry": "^2.2.2", |
export { Application, Input, Command, CommandManager, CommandConfiguration, CommandFactoryList } from './application' | ||
export * from './utils' | ||
export * from './npm' |
import { join } from 'node:path' | ||
import { packageRoot } from '../pathUtils' | ||
export const getPackageVersion = () => { | ||
export const getPackageVersion = (): string => { | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
return require(join(packageRoot, 'package.json')).version | ||
} |
@@ -9,2 +9,8 @@ import { basename, join } from 'node:path' | ||
import { pathExists } from './fs' | ||
import { PackageWorkspace, PackageWorkspaceResolver } from '../npm/PackageWorkspace' | ||
import { FsManager } from '../npm/FsManager' | ||
import { Yarn } from '../npm/packageManagers/Yarn' | ||
import { YarnClassic } from '../npm/packageManagers/YarnClassic' | ||
import { Pnpm } from '../npm/packageManagers/Pnpm' | ||
import { Npm } from '../npm/packageManagers/Npm' | ||
@@ -32,3 +38,2 @@ export interface WorkspaceDirectoryArgument { | ||
api?: { | ||
version?: string | ||
configFile?: string | ||
@@ -50,2 +55,3 @@ } | ||
public readonly config: WorkspaceConfig, | ||
private readonly packageWorkspaceResolver: PackageWorkspaceResolver, | ||
) {} | ||
@@ -55,3 +61,11 @@ | ||
const config = await readWorkspaceConfig({ workspaceDirectory }) | ||
return new Workspace(workspaceDirectory, readCliEnv(), config) | ||
const fsManager = new FsManager() | ||
const packageWorkspaceResolver = new PackageWorkspaceResolver(fsManager, [ | ||
new Yarn(fsManager), | ||
new YarnClassic(fsManager), | ||
new Pnpm(fsManager), | ||
new Npm(fsManager), | ||
]) | ||
return new Workspace(workspaceDirectory, readCliEnv(), config, packageWorkspaceResolver) | ||
} | ||
@@ -67,10 +81,9 @@ | ||
get apiVersion(): string | undefined { | ||
return this.config?.api?.version || undefined | ||
} | ||
public isSingleProjectMode(): boolean { | ||
return !!this.env.projectName | ||
} | ||
public async resolvePackageWorkspace(): Promise<PackageWorkspace> { | ||
return await this.packageWorkspaceResolver.resolve(this.directory) | ||
} | ||
} | ||
@@ -77,0 +90,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
227590
221
3269
8
6
+ Addedfast-glob@^3.2.12
+ Added@nodelib/fs.scandir@2.1.5(transitive)
+ Added@nodelib/fs.stat@2.0.5(transitive)
+ Added@nodelib/fs.walk@1.2.8(transitive)
+ Addedbraces@3.0.3(transitive)
+ Addedfast-glob@3.3.2(transitive)
+ Addedfastq@1.18.0(transitive)
+ Addedfill-range@7.1.1(transitive)
+ Addedglob-parent@5.1.2(transitive)
+ Addedis-extglob@2.1.1(transitive)
+ Addedis-glob@4.0.3(transitive)
+ Addedis-number@7.0.0(transitive)
+ Addedmerge2@1.4.1(transitive)
+ Addedmicromatch@4.0.8(transitive)
+ Addedpicomatch@2.3.1(transitive)
+ Addedqueue-microtask@1.2.3(transitive)
+ Addedreusify@1.0.4(transitive)
+ Addedrun-parallel@1.2.0(transitive)
+ Addedto-regex-range@5.0.1(transitive)