@rushstack/lockfile-explorer 1.4.17 → 1.5.0

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 (57) hide show
  1. package/bin/lockfile-explorer +1 -1
  2. package/bin/lockfile-lint +2 -0
  3. package/lib/assets/lint-init/lockfile-lint-template.json +42 -0
  4. package/lib/cli/explorer/ExplorerCommandLineParser.d.ts +12 -0
  5. package/lib/cli/explorer/ExplorerCommandLineParser.d.ts.map +1 -0
  6. package/lib/cli/explorer/ExplorerCommandLineParser.js +205 -0
  7. package/lib/cli/explorer/ExplorerCommandLineParser.js.map +1 -0
  8. package/lib/cli/lint/LintCommandLineParser.d.ts +10 -0
  9. package/lib/cli/lint/LintCommandLineParser.d.ts.map +1 -0
  10. package/lib/cli/lint/LintCommandLineParser.js +35 -0
  11. package/lib/cli/lint/LintCommandLineParser.js.map +1 -0
  12. package/lib/cli/lint/actions/CheckAction.d.ts +27 -0
  13. package/lib/cli/lint/actions/CheckAction.d.ts.map +1 -0
  14. package/lib/cli/lint/actions/CheckAction.js +145 -0
  15. package/lib/cli/lint/actions/CheckAction.js.map +1 -0
  16. package/lib/cli/lint/actions/InitAction.d.ts +8 -0
  17. package/lib/cli/lint/actions/InitAction.d.ts.map +1 -0
  18. package/lib/cli/lint/actions/InitAction.js +45 -0
  19. package/lib/cli/lint/actions/InitAction.js.map +1 -0
  20. package/lib/constants/common.d.ts +3 -0
  21. package/lib/constants/common.d.ts.map +1 -0
  22. package/lib/constants/common.js +8 -0
  23. package/lib/constants/common.js.map +1 -0
  24. package/lib/schemas/lockfile-lint.schema.json +45 -0
  25. package/lib/start-explorer.d.ts +2 -0
  26. package/lib/start-explorer.d.ts.map +1 -0
  27. package/lib/start-explorer.js +8 -0
  28. package/lib/start-explorer.js.map +1 -0
  29. package/lib/start-lint.d.ts +2 -0
  30. package/lib/start-lint.d.ts.map +1 -0
  31. package/lib/start-lint.js +8 -0
  32. package/lib/start-lint.js.map +1 -0
  33. package/lib/{init.d.ts → utils/init.d.ts} +1 -1
  34. package/lib/utils/init.d.ts.map +1 -0
  35. package/lib/{init.js → utils/init.js} +1 -1
  36. package/lib/utils/init.js.map +1 -0
  37. package/lib/utils/shrinkwrap.d.ts +11 -0
  38. package/lib/utils/shrinkwrap.d.ts.map +1 -0
  39. package/lib/{utils.js → utils/shrinkwrap.js} +37 -2
  40. package/lib/utils/shrinkwrap.js.map +1 -0
  41. package/package.json +13 -7
  42. package/lib/commandLine.d.ts +0 -7
  43. package/lib/commandLine.d.ts.map +0 -1
  44. package/lib/commandLine.js +0 -53
  45. package/lib/commandLine.js.map +0 -1
  46. package/lib/commandLine.test.d.ts +0 -2
  47. package/lib/commandLine.test.d.ts.map +0 -1
  48. package/lib/commandLine.test.js.map +0 -1
  49. package/lib/init.d.ts.map +0 -1
  50. package/lib/init.js.map +0 -1
  51. package/lib/start.d.ts +0 -2
  52. package/lib/start.d.ts.map +0 -1
  53. package/lib/start.js +0 -215
  54. package/lib/start.js.map +0 -1
  55. package/lib/utils.d.ts +0 -2
  56. package/lib/utils.d.ts.map +0 -1
  57. package/lib/utils.js.map +0 -1
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
+ // See LICENSE in the project root for license information.
4
+ var __importDefault = (this && this.__importDefault) || function (mod) {
5
+ return (mod && mod.__esModule) ? mod : { "default": mod };
6
+ };
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.InitAction = void 0;
9
+ const ts_command_line_1 = require("@rushstack/ts-command-line");
10
+ const terminal_1 = require("@rushstack/terminal");
11
+ const rush_sdk_1 = require("@rushstack/rush-sdk");
12
+ const node_core_library_1 = require("@rushstack/node-core-library");
13
+ const path_1 = __importDefault(require("path"));
14
+ const common_1 = require("../../../constants/common");
15
+ class InitAction extends ts_command_line_1.CommandLineAction {
16
+ constructor(parser) {
17
+ super({
18
+ actionName: 'init',
19
+ summary: `Create a new ${common_1.LOCKFILE_LINT_JSON_FILENAME} config file`,
20
+ documentation: `This command initializes a new ${common_1.LOCKFILE_LINT_JSON_FILENAME} config file.` +
21
+ ` The created template file includes source code comments that document the settings.`
22
+ });
23
+ this._terminal = parser.globalTerminal;
24
+ }
25
+ async onExecute() {
26
+ const rushConfiguration = rush_sdk_1.RushConfiguration.tryLoadFromDefaultLocation();
27
+ if (!rushConfiguration) {
28
+ throw new Error('The "lockfile-explorer check" must be executed in a folder that is under a Rush workspace folder');
29
+ }
30
+ const inputFilePath = path_1.default.resolve(__dirname, '../../../assets/lint-init/lockfile-lint-template.json');
31
+ const outputFilePath = path_1.default.resolve(rushConfiguration.commonFolder, 'config', common_1.LOCKFILE_EXPLORER_FOLDERNAME, common_1.LOCKFILE_LINT_JSON_FILENAME);
32
+ if (await node_core_library_1.FileSystem.existsAsync(outputFilePath)) {
33
+ this._terminal.writeError('The output file already exists:');
34
+ this._terminal.writeLine('\n ' + outputFilePath + '\n');
35
+ throw new Error('Unable to write output file');
36
+ }
37
+ this._terminal.writeLine(terminal_1.Colorize.green('Writing file: ') + outputFilePath);
38
+ await node_core_library_1.FileSystem.copyFileAsync({
39
+ sourcePath: inputFilePath,
40
+ destinationPath: outputFilePath
41
+ });
42
+ }
43
+ }
44
+ exports.InitAction = InitAction;
45
+ //# sourceMappingURL=InitAction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InitAction.js","sourceRoot":"","sources":["../../../../src/cli/lint/actions/InitAction.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;AAE3D,gEAA+D;AAE/D,kDAA+D;AAC/D,kDAAwD;AACxD,oEAA0D;AAC1D,gDAAwB;AAGxB,sDAAsG;AAEtG,MAAa,UAAW,SAAQ,mCAAiB;IAG/C,YAAmB,MAA6B;QAC9C,KAAK,CAAC;YACJ,UAAU,EAAE,MAAM;YAClB,OAAO,EAAE,gBAAgB,oCAA2B,cAAc;YAClE,aAAa,EACX,kCAAkC,oCAA2B,eAAe;gBAC5E,uFAAuF;SAC1F,CAAC,CAAC;QACH,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;IACzC,CAAC;IAES,KAAK,CAAC,SAAS;QACvB,MAAM,iBAAiB,GAAkC,4BAAiB,CAAC,0BAA0B,EAAE,CAAC;QACxG,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CACb,kGAAkG,CACnG,CAAC;QACJ,CAAC;QACD,MAAM,aAAa,GAAW,cAAI,CAAC,OAAO,CACxC,SAAS,EACT,uDAAuD,CACxD,CAAC;QACF,MAAM,cAAc,GAAW,cAAI,CAAC,OAAO,CACzC,iBAAiB,CAAC,YAAY,EAC9B,QAAQ,EACR,qCAA4B,EAC5B,oCAA2B,CAC5B,CAAC;QAEF,IAAI,MAAM,8BAAU,CAAC,WAAW,CAAC,cAAc,CAAC,EAAE,CAAC;YACjD,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,iCAAiC,CAAC,CAAC;YAC7D,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,cAAc,GAAG,IAAI,CAAC,CAAC;YACzD,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACjD,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,mBAAQ,CAAC,KAAK,CAAC,gBAAgB,CAAC,GAAG,cAAc,CAAC,CAAC;QAC5E,MAAM,8BAAU,CAAC,aAAa,CAAC;YAC7B,UAAU,EAAE,aAAa;YACzB,eAAe,EAAE,cAAc;SAChC,CAAC,CAAC;IACL,CAAC;CACF;AA5CD,gCA4CC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { CommandLineAction } from '@rushstack/ts-command-line';\n\nimport { Colorize, type ITerminal } from '@rushstack/terminal';\nimport { RushConfiguration } from '@rushstack/rush-sdk';\nimport { FileSystem } from '@rushstack/node-core-library';\nimport path from 'path';\n\nimport type { LintCommandLineParser } from '../LintCommandLineParser';\nimport { LOCKFILE_EXPLORER_FOLDERNAME, LOCKFILE_LINT_JSON_FILENAME } from '../../../constants/common';\n\nexport class InitAction extends CommandLineAction {\n private readonly _terminal: ITerminal;\n\n public constructor(parser: LintCommandLineParser) {\n super({\n actionName: 'init',\n summary: `Create a new ${LOCKFILE_LINT_JSON_FILENAME} config file`,\n documentation:\n `This command initializes a new ${LOCKFILE_LINT_JSON_FILENAME} config file.` +\n ` The created template file includes source code comments that document the settings.`\n });\n this._terminal = parser.globalTerminal;\n }\n\n protected async onExecute(): Promise<void> {\n const rushConfiguration: RushConfiguration | undefined = RushConfiguration.tryLoadFromDefaultLocation();\n if (!rushConfiguration) {\n throw new Error(\n 'The \"lockfile-explorer check\" must be executed in a folder that is under a Rush workspace folder'\n );\n }\n const inputFilePath: string = path.resolve(\n __dirname,\n '../../../assets/lint-init/lockfile-lint-template.json'\n );\n const outputFilePath: string = path.resolve(\n rushConfiguration.commonFolder,\n 'config',\n LOCKFILE_EXPLORER_FOLDERNAME,\n LOCKFILE_LINT_JSON_FILENAME\n );\n\n if (await FileSystem.existsAsync(outputFilePath)) {\n this._terminal.writeError('The output file already exists:');\n this._terminal.writeLine('\\n ' + outputFilePath + '\\n');\n throw new Error('Unable to write output file');\n }\n\n this._terminal.writeLine(Colorize.green('Writing file: ') + outputFilePath);\n await FileSystem.copyFileAsync({\n sourcePath: inputFilePath,\n destinationPath: outputFilePath\n });\n }\n}\n"]}
@@ -0,0 +1,3 @@
1
+ export declare const LOCKFILE_LINT_JSON_FILENAME: 'lockfile-lint.json';
2
+ export declare const LOCKFILE_EXPLORER_FOLDERNAME: 'lockfile-explorer';
3
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/constants/common.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,2BAA2B,EAAE,oBAA2C,CAAC;AAEtF,eAAO,MAAM,4BAA4B,EAAE,mBAAyC,CAAC"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
+ // See LICENSE in the project root for license information.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.LOCKFILE_EXPLORER_FOLDERNAME = exports.LOCKFILE_LINT_JSON_FILENAME = void 0;
6
+ exports.LOCKFILE_LINT_JSON_FILENAME = 'lockfile-lint.json';
7
+ exports.LOCKFILE_EXPLORER_FOLDERNAME = 'lockfile-explorer';
8
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/constants/common.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE9C,QAAA,2BAA2B,GAAyB,oBAAoB,CAAC;AAEzE,QAAA,4BAA4B,GAAwB,mBAAmB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nexport const LOCKFILE_LINT_JSON_FILENAME: 'lockfile-lint.json' = 'lockfile-lint.json';\n\nexport const LOCKFILE_EXPLORER_FOLDERNAME: 'lockfile-explorer' = 'lockfile-explorer';\n"]}
@@ -0,0 +1,45 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "title": "Lockfile Lint Configuration",
4
+ "description": "The lockfile-explorer.json configuration file for lockfile-lint tool.",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "properties": {
8
+ "$schema": {
9
+ "description": "Part of the JSON Schema standard, this optional keyword declares the URL of the schema that the file conforms to. Editors may download the schema and use it to perform syntax highlighting.",
10
+ "type": "string"
11
+ },
12
+ "rules": {
13
+ "description": "The rules adopted by Monorepo and the lockfile-lint will help to check.",
14
+ "type": "array",
15
+ "items": {
16
+ "type": "object",
17
+ "oneOf": [
18
+ {
19
+ "type": "object",
20
+ "required": ["rule", "project", "requiredVersions"],
21
+ "properties": {
22
+ "rule": {
23
+ "description": "Rule name applied to the project.",
24
+ "const": "restrict-versions"
25
+ },
26
+ "project": {
27
+ "description": "Project name.",
28
+ "type": "string"
29
+ },
30
+ "requiredVersions": {
31
+ "description": "List of restrict dependency version.",
32
+ "type": "object",
33
+ "patternProperties": {
34
+ ".*": {
35
+ "type": "string"
36
+ }
37
+ }
38
+ }
39
+ }
40
+ }
41
+ ]
42
+ }
43
+ }
44
+ }
45
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=start-explorer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"start-explorer.d.ts","sourceRoot":"","sources":["../src/start-explorer.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
+ // See LICENSE in the project root for license information.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ const ExplorerCommandLineParser_1 = require("./cli/explorer/ExplorerCommandLineParser");
6
+ const parser = new ExplorerCommandLineParser_1.ExplorerCommandLineParser();
7
+ parser.executeAsync().catch(console.error); // CommandLineParser.executeAsync() should never reject the promise
8
+ //# sourceMappingURL=start-explorer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"start-explorer.js","sourceRoot":"","sources":["../src/start-explorer.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;AAE3D,wFAAqF;AAErF,MAAM,MAAM,GAA8B,IAAI,qDAAyB,EAAE,CAAC;AAE1E,MAAM,CAAC,YAAY,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,mEAAmE","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { ExplorerCommandLineParser } from './cli/explorer/ExplorerCommandLineParser';\n\nconst parser: ExplorerCommandLineParser = new ExplorerCommandLineParser();\n\nparser.executeAsync().catch(console.error); // CommandLineParser.executeAsync() should never reject the promise\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=start-lint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"start-lint.d.ts","sourceRoot":"","sources":["../src/start-lint.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
+ // See LICENSE in the project root for license information.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ const LintCommandLineParser_1 = require("./cli/lint/LintCommandLineParser");
6
+ const parser = new LintCommandLineParser_1.LintCommandLineParser();
7
+ parser.executeAsync().catch(console.error); // CommandLineParser.executeAsync() should never reject the promise
8
+ //# sourceMappingURL=start-lint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"start-lint.js","sourceRoot":"","sources":["../src/start-lint.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;AAE3D,4EAAyE;AAEzE,MAAM,MAAM,GAA0B,IAAI,6CAAqB,EAAE,CAAC;AAElE,MAAM,CAAC,YAAY,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,mEAAmE","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { LintCommandLineParser } from './cli/lint/LintCommandLineParser';\n\nconst parser: LintCommandLineParser = new LintCommandLineParser();\n\nparser.executeAsync().catch(console.error); // CommandLineParser.executeAsync() should never reject the promise\n"]}
@@ -1,4 +1,4 @@
1
- import { type IAppState } from './state';
1
+ import { type IAppState } from '../state';
2
2
  export declare const init: (options: {
3
3
  lockfileExplorerProjectRoot: string;
4
4
  appVersion: string;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/utils/init.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,KAAK,SAAS,EAAyC,MAAM,UAAU,CAAC;AAEjF,eAAO,MAAM,IAAI,YAAa;IAC5B,2BAA2B,EAAE,MAAM,CAAC;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB,KAAG,SA+DH,CAAC"}
@@ -11,7 +11,7 @@ exports.init = void 0;
11
11
  const node_core_library_1 = require("@rushstack/node-core-library");
12
12
  const RushConfiguration_1 = require("@microsoft/rush-lib/lib/api/RushConfiguration");
13
13
  const path_1 = __importDefault(require("path"));
14
- const state_1 = require("./state");
14
+ const state_1 = require("../state");
15
15
  const init = (options) => {
16
16
  const { lockfileExplorerProjectRoot, appVersion, debugMode, subspaceName } = options;
17
17
  const currDir = process.cwd();
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/utils/init.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;AAE3D,uHAAuH;AACvH,6DAA6D;AAE7D,oEAAgE;AAChE,qFAAkF;AAElF,gDAAwB;AAExB,oCAAiF;AAE1E,MAAM,IAAI,GAAG,CAAC,OAKpB,EAAa,EAAE;IACd,MAAM,EAAE,2BAA2B,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;IACrF,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAE9B,IAAI,QAA+B,CAAC;IACpC,IAAI,eAAe,GAAG,wBAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACrD,OAAO,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACrC,sFAAsF;QACtF,MAAM,YAAY,GAAW,cAAI,CAAC,OAAO,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC;QACxE,MAAM,YAAY,GAAW,cAAI,CAAC,OAAO,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC;QAC7E,IAAI,8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CAAC,eAAe,EAAE,eAAe,CAAC;gBAChE,WAAW,EAAE,eAAe;aAC7B,CAAC;YAEF,MAAM;QACR,CAAC;QAED,eAAe,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC,EAAE,eAAe,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;IACnF,CAAC;IAED,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AApEW,QAAA,IAAI,QAoEf","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\n// This function will read the current directory and try to figure out if it's a rush project or regular pnpm workspace\n// Currently it will throw error if neither can be determined\n\nimport { FileSystem, Path } from '@rushstack/node-core-library';\nimport { RushConfiguration } from '@microsoft/rush-lib/lib/api/RushConfiguration';\nimport type { Subspace } from '@microsoft/rush-lib/lib/api/Subspace';\nimport path from 'path';\n\nimport { type IAppState, type IRushProjectDetails, ProjectType } from '../state';\n\nexport const init = (options: {\n lockfileExplorerProjectRoot: string;\n appVersion: string;\n debugMode: boolean;\n subspaceName: string;\n}): IAppState => {\n const { lockfileExplorerProjectRoot, appVersion, debugMode, subspaceName } = options;\n const currDir = process.cwd();\n\n let appState: IAppState | undefined;\n let currExploredDir = Path.convertToSlashes(currDir);\n while (currExploredDir.includes('/')) {\n // Look for a rush.json [rush project] or pnpm-lock.yaml file [regular pnpm workspace]\n const rushJsonPath: string = path.resolve(currExploredDir, 'rush.json');\n const pnpmLockPath: string = path.resolve(currExploredDir, 'pnpm-lock.yaml');\n if (FileSystem.exists(rushJsonPath)) {\n console.log('Found a Rush workspace: ', rushJsonPath);\n\n const rushConfiguration: RushConfiguration = RushConfiguration.tryLoadFromDefaultLocation()!;\n const subspace: Subspace = rushConfiguration.getSubspace(subspaceName);\n const workspaceFolder: string = subspace.getSubspaceTempFolder();\n\n const projectsByProjectFolder: Map<string, IRushProjectDetails> = new Map();\n for (const project of rushConfiguration.projects) {\n projectsByProjectFolder.set(project.projectFolder, {\n projectName: project.packageName,\n projectFolder: project.projectFolder\n });\n }\n\n appState = {\n currDir,\n appVersion,\n debugMode,\n lockfileExplorerProjectRoot,\n projectType: ProjectType.RUSH_PROJECT,\n pnpmLockfileLocation: path.resolve(workspaceFolder, 'pnpm-lock.yaml'),\n pnpmfileLocation: path.resolve(workspaceFolder, '.pnpmfile.cjs'),\n projectRoot: currExploredDir,\n rush: {\n rushJsonPath,\n projectsByProjectFolder\n }\n };\n break;\n } else if (FileSystem.exists(pnpmLockPath)) {\n appState = {\n currDir,\n appVersion,\n debugMode,\n lockfileExplorerProjectRoot,\n projectType: ProjectType.PNPM_WORKSPACE,\n pnpmLockfileLocation: path.resolve(currExploredDir, 'pnpm-lock.yaml'),\n pnpmfileLocation: path.resolve(currExploredDir, '.pnpmfile.cjs'),\n projectRoot: currExploredDir\n };\n\n break;\n }\n\n currExploredDir = currExploredDir.substring(0, currExploredDir.lastIndexOf('/'));\n }\n\n if (!appState) {\n throw new Error('Could not find a Rush or PNPM workspace!');\n }\n\n return appState;\n};\n"]}
@@ -0,0 +1,11 @@
1
+ interface IPackageInfo {
2
+ name: string;
3
+ peersSuffix: string | undefined;
4
+ version: string;
5
+ }
6
+ export declare function convertLockfileV6DepPathToV5DepPath(newDepPath: string): string;
7
+ export declare function parseDependencyPath(shrinkwrapFileMajorVersion: number, newDepPath: string): IPackageInfo;
8
+ export declare function getShrinkwrapFileMajorVersion(lockfileVersion: string | number): number;
9
+ export declare function splicePackageWithVersion(shrinkwrapFileMajorVersion: number, dependencyPackageName: string, dependencyPackageVersion: string): string;
10
+ export {};
11
+ //# sourceMappingURL=shrinkwrap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shrinkwrap.d.ts","sourceRoot":"","sources":["../../src/utils/shrinkwrap.ts"],"names":[],"mappings":"AAKA,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,mCAAmC,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAK9E;AAED,wBAAgB,mBAAmB,CAAC,0BAA0B,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,YAAY,CAWxG;AAED,wBAAgB,6BAA6B,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAmBtF;AAED,wBAAgB,wBAAwB,CACtC,0BAA0B,EAAE,MAAM,EAClC,qBAAqB,EAAE,MAAM,EAC7B,wBAAwB,EAAE,MAAM,GAC/B,MAAM,CAER"}
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  return result;
26
26
  };
27
27
  Object.defineProperty(exports, "__esModule", { value: true });
28
- exports.convertLockfileV6DepPathToV5DepPath = void 0;
28
+ exports.splicePackageWithVersion = exports.getShrinkwrapFileMajorVersion = exports.parseDependencyPath = exports.convertLockfileV6DepPathToV5DepPath = void 0;
29
29
  const dp = __importStar(require("@pnpm/dependency-path"));
30
30
  function convertLockfileV6DepPathToV5DepPath(newDepPath) {
31
31
  if (!newDepPath.includes('@', 2) || newDepPath.startsWith('file:'))
@@ -36,4 +36,39 @@ function convertLockfileV6DepPathToV5DepPath(newDepPath) {
36
36
  return `${newDepPath.substring(0, index)}/${newDepPath.substring(index + 1)}`;
37
37
  }
38
38
  exports.convertLockfileV6DepPathToV5DepPath = convertLockfileV6DepPathToV5DepPath;
39
- //# sourceMappingURL=utils.js.map
39
+ function parseDependencyPath(shrinkwrapFileMajorVersion, newDepPath) {
40
+ let dependencyPath = newDepPath;
41
+ if (shrinkwrapFileMajorVersion === 6) {
42
+ dependencyPath = convertLockfileV6DepPathToV5DepPath(newDepPath);
43
+ }
44
+ const packageInfo = dp.parse(dependencyPath);
45
+ return {
46
+ name: packageInfo.name,
47
+ peersSuffix: packageInfo.peersSuffix,
48
+ version: packageInfo.version
49
+ };
50
+ }
51
+ exports.parseDependencyPath = parseDependencyPath;
52
+ function getShrinkwrapFileMajorVersion(lockfileVersion) {
53
+ let shrinkwrapFileMajorVersion;
54
+ if (typeof lockfileVersion === 'string') {
55
+ const isDotIncluded = lockfileVersion.includes('.');
56
+ shrinkwrapFileMajorVersion = parseInt(lockfileVersion.substring(0, isDotIncluded ? lockfileVersion.indexOf('.') : undefined), 10);
57
+ }
58
+ else if (typeof lockfileVersion === 'number') {
59
+ shrinkwrapFileMajorVersion = Math.floor(lockfileVersion);
60
+ }
61
+ else {
62
+ shrinkwrapFileMajorVersion = 0;
63
+ }
64
+ if (shrinkwrapFileMajorVersion < 5 || shrinkwrapFileMajorVersion > 6) {
65
+ throw new Error('The current lockfile version is not supported.');
66
+ }
67
+ return shrinkwrapFileMajorVersion;
68
+ }
69
+ exports.getShrinkwrapFileMajorVersion = getShrinkwrapFileMajorVersion;
70
+ function splicePackageWithVersion(shrinkwrapFileMajorVersion, dependencyPackageName, dependencyPackageVersion) {
71
+ return `/${dependencyPackageName}${shrinkwrapFileMajorVersion === 6 ? '@' : '/'}${dependencyPackageVersion}`;
72
+ }
73
+ exports.splicePackageWithVersion = splicePackageWithVersion;
74
+ //# sourceMappingURL=shrinkwrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shrinkwrap.js","sourceRoot":"","sources":["../../src/utils/shrinkwrap.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,0DAA4C;AAQ5C,SAAgB,mCAAmC,CAAC,UAAkB;IACpE,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC;QAAE,OAAO,UAAU,CAAC;IACtF,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,EAAE,UAA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e,CAAC,CAAC;IAC3D,CAAC;SAAM,CAAC;QACN,0BAA0B,GAAG,CAAC,CAAC;IACjC,CAAC;IAED,IAAI,0BAA0B,GAAG,CAAC,IAAI,0BAA0B,GAAG,CAAC,EAAE,CAAC;QACrE,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IAED,OAAO,0BAA0B,CAAC;AACpC,CAAC;AAnBD,sEAmBC;AAED,SAAgB,wBAAwB,CACtC,0BAAkC,EAClC,qBAA6B,EAC7B,wBAAgC;IAEhC,OAAO,IAAI,qBAAqB,GAAG,0BAA0B,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,wBAAwB,EAAE,CAAC;AAC/G,CAAC;AAND,4DAMC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as dp from '@pnpm/dependency-path';\n\ninterface IPackageInfo {\n name: string;\n peersSuffix: string | undefined;\n version: string;\n}\n\nexport function convertLockfileV6DepPathToV5DepPath(newDepPath: string): string {\n if (!newDepPath.includes('@', 2) || newDepPath.startsWith('file:')) return newDepPath;\n const index = newDepPath.indexOf('@', newDepPath.indexOf('/@') + 2);\n if (newDepPath.includes('(') && index > dp.indexOfPeersSuffix(newDepPath)) return newDepPath;\n return `${newDepPath.substring(0, index)}/${newDepPath.substring(index + 1)}`;\n}\n\nexport function parseDependencyPath(shrinkwrapFileMajorVersion: number, newDepPath: string): IPackageInfo {\n let dependencyPath: string = newDepPath;\n if (shrinkwrapFileMajorVersion === 6) {\n dependencyPath = convertLockfileV6DepPathToV5DepPath(newDepPath);\n }\n const packageInfo = dp.parse(dependencyPath);\n return {\n name: packageInfo.name as string,\n peersSuffix: packageInfo.peersSuffix,\n version: packageInfo.version as string\n };\n}\n\nexport function getShrinkwrapFileMajorVersion(lockfileVersion: string | number): number {\n let shrinkwrapFileMajorVersion: number;\n if (typeof lockfileVersion === 'string') {\n const isDotIncluded: boolean = lockfileVersion.includes('.');\n shrinkwrapFileMajorVersion = parseInt(\n lockfileVersion.substring(0, isDotIncluded ? lockfileVersion.indexOf('.') : undefined),\n 10\n );\n } else if (typeof lockfileVersion === 'number') {\n shrinkwrapFileMajorVersion = Math.floor(lockfileVersion);\n } else {\n shrinkwrapFileMajorVersion = 0;\n }\n\n if (shrinkwrapFileMajorVersion < 5 || shrinkwrapFileMajorVersion > 6) {\n throw new Error('The current lockfile version is not supported.');\n }\n\n return shrinkwrapFileMajorVersion;\n}\n\nexport function splicePackageWithVersion(\n shrinkwrapFileMajorVersion: number,\n dependencyPackageName: string,\n dependencyPackageVersion: string\n): string {\n return `/${dependencyPackageName}${shrinkwrapFileMajorVersion === 6 ? '@' : '/'}${dependencyPackageVersion}`;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rushstack/lockfile-explorer",
3
- "version": "1.4.17",
3
+ "version": "1.5.0",
4
4
  "description": "Rush Lockfile Explorer: The UI for solving version conflicts quickly in a large monorepo",
5
5
  "keywords": [
6
6
  "conflict",
@@ -26,7 +26,9 @@
26
26
  "license": "MIT",
27
27
  "bin": {
28
28
  "lockfile-explorer": "./bin/lockfile-explorer",
29
- "lfx": "./bin/lockfile-explorer"
29
+ "lfx": "./bin/lockfile-explorer",
30
+ "lockfile-lint": "./bin/lockfile-lint",
31
+ "lflint": "./bin/lockfile-lint"
30
32
  },
31
33
  "peerDependencies": {
32
34
  "@types/express": "^4.17.21"
@@ -41,10 +43,11 @@
41
43
  "@types/express": "4.17.21",
42
44
  "@types/js-yaml": "3.12.1",
43
45
  "@types/update-notifier": "~6.0.1",
44
- "@pnpm/lockfile-types": "~6.0.0",
46
+ "@pnpm/lockfile-types": "^5.1.5",
47
+ "@types/semver": "7.5.0",
45
48
  "@rushstack/heft": "0.66.18",
46
- "local-node-rig": "1.0.0",
47
- "@rushstack/lockfile-explorer-web": "0.0.0"
49
+ "@rushstack/lockfile-explorer-web": "0.0.0",
50
+ "local-node-rig": "1.0.0"
48
51
  },
49
52
  "dependencies": {
50
53
  "cors": "~2.8.5",
@@ -53,9 +56,12 @@
53
56
  "open": "~8.4.0",
54
57
  "update-notifier": "~5.1.0",
55
58
  "@pnpm/dependency-path": "~2.1.2",
56
- "@microsoft/rush-lib": "5.126.0",
59
+ "semver": "~7.5.4",
60
+ "@microsoft/rush-lib": "5.129.4",
61
+ "@rushstack/node-core-library": "5.4.1",
57
62
  "@rushstack/terminal": "0.13.0",
58
- "@rushstack/node-core-library": "5.4.1"
63
+ "@rushstack/rush-sdk": "5.129.4",
64
+ "@rushstack/ts-command-line": "4.22.0"
59
65
  },
60
66
  "scripts": {
61
67
  "build": "heft build --clean",
@@ -1,7 +0,0 @@
1
- export interface ICommandLine {
2
- showedHelp: boolean;
3
- error: string | undefined;
4
- subspace: string | undefined;
5
- }
6
- export declare function parseCommandLine(args: string[]): ICommandLine;
7
- //# sourceMappingURL=commandLine.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"commandLine.d.ts","sourceRoot":"","sources":["../src/commandLine.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,OAAO,CAAC;IACpB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B;AAsBD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,YAAY,CAkC7D"}
@@ -1,53 +0,0 @@
1
- "use strict";
2
- // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
- // See LICENSE in the project root for license information.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.parseCommandLine = void 0;
6
- function showHelp() {
7
- console.log(`
8
- Usage: lockfile-explorer [--subspace SUBSPACE]
9
- lockfile-explorer [--help]
10
-
11
- Launches the Lockfile Explorer app. You can also use "lfx" as shorthand alias
12
- for "lockfile-explorer".
13
-
14
- Parameters:
15
-
16
- --help, -h
17
- Show command line help
18
-
19
- --subspace SUBSPACE, -s SUBSPACE
20
- Load the lockfile for the specified Rush subspace.
21
- `.trim());
22
- }
23
- function parseCommandLine(args) {
24
- const result = { showedHelp: false, error: undefined, subspace: undefined };
25
- let i = 0;
26
- while (i < args.length) {
27
- const parameter = args[i];
28
- ++i;
29
- switch (parameter) {
30
- case '--help':
31
- case '-h':
32
- case '/?':
33
- showHelp();
34
- result.showedHelp = true;
35
- return result;
36
- case '--subspace':
37
- case '-s':
38
- if (i >= args.length || args[i].startsWith('-')) {
39
- result.error = `Expecting argument after "${parameter}"`;
40
- return result;
41
- }
42
- result.subspace = args[i];
43
- ++i;
44
- break;
45
- default:
46
- result.error = 'Unknown parameter ' + JSON.stringify(parameter);
47
- return result;
48
- }
49
- }
50
- return result;
51
- }
52
- exports.parseCommandLine = parseCommandLine;
53
- //# sourceMappingURL=commandLine.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"commandLine.js","sourceRoot":"","sources":["../src/commandLine.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAQ3D,SAAS,QAAQ;IACf,OAAO,CAAC,GAAG,CACT;;;;;;;;;;;;;;CAcH,CAAC,IAAI,EAAE,CACL,CAAC;AACJ,CAAC;AAED,SAAgB,gBAAgB,CAAC,IAAc;IAC7C,MAAM,MAAM,GAAiB,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IAE1F,IAAI,CAAC,GAAW,CAAC,CAAC;IAElB,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QACvB,MAAM,SAAS,GAAW,IAAI,CAAC,CAAC,CAAC,CAAC;QAClC,EAAE,CAAC,CAAC;QAEJ,QAAQ,SAAS,EAAE,CAAC;YAClB,KAAK,QAAQ,CAAC;YACd,KAAK,IAAI,CAAC;YACV,KAAK,IAAI;gBACP,QAAQ,EAAE,CAAC;gBACX,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC;gBACzB,OAAO,MAAM,CAAC;YAEhB,KAAK,YAAY,CAAC;YAClB,KAAK,IAAI;gBACP,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;oBAChD,MAAM,CAAC,KAAK,GAAG,6BAA6B,SAAS,GAAG,CAAC;oBACzD,OAAO,MAAM,CAAC;gBAChB,CAAC;gBACD,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;gBAC1B,EAAE,CAAC,CAAC;gBACJ,MAAM;YAER;gBACE,MAAM,CAAC,KAAK,GAAG,oBAAoB,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;gBAChE,OAAO,MAAM,CAAC;QAClB,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAlCD,4CAkCC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nexport interface ICommandLine {\n showedHelp: boolean;\n error: string | undefined;\n subspace: string | undefined;\n}\n\nfunction showHelp(): void {\n console.log(\n `\nUsage: lockfile-explorer [--subspace SUBSPACE]\n lockfile-explorer [--help]\n\nLaunches the Lockfile Explorer app. You can also use \"lfx\" as shorthand alias\nfor \"lockfile-explorer\".\n\nParameters:\n\n--help, -h\n Show command line help\n\n--subspace SUBSPACE, -s SUBSPACE\n Load the lockfile for the specified Rush subspace.\n`.trim()\n );\n}\n\nexport function parseCommandLine(args: string[]): ICommandLine {\n const result: ICommandLine = { showedHelp: false, error: undefined, subspace: undefined };\n\n let i: number = 0;\n\n while (i < args.length) {\n const parameter: string = args[i];\n ++i;\n\n switch (parameter) {\n case '--help':\n case '-h':\n case '/?':\n showHelp();\n result.showedHelp = true;\n return result;\n\n case '--subspace':\n case '-s':\n if (i >= args.length || args[i].startsWith('-')) {\n result.error = `Expecting argument after \"${parameter}\"`;\n return result;\n }\n result.subspace = args[i];\n ++i;\n break;\n\n default:\n result.error = 'Unknown parameter ' + JSON.stringify(parameter);\n return result;\n }\n }\n\n return result;\n}\n"]}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=commandLine.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"commandLine.test.d.ts","sourceRoot":"","sources":["../src/commandLine.test.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"commandLine.test.js","sourceRoot":"","sources":["../src/commandLine.test.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;AAE3D,+CAAiD;AAEjD,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;QAClC,EAAE,CAAC,qCAAqC,EAAE,KAAK,IAAI,EAAE;YACnD,MAAM,MAAM,GAAG,IAAA,8BAAgB,EAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;YAC5C,MAAM,CAAC,MAAM,CAAC,CAAC,cAAc,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,yCAAyC,EAAE,KAAK,IAAI,EAAE;YACvD,MAAM,MAAM,GAAG,IAAA,8BAAgB,EAAC,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC;YAC1D,MAAM,CAAC,MAAM,CAAC,CAAC,cAAc,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,8CAA8C,EAAE,KAAK,IAAI,EAAE;YAC5D,MAAM,MAAM,GAAG,IAAA,8BAAgB,EAAC,CAAC,YAAY,CAAC,CAAC,CAAC;YAChD,MAAM,CAAC,MAAM,CAAC,CAAC,cAAc,CAAC,OAAO,EAAE,uCAAuC,CAAC,CAAC;QAClF,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { parseCommandLine } from './commandLine';\n\ndescribe('commandLine', () => {\n describe('parseCommandLine()', () => {\n it('sets showHelp when --help specified', async () => {\n const result = parseCommandLine(['--help']);\n expect(result).toHaveProperty('showedHelp', true);\n });\n\n it('sets subspace when --subspace specified', async () => {\n const result = parseCommandLine(['--subspace', 'wallet']);\n expect(result).toHaveProperty('subspace', 'wallet');\n });\n\n it('sets error when --subspace value not missing', async () => {\n const result = parseCommandLine(['--subspace']);\n expect(result).toHaveProperty('error', 'Expecting argument after \"--subspace\"');\n });\n });\n});\n"]}
package/lib/init.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,KAAK,SAAS,EAAyC,MAAM,SAAS,CAAC;AAEhF,eAAO,MAAM,IAAI,YAAa;IAC5B,2BAA2B,EAAE,MAAM,CAAC;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB,KAAG,SA+DH,CAAC"}
package/lib/init.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;AAE3D,uHAAuH;AACvH,6DAA6D;AAE7D,oEAAgE;AAChE,qFAAkF;AAElF,gDAAwB;AAExB,mCAAgF;AAEzE,MAAM,IAAI,GAAG,CAAC,OAKpB,EAAa,EAAE;IACd,MAAM,EAAE,2BAA2B,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;IACrF,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,C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ACJ,YAAY;oBACZ,uBAAuB;iBACxB;aACF,CAAC;YACF,MAAM;QACR,CAAC;aAAM,IAAI,8BAAU,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC;YAC3C,QAAQ,GAAG;gBACT,OAAO;gBACP,UAAU;gBACV,SAAS;gBACT,2BAA2B;gBAC3B,WAAW,EAAE,mBAAW,CAAC,cAAc;gBACvC,oBAAoB,EAAE,cAAI,CAAC,OAAO,CAAC,eAAe,EAAE,gBAAgB,CAAC;gBACrE,gBAAgB,EAAE,cAAI,CAAC,OAAO,CAAC,eAAe,EAAE,eAAe,CAAC;gBAChE,WAAW,EAAE,eAAe;aAC7B,CAAC;YAEF,MAAM;QACR,CAAC;QAED,eAAe,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC,EAAE,eAAe,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;IACnF,CAAC;IAED,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AApEW,QAAA,IAAI,QAoEf","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\n// This function will read the current directory and try to figure out if it's a rush project or regular pnpm workspace\n// Currently it will throw error if neither can be determined\n\nimport { FileSystem, Path } from '@rushstack/node-core-library';\nimport { RushConfiguration } from '@microsoft/rush-lib/lib/api/RushConfiguration';\nimport type { Subspace } from '@microsoft/rush-lib/lib/api/Subspace';\nimport path from 'path';\n\nimport { type IAppState, type IRushProjectDetails, ProjectType } from './state';\n\nexport const init = (options: {\n lockfileExplorerProjectRoot: string;\n appVersion: string;\n debugMode: boolean;\n subspaceName: string;\n}): IAppState => {\n const { lockfileExplorerProjectRoot, appVersion, debugMode, subspaceName } = options;\n const currDir = process.cwd();\n\n let appState: IAppState | undefined;\n let currExploredDir = Path.convertToSlashes(currDir);\n while (currExploredDir.includes('/')) {\n // Look for a rush.json [rush project] or pnpm-lock.yaml file [regular pnpm workspace]\n const rushJsonPath: string = path.resolve(currExploredDir, 'rush.json');\n const pnpmLockPath: string = path.resolve(currExploredDir, 'pnpm-lock.yaml');\n if (FileSystem.exists(rushJsonPath)) {\n console.log('Found a Rush workspace: ', rushJsonPath);\n\n const rushConfiguration: RushConfiguration = RushConfiguration.tryLoadFromDefaultLocation()!;\n const subspace: Subspace = rushConfiguration.getSubspace(subspaceName);\n const workspaceFolder: string = subspace.getSubspaceTempFolder();\n\n const projectsByProjectFolder: Map<string, IRushProjectDetails> = new Map();\n for (const project of rushConfiguration.projects) {\n projectsByProjectFolder.set(project.projectFolder, {\n projectName: project.packageName,\n projectFolder: project.projectFolder\n });\n }\n\n appState = {\n currDir,\n appVersion,\n debugMode,\n lockfileExplorerProjectRoot,\n projectType: ProjectType.RUSH_PROJECT,\n pnpmLockfileLocation: path.resolve(workspaceFolder, 'pnpm-lock.yaml'),\n pnpmfileLocation: path.resolve(workspaceFolder, '.pnpmfile.cjs'),\n projectRoot: currExploredDir,\n rush: {\n rushJsonPath,\n projectsByProjectFolder\n }\n };\n break;\n } else if (FileSystem.exists(pnpmLockPath)) {\n appState = {\n currDir,\n appVersion,\n debugMode,\n lockfileExplorerProjectRoot,\n projectType: ProjectType.PNPM_WORKSPACE,\n pnpmLockfileLocation: path.resolve(currExploredDir, 'pnpm-lock.yaml'),\n pnpmfileLocation: path.resolve(currExploredDir, '.pnpmfile.cjs'),\n projectRoot: currExploredDir\n };\n\n break;\n }\n\n currExploredDir = currExploredDir.substring(0, currExploredDir.lastIndexOf('/'));\n }\n\n if (!appState) {\n throw new Error('Could not find a Rush or PNPM workspace!');\n }\n\n return appState;\n};\n"]}
package/lib/start.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=start.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":""}