@contember/cli-common
Advanced tools
Comparing version 1.0.0-rc.6 to 1.0.0-rc.7
export declare type PathMapping = Record<string, string>; | ||
export declare const resolvePathMappingConfig: (baseDir: string, defaultDir: string, config?: PathMapping | undefined) => Promise<PathMapping>; | ||
export declare const resolvePathMappingConfig: (baseDir: string, config?: PathMapping | undefined) => Promise<PathMapping>; | ||
export declare const getPathFromMapping: (config: PathMapping, name: string) => string; | ||
export declare const listEntriesInMapping: (config: PathMapping) => Promise<string[]>; | ||
//# sourceMappingURL=PathMapping.d.ts.map |
@@ -5,5 +5,4 @@ "use strict"; | ||
const path_1 = require("path"); | ||
const fs_extra_1 = require("fs-extra"); | ||
const fs_1 = require("./fs"); | ||
const resolvePathMappingConfig = async (baseDir, defaultDir, config) => { | ||
const resolvePathMappingConfig = async (baseDir, config) => { | ||
var _a; | ||
@@ -13,13 +12,7 @@ if (config) { | ||
} | ||
const dir = (0, path_1.join)(baseDir, defaultDir); | ||
if (await (0, fs_extra_1.pathExists)(dir)) { | ||
return { ['*']: dir }; | ||
} | ||
else { | ||
// 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 }; | ||
} | ||
// 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 }; | ||
}; | ||
@@ -26,0 +19,0 @@ exports.resolvePathMappingConfig = resolvePathMappingConfig; |
@@ -59,3 +59,3 @@ "use strict"; | ||
async getProjectPathMapping() { | ||
return (0, PathMapping_1.resolvePathMappingConfig)(this.workspace.directory, 'projects', this.workspace.config.projects); | ||
return (0, PathMapping_1.resolvePathMappingConfig)(this.workspace.directory, this.workspace.config.projects); | ||
} | ||
@@ -62,0 +62,0 @@ } |
{ | ||
"name": "@contember/cli-common", | ||
"version": "1.0.0-rc.6", | ||
"version": "1.0.0-rc.7", | ||
"license": "Apache-2.0", | ||
@@ -16,3 +16,3 @@ "main": "dist/src/index.js", | ||
"dependencies": { | ||
"@contember/config-loader": "^1.0.0-rc.6", | ||
"@contember/config-loader": "^1.0.0-rc.7", | ||
"chalk": "^4.1.0", | ||
@@ -19,0 +19,0 @@ "download-tarball": "^2.0.0", |
import { basename, join, resolve } from 'path' | ||
import { pathExists } from 'fs-extra' | ||
import { listDirectories } from './fs' | ||
@@ -8,3 +7,2 @@ | ||
baseDir: string, | ||
defaultDir: string, | ||
config?: PathMapping, | ||
@@ -15,12 +13,7 @@ ): Promise<PathMapping> => { | ||
} | ||
const dir = join(baseDir, defaultDir) | ||
if (await pathExists(dir)) { | ||
return { ['*']: dir } | ||
} else { | ||
// single instance/project | ||
const baseName = process.env.CONTEMBER_PROJECT_NAME ?? basename(baseDir) | ||
.toLocaleLowerCase() | ||
.replace(/[^-_a-z0-9]/, '') | ||
return { [baseName]: baseDir } | ||
} | ||
// single instance/project | ||
const baseName = process.env.CONTEMBER_PROJECT_NAME ?? basename(baseDir) | ||
.toLocaleLowerCase() | ||
.replace(/[^-_a-z0-9]/, '') | ||
return { [baseName]: baseDir } | ||
} | ||
@@ -27,0 +20,0 @@ |
@@ -63,4 +63,4 @@ import { Project, validateProjectName } from './Project' | ||
private async getProjectPathMapping(): Promise<Record<string, string>> { | ||
return resolvePathMappingConfig(this.workspace.directory, 'projects', this.workspace.config.projects) | ||
return resolvePathMappingConfig(this.workspace.directory, this.workspace.config.projects) | ||
} | ||
} |
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
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
10
144724
2068