Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@contember/cli-common

Package Overview
Dependencies
Maintainers
5
Versions
172
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contember/cli-common - npm Package Compare versions

Comparing version 1.0.0-rc.15 to 1.0.0-rc.16

dist/src/application/env.d.ts

1

dist/src/application/index.d.ts

@@ -7,2 +7,3 @@ export * from './Application';

export * from './CommandConfiguration';
export * from './env';
export * from './Input';

@@ -9,0 +10,0 @@ export * from './InputParser';

@@ -19,2 +19,3 @@ "use strict";

__exportStar(require("./CommandConfiguration"), exports);
__exportStar(require("./env"), exports);
__exportStar(require("./Input"), exports);

@@ -21,0 +22,0 @@ __exportStar(require("./InputParser"), exports);

2

dist/src/utils/PathMapping.d.ts
export declare type PathMapping = Record<string, string>;
export declare const resolvePathMappingConfig: (baseDir: string, config?: PathMapping | undefined) => Promise<PathMapping>;
export declare const resolvePathMappingConfig: (baseDir: string, defaultProjectName: string, config?: PathMapping | undefined) => Promise<PathMapping>;
export declare const getPathFromMapping: (config: PathMapping, name: string) => string | undefined;
export declare const listEntriesInMapping: (config: PathMapping) => Promise<string[]>;
//# sourceMappingURL=PathMapping.d.ts.map

@@ -6,4 +6,3 @@ "use strict";

const fs_1 = require("./fs");
const resolvePathMappingConfig = async (baseDir, config) => {
var _a;
const resolvePathMappingConfig = async (baseDir, defaultProjectName, config) => {
if (config) {

@@ -13,6 +12,3 @@ return Object.fromEntries(Object.entries(config).map(([name, path]) => [name, (0, path_1.resolve)(baseDir, path)]));

// single instance/project
const baseName = (_a = process.env.CONTEMBER_PROJECT_NAME) !== null && _a !== void 0 ? _a : (0, path_1.basename)(baseDir)
.toLocaleLowerCase()
.replace(/[^-_a-z0-9]/, '');
return { [baseName]: baseDir };
return { [defaultProjectName]: baseDir };
};

@@ -19,0 +15,0 @@ exports.resolvePathMappingConfig = resolvePathMappingConfig;

@@ -16,3 +16,4 @@ import { Project } from './Project';

private getProjectPathMapping;
private getDefaultProjectName;
}
//# sourceMappingURL=ProjectManager.d.ts.map

@@ -62,6 +62,12 @@ "use strict";

async getProjectPathMapping() {
return (0, PathMapping_1.resolvePathMappingConfig)(this.workspace.directory, this.workspace.config.projects);
return (0, PathMapping_1.resolvePathMappingConfig)(this.workspace.directory, this.getDefaultProjectName(), this.workspace.config.projects);
}
getDefaultProjectName() {
var _a;
return (_a = this.workspace.env.projectName) !== null && _a !== void 0 ? _a : (0, path_1.basename)(this.workspace.directory)
.toLocaleLowerCase()
.replace(/[^-_a-z0-9]/, '');
}
}
exports.ProjectManager = ProjectManager;
//# sourceMappingURL=ProjectManager.js.map
import { ProjectManager } from './ProjectManager';
import { PathMapping } from './PathMapping';
import { CliEnv } from '../application';
export interface WorkspaceDirectoryArgument {

@@ -24,5 +25,6 @@ workspaceDirectory: string;

readonly directory: string;
readonly env: CliEnv;
readonly config: WorkspaceConfig;
readonly projects: ProjectManager;
constructor(directory: string, config: WorkspaceConfig);
constructor(directory: string, env: CliEnv, config: WorkspaceConfig);
static get(workspaceDirectory: string): Promise<Workspace>;

@@ -29,0 +31,0 @@ get name(): string;

@@ -10,2 +10,3 @@ "use strict";

const yaml_1 = require("./yaml");
const application_1 = require("../application");
const createWorkspace = async ({ workspaceDirectory, workspaceName, template }) => {

@@ -22,4 +23,5 @@ template !== null && template !== void 0 ? template : (template = '@contember/template-workspace');

class Workspace {
constructor(directory, config) {
constructor(directory, env, config) {
this.directory = directory;
this.env = env;
this.config = config;

@@ -30,3 +32,3 @@ this.projects = new ProjectManager_1.ProjectManager(this);

const config = await readWorkspaceConfig({ workspaceDirectory });
return new Workspace(workspaceDirectory, config);
return new Workspace(workspaceDirectory, (0, application_1.readCliEnv)(), config);
}

@@ -33,0 +35,0 @@ get name() {

{
"name": "@contember/cli-common",
"version": "1.0.0-rc.15",
"version": "1.0.0-rc.16",
"license": "Apache-2.0",

@@ -16,3 +16,3 @@ "main": "dist/src/index.js",

"dependencies": {
"@contember/config-loader": "^1.0.0-rc.15",
"@contember/config-loader": "^1.0.0-rc.16",
"chalk": "^4.1.0",

@@ -19,0 +19,0 @@ "download-tarball": "^2.0.0",

@@ -7,2 +7,3 @@ export * from './Application'

export * from './CommandConfiguration'
export * from './env'
export * from './Input'

@@ -9,0 +10,0 @@ export * from './InputParser'

@@ -7,2 +7,3 @@ import { basename, join, resolve } from 'path'

baseDir: string,
defaultProjectName: string,
config?: PathMapping,

@@ -14,6 +15,3 @@ ): Promise<PathMapping> => {

// single instance/project
const baseName = process.env.CONTEMBER_PROJECT_NAME ?? basename(baseDir)
.toLocaleLowerCase()
.replace(/[^-_a-z0-9]/, '')
return { [baseName]: baseDir }
return { [defaultProjectName]: baseDir }
}

@@ -20,0 +18,0 @@

import { Project, validateProjectName } from './Project'
import { join } from 'path'
import { basename, join } from 'path'
import { Workspace } from './Workspace'

@@ -67,4 +67,12 @@ import { resourcesDir } from '../pathUtils'

private async getProjectPathMapping(): Promise<Record<string, string>> {
return resolvePathMappingConfig(this.workspace.directory, this.workspace.config.projects)
return resolvePathMappingConfig(this.workspace.directory, this.getDefaultProjectName(), this.workspace.config.projects)
}
private getDefaultProjectName(): string {
return this.workspace.env.projectName
?? basename(this.workspace.directory)
.toLocaleLowerCase()
.replace(/[^-_a-z0-9]/, '')
}
}

@@ -8,2 +8,3 @@ import { basename, join } from 'path'

import { readYaml } from './yaml'
import { CliEnv, readCliEnv } from '../application'

@@ -44,7 +45,11 @@ export interface WorkspaceDirectoryArgument {

constructor(public readonly directory: string, public readonly config: WorkspaceConfig) {}
constructor(
public readonly directory: string,
public readonly env: CliEnv,
public readonly config: WorkspaceConfig,
) {}
public static async get(workspaceDirectory: string) {
const config = await readWorkspaceConfig({ workspaceDirectory })
return new Workspace(workspaceDirectory, config)
return new Workspace(workspaceDirectory, readCliEnv(), config)
}

@@ -51,0 +56,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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc