@backstage/cli-node 0.2.4 → 0.2.6-next.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.
- package/CHANGELOG.md +20 -0
- package/dist/index.cjs.js +25 -34
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @backstage/cli-node
|
|
2
2
|
|
|
3
|
+
## 0.2.6-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 93be042: Upgraded @yarnpkg/parsers to stable 3.0
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/cli-common@0.1.13
|
|
10
|
+
- @backstage/errors@1.2.4
|
|
11
|
+
- @backstage/types@1.1.1
|
|
12
|
+
|
|
13
|
+
## 0.2.5
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- ed9260f: Added `versions:migrate` command to help move packages to the new `@backstage-community` namespace
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
- @backstage/cli-common@0.1.13
|
|
20
|
+
- @backstage/errors@1.2.4
|
|
21
|
+
- @backstage/types@1.1.1
|
|
22
|
+
|
|
3
23
|
## 0.2.4
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var errors = require('@backstage/errors');
|
|
6
4
|
var cliCommon = require('@backstage/cli-common');
|
|
7
5
|
var child_process = require('child_process');
|
|
@@ -12,17 +10,16 @@ var getPackages = require('@manypkg/get-packages');
|
|
|
12
10
|
var parsers = require('@yarnpkg/parsers');
|
|
13
11
|
var zod = require('zod');
|
|
14
12
|
|
|
15
|
-
function
|
|
13
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
16
14
|
|
|
17
|
-
var fs__default = /*#__PURE__*/
|
|
18
|
-
var path__default = /*#__PURE__*/
|
|
15
|
+
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
16
|
+
var path__default = /*#__PURE__*/_interopDefaultCompat(path);
|
|
19
17
|
|
|
20
18
|
const paths = cliCommon.findPaths(__dirname);
|
|
21
19
|
|
|
22
20
|
const execFile = util.promisify(child_process.execFile);
|
|
23
21
|
|
|
24
22
|
async function runGit(...args) {
|
|
25
|
-
var _a, _b;
|
|
26
23
|
try {
|
|
27
24
|
const { stdout } = await execFile("git", args, {
|
|
28
25
|
shell: true,
|
|
@@ -32,8 +29,8 @@ async function runGit(...args) {
|
|
|
32
29
|
} catch (error) {
|
|
33
30
|
errors.assertError(error);
|
|
34
31
|
if (error.stderr || typeof error.code === "number") {
|
|
35
|
-
const stderr =
|
|
36
|
-
const msg =
|
|
32
|
+
const stderr = error.stderr?.toString("utf8");
|
|
33
|
+
const msg = stderr?.trim() ?? `with exit code ${error.code}`;
|
|
37
34
|
throw new Error(`git ${args[0]} failed, ${msg}`);
|
|
38
35
|
}
|
|
39
36
|
throw new errors.ForwardedError("Unknown execution error", error);
|
|
@@ -82,11 +79,10 @@ class GitUtils {
|
|
|
82
79
|
}
|
|
83
80
|
|
|
84
81
|
async function isMonoRepo() {
|
|
85
|
-
var _a;
|
|
86
82
|
const rootPackageJsonPath = paths.resolveTargetRoot("package.json");
|
|
87
83
|
try {
|
|
88
|
-
const pkg = await fs__default
|
|
89
|
-
return Boolean(
|
|
84
|
+
const pkg = await fs__default.default.readJson(rootPackageJsonPath);
|
|
85
|
+
return Boolean(pkg?.workspaces?.packages);
|
|
90
86
|
} catch (error) {
|
|
91
87
|
return false;
|
|
92
88
|
}
|
|
@@ -112,7 +108,7 @@ class Lockfile {
|
|
|
112
108
|
* Load a {@link Lockfile} from a file path.
|
|
113
109
|
*/
|
|
114
110
|
static async load(path) {
|
|
115
|
-
const lockfileContents = await fs__default
|
|
111
|
+
const lockfileContents = await fs__default.default.readFile(path, "utf8");
|
|
116
112
|
return Lockfile.parse(lockfileContents);
|
|
117
113
|
}
|
|
118
114
|
/**
|
|
@@ -121,7 +117,6 @@ class Lockfile {
|
|
|
121
117
|
* @public
|
|
122
118
|
*/
|
|
123
119
|
static parse(content) {
|
|
124
|
-
var _a;
|
|
125
120
|
let data;
|
|
126
121
|
try {
|
|
127
122
|
data = parsers.parseSyml(content);
|
|
@@ -132,7 +127,7 @@ class Lockfile {
|
|
|
132
127
|
for (const [key, value] of Object.entries(data)) {
|
|
133
128
|
if (SPECIAL_OBJECT_KEYS.includes(key))
|
|
134
129
|
continue;
|
|
135
|
-
const [, name, ranges] =
|
|
130
|
+
const [, name, ranges] = ENTRY_PATTERN.exec(key) ?? [];
|
|
136
131
|
if (!name) {
|
|
137
132
|
throw new Error(`Failed to parse yarn.lock entry '${key}'`);
|
|
138
133
|
}
|
|
@@ -163,11 +158,10 @@ class Lockfile {
|
|
|
163
158
|
for (const [name, entries] of this.packages) {
|
|
164
159
|
const dependencies = new Set(
|
|
165
160
|
entries.flatMap((e) => {
|
|
166
|
-
var _a, _b;
|
|
167
161
|
const data = this.data[e.dataKey];
|
|
168
162
|
return [
|
|
169
|
-
...Object.keys(
|
|
170
|
-
...Object.keys(
|
|
163
|
+
...Object.keys(data?.dependencies ?? {}),
|
|
164
|
+
...Object.keys(data?.peerDependencies ?? {})
|
|
171
165
|
];
|
|
172
166
|
})
|
|
173
167
|
);
|
|
@@ -180,7 +174,6 @@ class Lockfile {
|
|
|
180
174
|
* added, changed, and removed compared to the other lockfile.
|
|
181
175
|
*/
|
|
182
176
|
diff(otherLockfile) {
|
|
183
|
-
var _a;
|
|
184
177
|
const diff = {
|
|
185
178
|
added: new Array(),
|
|
186
179
|
changed: new Array(),
|
|
@@ -217,7 +210,7 @@ class Lockfile {
|
|
|
217
210
|
}
|
|
218
211
|
}
|
|
219
212
|
for (const name of remainingOldNames) {
|
|
220
|
-
const queries =
|
|
213
|
+
const queries = this.packages.get(name) ?? [];
|
|
221
214
|
diff.added.push(...queries.map((q) => ({ name, range: q.range })));
|
|
222
215
|
}
|
|
223
216
|
return diff;
|
|
@@ -336,12 +329,11 @@ class PackageGraph extends Map {
|
|
|
336
329
|
* also consider changes to the dependency management lockfile.
|
|
337
330
|
*/
|
|
338
331
|
async listChangedPackages(options) {
|
|
339
|
-
var _a, _b;
|
|
340
332
|
const changedFiles = await GitUtils.listChangedFiles(options.ref);
|
|
341
333
|
const dirMap = new Map(
|
|
342
334
|
Array.from(this.values()).map((pkg) => [
|
|
343
335
|
// relative from root, convert to posix, and add a / at the end
|
|
344
|
-
path__default
|
|
336
|
+
path__default.default.relative(paths.targetRoot, pkg.dir).split(path__default.default.sep).join(path__default.default.posix.sep) + path__default.default.posix.sep,
|
|
345
337
|
pkg
|
|
346
338
|
])
|
|
347
339
|
);
|
|
@@ -354,10 +346,10 @@ class PackageGraph extends Map {
|
|
|
354
346
|
while (searchIndex < changedFiles.length && changedFiles[searchIndex] < packageDir) {
|
|
355
347
|
searchIndex += 1;
|
|
356
348
|
}
|
|
357
|
-
if (
|
|
349
|
+
if (changedFiles[searchIndex]?.startsWith(packageDir)) {
|
|
358
350
|
searchIndex += 1;
|
|
359
351
|
result.push(dirMap.get(packageDir));
|
|
360
|
-
while (
|
|
352
|
+
while (changedFiles[searchIndex]?.startsWith(packageDir)) {
|
|
361
353
|
searchIndex += 1;
|
|
362
354
|
}
|
|
363
355
|
}
|
|
@@ -524,34 +516,33 @@ class PackageRoles {
|
|
|
524
516
|
* Attempt to detect the role of a package from its package.json.
|
|
525
517
|
*/
|
|
526
518
|
static detectRoleFromPackage(pkgJson) {
|
|
527
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
528
519
|
const pkg = detectionSchema.parse(pkgJson);
|
|
529
|
-
if (
|
|
520
|
+
if (pkg.scripts?.start?.includes("app:serve")) {
|
|
530
521
|
return "frontend";
|
|
531
522
|
}
|
|
532
|
-
if (
|
|
523
|
+
if (pkg.scripts?.build?.includes("backend:bundle")) {
|
|
533
524
|
return "backend";
|
|
534
525
|
}
|
|
535
|
-
if (
|
|
526
|
+
if (pkg.name?.includes("plugin-") && pkg.name?.includes("-backend-module-")) {
|
|
536
527
|
return "backend-plugin-module";
|
|
537
528
|
}
|
|
538
|
-
if (
|
|
529
|
+
if (pkg.name?.includes("plugin-") && pkg.name?.includes("-module-")) {
|
|
539
530
|
return "frontend-plugin-module";
|
|
540
531
|
}
|
|
541
|
-
if (
|
|
532
|
+
if (pkg.scripts?.start?.includes("plugin:serve")) {
|
|
542
533
|
return "frontend-plugin";
|
|
543
534
|
}
|
|
544
|
-
if (
|
|
535
|
+
if (pkg.scripts?.start?.includes("backend:dev")) {
|
|
545
536
|
return "backend-plugin";
|
|
546
537
|
}
|
|
547
|
-
const mainEntry =
|
|
548
|
-
const moduleEntry =
|
|
549
|
-
const typesEntry =
|
|
538
|
+
const mainEntry = pkg.publishConfig?.main || pkg.main;
|
|
539
|
+
const moduleEntry = pkg.publishConfig?.module || pkg.module;
|
|
540
|
+
const typesEntry = pkg.publishConfig?.types || pkg.types;
|
|
550
541
|
if (typesEntry) {
|
|
551
542
|
if (mainEntry && moduleEntry) {
|
|
552
543
|
return "common-library";
|
|
553
544
|
}
|
|
554
|
-
if (moduleEntry ||
|
|
545
|
+
if (moduleEntry || mainEntry?.endsWith(".esm.js")) {
|
|
555
546
|
return "web-library";
|
|
556
547
|
}
|
|
557
548
|
if (mainEntry) {
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/paths.ts","../src/run.ts","../src/git/GitUtils.ts","../src/monorepo/isMonoRepo.ts","../src/monorepo/Lockfile.ts","../src/monorepo/PackageGraph.ts","../src/roles/PackageRoles.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { findPaths } from '@backstage/cli-common';\n\n/* eslint-disable-next-line no-restricted-syntax */\nexport const paths = findPaths(__dirname);\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { execFile as execFileCb } from 'child_process';\nimport { promisify } from 'util';\n\nexport const execFile = promisify(execFileCb);\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { assertError, ForwardedError } from '@backstage/errors';\nimport { paths } from '../paths';\nimport { execFile } from '../run';\n\n/**\n * Run a git command, trimming the output splitting it into lines.\n */\nexport async function runGit(...args: string[]) {\n try {\n const { stdout } = await execFile('git', args, {\n shell: true,\n cwd: paths.targetRoot,\n });\n return stdout.trim().split(/\\r\\n|\\r|\\n/);\n } catch (error) {\n assertError(error);\n if (error.stderr || typeof error.code === 'number') {\n const stderr = (error.stderr as undefined | Buffer)?.toString('utf8');\n const msg = stderr?.trim() ?? `with exit code ${error.code}`;\n throw new Error(`git ${args[0]} failed, ${msg}`);\n }\n throw new ForwardedError('Unknown execution error', error);\n }\n}\n\n/**\n * Utilities for working with git.\n *\n * @public\n */\nexport class GitUtils {\n /**\n * Returns a sorted list of all files that have changed since the merge base\n * of the provided `ref` and HEAD, as well as all files that are not tracked by git.\n */\n static async listChangedFiles(ref: string) {\n if (!ref) {\n throw new Error('ref is required');\n }\n\n let diffRef = ref;\n try {\n const [base] = await runGit('merge-base', 'HEAD', ref);\n diffRef = base;\n } catch {\n // silently fall back to using the ref directly if merge base is not available\n }\n\n const tracked = await runGit('diff', '--name-only', diffRef);\n const untracked = await runGit(\n 'ls-files',\n '--others',\n '--exclude-standard',\n );\n\n return Array.from(new Set([...tracked, ...untracked]));\n }\n\n /**\n * Returns the contents of a file at a specific ref.\n */\n static async readFileAtRef(path: string, ref: string) {\n let showRef = ref;\n try {\n const [base] = await runGit('merge-base', 'HEAD', ref);\n showRef = base;\n } catch {\n // silently fall back to using the ref directly if merge base is not available\n }\n\n const { stdout } = await execFile('git', ['show', `${showRef}:${path}`], {\n shell: true,\n cwd: paths.targetRoot,\n maxBuffer: 1024 * 1024 * 50,\n });\n return stdout;\n }\n}\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { paths } from '../paths';\nimport fs from 'fs-extra';\n\n/**\n * Returns try if the current project is a monorepo.\n *\n * @public\n */\nexport async function isMonoRepo(): Promise<boolean> {\n const rootPackageJsonPath = paths.resolveTargetRoot('package.json');\n try {\n const pkg = await fs.readJson(rootPackageJsonPath);\n return Boolean(pkg?.workspaces?.packages);\n } catch (error) {\n return false;\n }\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { parseSyml } from '@yarnpkg/parsers';\nimport fs from 'fs-extra';\n\nconst ENTRY_PATTERN = /^((?:@[^/]+\\/)?[^@/]+)@(.+)$/;\n\n/** @internal */\ntype LockfileData = {\n [entry: string]: {\n version: string;\n resolved?: string;\n integrity?: string /* old */;\n checksum?: string /* new */;\n dependencies?: { [name: string]: string };\n peerDependencies?: { [name: string]: string };\n };\n};\n\n/** @internal */\ntype LockfileQueryEntry = {\n range: string;\n version: string;\n dataKey: string;\n};\n\n/**\n * An entry for a single difference between two {@link Lockfile}s.\n *\n * @public\n */\nexport type LockfileDiffEntry = {\n name: string;\n range: string;\n};\n\n/**\n * Represents the difference between two {@link Lockfile}s.\n *\n * @public\n */\nexport type LockfileDiff = {\n added: LockfileDiffEntry[];\n changed: LockfileDiffEntry[];\n removed: LockfileDiffEntry[];\n};\n\n// these are special top level yarn keys.\n// https://github.com/yarnpkg/berry/blob/9bd61fbffb83d0b8166a9cc26bec3a58743aa453/packages/yarnpkg-parsers/sources/syml.ts#L9\nconst SPECIAL_OBJECT_KEYS = [\n `__metadata`,\n `version`,\n `resolution`,\n `dependencies`,\n `peerDependencies`,\n `dependenciesMeta`,\n `peerDependenciesMeta`,\n `binaries`,\n];\n\n/**\n * Represents a package manager lockfile.\n *\n * @public\n */\nexport class Lockfile {\n /**\n * Load a {@link Lockfile} from a file path.\n */\n static async load(path: string): Promise<Lockfile> {\n const lockfileContents = await fs.readFile(path, 'utf8');\n return Lockfile.parse(lockfileContents);\n }\n\n /**\n * Parse lockfile contents into a {@link Lockfile}.\n *\n * @public\n */\n static parse(content: string): Lockfile {\n let data: LockfileData;\n try {\n data = parseSyml(content);\n } catch (err) {\n throw new Error(`Failed yarn.lock parse, ${err}`);\n }\n\n const packages = new Map<string, LockfileQueryEntry[]>();\n\n for (const [key, value] of Object.entries(data)) {\n if (SPECIAL_OBJECT_KEYS.includes(key)) continue;\n\n const [, name, ranges] = ENTRY_PATTERN.exec(key) ?? [];\n if (!name) {\n throw new Error(`Failed to parse yarn.lock entry '${key}'`);\n }\n\n let queries = packages.get(name);\n if (!queries) {\n queries = [];\n packages.set(name, queries);\n }\n for (let range of ranges.split(/\\s*,\\s*/)) {\n if (range.startsWith(`${name}@`)) {\n range = range.slice(`${name}@`.length);\n }\n if (range.startsWith('npm:')) {\n range = range.slice('npm:'.length);\n }\n queries.push({ range, version: value.version, dataKey: key });\n }\n }\n\n return new Lockfile(packages, data);\n }\n\n private constructor(\n private readonly packages: Map<string, LockfileQueryEntry[]>,\n private readonly data: LockfileData,\n ) {}\n\n /**\n * Creates a simplified dependency graph from the lockfile data, where each\n * key is a package, and the value is a set of all packages that it depends on\n * across all versions.\n */\n createSimplifiedDependencyGraph(): Map<string, Set<string>> {\n const graph = new Map<string, Set<string>>();\n\n for (const [name, entries] of this.packages) {\n const dependencies = new Set(\n entries.flatMap(e => {\n const data = this.data[e.dataKey];\n return [\n ...Object.keys(data?.dependencies ?? {}),\n ...Object.keys(data?.peerDependencies ?? {}),\n ];\n }),\n );\n graph.set(name, dependencies);\n }\n\n return graph;\n }\n\n /**\n * Diff with another lockfile, returning entries that have been\n * added, changed, and removed compared to the other lockfile.\n */\n diff(otherLockfile: Lockfile): LockfileDiff {\n const diff = {\n added: new Array<{ name: string; range: string }>(),\n changed: new Array<{ name: string; range: string }>(),\n removed: new Array<{ name: string; range: string }>(),\n };\n\n // Keeps track of packages that only exist in this lockfile\n const remainingOldNames = new Set(this.packages.keys());\n\n for (const [name, otherQueries] of otherLockfile.packages) {\n remainingOldNames.delete(name);\n\n const thisQueries = this.packages.get(name);\n // If the packages doesn't exist in this lockfile, add all entries\n if (!thisQueries) {\n diff.removed.push(...otherQueries.map(q => ({ name, range: q.range })));\n continue;\n }\n\n const remainingOldRanges = new Set(thisQueries.map(q => q.range));\n\n for (const otherQuery of otherQueries) {\n remainingOldRanges.delete(otherQuery.range);\n\n const thisQuery = thisQueries.find(q => q.range === otherQuery.range);\n if (!thisQuery) {\n diff.removed.push({ name, range: otherQuery.range });\n continue;\n }\n\n const otherPkg = otherLockfile.data[otherQuery.dataKey];\n const thisPkg = this.data[thisQuery.dataKey];\n if (otherPkg && thisPkg) {\n const thisCheck = thisPkg.integrity || thisPkg.checksum;\n const otherCheck = otherPkg.integrity || otherPkg.checksum;\n if (thisCheck !== otherCheck) {\n diff.changed.push({ name, range: otherQuery.range });\n }\n }\n }\n\n for (const thisRange of remainingOldRanges) {\n diff.added.push({ name, range: thisRange });\n }\n }\n\n for (const name of remainingOldNames) {\n const queries = this.packages.get(name) ?? [];\n diff.added.push(...queries.map(q => ({ name, range: q.range })));\n }\n\n return diff;\n }\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport path from 'path';\nimport { getPackages, Package } from '@manypkg/get-packages';\nimport { paths } from '../paths';\nimport { PackageRole } from '../roles';\nimport { GitUtils } from '../git';\nimport { Lockfile } from './Lockfile';\nimport { JsonValue } from '@backstage/types';\n\n/**\n * Known fields in Backstage package.json files.\n *\n * @public\n */\nexport interface BackstagePackageJson {\n name: string;\n version: string;\n private?: boolean;\n\n main?: string;\n module?: string;\n types?: string;\n\n scripts?: {\n [key: string]: string;\n };\n // The `bundled` field is a field known within Backstage, it means\n // that the package bundles all of its dependencies in its build output.\n bundled?: boolean;\n\n backstage?: {\n role?: PackageRole;\n };\n\n exports?: JsonValue;\n typesVersions?: Record<string, Record<string, string[]>>;\n\n files?: string[];\n\n publishConfig?: {\n access?: 'public' | 'restricted';\n directory?: string;\n registry?: string;\n };\n\n repository?:\n | string\n | {\n type: string;\n url: string;\n directory: string;\n };\n\n dependencies?: {\n [key: string]: string;\n };\n peerDependencies?: {\n [key: string]: string;\n };\n devDependencies?: {\n [key: string]: string;\n };\n optionalDependencies?: {\n [key: string]: string;\n };\n}\n\n/**\n * A local Backstage monorepo package\n *\n * @public\n */\nexport type BackstagePackage = {\n dir: string;\n packageJson: BackstagePackageJson;\n};\n\n/**\n * A local package in the monorepo package graph.\n *\n * @public\n */\nexport type PackageGraphNode = {\n /** The name of the package */\n name: string;\n /** The directory of the package */\n dir: string;\n /** The package data of the package itself */\n packageJson: BackstagePackageJson;\n\n /** All direct local dependencies of the package */\n allLocalDependencies: Map<string, PackageGraphNode>;\n /** All direct local dependencies that will be present in the published package */\n publishedLocalDependencies: Map<string, PackageGraphNode>;\n /** Local dependencies */\n localDependencies: Map<string, PackageGraphNode>;\n /** Local devDependencies */\n localDevDependencies: Map<string, PackageGraphNode>;\n /** Local optionalDependencies */\n localOptionalDependencies: Map<string, PackageGraphNode>;\n\n /** All direct incoming local dependencies of the package */\n allLocalDependents: Map<string, PackageGraphNode>;\n /** All direct incoming local dependencies that will be present in the published package */\n publishedLocalDependents: Map<string, PackageGraphNode>;\n /** Incoming local dependencies */\n localDependents: Map<string, PackageGraphNode>;\n /** Incoming local devDependencies */\n localDevDependents: Map<string, PackageGraphNode>;\n /** Incoming local optionalDependencies */\n localOptionalDependents: Map<string, PackageGraphNode>;\n};\n\n/**\n * Represents a local Backstage monorepo package graph.\n *\n * @public\n */\nexport class PackageGraph extends Map<string, PackageGraphNode> {\n /**\n * Lists all local packages in a monorepo.\n */\n static async listTargetPackages(): Promise<BackstagePackage[]> {\n const { packages } = await getPackages(paths.targetDir);\n return packages as BackstagePackage[];\n }\n\n /**\n * Creates a package graph from a list of local packages.\n */\n static fromPackages(packages: Package[]): PackageGraph {\n const graph = new PackageGraph();\n\n // Add all local packages to the graph\n for (const pkg of packages) {\n const name = pkg.packageJson.name;\n const existingPkg = graph.get(name);\n if (existingPkg) {\n throw new Error(\n `Duplicate package name '${name}' at ${pkg.dir} and ${existingPkg.dir}`,\n );\n }\n\n graph.set(name, {\n name,\n dir: pkg.dir,\n packageJson: pkg.packageJson as BackstagePackageJson,\n\n allLocalDependencies: new Map(),\n publishedLocalDependencies: new Map(),\n localDependencies: new Map(),\n localDevDependencies: new Map(),\n localOptionalDependencies: new Map(),\n\n allLocalDependents: new Map(),\n publishedLocalDependents: new Map(),\n localDependents: new Map(),\n localDevDependents: new Map(),\n localOptionalDependents: new Map(),\n });\n }\n\n // Populate the local dependency structure\n for (const node of graph.values()) {\n for (const depName of Object.keys(node.packageJson.dependencies || {})) {\n const depPkg = graph.get(depName);\n if (depPkg) {\n node.allLocalDependencies.set(depName, depPkg);\n node.publishedLocalDependencies.set(depName, depPkg);\n node.localDependencies.set(depName, depPkg);\n\n depPkg.allLocalDependents.set(node.name, node);\n depPkg.publishedLocalDependents.set(node.name, node);\n depPkg.localDependents.set(node.name, node);\n }\n }\n for (const depName of Object.keys(\n node.packageJson.devDependencies || {},\n )) {\n const depPkg = graph.get(depName);\n if (depPkg) {\n node.allLocalDependencies.set(depName, depPkg);\n node.localDevDependencies.set(depName, depPkg);\n\n depPkg.allLocalDependents.set(node.name, node);\n depPkg.localDevDependents.set(node.name, node);\n }\n }\n for (const depName of Object.keys(\n node.packageJson.optionalDependencies || {},\n )) {\n const depPkg = graph.get(depName);\n if (depPkg) {\n node.allLocalDependencies.set(depName, depPkg);\n node.publishedLocalDependencies.set(depName, depPkg);\n node.localOptionalDependencies.set(depName, depPkg);\n\n depPkg.allLocalDependents.set(node.name, node);\n depPkg.publishedLocalDependents.set(node.name, node);\n depPkg.localOptionalDependents.set(node.name, node);\n }\n }\n }\n\n return graph;\n }\n\n /**\n * Traverses the package graph and collects a set of package names.\n *\n * The traversal starts at the provided list names, and continues\n * throughout all the names returned by the `collectFn`, which is\n * called once for each seen package.\n */\n collectPackageNames(\n startingPackageNames: string[],\n collectFn: (pkg: PackageGraphNode) => Iterable<string> | undefined,\n ): Set<string> {\n const targets = new Set<string>();\n const searchNames = startingPackageNames.slice();\n\n while (searchNames.length) {\n const name = searchNames.pop()!;\n\n if (targets.has(name)) {\n continue;\n }\n\n const node = this.get(name);\n if (!node) {\n throw new Error(`Package '${name}' not found`);\n }\n\n targets.add(name);\n\n const collected = collectFn(node);\n if (collected) {\n searchNames.push(...collected);\n }\n }\n\n return targets;\n }\n\n /**\n * Lists all packages that have changed since a given git ref.\n *\n * @remarks\n *\n * If the `analyzeLockfile` option is set to true, the change detection will\n * also consider changes to the dependency management lockfile.\n */\n async listChangedPackages(options: {\n ref: string;\n analyzeLockfile?: boolean;\n }) {\n const changedFiles = await GitUtils.listChangedFiles(options.ref);\n\n const dirMap = new Map(\n Array.from(this.values()).map(pkg => [\n // relative from root, convert to posix, and add a / at the end\n path\n .relative(paths.targetRoot, pkg.dir)\n .split(path.sep)\n .join(path.posix.sep) + path.posix.sep,\n pkg,\n ]),\n );\n const packageDirs = Array.from(dirMap.keys());\n\n const result = new Array<PackageGraphNode>();\n let searchIndex = 0;\n\n changedFiles.sort();\n packageDirs.sort();\n\n for (const packageDir of packageDirs) {\n // Skip through changes that appear before our package dir\n while (\n searchIndex < changedFiles.length &&\n changedFiles[searchIndex] < packageDir\n ) {\n searchIndex += 1;\n }\n\n // Check if we arrived at a match, otherwise we move on to the next package dir\n if (changedFiles[searchIndex]?.startsWith(packageDir)) {\n searchIndex += 1;\n\n result.push(dirMap.get(packageDir)!);\n\n // Skip through the rest of the changed files for the same package\n while (changedFiles[searchIndex]?.startsWith(packageDir)) {\n searchIndex += 1;\n }\n }\n }\n\n if (changedFiles.includes('yarn.lock') && options.analyzeLockfile) {\n // Load the lockfile in the working tree and the one at the ref and diff them\n let thisLockfile: Lockfile;\n let otherLockfile: Lockfile;\n try {\n thisLockfile = await Lockfile.load(\n paths.resolveTargetRoot('yarn.lock'),\n );\n otherLockfile = Lockfile.parse(\n await GitUtils.readFileAtRef('yarn.lock', options.ref),\n );\n } catch (error) {\n console.warn(\n `Failed to read lockfiles, assuming all packages have changed, ${error}`,\n );\n return Array.from(this.values());\n }\n const diff = thisLockfile.diff(otherLockfile);\n\n // Create a simplified dependency graph only keeps track of package names\n const graph = thisLockfile.createSimplifiedDependencyGraph();\n\n // Merge the dependency graph from the other lockfile into this one in\n // order to be able to detect removals accurately.\n {\n const otherGraph = thisLockfile.createSimplifiedDependencyGraph();\n for (const [name, dependencies] of otherGraph) {\n const node = graph.get(name);\n if (node) {\n dependencies.forEach(d => node.add(d));\n } else {\n graph.set(name, dependencies);\n }\n }\n }\n\n // The check is simplified by only considering the package names rather\n // than the exact version range queries that were changed.\n // TODO(Rugvip): Use a more exact check\n const changedPackages = new Set(\n [...diff.added, ...diff.changed, ...diff.removed].map(e => e.name),\n );\n\n // Starting with our set of changed packages from the diff, we loop through\n // the full graph and add any package that has a dependency on a changed package.\n // We keep looping until all transitive dependencies have been detected.\n let changed = false;\n do {\n changed = false;\n for (const [name, dependencies] of graph) {\n if (changedPackages.has(name)) {\n continue;\n }\n for (const dep of dependencies) {\n if (changedPackages.has(dep)) {\n changed = true;\n changedPackages.add(name);\n break;\n }\n }\n }\n } while (changed);\n\n // Add all local packages that had a transitive dependency change to the result set\n for (const node of this.values()) {\n if (changedPackages.has(node.name) && !result.includes(node)) {\n result.push(node);\n }\n }\n }\n\n return result;\n }\n}\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { z } from 'zod';\nimport { PackageRole, PackageRoleInfo } from './types';\n\nconst packageRoleInfos: PackageRoleInfo[] = [\n {\n role: 'frontend',\n platform: 'web',\n output: ['bundle'],\n },\n {\n role: 'backend',\n platform: 'node',\n output: ['bundle'],\n },\n {\n role: 'cli',\n platform: 'node',\n output: ['cjs'],\n },\n {\n role: 'web-library',\n platform: 'web',\n output: ['types', 'esm'],\n },\n {\n role: 'node-library',\n platform: 'node',\n output: ['types', 'cjs'],\n },\n {\n role: 'common-library',\n platform: 'common',\n output: ['types', 'esm', 'cjs'],\n },\n {\n role: 'frontend-plugin',\n platform: 'web',\n output: ['types', 'esm'],\n },\n {\n role: 'frontend-plugin-module',\n platform: 'web',\n output: ['types', 'esm'],\n },\n {\n role: 'backend-plugin',\n platform: 'node',\n output: ['types', 'cjs'],\n },\n {\n role: 'backend-plugin-module',\n platform: 'node',\n output: ['types', 'cjs'],\n },\n];\n\nconst readSchema = z.object({\n name: z.string().optional(),\n backstage: z\n .object({\n role: z.string().optional(),\n })\n .optional(),\n});\n\nconst detectionSchema = z.object({\n name: z.string().optional(),\n scripts: z\n .object({\n start: z.string().optional(),\n build: z.string().optional(),\n })\n .optional(),\n publishConfig: z\n .object({\n main: z.string().optional(),\n types: z.string().optional(),\n module: z.string().optional(),\n })\n .optional(),\n main: z.string().optional(),\n types: z.string().optional(),\n module: z.string().optional(),\n});\n\n/**\n * Utilities for working with Backstage package roles.\n *\n * @public\n */\nexport class PackageRoles {\n /**\n * Get the associated info for a package role.\n */\n static getRoleInfo(role: string): PackageRoleInfo {\n const roleInfo = packageRoleInfos.find(r => r.role === role);\n if (!roleInfo) {\n throw new Error(`Unknown package role '${role}'`);\n }\n return roleInfo;\n }\n\n /**\n * Given package JSON data, get the package role.\n */\n static getRoleFromPackage(pkgJson: unknown): PackageRole | undefined {\n const pkg = readSchema.parse(pkgJson);\n\n if (pkg.backstage) {\n const { role } = pkg.backstage;\n if (!role) {\n throw new Error(\n `Package ${pkg.name} must specify a role in the \"backstage\" field`,\n );\n }\n\n return this.getRoleInfo(role).role;\n }\n\n return undefined;\n }\n\n /**\n * Attempt to detect the role of a package from its package.json.\n */\n static detectRoleFromPackage(pkgJson: unknown): PackageRole | undefined {\n const pkg = detectionSchema.parse(pkgJson);\n\n if (pkg.scripts?.start?.includes('app:serve')) {\n return 'frontend';\n }\n if (pkg.scripts?.build?.includes('backend:bundle')) {\n return 'backend';\n }\n if (\n pkg.name?.includes('plugin-') &&\n pkg.name?.includes('-backend-module-')\n ) {\n return 'backend-plugin-module';\n }\n if (pkg.name?.includes('plugin-') && pkg.name?.includes('-module-')) {\n return 'frontend-plugin-module';\n }\n if (pkg.scripts?.start?.includes('plugin:serve')) {\n return 'frontend-plugin';\n }\n if (pkg.scripts?.start?.includes('backend:dev')) {\n return 'backend-plugin';\n }\n\n const mainEntry = pkg.publishConfig?.main || pkg.main;\n const moduleEntry = pkg.publishConfig?.module || pkg.module;\n const typesEntry = pkg.publishConfig?.types || pkg.types;\n if (typesEntry) {\n if (mainEntry && moduleEntry) {\n return 'common-library';\n }\n if (moduleEntry || mainEntry?.endsWith('.esm.js')) {\n return 'web-library';\n }\n if (mainEntry) {\n return 'node-library';\n }\n } else if (mainEntry) {\n return 'cli';\n }\n\n return undefined;\n }\n}\n"],"names":["findPaths","promisify","execFileCb","assertError","ForwardedError","fs","parseSyml","getPackages","path","z"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBa,MAAA,KAAA,GAAQA,oBAAU,SAAS,CAAA;;ACA3B,MAAA,QAAA,G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EAAA;AAC5B,QAAO,OAAA,gBAAA,CAAA;AAAA,OACT;AACA,MAAI,IAAA,WAAA,KAAe,SAAW,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,SAAA,CAAA,QAAA,CAAS,SAAY,CAAA,CAAA,EAAA;AACjD,QAAO,OAAA,aAAA,CAAA;AAAA,OACT;AACA,MAAA,IAAI,SAAW,EAAA;AACb,QAAO,OAAA,cAAA,CAAA;AAAA,OACT;AAAA,eACS,SAAW,EAAA;AACpB,MAAO,OAAA,KAAA,CAAA;AAAA,KACT;AAEA,IAAO,OAAA,KAAA,CAAA,CAAA;AAAA,GACT;AACF;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/paths.ts","../src/run.ts","../src/git/GitUtils.ts","../src/monorepo/isMonoRepo.ts","../src/monorepo/Lockfile.ts","../src/monorepo/PackageGraph.ts","../src/roles/PackageRoles.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { findPaths } from '@backstage/cli-common';\n\n/* eslint-disable-next-line no-restricted-syntax */\nexport const paths = findPaths(__dirname);\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { execFile as execFileCb } from 'child_process';\nimport { promisify } from 'util';\n\nexport const execFile = promisify(execFileCb);\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { assertError, ForwardedError } from '@backstage/errors';\nimport { paths } from '../paths';\nimport { execFile } from '../run';\n\n/**\n * Run a git command, trimming the output splitting it into lines.\n */\nexport async function runGit(...args: string[]) {\n try {\n const { stdout } = await execFile('git', args, {\n shell: true,\n cwd: paths.targetRoot,\n });\n return stdout.trim().split(/\\r\\n|\\r|\\n/);\n } catch (error) {\n assertError(error);\n if (error.stderr || typeof error.code === 'number') {\n const stderr = (error.stderr as undefined | Buffer)?.toString('utf8');\n const msg = stderr?.trim() ?? `with exit code ${error.code}`;\n throw new Error(`git ${args[0]} failed, ${msg}`);\n }\n throw new ForwardedError('Unknown execution error', error);\n }\n}\n\n/**\n * Utilities for working with git.\n *\n * @public\n */\nexport class GitUtils {\n /**\n * Returns a sorted list of all files that have changed since the merge base\n * of the provided `ref` and HEAD, as well as all files that are not tracked by git.\n */\n static async listChangedFiles(ref: string) {\n if (!ref) {\n throw new Error('ref is required');\n }\n\n let diffRef = ref;\n try {\n const [base] = await runGit('merge-base', 'HEAD', ref);\n diffRef = base;\n } catch {\n // silently fall back to using the ref directly if merge base is not available\n }\n\n const tracked = await runGit('diff', '--name-only', diffRef);\n const untracked = await runGit(\n 'ls-files',\n '--others',\n '--exclude-standard',\n );\n\n return Array.from(new Set([...tracked, ...untracked]));\n }\n\n /**\n * Returns the contents of a file at a specific ref.\n */\n static async readFileAtRef(path: string, ref: string) {\n let showRef = ref;\n try {\n const [base] = await runGit('merge-base', 'HEAD', ref);\n showRef = base;\n } catch {\n // silently fall back to using the ref directly if merge base is not available\n }\n\n const { stdout } = await execFile('git', ['show', `${showRef}:${path}`], {\n shell: true,\n cwd: paths.targetRoot,\n maxBuffer: 1024 * 1024 * 50,\n });\n return stdout;\n }\n}\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { paths } from '../paths';\nimport fs from 'fs-extra';\n\n/**\n * Returns try if the current project is a monorepo.\n *\n * @public\n */\nexport async function isMonoRepo(): Promise<boolean> {\n const rootPackageJsonPath = paths.resolveTargetRoot('package.json');\n try {\n const pkg = await fs.readJson(rootPackageJsonPath);\n return Boolean(pkg?.workspaces?.packages);\n } catch (error) {\n return false;\n }\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { parseSyml } from '@yarnpkg/parsers';\nimport fs from 'fs-extra';\n\nconst ENTRY_PATTERN = /^((?:@[^/]+\\/)?[^@/]+)@(.+)$/;\n\n/** @internal */\ntype LockfileData = {\n [entry: string]: {\n version: string;\n resolved?: string;\n integrity?: string /* old */;\n checksum?: string /* new */;\n dependencies?: { [name: string]: string };\n peerDependencies?: { [name: string]: string };\n };\n};\n\n/** @internal */\ntype LockfileQueryEntry = {\n range: string;\n version: string;\n dataKey: string;\n};\n\n/**\n * An entry for a single difference between two {@link Lockfile}s.\n *\n * @public\n */\nexport type LockfileDiffEntry = {\n name: string;\n range: string;\n};\n\n/**\n * Represents the difference between two {@link Lockfile}s.\n *\n * @public\n */\nexport type LockfileDiff = {\n added: LockfileDiffEntry[];\n changed: LockfileDiffEntry[];\n removed: LockfileDiffEntry[];\n};\n\n// these are special top level yarn keys.\n// https://github.com/yarnpkg/berry/blob/9bd61fbffb83d0b8166a9cc26bec3a58743aa453/packages/yarnpkg-parsers/sources/syml.ts#L9\nconst SPECIAL_OBJECT_KEYS = [\n `__metadata`,\n `version`,\n `resolution`,\n `dependencies`,\n `peerDependencies`,\n `dependenciesMeta`,\n `peerDependenciesMeta`,\n `binaries`,\n];\n\n/**\n * Represents a package manager lockfile.\n *\n * @public\n */\nexport class Lockfile {\n /**\n * Load a {@link Lockfile} from a file path.\n */\n static async load(path: string): Promise<Lockfile> {\n const lockfileContents = await fs.readFile(path, 'utf8');\n return Lockfile.parse(lockfileContents);\n }\n\n /**\n * Parse lockfile contents into a {@link Lockfile}.\n *\n * @public\n */\n static parse(content: string): Lockfile {\n let data: LockfileData;\n try {\n data = parseSyml(content);\n } catch (err) {\n throw new Error(`Failed yarn.lock parse, ${err}`);\n }\n\n const packages = new Map<string, LockfileQueryEntry[]>();\n\n for (const [key, value] of Object.entries(data)) {\n if (SPECIAL_OBJECT_KEYS.includes(key)) continue;\n\n const [, name, ranges] = ENTRY_PATTERN.exec(key) ?? [];\n if (!name) {\n throw new Error(`Failed to parse yarn.lock entry '${key}'`);\n }\n\n let queries = packages.get(name);\n if (!queries) {\n queries = [];\n packages.set(name, queries);\n }\n for (let range of ranges.split(/\\s*,\\s*/)) {\n if (range.startsWith(`${name}@`)) {\n range = range.slice(`${name}@`.length);\n }\n if (range.startsWith('npm:')) {\n range = range.slice('npm:'.length);\n }\n queries.push({ range, version: value.version, dataKey: key });\n }\n }\n\n return new Lockfile(packages, data);\n }\n\n private constructor(\n private readonly packages: Map<string, LockfileQueryEntry[]>,\n private readonly data: LockfileData,\n ) {}\n\n /**\n * Creates a simplified dependency graph from the lockfile data, where each\n * key is a package, and the value is a set of all packages that it depends on\n * across all versions.\n */\n createSimplifiedDependencyGraph(): Map<string, Set<string>> {\n const graph = new Map<string, Set<string>>();\n\n for (const [name, entries] of this.packages) {\n const dependencies = new Set(\n entries.flatMap(e => {\n const data = this.data[e.dataKey];\n return [\n ...Object.keys(data?.dependencies ?? {}),\n ...Object.keys(data?.peerDependencies ?? {}),\n ];\n }),\n );\n graph.set(name, dependencies);\n }\n\n return graph;\n }\n\n /**\n * Diff with another lockfile, returning entries that have been\n * added, changed, and removed compared to the other lockfile.\n */\n diff(otherLockfile: Lockfile): LockfileDiff {\n const diff = {\n added: new Array<{ name: string; range: string }>(),\n changed: new Array<{ name: string; range: string }>(),\n removed: new Array<{ name: string; range: string }>(),\n };\n\n // Keeps track of packages that only exist in this lockfile\n const remainingOldNames = new Set(this.packages.keys());\n\n for (const [name, otherQueries] of otherLockfile.packages) {\n remainingOldNames.delete(name);\n\n const thisQueries = this.packages.get(name);\n // If the packages doesn't exist in this lockfile, add all entries\n if (!thisQueries) {\n diff.removed.push(...otherQueries.map(q => ({ name, range: q.range })));\n continue;\n }\n\n const remainingOldRanges = new Set(thisQueries.map(q => q.range));\n\n for (const otherQuery of otherQueries) {\n remainingOldRanges.delete(otherQuery.range);\n\n const thisQuery = thisQueries.find(q => q.range === otherQuery.range);\n if (!thisQuery) {\n diff.removed.push({ name, range: otherQuery.range });\n continue;\n }\n\n const otherPkg = otherLockfile.data[otherQuery.dataKey];\n const thisPkg = this.data[thisQuery.dataKey];\n if (otherPkg && thisPkg) {\n const thisCheck = thisPkg.integrity || thisPkg.checksum;\n const otherCheck = otherPkg.integrity || otherPkg.checksum;\n if (thisCheck !== otherCheck) {\n diff.changed.push({ name, range: otherQuery.range });\n }\n }\n }\n\n for (const thisRange of remainingOldRanges) {\n diff.added.push({ name, range: thisRange });\n }\n }\n\n for (const name of remainingOldNames) {\n const queries = this.packages.get(name) ?? [];\n diff.added.push(...queries.map(q => ({ name, range: q.range })));\n }\n\n return diff;\n }\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport path from 'path';\nimport { getPackages, Package } from '@manypkg/get-packages';\nimport { paths } from '../paths';\nimport { PackageRole } from '../roles';\nimport { GitUtils } from '../git';\nimport { Lockfile } from './Lockfile';\nimport { JsonValue } from '@backstage/types';\n\n/**\n * Known fields in Backstage package.json files.\n *\n * @public\n */\nexport interface BackstagePackageJson {\n name: string;\n version: string;\n private?: boolean;\n\n main?: string;\n module?: string;\n types?: string;\n\n scripts?: {\n [key: string]: string;\n };\n // The `bundled` field is a field known within Backstage, it means\n // that the package bundles all of its dependencies in its build output.\n bundled?: boolean;\n\n backstage?: {\n role?: PackageRole;\n moved?: string;\n };\n\n exports?: JsonValue;\n typesVersions?: Record<string, Record<string, string[]>>;\n\n files?: string[];\n\n publishConfig?: {\n access?: 'public' | 'restricted';\n directory?: string;\n registry?: string;\n };\n\n repository?:\n | string\n | {\n type: string;\n url: string;\n directory: string;\n };\n\n dependencies?: {\n [key: string]: string;\n };\n peerDependencies?: {\n [key: string]: string;\n };\n devDependencies?: {\n [key: string]: string;\n };\n optionalDependencies?: {\n [key: string]: string;\n };\n}\n\n/**\n * A local Backstage monorepo package\n *\n * @public\n */\nexport type BackstagePackage = {\n dir: string;\n packageJson: BackstagePackageJson;\n};\n\n/**\n * A local package in the monorepo package graph.\n *\n * @public\n */\nexport type PackageGraphNode = {\n /** The name of the package */\n name: string;\n /** The directory of the package */\n dir: string;\n /** The package data of the package itself */\n packageJson: BackstagePackageJson;\n\n /** All direct local dependencies of the package */\n allLocalDependencies: Map<string, PackageGraphNode>;\n /** All direct local dependencies that will be present in the published package */\n publishedLocalDependencies: Map<string, PackageGraphNode>;\n /** Local dependencies */\n localDependencies: Map<string, PackageGraphNode>;\n /** Local devDependencies */\n localDevDependencies: Map<string, PackageGraphNode>;\n /** Local optionalDependencies */\n localOptionalDependencies: Map<string, PackageGraphNode>;\n\n /** All direct incoming local dependencies of the package */\n allLocalDependents: Map<string, PackageGraphNode>;\n /** All direct incoming local dependencies that will be present in the published package */\n publishedLocalDependents: Map<string, PackageGraphNode>;\n /** Incoming local dependencies */\n localDependents: Map<string, PackageGraphNode>;\n /** Incoming local devDependencies */\n localDevDependents: Map<string, PackageGraphNode>;\n /** Incoming local optionalDependencies */\n localOptionalDependents: Map<string, PackageGraphNode>;\n};\n\n/**\n * Represents a local Backstage monorepo package graph.\n *\n * @public\n */\nexport class PackageGraph extends Map<string, PackageGraphNode> {\n /**\n * Lists all local packages in a monorepo.\n */\n static async listTargetPackages(): Promise<BackstagePackage[]> {\n const { packages } = await getPackages(paths.targetDir);\n\n return packages as BackstagePackage[];\n }\n\n /**\n * Creates a package graph from a list of local packages.\n */\n static fromPackages(packages: Package[]): PackageGraph {\n const graph = new PackageGraph();\n\n // Add all local packages to the graph\n for (const pkg of packages) {\n const name = pkg.packageJson.name;\n const existingPkg = graph.get(name);\n if (existingPkg) {\n throw new Error(\n `Duplicate package name '${name}' at ${pkg.dir} and ${existingPkg.dir}`,\n );\n }\n\n graph.set(name, {\n name,\n dir: pkg.dir,\n packageJson: pkg.packageJson as BackstagePackageJson,\n\n allLocalDependencies: new Map(),\n publishedLocalDependencies: new Map(),\n localDependencies: new Map(),\n localDevDependencies: new Map(),\n localOptionalDependencies: new Map(),\n\n allLocalDependents: new Map(),\n publishedLocalDependents: new Map(),\n localDependents: new Map(),\n localDevDependents: new Map(),\n localOptionalDependents: new Map(),\n });\n }\n\n // Populate the local dependency structure\n for (const node of graph.values()) {\n for (const depName of Object.keys(node.packageJson.dependencies || {})) {\n const depPkg = graph.get(depName);\n if (depPkg) {\n node.allLocalDependencies.set(depName, depPkg);\n node.publishedLocalDependencies.set(depName, depPkg);\n node.localDependencies.set(depName, depPkg);\n\n depPkg.allLocalDependents.set(node.name, node);\n depPkg.publishedLocalDependents.set(node.name, node);\n depPkg.localDependents.set(node.name, node);\n }\n }\n for (const depName of Object.keys(\n node.packageJson.devDependencies || {},\n )) {\n const depPkg = graph.get(depName);\n if (depPkg) {\n node.allLocalDependencies.set(depName, depPkg);\n node.localDevDependencies.set(depName, depPkg);\n\n depPkg.allLocalDependents.set(node.name, node);\n depPkg.localDevDependents.set(node.name, node);\n }\n }\n for (const depName of Object.keys(\n node.packageJson.optionalDependencies || {},\n )) {\n const depPkg = graph.get(depName);\n if (depPkg) {\n node.allLocalDependencies.set(depName, depPkg);\n node.publishedLocalDependencies.set(depName, depPkg);\n node.localOptionalDependencies.set(depName, depPkg);\n\n depPkg.allLocalDependents.set(node.name, node);\n depPkg.publishedLocalDependents.set(node.name, node);\n depPkg.localOptionalDependents.set(node.name, node);\n }\n }\n }\n\n return graph;\n }\n\n /**\n * Traverses the package graph and collects a set of package names.\n *\n * The traversal starts at the provided list names, and continues\n * throughout all the names returned by the `collectFn`, which is\n * called once for each seen package.\n */\n collectPackageNames(\n startingPackageNames: string[],\n collectFn: (pkg: PackageGraphNode) => Iterable<string> | undefined,\n ): Set<string> {\n const targets = new Set<string>();\n const searchNames = startingPackageNames.slice();\n\n while (searchNames.length) {\n const name = searchNames.pop()!;\n\n if (targets.has(name)) {\n continue;\n }\n\n const node = this.get(name);\n if (!node) {\n throw new Error(`Package '${name}' not found`);\n }\n\n targets.add(name);\n\n const collected = collectFn(node);\n if (collected) {\n searchNames.push(...collected);\n }\n }\n\n return targets;\n }\n\n /**\n * Lists all packages that have changed since a given git ref.\n *\n * @remarks\n *\n * If the `analyzeLockfile` option is set to true, the change detection will\n * also consider changes to the dependency management lockfile.\n */\n async listChangedPackages(options: {\n ref: string;\n analyzeLockfile?: boolean;\n }) {\n const changedFiles = await GitUtils.listChangedFiles(options.ref);\n\n const dirMap = new Map(\n Array.from(this.values()).map(pkg => [\n // relative from root, convert to posix, and add a / at the end\n path\n .relative(paths.targetRoot, pkg.dir)\n .split(path.sep)\n .join(path.posix.sep) + path.posix.sep,\n pkg,\n ]),\n );\n const packageDirs = Array.from(dirMap.keys());\n\n const result = new Array<PackageGraphNode>();\n let searchIndex = 0;\n\n changedFiles.sort();\n packageDirs.sort();\n\n for (const packageDir of packageDirs) {\n // Skip through changes that appear before our package dir\n while (\n searchIndex < changedFiles.length &&\n changedFiles[searchIndex] < packageDir\n ) {\n searchIndex += 1;\n }\n\n // Check if we arrived at a match, otherwise we move on to the next package dir\n if (changedFiles[searchIndex]?.startsWith(packageDir)) {\n searchIndex += 1;\n\n result.push(dirMap.get(packageDir)!);\n\n // Skip through the rest of the changed files for the same package\n while (changedFiles[searchIndex]?.startsWith(packageDir)) {\n searchIndex += 1;\n }\n }\n }\n\n if (changedFiles.includes('yarn.lock') && options.analyzeLockfile) {\n // Load the lockfile in the working tree and the one at the ref and diff them\n let thisLockfile: Lockfile;\n let otherLockfile: Lockfile;\n try {\n thisLockfile = await Lockfile.load(\n paths.resolveTargetRoot('yarn.lock'),\n );\n otherLockfile = Lockfile.parse(\n await GitUtils.readFileAtRef('yarn.lock', options.ref),\n );\n } catch (error) {\n console.warn(\n `Failed to read lockfiles, assuming all packages have changed, ${error}`,\n );\n return Array.from(this.values());\n }\n const diff = thisLockfile.diff(otherLockfile);\n\n // Create a simplified dependency graph only keeps track of package names\n const graph = thisLockfile.createSimplifiedDependencyGraph();\n\n // Merge the dependency graph from the other lockfile into this one in\n // order to be able to detect removals accurately.\n {\n const otherGraph = thisLockfile.createSimplifiedDependencyGraph();\n for (const [name, dependencies] of otherGraph) {\n const node = graph.get(name);\n if (node) {\n dependencies.forEach(d => node.add(d));\n } else {\n graph.set(name, dependencies);\n }\n }\n }\n\n // The check is simplified by only considering the package names rather\n // than the exact version range queries that were changed.\n // TODO(Rugvip): Use a more exact check\n const changedPackages = new Set(\n [...diff.added, ...diff.changed, ...diff.removed].map(e => e.name),\n );\n\n // Starting with our set of changed packages from the diff, we loop through\n // the full graph and add any package that has a dependency on a changed package.\n // We keep looping until all transitive dependencies have been detected.\n let changed = false;\n do {\n changed = false;\n for (const [name, dependencies] of graph) {\n if (changedPackages.has(name)) {\n continue;\n }\n for (const dep of dependencies) {\n if (changedPackages.has(dep)) {\n changed = true;\n changedPackages.add(name);\n break;\n }\n }\n }\n } while (changed);\n\n // Add all local packages that had a transitive dependency change to the result set\n for (const node of this.values()) {\n if (changedPackages.has(node.name) && !result.includes(node)) {\n result.push(node);\n }\n }\n }\n\n return result;\n }\n}\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { z } from 'zod';\nimport { PackageRole, PackageRoleInfo } from './types';\n\nconst packageRoleInfos: PackageRoleInfo[] = [\n {\n role: 'frontend',\n platform: 'web',\n output: ['bundle'],\n },\n {\n role: 'backend',\n platform: 'node',\n output: ['bundle'],\n },\n {\n role: 'cli',\n platform: 'node',\n output: ['cjs'],\n },\n {\n role: 'web-library',\n platform: 'web',\n output: ['types', 'esm'],\n },\n {\n role: 'node-library',\n platform: 'node',\n output: ['types', 'cjs'],\n },\n {\n role: 'common-library',\n platform: 'common',\n output: ['types', 'esm', 'cjs'],\n },\n {\n role: 'frontend-plugin',\n platform: 'web',\n output: ['types', 'esm'],\n },\n {\n role: 'frontend-plugin-module',\n platform: 'web',\n output: ['types', 'esm'],\n },\n {\n role: 'backend-plugin',\n platform: 'node',\n output: ['types', 'cjs'],\n },\n {\n role: 'backend-plugin-module',\n platform: 'node',\n output: ['types', 'cjs'],\n },\n];\n\nconst readSchema = z.object({\n name: z.string().optional(),\n backstage: z\n .object({\n role: z.string().optional(),\n })\n .optional(),\n});\n\nconst detectionSchema = z.object({\n name: z.string().optional(),\n scripts: z\n .object({\n start: z.string().optional(),\n build: z.string().optional(),\n })\n .optional(),\n publishConfig: z\n .object({\n main: z.string().optional(),\n types: z.string().optional(),\n module: z.string().optional(),\n })\n .optional(),\n main: z.string().optional(),\n types: z.string().optional(),\n module: z.string().optional(),\n});\n\n/**\n * Utilities for working with Backstage package roles.\n *\n * @public\n */\nexport class PackageRoles {\n /**\n * Get the associated info for a package role.\n */\n static getRoleInfo(role: string): PackageRoleInfo {\n const roleInfo = packageRoleInfos.find(r => r.role === role);\n if (!roleInfo) {\n throw new Error(`Unknown package role '${role}'`);\n }\n return roleInfo;\n }\n\n /**\n * Given package JSON data, get the package role.\n */\n static getRoleFromPackage(pkgJson: unknown): PackageRole | undefined {\n const pkg = readSchema.parse(pkgJson);\n\n if (pkg.backstage) {\n const { role } = pkg.backstage;\n if (!role) {\n throw new Error(\n `Package ${pkg.name} must specify a role in the \"backstage\" field`,\n );\n }\n\n return this.getRoleInfo(role).role;\n }\n\n return undefined;\n }\n\n /**\n * Attempt to detect the role of a package from its package.json.\n */\n static detectRoleFromPackage(pkgJson: unknown): PackageRole | undefined {\n const pkg = detectionSchema.parse(pkgJson);\n\n if (pkg.scripts?.start?.includes('app:serve')) {\n return 'frontend';\n }\n if (pkg.scripts?.build?.includes('backend:bundle')) {\n return 'backend';\n }\n if (\n pkg.name?.includes('plugin-') &&\n pkg.name?.includes('-backend-module-')\n ) {\n return 'backend-plugin-module';\n }\n if (pkg.name?.includes('plugin-') && pkg.name?.includes('-module-')) {\n return 'frontend-plugin-module';\n }\n if (pkg.scripts?.start?.includes('plugin:serve')) {\n return 'frontend-plugin';\n }\n if (pkg.scripts?.start?.includes('backend:dev')) {\n return 'backend-plugin';\n }\n\n const mainEntry = pkg.publishConfig?.main || pkg.main;\n const moduleEntry = pkg.publishConfig?.module || pkg.module;\n const typesEntry = pkg.publishConfig?.types || pkg.types;\n if (typesEntry) {\n if (mainEntry && moduleEntry) {\n return 'common-library';\n }\n if (moduleEntry || mainEntry?.endsWith('.esm.js')) {\n return 'web-library';\n }\n if (mainEntry) {\n return 'node-library';\n }\n } else if (mainEntry) {\n return 'cli';\n }\n\n return undefined;\n }\n}\n"],"names":["findPaths","promisify","execFileCb","assertError","ForwardedError","fs","parseSyml","getPackages","path","z"],"mappings":";;;;;;;;;;;;;;;;;AAmBa,MAAA,KAAA,GAAQA,oBAAU,SAAS,CAAA;;ACA3B,MAAA,QAAA,GAAWC,eAAUC,sBAAU,CAAA;;ACI5C,eAAsB,UAAU,IAAgB,EAAA;AAC9C,EAAI,IAAA;AACF,IAAA,MAAM,EAAE,MAAO,EAAA,GAAI,MAAM,QAAA,CAAS,OAAO,IAAM,EAAA;AAAA,MAC7C,KAAO,EAAA,IAAA;AAAA,MACP,KAAK,KAAM,CAAA,UAAA;AAAA,KACZ,CAAA,CAAA;AACD,IAAA,OAAO,MAAO,CAAA,IAAA,EAAO,CAAA,KAAA,CAAM,YAAY,CAAA,CAAA;AAAA,WAChC,KAAO,EAAA;AACd,IAAAC,kBAAA,CAAY,KAAK,CAAA,CAAA;AACjB,IAAA,IAAI,KAAM,CAAA,MAAA,IAAU,OAAO,KAAA,CAAM,SAAS,QAAU,EAAA;AAClD,MAAA,MAAM,MAAU,GAAA,KAAA,CAAM,MAA+B,EAAA,QAAA,CAAS,MAAM,CAAA,CAAA;AACpE,MAAA,MAAM,MAAM,MAAQ,EAAA,IAAA,EAAU,IAAA,CAAA,eAAA,EAAkB,MAAM,IAA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CAAA,MAAA,CAAA;AACrD,IAAA,MAAM,UAAa,GAAA,GAAA,CAAI,aAAe,EAAA,KAAA,IAAS,GAAI,CAAA,KAAA,CAAA;AACnD,IAAA,IAAI,UAAY,EAAA;AACd,MAAA,IAAI,aAAa,WAAa,EAAA;AAC5B,QAAO,OAAA,gBAAA,CAAA;AAAA,OACT;AACA,MAAA,IAAI,WAAe,IAAA,SAAA,EAAW,QAAS,CAAA,SAAS,CAAG,EAAA;AACjD,QAAO,OAAA,aAAA,CAAA;AAAA,OACT;AACA,MAAA,IAAI,SAAW,EAAA;AACb,QAAO,OAAA,cAAA,CAAA;AAAA,OACT;AAAA,eACS,SAAW,EAAA;AACpB,MAAO,OAAA,KAAA,CAAA;AAAA,KACT;AAEA,IAAO,OAAA,KAAA,CAAA,CAAA;AAAA,GACT;AACF;;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -92,6 +92,7 @@ interface BackstagePackageJson {
|
|
|
92
92
|
bundled?: boolean;
|
|
93
93
|
backstage?: {
|
|
94
94
|
role?: PackageRole;
|
|
95
|
+
moved?: string;
|
|
95
96
|
};
|
|
96
97
|
exports?: JsonValue;
|
|
97
98
|
typesVersions?: Record<string, Record<string, string[]>>;
|
|
@@ -248,4 +249,4 @@ declare class Lockfile {
|
|
|
248
249
|
diff(otherLockfile: Lockfile): LockfileDiff;
|
|
249
250
|
}
|
|
250
251
|
|
|
251
|
-
export { BackstagePackage, BackstagePackageJson, GitUtils, Lockfile, LockfileDiff, LockfileDiffEntry, PackageGraph, PackageGraphNode, PackageOutputType, PackagePlatform, PackageRole, PackageRoleInfo, PackageRoles, isMonoRepo };
|
|
252
|
+
export { type BackstagePackage, type BackstagePackageJson, GitUtils, Lockfile, type LockfileDiff, type LockfileDiffEntry, PackageGraph, type PackageGraphNode, type PackageOutputType, type PackagePlatform, type PackageRole, type PackageRoleInfo, PackageRoles, isMonoRepo };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/cli-node",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6-next.0",
|
|
4
4
|
"description": "Node.js library for Backstage CLIs",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "node-library"
|
|
@@ -35,13 +35,13 @@
|
|
|
35
35
|
"@backstage/errors": "^1.2.4",
|
|
36
36
|
"@backstage/types": "^1.1.1",
|
|
37
37
|
"@manypkg/get-packages": "^1.1.3",
|
|
38
|
-
"@yarnpkg/parsers": "^3.0.0
|
|
38
|
+
"@yarnpkg/parsers": "^3.0.0",
|
|
39
39
|
"fs-extra": "^11.2.0",
|
|
40
40
|
"semver": "^7.5.3",
|
|
41
41
|
"zod": "^3.22.4"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@backstage/backend-test-utils": "^0.3.
|
|
45
|
-
"@backstage/cli": "^0.26.0"
|
|
44
|
+
"@backstage/backend-test-utils": "^0.3.9-next.0",
|
|
45
|
+
"@backstage/cli": "^0.26.6-next.0"
|
|
46
46
|
}
|
|
47
47
|
}
|