@ms-cloudpack/cli 0.39.12 → 0.39.14
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/commands/bundle/bundle.d.ts +2 -4
- package/lib/commands/bundle/bundle.d.ts.map +1 -1
- package/lib/commands/bundle/bundle.js +2 -3
- package/lib/commands/bundle/bundle.js.map +1 -1
- package/lib/commands/bundle/index.js +2 -2
- package/lib/commands/bundle/index.js.map +1 -1
- package/lib/commands/dashboard/index.js +1 -1
- package/lib/commands/dashboard/index.js.map +1 -1
- package/lib/commands/init/index.d.ts.map +1 -1
- package/lib/commands/init/index.js +4 -3
- package/lib/commands/init/index.js.map +1 -1
- package/lib/commands/init/init.d.ts +2 -4
- package/lib/commands/init/init.d.ts.map +1 -1
- package/lib/commands/init/init.js +4 -7
- package/lib/commands/init/init.js.map +1 -1
- package/lib/commands/init/types/InitOptions.d.ts +0 -4
- package/lib/commands/init/types/InitOptions.d.ts.map +1 -1
- package/lib/commands/init/types/InitOptions.js.map +1 -1
- package/lib/commands/start/createSession.d.ts +3 -10
- package/lib/commands/start/createSession.d.ts.map +1 -1
- package/lib/commands/start/createSession.js +3 -4
- package/lib/commands/start/createSession.js.map +1 -1
- package/lib/commands/start/index.js +2 -2
- package/lib/commands/start/index.js.map +1 -1
- package/lib/commands/start/start.d.ts +2 -4
- package/lib/commands/start/start.d.ts.map +1 -1
- package/lib/commands/start/start.js +3 -3
- package/lib/commands/start/start.js.map +1 -1
- package/lib/common/getBundleDetails.js +1 -1
- package/lib/common/getBundleDetails.js.map +1 -1
- package/lib/index.d.ts +2 -12
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +8 -8
- package/lib/index.js.map +1 -1
- package/lib/initTelemetry.d.ts +2 -0
- package/lib/initTelemetry.d.ts.map +1 -1
- package/lib/initTelemetry.js +2 -2
- package/lib/initTelemetry.js.map +1 -1
- package/lib/tasks/resolveDependenciesTask.d.ts +3 -6
- package/lib/tasks/resolveDependenciesTask.d.ts.map +1 -1
- package/lib/tasks/resolveDependenciesTask.js +5 -2
- package/lib/tasks/resolveDependenciesTask.js.map +1 -1
- package/lib/types/CommandFunction.d.ts +2 -5
- package/lib/types/CommandFunction.d.ts.map +1 -1
- package/lib/types/CommandFunction.js.map +1 -1
- package/lib/types/TaskContext.d.ts +8 -0
- package/lib/types/TaskContext.d.ts.map +1 -0
- package/lib/types/TaskContext.js +2 -0
- package/lib/types/TaskContext.js.map +1 -0
- package/package.json +3 -4
- package/lib/common/getCachePath.d.ts +0 -3
- package/lib/common/getCachePath.d.ts.map +0 -1
- package/lib/common/getCachePath.js +0 -9
- package/lib/common/getCachePath.js.map +0 -1
- package/lib/initReporter.d.ts +0 -4
- package/lib/initReporter.d.ts.map +0 -1
- package/lib/initReporter.js +0 -7
- package/lib/initReporter.js.map +0 -1
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import type { BundleOptions } from './types/BundleOptions.js';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function bundle(options: BundleOptions, { reporter }:
|
|
4
|
-
reporter: TaskReporter;
|
|
5
|
-
}): Promise<void>;
|
|
2
|
+
import type { TaskContext } from '../../types/TaskContext.js';
|
|
3
|
+
export declare function bundle(options: BundleOptions, { reporter, appPath: packagePath }: TaskContext): Promise<void>;
|
|
6
4
|
//# sourceMappingURL=bundle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../../src/commands/bundle/bundle.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAG9D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../../src/commands/bundle/bundle.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAG9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE9D,wBAAsB,MAAM,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,WAAW,iBAwBnG"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { bundleTask } from '../../tasks/bundleTask.js';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { PackageDefinitions } from '@ms-cloudpack/package-utilities';
|
|
4
|
-
export async function bundle(options, { reporter }) {
|
|
5
|
-
const { bundler: bundlerType, outdir = 'dist/browser-esm', disableSourceMaps } = options
|
|
6
|
-
const packagePath = process.cwd();
|
|
4
|
+
export async function bundle(options, { reporter, appPath: packagePath }) {
|
|
5
|
+
const { bundler: bundlerType, outdir = 'dist/browser-esm', disableSourceMaps } = options;
|
|
7
6
|
const definition = await PackageDefinitions.getInstance().get(packagePath);
|
|
8
7
|
const { name = 'unknown', version = '0.0.0' } = definition || {};
|
|
9
8
|
const outputPath = path.resolve(packagePath, outdir);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.js","sourceRoot":"","sources":["../../../src/commands/bundle/bundle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAIrE,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,OAAsB,EAAE,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"bundle.js","sourceRoot":"","sources":["../../../src/commands/bundle/bundle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAIrE,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,OAAsB,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAe;IAClG,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,GAAG,kBAAkB,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC;IACzF,MAAM,UAAU,GAAG,MAAM,kBAAkB,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC3E,MAAM,EAAE,IAAI,GAAG,SAAS,EAAE,OAAO,GAAG,OAAO,EAAE,GAAG,UAAU,IAAI,EAAE,CAAC;IACjE,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IACrD,MAAM,aAAa,GAAkB;QACnC,EAAE,EAAE,QAAQ;QACZ,WAAW,EAAE,IAAI;QACjB,OAAO;QACP,WAAW;QACX,UAAU;QACV,UAAU,EAAE,IAAI;QAChB,WAAW;QACX,iBAAiB;KAClB,CAAC;IAEF,MAAM,UAAU,CAAC;QACf,aAAa;QACb,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE;KACzB,CAAC,CAAC;IAEH,QAAQ,CAAC,QAAQ,EAAE,CAAC;IAEpB,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACnE,CAAC","sourcesContent":["import { bundleTask } from '../../tasks/bundleTask.js';\nimport path from 'path';\nimport type { BundleOptions } from './types/BundleOptions.js';\nimport { PackageDefinitions } from '@ms-cloudpack/package-utilities';\nimport type { BundleRequest } from '../../types/BundleRequest.js';\nimport type { TaskContext } from '../../types/TaskContext.js';\n\nexport async function bundle(options: BundleOptions, { reporter, appPath: packagePath }: TaskContext) {\n const { bundler: bundlerType, outdir = 'dist/browser-esm', disableSourceMaps } = options;\n const definition = await PackageDefinitions.getInstance().get(packagePath);\n const { name = 'unknown', version = '0.0.0' } = definition || {};\n const outputPath = path.resolve(packagePath, outdir);\n const bundleRequest: BundleRequest = {\n id: 'bundle',\n packageName: name,\n version,\n packagePath,\n outputPath,\n isExternal: true,\n bundlerType,\n disableSourceMaps,\n };\n\n await bundleTask({\n bundleRequest,\n options: { force: true },\n });\n\n reporter.complete();\n\n process.exit(bundleRequest.result?.errors?.length === 0 ? 0 : 1);\n}\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { bundle } from './bundle.js';
|
|
2
|
-
export const init = (
|
|
2
|
+
export const init = (command, context) => {
|
|
3
3
|
command
|
|
4
4
|
.command('bundle')
|
|
5
5
|
.option('--bundler <name>', 'Forces use of a specific bundler.')
|
|
6
6
|
.option('--outdir <path>', 'Path to drop the bundle output, relative to current path.')
|
|
7
7
|
.description('Bundles a package.')
|
|
8
|
-
.action((bundleOptions) => bundle(bundleOptions,
|
|
8
|
+
.action((bundleOptions) => bundle(bundleOptions, context));
|
|
9
9
|
};
|
|
10
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/bundle/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAIrC,MAAM,CAAC,MAAM,IAAI,GAAoB,CAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/bundle/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAIrC,MAAM,CAAC,MAAM,IAAI,GAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE;IACxD,OAAO;SACJ,OAAO,CAAC,QAAQ,CAAC;SACjB,MAAM,CAAC,kBAAkB,EAAE,mCAAmC,CAAC;SAC/D,MAAM,CAAC,iBAAiB,EAAE,2DAA2D,CAAC;SACtF,WAAW,CAAC,oBAAoB,CAAC;SACjC,MAAM,CAAC,CAAC,aAA4B,EAAE,EAAE,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC;AAC9E,CAAC,CAAC","sourcesContent":["import { bundle } from './bundle.js';\nimport type { BundleOptions } from './types/BundleOptions.js';\nimport type { CommandFunction } from '../../types/CommandFunction.js';\n\nexport const init: CommandFunction = (command, context) => {\n command\n .command('bundle')\n .option('--bundler <name>', 'Forces use of a specific bundler.')\n .option('--outdir <path>', 'Path to drop the bundle output, relative to current path.')\n .description('Bundles a package.')\n .action((bundleOptions: BundleOptions) => bundle(bundleOptions, context));\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/dashboard/index.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,IAAI,GAAoB,CAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/dashboard/index.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,IAAI,GAAoB,CAAC,OAAO,EAAE,EAAE;IAC/C,OAAO;SACJ,OAAO,CAAC,WAAW,CAAC;SACpB,WAAW,CAAC,sBAAsB,CAAC;SACnC,MAAM,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC,CAAC;AAC9D,CAAC,CAAC","sourcesContent":["import type { CommandFunction } from '../../types/CommandFunction.js';\n\nexport const init: CommandFunction = (command) => {\n command\n .command('dashboard')\n .description('Shows the dashboard.')\n .action(() => console.log('i am showing the dashboard.'));\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/init/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAGtE,eAAO,MAAM,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/init/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAGtE,eAAO,MAAM,IAAI,EAAE,eAmDlB,CAAC"}
|
|
@@ -2,14 +2,15 @@ import { plural, red, yellow } from '@ms-cloudpack/task-reporter';
|
|
|
2
2
|
import { configFileName } from '@ms-cloudpack/config';
|
|
3
3
|
import { stopTelemetry } from '../../initTelemetry.js';
|
|
4
4
|
/* Defines the "init" verb. */
|
|
5
|
-
export const init = (
|
|
5
|
+
export const init = (command, context) => {
|
|
6
6
|
command
|
|
7
7
|
.command('init')
|
|
8
8
|
.description('Initializes a given app project and defines the necessary configuration overrides to make an existing app compatible with Cloudpack.')
|
|
9
9
|
.option('--fix', 'Applies fixes to all identified issues in internal packages.')
|
|
10
10
|
.option('--reset', 'Ignores existing overrides when determining all entries.')
|
|
11
11
|
.option('--check', 'Fails if any package exports are missing.')
|
|
12
|
-
.action(async (options
|
|
12
|
+
.action(async (options) => {
|
|
13
|
+
const { reporter } = context;
|
|
13
14
|
const { init } = await import('./init.js');
|
|
14
15
|
let completeReason;
|
|
15
16
|
let hasErrors = false;
|
|
@@ -39,7 +40,7 @@ export const init = ({ command, reporter }) => {
|
|
|
39
40
|
}
|
|
40
41
|
catch (error) {
|
|
41
42
|
hasErrors = true;
|
|
42
|
-
completeReason = `Unexpected error: ${error.
|
|
43
|
+
completeReason = `Unexpected error: ${error.stack || error}`;
|
|
43
44
|
}
|
|
44
45
|
await stopTelemetry();
|
|
45
46
|
reporter.complete(hasErrors ? red(completeReason) : hasWarnings ? yellow(completeReason) : completeReason);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/init/index.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/init/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,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;qBAC3D;yBACE,MAAM,CAAC,OAAO,CAAC;yBACf,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;aACxB;iBAAM;gBACL,cAAc,GAAG,OAAO,UAAU,gCAAgC,CAAC;aACpE;YAED,IAAI,WAAW,EAAE;gBACf,cAAc,IAAI,gBAAgB,cAAc,UAAU,MAAM,CAAC,WAAW,EAAE,QAAQ,CAAC,GAAG,CAAC;aAC5F;SACF;QAAC,OAAO,KAAK,EAAE;YACd,SAAS,GAAG,IAAI,CAAC;YACjB,cAAc,GAAG,qBAAsB,KAAe,CAAC,KAAK,IAAI,KAAK,EAAE,CAAC;SACzE;QAED,MAAM,aAAa,EAAE,CAAC;QACtB,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;QAE3G,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;AACP,CAAC,CAAC","sourcesContent":["import type { InitOptions } from './types/InitOptions.js';\nimport { plural, red, yellow } from '@ms-cloudpack/task-reporter';\nimport { configFileName } from '@ms-cloudpack/config';\nimport { stopTelemetry } from '../../initTelemetry.js';\nimport type { CommandFunction } from '../../types/CommandFunction.js';\n\n/* Defines the \"init\" verb. */\nexport const init: CommandFunction = (command, context) => {\n command\n .command('init')\n .description(\n 'Initializes a given app project and defines the necessary configuration overrides to make an existing app compatible with Cloudpack.',\n )\n .option('--fix', 'Applies fixes to all identified issues in internal packages.')\n .option('--reset', 'Ignores existing overrides when determining all entries.')\n .option('--check', 'Fails if any package exports are missing.')\n .action(async (options: InitOptions) => {\n const { reporter } = context;\n const { init } = await import('./init.js');\n\n let completeReason: string | undefined;\n let hasErrors = false;\n let hasWarnings = false;\n try {\n const { changeCount, errorPkgCount, warningPkgCount, successPkgCount } = await init(options, context);\n\n hasErrors = errorPkgCount > 0;\n hasWarnings = warningPkgCount > 0;\n\n const totalCount = errorPkgCount + warningPkgCount + successPkgCount;\n\n if (hasErrors || hasWarnings) {\n const successPct = ((successPkgCount / totalCount) * 100).toFixed(1);\n completeReason =\n [\n `${successPkgCount}/${totalCount} (${successPct}%) packages bundled successfully`,\n hasErrors && `${errorPkgCount} packages with errors`,\n hasWarnings && `${warningPkgCount} packages with warnings`,\n ]\n .filter(Boolean)\n .join('\\n') + '\\n';\n } else {\n completeReason = `All ${totalCount} packages bundled successfully`;\n }\n\n if (changeCount) {\n completeReason += `\\n\\nUpdated \"${configFileName}\" with ${plural(changeCount, 'change')}.`;\n }\n } catch (error) {\n hasErrors = true;\n completeReason = `Unexpected error: ${(error as Error).stack || error}`;\n }\n\n await stopTelemetry();\n reporter.complete(hasErrors ? red(completeReason) : hasWarnings ? yellow(completeReason) : completeReason);\n\n process.exit(hasErrors ? 1 : 0);\n });\n};\n"]}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { InitOptions } from './types/InitOptions.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { TaskContext } from '../../types/TaskContext.js';
|
|
3
3
|
/** Given the path, updates the Cloudpack config with overrides and project settings. */
|
|
4
|
-
export declare function init(options: InitOptions,
|
|
5
|
-
reporter: TaskReporter;
|
|
6
|
-
}): Promise<{
|
|
4
|
+
export declare function init(options: InitOptions, context: TaskContext): Promise<{
|
|
7
5
|
changeCount: number;
|
|
8
6
|
errorPkgCount: number;
|
|
9
7
|
warningPkgCount: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/commands/init/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/commands/init/init.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE9D,wFAAwF;AACxF,wBAAsB,IAAI,CACxB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC;IACT,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC,CA8GD"}
|
|
@@ -7,23 +7,20 @@ import { evaluateImportsForOverrides } from './evaluateImportsForOverrides.js';
|
|
|
7
7
|
import { bundleAndGetImports } from './bundleAndGetImports.js';
|
|
8
8
|
import { patchAllInternalPackageExports } from './patchAllInternalPackageExports.js';
|
|
9
9
|
/** Given the path, updates the Cloudpack config with overrides and project settings. */
|
|
10
|
-
export async function init(options,
|
|
10
|
+
export async function init(options, context) {
|
|
11
|
+
const { appPath } = context;
|
|
11
12
|
if (options.check && options.fix) {
|
|
12
13
|
throw Error('Cannot use --check and --fix together.');
|
|
13
14
|
}
|
|
14
15
|
if (options.check && options.reset) {
|
|
15
16
|
throw Error('Cannot use --check and --reset together.');
|
|
16
17
|
}
|
|
17
|
-
const appPath = options.cwd || process.cwd();
|
|
18
18
|
const config = await readConfig(appPath);
|
|
19
19
|
const packageOverrides = (!options.reset && config.packageOverrides) || [];
|
|
20
20
|
const packages = new PackageDefinitions();
|
|
21
21
|
packages.registerTransform(createPackageOverrideTransform({ packageOverrides }));
|
|
22
22
|
// Try to resolve dependencies.
|
|
23
|
-
const resolveMap =
|
|
24
|
-
if (!resolveMap) {
|
|
25
|
-
throw new Error("Couldn't resolve dependencies.");
|
|
26
|
-
}
|
|
23
|
+
const resolveMap = await resolveDependenciesTask({ packages }, context);
|
|
27
24
|
const packagePathsToEvaluate = new Set([appPath]);
|
|
28
25
|
const evaluatedPackages = new Set();
|
|
29
26
|
let changeCount = 0;
|
|
@@ -46,7 +43,7 @@ export async function init(options, { reporter }) {
|
|
|
46
43
|
continue;
|
|
47
44
|
}
|
|
48
45
|
// Bundle the package and find the imports it depends on.
|
|
49
|
-
const bundleResult = await bundleAndGetImports({ packagePath, definition, packages, reporter });
|
|
46
|
+
const bundleResult = await bundleAndGetImports({ packagePath, definition, packages, reporter: context.reporter });
|
|
50
47
|
if (!bundleResult.imports) {
|
|
51
48
|
// This is expected if the package just doesn't import anything else.
|
|
52
49
|
console.info(`${packagePath} has no additional imports to evaluate.`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/commands/init/init.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/commands/init/init.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjG,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,8BAA8B,EAAE,MAAM,gDAAgD,CAAC;AAChG,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AAIrF,wFAAwF;AACxF,MAAM,CAAC,KAAK,UAAU,IAAI,CACxB,OAAoB,EACpB,OAAoB;IAOpB,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAE5B,IAAI,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,GAAG,EAAE;QAChC,MAAM,KAAK,CAA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E,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CACpD,CAAC;SACH;QAED,WAAW,IAAI,eAAe,CAAC,WAAW,CAAC;QAE3C,YAAY,CAAC,SAAS,IAAI,eAAe,CAAC,MAAM,CAAC,MAAM;YACrD,CAAC,CAAC,aAAa,EAAE;YACjB,CAAC,CAAC,YAAY,CAAC,WAAW;gBAC1B,CAAC,CAAC,eAAe,EAAE;gBACnB,CAAC,CAAC,eAAe,EAAE,CAAC;KACvB;IAED,IAAI,OAAO,CAAC,GAAG,EAAE;QACf,MAAM,8BAA8B,CAAC,EAAE,UAAU,EAAE,gBAAgB,EAAE,CAAC,CAAC;KACxE;IAED,IAAI,WAAW,EAAE;QACf,6BAA6B;QAC7B,OAAO,CAAC,GAAG,CACT,uBAAuB,uBAAuB,8EAA8E,CAC7H,CAAC;QAEF,IAAI,gBAAgB,CAAC,MAAM,EAAE;YAC3B,MAAM,oBAAoB,CAAC,EAAE,gBAAgB,EAAE,EAAE,OAAO,CAAC,CAAC;SAC3D;KACF;IAED,OAAO;QACL,WAAW;QACX,aAAa;QACb,eAAe;QACf,eAAe;KAChB,CAAC;AACJ,CAAC","sourcesContent":["import type { PackageOverride } from '@ms-cloudpack/config';\nimport { generatedConfigFileName, readConfig, writeGeneratedConfig } from '@ms-cloudpack/config';\nimport { PackageDefinitions } from '@ms-cloudpack/package-utilities';\nimport { createPackageOverrideTransform } from '../../common/createPackageOverrideTransform.js';\nimport { rootSpan } from '../../initTelemetry.js';\nimport { resolveDependenciesTask } from '../../tasks/resolveDependenciesTask.js';\nimport { evaluateImportsForOverrides } from './evaluateImportsForOverrides.js';\nimport { bundleAndGetImports } from './bundleAndGetImports.js';\nimport { patchAllInternalPackageExports } from './patchAllInternalPackageExports.js';\nimport type { InitOptions } from './types/InitOptions.js';\nimport type { TaskContext } from '../../types/TaskContext.js';\n\n/** Given the path, updates the Cloudpack config with overrides and project settings. */\nexport async function init(\n options: InitOptions,\n context: TaskContext,\n): Promise<{\n changeCount: number;\n errorPkgCount: number;\n warningPkgCount: number;\n successPkgCount: number;\n}> {\n const { appPath } = context;\n\n if (options.check && options.fix) {\n throw Error('Cannot use --check and --fix together.');\n }\n\n if (options.check && options.reset) {\n throw Error('Cannot use --check and --reset together.');\n }\n\n const config = await readConfig(appPath);\n const packageOverrides: PackageOverride[] = (!options.reset && config.packageOverrides) || [];\n const packages = new PackageDefinitions();\n\n packages.registerTransform(createPackageOverrideTransform({ packageOverrides }));\n\n // Try to resolve dependencies.\n const resolveMap = await resolveDependenciesTask({ packages }, context);\n\n const packagePathsToEvaluate = new Set<string>([appPath]);\n const evaluatedPackages = new Set<string>();\n let changeCount = 0;\n let errorPkgCount = 0;\n let warningPkgCount = 0;\n let successPkgCount = 0;\n\n while (packagePathsToEvaluate.size) {\n const packagePath = packagePathsToEvaluate.values().next().value as string;\n\n packagePathsToEvaluate.delete(packagePath);\n\n // Skip already-visited packages.\n if (!packagePath || evaluatedPackages.has(packagePath)) {\n continue;\n }\n\n evaluatedPackages.add(packagePath);\n\n const definition = await packages.get(packagePath, { refresh: true });\n\n if (!definition) {\n // This is very weird and probably won't happen.\n console.error(`Skipping ${packagePath} evaluation because the package.json was not found or not readable.`);\n errorPkgCount++;\n continue;\n }\n\n // Bundle the package and find the imports it depends on.\n const bundleResult = await bundleAndGetImports({ packagePath, definition, packages, reporter: context.reporter });\n\n if (!bundleResult.imports) {\n // This is expected if the package just doesn't import anything else.\n console.info(`${packagePath} has no additional imports to evaluate.`);\n bundleResult.hasErrors ? errorPkgCount++ : bundleResult.hasWarnings ? warningPkgCount++ : successPkgCount++;\n continue;\n }\n\n // Given the package imports, find the missing exports maps and update packageOverrides.\n const overridesResult = await evaluateImportsForOverrides({\n definition,\n packages,\n packagePathsToEvaluate,\n evaluatedPackages,\n imports: bundleResult.imports,\n packageOverrides,\n resolveMap,\n });\n\n if (options.check && (overridesResult.changeCount || overridesResult.errors.length)) {\n rootSpan?.addEvent('INIT_CHECK_FAILED', {\n reason: overridesResult.changeCount ? 'Config needs to be updated.' : overridesResult.errors,\n });\n throw Error(\n overridesResult.changeCount\n ? 'Run \"cloudpack init --reset\" to update the config.'\n : overridesResult.errors.map((e) => e).join('\\n'),\n );\n }\n\n changeCount += overridesResult.changeCount;\n\n bundleResult.hasErrors || overridesResult.errors.length\n ? errorPkgCount++\n : bundleResult.hasWarnings\n ? warningPkgCount++\n : successPkgCount++;\n }\n\n if (options.fix) {\n await patchAllInternalPackageExports({ resolveMap, packageOverrides });\n }\n\n if (changeCount) {\n // Log the results to a file.\n console.log(\n `Writing updates to \"${generatedConfigFileName}\". If you're in a git repo, this file should be committed with your project.`,\n );\n\n if (packageOverrides.length) {\n await writeGeneratedConfig({ packageOverrides }, appPath);\n }\n }\n\n return {\n changeCount,\n errorPkgCount,\n warningPkgCount,\n successPkgCount,\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InitOptions.d.ts","sourceRoot":"","sources":["../../../../src/commands/init/types/InitOptions.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;IAEd;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,
|
|
1
|
+
{"version":3,"file":"InitOptions.d.ts","sourceRoot":"","sources":["../../../../src/commands/init/types/InitOptions.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;IAEd;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InitOptions.js","sourceRoot":"","sources":["../../../../src/commands/init/types/InitOptions.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Defines the options for the \"init\" command.\n */\nexport interface InitOptions {\n /**\n * Whether to apply fixes to all identified issues in internal packages.\n */\n fix?: boolean;\n\n /**\n * Whether to ignore existing overrides when determining all entries.\n */\n reset?: boolean;\n\n /**\n *
|
|
1
|
+
{"version":3,"file":"InitOptions.js","sourceRoot":"","sources":["../../../../src/commands/init/types/InitOptions.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Defines the options for the \"init\" command.\n */\nexport interface InitOptions {\n /**\n * Whether to apply fixes to all identified issues in internal packages.\n */\n fix?: boolean;\n\n /**\n * Whether to ignore existing overrides when determining all entries.\n */\n reset?: boolean;\n\n /**\n * Whether to fail on missing exports.\n */\n check?: boolean;\n}\n"]}
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
export interface SessionOptions {
|
|
5
|
-
appPath: string;
|
|
6
|
-
config: CloudpackConfig;
|
|
7
|
-
}
|
|
8
|
-
export declare function createSession(options: SessionOptions, context: {
|
|
9
|
-
reporter: TaskReporter;
|
|
10
|
-
}): Promise<Session>;
|
|
1
|
+
import { type Session } from '@ms-cloudpack/api-server';
|
|
2
|
+
import type { TaskContext } from '../../types/TaskContext.js';
|
|
3
|
+
export declare function createSession(context: TaskContext): Promise<Session>;
|
|
11
4
|
//# sourceMappingURL=createSession.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSession.d.ts","sourceRoot":"","sources":["../../../src/commands/start/createSession.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"createSession.d.ts","sourceRoot":"","sources":["../../../src/commands/start/createSession.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAO3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAK9D,wBAAsB,aAAa,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAwD1E"}
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { v4 as uuid } from 'uuid';
|
|
2
|
+
import { getLocalCachePath } from '@ms-cloudpack/api-server';
|
|
2
3
|
import { resolve } from '@ms-cloudpack/package-utilities';
|
|
3
4
|
import fs from 'fs';
|
|
4
5
|
import fsExtra from 'fs-extra';
|
|
5
6
|
import path from 'path';
|
|
6
7
|
import { fileURLToPath } from 'url';
|
|
7
|
-
import { getLocalCachePath } from '../../common/getCachePath.js';
|
|
8
8
|
import { resolveDependenciesTask } from '../../tasks/resolveDependenciesTask.js';
|
|
9
9
|
const dashboardPackageName = '@ms-cloudpack/overlay';
|
|
10
10
|
const dashboardPackagePath = (await resolve(dashboardPackageName, path.dirname(fileURLToPath(import.meta.url)))) || '';
|
|
11
|
-
export async function createSession(
|
|
12
|
-
const { appPath, config } =
|
|
11
|
+
export async function createSession(context) {
|
|
12
|
+
const { appPath, config } = context;
|
|
13
13
|
const projectName = path.basename(appPath);
|
|
14
14
|
const id = uuid();
|
|
15
15
|
const resolveMap = await resolveDependenciesTask({
|
|
16
|
-
appPath,
|
|
17
16
|
additionalPaths: [dashboardPackagePath],
|
|
18
17
|
}, context);
|
|
19
18
|
if (!resolveMap) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSession.js","sourceRoot":"","sources":["../../../src/commands/start/createSession.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"createSession.js","sourceRoot":"","sources":["../../../src/commands/start/createSession.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAgB,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EAAE,OAAO,EAAkB,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,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AAC,EAAE,CAAC,CAAC;KAChE;IACD,MAAM,cAAc,GAAG,CAAC,MAAM,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAA2B,CAAC;IAE9F,OAAO;QACL,EAAE;QACF,OAAO;QACP,MAAM;QACN,WAAW;QACX,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,SAAS;QACf,UAAU;QACV,QAAQ,EAAE,CAAC;QACX,cAAc;QACd,iBAAiB,EAAE,GAAG,EAAE,CAAC,cAAc;QACvC,uBAAuB,EAAE,CAAC,OAAgB,EAAE,EAAE;YAC5C,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,GAAG,cAAc,EAAE;gBACrD,cAAc,GAAG,OAAO,IAAI,cAAc,GAAG,CAAC,CAAC;gBAC/C,SAAS,GAAG,SAAS,CAAC;aACvB;QACH,CAAC;QACD,sBAAsB,EAAE,CAAC,SAAiB,EAAE,EAAE;YAC5C,cAAc,CAAC,SAAS,MAAxB,cAAc,CAAC,SAAS,IAAM,CAAC,EAAC;YAChC,cAAc,CAAC,SAAS,CAAC,EAAE,CAAC;YAC5B,SAAS,GAAG,SAAS,CAAC;YACtB,gFAAgF;YAChF,EAAE,CAAC,aAAa,CAAC,kBAAkB,EAAE,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAChF,CAAC;QACD,YAAY,EAAE,GAAG,EAAE,CAAC,SAAS;QAC7B,YAAY,EAAE,CAAC,YAAuB,EAAE,EAAE;YACxC,SAAS,GAAG,YAAY,CAAC;YACzB,OAAO,SAAS,CAAC;QACnB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { v4 as uuid } from 'uuid';\nimport { getLocalCachePath, type Session } from '@ms-cloudpack/api-server';\nimport { resolve, type ImportMap } from '@ms-cloudpack/package-utilities';\nimport fs from 'fs';\nimport fsExtra from 'fs-extra';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\nimport { resolveDependenciesTask } from '../../tasks/resolveDependenciesTask.js';\nimport type { TaskContext } from '../../types/TaskContext.js';\n\nconst dashboardPackageName = '@ms-cloudpack/overlay';\nconst dashboardPackagePath = (await resolve(dashboardPackageName, path.dirname(fileURLToPath(import.meta.url)))) || '';\n\nexport async function createSession(context: TaskContext): Promise<Session> {\n const { appPath, config } = context;\n const projectName = path.basename(appPath);\n const id = uuid();\n const resolveMap = await resolveDependenciesTask(\n {\n additionalPaths: [dashboardPackagePath],\n },\n context,\n );\n\n if (!resolveMap) {\n throw new Error('Could not resolve dependencies.');\n }\n\n let importMap: ImportMap | undefined = undefined;\n let sessionVersion = 0;\n\n await fsExtra.ensureDir(getLocalCachePath(appPath));\n const targetVersionsPath = path.join(getLocalCachePath(appPath), 'targetVersions.json');\n const fileExists = await fsExtra.pathExists(targetVersionsPath);\n if (!fileExists) {\n await fsExtra.writeJson(targetVersionsPath, {}, { spaces: 2 });\n }\n const targetVersions = (await fsExtra.readJSON(targetVersionsPath)) as Record<string, number>;\n\n return {\n id,\n appPath,\n config,\n projectName,\n type: 'web-app',\n mode: 'library',\n resolveMap,\n sequence: 0,\n targetVersions,\n getSessionVersion: () => sessionVersion,\n incrementSessionVersion: (version?: number) => {\n if (version === undefined || version > sessionVersion) {\n sessionVersion = version ?? sessionVersion + 1;\n importMap = undefined;\n }\n },\n incrementTargetVersion: (inputPath: string) => {\n targetVersions[inputPath] ||= 0;\n targetVersions[inputPath]++;\n importMap = undefined;\n // eslint-disable-next-line no-restricted-syntax -- this function can't be async\n fs.writeFileSync(targetVersionsPath, JSON.stringify(targetVersions, null, 2));\n },\n getImportMap: () => importMap,\n setImportMap: (newImportMap: ImportMap) => {\n importMap = newImportMap;\n return importMap;\n },\n };\n}\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/* Defines the "start" verb. */
|
|
2
|
-
export const init = (
|
|
2
|
+
export const init = (command, context) => {
|
|
3
3
|
command
|
|
4
4
|
.command('start')
|
|
5
5
|
.description('Starts a web inner-loop from the current package folder.')
|
|
6
6
|
.option('--log-resolve-map', 'Logs the resolve map to "resolve-map.json" for diagnostics.')
|
|
7
7
|
.option('--features <featureName> [featureNames...]', 'Enable experimental features.')
|
|
8
|
-
.action(async (options) => (await import('./start.js')).start(options,
|
|
8
|
+
.action(async (options) => (await import('./start.js')).start(options, context));
|
|
9
9
|
};
|
|
10
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/start/index.ts"],"names":[],"mappings":"AAGA,+BAA+B;AAC/B,MAAM,CAAC,MAAM,IAAI,GAAoB,CAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/start/index.ts"],"names":[],"mappings":"AAGA,+BAA+B;AAC/B,MAAM,CAAC,MAAM,IAAI,GAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE;IACxD,OAAO;SACJ,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,0DAA0D,CAAC;SACvE,MAAM,CAAC,mBAAmB,EAAE,6DAA6D,CAAC;SAC1F,MAAM,CAAC,4CAA4C,EAAE,+BAA+B,CAAC;SACrF,MAAM,CAAC,KAAK,EAAE,OAAqB,EAAE,EAAE,CAAC,CAAC,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;AACnG,CAAC,CAAC","sourcesContent":["import type { CommandFunction } from '../../types/CommandFunction.js';\nimport type { StartOptions } from './types/StartOptions.js';\n\n/* Defines the \"start\" verb. */\nexport const init: CommandFunction = (command, context) => {\n command\n .command('start')\n .description('Starts a web inner-loop from the current package folder.')\n .option('--log-resolve-map', 'Logs the resolve map to \"resolve-map.json\" for diagnostics.')\n .option('--features <featureName> [featureNames...]', 'Enable experimental features.')\n .action(async (options: StartOptions) => (await import('./start.js')).start(options, context));\n};\n"]}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { StartOptions } from './types/StartOptions.js';
|
|
2
|
-
import {
|
|
2
|
+
import type { TaskContext } from '../../types/TaskContext.js';
|
|
3
3
|
/**
|
|
4
4
|
* Defines the "start" verb entry point.
|
|
5
5
|
*/
|
|
6
|
-
export declare function start(options: StartOptions, { reporter }:
|
|
7
|
-
reporter: TaskReporter;
|
|
8
|
-
}): Promise<void>;
|
|
6
|
+
export declare function start(options: StartOptions, { reporter, appPath, config }: TaskContext): Promise<void>;
|
|
9
7
|
//# sourceMappingURL=start.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../../src/commands/start/start.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../../src/commands/start/start.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAS5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAgB9D;;GAEG;AACH,wBAAsB,KAAK,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,WAAW,iBAuH5F"}
|
|
@@ -25,8 +25,7 @@ async function createAppBundleTask(session, packageName, features) {
|
|
|
25
25
|
/**
|
|
26
26
|
* Defines the "start" verb entry point.
|
|
27
27
|
*/
|
|
28
|
-
export async function start(options, { reporter }) {
|
|
29
|
-
const appPath = process.cwd();
|
|
28
|
+
export async function start(options, { reporter, appPath, config }) {
|
|
30
29
|
try {
|
|
31
30
|
// Parse config if it exists.
|
|
32
31
|
const config = await readConfig(appPath);
|
|
@@ -50,7 +49,7 @@ export async function start(options, { reporter }) {
|
|
|
50
49
|
throw new Error(`The package.json at "${appPath}" did not have a name and/or version.`);
|
|
51
50
|
}
|
|
52
51
|
// Initialize session definition.
|
|
53
|
-
const session = await createSession({
|
|
52
|
+
const session = await createSession({ config, reporter, appPath });
|
|
54
53
|
// Set shared telemetry attributes which will be sent with all telemetry events.
|
|
55
54
|
setSharedTelemetryAttribute('sessionId', session.id);
|
|
56
55
|
if (options.logResolveMap) {
|
|
@@ -63,6 +62,7 @@ export async function start(options, { reporter }) {
|
|
|
63
62
|
session,
|
|
64
63
|
rootSpan,
|
|
65
64
|
reporter,
|
|
65
|
+
appPath,
|
|
66
66
|
});
|
|
67
67
|
// Kick off bundling app package as soon as api server is ready.
|
|
68
68
|
void apiServer.addTask(await createAppBundleTask(session, definition.name, config.features));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../../src/commands/start/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC1F,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,8BAA8B,EAAE,MAAM,gDAAgD,CAAC;AAChG,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC9F,OAAO,EAAE,2BAA2B,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAC9F,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,
|
|
1
|
+
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../../src/commands/start/start.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son } from '@ms-cloudpack/json-utilities';\nimport { PackageDefinitions, findResolveMapEntry } from '@ms-cloudpack/package-utilities';\nimport path from 'path';\nimport { createPackageOverrideTransform } from '../../common/createPackageOverrideTransform.js';\nimport { createSession } from './createSession.js';\nimport { openBrowser } from './openBrowser.js';\nimport type { Session } from '@ms-cloudpack/api-server';\nimport type { StartOptions } from './types/StartOptions.js';\nimport { readConfig } from '@ms-cloudpack/config';\nimport type { Features } from '@ms-cloudpack/config';\nimport { PerfMarkerCliEntry, PerfMeasurementOpenBrowser } from '../../performance/markers.js';\nimport { setSharedTelemetryAttribute, stopTelemetry, rootSpan } from '../../initTelemetry.js';\nimport { createBundleRequestForPackage } from './createBundleRequestForPackage.js';\nimport { createBundleTask } from './createBundleTask.js';\nimport { mergeFeatures } from './mergeFeatures.js';\nimport { yellow } from '@ms-cloudpack/task-reporter';\nimport type { TaskContext } from '../../types/TaskContext.js';\n\nasync function createAppBundleTask(session: Session, packageName: string, features?: Features) {\n const packageEntry = findResolveMapEntry({\n packageName,\n resolveMap: session.resolveMap,\n });\n\n if (!packageEntry) {\n throw new Error(`Could not find package ${packageName} in the resolve map.`);\n }\n const bundleRequest = await createBundleRequestForPackage(packageEntry, features);\n\n return createBundleTask(bundleRequest);\n}\n\n/**\n * Defines the \"start\" verb entry point.\n */\nexport async function start(options: StartOptions, { reporter, appPath, config }: TaskContext) {\n try {\n // Parse config if it exists.\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: options.features,\n });\n\n const featureNames = Object.keys(config.features);\n\n if (featureNames.length) {\n console.log(`Enabled features: ${featureNames.map((f) => yellow(f)).join(', ')}`);\n }\n\n // Initialize package overrides.\n PackageDefinitions.getInstance().registerTransform(createPackageOverrideTransform(config));\n\n // Make sure the package has a valid definition.\n const definition = await PackageDefinitions.getInstance().get(appPath);\n\n if (!definition) {\n throw new Error(`There was no package.json located at \"${appPath}\".`);\n }\n\n if (!definition.name || !definition.version) {\n throw new Error(`The package.json at \"${appPath}\" did not have a name and/or version.`);\n }\n\n // Initialize session definition.\n const session = await createSession({ config, reporter, appPath });\n\n // Set shared telemetry attributes which will be sent with all telemetry events.\n setSharedTelemetryAttribute('sessionId', session.id);\n\n if (options.logResolveMap) {\n // Write the resolve map to disk.\n await writeJson(path.join(appPath, 'resolve-map.json'), session.resolveMap);\n }\n\n const { startApiServer } = await import('@ms-cloudpack/api-server');\n\n // Start api server for tracking status and handling remote requests.\n const apiServer = await startApiServer({\n session,\n rootSpan,\n reporter,\n appPath,\n });\n\n // Kick off bundling app package as soon as api server is ready.\n void apiServer.addTask(await createAppBundleTask(session, definition.name, config.features));\n\n // Then start bundle and app servers for hosting the app.\n const { startBundleServer } = await import('./startBundleServer.js');\n const bundleServer = await startBundleServer({ session, apiServer, reporter });\n\n const { startAppServer } = await import('./appServer/startAppServer.js');\n const appServer = await startAppServer({\n session,\n definition,\n bundleServer,\n apiServer,\n config,\n reporter,\n });\n\n const cleanup = async () => {\n for (const [name, server] of [\n ['appServer', appServer] as const,\n ['apiServer', apiServer] as const,\n ['bundleServer', bundleServer] as const,\n ]) {\n console.info(`Closing ${name}: ${server.url}`);\n try {\n await server.close();\n } catch (err) {\n console.warn('Error closing server:', err);\n }\n }\n\n // Complete the reporting and list pending tasks as aborted.\n reporter.complete();\n\n // Flush and close telemetry.\n await stopTelemetry();\n };\n\n // Setup cleanup and close things on completion.\n let sigintCount = 0;\n\n process.on('SIGINT', () => {\n sigintCount++;\n if (sigintCount > 1) {\n console.debug('Forcing exit');\n process.exit(1);\n }\n\n cleanup().finally(() => {\n process.exit(0);\n });\n });\n\n // Open the browser.\n const url = appServer.url;\n\n performance.measure(PerfMeasurementOpenBrowser, PerfMarkerCliEntry);\n openBrowser(url).catch((err) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n console.warn('Error opening browser:', err?.stack || err);\n console.warn('Please open the browser manually to:', url);\n });\n } catch (err) {\n console.error(err);\n reporter.complete();\n process.exit(1);\n }\n}\n"]}
|
|
@@ -2,7 +2,7 @@ import { isExternalPackage, PackageDefinitions } from '@ms-cloudpack/package-uti
|
|
|
2
2
|
import hash from 'object-hash';
|
|
3
3
|
import filenamify from 'filenamify';
|
|
4
4
|
import path from 'path';
|
|
5
|
-
import { getCachePath } from '
|
|
5
|
+
import { getCachePath } from '@ms-cloudpack/api-server';
|
|
6
6
|
export async function getBundleDetails(packagePath) {
|
|
7
7
|
const definition = await PackageDefinitions.getInstance().get(packagePath);
|
|
8
8
|
if (!definition) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getBundleDetails.js","sourceRoot":"","sources":["../../src/common/getBundleDetails.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACxF,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"getBundleDetails.js","sourceRoot":"","sources":["../../src/common/getBundleDetails.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACxF,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,WAAmB;IACxD,MAAM,UAAU,GAAG,MAAM,kBAAkB,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAE3E,IAAI,CAAC,UAAU,EAAE;QACf,MAAM,IAAI,KAAK,CAAC,4DAA4D,WAAW,GAAG,CAAC,CAAC;KAC7F;IAED,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC;IAElD,IAAI,CAAC,WAAW,EAAE;QAChB,MAAM,IAAI,KAAK,CAAC,sDAAsD,WAAW,GAAG,CAAC,CAAC;KACvF;IAED,MAAM,UAAU,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAClD,MAAM,QAAQ,GAAG,IAAI,CAAC;QACpB,IAAI,EAAE,WAAW;QACjB,GAAG,UAAU;QACb,OAAO,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,WAAW;KAC7D,CAAC,CAAC;IAEH,qCAAqC;IACrC,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,GAAG,UAAU,CAAC,WAAW,CAAC,IAAI,OAAO,IAAI,QAAQ,EAAE,CAAC,CAAC;IAElG,OAAO;QACL,QAAQ;QACR,UAAU;QACV,UAAU;KACX,CAAC;AACJ,CAAC","sourcesContent":["import { isExternalPackage, PackageDefinitions } from '@ms-cloudpack/package-utilities';\nimport hash from 'object-hash';\nimport filenamify from 'filenamify';\nimport path from 'path';\nimport { getCachePath } from '@ms-cloudpack/api-server';\n\nexport async function getBundleDetails(packagePath: string) {\n const definition = await PackageDefinitions.getInstance().get(packagePath);\n\n if (!definition) {\n throw new Error(`Package definition (package.json) missing or invalid at \"${packagePath}\"`);\n }\n\n const { name: packageName, version } = definition;\n\n if (!packageName) {\n throw new Error(`Package definition (package.json) missing name at \"${packagePath}\"`);\n }\n\n const isExternal = isExternalPackage(packagePath);\n const bundleId = hash({\n name: packageName,\n ...definition,\n version: (isExternal ? version : packagePath) || packagePath,\n });\n\n // Derive where the output should be.\n const outputPath = path.join(getCachePath(), `${filenamify(packageName)}-${version}-${bundleId}`);\n\n return {\n bundleId,\n isExternal,\n outputPath,\n };\n}\n"]}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Entry point for the cloudpack CLI.
|
|
3
|
-
* within the "./commands" folder.
|
|
2
|
+
* Entry point for the cloudpack CLI.
|
|
3
|
+
* Resolves all commands defined within the "./commands" folder.
|
|
4
4
|
*/
|
|
5
5
|
export declare function main(): Promise<void>;
|
|
6
|
-
export type { ApiServer, DevServer, SessionStats, Task, TaskDescription, TaskEndDescription, TaskError, TaskOptions, TaskStartDescription, } from '@ms-cloudpack/api-server';
|
|
7
|
-
export type { CloudpackConfig, Route, TelemetryConfig } from '@ms-cloudpack/config';
|
|
8
|
-
export type { BundleRequest } from './types/BundleRequest.js';
|
|
9
|
-
export type { BundleServer } from './types/BundleServer.js';
|
|
10
|
-
export type { BundleTaskOptions } from './types/BundleTaskOptions.js';
|
|
11
|
-
export type { CreateHtmlFunction } from './types/CreateHtmlFunction.js';
|
|
12
|
-
export type { CreateHtmlOptions } from './types/CreateHtmlOptions.js';
|
|
13
|
-
export type { CreateHtmlResult } from './types/CreateHtmlResult.js';
|
|
14
|
-
export type { CreateHtmlScript } from './types/CreateHtmlScript.js';
|
|
15
|
-
export type { Watcher } from './types/Watcher.js';
|
|
16
6
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAoBA;;;GAGG;AACH,wBAAsB,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAoBA;;;GAGG;AACH,wBAAsB,IAAI,kBAsEzB"}
|
package/lib/index.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { PackageDefinitions, getVersion } from '@ms-cloudpack/package-utilities';
|
|
2
|
-
import { bold, debugLoggingConfig, defaultLoggingConfig, gradient, verboseLoggingConfig, } from '@ms-cloudpack/task-reporter';
|
|
2
|
+
import { TaskReporter, bold, debugLoggingConfig, defaultLoggingConfig, gradient, verboseLoggingConfig, } from '@ms-cloudpack/task-reporter';
|
|
3
3
|
import { Command } from 'commander';
|
|
4
4
|
import glob from 'glob';
|
|
5
5
|
import path from 'path';
|
|
6
6
|
import { fileURLToPath, pathToFileURL } from 'url';
|
|
7
7
|
import { initTelemetry, setSharedTelemetryAttributes } from './initTelemetry.js';
|
|
8
8
|
import { PerfMarkerCliEntry } from './performance/markers.js';
|
|
9
|
-
import { initReporter } from './initReporter.js';
|
|
10
9
|
import { readConfig } from '@ms-cloudpack/config';
|
|
11
10
|
const currentPath = path.dirname(fileURLToPath(import.meta.url));
|
|
12
11
|
/**
|
|
13
|
-
* Entry point for the cloudpack CLI.
|
|
14
|
-
* within the "./commands" folder.
|
|
12
|
+
* Entry point for the cloudpack CLI.
|
|
13
|
+
* Resolves all commands defined within the "./commands" folder.
|
|
15
14
|
*/
|
|
16
15
|
export async function main() {
|
|
17
16
|
performance.mark(PerfMarkerCliEntry);
|
|
@@ -23,8 +22,9 @@ export async function main() {
|
|
|
23
22
|
const verb = process.argv[2];
|
|
24
23
|
const useVerboseLogging = process.argv.includes('--verbose') || process.argv.includes('-v') || verb === 'bundle';
|
|
25
24
|
program.name(productName).version(version).usage('<command> [options]');
|
|
26
|
-
const
|
|
27
|
-
const
|
|
25
|
+
const appPath = process.cwd();
|
|
26
|
+
const config = await readConfig(appPath);
|
|
27
|
+
const reporter = new TaskReporter();
|
|
28
28
|
reporter.setOptions({
|
|
29
29
|
productName,
|
|
30
30
|
version,
|
|
@@ -38,9 +38,9 @@ export async function main() {
|
|
|
38
38
|
await initTelemetry({
|
|
39
39
|
useDebugLogging,
|
|
40
40
|
useVerboseLogging,
|
|
41
|
+
telemetryConfig: config.telemetry,
|
|
41
42
|
}, reporter);
|
|
42
43
|
// Make sure the package has a valid definition.
|
|
43
|
-
const appPath = process.cwd();
|
|
44
44
|
const definition = await PackageDefinitions.getInstance().get(appPath);
|
|
45
45
|
if (!definition) {
|
|
46
46
|
throw new Error(`There was no package.json located at "${appPath}".`);
|
|
@@ -54,7 +54,7 @@ export async function main() {
|
|
|
54
54
|
const commands = glob.sync('commands/*/index.js', { cwd: currentPath });
|
|
55
55
|
for (const commandPath of commands) {
|
|
56
56
|
const commandFunction = (await import(pathToFileURL(path.resolve(currentPath, commandPath)).toString()));
|
|
57
|
-
commandFunction.init({
|
|
57
|
+
commandFunction.init(program, { reporter, appPath, config });
|
|
58
58
|
}
|
|
59
59
|
program.option('-v, --verbose', 'Show additional details about the running tasks. (default: false)');
|
|
60
60
|
program.option('-d, --debug', 'Show debug information (superset of --verbose). (default: false)');
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AACjF,OAAO,EACL,IAAI,EACJ,kBAAkB,EAClB,oBAAoB,EACpB,QAAQ,EACR,oBAAoB,GACrB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AACjF,OAAO,EACL,YAAY,EACZ,IAAI,EACJ,kBAAkB,EAClB,oBAAoB,EACpB,QAAQ,EACR,oBAAoB,GACrB,MAAM,6BAA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AAC,OAAO;QACpE,OAAO,EAAE,UAAU,CAAC,IAAI,IAAI,UAAU;KACvC,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC,CAAC;IAExE,KAAK,MAAM,WAAW,IAAI,QAAQ,EAAE;QAClC,MAAM,eAAe,GAAG,CAAC,MAAM,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAEtG,CAAC;QAEF,eAAe,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;KAC9D;IAED,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,mEAAmE,CAAC,CAAC;IACrG,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,kEAAkE,CAAC,CAAC;IAClG,OAAO,CAAC,MAAM,CAAC,gBAAgB,EAAE,gDAAgD,CAAC,CAAC;IAEnF,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5B,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;QAC7B,OAAO,CAAC,IAAI,EAAE,CAAC;KAChB;AACH,CAAC","sourcesContent":["import { PackageDefinitions, getVersion } from '@ms-cloudpack/package-utilities';\nimport {\n TaskReporter,\n bold,\n debugLoggingConfig,\n defaultLoggingConfig,\n gradient,\n verboseLoggingConfig,\n} from '@ms-cloudpack/task-reporter';\nimport { Command } from 'commander';\nimport glob from 'glob';\nimport path from 'path';\nimport { fileURLToPath, pathToFileURL } from 'url';\nimport { initTelemetry, setSharedTelemetryAttributes } from './initTelemetry.js';\nimport { PerfMarkerCliEntry } from './performance/markers.js';\nimport { readConfig } from '@ms-cloudpack/config';\nimport type { CommandFunction } from './types/CommandFunction.js';\n\nconst currentPath = path.dirname(fileURLToPath(import.meta.url));\n\n/**\n * Entry point for the cloudpack CLI.\n * Resolves all commands defined within the \"./commands\" folder.\n */\nexport async function main() {\n performance.mark(PerfMarkerCliEntry);\n\n const program = new Command();\n const plainTextMode = process.argv.includes('--no-color') || process.argv.includes('-n');\n const version = getVersion(import.meta.url);\n const productName = gradient(`Cloudpack`);\n const useDebugLogging = process.argv.includes('--debug') || process.argv.includes('-d');\n const verb = process.argv[2];\n const useVerboseLogging = process.argv.includes('--verbose') || process.argv.includes('-v') || verb === 'bundle';\n\n program.name(productName).version(version).usage('<command> [options]');\n\n const appPath = process.cwd();\n const config = await readConfig(appPath);\n const reporter = new TaskReporter();\n\n reporter.setOptions({\n productName,\n version,\n plainTextMode,\n description: `Running \"${bold(process.argv.slice(2).join(' '))}\"`,\n helpMessage: config.helpMessage,\n ...defaultLoggingConfig,\n ...(useVerboseLogging && verboseLoggingConfig),\n ...(useDebugLogging && debugLoggingConfig),\n });\n\n await initTelemetry(\n {\n useDebugLogging,\n useVerboseLogging,\n telemetryConfig: config.telemetry,\n },\n reporter,\n );\n\n // Make sure the package has a valid definition.\n const definition = await PackageDefinitions.getInstance().get(appPath);\n\n if (!definition) {\n throw new Error(`There was no package.json located at \"${appPath}\".`);\n }\n\n setSharedTelemetryAttributes({\n verb,\n arguments: process.argv.slice(3).join(' '),\n environment: process.env.CI || process.env.TF_BUILD ? 'ci' : 'local',\n appName: definition.name || '<unkown>',\n });\n\n const commands = glob.sync('commands/*/index.js', { cwd: currentPath });\n\n for (const commandPath of commands) {\n const commandFunction = (await import(pathToFileURL(path.resolve(currentPath, commandPath)).toString())) as {\n init: CommandFunction;\n };\n\n commandFunction.init(program, { reporter, appPath, config });\n }\n\n program.option('-v, --verbose', 'Show additional details about the running tasks. (default: false)');\n program.option('-d, --debug', 'Show debug information (superset of --verbose). (default: false)');\n program.option('-n, --no-color', 'Disable colors in the output. (default: false)');\n\n program.parse(process.argv);\n\n if (program.args.length === 0) {\n program.help();\n }\n}\n"]}
|
package/lib/initTelemetry.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { type TelemetryConfig } from '@ms-cloudpack/config';
|
|
1
2
|
import { type Span } from '@ms-cloudpack/telemetry';
|
|
2
3
|
import type { TaskReporter } from '@ms-cloudpack/task-reporter';
|
|
3
4
|
export interface TelemetryInitOptions {
|
|
4
5
|
useDebugLogging: boolean;
|
|
5
6
|
useVerboseLogging: boolean;
|
|
7
|
+
telemetryConfig: TelemetryConfig | undefined;
|
|
6
8
|
}
|
|
7
9
|
export declare let rootSpan: Span | undefined;
|
|
8
10
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initTelemetry.d.ts","sourceRoot":"","sources":["../src/initTelemetry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"initTelemetry.d.ts","sourceRoot":"","sources":["../src/initTelemetry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,EAAE,KAAK,IAAI,EAA+C,MAAM,yBAAyB,CAAC;AAEjG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,MAAM,WAAW,oBAAoB;IACnC,eAAe,EAAE,OAAO,CAAC;IACzB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,eAAe,EAAE,eAAe,GAAG,SAAS,CAAC;CAC9C;AAGD,eAAO,IAAI,QAAQ,EAAE,IAAI,GAAG,SAAS,CAAC;AAEtC;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,YAAY,iBAwB5F;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAI9E;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAErE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,8BAG5B"}
|
package/lib/initTelemetry.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {} from '@ms-cloudpack/config';
|
|
2
2
|
import { getVersion } from '@ms-cloudpack/package-utilities';
|
|
3
3
|
import { createTelemetryClient } from '@ms-cloudpack/telemetry';
|
|
4
4
|
import { registerPerformanceObservers } from './performance/registerPerformanceObservers.js';
|
|
@@ -11,7 +11,7 @@ export let rootSpan;
|
|
|
11
11
|
* @returns
|
|
12
12
|
*/
|
|
13
13
|
export async function initTelemetry(options, taskReporter) {
|
|
14
|
-
const instrumentationKey =
|
|
14
|
+
const instrumentationKey = options.telemetryConfig?.instrumentationKey || process.env.CLOUDPACK_TELEMETRY_INSTRUMENTATION_KEY;
|
|
15
15
|
const logLevel = options.useVerboseLogging ? 'VERBOSE' : options.useDebugLogging ? 'DEBUG' : undefined;
|
|
16
16
|
if (!options.useDebugLogging) {
|
|
17
17
|
taskReporter.ignoreLogMessage('ApplicationInsights:');
|
package/lib/initTelemetry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initTelemetry.js","sourceRoot":"","sources":["../src/initTelemetry.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"initTelemetry.js","sourceRoot":"","sources":["../src/initTelemetry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAmC,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACjG,OAAO,EAAE,4BAA4B,EAAE,MAAM,+CAA+C,CAAC;AAS7F,IAAI,eAA4C,CAAC;AACjD,MAAM,CAAC,IAAI,QAA0B,CAAC;AAEtC;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAA6B,EAAE,YAA0B;IAC3F,MAAM,kB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;AACrC,CAAC","sourcesContent":["import { type TelemetryConfig } from '@ms-cloudpack/config';\nimport { getVersion } from '@ms-cloudpack/package-utilities';\nimport { type Span, type TelemetryClient, createTelemetryClient } from '@ms-cloudpack/telemetry';\nimport { registerPerformanceObservers } from './performance/registerPerformanceObservers.js';\nimport type { TaskReporter } from '@ms-cloudpack/task-reporter';\n\nexport interface TelemetryInitOptions {\n useDebugLogging: boolean;\n useVerboseLogging: boolean;\n telemetryConfig: TelemetryConfig | undefined;\n}\n\nlet telemetryClient: TelemetryClient | undefined;\nexport let rootSpan: Span | undefined;\n\n/**\n * Initialize the telemetry client, create the root span, register performance observers.\n * Telemetry will not be sent if no instrumentation key is found.\n * @param options - options to initialize telemetry\n * @returns\n */\nexport async function initTelemetry(options: TelemetryInitOptions, taskReporter: TaskReporter) {\n const instrumentationKey =\n options.telemetryConfig?.instrumentationKey || process.env.CLOUDPACK_TELEMETRY_INSTRUMENTATION_KEY;\n\n const logLevel = options.useVerboseLogging ? 'VERBOSE' : options.useDebugLogging ? 'DEBUG' : undefined;\n if (!options.useDebugLogging) {\n taskReporter.ignoreLogMessage('ApplicationInsights:');\n }\n\n telemetryClient = await createTelemetryClient({\n productVersion: getVersion(import.meta.url),\n instrumentationKey,\n logLevel,\n serviceNamespace: 'cloudpack',\n serviceName: 'cli',\n });\n\n // This is the root span for the CLI. It will be used to track the duration of the CLI execution.\n rootSpan = telemetryClient.getTracer()?.startSpan('CLI');\n\n if (rootSpan) {\n // Register performance observers to track performance metrics as events of CLI span.\n registerPerformanceObservers(rootSpan);\n }\n}\n\n/**\n * Adds shared attributes to all spans.\n * No-op if telemetry is not initialized.\n * @param attributes - key-value pair\n */\nexport function setSharedTelemetryAttributes(attributes: Record<string, string>) {\n for (const [key, value] of Object.entries(attributes)) {\n telemetryClient?.setSharedSpanAttribute(key, value);\n }\n}\n\n/**\n * Adds a shared attribute to all spans.\n * No-op if telemetry is not initialized.\n * @param key - key of the attribute\n * @param value - value of the attribute\n */\nexport function setSharedTelemetryAttribute(key: string, value: string) {\n telemetryClient?.setSharedSpanAttribute(key, value);\n}\n\n/**\n * Ends rootSpan and flushes all telemetry.\n * No-op if telemetry is not initialized.\n * @returns a promise that resolves when telemetry is flushed and shutdown.\n */\nexport function stopTelemetry() {\n rootSpan?.end();\n return telemetryClient?.shutdown();\n}\n"]}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { type ResolveMap, type PackageDefinitions } from '@ms-cloudpack/package-utilities';
|
|
2
|
-
import {
|
|
2
|
+
import type { TaskContext } from '../types/TaskContext.js';
|
|
3
3
|
/**
|
|
4
4
|
* Resolves the locations of dependencies and returns the resolve map, logging results
|
|
5
5
|
* to the task reporter.
|
|
6
6
|
*/
|
|
7
|
-
export declare function resolveDependenciesTask(
|
|
8
|
-
appPath: string;
|
|
7
|
+
export declare function resolveDependenciesTask(options: {
|
|
9
8
|
additionalPaths?: string[];
|
|
10
9
|
linkedPaths?: string[];
|
|
11
10
|
packages?: PackageDefinitions;
|
|
12
|
-
},
|
|
13
|
-
reporter: TaskReporter;
|
|
14
|
-
}): Promise<ResolveMap | undefined>;
|
|
11
|
+
}, context: TaskContext): Promise<ResolveMap>;
|
|
15
12
|
//# sourceMappingURL=resolveDependenciesTask.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveDependenciesTask.d.ts","sourceRoot":"","sources":["../../src/tasks/resolveDependenciesTask.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,UAAU,EAGf,KAAK,kBAAkB,EACxB,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"resolveDependenciesTask.d.ts","sourceRoot":"","sources":["../../src/tasks/resolveDependenciesTask.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,UAAU,EAGf,KAAK,kBAAkB,EACxB,MAAM,iCAAiC,CAAC;AAGzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D;;;GAGG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE;IACP,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,QAAQ,CAAC,EAAE,kBAAkB,CAAC;CAC/B,EACD,OAAO,EAAE,WAAW,uBAsCrB"}
|
|
@@ -5,13 +5,15 @@ import { PerfMarkerCliEntry, PerfMeasurementTimeToResolveDependencies } from '..
|
|
|
5
5
|
* Resolves the locations of dependencies and returns the resolve map, logging results
|
|
6
6
|
* to the task reporter.
|
|
7
7
|
*/
|
|
8
|
-
export async function resolveDependenciesTask(
|
|
8
|
+
export async function resolveDependenciesTask(options, context) {
|
|
9
|
+
const { additionalPaths, linkedPaths, packages } = options;
|
|
10
|
+
const { reporter, appPath } = context;
|
|
9
11
|
let resolveMap;
|
|
10
12
|
if (performance.getEntriesByName(PerfMarkerCliEntry).length) {
|
|
11
13
|
performance.measure(PerfMeasurementTimeToResolveDependencies, PerfMarkerCliEntry);
|
|
12
14
|
}
|
|
13
15
|
// Grab the installed dependency locations.
|
|
14
|
-
await reporter
|
|
16
|
+
await reporter.runTask('Resolving dependencies', async () => {
|
|
15
17
|
resolveMap = await createResolveMap({
|
|
16
18
|
appPath,
|
|
17
19
|
additionalPaths,
|
|
@@ -28,6 +30,7 @@ export async function resolveDependenciesTask({ appPath, additionalPaths, linked
|
|
|
28
30
|
forceShow: true,
|
|
29
31
|
};
|
|
30
32
|
});
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- will be defined after the task runs
|
|
31
34
|
return resolveMap;
|
|
32
35
|
}
|
|
33
36
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveDependenciesTask.js","sourceRoot":"","sources":["../../src/tasks/resolveDependenciesTask.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,gBAAgB,GAGjB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE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,CAAC,EAAE;QACpD,QAAQ,CAAC,YAAY,CAAC,CAAC;QAEvB,IAAI,YAAY,CAAC,cAAc,EAAE;YAC/B,KAAK,MAAM,WAAW,IAAI,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,cAAc,CAAC,EAAE;gBACpE,QAAQ,CAAC,WAAW,CAAC,CAAC;aACvB;SACF;KACF;IAED,OAAO;QACL,WAAW;QACX,kBAAkB;KACnB,CAAC;AACJ,CAAC","sourcesContent":["import {\n type ResolveMap,\n createResolveMap,\n type ResolveMapEntry,\n type PackageDefinitions,\n} from '@ms-cloudpack/package-utilities';\nimport { cyan, yellow, bulletedList, bold } from '@ms-cloudpack/task-reporter';\nimport { PerfMarkerCliEntry, PerfMeasurementTimeToResolveDependencies } from '../performance/markers.js';\nimport type { TaskContext } from '../types/TaskContext.js';\n\n/**\n * Resolves the locations of dependencies and returns the resolve map, logging results\n * to the task reporter.\n */\nexport async function resolveDependenciesTask(\n options: {\n additionalPaths?: string[];\n linkedPaths?: string[];\n packages?: PackageDefinitions;\n },\n context: TaskContext,\n) {\n const { additionalPaths, linkedPaths, packages } = options;\n const { reporter, appPath } = context;\n let resolveMap: ResolveMap | undefined;\n\n if (performance.getEntriesByName(PerfMarkerCliEntry).length) {\n performance.measure(PerfMeasurementTimeToResolveDependencies, PerfMarkerCliEntry);\n }\n // Grab the installed dependency locations.\n await reporter.runTask('Resolving dependencies', async () => {\n resolveMap = await createResolveMap({\n appPath,\n additionalPaths,\n linkedPaths,\n useStrictVersioning: false,\n packages,\n });\n\n const { allPackages, duplicatedPackages } = getPackagesFromResolveMap(resolveMap);\n const message = `Found ${cyan(allPackages.size)} total packages, ${\n duplicatedPackages.size ? `${yellow(duplicatedPackages.size)} with multiple versions.` : `no duplicates.`\n }`;\n const extended = bulletedList(\n Array.from(duplicatedPackages.entries()).map(\n ([name, versions]) => `${bold(name)}: ${Array.from(versions).join(', ')}`,\n ),\n );\n\n return {\n message,\n extended,\n forceShow: true,\n };\n });\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- will be defined after the task runs\n return resolveMap!;\n}\n\n/**\n * Given a resolveMap, returns a map of all packages and a map of packages with multiple versions.\n * This is used to log the results of the resolve task.\n */\nfunction getPackagesFromResolveMap(resolveMap: ResolveMap) {\n const allPackages = new Map<string, ResolveMapEntry>();\n const duplicatedPackages = new Map<string, Set<string>>();\n\n function addEntry(entry: ResolveMapEntry) {\n if (allPackages.has(entry.name)) {\n if (!duplicatedPackages.has(entry.name)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n duplicatedPackages.set(entry.name, new Set([allPackages.get(entry.name)!.version]));\n }\n const dupeSet = duplicatedPackages.get(entry.name);\n\n dupeSet?.add(entry.version);\n } else {\n allPackages.set(entry.name, entry);\n }\n }\n\n for (const currentEntry of Object.values(resolveMap)) {\n addEntry(currentEntry);\n\n if (currentEntry.scopedVersions) {\n for (const scopedEntry of Object.values(currentEntry.scopedVersions)) {\n addEntry(scopedEntry);\n }\n }\n }\n\n return {\n allPackages,\n duplicatedPackages,\n };\n}\n"]}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import type { TaskReporter } from '@ms-cloudpack/task-reporter';
|
|
2
1
|
import type { Command } from 'commander';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
reporter: TaskReporter;
|
|
6
|
-
}) => void;
|
|
2
|
+
import type { TaskContext } from './TaskContext.js';
|
|
3
|
+
export type CommandFunction = (command: Command, context: TaskContext) => void;
|
|
7
4
|
//# sourceMappingURL=CommandFunction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandFunction.d.ts","sourceRoot":"","sources":["../../src/types/CommandFunction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"CommandFunction.d.ts","sourceRoot":"","sources":["../../src/types/CommandFunction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandFunction.js","sourceRoot":"","sources":["../../src/types/CommandFunction.ts"],"names":[],"mappings":"","sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"CommandFunction.js","sourceRoot":"","sources":["../../src/types/CommandFunction.ts"],"names":[],"mappings":"","sourcesContent":["import type { Command } from 'commander';\nimport type { TaskContext } from './TaskContext.js';\n\nexport type CommandFunction = (command: Command, context: TaskContext) => void;\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CloudpackConfig } from '@ms-cloudpack/config';
|
|
2
|
+
import type { TaskReporter } from '@ms-cloudpack/task-reporter';
|
|
3
|
+
export interface TaskContext {
|
|
4
|
+
reporter: TaskReporter;
|
|
5
|
+
appPath: string;
|
|
6
|
+
config: CloudpackConfig;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=TaskContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TaskContext.d.ts","sourceRoot":"","sources":["../../src/types/TaskContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,eAAe,CAAC;CACzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TaskContext.js","sourceRoot":"","sources":["../../src/types/TaskContext.ts"],"names":[],"mappings":"","sourcesContent":["import type { CloudpackConfig } from '@ms-cloudpack/config';\nimport type { TaskReporter } from '@ms-cloudpack/task-reporter';\n\nexport interface TaskContext {\n reporter: TaskReporter;\n appPath: string;\n config: CloudpackConfig;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/cli",
|
|
3
|
-
"version": "0.39.
|
|
3
|
+
"version": "0.39.14",
|
|
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,9 +10,9 @@
|
|
|
10
10
|
"cloudpack": "./bin/cloudpack.js"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@ms-cloudpack/api-server": "^0.6.
|
|
13
|
+
"@ms-cloudpack/api-server": "^0.6.18",
|
|
14
14
|
"@ms-cloudpack/bundler": "^0.13.3",
|
|
15
|
-
"@ms-cloudpack/config": "^0.7.
|
|
15
|
+
"@ms-cloudpack/config": "^0.7.5",
|
|
16
16
|
"@ms-cloudpack/create-express-app": "^1.3.7",
|
|
17
17
|
"@ms-cloudpack/data-bus": "^0.3.0",
|
|
18
18
|
"@ms-cloudpack/json-utilities": "^0.0.6",
|
|
@@ -51,7 +51,6 @@
|
|
|
51
51
|
"@types/ws": "^8.5.4"
|
|
52
52
|
},
|
|
53
53
|
"scripts": {
|
|
54
|
-
"api": "cloudpack-scripts api",
|
|
55
54
|
"build:watch": "cloudpack-scripts build-watch",
|
|
56
55
|
"build": "cloudpack-scripts build",
|
|
57
56
|
"lint:update": "cloudpack-scripts lint-update",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getCachePath.d.ts","sourceRoot":"","sources":["../../src/common/getCachePath.ts"],"names":[],"mappings":"AAGA,wBAAgB,YAAY,WAE3B;AAED,wBAAgB,iBAAiB,CAAC,OAAO,CAAC,EAAE,MAAM,UAEjD"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import os from 'os';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
export function getCachePath() {
|
|
4
|
-
return path.join(os.homedir(), '.cloudpack');
|
|
5
|
-
}
|
|
6
|
-
export function getLocalCachePath(appPath) {
|
|
7
|
-
return path.join(appPath ?? process.cwd(), 'node_modules', '.cache', 'cloudpack');
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=getCachePath.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getCachePath.js","sourceRoot":"","sources":["../../src/common/getCachePath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,UAAU,YAAY;IAC1B,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,YAAY,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,OAAgB;IAChD,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;AACpF,CAAC","sourcesContent":["import os from 'os';\nimport path from 'path';\n\nexport function getCachePath() {\n return path.join(os.homedir(), '.cloudpack');\n}\n\nexport function getLocalCachePath(appPath?: string) {\n return path.join(appPath ?? process.cwd(), 'node_modules', '.cache', 'cloudpack');\n}\n"]}
|
package/lib/initReporter.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { TaskReporter } from '@ms-cloudpack/task-reporter';
|
|
2
|
-
export declare function initReporter(): TaskReporter;
|
|
3
|
-
export { noLoggingConfig, defaultLoggingConfig, verboseLoggingConfig, debugLoggingConfig, } from '@ms-cloudpack/task-reporter';
|
|
4
|
-
//# sourceMappingURL=initReporter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"initReporter.d.ts","sourceRoot":"","sources":["../src/initReporter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,wBAAgB,YAAY,iBAI3B;AAED,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,6BAA6B,CAAC"}
|
package/lib/initReporter.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { TaskReporter } from '@ms-cloudpack/task-reporter';
|
|
2
|
-
export function initReporter() {
|
|
3
|
-
const reporter = new TaskReporter();
|
|
4
|
-
return reporter;
|
|
5
|
-
}
|
|
6
|
-
export { noLoggingConfig, defaultLoggingConfig, verboseLoggingConfig, debugLoggingConfig, } from '@ms-cloudpack/task-reporter';
|
|
7
|
-
//# sourceMappingURL=initReporter.js.map
|
package/lib/initReporter.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"initReporter.js","sourceRoot":"","sources":["../src/initReporter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,MAAM,UAAU,YAAY;IAC1B,MAAM,QAAQ,GAAG,IAAI,YAAY,EAAE,CAAC;IAEpC,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,6BAA6B,CAAC","sourcesContent":["import { TaskReporter } from '@ms-cloudpack/task-reporter';\n\nexport function initReporter() {\n const reporter = new TaskReporter();\n\n return reporter;\n}\n\nexport {\n noLoggingConfig,\n defaultLoggingConfig,\n verboseLoggingConfig,\n debugLoggingConfig,\n} from '@ms-cloudpack/task-reporter';\n"]}
|