@ms-cloudpack/cli 0.51.2 → 0.51.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/common/checkFeatures.d.ts +12 -0
- package/lib/common/checkFeatures.d.ts.map +1 -0
- package/lib/common/checkFeatures.js +24 -0
- package/lib/common/checkFeatures.js.map +1 -0
- package/lib/common/createInitializeFunction.d.ts.map +1 -1
- package/lib/common/createInitializeFunction.js +8 -1
- package/lib/common/createInitializeFunction.js.map +1 -1
- package/lib/common/mergeFeatures.d.ts.map +1 -0
- package/lib/common/mergeFeatures.js.map +1 -0
- package/lib/setupReporting.js.map +1 -1
- package/package.json +7 -5
- package/lib/commands/start/mergeFeatures.d.ts.map +0 -1
- package/lib/commands/start/mergeFeatures.js.map +0 -1
- /package/lib/{commands/start → common}/mergeFeatures.d.ts +0 -0
- /package/lib/{commands/start → common}/mergeFeatures.js +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { allFeatures } from '@ms-cloudpack/config-types';
|
|
2
|
+
/**
|
|
3
|
+
* Check that the features in the config are valid.
|
|
4
|
+
* @returns An array of errors.
|
|
5
|
+
*/
|
|
6
|
+
export declare function checkFeatures<TFeatureSet extends Record<string, unknown> = typeof allFeatures>({ configFeatures, featureSet, }: {
|
|
7
|
+
/** The features from the config. */
|
|
8
|
+
configFeatures?: Record<string, boolean>;
|
|
9
|
+
/** The set of valid features. */
|
|
10
|
+
featureSet?: TFeatureSet;
|
|
11
|
+
}): string[];
|
|
12
|
+
//# sourceMappingURL=checkFeatures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkFeatures.d.ts","sourceRoot":"","sources":["../../src/common/checkFeatures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAGzD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,WAAW,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,WAAW,EAAE,EAC9F,cAAc,EACd,UAAkD,GACnD,EAAE;IACD,oCAAoC;IACpC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,iCAAiC;IACjC,UAAU,CAAC,EAAE,WAAW,CAAC;CAC1B,GAAG,MAAM,EAAE,CAmBX"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { allFeatures } from '@ms-cloudpack/config-types';
|
|
2
|
+
import didyoumean from 'didyoumean';
|
|
3
|
+
/**
|
|
4
|
+
* Check that the features in the config are valid.
|
|
5
|
+
* @returns An array of errors.
|
|
6
|
+
*/
|
|
7
|
+
export function checkFeatures({ configFeatures, featureSet = allFeatures, }) {
|
|
8
|
+
if (!configFeatures) {
|
|
9
|
+
return [];
|
|
10
|
+
}
|
|
11
|
+
const featureList = Object.keys(featureSet);
|
|
12
|
+
const features = Object.keys(configFeatures);
|
|
13
|
+
const errors = [];
|
|
14
|
+
features.forEach((featureName) => {
|
|
15
|
+
// Require an exact match.
|
|
16
|
+
if (!(featureName in featureSet)) {
|
|
17
|
+
// If there is no exact match, suggest the closest match.
|
|
18
|
+
const suggestion = didyoumean(featureName, featureList);
|
|
19
|
+
errors.push(`Unknown feature "${featureName}".${suggestion ? ` Did you mean "${suggestion}"?` : ''}`);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
return errors;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=checkFeatures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkFeatures.js","sourceRoot":"","sources":["../../src/common/checkFeatures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAmE,EAC9F,cAAc,EACd,UAAU,GAAG,WAAqC,GAMnD;IACC,IAAI,CAAC,cAAc,EAAE;QACnB,OAAO,EAAE,CAAC;KACX;IAED,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC5C,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC7C,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,QAAQ,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE;QAC/B,0BAA0B;QAC1B,IAAI,CAAC,CAAC,WAAW,IAAI,UAAU,CAAC,EAAE;YAChC,yDAAyD;YACzD,MAAM,UAAU,GAAG,UAAU,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;YACxD,MAAM,CAAC,IAAI,CAAC,oBAAoB,WAAW,KAAK,UAAU,CAAC,CAAC,CAAC,kBAAkB,UAAU,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;SACvG;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { allFeatures } from '@ms-cloudpack/config-types';\nimport didyoumean from 'didyoumean';\n\n/**\n * Check that the features in the config are valid.\n * @returns An array of errors.\n */\nexport function checkFeatures<TFeatureSet extends Record<string, unknown> = typeof allFeatures>({\n configFeatures,\n featureSet = allFeatures as unknown as TFeatureSet,\n}: {\n /** The features from the config. */\n configFeatures?: Record<string, boolean>;\n /** The set of valid features. */\n featureSet?: TFeatureSet;\n}): string[] {\n if (!configFeatures) {\n return [];\n }\n\n const featureList = Object.keys(featureSet);\n const features = Object.keys(configFeatures);\n const errors: string[] = [];\n\n features.forEach((featureName) => {\n // Require an exact match.\n if (!(featureName in featureSet)) {\n // If there is no exact match, suggest the closest match.\n const suggestion = didyoumean(featureName, featureList);\n errors.push(`Unknown feature \"${featureName}\".${suggestion ? ` Did you mean \"${suggestion}\"?` : ''}`);\n }\n });\n\n return errors;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createInitializeFunction.d.ts","sourceRoot":"","sources":["../../src/common/createInitializeFunction.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,KAAK,YAAY,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"createInitializeFunction.d.ts","sourceRoot":"","sources":["../../src/common/createInitializeFunction.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,KAAK,YAAY,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAG/D,wBAAgB,wBAAwB,CAAC,MAAM,EAAE;IAC/C,QAAQ,EAAE,YAAY,CAAC;IACvB,sEAAsE;IACtE,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,WAAW,CAAC;IACzB,mDAAmD;IACnD,OAAO,EAAE,aAAa,CAAC;CACxB,sBAEoD;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,gBAAgB,CAAC,EAAE,QAAQ,aAAa,CAAC,CAAA;CAAE;;;GA8ClH"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { readConfig } from '@ms-cloudpack/config';
|
|
2
2
|
import { yellow } from '@ms-cloudpack/task-reporter';
|
|
3
3
|
import { setupReporting } from '../setupReporting.js';
|
|
4
|
-
import { mergeFeatures } from '
|
|
4
|
+
import { mergeFeatures } from './mergeFeatures.js';
|
|
5
|
+
import { checkFeatures } from './checkFeatures.js';
|
|
5
6
|
export function createInitializeFunction(params) {
|
|
6
7
|
const { reporter, autoDispose, command } = params;
|
|
7
8
|
return async function initialize(initializeParams) {
|
|
@@ -20,6 +21,12 @@ export function createInitializeFunction(params) {
|
|
|
20
21
|
.filter(([, value]) => value)
|
|
21
22
|
.map(([key]) => key);
|
|
22
23
|
const telemetryClient = await setupReporting({ appPath, config, reporter, command, options: actionOptions });
|
|
24
|
+
const errors = checkFeatures({ configFeatures: config.features });
|
|
25
|
+
// If there are any invalid features, exit with an error.
|
|
26
|
+
if (errors.length) {
|
|
27
|
+
errors.forEach((error) => console.error(error));
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
23
30
|
if (enabledFeatureNames.length) {
|
|
24
31
|
telemetryClient.setSharedSpanAttribute('features', enabledFeatureNames);
|
|
25
32
|
console.log(`Enabled features: ${enabledFeatureNames.map((f) => yellow(f)).join(', ')}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createInitializeFunction.js","sourceRoot":"","sources":["../../src/common/createInitializeFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAqB,MAAM,6BAA6B,CAAC;AAExE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"createInitializeFunction.js","sourceRoot":"","sources":["../../src/common/createInitializeFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAqB,MAAM,6BAA6B,CAAC;AAExE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAKnD,MAAM,UAAU,wBAAwB,CAAC,MAOxC;IACC,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IAClD,OAAO,KAAK,UAAU,UAAU,CAAC,gBAAgF;QAC/G,MAAM,EAAE,OAAO,EAAE,GAAG,gBAAgB,CAAC;QAErC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AAC,IAAI,CAAC,EAAE,CAAC,CAAC;SAC1F;QAED,uDAAuD;QACvD,MAAM,sBAAsB,GAAG,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAC9E,MAAM,mBAAmB,GAAe;YACtC,OAAO,EAAE,sBAAsB;SAChC,CAAC;QACF,WAAW,CAAC,mBAAmB,CAAC,CAAC;QAEjC,OAAO;YACL,eAAe;YACf,MAAM;SACP,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { readConfig } from '@ms-cloudpack/config';\nimport { yellow, type TaskReporter } from '@ms-cloudpack/task-reporter';\nimport type { Command } from 'commander';\nimport { setupReporting } from '../setupReporting.js';\nimport { mergeFeatures } from './mergeFeatures.js';\nimport { checkFeatures } from './checkFeatures.js';\nimport type { AutoDispose } from '../types/AutoDispose.js';\nimport type { SharedOptions } from '../types/SharedOptions.js';\nimport type { Disposable } from '../types/Disposable.js';\n\nexport function createInitializeFunction(params: {\n reporter: TaskReporter;\n /** Command object for the current command (not the whole program). */\n command: Command;\n autoDispose: AutoDispose;\n /** Options from CLI args for the whole program. */\n options: SharedOptions;\n}) {\n const { reporter, autoDispose, command } = params;\n return async function initialize(initializeParams: { appPath: string; optionsOverrides?: Partial<SharedOptions> }) {\n const { appPath } = initializeParams;\n\n const actionOptions: SharedOptions = {\n ...params.options,\n ...initializeParams.optionsOverrides,\n };\n\n const config = await readConfig(appPath);\n\n // Merge in any additional features from the command line.\n config.features = mergeFeatures({\n configFeatures: config.features,\n commandLineFeatures: actionOptions.features,\n });\n\n const enabledFeatureNames = Object.entries(config.features)\n .filter(([, value]) => value)\n .map(([key]) => key);\n\n const telemetryClient = await setupReporting({ appPath, config, reporter, command, options: actionOptions });\n\n const errors = checkFeatures({ configFeatures: config.features });\n // If there are any invalid features, exit with an error.\n if (errors.length) {\n errors.forEach((error) => console.error(error));\n process.exit(1);\n }\n\n if (enabledFeatureNames.length) {\n telemetryClient.setSharedSpanAttribute('features', enabledFeatureNames);\n console.log(`Enabled features: ${enabledFeatureNames.map((f) => yellow(f)).join(', ')}`);\n }\n\n // Dispose the telemetry client when the app is closing\n const disposeTelemetryClient = telemetryClient.shutdown.bind(telemetryClient);\n const disposableTelemetry: Disposable = {\n dispose: disposeTelemetryClient,\n };\n autoDispose(disposableTelemetry);\n\n return {\n telemetryClient,\n config,\n };\n };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mergeFeatures.d.ts","sourceRoot":"","sources":["../../src/common/mergeFeatures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,wBAAgB,aAAa,CAAC,WAAW,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,WAAW,EAAE,EAC9F,cAAc,EACd,mBAAmB,EACnB,UAAkD,GACnD,EAAE;IACD,cAAc,CAAC,EAAE;SAAG,GAAG,IAAI,MAAM,OAAO,UAAU,CAAC,CAAC,EAAE,OAAO;KAAE,CAAC;IAChE,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,UAAU,CAAC,EAAE,WAAW,CAAC;CAC1B,yDAiBA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mergeFeatures.js","sourceRoot":"","sources":["../../src/common/mergeFeatures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,MAAM,UAAU,aAAa,CAAmE,EAC9F,cAAc,EACd,mBAAmB,EACnB,UAAU,GAAG,WAAqC,GAKnD;IACC,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC5C,MAAM,QAAQ,GAAG,EAAE,GAAG,cAAc,EAAE,CAAC;IAEvC,mBAAmB,EAAE,OAAO,CAAC,CAAC,kBAAkB,EAAE,EAAE;QAClD,yDAAyD;QACzD,MAAM,kBAAkB,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,kBAAkB,CAAC,WAAW,EAAE,CAAC;YACvG,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,kBAAkB,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAE5E,CAAC;QAEd,IAAI,kBAAkB,EAAE;YACtB,QAAQ,CAAC,kBAAkB,CAAC,GAAG,IAAI,CAAC;SACrC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,QAA0D,CAAC;AACpE,CAAC","sourcesContent":["import { allFeatures } from '@ms-cloudpack/config-types';\n\nexport function mergeFeatures<TFeatureSet extends Record<string, unknown> = typeof allFeatures>({\n configFeatures,\n commandLineFeatures,\n featureSet = allFeatures as unknown as TFeatureSet,\n}: {\n configFeatures?: { [key in keyof typeof featureSet]?: boolean };\n commandLineFeatures?: string[];\n featureSet?: TFeatureSet;\n}) {\n const featureList = Object.keys(featureSet);\n const features = { ...configFeatures };\n\n commandLineFeatures?.forEach((partialFeatureName) => {\n // Prefer an exact match, but fall back to partial match.\n const matchedFeatureName = (featureList.find((f) => f.toLowerCase() === partialFeatureName.toLowerCase()) ||\n featureList.find((f) => f.toLowerCase().indexOf(partialFeatureName.toLowerCase()) > -1)) as\n | keyof typeof features\n | undefined;\n\n if (matchedFeatureName) {\n features[matchedFeatureName] = true;\n }\n });\n\n return features as { [key in keyof typeof featureSet]?: boolean };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setupReporting.js","sourceRoot":"","sources":["../src/setupReporting.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EACL,IAAI,EACJ,oBAAoB,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AC,CAAC,GAAG;QAC/D,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,aAAa,EAAE,CAAC,OAAO,CAAC,KAAK;QAC7B,GAAG,CAAC,OAAO,CAAC,KAAK;YACf,CAAC,CAAC,kBAAkB;YACpB,CAAC,CAAC,OAAO,CAAC,OAAO;gBACf,CAAC,CAAC,oBAAoB;gBACtB,CAAC,CAAC,OAAO,CAAC,KAAK;oBACb,CAAC,CAAC,eAAe;oBACjB,CAAC,CAAC,oBAAoB,CAAC;KAC9B,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAgB,CAAC;IAEvF,MAAM,eAAe,GAAG,MAAM,aAAa,CACzC;QACE,eAAe,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK;QAChC,iBAAiB,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO;QACpC,eAAe,EAAE,MAAM,CAAC,SAAS;QACjC,oBAAoB,EAAE;YACpB,IAAI;YACJ,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;YAClC,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO;YACzC,OAAO,EAAE,UAAU,EAAE,IAAI,IAAI,WAAW;SACzC;KACF,EACD,QAAQ,CACT,CAAC;IAEF,OAAO,eAAe,CAAC;AACzB,CAAC","sourcesContent":["import type { PackageJson, CloudpackConfig } from '@ms-cloudpack/config-types';\nimport { readJson } from '@ms-cloudpack/json-utilities';\nimport { getVersion } from '@ms-cloudpack/package-utilities';\nimport {\n bold,\n defaultLoggingConfig,\n verboseLoggingConfig,\n debugLoggingConfig,\n noLoggingConfig,\n type TaskReporter,\n} from '@ms-cloudpack/task-reporter';\nimport type { Command } from 'commander';\nimport path from 'path';\nimport { initTelemetry } from './initTelemetry.js';\nimport type { SharedOptions } from './types/SharedOptions.js';\nimport { isCIBuild } from './utilities/isCIBuild.js';\n\nconst version = getVersion(import.meta.url);\n\nexport async function setupReporting(params: {\n options: SharedOptions;\n reporter: TaskReporter;\n config: CloudpackConfig;\n appPath: string;\n /** Command object for the current command (not the whole program). */\n command: Command;\n}) {\n const { appPath, config, reporter, options, command } = params;\n\n // commander stores the original argv under the \"program\" command where `parseAsync` was called.\n // Usually `command` is a sub-command (e.g. \"bundle\"), but it could also be a sub-sub-command\n // (e.g. \"cache clean\"), so we look up two levels if present.\n const program = command.parent?.parent || command.parent || command;\n // It looks like rawArgs was intended to be a public API (\"private\" member are prefixed with _)\n // but isn't included in the types...\n const argv = (program as unknown as { rawArgs: string[] }).rawArgs;\n\n // For same reasons as above, check if this is a sub-sub-command\n const verb = command.parent?.parent ? command.parent.name() : command.name();\n\n // Set reporter options and print the product info header\n reporter.setOptions({\n productName: 'Cloudpack',\n version,\n description: () => `Running \"${bold(argv.slice(2).join(' '))}\"`,\n helpMessage: config.helpMessage,\n plainTextMode: !options.color,\n ...(options.debug\n ? debugLoggingConfig\n : options.verbose\n ? verboseLoggingConfig\n : options.quiet\n ? noLoggingConfig\n : defaultLoggingConfig),\n });\n\n const definition = (await readJson(path.join(appPath, 'package.json'))) as PackageJson;\n\n const telemetryClient = await initTelemetry(\n {\n useDebugLogging: !!options.debug,\n useVerboseLogging: !!options.verbose,\n telemetryConfig: config.telemetry,\n sharedSpanAttributes: {\n verb,\n arguments: argv.slice(3).join(' '),\n environment: isCIBuild() ? 'ci' : 'local',\n appName: definition?.name || '<unknown>',\n },\n },\n reporter,\n );\n\n return telemetryClient;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/cli",
|
|
3
|
-
"version": "0.51.
|
|
3
|
+
"version": "0.51.3",
|
|
4
4
|
"description": "The Cloudpack command line interface - a tool for managing fast inner and outer looping in web apps.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
"cloudpack": "./bin/cloudpack.js"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@ms-cloudpack/api-server": "^0.27.
|
|
13
|
+
"@ms-cloudpack/api-server": "^0.27.7",
|
|
14
14
|
"@ms-cloudpack/config": "^0.17.2",
|
|
15
15
|
"@ms-cloudpack/config-types": "^0.1.1",
|
|
16
16
|
"@ms-cloudpack/create-express-app": "^1.3.12",
|
|
17
17
|
"@ms-cloudpack/json-utilities": "^0.1.2",
|
|
18
|
-
"@ms-cloudpack/overlay": "^0.16.
|
|
18
|
+
"@ms-cloudpack/overlay": "^0.16.30",
|
|
19
19
|
"@ms-cloudpack/package-hashes": "^0.2.3",
|
|
20
20
|
"@ms-cloudpack/package-utilities": "^5.6.0",
|
|
21
21
|
"@ms-cloudpack/path-string-parsing": "^1.1.1",
|
|
@@ -30,7 +30,8 @@
|
|
|
30
30
|
"open": "^9.0.0",
|
|
31
31
|
"prompts": "^2.4.2",
|
|
32
32
|
"semver": "^7.3.7",
|
|
33
|
-
"workspace-tools": "^0.36.3"
|
|
33
|
+
"workspace-tools": "^0.36.3",
|
|
34
|
+
"didyoumean": "^1.2.2"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
37
|
"@ms-cloudpack/bundler-types": "*",
|
|
@@ -41,7 +42,8 @@
|
|
|
41
42
|
"@types/jsdom": "^21.1.1",
|
|
42
43
|
"@types/object-hash": "^3.0.2",
|
|
43
44
|
"@types/prompts": "^2.4.4",
|
|
44
|
-
"@types/uuid": "^9.0.1"
|
|
45
|
+
"@types/uuid": "^9.0.1",
|
|
46
|
+
"@types/didyoumean": "^1.2.2"
|
|
45
47
|
},
|
|
46
48
|
"scripts": {
|
|
47
49
|
"build:watch": "cloudpack-scripts build-watch",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mergeFeatures.d.ts","sourceRoot":"","sources":["../../../src/commands/start/mergeFeatures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,wBAAgB,aAAa,CAAC,WAAW,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,WAAW,EAAE,EAC9F,cAAc,EACd,mBAAmB,EACnB,UAAkD,GACnD,EAAE;IACD,cAAc,CAAC,EAAE;SAAG,GAAG,IAAI,MAAM,OAAO,UAAU,CAAC,CAAC,EAAE,OAAO;KAAE,CAAC;IAChE,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,UAAU,CAAC,EAAE,WAAW,CAAC;CAC1B,yDAiBA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mergeFeatures.js","sourceRoot":"","sources":["../../../src/commands/start/mergeFeatures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,MAAM,UAAU,aAAa,CAAmE,EAC9F,cAAc,EACd,mBAAmB,EACnB,UAAU,GAAG,WAAqC,GAKnD;IACC,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC5C,MAAM,QAAQ,GAAG,EAAE,GAAG,cAAc,EAAE,CAAC;IAEvC,mBAAmB,EAAE,OAAO,CAAC,CAAC,kBAAkB,EAAE,EAAE;QAClD,yDAAyD;QACzD,MAAM,kBAAkB,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,kBAAkB,CAAC,WAAW,EAAE,CAAC;YACvG,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,kBAAkB,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAE5E,CAAC;QAEd,IAAI,kBAAkB,EAAE;YACtB,QAAQ,CAAC,kBAAkB,CAAC,GAAG,IAAI,CAAC;SACrC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,QAA0D,CAAC;AACpE,CAAC","sourcesContent":["import { allFeatures } from '@ms-cloudpack/config-types';\n\nexport function mergeFeatures<TFeatureSet extends Record<string, unknown> = typeof allFeatures>({\n configFeatures,\n commandLineFeatures,\n featureSet = allFeatures as unknown as TFeatureSet,\n}: {\n configFeatures?: { [key in keyof typeof featureSet]?: boolean };\n commandLineFeatures?: string[];\n featureSet?: TFeatureSet;\n}) {\n const featureList = Object.keys(featureSet);\n const features = { ...configFeatures };\n\n commandLineFeatures?.forEach((partialFeatureName) => {\n // Prefer an exact match, but fall back to partial match.\n const matchedFeatureName = (featureList.find((f) => f.toLowerCase() === partialFeatureName.toLowerCase()) ||\n featureList.find((f) => f.toLowerCase().indexOf(partialFeatureName.toLowerCase()) > -1)) as\n | keyof typeof features\n | undefined;\n\n if (matchedFeatureName) {\n features[matchedFeatureName] = true;\n }\n });\n\n return features as { [key in keyof typeof featureSet]?: boolean };\n}\n"]}
|
|
File without changes
|
|
File without changes
|