@backstage/cli 0.36.0-next.2 → 0.36.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 +95 -0
- package/config/eslint-factory.js +1 -0
- package/config/getJestEnvironment.js +7 -29
- package/config/jest-environment-jsdom/index.js +9 -43
- package/config/jest.js +7 -401
- package/config/jestCacheResultProcessor.cjs +10 -6
- package/config/jestCachingModuleLoader.js +11 -19
- package/config/jestFileTransform.js +11 -28
- package/config/jestRejectNetworkRequests.js +10 -53
- package/config/jestSucraseTransform.js +10 -70
- package/config/jestSwcTransform.js +10 -27
- package/config/jestYamlTransform.js +11 -24
- package/config/nodeTransform.cjs +10 -70
- package/config/nodeTransformHooks.mjs +4 -278
- package/config/webpack-public-path.js +10 -14
- package/dist/cli-internal/src/InternalCliModule.cjs.js +11 -0
- package/dist/cli-internal/src/InternalCommandNode.cjs.js +25 -0
- package/dist/cli-internal/src/knownPluginPackages.cjs.js +40 -0
- package/dist/index.cjs.js +21 -11
- package/dist/wiring/CliInitializer.cjs.js +61 -30
- package/dist/wiring/CommandGraph.cjs.js +81 -23
- package/dist/wiring/discoverCliModules.cjs.js +44 -0
- package/package.json +27 -160
- package/dist/modules/auth/commands/list.cjs.js +0 -23
- package/dist/modules/auth/commands/login.cjs.js +0 -316
- package/dist/modules/auth/commands/logout.cjs.js +0 -55
- package/dist/modules/auth/commands/printToken.cjs.js +0 -41
- package/dist/modules/auth/commands/select.cjs.js +0 -32
- package/dist/modules/auth/commands/show.cjs.js +0 -59
- package/dist/modules/auth/index.cjs.js +0 -44
- package/dist/modules/auth/lib/auth.cjs.js +0 -60
- package/dist/modules/auth/lib/http.cjs.js +0 -26
- package/dist/modules/auth/lib/localServer.cjs.js +0 -80
- package/dist/modules/auth/lib/pkce.cjs.js +0 -23
- package/dist/modules/auth/lib/prompt.cjs.js +0 -44
- package/dist/modules/auth/lib/secretStore.cjs.js +0 -81
- package/dist/modules/auth/lib/storage.cjs.js +0 -152
- package/dist/modules/build/commands/buildWorkspace.cjs.js +0 -53
- package/dist/modules/build/commands/package/build/command.cjs.js +0 -136
- package/dist/modules/build/commands/package/build/index.cjs.js +0 -10
- package/dist/modules/build/commands/package/clean.cjs.js +0 -21
- package/dist/modules/build/commands/package/postpack.cjs.js +0 -15
- package/dist/modules/build/commands/package/prepack.cjs.js +0 -29
- package/dist/modules/build/commands/package/start/command.cjs.js +0 -80
- package/dist/modules/build/commands/package/start/index.cjs.js +0 -10
- package/dist/modules/build/commands/package/start/resolveLinkedWorkspace.cjs.js +0 -34
- package/dist/modules/build/commands/package/start/startBackend.cjs.js +0 -46
- package/dist/modules/build/commands/package/start/startFrontend.cjs.js +0 -50
- package/dist/modules/build/commands/package/start/startPackage.cjs.js +0 -53
- package/dist/modules/build/commands/repo/build.cjs.js +0 -149
- package/dist/modules/build/commands/repo/clean.cjs.js +0 -41
- package/dist/modules/build/commands/repo/start.cjs.js +0 -199
- package/dist/modules/build/index.cjs.js +0 -68
- package/dist/modules/build/lib/buildBackend.cjs.js +0 -81
- package/dist/modules/build/lib/buildFrontend.cjs.js +0 -50
- package/dist/modules/build/lib/builder/config.cjs.js +0 -257
- package/dist/modules/build/lib/builder/packager.cjs.js +0 -131
- package/dist/modules/build/lib/builder/plugins.cjs.js +0 -125
- package/dist/modules/build/lib/builder/types.cjs.js +0 -10
- package/dist/modules/build/lib/bundler/ConfigInjectingHtmlWebpackPlugin.cjs.js +0 -43
- package/dist/modules/build/lib/bundler/bundle.cjs.js +0 -189
- package/dist/modules/build/lib/bundler/config.cjs.js +0 -308
- package/dist/modules/build/lib/bundler/hasReactDomClient.cjs.js +0 -17
- package/dist/modules/build/lib/bundler/linkWorkspaces.cjs.js +0 -34
- package/dist/modules/build/lib/bundler/moduleFederation.cjs.js +0 -135
- package/dist/modules/build/lib/bundler/optimization.cjs.js +0 -68
- package/dist/modules/build/lib/bundler/packageDetection.cjs.js +0 -124
- package/dist/modules/build/lib/bundler/paths.cjs.js +0 -62
- package/dist/modules/build/lib/bundler/server.cjs.js +0 -231
- package/dist/modules/build/lib/bundler/transforms.cjs.js +0 -145
- package/dist/modules/build/lib/config.cjs.js +0 -94
- package/dist/modules/build/lib/entryPoints.cjs.js +0 -49
- package/dist/modules/build/lib/ipc/IpcServer.cjs.js +0 -60
- package/dist/modules/build/lib/ipc/ServerDataStore.cjs.js +0 -36
- package/dist/modules/build/lib/optionsParser.cjs.js +0 -22
- package/dist/modules/build/lib/packager/createDistWorkspace.cjs.js +0 -235
- package/dist/modules/build/lib/packager/productionPack.cjs.js +0 -160
- package/dist/modules/build/lib/publishing.cjs.js +0 -40
- package/dist/modules/build/lib/role.cjs.js +0 -24
- package/dist/modules/build/lib/runner/runBackend.cjs.js +0 -136
- package/dist/modules/build/lib/typeDistProject.cjs.js +0 -89
- package/dist/modules/build/lib/urls.cjs.js +0 -13
- package/dist/modules/config/commands/docs.cjs.js +0 -63
- package/dist/modules/config/commands/print.cjs.js +0 -81
- package/dist/modules/config/commands/schema.cjs.js +0 -56
- package/dist/modules/config/commands/validate.cjs.js +0 -50
- package/dist/modules/config/index.cjs.js +0 -51
- package/dist/modules/config/lib/config.cjs.js +0 -94
- package/dist/modules/create-github-app/commands/create-github-app/GithubCreateAppServer.cjs.js +0 -127
- package/dist/modules/create-github-app/commands/create-github-app/index.cjs.js +0 -126
- package/dist/modules/create-github-app/index.cjs.js +0 -19
- package/dist/modules/info/commands/info.cjs.js +0 -182
- package/dist/modules/info/index.cjs.js +0 -19
- package/dist/modules/lint/commands/package/lint.cjs.js +0 -78
- package/dist/modules/lint/commands/repo/lint.cjs.js +0 -282
- package/dist/modules/lint/index.cjs.js +0 -24
- package/dist/modules/lint/lib/optionsParser.cjs.js +0 -22
- package/dist/modules/maintenance/commands/repo/fix.cjs.js +0 -426
- package/dist/modules/maintenance/commands/repo/list-deprecations.cjs.js +0 -90
- package/dist/modules/maintenance/index.cjs.js +0 -24
- package/dist/modules/migrate/commands/packageExports.cjs.js +0 -15
- package/dist/modules/migrate/commands/packageLintConfigs.cjs.js +0 -77
- package/dist/modules/migrate/commands/packageRole.cjs.js +0 -57
- package/dist/modules/migrate/commands/packageScripts.cjs.js +0 -87
- package/dist/modules/migrate/commands/reactRouterDeps.cjs.js +0 -51
- package/dist/modules/migrate/commands/versions/bump.cjs.js +0 -403
- package/dist/modules/migrate/commands/versions/migrate.cjs.js +0 -133
- package/dist/modules/migrate/index.cjs.js +0 -59
- package/dist/modules/migrate/lib/utils.cjs.js +0 -44
- package/dist/modules/migrate/lib/versioning/packages.cjs.js +0 -71
- package/dist/modules/migrate/lib/versioning/yarn.cjs.js +0 -28
- package/dist/modules/new/commands/new.cjs.js +0 -115
- package/dist/modules/new/index.cjs.js +0 -40
- package/dist/modules/new/lib/codeowners/codeowners.cjs.js +0 -92
- package/dist/modules/new/lib/createNewPackage.cjs.js +0 -32
- package/dist/modules/new/lib/defaultTemplates.cjs.js +0 -17
- package/dist/modules/new/lib/execution/PortableTemplater.cjs.js +0 -89
- package/dist/modules/new/lib/execution/executePortableTemplate.cjs.js +0 -66
- package/dist/modules/new/lib/execution/installNewPackage.cjs.js +0 -127
- package/dist/modules/new/lib/execution/writeTemplateContents.cjs.js +0 -116
- package/dist/modules/new/lib/preparation/collectPortableTemplateInput.cjs.js +0 -157
- package/dist/modules/new/lib/preparation/loadPortableTemplate.cjs.js +0 -81
- package/dist/modules/new/lib/preparation/loadPortableTemplateConfig.cjs.js +0 -132
- package/dist/modules/new/lib/preparation/resolvePackageParams.cjs.js +0 -40
- package/dist/modules/new/lib/preparation/selectTemplateInteractively.cjs.js +0 -38
- package/dist/modules/new/lib/tasks.cjs.js +0 -51
- package/dist/modules/new/lib/types.cjs.js +0 -19
- package/dist/modules/new/lib/version.cjs.js +0 -91
- package/dist/modules/test/commands/package/test.cjs.js +0 -59
- package/dist/modules/test/commands/repo/test.cjs.js +0 -299
- package/dist/modules/test/index.cjs.js +0 -24
- package/dist/modules/translations/commands/export.cjs.js +0 -128
- package/dist/modules/translations/commands/import.cjs.js +0 -165
- package/dist/modules/translations/index.cjs.js +0 -24
- package/dist/modules/translations/lib/discoverPackages.cjs.js +0 -121
- package/dist/modules/translations/lib/extractTranslations.cjs.js +0 -71
- package/dist/modules/translations/lib/messageFilePath.cjs.js +0 -43
- package/dist/packages/backend-defaults/package.json.cjs.js +0 -6
- package/dist/packages/backend-plugin-api/package.json.cjs.js +0 -6
- package/dist/packages/backend-test-utils/package.json.cjs.js +0 -6
- package/dist/packages/catalog-client/package.json.cjs.js +0 -6
- package/dist/packages/cli/package.json.cjs.js +0 -159
- package/dist/packages/config/package.json.cjs.js +0 -6
- package/dist/packages/core-app-api/package.json.cjs.js +0 -6
- package/dist/packages/core-components/package.json.cjs.js +0 -6
- package/dist/packages/core-plugin-api/package.json.cjs.js +0 -6
- package/dist/packages/dev-utils/package.json.cjs.js +0 -6
- package/dist/packages/errors/package.json.cjs.js +0 -6
- package/dist/packages/frontend-defaults/package.json.cjs.js +0 -6
- package/dist/packages/frontend-plugin-api/package.json.cjs.js +0 -6
- package/dist/packages/frontend-plugin-api/src/routing/describeParentCallSite.cjs.js +0 -26
- package/dist/packages/frontend-test-utils/package.json.cjs.js +0 -6
- package/dist/packages/test-utils/package.json.cjs.js +0 -6
- package/dist/packages/theme/package.json.cjs.js +0 -6
- package/dist/packages/types/package.json.cjs.js +0 -6
- package/dist/plugins/auth-backend/package.json.cjs.js +0 -6
- package/dist/plugins/auth-backend-module-guest-provider/package.json.cjs.js +0 -6
- package/dist/plugins/catalog-node/package.json.cjs.js +0 -6
- package/dist/plugins/scaffolder-node/package.json.cjs.js +0 -6
- package/dist/plugins/scaffolder-node-test-utils/package.json.cjs.js +0 -6
- package/dist/wiring/CommandRegistry.cjs.js +0 -14
- package/dist/wiring/factory.cjs.js +0 -15
- package/dist/wiring/types.cjs.js +0 -11
- package/templates/backend-plugin/.eslintrc.js.hbs +0 -1
- package/templates/backend-plugin/README.md.hbs +0 -28
- package/templates/backend-plugin/dev/index.ts.hbs +0 -60
- package/templates/backend-plugin/package.json.hbs +0 -44
- package/templates/backend-plugin/portable-template.yaml +0 -5
- package/templates/backend-plugin/src/index.ts.hbs +0 -1
- package/templates/backend-plugin/src/plugin.test.ts.hbs +0 -129
- package/templates/backend-plugin/src/plugin.ts.hbs +0 -32
- package/templates/backend-plugin/src/router.test.ts +0 -67
- package/templates/backend-plugin/src/router.ts +0 -51
- package/templates/backend-plugin/src/services/TodoListService.ts +0 -155
- package/templates/backend-plugin/src/setupTests.ts +0 -1
- package/templates/backend-plugin-module/.eslintrc.js.hbs +0 -1
- package/templates/backend-plugin-module/README.md.hbs +0 -5
- package/templates/backend-plugin-module/package.json.hbs +0 -34
- package/templates/backend-plugin-module/portable-template.yaml +0 -5
- package/templates/backend-plugin-module/src/index.ts.hbs +0 -8
- package/templates/backend-plugin-module/src/module.ts.hbs +0 -17
- package/templates/catalog-provider-module/.eslintrc.js.hbs +0 -1
- package/templates/catalog-provider-module/README.md.hbs +0 -5
- package/templates/catalog-provider-module/config.d.ts.hbs +0 -34
- package/templates/catalog-provider-module/package.json.hbs +0 -36
- package/templates/catalog-provider-module/portable-template.yaml +0 -9
- package/templates/catalog-provider-module/src/index.ts.hbs +0 -8
- package/templates/catalog-provider-module/src/module.ts.hbs +0 -29
- package/templates/catalog-provider-module/src/provider/readProviderConfigs.ts.hbs +0 -78
- package/templates/catalog-provider-module/src/provider/{{providerClass}}.test.ts.hbs +0 -18
- package/templates/catalog-provider-module/src/provider/{{providerClass}}.ts.hbs +0 -109
- package/templates/frontend-plugin/.eslintrc.js.hbs +0 -1
- package/templates/frontend-plugin/README.md.hbs +0 -13
- package/templates/frontend-plugin/dev/index.tsx.hbs +0 -11
- package/templates/frontend-plugin/package.json.hbs +0 -54
- package/templates/frontend-plugin/portable-template.yaml +0 -6
- package/templates/frontend-plugin/src/components/ExampleComponent/ExampleComponent.test.tsx.hbs +0 -28
- package/templates/frontend-plugin/src/components/ExampleComponent/ExampleComponent.tsx.hbs +0 -37
- package/templates/frontend-plugin/src/components/ExampleComponent/index.ts +0 -1
- package/templates/frontend-plugin/src/components/ExampleFetchComponent/ExampleFetchComponent.test.tsx.hbs +0 -19
- package/templates/frontend-plugin/src/components/ExampleFetchComponent/ExampleFetchComponent.tsx.hbs +0 -308
- package/templates/frontend-plugin/src/components/ExampleFetchComponent/index.ts +0 -1
- package/templates/frontend-plugin/src/index.ts.hbs +0 -1
- package/templates/frontend-plugin/src/plugin.test.ts.hbs +0 -7
- package/templates/frontend-plugin/src/plugin.ts.hbs +0 -22
- package/templates/frontend-plugin/src/routes.ts.hbs +0 -5
- package/templates/frontend-plugin/src/setupTests.ts +0 -1
- package/templates/new-frontend-plugin/.eslintrc.js.hbs +0 -1
- package/templates/new-frontend-plugin/README.md.hbs +0 -20
- package/templates/new-frontend-plugin/dev/index.tsx +0 -10
- package/templates/new-frontend-plugin/package.json.hbs +0 -49
- package/templates/new-frontend-plugin/portable-template.yaml +0 -5
- package/templates/new-frontend-plugin/src/components/ExampleComponent/ExampleComponent.test.tsx.hbs +0 -28
- package/templates/new-frontend-plugin/src/components/ExampleComponent/ExampleComponent.tsx.hbs +0 -37
- package/templates/new-frontend-plugin/src/components/ExampleComponent/index.ts +0 -1
- package/templates/new-frontend-plugin/src/components/ExampleFetchComponent/ExampleFetchComponent.test.tsx.hbs +0 -19
- package/templates/new-frontend-plugin/src/components/ExampleFetchComponent/ExampleFetchComponent.tsx.hbs +0 -308
- package/templates/new-frontend-plugin/src/components/ExampleFetchComponent/index.ts +0 -1
- package/templates/new-frontend-plugin/src/index.ts.hbs +0 -1
- package/templates/new-frontend-plugin/src/plugin.test.ts.hbs +0 -7
- package/templates/new-frontend-plugin/src/plugin.tsx.hbs +0 -25
- package/templates/new-frontend-plugin/src/routes.ts +0 -3
- package/templates/new-frontend-plugin/src/setupTests.ts +0 -1
- package/templates/new-frontend-plugin-module/.eslintrc.js.hbs +0 -1
- package/templates/new-frontend-plugin-module/README.md.hbs +0 -5
- package/templates/new-frontend-plugin-module/package.json.hbs +0 -35
- package/templates/new-frontend-plugin-module/portable-template.yaml +0 -5
- package/templates/new-frontend-plugin-module/src/index.ts.hbs +0 -1
- package/templates/new-frontend-plugin-module/src/module.tsx.hbs +0 -8
- package/templates/new-frontend-plugin-module/src/setupTests.ts +0 -1
- package/templates/node-library/.eslintrc.js.hbs +0 -1
- package/templates/node-library/README.md.hbs +0 -12
- package/templates/node-library/package.json.hbs +0 -29
- package/templates/node-library/portable-template.yaml +0 -3
- package/templates/node-library/src/index.ts.hbs +0 -1
- package/templates/node-library/src/setupTests.ts +0 -1
- package/templates/plugin-common-library/.eslintrc.js.hbs +0 -1
- package/templates/plugin-common-library/README.md.hbs +0 -5
- package/templates/plugin-common-library/package.json.hbs +0 -31
- package/templates/plugin-common-library/portable-template.yaml +0 -3
- package/templates/plugin-common-library/src/index.ts.hbs +0 -19
- package/templates/plugin-common-library/src/setupTests.ts +0 -1
- package/templates/plugin-node-library/.eslintrc.js.hbs +0 -1
- package/templates/plugin-node-library/README.md.hbs +0 -5
- package/templates/plugin-node-library/package.json.hbs +0 -30
- package/templates/plugin-node-library/portable-template.yaml +0 -3
- package/templates/plugin-node-library/src/index.ts.hbs +0 -18
- package/templates/plugin-node-library/src/setupTests.ts +0 -1
- package/templates/plugin-web-library/.eslintrc.js.hbs +0 -1
- package/templates/plugin-web-library/README.md.hbs +0 -5
- package/templates/plugin-web-library/package.json.hbs +0 -42
- package/templates/plugin-web-library/portable-template.yaml +0 -3
- package/templates/plugin-web-library/src/components/ExampleComponent/ExampleComponent.test.tsx +0 -17
- package/templates/plugin-web-library/src/components/ExampleComponent/ExampleComponent.tsx +0 -28
- package/templates/plugin-web-library/src/components/ExampleComponent/index.ts +0 -2
- package/templates/plugin-web-library/src/components/index.ts +0 -5
- package/templates/plugin-web-library/src/hooks/index.ts +0 -5
- package/templates/plugin-web-library/src/hooks/useExample/index.ts +0 -1
- package/templates/plugin-web-library/src/hooks/useExample/useExample.ts +0 -15
- package/templates/plugin-web-library/src/index.ts.hbs +0 -12
- package/templates/plugin-web-library/src/setupTests.ts +0 -1
- package/templates/scaffolder-backend-module/.eslintrc.js.hbs +0 -1
- package/templates/scaffolder-backend-module/README.md.hbs +0 -5
- package/templates/scaffolder-backend-module/package.json.hbs +0 -36
- package/templates/scaffolder-backend-module/portable-template.yaml +0 -6
- package/templates/scaffolder-backend-module/src/actions/example.test.ts +0 -24
- package/templates/scaffolder-backend-module/src/actions/example.ts +0 -39
- package/templates/scaffolder-backend-module/src/index.ts.hbs +0 -8
- package/templates/scaffolder-backend-module/src/module.ts +0 -21
- package/templates/web-library/.eslintrc.js.hbs +0 -1
- package/templates/web-library/README.md.hbs +0 -12
- package/templates/web-library/package.json.hbs +0 -30
- package/templates/web-library/portable-template.yaml +0 -3
- package/templates/web-library/src/index.ts.hbs +0 -1
- package/templates/web-library/src/setupTests.ts +0 -1
- /package/dist/{packages/opaque-internal → opaque-internal}/src/OpaqueType.cjs.js +0 -0
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var cleye = require('cleye');
|
|
6
|
-
var _package = require('../../../packages/cli/package.json.cjs.js');
|
|
7
|
-
var os = require('node:os');
|
|
8
|
-
var cliCommon = require('@backstage/cli-common');
|
|
9
|
-
var cliNode = require('@backstage/cli-node');
|
|
10
|
-
var minimatch = require('minimatch');
|
|
11
|
-
var fs = require('fs-extra');
|
|
12
|
-
|
|
13
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
14
|
-
|
|
15
|
-
var os__default = /*#__PURE__*/_interopDefaultCompat(os);
|
|
16
|
-
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
17
|
-
|
|
18
|
-
function tryReadPackageJson(packageName, targetPath) {
|
|
19
|
-
try {
|
|
20
|
-
return require(require.resolve(`${packageName}/package.json`, {
|
|
21
|
-
paths: [targetPath]
|
|
22
|
-
}));
|
|
23
|
-
} catch {
|
|
24
|
-
return void 0;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
function hasBackstageField(packageName, targetPath) {
|
|
28
|
-
const pkg = tryReadPackageJson(packageName, targetPath);
|
|
29
|
-
return pkg?.backstage !== void 0;
|
|
30
|
-
}
|
|
31
|
-
var info = async ({ args, info }) => {
|
|
32
|
-
const {
|
|
33
|
-
flags: { include, format }
|
|
34
|
-
} = cleye.cli(
|
|
35
|
-
{
|
|
36
|
-
help: info,
|
|
37
|
-
booleanFlagNegation: true,
|
|
38
|
-
flags: {
|
|
39
|
-
include: {
|
|
40
|
-
type: [String],
|
|
41
|
-
description: "Glob patterns for additional packages to include (e.g., @spotify/backstage*)"
|
|
42
|
-
},
|
|
43
|
-
format: {
|
|
44
|
-
type: String,
|
|
45
|
-
description: "Output format (text or json)",
|
|
46
|
-
default: "text"
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
void 0,
|
|
51
|
-
args
|
|
52
|
-
);
|
|
53
|
-
const options = { include, format };
|
|
54
|
-
await new Promise(async () => {
|
|
55
|
-
const yarnVersion = await cliCommon.runOutput(["yarn", "--version"]);
|
|
56
|
-
const isLocal = fs__default.default.existsSync(cliCommon.findOwnPaths(__dirname).resolve("./src"));
|
|
57
|
-
const backstageFile = cliCommon.targetPaths.resolveRoot("backstage.json");
|
|
58
|
-
let backstageVersion = "N/A";
|
|
59
|
-
if (fs__default.default.existsSync(backstageFile)) {
|
|
60
|
-
try {
|
|
61
|
-
const backstageJson = await fs__default.default.readJSON(backstageFile);
|
|
62
|
-
backstageVersion = backstageJson.version ?? "N/A";
|
|
63
|
-
} catch (error) {
|
|
64
|
-
if (options.format !== "json") {
|
|
65
|
-
console.warn(
|
|
66
|
-
'The "backstage.json" file is not in the expected format'
|
|
67
|
-
);
|
|
68
|
-
console.log();
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
const systemInfo = {
|
|
73
|
-
os: `${os__default.default.type} ${os__default.default.release} - ${os__default.default.platform}/${os__default.default.arch}`,
|
|
74
|
-
node: process.version,
|
|
75
|
-
yarn: yarnVersion,
|
|
76
|
-
cli: { version: _package.version, local: isLocal },
|
|
77
|
-
backstage: backstageVersion
|
|
78
|
-
};
|
|
79
|
-
const lockfilePath = cliCommon.targetPaths.resolveRoot("yarn.lock");
|
|
80
|
-
const lockfile = await cliNode.Lockfile.load(lockfilePath);
|
|
81
|
-
const targetPath = cliCommon.targetPaths.rootDir;
|
|
82
|
-
const workspacePackages = /* @__PURE__ */ new Map();
|
|
83
|
-
try {
|
|
84
|
-
const packages = await cliNode.PackageGraph.listTargetPackages();
|
|
85
|
-
for (const pkg of packages) {
|
|
86
|
-
workspacePackages.set(pkg.packageJson.name, pkg.packageJson.version);
|
|
87
|
-
}
|
|
88
|
-
} catch {
|
|
89
|
-
}
|
|
90
|
-
const allPackages = [...lockfile.keys()];
|
|
91
|
-
const includePatterns = options.include || [];
|
|
92
|
-
const installedDeps = /* @__PURE__ */ new Set();
|
|
93
|
-
const localDeps = /* @__PURE__ */ new Set();
|
|
94
|
-
for (const pkg of allPackages) {
|
|
95
|
-
if (pkg.startsWith("@backstage/")) {
|
|
96
|
-
if (workspacePackages.has(pkg)) {
|
|
97
|
-
localDeps.add(pkg);
|
|
98
|
-
} else {
|
|
99
|
-
installedDeps.add(pkg);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
for (const pattern of includePatterns) {
|
|
104
|
-
for (const pkg of allPackages) {
|
|
105
|
-
if (minimatch.minimatch(pkg, pattern)) {
|
|
106
|
-
if (workspacePackages.has(pkg)) {
|
|
107
|
-
localDeps.add(pkg);
|
|
108
|
-
} else {
|
|
109
|
-
installedDeps.add(pkg);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
for (const pkg of allPackages) {
|
|
115
|
-
if (pkg.startsWith("@backstage/")) {
|
|
116
|
-
continue;
|
|
117
|
-
}
|
|
118
|
-
if (workspacePackages.has(pkg)) {
|
|
119
|
-
if (hasBackstageField(pkg, targetPath)) {
|
|
120
|
-
localDeps.add(pkg);
|
|
121
|
-
}
|
|
122
|
-
} else if (hasBackstageField(pkg, targetPath)) {
|
|
123
|
-
installedDeps.add(pkg);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
const getVersions = (dep) => {
|
|
127
|
-
const entries = lockfile.get(dep);
|
|
128
|
-
if (!entries) {
|
|
129
|
-
return [{ version: "unknown" }];
|
|
130
|
-
}
|
|
131
|
-
const versions = [...new Set(entries.map((i) => i.version))];
|
|
132
|
-
return versions.map((v) => ({ version: v }));
|
|
133
|
-
};
|
|
134
|
-
const sortedInstalled = [...installedDeps].sort();
|
|
135
|
-
const sortedLocal = [...localDeps].sort();
|
|
136
|
-
if (options.format === "json") {
|
|
137
|
-
const output = {
|
|
138
|
-
system: systemInfo,
|
|
139
|
-
dependencies: Object.fromEntries(
|
|
140
|
-
sortedInstalled.map((dep) => [dep, getVersions(dep)])
|
|
141
|
-
),
|
|
142
|
-
local: Object.fromEntries(
|
|
143
|
-
sortedLocal.map((dep) => [
|
|
144
|
-
dep,
|
|
145
|
-
[{ version: workspacePackages.get(dep) ?? "unknown" }]
|
|
146
|
-
])
|
|
147
|
-
)
|
|
148
|
-
};
|
|
149
|
-
process.stdout.write(`${JSON.stringify(output, null, 2)}
|
|
150
|
-
`);
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
console.log(`OS: ${systemInfo.os}`);
|
|
154
|
-
console.log(`node: ${systemInfo.node}`);
|
|
155
|
-
console.log(`yarn: ${systemInfo.yarn}`);
|
|
156
|
-
console.log(`cli: ${_package.version} (${isLocal ? "local" : "installed"})`);
|
|
157
|
-
console.log(`backstage: ${backstageVersion}`);
|
|
158
|
-
console.log();
|
|
159
|
-
console.log("Dependencies:");
|
|
160
|
-
if (sortedInstalled.length > 0) {
|
|
161
|
-
const maxLength = Math.max(...sortedInstalled.map((d) => d.length));
|
|
162
|
-
for (const dep of sortedInstalled) {
|
|
163
|
-
const versions = getVersions(dep).map((v) => v.version).join(", ");
|
|
164
|
-
console.log(` ${dep.padEnd(maxLength)} ${versions}`);
|
|
165
|
-
}
|
|
166
|
-
} else {
|
|
167
|
-
console.log(" (no installed Backstage packages found)");
|
|
168
|
-
}
|
|
169
|
-
if (localDeps.size > 0) {
|
|
170
|
-
console.log();
|
|
171
|
-
console.log("Local:");
|
|
172
|
-
const maxLength = Math.max(...sortedLocal.map((d) => d.length));
|
|
173
|
-
for (const dep of sortedLocal) {
|
|
174
|
-
const version = workspacePackages.get(dep) ?? "unknown";
|
|
175
|
-
console.log(` ${dep.padEnd(maxLength)} ${version}`);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
exports.default = info;
|
|
182
|
-
//# sourceMappingURL=info.cjs.js.map
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var factory = require('../../wiring/factory.cjs.js');
|
|
6
|
-
|
|
7
|
-
var index = factory.createCliPlugin({
|
|
8
|
-
pluginId: "info",
|
|
9
|
-
init: async (reg) => {
|
|
10
|
-
reg.addCommand({
|
|
11
|
-
path: ["info"],
|
|
12
|
-
description: "Show helpful information for debugging and reporting bugs",
|
|
13
|
-
execute: { loader: () => import('./commands/info.cjs.js') }
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
exports.default = index;
|
|
19
|
-
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var fs = require('fs-extra');
|
|
6
|
-
var cleye = require('cleye');
|
|
7
|
-
var cliCommon = require('@backstage/cli-common');
|
|
8
|
-
var eslint = require('eslint');
|
|
9
|
-
|
|
10
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
11
|
-
|
|
12
|
-
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
13
|
-
|
|
14
|
-
var lint = async ({ args, info }) => {
|
|
15
|
-
const {
|
|
16
|
-
flags: { fix, format, outputFile, maxWarnings },
|
|
17
|
-
_: directories
|
|
18
|
-
} = cleye.cli(
|
|
19
|
-
{
|
|
20
|
-
help: { ...info, usage: `${info.usage} [directories...]` },
|
|
21
|
-
booleanFlagNegation: true,
|
|
22
|
-
parameters: ["[directories...]"],
|
|
23
|
-
flags: {
|
|
24
|
-
fix: {
|
|
25
|
-
type: Boolean,
|
|
26
|
-
description: "Attempt to automatically fix violations"
|
|
27
|
-
},
|
|
28
|
-
format: {
|
|
29
|
-
type: String,
|
|
30
|
-
description: "Lint report output format",
|
|
31
|
-
default: "eslint-formatter-friendly"
|
|
32
|
-
},
|
|
33
|
-
outputFile: {
|
|
34
|
-
type: String,
|
|
35
|
-
description: "Write the lint report to a file instead of stdout"
|
|
36
|
-
},
|
|
37
|
-
maxWarnings: {
|
|
38
|
-
type: String,
|
|
39
|
-
description: "Fail if more than this number of warnings. -1 allows warnings. (default: -1)"
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
void 0,
|
|
44
|
-
args
|
|
45
|
-
);
|
|
46
|
-
const eslint$1 = new eslint.ESLint({
|
|
47
|
-
cwd: cliCommon.targetPaths.dir,
|
|
48
|
-
fix,
|
|
49
|
-
extensions: ["js", "jsx", "ts", "tsx", "mjs", "cjs"]
|
|
50
|
-
});
|
|
51
|
-
const results = await eslint$1.lintFiles(
|
|
52
|
-
directories.length ? directories : ["."]
|
|
53
|
-
);
|
|
54
|
-
const maxWarningsNum = maxWarnings ? +maxWarnings : -1;
|
|
55
|
-
const ignoreWarnings = maxWarningsNum === -1;
|
|
56
|
-
const failed = results.some((r) => r.errorCount > 0) || !ignoreWarnings && results.reduce((current, next) => current + next.warningCount, 0) > maxWarningsNum;
|
|
57
|
-
if (fix) {
|
|
58
|
-
await eslint.ESLint.outputFixes(results);
|
|
59
|
-
}
|
|
60
|
-
const formatter = await eslint$1.loadFormatter(format);
|
|
61
|
-
if (format === "eslint-formatter-friendly") {
|
|
62
|
-
process.chdir(cliCommon.targetPaths.rootDir);
|
|
63
|
-
}
|
|
64
|
-
const resultText = await formatter.format(results);
|
|
65
|
-
if (resultText) {
|
|
66
|
-
if (outputFile) {
|
|
67
|
-
await fs__default.default.writeFile(cliCommon.targetPaths.resolve(outputFile), resultText);
|
|
68
|
-
} else {
|
|
69
|
-
console.log(resultText);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
if (failed) {
|
|
73
|
-
process.exit(1);
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
exports.default = lint;
|
|
78
|
-
//# sourceMappingURL=lint.cjs.js.map
|
|
@@ -1,282 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var chalk = require('chalk');
|
|
6
|
-
var fs = require('fs-extra');
|
|
7
|
-
var cleye = require('cleye');
|
|
8
|
-
var crypto = require('node:crypto');
|
|
9
|
-
var path = require('node:path');
|
|
10
|
-
var cliNode = require('@backstage/cli-node');
|
|
11
|
-
var cliCommon = require('@backstage/cli-common');
|
|
12
|
-
var optionsParser = require('../../lib/optionsParser.cjs.js');
|
|
13
|
-
|
|
14
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
15
|
-
|
|
16
|
-
var chalk__default = /*#__PURE__*/_interopDefaultCompat(chalk);
|
|
17
|
-
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
18
|
-
|
|
19
|
-
function depCount(pkg) {
|
|
20
|
-
const deps = pkg.dependencies ? Object.keys(pkg.dependencies).length : 0;
|
|
21
|
-
const devDeps = pkg.devDependencies ? Object.keys(pkg.devDependencies).length : 0;
|
|
22
|
-
return deps + devDeps;
|
|
23
|
-
}
|
|
24
|
-
var lint = async ({ args, info }) => {
|
|
25
|
-
for (const flag of [
|
|
26
|
-
"outputFile",
|
|
27
|
-
"successCache",
|
|
28
|
-
"successCacheDir",
|
|
29
|
-
"maxWarnings"
|
|
30
|
-
]) {
|
|
31
|
-
if (args.some((a) => a === `--${flag}` || a.startsWith(`--${flag}=`))) {
|
|
32
|
-
process.stderr.write(
|
|
33
|
-
`DEPRECATION WARNING: --${flag} is deprecated, use the kebab-case form instead
|
|
34
|
-
`
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
const {
|
|
39
|
-
flags: {
|
|
40
|
-
fix,
|
|
41
|
-
format,
|
|
42
|
-
outputFile,
|
|
43
|
-
successCache: useSuccessCache,
|
|
44
|
-
successCacheDir,
|
|
45
|
-
since,
|
|
46
|
-
maxWarnings
|
|
47
|
-
}
|
|
48
|
-
} = cleye.cli(
|
|
49
|
-
{
|
|
50
|
-
help: info,
|
|
51
|
-
booleanFlagNegation: true,
|
|
52
|
-
flags: {
|
|
53
|
-
fix: {
|
|
54
|
-
type: Boolean,
|
|
55
|
-
description: "Attempt to automatically fix violations"
|
|
56
|
-
},
|
|
57
|
-
format: {
|
|
58
|
-
type: String,
|
|
59
|
-
description: "Lint report output format",
|
|
60
|
-
default: "eslint-formatter-friendly"
|
|
61
|
-
},
|
|
62
|
-
outputFile: {
|
|
63
|
-
type: String,
|
|
64
|
-
description: "Write the lint report to a file instead of stdout"
|
|
65
|
-
},
|
|
66
|
-
successCache: {
|
|
67
|
-
type: Boolean,
|
|
68
|
-
description: "Enable success caching, which skips running tests for unchanged packages that were successful in the previous run"
|
|
69
|
-
},
|
|
70
|
-
successCacheDir: {
|
|
71
|
-
type: String,
|
|
72
|
-
description: "Set the success cache location, (default: node_modules/.cache/backstage-cli)"
|
|
73
|
-
},
|
|
74
|
-
since: {
|
|
75
|
-
type: String,
|
|
76
|
-
description: "Only lint packages that changed since the specified ref"
|
|
77
|
-
},
|
|
78
|
-
maxWarnings: {
|
|
79
|
-
type: String,
|
|
80
|
-
description: "Fail if more than this number of warnings. -1 allows warnings. (default: -1)"
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
void 0,
|
|
85
|
-
args
|
|
86
|
-
);
|
|
87
|
-
let packages = await cliNode.PackageGraph.listTargetPackages();
|
|
88
|
-
const cache = cliNode.SuccessCache.create({
|
|
89
|
-
name: "lint",
|
|
90
|
-
basePath: successCacheDir
|
|
91
|
-
});
|
|
92
|
-
const cacheContext = useSuccessCache ? {
|
|
93
|
-
entries: await cache.read(),
|
|
94
|
-
lockfile: await cliNode.Lockfile.load(cliCommon.targetPaths.resolveRoot("yarn.lock"))
|
|
95
|
-
} : void 0;
|
|
96
|
-
if (since) {
|
|
97
|
-
const graph = cliNode.PackageGraph.fromPackages(packages);
|
|
98
|
-
packages = await graph.listChangedPackages({
|
|
99
|
-
ref: since,
|
|
100
|
-
analyzeLockfile: true
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
packages.sort((a, b) => depCount(b.packageJson) - depCount(a.packageJson));
|
|
104
|
-
if (format === "eslint-formatter-friendly") {
|
|
105
|
-
process.chdir(cliCommon.targetPaths.rootDir);
|
|
106
|
-
}
|
|
107
|
-
if (!process.env.FORCE_COLOR) {
|
|
108
|
-
process.env.FORCE_COLOR = "1";
|
|
109
|
-
}
|
|
110
|
-
const parseLintScript = optionsParser.createScriptOptionsParser(["package", "lint"], {
|
|
111
|
-
fix: { type: "boolean" },
|
|
112
|
-
format: { type: "string" },
|
|
113
|
-
"output-file": { type: "string" },
|
|
114
|
-
"max-warnings": { type: "string" }
|
|
115
|
-
});
|
|
116
|
-
const items = await Promise.all(
|
|
117
|
-
packages.map(async (pkg) => {
|
|
118
|
-
const lintOptions = parseLintScript(pkg.packageJson.scripts?.lint);
|
|
119
|
-
const base = {
|
|
120
|
-
fullDir: pkg.dir,
|
|
121
|
-
relativeDir: path.relative(cliCommon.targetPaths.rootDir, pkg.dir),
|
|
122
|
-
lintOptions,
|
|
123
|
-
parentHash: void 0
|
|
124
|
-
};
|
|
125
|
-
if (!cacheContext) {
|
|
126
|
-
return base;
|
|
127
|
-
}
|
|
128
|
-
const hash = crypto.createHash("sha1");
|
|
129
|
-
hash.update(
|
|
130
|
-
cacheContext.lockfile.getDependencyTreeHash(pkg.packageJson.name)
|
|
131
|
-
);
|
|
132
|
-
hash.update("\0");
|
|
133
|
-
hash.update(JSON.stringify(lintOptions ?? {}));
|
|
134
|
-
hash.update("\0");
|
|
135
|
-
hash.update(process.version);
|
|
136
|
-
hash.update("\0");
|
|
137
|
-
hash.update("v1");
|
|
138
|
-
return {
|
|
139
|
-
...base,
|
|
140
|
-
parentHash: hash.digest("hex")
|
|
141
|
-
};
|
|
142
|
-
})
|
|
143
|
-
);
|
|
144
|
-
const { results: resultsList } = await cliNode.runWorkerQueueThreads({
|
|
145
|
-
items: items.filter((item) => item.lintOptions),
|
|
146
|
-
// Filter out packages without lint script
|
|
147
|
-
context: {
|
|
148
|
-
fix: Boolean(fix),
|
|
149
|
-
format,
|
|
150
|
-
shouldCache: Boolean(cacheContext),
|
|
151
|
-
maxWarnings: maxWarnings ?? "-1",
|
|
152
|
-
successCache: cacheContext?.entries,
|
|
153
|
-
rootDir: cliCommon.targetPaths.rootDir
|
|
154
|
-
},
|
|
155
|
-
workerFactory: async ({
|
|
156
|
-
fix: workerFix,
|
|
157
|
-
format: workerFormat,
|
|
158
|
-
shouldCache,
|
|
159
|
-
successCache,
|
|
160
|
-
rootDir,
|
|
161
|
-
maxWarnings: workerMaxWarnings
|
|
162
|
-
}) => {
|
|
163
|
-
const { ESLint } = require("eslint");
|
|
164
|
-
const crypto = require("node:crypto");
|
|
165
|
-
const globby = require("globby");
|
|
166
|
-
const { readFile } = require("node:fs/promises");
|
|
167
|
-
const workerPath = require("node:path");
|
|
168
|
-
return async ({
|
|
169
|
-
fullDir,
|
|
170
|
-
relativeDir,
|
|
171
|
-
parentHash
|
|
172
|
-
}) => {
|
|
173
|
-
process.cwd = () => fullDir;
|
|
174
|
-
const start = Date.now();
|
|
175
|
-
const eslint = new ESLint({
|
|
176
|
-
cwd: fullDir,
|
|
177
|
-
fix: workerFix,
|
|
178
|
-
extensions: ["js", "jsx", "ts", "tsx", "mjs", "cjs"]
|
|
179
|
-
});
|
|
180
|
-
let sha = void 0;
|
|
181
|
-
if (shouldCache) {
|
|
182
|
-
const result = await globby(relativeDir, {
|
|
183
|
-
gitignore: true,
|
|
184
|
-
onlyFiles: true,
|
|
185
|
-
cwd: rootDir
|
|
186
|
-
});
|
|
187
|
-
const hash = crypto.createHash("sha1");
|
|
188
|
-
hash.update(parentHash);
|
|
189
|
-
hash.update("\0");
|
|
190
|
-
for (const path of result.sort()) {
|
|
191
|
-
const absPath = workerPath.resolve(rootDir, path);
|
|
192
|
-
const pathInPackage = workerPath.relative(fullDir, absPath);
|
|
193
|
-
if (await eslint.isPathIgnored(pathInPackage)) {
|
|
194
|
-
continue;
|
|
195
|
-
}
|
|
196
|
-
hash.update(pathInPackage);
|
|
197
|
-
hash.update("\0");
|
|
198
|
-
hash.update(await readFile(absPath));
|
|
199
|
-
hash.update("\0");
|
|
200
|
-
hash.update(
|
|
201
|
-
JSON.stringify(
|
|
202
|
-
await eslint.calculateConfigForFile(pathInPackage)
|
|
203
|
-
).replaceAll(rootDir, "")
|
|
204
|
-
);
|
|
205
|
-
hash.update("\0");
|
|
206
|
-
}
|
|
207
|
-
sha = await hash.digest("hex");
|
|
208
|
-
if (successCache?.has(sha)) {
|
|
209
|
-
console.log(`Skipped ${relativeDir} due to cache hit`);
|
|
210
|
-
return { relativeDir, sha, failed: false };
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
const formatter = await eslint.loadFormatter(workerFormat);
|
|
214
|
-
const results = await eslint.lintFiles(["."]);
|
|
215
|
-
const count = String(results.length).padStart(3);
|
|
216
|
-
const time = ((Date.now() - start) / 1e3).toFixed(2);
|
|
217
|
-
console.log(`Checked ${count} files in ${relativeDir} ${time}s`);
|
|
218
|
-
if (workerFix) {
|
|
219
|
-
await ESLint.outputFixes(results);
|
|
220
|
-
}
|
|
221
|
-
const ignoreWarnings = +workerMaxWarnings === -1;
|
|
222
|
-
const resultText = formatter.format(results);
|
|
223
|
-
const failed2 = results.some((r) => r.errorCount > 0) || !ignoreWarnings && results.reduce((current, next) => current + next.warningCount, 0) > +workerMaxWarnings;
|
|
224
|
-
return {
|
|
225
|
-
relativeDir,
|
|
226
|
-
resultText,
|
|
227
|
-
failed: failed2,
|
|
228
|
-
sha
|
|
229
|
-
};
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
});
|
|
233
|
-
const outputSuccessCache = [];
|
|
234
|
-
const jsonResults = [];
|
|
235
|
-
let errorOutput = "";
|
|
236
|
-
let failed = false;
|
|
237
|
-
for (const {
|
|
238
|
-
relativeDir,
|
|
239
|
-
resultText,
|
|
240
|
-
failed: runFailed,
|
|
241
|
-
sha
|
|
242
|
-
} of resultsList) {
|
|
243
|
-
if (runFailed) {
|
|
244
|
-
console.log(chalk__default.default.red(`Lint failed in ${relativeDir}`));
|
|
245
|
-
failed = true;
|
|
246
|
-
if (resultText) {
|
|
247
|
-
if (outputFile) {
|
|
248
|
-
if (format === "json") {
|
|
249
|
-
jsonResults.push(resultText);
|
|
250
|
-
} else {
|
|
251
|
-
errorOutput += `${resultText}
|
|
252
|
-
`;
|
|
253
|
-
}
|
|
254
|
-
} else {
|
|
255
|
-
console.log();
|
|
256
|
-
console.log(resultText.trimStart());
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
} else if (sha) {
|
|
260
|
-
outputSuccessCache.push(sha);
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
if (format === "json") {
|
|
264
|
-
let mergedJsonResults = [];
|
|
265
|
-
for (const jsonResult of jsonResults) {
|
|
266
|
-
mergedJsonResults = mergedJsonResults.concat(JSON.parse(jsonResult));
|
|
267
|
-
}
|
|
268
|
-
errorOutput = JSON.stringify(mergedJsonResults, null, 2);
|
|
269
|
-
}
|
|
270
|
-
if (outputFile && errorOutput) {
|
|
271
|
-
await fs__default.default.writeFile(cliCommon.targetPaths.resolveRoot(outputFile), errorOutput);
|
|
272
|
-
}
|
|
273
|
-
if (cacheContext) {
|
|
274
|
-
await cache.write(outputSuccessCache);
|
|
275
|
-
}
|
|
276
|
-
if (failed) {
|
|
277
|
-
process.exit(1);
|
|
278
|
-
}
|
|
279
|
-
};
|
|
280
|
-
|
|
281
|
-
exports.default = lint;
|
|
282
|
-
//# sourceMappingURL=lint.cjs.js.map
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var factory = require('../../wiring/factory.cjs.js');
|
|
6
|
-
|
|
7
|
-
var index = factory.createCliPlugin({
|
|
8
|
-
pluginId: "lint",
|
|
9
|
-
init: async (reg) => {
|
|
10
|
-
reg.addCommand({
|
|
11
|
-
path: ["package", "lint"],
|
|
12
|
-
description: "Lint a package",
|
|
13
|
-
execute: { loader: () => import('./commands/package/lint.cjs.js') }
|
|
14
|
-
});
|
|
15
|
-
reg.addCommand({
|
|
16
|
-
path: ["repo", "lint"],
|
|
17
|
-
description: "Lint a repository",
|
|
18
|
-
execute: { loader: () => import('./commands/repo/lint.cjs.js') }
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
exports.default = index;
|
|
24
|
-
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var node_util = require('node:util');
|
|
4
|
-
var shellQuote = require('shell-quote');
|
|
5
|
-
|
|
6
|
-
function createScriptOptionsParser(commandPath, options) {
|
|
7
|
-
const expectedScript = `backstage-cli ${commandPath.join(" ")}`;
|
|
8
|
-
return (scriptStr) => {
|
|
9
|
-
if (!scriptStr || !scriptStr.startsWith(expectedScript)) {
|
|
10
|
-
return void 0;
|
|
11
|
-
}
|
|
12
|
-
const argsStr = scriptStr.slice(expectedScript.length).trim();
|
|
13
|
-
const args = argsStr ? shellQuote.parse(argsStr).filter(
|
|
14
|
-
(e) => typeof e === "string"
|
|
15
|
-
) : [];
|
|
16
|
-
const { values } = node_util.parseArgs({ args, strict: false, options });
|
|
17
|
-
return values;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
exports.createScriptOptionsParser = createScriptOptionsParser;
|
|
22
|
-
//# sourceMappingURL=optionsParser.cjs.js.map
|