@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,63 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var cleye = require('cleye');
|
|
6
|
-
var configLoader = require('@backstage/config-loader');
|
|
7
|
-
var openBrowser = require('react-dev-utils/openBrowser');
|
|
8
|
-
var chalk = require('chalk');
|
|
9
|
-
var config = require('../lib/config.cjs.js');
|
|
10
|
-
|
|
11
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
12
|
-
|
|
13
|
-
var openBrowser__default = /*#__PURE__*/_interopDefaultCompat(openBrowser);
|
|
14
|
-
var chalk__default = /*#__PURE__*/_interopDefaultCompat(chalk);
|
|
15
|
-
|
|
16
|
-
const DOCS_URL = "https://config.backstage.io";
|
|
17
|
-
var docs = async ({ args, info }) => {
|
|
18
|
-
const {
|
|
19
|
-
flags: { package: pkg }
|
|
20
|
-
} = cleye.cli(
|
|
21
|
-
{
|
|
22
|
-
help: info,
|
|
23
|
-
booleanFlagNegation: true,
|
|
24
|
-
flags: {
|
|
25
|
-
package: {
|
|
26
|
-
type: String,
|
|
27
|
-
description: "Only include the schema that applies to the given package"
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
void 0,
|
|
32
|
-
args
|
|
33
|
-
);
|
|
34
|
-
const { schema: appSchemas } = await config.loadCliConfig({
|
|
35
|
-
args: [],
|
|
36
|
-
fromPackage: pkg,
|
|
37
|
-
mockEnv: true
|
|
38
|
-
});
|
|
39
|
-
const schema = configLoader.mergeConfigSchemas(
|
|
40
|
-
appSchemas.serialize().schemas.map(
|
|
41
|
-
(_) => _.value
|
|
42
|
-
)
|
|
43
|
-
);
|
|
44
|
-
const url = `${DOCS_URL}#schema=${JSON.stringify(schema)}`;
|
|
45
|
-
console.log();
|
|
46
|
-
console.log(
|
|
47
|
-
chalk__default.default.cyan(
|
|
48
|
-
"Opening configuration reference documentation in your browser..."
|
|
49
|
-
)
|
|
50
|
-
);
|
|
51
|
-
console.log(` ${chalk__default.default.cyan(url)}`);
|
|
52
|
-
console.log();
|
|
53
|
-
const opened = openBrowser__default.default(url);
|
|
54
|
-
if (!opened) {
|
|
55
|
-
console.log(
|
|
56
|
-
chalk__default.default.yellow("\u26A0\uFE0F WARNING: Unable to open browser automatically.")
|
|
57
|
-
);
|
|
58
|
-
console.log(chalk__default.default.yellow("Please open the URL manually in your browser."));
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
exports.default = docs;
|
|
63
|
-
//# sourceMappingURL=docs.cjs.js.map
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var cleye = require('cleye');
|
|
6
|
-
var YAML = require('yaml');
|
|
7
|
-
var config$1 = require('@backstage/config');
|
|
8
|
-
var config = require('../lib/config.cjs.js');
|
|
9
|
-
|
|
10
|
-
var print = async ({ args, info }) => {
|
|
11
|
-
const {
|
|
12
|
-
flags: { config: config$1, lax, frontend, withSecrets, format, package: pkg }
|
|
13
|
-
} = cleye.cli(
|
|
14
|
-
{
|
|
15
|
-
help: info,
|
|
16
|
-
booleanFlagNegation: true,
|
|
17
|
-
flags: {
|
|
18
|
-
package: { type: String, description: "Package to print config for" },
|
|
19
|
-
lax: {
|
|
20
|
-
type: Boolean,
|
|
21
|
-
description: "Do not require environment variables to be set"
|
|
22
|
-
},
|
|
23
|
-
frontend: { type: Boolean, description: "Only print frontend config" },
|
|
24
|
-
withSecrets: {
|
|
25
|
-
type: Boolean,
|
|
26
|
-
description: "Include secrets in the output"
|
|
27
|
-
},
|
|
28
|
-
format: { type: String, description: "Output format (yaml or json)" },
|
|
29
|
-
config: {
|
|
30
|
-
type: [String],
|
|
31
|
-
description: "Config files to load instead of app-config.yaml"
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
void 0,
|
|
36
|
-
args
|
|
37
|
-
);
|
|
38
|
-
const { schema, appConfigs } = await config.loadCliConfig({
|
|
39
|
-
args: config$1,
|
|
40
|
-
fromPackage: pkg,
|
|
41
|
-
mockEnv: lax,
|
|
42
|
-
fullVisibility: !frontend
|
|
43
|
-
});
|
|
44
|
-
const visibility = getVisibilityOption(frontend, withSecrets);
|
|
45
|
-
const data = serializeConfigData(appConfigs, schema, visibility);
|
|
46
|
-
if (format === "json") {
|
|
47
|
-
process.stdout.write(`${JSON.stringify(data, null, 2)}
|
|
48
|
-
`);
|
|
49
|
-
} else {
|
|
50
|
-
process.stdout.write(`${YAML.stringify(data)}
|
|
51
|
-
`);
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
function getVisibilityOption(frontend, withSecrets) {
|
|
55
|
-
if (frontend && withSecrets) {
|
|
56
|
-
throw new Error("Not allowed to combine frontend and secret config");
|
|
57
|
-
}
|
|
58
|
-
if (frontend) {
|
|
59
|
-
return "frontend";
|
|
60
|
-
} else if (withSecrets) {
|
|
61
|
-
return "secret";
|
|
62
|
-
}
|
|
63
|
-
return "backend";
|
|
64
|
-
}
|
|
65
|
-
function serializeConfigData(appConfigs, schema, visibility) {
|
|
66
|
-
if (visibility === "frontend") {
|
|
67
|
-
const frontendConfigs = schema.process(appConfigs, {
|
|
68
|
-
visibility: ["frontend"]
|
|
69
|
-
});
|
|
70
|
-
return config$1.ConfigReader.fromConfigs(frontendConfigs).get();
|
|
71
|
-
} else if (visibility === "secret") {
|
|
72
|
-
return config$1.ConfigReader.fromConfigs(appConfigs).get();
|
|
73
|
-
}
|
|
74
|
-
const sanitizedConfigs = schema.process(appConfigs, {
|
|
75
|
-
valueTransform: (value, context) => context.visibility === "secret" ? "<secret>" : value
|
|
76
|
-
});
|
|
77
|
-
return config$1.ConfigReader.fromConfigs(sanitizedConfigs).get();
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
exports.default = print;
|
|
81
|
-
//# sourceMappingURL=print.cjs.js.map
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var cleye = require('cleye');
|
|
6
|
-
var YAML = require('yaml');
|
|
7
|
-
var config = require('../lib/config.cjs.js');
|
|
8
|
-
var configLoader = require('@backstage/config-loader');
|
|
9
|
-
|
|
10
|
-
var schema = async ({ args, info }) => {
|
|
11
|
-
const {
|
|
12
|
-
flags: { merge, format, package: pkg }
|
|
13
|
-
} = cleye.cli(
|
|
14
|
-
{
|
|
15
|
-
help: info,
|
|
16
|
-
booleanFlagNegation: true,
|
|
17
|
-
flags: {
|
|
18
|
-
package: { type: String, description: "Package to print schema for" },
|
|
19
|
-
format: { type: String, description: "Output format (yaml or json)" },
|
|
20
|
-
merge: {
|
|
21
|
-
type: Boolean,
|
|
22
|
-
description: "Merge all schemas into a single schema"
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
void 0,
|
|
27
|
-
args
|
|
28
|
-
);
|
|
29
|
-
const { schema } = await config.loadCliConfig({
|
|
30
|
-
args: [],
|
|
31
|
-
fromPackage: pkg,
|
|
32
|
-
mockEnv: true
|
|
33
|
-
});
|
|
34
|
-
let configSchema;
|
|
35
|
-
if (merge) {
|
|
36
|
-
configSchema = configLoader.mergeConfigSchemas(
|
|
37
|
-
schema.serialize().schemas.map(
|
|
38
|
-
(_) => _.value
|
|
39
|
-
)
|
|
40
|
-
);
|
|
41
|
-
configSchema.title = "Application Configuration Schema";
|
|
42
|
-
configSchema.description = "This is the schema describing the structure of the app-config.yaml configuration file.";
|
|
43
|
-
} else {
|
|
44
|
-
configSchema = schema.serialize();
|
|
45
|
-
}
|
|
46
|
-
if (format === "json") {
|
|
47
|
-
process.stdout.write(`${JSON.stringify(configSchema, null, 2)}
|
|
48
|
-
`);
|
|
49
|
-
} else {
|
|
50
|
-
process.stdout.write(`${YAML.stringify(configSchema)}
|
|
51
|
-
`);
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
exports.default = schema;
|
|
56
|
-
//# sourceMappingURL=schema.cjs.js.map
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var cleye = require('cleye');
|
|
6
|
-
var config = require('../lib/config.cjs.js');
|
|
7
|
-
|
|
8
|
-
var validate = async ({ args, info }) => {
|
|
9
|
-
const {
|
|
10
|
-
flags: { config: config$1, lax, frontend, deprecated, strict, package: pkg }
|
|
11
|
-
} = cleye.cli(
|
|
12
|
-
{
|
|
13
|
-
help: info,
|
|
14
|
-
booleanFlagNegation: true,
|
|
15
|
-
flags: {
|
|
16
|
-
package: {
|
|
17
|
-
type: String,
|
|
18
|
-
description: "Package to validate config for"
|
|
19
|
-
},
|
|
20
|
-
lax: {
|
|
21
|
-
type: Boolean,
|
|
22
|
-
description: "Do not require environment variables to be set"
|
|
23
|
-
},
|
|
24
|
-
frontend: {
|
|
25
|
-
type: Boolean,
|
|
26
|
-
description: "Only validate frontend config"
|
|
27
|
-
},
|
|
28
|
-
deprecated: { type: Boolean, description: "Output deprecated keys" },
|
|
29
|
-
strict: { type: Boolean, description: "Enable strict validation" },
|
|
30
|
-
config: {
|
|
31
|
-
type: [String],
|
|
32
|
-
description: "Config files to load instead of app-config.yaml"
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
void 0,
|
|
37
|
-
args
|
|
38
|
-
);
|
|
39
|
-
await config.loadCliConfig({
|
|
40
|
-
args: config$1,
|
|
41
|
-
fromPackage: pkg,
|
|
42
|
-
mockEnv: lax,
|
|
43
|
-
fullVisibility: !frontend,
|
|
44
|
-
withDeprecatedKeys: deprecated,
|
|
45
|
-
strict
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
exports.default = validate;
|
|
50
|
-
//# sourceMappingURL=validate.cjs.js.map
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var factory = require('../../wiring/factory.cjs.js');
|
|
6
|
-
|
|
7
|
-
const configOption = [
|
|
8
|
-
"--config <path>",
|
|
9
|
-
"Config files to load instead of app-config.yaml",
|
|
10
|
-
(opt, opts) => opts ? [...opts, opt] : [opt],
|
|
11
|
-
Array()
|
|
12
|
-
];
|
|
13
|
-
var index = factory.createCliPlugin({
|
|
14
|
-
pluginId: "config",
|
|
15
|
-
init: async (reg) => {
|
|
16
|
-
reg.addCommand({
|
|
17
|
-
path: ["config:docs"],
|
|
18
|
-
description: "Browse the configuration reference documentation",
|
|
19
|
-
execute: { loader: () => import('./commands/docs.cjs.js') }
|
|
20
|
-
});
|
|
21
|
-
reg.addCommand({
|
|
22
|
-
path: ["config", "docs"],
|
|
23
|
-
description: "Browse the configuration reference documentation",
|
|
24
|
-
execute: { loader: () => import('./commands/docs.cjs.js') }
|
|
25
|
-
});
|
|
26
|
-
reg.addCommand({
|
|
27
|
-
path: ["config:print"],
|
|
28
|
-
description: "Print the app configuration for the current package",
|
|
29
|
-
execute: { loader: () => import('./commands/print.cjs.js') }
|
|
30
|
-
});
|
|
31
|
-
reg.addCommand({
|
|
32
|
-
path: ["config:check"],
|
|
33
|
-
description: "Validate that the given configuration loads and matches schema",
|
|
34
|
-
execute: { loader: () => import('./commands/validate.cjs.js') }
|
|
35
|
-
});
|
|
36
|
-
reg.addCommand({
|
|
37
|
-
path: ["config:schema"],
|
|
38
|
-
description: "Print the JSON schema for the given configuration",
|
|
39
|
-
execute: { loader: () => import('./commands/schema.cjs.js') }
|
|
40
|
-
});
|
|
41
|
-
reg.addCommand({
|
|
42
|
-
path: ["config", "schema"],
|
|
43
|
-
description: "Print the JSON schema for the given configuration",
|
|
44
|
-
execute: { loader: () => import('./commands/schema.cjs.js') }
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
exports.configOption = configOption;
|
|
50
|
-
exports.default = index;
|
|
51
|
-
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -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,126 +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 cleye = require('cleye');
|
|
11
|
-
var GithubCreateAppServer = require('./GithubCreateAppServer.cjs.js');
|
|
12
|
-
var openBrowser = require('react-dev-utils/openBrowser');
|
|
13
|
-
|
|
14
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
15
|
-
|
|
16
|
-
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
17
|
-
var chalk__default = /*#__PURE__*/_interopDefaultCompat(chalk);
|
|
18
|
-
var inquirer__default = /*#__PURE__*/_interopDefaultCompat(inquirer);
|
|
19
|
-
var openBrowser__default = /*#__PURE__*/_interopDefaultCompat(openBrowser);
|
|
20
|
-
|
|
21
|
-
var index = async ({ args, info }) => {
|
|
22
|
-
const { _: positionals } = cleye.cli(
|
|
23
|
-
{
|
|
24
|
-
help: { ...info, usage: `${info.usage} <github-org>` },
|
|
25
|
-
booleanFlagNegation: true,
|
|
26
|
-
parameters: ["<github-org>"]
|
|
27
|
-
},
|
|
28
|
-
void 0,
|
|
29
|
-
args
|
|
30
|
-
);
|
|
31
|
-
const org = positionals[0];
|
|
32
|
-
const answers = await inquirer__default.default.prompt({
|
|
33
|
-
name: "appType",
|
|
34
|
-
type: "checkbox",
|
|
35
|
-
message: "Select permissions [required] (these can be changed later but then require approvals in all installations)",
|
|
36
|
-
choices: [
|
|
37
|
-
{
|
|
38
|
-
name: "Read access to content (required by Software Catalog to ingest data from repositories)",
|
|
39
|
-
value: "read",
|
|
40
|
-
checked: true
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
name: "Read access to members (required by Software Catalog to ingest GitHub teams)",
|
|
44
|
-
value: "members",
|
|
45
|
-
checked: true
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
name: "Read and Write to content and actions (required by Software Templates to create new repositories)",
|
|
49
|
-
value: "write"
|
|
50
|
-
}
|
|
51
|
-
]
|
|
52
|
-
});
|
|
53
|
-
if (answers.appType.length === 0) {
|
|
54
|
-
console.log(chalk__default.default.red("You must select at least one permission"));
|
|
55
|
-
process.exit(1);
|
|
56
|
-
}
|
|
57
|
-
await verifyGithubOrg(org);
|
|
58
|
-
const { slug, name, ...config } = await GithubCreateAppServer.GithubCreateAppServer.run({
|
|
59
|
-
org,
|
|
60
|
-
permissions: answers.appType
|
|
61
|
-
});
|
|
62
|
-
const fileName = `github-app-${slug}-credentials.yaml`;
|
|
63
|
-
const content = `# Name: ${name}
|
|
64
|
-
${YAML.stringify(config)}`;
|
|
65
|
-
await fs__default.default.writeFile(cliCommon.targetPaths.resolveRoot(fileName), content);
|
|
66
|
-
console.log(`GitHub App configuration written to ${chalk__default.default.cyan(fileName)}`);
|
|
67
|
-
console.log(
|
|
68
|
-
chalk__default.default.yellow(
|
|
69
|
-
"This file contains sensitive credentials, it should not be committed to version control and handled with care!"
|
|
70
|
-
)
|
|
71
|
-
);
|
|
72
|
-
console.log(
|
|
73
|
-
"Here's an example on how to update the integrations section in app-config.yaml"
|
|
74
|
-
);
|
|
75
|
-
console.log(
|
|
76
|
-
chalk__default.default.green(`
|
|
77
|
-
integrations:
|
|
78
|
-
github:
|
|
79
|
-
- host: github.com
|
|
80
|
-
apps:
|
|
81
|
-
- $include: ${fileName}`)
|
|
82
|
-
);
|
|
83
|
-
};
|
|
84
|
-
async function verifyGithubOrg(org) {
|
|
85
|
-
let response;
|
|
86
|
-
try {
|
|
87
|
-
response = await fetch(
|
|
88
|
-
`https://api.github.com/orgs/${encodeURIComponent(org)}`
|
|
89
|
-
);
|
|
90
|
-
} catch (e) {
|
|
91
|
-
console.log(
|
|
92
|
-
chalk__default.default.yellow(
|
|
93
|
-
"Warning: Unable to verify existence of GitHub organization. ",
|
|
94
|
-
e
|
|
95
|
-
)
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
if (response?.status === 404) {
|
|
99
|
-
const questions = [
|
|
100
|
-
{
|
|
101
|
-
type: "confirm",
|
|
102
|
-
name: "shouldCreateOrg",
|
|
103
|
-
message: `GitHub organization ${chalk__default.default.cyan(
|
|
104
|
-
org
|
|
105
|
-
)} does not exist. Would you like to create a new Organization instead?`
|
|
106
|
-
}
|
|
107
|
-
];
|
|
108
|
-
const answers = await inquirer__default.default.prompt(questions);
|
|
109
|
-
if (!answers.shouldCreateOrg) {
|
|
110
|
-
console.log(
|
|
111
|
-
chalk__default.default.yellow("GitHub organization must exist to create GitHub app")
|
|
112
|
-
);
|
|
113
|
-
process.exit(1);
|
|
114
|
-
}
|
|
115
|
-
openBrowser__default.default("https://github.com/account/organizations/new");
|
|
116
|
-
console.log(
|
|
117
|
-
chalk__default.default.yellow(
|
|
118
|
-
"Please re-run this command when you have created your new organization"
|
|
119
|
-
)
|
|
120
|
-
);
|
|
121
|
-
process.exit(0);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
exports.default = index;
|
|
126
|
-
//# sourceMappingURL=index.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: "new",
|
|
9
|
-
init: async (reg) => {
|
|
10
|
-
reg.addCommand({
|
|
11
|
-
path: ["create-github-app"],
|
|
12
|
-
description: "Create new GitHub App in your organization.",
|
|
13
|
-
execute: { loader: () => import('./commands/create-github-app/index.cjs.js') }
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
exports.default = index;
|
|
19
|
-
//# sourceMappingURL=index.cjs.js.map
|