nx 21.6.1-beta.0 → 21.6.1-beta.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "21.6.1-beta.0",
3
+ "version": "21.6.1-beta.1",
4
4
  "private": false,
5
5
  "description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
6
6
  "repository": {
@@ -83,16 +83,16 @@
83
83
  }
84
84
  },
85
85
  "optionalDependencies": {
86
- "@nx/nx-darwin-arm64": "21.6.1-beta.0",
87
- "@nx/nx-darwin-x64": "21.6.1-beta.0",
88
- "@nx/nx-freebsd-x64": "21.6.1-beta.0",
89
- "@nx/nx-linux-arm-gnueabihf": "21.6.1-beta.0",
90
- "@nx/nx-linux-arm64-gnu": "21.6.1-beta.0",
91
- "@nx/nx-linux-arm64-musl": "21.6.1-beta.0",
92
- "@nx/nx-linux-x64-gnu": "21.6.1-beta.0",
93
- "@nx/nx-linux-x64-musl": "21.6.1-beta.0",
94
- "@nx/nx-win32-arm64-msvc": "21.6.1-beta.0",
95
- "@nx/nx-win32-x64-msvc": "21.6.1-beta.0"
86
+ "@nx/nx-darwin-arm64": "21.6.1-beta.1",
87
+ "@nx/nx-darwin-x64": "21.6.1-beta.1",
88
+ "@nx/nx-freebsd-x64": "21.6.1-beta.1",
89
+ "@nx/nx-linux-arm-gnueabihf": "21.6.1-beta.1",
90
+ "@nx/nx-linux-arm64-gnu": "21.6.1-beta.1",
91
+ "@nx/nx-linux-arm64-musl": "21.6.1-beta.1",
92
+ "@nx/nx-linux-x64-gnu": "21.6.1-beta.1",
93
+ "@nx/nx-linux-x64-musl": "21.6.1-beta.1",
94
+ "@nx/nx-win32-arm64-msvc": "21.6.1-beta.1",
95
+ "@nx/nx-win32-x64-msvc": "21.6.1-beta.1"
96
96
  },
97
97
  "nx-migrations": {
98
98
  "migrations": "./migrations.json",
@@ -10,7 +10,7 @@ exports.yargsMigrateCommand = {
10
10
  - Run migrations (e.g., nx migrate --run-migrations=migrations.json). Use flag --if-exists to run migrations only if the migrations file exists.`,
11
11
  builder: (yargs) => (0, documentation_1.linkToNxDevAndExamples)(withMigrationOptions(yargs), 'migrate'),
12
12
  handler: async () => {
13
- (await Promise.resolve().then(() => require('./migrate'))).runMigration();
13
+ await (await Promise.resolve().then(() => require('./migrate'))).runMigration();
14
14
  process.exit(0);
15
15
  },
16
16
  };
@@ -122,7 +122,7 @@ export declare function runNxOrAngularMigration(root: string, migration: {
122
122
  export declare function migrate(root: string, args: {
123
123
  [k: string]: any;
124
124
  }, rawArgs: string[]): Promise<number>;
125
- export declare function runMigration(): void;
125
+ export declare function runMigration(): Promise<void>;
126
126
  export declare function readMigrationCollection(packageName: string, root: string): {
127
127
  collection: MigrationsJson;
128
128
  collectionPath: string;
@@ -131,6 +131,6 @@ export declare function getImplementationPath(collection: MigrationsJson, collec
131
131
  path: string;
132
132
  fnSymbol: string;
133
133
  };
134
- export declare function nxCliPath(nxWorkspaceRoot?: string): string;
134
+ export declare function nxCliPath(nxWorkspaceRoot?: string): Promise<string>;
135
135
  export {};
136
136
  //# sourceMappingURL=migrate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/migrate/migrate.ts"],"names":[],"mappings":"AAkBA,OAAO,EACL,cAAc,EAEd,2BAA2B,IAAI,aAAa,EAE7C,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EACL,UAAU,EAIX,MAAM,uBAAuB,CAAC;AAW/B,OAAO,EACL,iBAAiB,EAEjB,WAAW,EAGZ,MAAM,0BAA0B,CAAC;AAmClC,MAAM,WAAW,8BAA+B,SAAQ,cAAc;IACpE,YAAY,CAAC,EAAE,iBAAiB,CAAC;CAClC;AAID,wBAAgB,gBAAgB,CAAC,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B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,EAC1B,OAAO,EAAE,MAAM,EAAE,mBAmBlB;AAED,wBAAsB,YAAY,kBA6BjC;AAED,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;;;EAWxE;AAED,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,cAAc,EAC1B,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,MAAM,GACX;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAyBpC;AAED,wBAAsB,SAAS,CAAC,eAAe,CAAC,EAAE,MAAM,mBAoEvD"}
@@ -36,6 +36,7 @@ const client_1 = require("../../daemon/client/client");
36
36
  const nx_cloud_utils_1 = require("../../utils/nx-cloud-utils");
37
37
  const project_graph_1 = require("../../project-graph/project-graph");
38
38
  const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
39
+ const provenance_1 = require("../../utils/provenance");
39
40
  const execAsync = (0, util_1.promisify)(child_process_1.exec);
40
41
  function normalizeVersion(version) {
41
42
  const [semver, ...prereleaseTagParts] = version.split('-');
@@ -596,6 +597,9 @@ function createFetcher() {
596
597
  }
597
598
  // testing-fetch-end
598
599
  async function getPackageMigrationsUsingRegistry(packageName, packageVersion) {
600
+ if ((0, provenance_1.getNxPackageGroup)().includes(packageName)) {
601
+ await (0, provenance_1.ensurePackageHasProvenance)(packageName, packageVersion);
602
+ }
599
603
  // check if there are migrations in the packages by looking at the
600
604
  // registry directly
601
605
  const migrationsConfig = await getPackageMigrationsConfigFromRegistry(packageName, packageVersion);
@@ -652,6 +656,9 @@ async function downloadPackageMigrationsFromRegistry(packageName, packageVersion
652
656
  async function getPackageMigrationsUsingInstall(packageName, packageVersion) {
653
657
  const { dir, cleanup } = (0, package_manager_1.createTempNpmDirectory)();
654
658
  let result;
659
+ if ((0, provenance_1.getNxPackageGroup)().includes(packageName)) {
660
+ await (0, provenance_1.ensurePackageHasProvenance)(packageName, packageVersion);
661
+ }
655
662
  try {
656
663
  const pmc = (0, package_manager_1.getPackageManagerCommand)((0, package_manager_1.detectPackageManager)(dir), dir);
657
664
  await execAsync(`${pmc.add} ${packageName}@${packageVersion}`, {
@@ -926,10 +933,11 @@ function runInstall(nxWorkspaceRoot) {
926
933
  if (packageManager ?? (0, package_manager_1.detectPackageManager)() === 'npm') {
927
934
  process.env.npm_config_legacy_peer_deps ??= 'true';
928
935
  }
936
+ const installCommand = `${pmCommands.install} ${pmCommands.ignoreScriptsFlag ?? ''}`;
929
937
  output_1.output.log({
930
- title: `Running '${pmCommands.install}' to make sure necessary packages are installed`,
938
+ title: `Running '${installCommand}' to make sure necessary packages are installed`,
931
939
  });
932
- (0, child_process_1.execSync)(pmCommands.install, {
940
+ (0, child_process_1.execSync)(installCommand, {
933
941
  stdio: [0, 1, 2],
934
942
  windowsHide: false,
935
943
  cwd: nxWorkspaceRoot ?? process.cwd(),
@@ -1135,14 +1143,14 @@ async function migrate(root, args, rawArgs) {
1135
1143
  }
1136
1144
  });
1137
1145
  }
1138
- function runMigration() {
1146
+ async function runMigration() {
1139
1147
  const runLocalMigrate = () => {
1140
1148
  (0, child_process_2.runNxSync)(`_migrate ${process.argv.slice(3).join(' ')}`, {
1141
1149
  stdio: ['inherit', 'inherit', 'inherit'],
1142
1150
  });
1143
1151
  };
1144
1152
  if (process.env.NX_MIGRATE_USE_LOCAL === undefined) {
1145
- const p = nxCliPath();
1153
+ const p = await nxCliPath();
1146
1154
  if (p === null) {
1147
1155
  runLocalMigrate();
1148
1156
  }
@@ -1191,9 +1199,10 @@ function getImplementationPath(collection, collectionPath, name) {
1191
1199
  }
1192
1200
  return { path: implPath, fnSymbol };
1193
1201
  }
1194
- function nxCliPath(nxWorkspaceRoot) {
1202
+ async function nxCliPath(nxWorkspaceRoot) {
1195
1203
  const version = process.env.NX_MIGRATE_CLI_VERSION || 'latest';
1196
1204
  const isVerbose = process.env.NX_VERBOSE_LOGGING === 'true';
1205
+ await (0, provenance_1.ensurePackageHasProvenance)('nx', version);
1197
1206
  try {
1198
1207
  const packageManager = (0, package_manager_1.detectPackageManager)();
1199
1208
  const pmc = (0, package_manager_1.getPackageManagerCommand)(packageManager);
@@ -1229,7 +1238,7 @@ function nxCliPath(nxWorkspaceRoot) {
1229
1238
  });
1230
1239
  }
1231
1240
  }
1232
- (0, child_process_1.execSync)(pmc.install, {
1241
+ (0, child_process_1.execSync)(`${pmc.install} ${pmc.ignoreScriptsFlag ?? ''}`, {
1233
1242
  cwd: tmpDir,
1234
1243
  stdio,
1235
1244
  windowsHide: false,
@@ -64,46 +64,49 @@ function __napi_rs_initialize_modules(__napiInstance) {
64
64
  __napiInstance.exports['__napi_register__NxConsolePreferences_struct_10']?.()
65
65
  __napiInstance.exports['__napi_register__NxConsolePreferences_impl_14']?.()
66
66
  __napiInstance.exports['__napi_register__log_debug_15']?.()
67
- __napiInstance.exports['__napi_register__log_error_16']?.()
68
- __napiInstance.exports['__napi_register__IS_WASM_17']?.()
69
- __napiInstance.exports['__napi_register__get_binary_target_18']?.()
70
- __napiInstance.exports['__napi_register__ImportResult_struct_19']?.()
71
- __napiInstance.exports['__napi_register__find_imports_20']?.()
72
- __napiInstance.exports['__napi_register__transfer_project_graph_21']?.()
73
- __napiInstance.exports['__napi_register__ExternalNode_struct_22']?.()
74
- __napiInstance.exports['__napi_register__Target_struct_23']?.()
75
- __napiInstance.exports['__napi_register__Project_struct_24']?.()
76
- __napiInstance.exports['__napi_register__ProjectGraph_struct_25']?.()
77
- __napiInstance.exports['__napi_register__HashPlanner_struct_26']?.()
78
- __napiInstance.exports['__napi_register__HashPlanner_impl_30']?.()
79
- __napiInstance.exports['__napi_register__HashDetails_struct_31']?.()
80
- __napiInstance.exports['__napi_register__HasherOptions_struct_32']?.()
81
- __napiInstance.exports['__napi_register__TaskHasher_struct_33']?.()
82
- __napiInstance.exports['__napi_register__TaskHasher_impl_36']?.()
83
- __napiInstance.exports['__napi_register__Task_struct_37']?.()
84
- __napiInstance.exports['__napi_register__TaskTarget_struct_38']?.()
85
- __napiInstance.exports['__napi_register__TaskResult_struct_39']?.()
86
- __napiInstance.exports['__napi_register__TaskGraph_struct_40']?.()
87
- __napiInstance.exports['__napi_register__FileData_struct_41']?.()
88
- __napiInstance.exports['__napi_register__InputsInput_struct_42']?.()
89
- __napiInstance.exports['__napi_register__FileSetInput_struct_43']?.()
90
- __napiInstance.exports['__napi_register__RuntimeInput_struct_44']?.()
91
- __napiInstance.exports['__napi_register__EnvironmentInput_struct_45']?.()
92
- __napiInstance.exports['__napi_register__ExternalDependenciesInput_struct_46']?.()
93
- __napiInstance.exports['__napi_register__DepsOutputsInput_struct_47']?.()
94
- __napiInstance.exports['__napi_register__NxJson_struct_48']?.()
95
- __napiInstance.exports['__napi_register__FileLock_struct_49']?.()
96
- __napiInstance.exports['__napi_register__FileLock_impl_51']?.()
97
- __napiInstance.exports['__napi_register__WorkspaceContext_struct_52']?.()
98
- __napiInstance.exports['__napi_register__WorkspaceContext_impl_63']?.()
99
- __napiInstance.exports['__napi_register__WorkspaceErrors_64']?.()
100
- __napiInstance.exports['__napi_register__NxWorkspaceFiles_struct_65']?.()
101
- __napiInstance.exports['__napi_register__NxWorkspaceFilesExternals_struct_66']?.()
102
- __napiInstance.exports['__napi_register__UpdatedWorkspaceFiles_struct_67']?.()
103
- __napiInstance.exports['__napi_register__FileMap_struct_68']?.()
104
- __napiInstance.exports['__napi_register____test_only_transfer_file_map_69']?.()
67
+ __napiInstance.exports['__napi_register__IS_WASM_16']?.()
68
+ __napiInstance.exports['__napi_register__get_binary_target_17']?.()
69
+ __napiInstance.exports['__napi_register__ImportResult_struct_18']?.()
70
+ __napiInstance.exports['__napi_register__find_imports_19']?.()
71
+ __napiInstance.exports['__napi_register__transfer_project_graph_20']?.()
72
+ __napiInstance.exports['__napi_register__ExternalNode_struct_21']?.()
73
+ __napiInstance.exports['__napi_register__Target_struct_22']?.()
74
+ __napiInstance.exports['__napi_register__Project_struct_23']?.()
75
+ __napiInstance.exports['__napi_register__ProjectGraph_struct_24']?.()
76
+ __napiInstance.exports['__napi_register__HashPlanInspector_struct_25']?.()
77
+ __napiInstance.exports['__napi_register__HashPlanInspector_impl_28']?.()
78
+ __napiInstance.exports['__napi_register__HashPlanner_struct_29']?.()
79
+ __napiInstance.exports['__napi_register__HashPlanner_impl_33']?.()
80
+ __napiInstance.exports['__napi_register__HashDetails_struct_34']?.()
81
+ __napiInstance.exports['__napi_register__HasherOptions_struct_35']?.()
82
+ __napiInstance.exports['__napi_register__TaskHasher_struct_36']?.()
83
+ __napiInstance.exports['__napi_register__TaskHasher_impl_39']?.()
84
+ __napiInstance.exports['__napi_register__Task_struct_40']?.()
85
+ __napiInstance.exports['__napi_register__TaskTarget_struct_41']?.()
86
+ __napiInstance.exports['__napi_register__TaskResult_struct_42']?.()
87
+ __napiInstance.exports['__napi_register__TaskGraph_struct_43']?.()
88
+ __napiInstance.exports['__napi_register__FileData_struct_44']?.()
89
+ __napiInstance.exports['__napi_register__InputsInput_struct_45']?.()
90
+ __napiInstance.exports['__napi_register__FileSetInput_struct_46']?.()
91
+ __napiInstance.exports['__napi_register__RuntimeInput_struct_47']?.()
92
+ __napiInstance.exports['__napi_register__EnvironmentInput_struct_48']?.()
93
+ __napiInstance.exports['__napi_register__ExternalDependenciesInput_struct_49']?.()
94
+ __napiInstance.exports['__napi_register__DepsOutputsInput_struct_50']?.()
95
+ __napiInstance.exports['__napi_register__NxJson_struct_51']?.()
96
+ __napiInstance.exports['__napi_register__is_ai_agent_52']?.()
97
+ __napiInstance.exports['__napi_register__FileLock_struct_53']?.()
98
+ __napiInstance.exports['__napi_register__FileLock_impl_55']?.()
99
+ __napiInstance.exports['__napi_register__WorkspaceContext_struct_56']?.()
100
+ __napiInstance.exports['__napi_register__WorkspaceContext_impl_67']?.()
101
+ __napiInstance.exports['__napi_register__WorkspaceErrors_68']?.()
102
+ __napiInstance.exports['__napi_register__NxWorkspaceFiles_struct_69']?.()
103
+ __napiInstance.exports['__napi_register__NxWorkspaceFilesExternals_struct_70']?.()
104
+ __napiInstance.exports['__napi_register__UpdatedWorkspaceFiles_struct_71']?.()
105
+ __napiInstance.exports['__napi_register__FileMap_struct_72']?.()
106
+ __napiInstance.exports['__napi_register____test_only_transfer_file_map_73']?.()
105
107
  }
106
108
  export const FileLock = __napiModule.exports.FileLock
109
+ export const HashPlanInspector = __napiModule.exports.HashPlanInspector
107
110
  export const HashPlanner = __napiModule.exports.HashPlanner
108
111
  export const ImportResult = __napiModule.exports.ImportResult
109
112
  export const NxConsolePreferences = __napiModule.exports.NxConsolePreferences
@@ -120,8 +123,8 @@ export const hashArray = __napiModule.exports.hashArray
120
123
  export const hashFile = __napiModule.exports.hashFile
121
124
  export const installNxConsole = __napiModule.exports.installNxConsole
122
125
  export const IS_WASM = __napiModule.exports.IS_WASM
126
+ export const isAiAgent = __napiModule.exports.isAiAgent
123
127
  export const logDebug = __napiModule.exports.logDebug
124
- export const logError = __napiModule.exports.logError
125
128
  export const remove = __napiModule.exports.remove
126
129
  export const testOnlyTransferFileMap = __napiModule.exports.testOnlyTransferFileMap
127
130
  export const transferProjectGraph = __napiModule.exports.transferProjectGraph
Binary file
@@ -1 +1 @@
1
- {"version":3,"file":"nx-console-prompt.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/utils/nx-console-prompt.ts"],"names":[],"mappings":"AASA,wBAAsB,wBAAwB,kBAmB7C"}
1
+ {"version":3,"file":"nx-console-prompt.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/utils/nx-console-prompt.ts"],"names":[],"mappings":"AASA,wBAAsB,wBAAwB,kBA4B7C"}
@@ -9,6 +9,14 @@ async function ensureNxConsoleInstalled() {
9
9
  const preferences = new native_1.NxConsolePreferences((0, os_1.homedir)());
10
10
  let setting = preferences.getAutoInstallPreference();
11
11
  const canInstallConsole = (0, native_1.canInstallNxConsole)();
12
+ // If user previously opted in but extension is not installed,
13
+ // they must have manually uninstalled it - respect that choice
14
+ if (setting === true && canInstallConsole) {
15
+ // User had auto-install enabled but extension is missing
16
+ // This means they manually uninstalled it
17
+ preferences.setAutoInstallPreference(false);
18
+ return;
19
+ }
12
20
  // Noop
13
21
  if (!canInstallConsole) {
14
22
  return;
@@ -13,6 +13,7 @@ export interface PackageManagerCommands {
13
13
  run: (script: string, args?: string) => string;
14
14
  getRegistryUrl?: string;
15
15
  publish: (packageRoot: string, registry: string, registryConfigKey: string, tag: string) => string;
16
+ ignoreScriptsFlag?: string;
16
17
  }
17
18
  /**
18
19
  * Detects which package manager is used in the workspace based on the lock file.
@@ -1 +1 @@
1
- {"version":3,"file":"package-manager.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/utils/package-manager.ts"],"names":[],"mappings":"AA+BA,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;AAE7D,MAAM,WAAW,sBAAsB;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAE/C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,CACP,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,iBAAiB,EAAE,MAAM,EACzB,GAAG,EAAE,MAAM,KACR,MAAM,CAAC;CACb;AAED;;GAEG;AACH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AAM,EACf,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,MAAM,CAAC,CAoBjB;AAED,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,GACd,OAAO,CAAC;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,CAsBlC;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,cAAc,GAAE,cAAuC,EACvD,IAAI,GAAE,MAAsB,GAC3B,MAAM,EAAE,CAoBV;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,MAAM,EACnB,cAAc,GAAE,cAAuC,EACvD,UAAU,GAAE,MAAM,EAAyC,EAC3D,IAAI,GAAE,MAAsB,GAC3B,IAAI,CAiEN"}
1
+ {"version":3,"file":"package-manager.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/utils/package-manager.ts"],"names":[],"mappings":"AA+BA,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;AAE7D,MAAM,WAAW,sBAAsB;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAE/C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,CACP,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,iBAAiB,EAAE,MAAM,EACzB,GAA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AO,CAAC,MAAM,CAAC,CAgBjB;AAED,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,MAAM,CAAC,CAoBjB;AAED,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,GACd,OAAO,CAAC;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,CAsBlC;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,cAAc,GAAE,cAAuC,EACvD,IAAI,GAAE,MAAsB,GAC3B,MAAM,EAAE,CAoBV;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,MAAM,EACnB,cAAc,GAAE,cAAuC,EACvD,UAAU,GAAE,MAAM,EAAyC,EAC3D,IAAI,GAAE,MAAsB,GAC3B,IAAI,CAiEN"}
@@ -95,6 +95,7 @@ function getPackageManagerCommand(packageManager = detectPackageManager(), root
95
95
  yarnVersion = 'latest';
96
96
  useBerry = true;
97
97
  }
98
+ // new versions of yarn only support ignoring scripts via .yarnrc.yml
98
99
  return {
99
100
  preInstall: `yarn set version ${yarnVersion}`,
100
101
  install: 'yarn',
@@ -108,13 +109,14 @@ function getPackageManagerCommand(packageManager = detectPackageManager(), root
108
109
  addDev: useBerry ? 'yarn add -D' : 'yarn add -D -W',
109
110
  rm: 'yarn remove',
110
111
  exec: 'yarn',
111
- dlx: useBerry ? 'yarn dlx' : 'yarn',
112
+ dlx: useBerry ? 'yarn dlx' : 'npx',
112
113
  run: (script, args) => `yarn ${script}${args ? ` ${args}` : ''}`,
113
114
  list: useBerry ? 'yarn info --name-only' : 'yarn list',
114
115
  getRegistryUrl: useBerry
115
116
  ? 'yarn config get npmRegistryServer'
116
117
  : 'yarn config get registry',
117
118
  publish: (packageRoot, registry, registryConfigKey, tag) => `npm publish "${packageRoot}" --json --"${registryConfigKey}=${registry}" --tag=${tag}`,
119
+ ignoreScriptsFlag: useBerry ? undefined : `--ignore-scripts`,
118
120
  };
119
121
  },
120
122
  pnpm: () => {
@@ -150,6 +152,7 @@ function getPackageManagerCommand(packageManager = detectPackageManager(), root
150
152
  list: 'pnpm ls --depth 100',
151
153
  getRegistryUrl: 'pnpm config get registry',
152
154
  publish: (packageRoot, registry, registryConfigKey, tag) => `pnpm publish "${packageRoot}" --json --"${allowRegistryConfigKey ? registryConfigKey : 'registry'}=${registry}" --tag=${tag} --no-git-checks`,
155
+ ignoreScriptsFlag: '--ignore-scripts',
153
156
  };
154
157
  },
155
158
  npm: () => {
@@ -168,6 +171,7 @@ function getPackageManagerCommand(packageManager = detectPackageManager(), root
168
171
  list: 'npm ls',
169
172
  getRegistryUrl: 'npm config get registry',
170
173
  publish: (packageRoot, registry, registryConfigKey, tag) => `npm publish "${packageRoot}" --json --"${registryConfigKey}=${registry}" --tag=${tag}`,
174
+ ignoreScriptsFlag: '--ignore-scripts',
171
175
  };
172
176
  },
173
177
  bun: () => {
@@ -185,6 +189,7 @@ function getPackageManagerCommand(packageManager = detectPackageManager(), root
185
189
  list: 'bun pm ls',
186
190
  // Unlike npm, bun publish does not support a custom registryConfigKey option
187
191
  publish: (packageRoot, registry, registryConfigKey, tag) => `bun publish --cwd="${packageRoot}" --json --registry="${registry}" --tag=${tag}`,
192
+ ignoreScriptsFlag: '--ignore-scripts',
188
193
  };
189
194
  },
190
195
  };
@@ -0,0 +1,46 @@
1
+ export declare function ensurePackageHasProvenance(packageName: string, packageVersion: string): Promise<void>;
2
+ export declare const noProvenanceError: (packageName: string, packageVersion: string, error?: string) => string;
3
+ export declare function getNxPackageGroup(): string[];
4
+ export type DecodedAttestationPayload = {
5
+ _type: 'https://in-toto.io/Statement/v1';
6
+ subject: unknown[];
7
+ predicateType: 'https://slsa.dev/provenance/v1';
8
+ predicate: {
9
+ buildDefinition: {
10
+ buildType: string;
11
+ externalParameters: Record<string, any>;
12
+ internalParameters?: Record<string, any>;
13
+ resolvedDependencies?: ResourceDescriptor[];
14
+ };
15
+ runDetails: {
16
+ builder: {
17
+ id: string;
18
+ builderDependencies?: ResourceDescriptor[];
19
+ version?: Record<string, string>;
20
+ };
21
+ metadata?: {
22
+ invocationId?: string;
23
+ startedOn?: string;
24
+ finishedOn?: string;
25
+ };
26
+ byproducts?: ResourceDescriptor[];
27
+ };
28
+ };
29
+ };
30
+ export interface ResourceDescriptor {
31
+ uri?: string;
32
+ digest?: {
33
+ sha256?: string;
34
+ sha512?: string;
35
+ gitCommit?: string;
36
+ [key: string]: string | undefined;
37
+ };
38
+ name?: string;
39
+ downloadLocation?: string;
40
+ mediaType?: string;
41
+ content?: string;
42
+ annotations?: {
43
+ [key: string]: any;
44
+ };
45
+ }
46
+ //# sourceMappingURL=provenance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provenance.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/utils/provenance.ts"],"names":[],"mappings":"AAYA,wBAAsB,0BAA0B,CAC9C,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,IAAI,CAAC,CA4Ff;AAED,eAAO,MAAM,iBAAiB,GAC5B,aAAa,MAAM,EACnB,gBAAgB,MAAM,EACtB,QAAQ,MAAM,WAIZ,CAAC;AAEL,wBAAgB,iBAAiB,IAAI,MAAM,EAAE,CAQ5C;AAoBD,MAAM,MAAM,yBAAyB,GAAG;IACtC,KAAK,EAAE,iCAAiC,CAAC;IACzC,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,aAAa,EAAE,gCAAgC,CAAC;IAChD,SAAS,EAAE;QACT,eAAe,EAAE;YACf,SAAS,EAAE,MAAM,CAAC;YAClB,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;YACxC,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;YACzC,oBAAoB,CAAC,EAAE,kBAAkB,EAAE,CAAC;SAC7C,CAAC;QACF,UAAU,EAAE;YACV,OAAO,EAAE;gBACP,EAAE,EAAE,MAAM,CAAC;gBACX,mBAAmB,CAAC,EAAE,kBAAkB,EAAE,CAAC;gBAC3C,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;aAClC,CAAC;YACF,QAAQ,CAAC,EAAE;gBACT,YAAY,CAAC,EAAE,MAAM,CAAC;gBACtB,SAAS,CAAC,EAAE,MAAM,CAAC;gBACnB,UAAU,CAAC,EAAE,MAAM,CAAC;aACrB,CAAC;YACF,UAAU,CAAC,EAAE,kBAAkB,EAAE,CAAC;SACnC,CAAC;KACH,CAAC;CACH,CAAC;AAEF,MAAM,WAAW,kBAAkB;IACjC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE;QACP,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;KACnC,CAAC;IACF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE;QACZ,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;CACH"}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.noProvenanceError = void 0;
4
+ exports.ensurePackageHasProvenance = ensurePackageHasProvenance;
5
+ exports.getNxPackageGroup = getNxPackageGroup;
6
+ const child_process_1 = require("child_process");
7
+ const path_1 = require("path");
8
+ const util_1 = require("util");
9
+ const fileutils_1 = require("./fileutils");
10
+ /*
11
+ * Verifies that the given npm package has provenance attestations
12
+ * generated by the GitHub Actions workflow at .github/workflows/publish.yml
13
+ * in the nrwl/nx repository.
14
+ *
15
+ * Will throw if the package does not have valid provenance.
16
+ */
17
+ async function ensurePackageHasProvenance(packageName, packageVersion) {
18
+ // this is used for locally released versions without provenance
19
+ // do not set this for other reasons or you might be exposed to security risks
20
+ if (process.env.NX_SKIP_PROVENANCE_CHECK) {
21
+ return;
22
+ }
23
+ const execFileAsync = (0, util_1.promisify)(child_process_1.execFile);
24
+ const npmViewResult = JSON.parse((await execFileAsync('npm', ['view', `${packageName}@${packageVersion}`, '--json', '--silent'], {
25
+ timeout: 20000,
26
+ })).stdout.trim());
27
+ const attURL = npmViewResult.dist?.attestations?.url;
28
+ if (!attURL)
29
+ throw (0, exports.noProvenanceError)(packageName, packageVersion, 'No attestation URL found');
30
+ const attestations = (await (await fetch(attURL)).json());
31
+ const provenanceAttestation = attestations?.attestations?.find((a) => a.predicateType === 'https://slsa.dev/provenance/v1');
32
+ if (!provenanceAttestation)
33
+ throw (0, exports.noProvenanceError)(packageName, packageVersion, 'No provenance attestation found');
34
+ const dsseEnvelopePayload = JSON.parse(Buffer.from(provenanceAttestation.bundle.dsseEnvelope.payload, 'base64').toString());
35
+ const workflowParameters = dsseEnvelopePayload?.predicate?.buildDefinition?.externalParameters
36
+ ?.workflow;
37
+ // verify that provenance was actually generated from the right publishing workflow
38
+ if (workflowParameters?.repository !== 'https://github.com/nrwl/nx') {
39
+ throw (0, exports.noProvenanceError)(packageName, packageVersion, 'Repository does not match nrwl/nx');
40
+ }
41
+ if (workflowParameters?.path !== '.github/workflows/publish.yml') {
42
+ throw (0, exports.noProvenanceError)(packageName, packageVersion, 'Publishing workflow does not match .github/workflows/publish.yml');
43
+ }
44
+ if (workflowParameters?.ref !== `refs/tags/${npmViewResult.version}`) {
45
+ throw (0, exports.noProvenanceError)(packageName, packageVersion, `Version ref does not match refs/tags/${npmViewResult.version}`);
46
+ }
47
+ // verify that provenance was generated from the exact same artifact as the one we are installing
48
+ const distSha = Buffer.from(npmViewResult.dist.integrity.replace('sha512-', ''), 'base64').toString('hex');
49
+ const attestationSha = dsseEnvelopePayload?.subject[0]?.digest.sha512;
50
+ if (distSha !== attestationSha) {
51
+ throw (0, exports.noProvenanceError)(packageName, packageVersion, 'Integrity hash does not match attestation hash');
52
+ }
53
+ return;
54
+ }
55
+ const noProvenanceError = (packageName, packageVersion, error) => `An error occurred while checking the provenance of ${packageName}@${packageVersion}. This could indicate a security risk. Please double check https://www.npmjs.com/package/${packageName} to see if the package is published correctly or file an issue at https://github.com/nrwl/nx/issues \n Error: ${error ?? ''}`;
56
+ exports.noProvenanceError = noProvenanceError;
57
+ function getNxPackageGroup() {
58
+ const packageJsonPath = (0, path_1.join)(__dirname, '../../package.json');
59
+ const packageJson = (0, fileutils_1.readJsonFile)(packageJsonPath);
60
+ const packages = packageJson['nx-migrations'].packageGroup.filter((dep) => typeof dep === 'string' && dep.startsWith('@nx/'));
61
+ packages.push('nx');
62
+ return packages;
63
+ }