@ms-cloudpack/cli 0.42.0 → 0.42.2

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.
Files changed (100) hide show
  1. package/lib/commands/bundle/bundle.d.ts +1 -1
  2. package/lib/commands/bundle/bundle.d.ts.map +1 -1
  3. package/lib/commands/bundle/bundle.js +6 -4
  4. package/lib/commands/bundle/bundle.js.map +1 -1
  5. package/lib/commands/init/bundleAndGetImports.d.ts.map +1 -1
  6. package/lib/commands/init/bundleAndGetImports.js +3 -12
  7. package/lib/commands/init/bundleAndGetImports.js.map +1 -1
  8. package/lib/commands/init/evaluateImportsForOverrides.d.ts.map +1 -1
  9. package/lib/commands/init/evaluateImportsForOverrides.js +10 -10
  10. package/lib/commands/init/evaluateImportsForOverrides.js.map +1 -1
  11. package/lib/commands/init/init.d.ts.map +1 -1
  12. package/lib/commands/init/init.js +5 -7
  13. package/lib/commands/init/init.js.map +1 -1
  14. package/lib/commands/start/start.d.ts +1 -1
  15. package/lib/commands/start/start.d.ts.map +1 -1
  16. package/lib/commands/start/start.js +7 -7
  17. package/lib/commands/start/start.js.map +1 -1
  18. package/lib/commands/start/startBundleServer.d.ts.map +1 -1
  19. package/lib/commands/start/startBundleServer.js +1 -2
  20. package/lib/commands/start/startBundleServer.js.map +1 -1
  21. package/lib/commands/sync/sync.d.ts +1 -1
  22. package/lib/commands/sync/sync.d.ts.map +1 -1
  23. package/lib/commands/sync/sync.js +17 -4
  24. package/lib/commands/sync/sync.js.map +1 -1
  25. package/lib/index.d.ts.map +1 -1
  26. package/lib/index.js +0 -10
  27. package/lib/index.js.map +1 -1
  28. package/lib/initTelemetry.d.ts +3 -15
  29. package/lib/initTelemetry.d.ts.map +1 -1
  30. package/lib/initTelemetry.js +6 -19
  31. package/lib/initTelemetry.js.map +1 -1
  32. package/lib/setupReporting.d.ts +3 -0
  33. package/lib/setupReporting.d.ts.map +1 -0
  34. package/lib/{commands/start/setupReporting.js → setupReporting.js} +13 -3
  35. package/lib/setupReporting.js.map +1 -0
  36. package/lib/tasks/bundleTaskWorker.js +1 -1
  37. package/lib/tasks/bundleTaskWorker.js.map +1 -1
  38. package/lib/types/Watcher.d.ts +1 -1
  39. package/lib/types/Watcher.d.ts.map +1 -1
  40. package/lib/types/Watcher.js.map +1 -1
  41. package/package.json +4 -8
  42. package/lib/commands/start/createBundleRequestForPackage.d.ts +0 -11
  43. package/lib/commands/start/createBundleRequestForPackage.d.ts.map +0 -1
  44. package/lib/commands/start/createBundleRequestForPackage.js +0 -21
  45. package/lib/commands/start/createBundleRequestForPackage.js.map +0 -1
  46. package/lib/commands/start/createBundleTask.d.ts +0 -10
  47. package/lib/commands/start/createBundleTask.d.ts.map +0 -1
  48. package/lib/commands/start/createBundleTask.js +0 -42
  49. package/lib/commands/start/createBundleTask.js.map +0 -1
  50. package/lib/commands/start/setupReporting.d.ts +0 -3
  51. package/lib/commands/start/setupReporting.d.ts.map +0 -1
  52. package/lib/commands/start/setupReporting.js.map +0 -1
  53. package/lib/commands/sync/Task.d.ts +0 -6
  54. package/lib/commands/sync/Task.d.ts.map +0 -1
  55. package/lib/commands/sync/Task.js +0 -2
  56. package/lib/commands/sync/Task.js.map +0 -1
  57. package/lib/commands/sync/createDownloadTask.d.ts +0 -5
  58. package/lib/commands/sync/createDownloadTask.d.ts.map +0 -1
  59. package/lib/commands/sync/createDownloadTask.js +0 -22
  60. package/lib/commands/sync/createDownloadTask.js.map +0 -1
  61. package/lib/commands/sync/createUploadTask.d.ts +0 -5
  62. package/lib/commands/sync/createUploadTask.d.ts.map +0 -1
  63. package/lib/commands/sync/createUploadTask.js +0 -18
  64. package/lib/commands/sync/createUploadTask.js.map +0 -1
  65. package/lib/commands/sync/getPackagesToSync.d.ts +0 -9
  66. package/lib/commands/sync/getPackagesToSync.d.ts.map +0 -1
  67. package/lib/commands/sync/getPackagesToSync.js +0 -24
  68. package/lib/commands/sync/getPackagesToSync.js.map +0 -1
  69. package/lib/commands/sync/syncInternal.d.ts +0 -10
  70. package/lib/commands/sync/syncInternal.d.ts.map +0 -1
  71. package/lib/commands/sync/syncInternal.js +0 -39
  72. package/lib/commands/sync/syncInternal.js.map +0 -1
  73. package/lib/common/getBundleDetails.d.ts +0 -14
  74. package/lib/common/getBundleDetails.d.ts.map +0 -1
  75. package/lib/common/getBundleDetails.js +0 -35
  76. package/lib/common/getBundleDetails.js.map +0 -1
  77. package/lib/tasks/bundleTask.d.ts +0 -9
  78. package/lib/tasks/bundleTask.d.ts.map +0 -1
  79. package/lib/tasks/bundleTask.js +0 -119
  80. package/lib/tasks/bundleTask.js.map +0 -1
  81. package/lib/tasks/formatBundleErrors.d.ts +0 -9
  82. package/lib/tasks/formatBundleErrors.d.ts.map +0 -1
  83. package/lib/tasks/formatBundleErrors.js +0 -19
  84. package/lib/tasks/formatBundleErrors.js.map +0 -1
  85. package/lib/tasks/getFileSizeSync.d.ts +0 -5
  86. package/lib/tasks/getFileSizeSync.d.ts.map +0 -1
  87. package/lib/tasks/getFileSizeSync.js +0 -16
  88. package/lib/tasks/getFileSizeSync.js.map +0 -1
  89. package/lib/tasks/hashPackage.d.ts +0 -6
  90. package/lib/tasks/hashPackage.d.ts.map +0 -1
  91. package/lib/tasks/hashPackage.js +0 -21
  92. package/lib/tasks/hashPackage.js.map +0 -1
  93. package/lib/types/BundleRequest.d.ts +0 -26
  94. package/lib/types/BundleRequest.d.ts.map +0 -1
  95. package/lib/types/BundleRequest.js +0 -2
  96. package/lib/types/BundleRequest.js.map +0 -1
  97. package/lib/types/BundleTaskOptions.d.ts +0 -4
  98. package/lib/types/BundleTaskOptions.d.ts.map +0 -1
  99. package/lib/types/BundleTaskOptions.js +0 -2
  100. package/lib/types/BundleTaskOptions.js.map +0 -1
package/lib/index.js CHANGED
@@ -4,10 +4,8 @@ import { Command } from 'commander';
4
4
  import glob from 'glob';
5
5
  import path from 'path';
6
6
  import { fileURLToPath, pathToFileURL } from 'url';
7
- import { setSharedTelemetryAttributes } from './initTelemetry.js';
8
7
  import { PerfMarkerCliEntry } from './performance/markers.js';
9
8
  import { readConfig } from '@ms-cloudpack/config';
10
- import { readJson } from '@ms-cloudpack/json-utilities';
11
9
  const currentFilePath = fileURLToPath(import.meta.url);
12
10
  const currentPath = path.dirname(currentFilePath);
13
11
  /**
@@ -22,15 +20,7 @@ export async function main(testOptions) {
22
20
  const config = await readConfig(appPath);
23
21
  const program = new Command();
24
22
  const version = getVersion(import.meta.url);
25
- const verb = argv[2];
26
23
  program.name('cloudpack').version(version).usage('<command> [options]');
27
- const definition = (await readJson(path.join(appPath, 'package.json')));
28
- setSharedTelemetryAttributes({
29
- verb,
30
- arguments: argv.slice(3).join(' '),
31
- environment: process.env.CI || process.env.TF_BUILD ? 'ci' : 'local',
32
- appName: definition?.name || '<unknown>',
33
- });
34
24
  // Ensure the glob works in tests
35
25
  const commandsGlob = `commands/*/index${path.extname(currentFilePath)}`;
36
26
  const commands = glob.sync(commandsGlob, { cwd: currentPath });
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,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,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAGxD,MAAM,eAAe,GAAG,aAAa,CAAC,MA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AC;IAEH,iCAAiC;IACjC,MAAM,YAAY,GAAG,mBAAmB,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC;IACxE,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC,CAAC;IAC/D,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;QACpB,sGAAsG;QACtG,MAAM,IAAI,KAAK,CAAC,4BAA4B,WAAW,IAAI,CAAC,CAAC;KAC9D;IAED,KAAK,MAAM,WAAW,IAAI,QAAQ,EAAE;QAClC,MAAM,eAAe,GAAG,CAAC,MAAM,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAEnG,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,WAAW,EAAE,iBAAiB,EAAE,CAAC,OAAO,CAAC,CAAC;IAE1C,MAAM,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAE/B,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;QAC7B,OAAO,CAAC,IAAI,EAAE,CAAC;KAChB;AACH,CAAC","sourcesContent":["import { getVersion } from '@ms-cloudpack/package-utilities';\nimport { TaskReporter } from '@ms-cloudpack/task-reporter';\nimport { Command } from 'commander';\nimport glob from 'glob';\nimport path from 'path';\nimport { fileURLToPath, pathToFileURL } from 'url';\nimport { setSharedTelemetryAttributes } from './initTelemetry.js';\nimport { PerfMarkerCliEntry } from './performance/markers.js';\nimport { readConfig } from '@ms-cloudpack/config';\nimport type { CommandFunction } from './types/CommandFunction.js';\nimport { readJson } from '@ms-cloudpack/json-utilities';\nimport type { PackageJson } from '@ms-cloudpack/bundler-types';\n\nconst currentFilePath = fileURLToPath(import.meta.url);\nconst currentPath = path.dirname(currentFilePath);\n\n/**\n * Entry point for the cloudpack CLI.\n * Resolves all commands defined within the \"./commands\" folder.\n */\nexport async function main(testOptions?: {\n appPath: string;\n argv: string[];\n reporter: TaskReporter;\n preParseOverrides?: (program: Command) => void;\n}) {\n performance.mark(PerfMarkerCliEntry);\n\n const argv = testOptions?.argv || process.argv;\n const appPath = testOptions?.appPath || process.cwd();\n const reporter = testOptions?.reporter || new TaskReporter();\n const config = await readConfig(appPath);\n\n const program = new Command();\n const version = getVersion(import.meta.url);\n const verb = argv[2];\n\n program.name('cloudpack').version(version).usage('<command> [options]');\n\n const definition = (await readJson(path.join(appPath, 'package.json'))) as PackageJson;\n\n setSharedTelemetryAttributes({\n verb,\n arguments: argv.slice(3).join(' '),\n environment: process.env.CI || process.env.TF_BUILD ? 'ci' : 'local',\n appName: definition?.name || '<unknown>',\n });\n\n // Ensure the glob works in tests\n const commandsGlob = `commands/*/index${path.extname(currentFilePath)}`;\n const commands = glob.sync(commandsGlob, { cwd: currentPath });\n if (!commands.length) {\n // There was an issue with the glob above not working in tests, so make sure that doesn't happen again\n throw new Error(`No commands found under \"${currentPath}\".`);\n }\n\n for (const commandPath of commands) {\n const commandFunction = (await import(pathToFileURL(path.join(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 testOptions?.preParseOverrides?.(program);\n\n await program.parseAsync(argv);\n\n if (program.args.length === 0) {\n program.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qBAAqB,CAAC,CAAC;IAExE,iCAAiC;IACjC,MAAM,YAAY,GAAG,mBAAmB,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC;IACxE,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC,CAAC;IAC/D,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;QACpB,sGAAsG;QACtG,MAAM,IAAI,KAAK,CAAC,4BAA4B,WAAW,IAAI,CAAC,CAAC;KAC9D;IAED,KAAK,MAAM,WAAW,IAAI,QAAQ,EAAE;QAClC,MAAM,eAAe,GAAG,CAAC,MAAM,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAEnG,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,WAAW,EAAE,iBAAiB,EAAE,CAAC,OAAO,CAAC,CAAC;IAE1C,MAAM,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAE/B,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;QAC7B,OAAO,CAAC,IAAI,EAAE,CAAC;KAChB;AACH,CAAC","sourcesContent":["import { getVersion } from '@ms-cloudpack/package-utilities';\nimport { TaskReporter } from '@ms-cloudpack/task-reporter';\nimport { Command } from 'commander';\nimport glob from 'glob';\nimport path from 'path';\nimport { fileURLToPath, pathToFileURL } from 'url';\nimport { PerfMarkerCliEntry } from './performance/markers.js';\nimport { readConfig } from '@ms-cloudpack/config';\nimport type { CommandFunction } from './types/CommandFunction.js';\n\nconst currentFilePath = fileURLToPath(import.meta.url);\nconst currentPath = path.dirname(currentFilePath);\n\n/**\n * Entry point for the cloudpack CLI.\n * Resolves all commands defined within the \"./commands\" folder.\n */\nexport async function main(testOptions?: {\n appPath: string;\n argv: string[];\n reporter: TaskReporter;\n preParseOverrides?: (program: Command) => void;\n}) {\n performance.mark(PerfMarkerCliEntry);\n\n const argv = testOptions?.argv || process.argv;\n const appPath = testOptions?.appPath || process.cwd();\n const reporter = testOptions?.reporter || new TaskReporter();\n const config = await readConfig(appPath);\n\n const program = new Command();\n const version = getVersion(import.meta.url);\n\n program.name('cloudpack').version(version).usage('<command> [options]');\n\n // Ensure the glob works in tests\n const commandsGlob = `commands/*/index${path.extname(currentFilePath)}`;\n const commands = glob.sync(commandsGlob, { cwd: currentPath });\n if (!commands.length) {\n // There was an issue with the glob above not working in tests, so make sure that doesn't happen again\n throw new Error(`No commands found under \"${currentPath}\".`);\n }\n\n for (const commandPath of commands) {\n const commandFunction = (await import(pathToFileURL(path.join(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 testOptions?.preParseOverrides?.(program);\n\n await program.parseAsync(argv);\n\n if (program.args.length === 0) {\n program.help();\n }\n}\n"]}
@@ -1,10 +1,11 @@
1
1
  import { type TelemetryConfig } from '@ms-cloudpack/config';
2
- import { type Span } from '@ms-cloudpack/telemetry';
2
+ import { type Span, type TelemetryClient } from '@ms-cloudpack/telemetry';
3
3
  import type { TaskReporter } from '@ms-cloudpack/task-reporter';
4
4
  export interface TelemetryInitOptions {
5
5
  useDebugLogging: boolean;
6
6
  useVerboseLogging: boolean;
7
7
  telemetryConfig: TelemetryConfig | undefined;
8
+ sharedSpanAttributes?: Record<string, string>;
8
9
  }
9
10
  export declare let rootSpan: Span | undefined;
10
11
  /**
@@ -13,20 +14,7 @@ export declare let rootSpan: Span | undefined;
13
14
  * @param options - options to initialize telemetry
14
15
  * @returns
15
16
  */
16
- export declare function initTelemetry(options: TelemetryInitOptions, taskReporter: TaskReporter): Promise<void>;
17
- /**
18
- * Adds shared attributes to all spans.
19
- * No-op if telemetry is not initialized.
20
- * @param attributes - key-value pair
21
- */
22
- export declare function setSharedTelemetryAttributes(attributes: Record<string, string>): void;
23
- /**
24
- * Adds a shared attribute to all spans.
25
- * No-op if telemetry is not initialized.
26
- * @param key - key of the attribute
27
- * @param value - value of the attribute
28
- */
29
- export declare function setSharedTelemetryAttribute(key: string, value: string): void;
17
+ export declare function initTelemetry(options: TelemetryInitOptions, taskReporter: TaskReporter): Promise<TelemetryClient>;
30
18
  /**
31
19
  * Ends rootSpan and flushes all telemetry.
32
20
  * No-op if telemetry is not initialized.
@@ -1 +1 @@
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"}
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,EAAE,KAAK,eAAe,EAAyB,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;IAC7C,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/C;AAGD,eAAO,IAAI,QAAQ,EAAE,IAAI,GAAG,SAAS,CAAC;AAEtC;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,YAAY,4BAgC5F;AAED;;;;GAIG;AACH,wBAAgB,aAAa,8BAG5B"}
@@ -23,31 +23,18 @@ export async function initTelemetry(options, taskReporter) {
23
23
  serviceNamespace: 'cloudpack',
24
24
  serviceName: 'cli',
25
25
  });
26
+ if (options.sharedSpanAttributes) {
27
+ for (const [key, value] of Object.entries(options.sharedSpanAttributes)) {
28
+ telemetryClient.setSharedSpanAttribute(key, value);
29
+ }
30
+ }
26
31
  // This is the root span for the CLI. It will be used to track the duration of the CLI execution.
27
32
  rootSpan = telemetryClient.getTracer()?.startSpan('CLI');
28
33
  if (rootSpan) {
29
34
  // Register performance observers to track performance metrics as events of CLI span.
30
35
  registerPerformanceObservers(rootSpan);
31
36
  }
32
- }
33
- /**
34
- * Adds shared attributes to all spans.
35
- * No-op if telemetry is not initialized.
36
- * @param attributes - key-value pair
37
- */
38
- export function setSharedTelemetryAttributes(attributes) {
39
- for (const [key, value] of Object.entries(attributes)) {
40
- telemetryClient?.setSharedSpanAttribute(key, value);
41
- }
42
- }
43
- /**
44
- * Adds a shared attribute to all spans.
45
- * No-op if telemetry is not initialized.
46
- * @param key - key of the attribute
47
- * @param value - value of the attribute
48
- */
49
- export function setSharedTelemetryAttribute(key, value) {
50
- telemetryClient?.setSharedSpanAttribute(key, value);
37
+ return telemetryClient;
51
38
  }
52
39
  /**
53
40
  * Ends rootSpan and flushes all telemetry.
@@ -1 +1 @@
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,kBAAkB,GACtB,OAAO,CAAC,eAAe,EAAE,kBAAkB,IAAI,OAAO,CAAC,GAAG,CAAC,uCAAuC,CAAC;IAErG,MAAM,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;IACvG,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE;QAC5B,YAAY,CAAC,gBAAgB,CAAC,sBAAsB,CAAC,CAAC;KACvD;IAED,eAAe,GAAG,MAAM,qBAAqB,CAAC;QAC5C,cAAc,EAAE,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;QAC3C,kBAAkB;QAClB,QAAQ;QACR,gBAAgB,EAAE,WAAW;QAC7B,WAAW,EAAE,KAAK;KACnB,CAAC,CAAC;IAEH,iGAAiG;IACjG,QAAQ,GAAG,eAAe,CAAC,SAAS,EAAE,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;IAEzD,IAAI,QAAQ,EAAE;QACZ,qFAAqF;QACrF,4BAA4B,CAAC,QAAQ,CAAC,CAAC;KACxC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,4BAA4B,CAAC,UAAkC;IAC7E,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;QACrD,eAAe,EAAE,sBAAsB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;KACrD;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CAAC,GAAW,EAAE,KAAa;IACpE,eAAe,EAAE,sBAAsB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AACtD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa;IAC3B,QAAQ,EAAE,GAAG,EAAE,CAAC;IAChB,OAAO,eAAe,EAAE,QAAQ,EAAE,CAAC;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
+ {"version":3,"file":"initTelemetry.js","sourceRoot":"","sources":["../src/initTelemetry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAA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,CAAC;KACxC;IAED,OAAO,eAAe,CAAC;AACzB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa;IAC3B,QAAQ,EAAE,GAAG,EAAE,CAAC;IAChB,OAAO,eAAe,EAAE,QAAQ,EAAE,CAAC;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 sharedSpanAttributes?: Record<string, string>;\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 if (options.sharedSpanAttributes) {\n for (const [key, value] of Object.entries(options.sharedSpanAttributes)) {\n telemetryClient.setSharedSpanAttribute(key, value);\n }\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 return telemetryClient;\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"]}
@@ -0,0 +1,3 @@
1
+ import type { TaskContext } from './types/TaskContext.js';
2
+ export declare function setupReporting({ reporter, config, appPath }: TaskContext): Promise<import("@ms-cloudpack/telemetry").TelemetryClient>;
3
+ //# sourceMappingURL=setupReporting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setupReporting.d.ts","sourceRoot":"","sources":["../src/setupReporting.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAmB1D,wBAAsB,cAAc,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,WAAW,8DA6B9E"}
@@ -1,12 +1,14 @@
1
1
  import { getVersion } from '@ms-cloudpack/package-utilities';
2
- import { initTelemetry } from '../../initTelemetry.js';
2
+ import { initTelemetry } from './initTelemetry.js';
3
3
  import { bold, defaultLoggingConfig, verboseLoggingConfig, debugLoggingConfig, } from '@ms-cloudpack/task-reporter';
4
+ import { readJson } from '@ms-cloudpack/json-utilities';
5
+ import path from 'path';
4
6
  const { argv } = process;
5
7
  const useDebugLogging = argv.includes('--debug') || argv.includes('-d');
6
8
  const verb = argv[2];
7
9
  const useVerboseLogging = argv.includes('--verbose') || argv.includes('-v') || verb === 'bundle';
8
10
  const version = getVersion(import.meta.url);
9
- export async function setupReporting({ reporter, config }) {
11
+ export async function setupReporting({ reporter, config, appPath }) {
10
12
  reporter.setOptions({
11
13
  productName: 'Cloudpack',
12
14
  version,
@@ -16,10 +18,18 @@ export async function setupReporting({ reporter, config }) {
16
18
  ...(useVerboseLogging && verboseLoggingConfig),
17
19
  ...(useDebugLogging && debugLoggingConfig),
18
20
  });
19
- await initTelemetry({
21
+ const definition = (await readJson(path.join(appPath, 'package.json')));
22
+ const telemetryClient = await initTelemetry({
20
23
  useDebugLogging,
21
24
  useVerboseLogging,
22
25
  telemetryConfig: config.telemetry,
26
+ sharedSpanAttributes: {
27
+ verb,
28
+ arguments: argv.slice(3).join(' '),
29
+ environment: process.env.CI || process.env.TF_BUILD ? 'ci' : 'local',
30
+ appName: definition?.name || '<unknown>',
31
+ },
23
32
  }, reporter);
33
+ return telemetryClient;
24
34
  }
25
35
  //# sourceMappingURL=setupReporting.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setupReporting.js","sourceRoot":"","sources":["../src/setupReporting.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAE7D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EACL,IAAI,EACJ,oBAAoB,EACpB,oBAAoB,EAEpB,kBAAkB,GACnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;AACzB,MAAM,eAAe,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACxE,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AACrB,MAAM,iBAAiB,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,KAAK,QAAQ,CAAC;AACjG,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE5C,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAe;IAC7E,QAAQ,CAAC,UAAU,CAAC;QAClB,WAAW,EAAE,WAAW;QACxB,OAAO;QACP,WAAW,EAAE,GAAG,EAAE,CAAC,YAAY,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG;QAC/D,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,GAAG,oBAAoB;QACvB,GAAG,CAAC,iBAAiB,IAAI,oBAAoB,CAAC;QAC9C,GAAG,CAAC,eAAe,IAAI,kBAAkB,CAAC;KACpB,CAAC,CAAC;IAE1B,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;QACf,iBAAiB;QACjB,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,OAAO,CAAC,GAAG,CAAC,EAAE,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO;YACpE,OAAO,EAAE,UAAU,EAAE,IAAI,IAAI,WAAW;SACzC;KACF,EACD,QAAQ,CACT,CAAC;IAEF,OAAO,eAAe,CAAC;AACzB,CAAC","sourcesContent":["import { getVersion } from '@ms-cloudpack/package-utilities';\nimport type { TaskContext } from './types/TaskContext.js';\nimport { initTelemetry } from './initTelemetry.js';\nimport {\n bold,\n defaultLoggingConfig,\n verboseLoggingConfig,\n type TaskReporterOptions,\n debugLoggingConfig,\n} from '@ms-cloudpack/task-reporter';\nimport { readJson } from '@ms-cloudpack/json-utilities';\nimport path from 'path';\nimport type { PackageJson } from '@ms-cloudpack/bundler-types';\n\nconst { argv } = process;\nconst useDebugLogging = argv.includes('--debug') || argv.includes('-d');\nconst verb = argv[2];\nconst useVerboseLogging = argv.includes('--verbose') || argv.includes('-v') || verb === 'bundle';\nconst version = getVersion(import.meta.url);\n\nexport async function setupReporting({ reporter, config, appPath }: TaskContext) {\n reporter.setOptions({\n productName: 'Cloudpack',\n version,\n description: () => `Running \"${bold(argv.slice(2).join(' '))}\"`,\n helpMessage: config.helpMessage,\n ...defaultLoggingConfig,\n ...(useVerboseLogging && verboseLoggingConfig),\n ...(useDebugLogging && debugLoggingConfig),\n } as TaskReporterOptions);\n\n const definition = (await readJson(path.join(appPath, 'package.json'))) as PackageJson;\n\n const telemetryClient = await initTelemetry(\n {\n useDebugLogging,\n useVerboseLogging,\n telemetryConfig: config.telemetry,\n sharedSpanAttributes: {\n verb,\n arguments: argv.slice(3).join(' '),\n environment: process.env.CI || process.env.TF_BUILD ? 'ci' : 'local',\n appName: definition?.name || '<unknown>',\n },\n },\n reporter,\n );\n\n return telemetryClient;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { bundleTask } from './bundleTask.js';
1
+ import { bundleTask } from '@ms-cloudpack/api-server';
2
2
  export default async function run(data) {
3
3
  const { target } = data;
4
4
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
@@ -1 +1 @@
1
- {"version":3,"file":"bundleTaskWorker.js","sourceRoot":"","sources":["../../src/tasks/bundleTaskWorker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,GAAG,CAAC,IAAwB;IACxD,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAExB,mEAAmE;IACnE,MAAM,UAAU,CAAC,EAAE,aAAa,EAAE,MAAM,CAAC,OAAO,EAAE,aAAa,EAAE,CAAC,CAAC;AACrE,CAAC","sourcesContent":["import { bundleTask } from './bundleTask.js';\nimport type { Target } from '@lage-run/target-graph';\n\nexport default async function run(data: { target: Target }) {\n const { target } = data;\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n await bundleTask({ bundleRequest: target.options?.bundleRequest });\n}\n"]}
1
+ {"version":3,"file":"bundleTaskWorker.js","sourceRoot":"","sources":["../../src/tasks/bundleTaskWorker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAGtD,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,GAAG,CAAC,IAAwB;IACxD,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAExB,mEAAmE;IACnE,MAAM,UAAU,CAAC,EAAE,aAAa,EAAE,MAAM,CAAC,OAAO,EAAE,aAAa,EAAE,CAAC,CAAC;AACrE,CAAC","sourcesContent":["import { bundleTask } from '@ms-cloudpack/api-server';\nimport type { Target } from '@lage-run/target-graph';\n\nexport default async function run(data: { target: Target }) {\n const { target } = data;\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n await bundleTask({ bundleRequest: target.options?.bundleRequest });\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { BundleRequest } from './BundleRequest.js';
1
+ import type { BundleRequest } from '@ms-cloudpack/api-server';
2
2
  export interface Watcher {
3
3
  watch: (bundleRequest: BundleRequest) => void;
4
4
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Watcher.d.ts","sourceRoot":"","sources":["../../src/types/Watcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,CAAC,aAAa,EAAE,aAAa,KAAK,IAAI,CAAC;CAC/C"}
1
+ {"version":3,"file":"Watcher.d.ts","sourceRoot":"","sources":["../../src/types/Watcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,CAAC,aAAa,EAAE,aAAa,KAAK,IAAI,CAAC;CAC/C"}
@@ -1 +1 @@
1
- {"version":3,"file":"Watcher.js","sourceRoot":"","sources":["../../src/types/Watcher.ts"],"names":[],"mappings":"","sourcesContent":["import type { BundleRequest } from './BundleRequest.js';\n\nexport interface Watcher {\n watch: (bundleRequest: BundleRequest) => void;\n}\n"]}
1
+ {"version":3,"file":"Watcher.js","sourceRoot":"","sources":["../../src/types/Watcher.ts"],"names":[],"mappings":"","sourcesContent":["import type { BundleRequest } from '@ms-cloudpack/api-server';\n\nexport interface Watcher {\n watch: (bundleRequest: BundleRequest) => void;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/cli",
3
- "version": "0.42.0",
3
+ "version": "0.42.2",
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",
@@ -11,28 +11,24 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "@lage-run/target-graph": "^0.8.6",
14
- "@ms-cloudpack/api-server": "^0.12.1",
14
+ "@ms-cloudpack/api-server": "^0.12.2",
15
15
  "@ms-cloudpack/bundler": "^0.14.5",
16
16
  "@ms-cloudpack/config": "^0.11.0",
17
17
  "@ms-cloudpack/create-express-app": "^1.3.9",
18
18
  "@ms-cloudpack/json-utilities": "^0.0.7",
19
- "@ms-cloudpack/overlay": "^0.14.2",
19
+ "@ms-cloudpack/overlay": "^0.14.3",
20
20
  "@ms-cloudpack/package-utilities": "^5.1.0",
21
21
  "@ms-cloudpack/path-string-parsing": "^1.0.3",
22
22
  "@ms-cloudpack/path-utilities": "^2.3.2",
23
- "@ms-cloudpack/task-reporter": "^0.7.0",
23
+ "@ms-cloudpack/task-reporter": "^0.7.1",
24
24
  "@ms-cloudpack/telemetry": "^0.3.6",
25
- "@ms-cloudpack/remote-cache": "^0.0.1",
26
25
  "commander": "^11.0.0",
27
26
  "cross-spawn": "^7.0.3",
28
27
  "es-module-lexer": "^1.0.3",
29
- "fast-glob": "^3.2.12",
30
- "filenamify": "^6.0.0",
31
28
  "fs-extra": "^11.0.0",
32
29
  "glob": "^8.0.0",
33
30
  "glob-hasher": "^1.2.1",
34
31
  "jsdom": "^22.0.0",
35
- "object-hash": "^3.0.0",
36
32
  "open": "^9.0.0",
37
33
  "prompts": "^2.4.2",
38
34
  "semver": "^7.3.7",
@@ -1,11 +0,0 @@
1
- import type { CloudpackConfig } from '@ms-cloudpack/config';
2
- import type { ResolveMapEntry } from '@ms-cloudpack/package-utilities';
3
- import type { BundleRequest } from '../../types/BundleRequest.js';
4
- import type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';
5
- export declare function createBundleRequestForPackage(options: {
6
- packageEntry: ResolveMapEntry;
7
- }, context: {
8
- config: CloudpackConfig;
9
- packages: PackageDefinitionsCache;
10
- }): Promise<BundleRequest>;
11
- //# sourceMappingURL=createBundleRequestForPackage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createBundleRequestForPackage.d.ts","sourceRoot":"","sources":["../../../src/commands/start/createBundleRequestForPackage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAEvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAE3E,wBAAsB,6BAA6B,CACjD,OAAO,EAAE;IACP,YAAY,EAAE,eAAe,CAAC;CAC/B,EACD,OAAO,EAAE;IACP,MAAM,EAAE,eAAe,CAAC;IACxB,QAAQ,EAAE,uBAAuB,CAAC;CACnC,GACA,OAAO,CAAC,aAAa,CAAC,CAmBxB"}
@@ -1,21 +0,0 @@
1
- import { getBundleDetails } from '../../common/getBundleDetails.js';
2
- export async function createBundleRequestForPackage(options, context) {
3
- const { packageEntry } = options;
4
- const { config } = context;
5
- const { features = {} } = config;
6
- const { path, version, name } = packageEntry;
7
- const { bundleId, isExternal, outputLocation } = await getBundleDetails({ packagePath: path }, context);
8
- return {
9
- id: bundleId,
10
- packagePath: path,
11
- packageName: name,
12
- isExternal,
13
- outputPath: outputLocation.path,
14
- version,
15
- disableSourceMaps: features.disableSourceMaps,
16
- enableFindImports: features.enqueueDependencies,
17
- enableCacheInternalPackages: features.cacheInternalPackages,
18
- ...context,
19
- };
20
- }
21
- //# sourceMappingURL=createBundleRequestForPackage.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createBundleRequestForPackage.js","sourceRoot":"","sources":["../../../src/commands/start/createBundleRequestForPackage.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAIpE,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,OAEC,EACD,OAGC;IAED,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;IACjC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAC3B,MAAM,EAAE,QAAQ,GAAG,EAAE,EAAE,GAAG,MAAM,CAAC;IACjC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,YAAY,CAAC;IAC7C,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,cAAc,EAAE,GAAG,MAAM,gBAAgB,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;IAExG,OAAO;QACL,EAAE,EAAE,QAAQ;QACZ,WAAW,EAAE,IAAI;QACjB,WAAW,EAAE,IAAI;QACjB,UAAU;QACV,UAAU,EAAE,cAAc,CAAC,IAAI;QAC/B,OAAO;QACP,iBAAiB,EAAE,QAAQ,CAAC,iBAAiB;QAC7C,iBAAiB,EAAE,QAAQ,CAAC,mBAAmB;QAC/C,2BAA2B,EAAE,QAAQ,CAAC,qBAAqB;QAC3D,GAAG,OAAO;KACX,CAAC;AACJ,CAAC","sourcesContent":["import type { CloudpackConfig } from '@ms-cloudpack/config';\nimport type { ResolveMapEntry } from '@ms-cloudpack/package-utilities';\nimport { getBundleDetails } from '../../common/getBundleDetails.js';\nimport type { BundleRequest } from '../../types/BundleRequest.js';\nimport type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';\n\nexport async function createBundleRequestForPackage(\n options: {\n packageEntry: ResolveMapEntry;\n },\n context: {\n config: CloudpackConfig;\n packages: PackageDefinitionsCache;\n },\n): Promise<BundleRequest> {\n const { packageEntry } = options;\n const { config } = context;\n const { features = {} } = config;\n const { path, version, name } = packageEntry;\n const { bundleId, isExternal, outputLocation } = await getBundleDetails({ packagePath: path }, context);\n\n return {\n id: bundleId,\n packagePath: path,\n packageName: name,\n isExternal,\n outputPath: outputLocation.path,\n version,\n disableSourceMaps: features.disableSourceMaps,\n enableFindImports: features.enqueueDependencies,\n enableCacheInternalPackages: features.cacheInternalPackages,\n ...context,\n };\n}\n"]}
@@ -1,10 +0,0 @@
1
- import type { BundleTaskOptions } from '../../types/BundleTaskOptions.js';
2
- import type { BundleRequest } from '../../types/BundleRequest.js';
3
- import type { Task } from '@ms-cloudpack/api-server';
4
- import type { TaskReporter } from '@ms-cloudpack/task-reporter';
5
- /**
6
- * Creates a bundle task tracked in the task runner of the api server. This allows active tasks to be tracked
7
- * remotely (e.g. in the browser) and allows the user to cancel tasks.
8
- */
9
- export declare function createBundleTask(bundleRequest: BundleRequest, options?: BundleTaskOptions, reporter?: TaskReporter): Task<BundleRequest>;
10
- //# sourceMappingURL=createBundleTask.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createBundleTask.d.ts","sourceRoot":"","sources":["../../../src/commands/start/createBundleTask.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,IAAI,EAAiC,MAAM,0BAA0B,CAAC;AAIpF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,aAAa,EAAE,aAAa,EAC5B,OAAO,CAAC,EAAE,iBAAiB,EAC3B,QAAQ,CAAC,EAAE,YAAY,GACtB,IAAI,CAAC,aAAa,CAAC,CAoCrB"}
@@ -1,42 +0,0 @@
1
- import path from 'path';
2
- import fs from 'fs';
3
- import { bundleTask } from '../../tasks/bundleTask.js';
4
- /**
5
- * Creates a bundle task tracked in the task runner of the api server. This allows active tasks to be tracked
6
- * remotely (e.g. in the browser) and allows the user to cancel tasks.
7
- */
8
- export function createBundleTask(bundleRequest, options, reporter) {
9
- const { id, packageName, version, outputPath, packagePath, isExternal } = bundleRequest;
10
- return {
11
- name: `Bundle ${packageName}@${version}`,
12
- id,
13
- dir: `${path.join(packagePath, 'src')}`,
14
- watch: !isExternal,
15
- async execute() {
16
- await bundleTask({ bundleRequest, options, reporter });
17
- return bundleRequest;
18
- },
19
- clear: () => {
20
- bundleRequest.result?.dispose?.();
21
- bundleRequest.result = undefined;
22
- // eslint-disable-next-line no-restricted-syntax -- this function can't be async
23
- fs.rmSync(outputPath, { recursive: true, force: true });
24
- },
25
- onDispose: () => {
26
- bundleRequest.result?.dispose?.();
27
- },
28
- getErrors: () => bundleRequest.result?.errors,
29
- getStartDescription: () => ({
30
- id,
31
- name: `Bundle ${packageName}@${version}`,
32
- inputPath: packagePath || '',
33
- outputPath,
34
- }),
35
- getEndDescription: (taskResult) => ({
36
- id,
37
- errors: taskResult?.result?.errors,
38
- warnings: taskResult?.result?.warnings,
39
- }),
40
- };
41
- }
42
- //# sourceMappingURL=createBundleTask.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createBundleTask.js","sourceRoot":"","sources":["../../../src/commands/start/createBundleTask.ts"],"names":[],"mappings":"AAGA,OAAO,IAAI,MAAM,MAAM,CAAC;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CAAC;YACC,EAAE;YACF,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM;YAClC,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ;SACvC,CAAuB;KAC3B,CAAC;AACJ,CAAC","sourcesContent":["import type { BundleTaskOptions } from '../../types/BundleTaskOptions.js';\nimport type { BundleRequest } from '../../types/BundleRequest.js';\nimport type { Task, TaskEndDescription, TaskError } from '@ms-cloudpack/api-server';\nimport path from 'path';\nimport fs from 'fs';\nimport { bundleTask } from '../../tasks/bundleTask.js';\nimport type { TaskReporter } from '@ms-cloudpack/task-reporter';\n\n/**\n * Creates a bundle task tracked in the task runner of the api server. This allows active tasks to be tracked\n * remotely (e.g. in the browser) and allows the user to cancel tasks.\n */\nexport function createBundleTask(\n bundleRequest: BundleRequest,\n options?: BundleTaskOptions,\n reporter?: TaskReporter,\n): Task<BundleRequest> {\n const { id, packageName, version, outputPath, packagePath, isExternal } = bundleRequest;\n\n return {\n name: `Bundle ${packageName}@${version}`,\n id,\n dir: `${path.join(packagePath, 'src')}`,\n watch: !isExternal,\n async execute(): Promise<BundleRequest> {\n await bundleTask({ bundleRequest, options, reporter });\n\n return bundleRequest;\n },\n clear: () => {\n bundleRequest.result?.dispose?.();\n bundleRequest.result = undefined;\n // eslint-disable-next-line no-restricted-syntax -- this function can't be async\n fs.rmSync(outputPath, { recursive: true, force: true });\n },\n onDispose: () => {\n bundleRequest.result?.dispose?.();\n },\n getErrors: () => bundleRequest.result?.errors as unknown as TaskError[],\n getStartDescription: () => ({\n id,\n name: `Bundle ${packageName}@${version}`,\n inputPath: packagePath || '',\n outputPath,\n }),\n getEndDescription: (taskResult) =>\n ({\n id,\n errors: taskResult?.result?.errors,\n warnings: taskResult?.result?.warnings,\n }) as TaskEndDescription,\n };\n}\n"]}
@@ -1,3 +0,0 @@
1
- import type { TaskContext } from '../../types/TaskContext.js';
2
- export declare function setupReporting({ reporter, config }: Pick<TaskContext, 'reporter' | 'config'>): Promise<void>;
3
- //# sourceMappingURL=setupReporting.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setupReporting.d.ts","sourceRoot":"","sources":["../../../src/commands/start/setupReporting.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAgB9D,wBAAsB,cAAc,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,QAAQ,CAAC,iBAmBlG"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"setupReporting.js","sourceRoot":"","sources":["../../../src/commands/start/setupReporting.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAE7D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EACL,IAAI,EACJ,oBAAoB,EACpB,oBAAoB,EAEpB,kBAAkB,GACnB,MAAM,6BAA6B,CAAC;AAErC,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;AACzB,MAAM,eAAe,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACxE,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AACrB,MAAM,iBAAiB,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,KAAK,QAAQ,CAAC;AACjG,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE5C,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,EAAE,QAAQ,EAAE,MAAM,EAA4C;IACjG,QAAQ,CAAC,UAAU,CAAC;QAClB,WAAW,EAAE,WAAW;QACxB,OAAO;QACP,WAAW,EAAE,GAAG,EAAE,CAAC,YAAY,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG;QAC/D,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,GAAG,oBAAoB;QACvB,GAAG,CAAC,iBAAiB,IAAI,oBAAoB,CAAC;QAC9C,GAAG,CAAC,eAAe,IAAI,kBAAkB,CAAC;KACpB,CAAC,CAAC;IAE1B,MAAM,aAAa,CACjB;QACE,eAAe;QACf,iBAAiB;QACjB,eAAe,EAAE,MAAM,CAAC,SAAS;KAClC,EACD,QAAQ,CACT,CAAC;AACJ,CAAC","sourcesContent":["import { getVersion } from '@ms-cloudpack/package-utilities';\nimport type { TaskContext } from '../../types/TaskContext.js';\nimport { initTelemetry } from '../../initTelemetry.js';\nimport {\n bold,\n defaultLoggingConfig,\n verboseLoggingConfig,\n type TaskReporterOptions,\n debugLoggingConfig,\n} from '@ms-cloudpack/task-reporter';\n\nconst { argv } = process;\nconst useDebugLogging = argv.includes('--debug') || argv.includes('-d');\nconst verb = argv[2];\nconst useVerboseLogging = argv.includes('--verbose') || argv.includes('-v') || verb === 'bundle';\nconst version = getVersion(import.meta.url);\n\nexport async function setupReporting({ reporter, config }: Pick<TaskContext, 'reporter' | 'config'>) {\n reporter.setOptions({\n productName: 'Cloudpack',\n version,\n description: () => `Running \"${bold(argv.slice(2).join(' '))}\"`,\n helpMessage: config.helpMessage,\n ...defaultLoggingConfig,\n ...(useVerboseLogging && verboseLoggingConfig),\n ...(useDebugLogging && debugLoggingConfig),\n } as TaskReporterOptions);\n\n await initTelemetry(\n {\n useDebugLogging,\n useVerboseLogging,\n telemetryConfig: config.telemetry,\n },\n reporter,\n );\n}\n"]}
@@ -1,6 +0,0 @@
1
- import type { TaskReporterTaskResult } from '@ms-cloudpack/task-reporter';
2
- export interface Task {
3
- name: string;
4
- execute: () => Promise<TaskReporterTaskResult>;
5
- }
6
- //# sourceMappingURL=Task.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Task.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/Task.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAE1E,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,OAAO,CAAC,sBAAsB,CAAC,CAAC;CAChD"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=Task.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Task.js","sourceRoot":"","sources":["../../../src/commands/sync/Task.ts"],"names":[],"mappings":"","sourcesContent":["import type { TaskReporterTaskResult } from '@ms-cloudpack/task-reporter';\n\nexport interface Task {\n name: string;\n execute: () => Promise<TaskReporterTaskResult>;\n}\n"]}
@@ -1,5 +0,0 @@
1
- import type { RemoteCacheClient } from '@ms-cloudpack/remote-cache';
2
- import { type PackageToSync } from './getPackagesToSync.js';
3
- import type { Task } from './Task.js';
4
- export declare function createDownloadTask(client: RemoteCacheClient, { folderName, packageName, path, version }: PackageToSync): Task;
5
- //# sourceMappingURL=createDownloadTask.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createDownloadTask.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/createDownloadTask.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAItC,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,iBAAiB,EACzB,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,aAAa,GACxD,IAAI,CAmBN"}
@@ -1,22 +0,0 @@
1
- import {} from './getPackagesToSync.js';
2
- import { existsSync } from 'fs';
3
- import { bulletedList } from '@ms-cloudpack/task-reporter';
4
- export function createDownloadTask(client, { folderName, packageName, path, version }) {
5
- return {
6
- name: `Downloading ${packageName}@${version}`,
7
- execute: async () => {
8
- if (existsSync(path)) {
9
- return { status: 'skip', message: 'Package is already exist in the local cache.' };
10
- }
11
- const result = await client.downloadFolder(folderName, path);
12
- if (!result) {
13
- return { status: 'skip', message: `not found in the remote cache.` };
14
- }
15
- return {
16
- status: 'complete',
17
- details: bulletedList([`FolderName: ${folderName}`, `Path: ${path}`, `Version: ${version}`]),
18
- };
19
- },
20
- };
21
- }
22
- //# sourceMappingURL=createDownloadTask.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createDownloadTask.js","sourceRoot":"","sources":["../../../src/commands/sync/createDownloadTask.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,MAAM,UAAU,kBAAkB,CAChC,MAAyB,EACzB,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAiB;IAEzD,OAAO;QACL,IAAI,EAAE,eAAe,WAAW,IAAI,OAAO,EAAE;QAC7C,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE;gBACpB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,8CAA8C,EAAE,CAAC;aACpF;YAED,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;YAC7D,IAAI,CAAC,MAAM,EAAE;gBACX,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,gCAAgC,EAAE,CAAC;aACtE;YAED,OAAO;gBACL,MAAM,EAAE,UAAU;gBAClB,OAAO,EAAE,YAAY,CAAC,CAAC,eAAe,UAAU,EAAE,EAAE,SAAS,IAAI,EAAE,EAAE,YAAY,OAAO,EAAE,CAAC,CAAC;aAC7F,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { RemoteCacheClient } from '@ms-cloudpack/remote-cache';\nimport { type PackageToSync } from './getPackagesToSync.js';\nimport type { Task } from './Task.js';\nimport { existsSync } from 'fs';\nimport { bulletedList } from '@ms-cloudpack/task-reporter';\n\nexport function createDownloadTask(\n client: RemoteCacheClient,\n { folderName, packageName, path, version }: PackageToSync,\n): Task {\n return {\n name: `Downloading ${packageName}@${version}`,\n execute: async () => {\n if (existsSync(path)) {\n return { status: 'skip', message: 'Package is already exist in the local cache.' };\n }\n\n const result = await client.downloadFolder(folderName, path);\n if (!result) {\n return { status: 'skip', message: `not found in the remote cache.` };\n }\n\n return {\n status: 'complete',\n details: bulletedList([`FolderName: ${folderName}`, `Path: ${path}`, `Version: ${version}`]),\n };\n },\n };\n}\n"]}
@@ -1,5 +0,0 @@
1
- import type { RemoteCacheClient } from '@ms-cloudpack/remote-cache';
2
- import type { PackageToSync } from './getPackagesToSync.js';
3
- import type { Task } from './Task.js';
4
- export declare function createUploadTask(client: RemoteCacheClient, { folderName, packageName, path, version }: PackageToSync): Task;
5
- //# sourceMappingURL=createUploadTask.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createUploadTask.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/createUploadTask.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAItC,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,iBAAiB,EACzB,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,aAAa,GACxD,IAAI,CAeN"}
@@ -1,18 +0,0 @@
1
- import { existsSync } from 'fs';
2
- import { bulletedList } from '@ms-cloudpack/task-reporter';
3
- export function createUploadTask(client, { folderName, packageName, path, version }) {
4
- return {
5
- name: `Uploading ${packageName}@${version}`,
6
- execute: async () => {
7
- if (!existsSync(path)) {
8
- return { status: 'skip', message: `Not found in the local cache.` };
9
- }
10
- await client.uploadFolder(folderName, path);
11
- return {
12
- status: 'complete',
13
- details: bulletedList([`FolderName: ${folderName}`, `Path: ${path}`, `Version: ${version}`]),
14
- };
15
- },
16
- };
17
- }
18
- //# sourceMappingURL=createUploadTask.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createUploadTask.js","sourceRoot":"","sources":["../../../src/commands/sync/createUploadTask.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,MAAM,UAAU,gBAAgB,CAC9B,MAAyB,EACzB,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAiB;IAEzD,OAAO;QACL,IAAI,EAAE,aAAa,WAAW,IAAI,OAAO,EAAE;QAC3C,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;gBACrB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,+BAA+B,EAAE,CAAC;aACrE;YAED,MAAM,MAAM,CAAC,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;YAC5C,OAAO;gBACL,MAAM,EAAE,UAAU;gBAClB,OAAO,EAAE,YAAY,CAAC,CAAC,eAAe,UAAU,EAAE,EAAE,SAAS,IAAI,EAAE,EAAE,YAAY,OAAO,EAAE,CAAC,CAAC;aAC7F,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { RemoteCacheClient } from '@ms-cloudpack/remote-cache';\nimport type { PackageToSync } from './getPackagesToSync.js';\nimport type { Task } from './Task.js';\nimport { existsSync } from 'fs';\nimport { bulletedList } from '@ms-cloudpack/task-reporter';\n\nexport function createUploadTask(\n client: RemoteCacheClient,\n { folderName, packageName, path, version }: PackageToSync,\n): Task {\n return {\n name: `Uploading ${packageName}@${version}`,\n execute: async () => {\n if (!existsSync(path)) {\n return { status: 'skip', message: `Not found in the local cache.` };\n }\n\n await client.uploadFolder(folderName, path);\n return {\n status: 'complete',\n details: bulletedList([`FolderName: ${folderName}`, `Path: ${path}`, `Version: ${version}`]),\n };\n },\n };\n}\n"]}
@@ -1,9 +0,0 @@
1
- import type { TaskReporter } from '@ms-cloudpack/task-reporter';
2
- export interface PackageToSync {
3
- path: string;
4
- folderName: string;
5
- packageName: string;
6
- version: string;
7
- }
8
- export declare function getPackagesToSync(appPath: string, reporter: TaskReporter): Promise<PackageToSync[]>;
9
- //# sourceMappingURL=getPackagesToSync.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getPackagesToSync.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/getPackagesToSync.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAyBzG"}
@@ -1,24 +0,0 @@
1
- import { createPackageDefinitions, readConfig } from '@ms-cloudpack/config';
2
- import { resolveDependenciesTask } from '../../tasks/resolveDependenciesTask.js';
3
- import { findResolveMapEntry } from '@ms-cloudpack/package-utilities';
4
- import { getBundleDetails } from '../../common/getBundleDetails.js';
5
- export async function getPackagesToSync(appPath, reporter) {
6
- const list = [];
7
- const config = await readConfig(appPath);
8
- const packages = createPackageDefinitions({ config });
9
- const resolveMap = await resolveDependenciesTask({ appPath }, { packages, reporter });
10
- const packageEntries = Object.keys(resolveMap)
11
- .map((packageName) => findResolveMapEntry({
12
- packageName,
13
- resolveMap,
14
- }))
15
- .filter((item) => item);
16
- for (const { path: packagePath, name, version } of packageEntries) {
17
- const details = await getBundleDetails({ packagePath }, { packages });
18
- if (details.isExternal) {
19
- list.push({ ...details.outputLocation, packageName: name, version });
20
- }
21
- }
22
- return list;
23
- }
24
- //# sourceMappingURL=getPackagesToSync.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getPackagesToSync.js","sourceRoot":"","sources":["../../../src/commands/sync/getPackagesToSync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAwB,MAAM,iCAAiC,CAAC;AAC5F,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAUpE,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,OAAe,EAAE,QAAsB;IAC7E,MAAM,IAAI,GAAoB,EAAE,CAAC;IAEjC,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC;IACzC,MAAM,QAAQ,GAAG,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAEtD,MAAM,UAAU,GAAG,MAAM,uBAAuB,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC;IAEtF,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;SAC3C,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CACnB,mBAAmB,CAAC;QAClB,WAAW;QACX,UAAU;KACX,CAAC,CACH;SACA,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAsB,CAAC;IAE/C,KAAK,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,cAAc,EAAE;QACjE,MAAM,OAAO,GAAG,MAAM,gBAAgB,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;QACtE,IAAI,OAAO,CAAC,UAAU,EAAE;YACtB,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;SACtE;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { createPackageDefinitions, readConfig } from '@ms-cloudpack/config';\nimport { resolveDependenciesTask } from '../../tasks/resolveDependenciesTask.js';\nimport { findResolveMapEntry, type ResolveMapEntry } from '@ms-cloudpack/package-utilities';\nimport { getBundleDetails } from '../../common/getBundleDetails.js';\nimport type { TaskReporter } from '@ms-cloudpack/task-reporter';\n\nexport interface PackageToSync {\n path: string;\n folderName: string;\n packageName: string;\n version: string;\n}\n\nexport async function getPackagesToSync(appPath: string, reporter: TaskReporter): Promise<PackageToSync[]> {\n const list: PackageToSync[] = [];\n\n const config = await readConfig(appPath);\n const packages = createPackageDefinitions({ config });\n\n const resolveMap = await resolveDependenciesTask({ appPath }, { packages, reporter });\n\n const packageEntries = Object.keys(resolveMap)\n .map((packageName) =>\n findResolveMapEntry({\n packageName,\n resolveMap,\n }),\n )\n .filter((item) => item) as ResolveMapEntry[];\n\n for (const { path: packagePath, name, version } of packageEntries) {\n const details = await getBundleDetails({ packagePath }, { packages });\n if (details.isExternal) {\n list.push({ ...details.outputLocation, packageName: name, version });\n }\n }\n\n return list;\n}\n"]}
@@ -1,10 +0,0 @@
1
- import type { TaskContext } from '../../types/TaskContext.js';
2
- import type { SyncOptions } from './types/SyncOptions.js';
3
- /**
4
- * Syncs the packages to the remote cache.
5
- * @param syncOptions - The options for the sync command.
6
- * @param context - The task context.
7
- * @returns The number of packages synced.
8
- */
9
- export declare function syncInternal({ upload: isUpload }: SyncOptions, context: TaskContext): Promise<void>;
10
- //# sourceMappingURL=syncInternal.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"syncInternal.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/syncInternal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAW9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D;;;;;GAKG;AACH,wBAAsB,YAAY,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAiCzG"}