@backstage/cli 0.36.0-next.1 → 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 +110 -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 -10
- package/dist/wiring/CliInitializer.cjs.js +61 -20
- package/dist/wiring/CommandGraph.cjs.js +81 -23
- package/dist/wiring/discoverCliModules.cjs.js +44 -0
- package/package.json +27 -154
- package/dist/modules/build/commands/buildWorkspace.cjs.js +0 -24
- package/dist/modules/build/commands/package/build/command.cjs.js +0 -89
- package/dist/modules/build/commands/package/build/index.cjs.js +0 -8
- 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 -23
- package/dist/modules/build/commands/package/start/index.cjs.js +0 -8
- 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 -114
- package/dist/modules/build/commands/repo/clean.cjs.js +0 -41
- package/dist/modules/build/commands/repo/start.cjs.js +0 -150
- package/dist/modules/build/index.cjs.js +0 -192
- 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 -37
- 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 -62
- package/dist/modules/config/commands/print.cjs.js +0 -80
- package/dist/modules/config/commands/schema.cjs.js +0 -55
- package/dist/modules/config/commands/validate.cjs.js +0 -49
- 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 -115
- package/dist/modules/create-github-app/index.cjs.js +0 -27
- package/dist/modules/info/commands/info.cjs.js +0 -181
- package/dist/modules/info/index.cjs.js +0 -19
- package/dist/modules/lint/commands/package/lint.cjs.js +0 -46
- package/dist/modules/lint/commands/repo/lint.cjs.js +0 -212
- package/dist/modules/lint/index.cjs.js +0 -82
- package/dist/modules/lint/lib/optionsParser.cjs.js +0 -37
- package/dist/modules/maintenance/commands/repo/fix.cjs.js +0 -400
- package/dist/modules/maintenance/commands/repo/list-deprecations.cjs.js +0 -74
- package/dist/modules/maintenance/index.cjs.js +0 -42
- 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 -373
- package/dist/modules/migrate/commands/versions/migrate.cjs.js +0 -112
- package/dist/modules/migrate/index.cjs.js +0 -82
- 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 -60
- package/dist/modules/new/index.cjs.js +0 -68
- 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 -65
- package/dist/modules/test/commands/repo/test.cjs.js +0 -288
- package/dist/modules/test/index.cjs.js +0 -54
- package/dist/modules/translations/commands/export.cjs.js +0 -127
- package/dist/modules/translations/commands/import.cjs.js +0 -164
- 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 -156
- 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/lazy.cjs.js +0 -22
- 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,94 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var configLoader = require('@backstage/config-loader');
|
|
4
|
-
var config = require('@backstage/config');
|
|
5
|
-
var cliCommon = require('@backstage/cli-common');
|
|
6
|
-
var getPackages = require('@manypkg/get-packages');
|
|
7
|
-
var cliNode = require('@backstage/cli-node');
|
|
8
|
-
var path = require('node:path');
|
|
9
|
-
|
|
10
|
-
async function loadCliConfig(options) {
|
|
11
|
-
const targetDir = options.targetDir ?? cliCommon.targetPaths.dir;
|
|
12
|
-
const { packages } = await getPackages.getPackages(targetDir);
|
|
13
|
-
let localPackageNames;
|
|
14
|
-
if (options.fromPackage) {
|
|
15
|
-
if (packages.length) {
|
|
16
|
-
const graph = cliNode.PackageGraph.fromPackages(packages);
|
|
17
|
-
localPackageNames = Array.from(
|
|
18
|
-
graph.collectPackageNames([options.fromPackage], (node) => {
|
|
19
|
-
if (node.name === "@backstage/cli") {
|
|
20
|
-
return void 0;
|
|
21
|
-
}
|
|
22
|
-
return node.localDependencies.keys();
|
|
23
|
-
})
|
|
24
|
-
);
|
|
25
|
-
} else {
|
|
26
|
-
localPackageNames = [options.fromPackage];
|
|
27
|
-
}
|
|
28
|
-
} else {
|
|
29
|
-
localPackageNames = packages.map((p) => p.packageJson.name);
|
|
30
|
-
}
|
|
31
|
-
const schema = await configLoader.loadConfigSchema({
|
|
32
|
-
dependencies: localPackageNames,
|
|
33
|
-
// Include the package.json in the project root if it exists
|
|
34
|
-
packagePaths: [cliCommon.targetPaths.resolveRoot("package.json")],
|
|
35
|
-
noUndeclaredProperties: options.strict
|
|
36
|
-
});
|
|
37
|
-
const source = configLoader.ConfigSources.default({
|
|
38
|
-
allowMissingDefaultConfig: true,
|
|
39
|
-
substitutionFunc: options.mockEnv ? async (name) => process.env[name] || "x" : void 0,
|
|
40
|
-
rootDir: cliCommon.targetPaths.rootDir,
|
|
41
|
-
argv: options.args.flatMap((t) => ["--config", path.resolve(targetDir, t)])
|
|
42
|
-
});
|
|
43
|
-
const appConfigs = await new Promise((resolve, reject) => {
|
|
44
|
-
async function readConfig() {
|
|
45
|
-
let loaded = false;
|
|
46
|
-
try {
|
|
47
|
-
const abortController = new AbortController();
|
|
48
|
-
for await (const { configs } of source.readConfigData({
|
|
49
|
-
signal: abortController.signal
|
|
50
|
-
})) {
|
|
51
|
-
resolve(configs);
|
|
52
|
-
loaded = true;
|
|
53
|
-
abortController.abort();
|
|
54
|
-
}
|
|
55
|
-
} catch (error) {
|
|
56
|
-
if (!loaded) {
|
|
57
|
-
reject(error);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
readConfig();
|
|
62
|
-
});
|
|
63
|
-
const configurationLoadedMessage = appConfigs.length ? `Loaded config from ${appConfigs.map((c) => c.context).join(", ")}` : `No configuration files found, running without config`;
|
|
64
|
-
process.stderr.write(`${configurationLoadedMessage}
|
|
65
|
-
`);
|
|
66
|
-
try {
|
|
67
|
-
const frontendAppConfigs = schema.process(appConfigs, {
|
|
68
|
-
visibility: options.fullVisibility ? ["frontend", "backend", "secret"] : ["frontend"],
|
|
69
|
-
withDeprecatedKeys: options.withDeprecatedKeys,
|
|
70
|
-
ignoreSchemaErrors: !options.strict
|
|
71
|
-
});
|
|
72
|
-
const frontendConfig = config.ConfigReader.fromConfigs(frontendAppConfigs);
|
|
73
|
-
const fullConfig = config.ConfigReader.fromConfigs(appConfigs);
|
|
74
|
-
return {
|
|
75
|
-
schema,
|
|
76
|
-
appConfigs,
|
|
77
|
-
frontendConfig,
|
|
78
|
-
frontendAppConfigs,
|
|
79
|
-
fullConfig
|
|
80
|
-
};
|
|
81
|
-
} catch (error) {
|
|
82
|
-
const maybeSchemaError = error;
|
|
83
|
-
if (maybeSchemaError.messages) {
|
|
84
|
-
const messages = maybeSchemaError.messages.join("\n ");
|
|
85
|
-
throw new Error(`Configuration does not match schema
|
|
86
|
-
|
|
87
|
-
${messages}`);
|
|
88
|
-
}
|
|
89
|
-
throw error;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
exports.loadCliConfig = loadCliConfig;
|
|
94
|
-
//# sourceMappingURL=config.cjs.js.map
|
package/dist/modules/create-github-app/commands/create-github-app/GithubCreateAppServer.cjs.js
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var crypto = require('node:crypto');
|
|
4
|
-
var openBrowser = require('react-dev-utils/openBrowser');
|
|
5
|
-
var request = require('@octokit/request');
|
|
6
|
-
var express = require('express');
|
|
7
|
-
|
|
8
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
9
|
-
|
|
10
|
-
var crypto__default = /*#__PURE__*/_interopDefaultCompat(crypto);
|
|
11
|
-
var openBrowser__default = /*#__PURE__*/_interopDefaultCompat(openBrowser);
|
|
12
|
-
var express__default = /*#__PURE__*/_interopDefaultCompat(express);
|
|
13
|
-
|
|
14
|
-
const FORM_PAGE = `
|
|
15
|
-
<html>
|
|
16
|
-
<body>
|
|
17
|
-
<form id="form" action="ACTION_URL" method="post">
|
|
18
|
-
<input type="hidden" name="manifest" value="MANIFEST_JSON">
|
|
19
|
-
<input type="submit" value="Continue">
|
|
20
|
-
</form>
|
|
21
|
-
<script>
|
|
22
|
-
document.getElementById("form").submit()
|
|
23
|
-
<\/script>
|
|
24
|
-
</body>
|
|
25
|
-
</html>
|
|
26
|
-
`;
|
|
27
|
-
class GithubCreateAppServer {
|
|
28
|
-
baseUrl;
|
|
29
|
-
webhookUrl;
|
|
30
|
-
static async run(options) {
|
|
31
|
-
const encodedOrg = encodeURIComponent(options.org);
|
|
32
|
-
const actionUrl = `https://github.com/organizations/${encodedOrg}/settings/apps/new`;
|
|
33
|
-
const server = new GithubCreateAppServer(actionUrl, options.permissions);
|
|
34
|
-
return server.start();
|
|
35
|
-
}
|
|
36
|
-
actionUrl;
|
|
37
|
-
permissions;
|
|
38
|
-
constructor(actionUrl, permissions) {
|
|
39
|
-
this.actionUrl = actionUrl;
|
|
40
|
-
this.permissions = permissions;
|
|
41
|
-
const webhookId = crypto__default.default.randomBytes(15).toString("base64").replace(/[\+\/]/g, "");
|
|
42
|
-
this.webhookUrl = `https://smee.io/${webhookId}`;
|
|
43
|
-
}
|
|
44
|
-
async start() {
|
|
45
|
-
const app = express__default.default();
|
|
46
|
-
app.get("/", this.formHandler);
|
|
47
|
-
const callPromise = new Promise((resolve, reject) => {
|
|
48
|
-
app.get("/callback", (req, res) => {
|
|
49
|
-
request.request(
|
|
50
|
-
`POST /app-manifests/${encodeURIComponent(
|
|
51
|
-
req.query.code
|
|
52
|
-
)}/conversions`
|
|
53
|
-
).then(({ data }) => {
|
|
54
|
-
resolve({
|
|
55
|
-
name: data.name,
|
|
56
|
-
slug: data.slug,
|
|
57
|
-
appId: data.id,
|
|
58
|
-
webhookUrl: this.webhookUrl,
|
|
59
|
-
clientId: data.client_id,
|
|
60
|
-
clientSecret: data.client_secret,
|
|
61
|
-
webhookSecret: data.webhook_secret,
|
|
62
|
-
privateKey: data.pem
|
|
63
|
-
});
|
|
64
|
-
res.redirect(302, `${data.html_url}/installations/new`);
|
|
65
|
-
}, reject);
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
this.baseUrl = await this.listen(app);
|
|
69
|
-
openBrowser__default.default(this.baseUrl);
|
|
70
|
-
return callPromise;
|
|
71
|
-
}
|
|
72
|
-
formHandler = (_req, res) => {
|
|
73
|
-
const baseUrl = this.baseUrl;
|
|
74
|
-
if (!baseUrl) {
|
|
75
|
-
throw new Error("baseUrl is not set");
|
|
76
|
-
}
|
|
77
|
-
const manifest = {
|
|
78
|
-
default_events: ["create", "delete", "push", "repository"],
|
|
79
|
-
default_permissions: {
|
|
80
|
-
metadata: "read",
|
|
81
|
-
...this.permissions.includes("members") && {
|
|
82
|
-
members: "read"
|
|
83
|
-
},
|
|
84
|
-
...this.permissions.includes("read") && {
|
|
85
|
-
contents: "read",
|
|
86
|
-
checks: "read"
|
|
87
|
-
},
|
|
88
|
-
...this.permissions.includes("write") && {
|
|
89
|
-
contents: "write",
|
|
90
|
-
checks: "read",
|
|
91
|
-
actions: "write"
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
name: "Backstage-<changeme>",
|
|
95
|
-
url: "https://backstage.io",
|
|
96
|
-
description: "GitHub App for Backstage",
|
|
97
|
-
public: false,
|
|
98
|
-
redirect_url: `${baseUrl}/callback`,
|
|
99
|
-
hook_attributes: {
|
|
100
|
-
url: this.webhookUrl,
|
|
101
|
-
active: false
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
const manifestJson = JSON.stringify(manifest).replace(/\"/g, """);
|
|
105
|
-
let body = FORM_PAGE;
|
|
106
|
-
body = body.replace("MANIFEST_JSON", manifestJson);
|
|
107
|
-
body = body.replace("ACTION_URL", this.actionUrl);
|
|
108
|
-
res.setHeader("content-type", "text/html");
|
|
109
|
-
res.send(body);
|
|
110
|
-
};
|
|
111
|
-
async listen(app) {
|
|
112
|
-
return new Promise((resolve, reject) => {
|
|
113
|
-
const listener = app.listen(0, () => {
|
|
114
|
-
const info = listener.address();
|
|
115
|
-
if (typeof info !== "object" || info === null) {
|
|
116
|
-
reject(new Error(`Unexpected listener info '${info}'`));
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
const { port } = info;
|
|
120
|
-
resolve(`http://localhost:${port}`);
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
exports.GithubCreateAppServer = GithubCreateAppServer;
|
|
127
|
-
//# sourceMappingURL=GithubCreateAppServer.cjs.js.map
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var fs = require('fs-extra');
|
|
6
|
-
var chalk = require('chalk');
|
|
7
|
-
var yaml = require('yaml');
|
|
8
|
-
var inquirer = require('inquirer');
|
|
9
|
-
var cliCommon = require('@backstage/cli-common');
|
|
10
|
-
var GithubCreateAppServer = require('./GithubCreateAppServer.cjs.js');
|
|
11
|
-
var openBrowser = require('react-dev-utils/openBrowser');
|
|
12
|
-
|
|
13
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
14
|
-
|
|
15
|
-
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
16
|
-
var chalk__default = /*#__PURE__*/_interopDefaultCompat(chalk);
|
|
17
|
-
var inquirer__default = /*#__PURE__*/_interopDefaultCompat(inquirer);
|
|
18
|
-
var openBrowser__default = /*#__PURE__*/_interopDefaultCompat(openBrowser);
|
|
19
|
-
|
|
20
|
-
var index = async (org) => {
|
|
21
|
-
const answers = await inquirer__default.default.prompt({
|
|
22
|
-
name: "appType",
|
|
23
|
-
type: "checkbox",
|
|
24
|
-
message: "Select permissions [required] (these can be changed later but then require approvals in all installations)",
|
|
25
|
-
choices: [
|
|
26
|
-
{
|
|
27
|
-
name: "Read access to content (required by Software Catalog to ingest data from repositories)",
|
|
28
|
-
value: "read",
|
|
29
|
-
checked: true
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
name: "Read access to members (required by Software Catalog to ingest GitHub teams)",
|
|
33
|
-
value: "members",
|
|
34
|
-
checked: true
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
name: "Read and Write to content and actions (required by Software Templates to create new repositories)",
|
|
38
|
-
value: "write"
|
|
39
|
-
}
|
|
40
|
-
]
|
|
41
|
-
});
|
|
42
|
-
if (answers.appType.length === 0) {
|
|
43
|
-
console.log(chalk__default.default.red("You must select at least one permission"));
|
|
44
|
-
process.exit(1);
|
|
45
|
-
}
|
|
46
|
-
await verifyGithubOrg(org);
|
|
47
|
-
const { slug, name, ...config } = await GithubCreateAppServer.GithubCreateAppServer.run({
|
|
48
|
-
org,
|
|
49
|
-
permissions: answers.appType
|
|
50
|
-
});
|
|
51
|
-
const fileName = `github-app-${slug}-credentials.yaml`;
|
|
52
|
-
const content = `# Name: ${name}
|
|
53
|
-
${yaml.stringify(config)}`;
|
|
54
|
-
await fs__default.default.writeFile(cliCommon.targetPaths.resolveRoot(fileName), content);
|
|
55
|
-
console.log(`GitHub App configuration written to ${chalk__default.default.cyan(fileName)}`);
|
|
56
|
-
console.log(
|
|
57
|
-
chalk__default.default.yellow(
|
|
58
|
-
"This file contains sensitive credentials, it should not be committed to version control and handled with care!"
|
|
59
|
-
)
|
|
60
|
-
);
|
|
61
|
-
console.log(
|
|
62
|
-
"Here's an example on how to update the integrations section in app-config.yaml"
|
|
63
|
-
);
|
|
64
|
-
console.log(
|
|
65
|
-
chalk__default.default.green(`
|
|
66
|
-
integrations:
|
|
67
|
-
github:
|
|
68
|
-
- host: github.com
|
|
69
|
-
apps:
|
|
70
|
-
- $include: ${fileName}`)
|
|
71
|
-
);
|
|
72
|
-
};
|
|
73
|
-
async function verifyGithubOrg(org) {
|
|
74
|
-
let response;
|
|
75
|
-
try {
|
|
76
|
-
response = await fetch(
|
|
77
|
-
`https://api.github.com/orgs/${encodeURIComponent(org)}`
|
|
78
|
-
);
|
|
79
|
-
} catch (e) {
|
|
80
|
-
console.log(
|
|
81
|
-
chalk__default.default.yellow(
|
|
82
|
-
"Warning: Unable to verify existence of GitHub organization. ",
|
|
83
|
-
e
|
|
84
|
-
)
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
if (response?.status === 404) {
|
|
88
|
-
const questions = [
|
|
89
|
-
{
|
|
90
|
-
type: "confirm",
|
|
91
|
-
name: "shouldCreateOrg",
|
|
92
|
-
message: `GitHub organization ${chalk__default.default.cyan(
|
|
93
|
-
org
|
|
94
|
-
)} does not exist. Would you like to create a new Organization instead?`
|
|
95
|
-
}
|
|
96
|
-
];
|
|
97
|
-
const answers = await inquirer__default.default.prompt(questions);
|
|
98
|
-
if (!answers.shouldCreateOrg) {
|
|
99
|
-
console.log(
|
|
100
|
-
chalk__default.default.yellow("GitHub organization must exist to create GitHub app")
|
|
101
|
-
);
|
|
102
|
-
process.exit(1);
|
|
103
|
-
}
|
|
104
|
-
openBrowser__default.default("https://github.com/account/organizations/new");
|
|
105
|
-
console.log(
|
|
106
|
-
chalk__default.default.yellow(
|
|
107
|
-
"Please re-run this command when you have created your new organization"
|
|
108
|
-
)
|
|
109
|
-
);
|
|
110
|
-
process.exit(0);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
exports.default = index;
|
|
115
|
-
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var factory = require('../../wiring/factory.cjs.js');
|
|
6
|
-
var commander = require('commander');
|
|
7
|
-
var lazy = require('../../wiring/lazy.cjs.js');
|
|
8
|
-
|
|
9
|
-
var index = factory.createCliPlugin({
|
|
10
|
-
pluginId: "new",
|
|
11
|
-
init: async (reg) => {
|
|
12
|
-
reg.addCommand({
|
|
13
|
-
path: ["create-github-app"],
|
|
14
|
-
description: "Create new GitHub App in your organization.",
|
|
15
|
-
execute: async ({ args }) => {
|
|
16
|
-
const command = new commander.Command();
|
|
17
|
-
const defaultCommand = command.argument("<github-org>").action(
|
|
18
|
-
lazy.lazy(() => import('./commands/create-github-app/index.cjs.js'), "default")
|
|
19
|
-
);
|
|
20
|
-
await defaultCommand.parseAsync(args, { from: "user" });
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
exports.default = index;
|
|
27
|
-
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -1,181 +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
|
-
flags: {
|
|
38
|
-
include: {
|
|
39
|
-
type: [String],
|
|
40
|
-
description: "Glob patterns for additional packages to include (e.g., @spotify/backstage*)"
|
|
41
|
-
},
|
|
42
|
-
format: {
|
|
43
|
-
type: String,
|
|
44
|
-
description: "Output format (text or json)",
|
|
45
|
-
default: "text"
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
void 0,
|
|
50
|
-
args
|
|
51
|
-
);
|
|
52
|
-
const options = { include, format };
|
|
53
|
-
await new Promise(async () => {
|
|
54
|
-
const yarnVersion = await cliCommon.runOutput(["yarn", "--version"]);
|
|
55
|
-
const isLocal = fs__default.default.existsSync(cliCommon.findOwnPaths(__dirname).resolve("./src"));
|
|
56
|
-
const backstageFile = cliCommon.targetPaths.resolveRoot("backstage.json");
|
|
57
|
-
let backstageVersion = "N/A";
|
|
58
|
-
if (fs__default.default.existsSync(backstageFile)) {
|
|
59
|
-
try {
|
|
60
|
-
const backstageJson = await fs__default.default.readJSON(backstageFile);
|
|
61
|
-
backstageVersion = backstageJson.version ?? "N/A";
|
|
62
|
-
} catch (error) {
|
|
63
|
-
if (options.format !== "json") {
|
|
64
|
-
console.warn(
|
|
65
|
-
'The "backstage.json" file is not in the expected format'
|
|
66
|
-
);
|
|
67
|
-
console.log();
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
const systemInfo = {
|
|
72
|
-
os: `${os__default.default.type} ${os__default.default.release} - ${os__default.default.platform}/${os__default.default.arch}`,
|
|
73
|
-
node: process.version,
|
|
74
|
-
yarn: yarnVersion,
|
|
75
|
-
cli: { version: _package.version, local: isLocal },
|
|
76
|
-
backstage: backstageVersion
|
|
77
|
-
};
|
|
78
|
-
const lockfilePath = cliCommon.targetPaths.resolveRoot("yarn.lock");
|
|
79
|
-
const lockfile = await cliNode.Lockfile.load(lockfilePath);
|
|
80
|
-
const targetPath = cliCommon.targetPaths.rootDir;
|
|
81
|
-
const workspacePackages = /* @__PURE__ */ new Map();
|
|
82
|
-
try {
|
|
83
|
-
const packages = await cliNode.PackageGraph.listTargetPackages();
|
|
84
|
-
for (const pkg of packages) {
|
|
85
|
-
workspacePackages.set(pkg.packageJson.name, pkg.packageJson.version);
|
|
86
|
-
}
|
|
87
|
-
} catch {
|
|
88
|
-
}
|
|
89
|
-
const allPackages = [...lockfile.keys()];
|
|
90
|
-
const includePatterns = options.include || [];
|
|
91
|
-
const installedDeps = /* @__PURE__ */ new Set();
|
|
92
|
-
const localDeps = /* @__PURE__ */ new Set();
|
|
93
|
-
for (const pkg of allPackages) {
|
|
94
|
-
if (pkg.startsWith("@backstage/")) {
|
|
95
|
-
if (workspacePackages.has(pkg)) {
|
|
96
|
-
localDeps.add(pkg);
|
|
97
|
-
} else {
|
|
98
|
-
installedDeps.add(pkg);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
for (const pattern of includePatterns) {
|
|
103
|
-
for (const pkg of allPackages) {
|
|
104
|
-
if (minimatch.minimatch(pkg, pattern)) {
|
|
105
|
-
if (workspacePackages.has(pkg)) {
|
|
106
|
-
localDeps.add(pkg);
|
|
107
|
-
} else {
|
|
108
|
-
installedDeps.add(pkg);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
for (const pkg of allPackages) {
|
|
114
|
-
if (pkg.startsWith("@backstage/")) {
|
|
115
|
-
continue;
|
|
116
|
-
}
|
|
117
|
-
if (workspacePackages.has(pkg)) {
|
|
118
|
-
if (hasBackstageField(pkg, targetPath)) {
|
|
119
|
-
localDeps.add(pkg);
|
|
120
|
-
}
|
|
121
|
-
} else if (hasBackstageField(pkg, targetPath)) {
|
|
122
|
-
installedDeps.add(pkg);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
const getVersions = (dep) => {
|
|
126
|
-
const entries = lockfile.get(dep);
|
|
127
|
-
if (!entries) {
|
|
128
|
-
return [{ version: "unknown" }];
|
|
129
|
-
}
|
|
130
|
-
const versions = [...new Set(entries.map((i) => i.version))];
|
|
131
|
-
return versions.map((v) => ({ version: v }));
|
|
132
|
-
};
|
|
133
|
-
const sortedInstalled = [...installedDeps].sort();
|
|
134
|
-
const sortedLocal = [...localDeps].sort();
|
|
135
|
-
if (options.format === "json") {
|
|
136
|
-
const output = {
|
|
137
|
-
system: systemInfo,
|
|
138
|
-
dependencies: Object.fromEntries(
|
|
139
|
-
sortedInstalled.map((dep) => [dep, getVersions(dep)])
|
|
140
|
-
),
|
|
141
|
-
local: Object.fromEntries(
|
|
142
|
-
sortedLocal.map((dep) => [
|
|
143
|
-
dep,
|
|
144
|
-
[{ version: workspacePackages.get(dep) ?? "unknown" }]
|
|
145
|
-
])
|
|
146
|
-
)
|
|
147
|
-
};
|
|
148
|
-
process.stdout.write(`${JSON.stringify(output, null, 2)}
|
|
149
|
-
`);
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
console.log(`OS: ${systemInfo.os}`);
|
|
153
|
-
console.log(`node: ${systemInfo.node}`);
|
|
154
|
-
console.log(`yarn: ${systemInfo.yarn}`);
|
|
155
|
-
console.log(`cli: ${_package.version} (${isLocal ? "local" : "installed"})`);
|
|
156
|
-
console.log(`backstage: ${backstageVersion}`);
|
|
157
|
-
console.log();
|
|
158
|
-
console.log("Dependencies:");
|
|
159
|
-
if (sortedInstalled.length > 0) {
|
|
160
|
-
const maxLength = Math.max(...sortedInstalled.map((d) => d.length));
|
|
161
|
-
for (const dep of sortedInstalled) {
|
|
162
|
-
const versions = getVersions(dep).map((v) => v.version).join(", ");
|
|
163
|
-
console.log(` ${dep.padEnd(maxLength)} ${versions}`);
|
|
164
|
-
}
|
|
165
|
-
} else {
|
|
166
|
-
console.log(" (no installed Backstage packages found)");
|
|
167
|
-
}
|
|
168
|
-
if (localDeps.size > 0) {
|
|
169
|
-
console.log();
|
|
170
|
-
console.log("Local:");
|
|
171
|
-
const maxLength = Math.max(...sortedLocal.map((d) => d.length));
|
|
172
|
-
for (const dep of sortedLocal) {
|
|
173
|
-
const version = workspacePackages.get(dep) ?? "unknown";
|
|
174
|
-
console.log(` ${dep.padEnd(maxLength)} ${version}`);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
exports.default = info;
|
|
181
|
-
//# 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,46 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var fs = require('fs-extra');
|
|
6
|
-
var cliCommon = require('@backstage/cli-common');
|
|
7
|
-
var eslint = require('eslint');
|
|
8
|
-
|
|
9
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
10
|
-
|
|
11
|
-
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
12
|
-
|
|
13
|
-
var lint = async (directories, opts) => {
|
|
14
|
-
const eslint$1 = new eslint.ESLint({
|
|
15
|
-
cwd: cliCommon.targetPaths.dir,
|
|
16
|
-
fix: opts.fix,
|
|
17
|
-
extensions: ["js", "jsx", "ts", "tsx", "mjs", "cjs"]
|
|
18
|
-
});
|
|
19
|
-
const results = await eslint$1.lintFiles(
|
|
20
|
-
directories.length ? directories : ["."]
|
|
21
|
-
);
|
|
22
|
-
const maxWarnings = opts.maxWarnings ?? -1;
|
|
23
|
-
const ignoreWarnings = +maxWarnings === -1;
|
|
24
|
-
const failed = results.some((r) => r.errorCount > 0) || !ignoreWarnings && results.reduce((current, next) => current + next.warningCount, 0) > maxWarnings;
|
|
25
|
-
if (opts.fix) {
|
|
26
|
-
await eslint.ESLint.outputFixes(results);
|
|
27
|
-
}
|
|
28
|
-
const formatter = await eslint$1.loadFormatter(opts.format);
|
|
29
|
-
if (opts.format === "eslint-formatter-friendly") {
|
|
30
|
-
process.chdir(cliCommon.targetPaths.rootDir);
|
|
31
|
-
}
|
|
32
|
-
const resultText = await formatter.format(results);
|
|
33
|
-
if (resultText) {
|
|
34
|
-
if (opts.outputFile) {
|
|
35
|
-
await fs__default.default.writeFile(cliCommon.targetPaths.resolve(opts.outputFile), resultText);
|
|
36
|
-
} else {
|
|
37
|
-
console.log(resultText);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
if (failed) {
|
|
41
|
-
process.exit(1);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
exports.default = lint;
|
|
46
|
-
//# sourceMappingURL=lint.cjs.js.map
|