@backstage/create-app 0.4.30-next.3 → 0.4.31-next.1

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 CHANGED
@@ -1,5 +1,149 @@
1
1
  # @backstage/create-app
2
2
 
3
+ ## 0.4.31-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - c1f1a4c760: The Backstage packages and plugins have all been updated to support React Router v6 stable. The `create-app` template has not been migrated yet, but if you want to migrate your own app or plugins, check out the [migration guide](https://backstage.io/docs/tutorials/react-router-stable-migration).
8
+ - c3c90280be: The options part of `DatabaseManager.fromConfig` now accepts an optional logger
9
+ field. You may want to supply that logger in your backend initialization code to
10
+ ensure that you can get relevant logging data when things happen related to the
11
+ connection pool.
12
+
13
+ In `packages/backend/src/index.ts`:
14
+
15
+ ```diff
16
+ function makeCreateEnv(config: Config) {
17
+ const root = getRootLogger();
18
+ ...
19
+ - const databaseManager = DatabaseManager.fromConfig(config);
20
+ + const databaseManager = DatabaseManager.fromConfig(config, { logger: root });
21
+ ```
22
+
23
+ ## 0.4.31-next.0
24
+
25
+ ### Patch Changes
26
+
27
+ - e83de28e36: Fix typo in the documentation
28
+ - 208d6780c9: The `packages/backend/Dockerfile` received a couple of updates, it now looks as follows:
29
+
30
+ ```Dockerfile
31
+ FROM node:16-bullseye-slim
32
+
33
+ # Install sqlite3 dependencies. You can skip this if you don't use sqlite3 in the image,
34
+ # in which case you should also move better-sqlite3 to "devDependencies" in package.json.
35
+ RUN apt-get update && \
36
+ apt-get install -y --no-install-recommends libsqlite3-dev python3 build-essential && \
37
+ rm -rf /var/lib/apt/lists/* && \
38
+ yarn config set python /usr/bin/python3
39
+
40
+ # From here on we use the least-privileged `node` user to run the backend.
41
+ USER node
42
+ WORKDIR /app
43
+
44
+ # This switches many Node.js dependencies to production mode.
45
+ ENV NODE_ENV production
46
+
47
+ # Copy repo skeleton first, to avoid unnecessary docker cache invalidation.
48
+ # The skeleton contains the package.json of each package in the monorepo,
49
+ # and along with yarn.lock and the root package.json, that's enough to run yarn install.
50
+ COPY --chown=node:node yarn.lock package.json packages/backend/dist/skeleton.tar.gz ./
51
+ RUN tar xzf skeleton.tar.gz && rm skeleton.tar.gz
52
+
53
+ RUN yarn install --frozen-lockfile --production --network-timeout 300000 && rm -rf "$(yarn cache dir)"
54
+
55
+ # Then copy the rest of the backend bundle, along with any other files we might want.
56
+ COPY --chown=node:node packages/backend/dist/bundle.tar.gz app-config*.yaml ./
57
+ RUN tar xzf bundle.tar.gz && rm bundle.tar.gz
58
+
59
+ CMD ["node", "packages/backend", "--config", "app-config.yaml", "--config", "app-config.production.yaml"]
60
+ ```
61
+
62
+ The two notable changes are that a `USER node` instruction has been added and the ordering of instructions has been changed accordingly. This means that the app will now be running using the least-privileged `node` user. In order for this to work we now need to make sure that all app files are owned by the `node` user, which we do by adding the `--chown=node:node` option to the `COPY` instructions.
63
+
64
+ The second change is the addition of `ENV NODE_ENV production`, which ensured that all Node.js modules run in production mode. If you apply this change to an existing app, note that one of the more significant changes is that this switches the log formatting to use the default production format, JSON. Rather than your log lines looking like this:
65
+
66
+ ```log
67
+ 2022-08-10T11:36:05.478Z catalog info Performing database migration type=plugin
68
+ ```
69
+
70
+ They will now look like this:
71
+
72
+ ```log
73
+ {"level":"info","message":"Performing database migration","plugin":"catalog","service":"backstage","type":"plugin"}
74
+ ```
75
+
76
+ If you wish to keep the existing format, you can override this change by applying the following change to `packages/backend/src/index.ts`:
77
+
78
+ ```diff
79
+ getRootLogger,
80
+ + setRootLogger,
81
+ + createRootLogger,
82
+ + coloredFormat,
83
+ useHotMemoize,
84
+ ...
85
+ ServerTokenManager,
86
+ } from '@backstage/backend-common';
87
+
88
+ ...
89
+
90
+ async function main() {
91
+ + setRootLogger(createRootLogger({ format: coloredFormat }));
92
+ +
93
+ const config = await loadBackendConfig({
94
+ ```
95
+
96
+ - c0a08fd08c: Added `EntityLinksCard` to the system `EntityPage`.
97
+
98
+ For an existing installation where you want to display the links card for entity pages of kind `system` you should make the following adjustment to `packages/app/src/components/catalog/EntityPage.tsx`
99
+
100
+ ```diff
101
+ const systemPage = (
102
+ ...
103
+ <Grid item md={6} xs={12}>
104
+ <EntityCatalogGraphCard variant="gridItem" height={400} />
105
+ </Grid>
106
+ + <Grid item md={4} xs={12}>
107
+ + <EntityLinksCard />
108
+ + </Grid>
109
+ - <Grid item md={6}>
110
+ + <Grid item md={8}>
111
+ <EntityHasComponentsCard variant="gridItem" />
112
+ </Grid>
113
+ ...
114
+ );
115
+ ```
116
+
117
+ ## 0.4.30
118
+
119
+ ### Patch Changes
120
+
121
+ - 73cee58fc2: Bumped create-app version.
122
+ - f762386d48: Bumped create-app version.
123
+ - b162bbf464: Bumped create-app version.
124
+ - db76fc6255: The `better-sqlite3` dependency has been moved back to production `"dependencies"` in `packages/backend/package.json`, with instructions in the Dockerfile to move it to `"devDependencies"` if desired. There is no need to apply this change to existing apps, unless you want your production image to have SQLite available as a database option.
125
+ - ab9edd8b58: Updated backend to write stack trace when the backend fails to start up.
126
+
127
+ To apply this change to your Backstage installation, make the following change to `packages/backend/src/index.ts`
128
+
129
+ ```diff
130
+ cors:
131
+ origin: http://localhost:3000
132
+ - console.error(`Backend failed to start up, ${error}`);
133
+ + console.error('Backend failed to start up', error);
134
+ ```
135
+
136
+ - 0174a0a022: Add `PATCH` and `HEAD` to the `Access-Control-Allow-Methods`.
137
+
138
+ To apply this change to your Backstage installation make the following change to your `app-config.yaml`
139
+
140
+ ```diff
141
+ cors:
142
+ origin: http://localhost:3000
143
+ - methods: [GET, POST, PUT, DELETE]
144
+ + methods: [GET, POST, PUT, DELETE, PATCH, HEAD]
145
+ ```
146
+
3
147
  ## 0.4.30-next.3
4
148
 
5
149
  ### Patch Changes
package/dist/index.cjs.js CHANGED
@@ -57,99 +57,99 @@ ${chalk__default["default"].red(`${error}`)}
57
57
  }
58
58
  }
59
59
 
60
- var version$K = "1.5.0-next.3";
60
+ var version$K = "1.6.0-next.1";
61
61
 
62
- var version$J = "1.0.5-next.1";
62
+ var version$J = "1.0.6-next.1";
63
63
 
64
- var version$I = "0.15.0-next.2";
64
+ var version$I = "0.15.1-next.1";
65
65
 
66
- var version$H = "0.3.4-next.0";
66
+ var version$H = "0.3.5-next.0";
67
67
 
68
- var version$G = "1.0.4";
68
+ var version$G = "1.0.5-next.0";
69
69
 
70
70
  var version$F = "1.1.0";
71
71
 
72
- var version$E = "0.18.1-next.1";
72
+ var version$E = "0.19.0-next.1";
73
73
 
74
74
  var version$D = "1.0.1";
75
75
 
76
- var version$C = "1.0.5-next.0";
76
+ var version$C = "1.1.0-next.1";
77
77
 
78
- var version$B = "0.11.0-next.2";
78
+ var version$B = "0.11.1-next.1";
79
79
 
80
- var version$A = "1.0.5-next.0";
80
+ var version$A = "1.0.6-next.1";
81
81
 
82
82
  var version$z = "1.1.0";
83
83
 
84
- var version$y = "1.1.3-next.1";
84
+ var version$y = "1.1.4-next.0";
85
85
 
86
- var version$x = "1.1.3-next.0";
86
+ var version$x = "1.2.0-next.1";
87
87
 
88
88
  var version$w = "0.2.16";
89
89
 
90
- var version$v = "0.8.8-next.2";
90
+ var version$v = "0.8.9-next.1";
91
91
 
92
- var version$u = "0.3.35-next.0";
92
+ var version$u = "0.3.36-next.1";
93
93
 
94
- var version$t = "0.15.1-next.1";
94
+ var version$t = "0.16.0-next.1";
95
95
 
96
- var version$s = "1.5.0-next.2";
96
+ var version$s = "1.5.1-next.1";
97
97
 
98
- var version$r = "1.0.5-next.0";
98
+ var version$r = "1.0.6-next.0";
99
99
 
100
- var version$q = "1.1.3-next.2";
100
+ var version$q = "1.1.4-next.1";
101
101
 
102
- var version$p = "1.3.1-next.2";
102
+ var version$p = "1.4.0-next.1";
103
103
 
104
- var version$o = "0.2.20-next.1";
104
+ var version$o = "0.2.21-next.1";
105
105
 
106
- var version$n = "0.8.11-next.1";
106
+ var version$n = "0.8.12-next.1";
107
107
 
108
- var version$m = "0.3.8-next.1";
108
+ var version$m = "0.3.9-next.1";
109
109
 
110
- var version$l = "0.3.39-next.1";
110
+ var version$l = "0.3.40-next.1";
111
111
 
112
- var version$k = "0.5.8-next.1";
112
+ var version$k = "0.5.9-next.1";
113
113
 
114
- var version$j = "0.3.8-next.1";
114
+ var version$j = "0.3.9-next.1";
115
115
 
116
- var version$i = "0.5.8-next.1";
116
+ var version$i = "0.5.9-next.1";
117
117
 
118
- var version$h = "0.6.3";
118
+ var version$h = "0.6.4-next.0";
119
119
 
120
- var version$g = "0.4.4-next.0";
120
+ var version$g = "0.4.5-next.1";
121
121
 
122
- var version$f = "0.6.4-next.0";
122
+ var version$f = "0.6.5-next.1";
123
123
 
124
- var version$e = "0.2.29-next.0";
124
+ var version$e = "0.2.30-next.0";
125
125
 
126
- var version$d = "0.1.32-next.0";
126
+ var version$d = "0.1.33-next.1";
127
127
 
128
- var version$c = "1.5.0-next.2";
128
+ var version$c = "1.6.0-next.1";
129
129
 
130
- var version$b = "1.5.0-next.2";
130
+ var version$b = "1.6.0-next.1";
131
131
 
132
- var version$a = "1.0.1-next.1";
132
+ var version$a = "1.0.2-next.1";
133
133
 
134
- var version$9 = "1.0.1-next.1";
134
+ var version$9 = "1.0.2-next.1";
135
135
 
136
- var version$8 = "1.0.1-next.0";
136
+ var version$8 = "1.0.2-next.0";
137
137
 
138
- var version$7 = "0.3.6-next.0";
138
+ var version$7 = "0.4.0-next.1";
139
139
 
140
- var version$6 = "1.0.1-next.0";
140
+ var version$6 = "1.0.2-next.1";
141
141
 
142
- var version$5 = "0.5.15-next.1";
142
+ var version$5 = "0.5.16-next.1";
143
143
 
144
- var version$4 = "1.3.1-next.2";
144
+ var version$4 = "1.3.2-next.1";
145
145
 
146
- var version$3 = "1.0.3-next.2";
146
+ var version$3 = "1.0.4-next.1";
147
147
 
148
- var version$2 = "1.0.3-next.2";
148
+ var version$2 = "1.0.4-next.0";
149
149
 
150
- var version$1 = "1.2.1-next.1";
150
+ var version$1 = "1.2.2-next.0";
151
151
 
152
- var version = "0.4.7-next.1";
152
+ var version = "0.4.8-next.1";
153
153
 
154
154
  const packageVersions = {
155
155
  root: version$K,
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../src/lib/errors.ts","../src/lib/versions.ts","../src/lib/tasks.ts","../src/createApp.ts","../src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport chalk from 'chalk';\n\nexport class CustomError extends Error {\n get name(): string {\n return this.constructor.name;\n }\n}\n\nexport class ExitCodeError extends CustomError {\n readonly code: number;\n\n constructor(code: number, command?: string) {\n if (command) {\n super(`Command '${command}' exited with code ${code}`);\n } else {\n super(`Child exited with code ${code}`);\n }\n this.code = code;\n }\n}\n\nexport function exitWithError(error: Error): never {\n if (error instanceof ExitCodeError) {\n process.stderr.write(`\\n${chalk.red(error.message)}\\n\\n`);\n process.exit(error.code);\n } else {\n process.stderr.write(`\\n${chalk.red(`${error}`)}\\n\\n`);\n process.exit(1);\n }\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* eslint-disable monorepo/no-relative-import */\n\n/*\nThis is a list of all packages used by the template. If dependencies are added or removed,\nthis list should be updated as well.\n\nThere is a release step that ensures that this package is always bumped with every\nrelease, meaning these version will always be up to date.\n\nThis does not create an actual dependency on these packages and does not bring in any code.\nRelative imports are used rather than package imports to make sure the packages aren't externalized.\nRollup will extract the value of the version field in each package at build time without\nleaving any imports in place.\n*/\n\nimport { version as root } from '../../../../package.json';\n\nimport { version as appDefaults } from '../../../app-defaults/package.json';\nimport { version as backendCommon } from '../../../backend-common/package.json';\nimport { version as backendTasks } from '../../../backend-tasks/package.json';\nimport { version as catalogClient } from '../../../catalog-client/package.json';\nimport { version as catalogModel } from '../../../catalog-model/package.json';\nimport { version as cli } from '../../../cli/package.json';\nimport { version as config } from '../../../config/package.json';\nimport { version as coreAppApi } from '../../../core-app-api/package.json';\nimport { version as coreComponents } from '../../../core-components/package.json';\nimport { version as corePluginApi } from '../../../core-plugin-api/package.json';\nimport { version as errors } from '../../../errors/package.json';\nimport { version as integrationReact } from '../../../integration-react/package.json';\nimport { version as testUtils } from '../../../test-utils/package.json';\nimport { version as theme } from '../../../theme/package.json';\n\nimport { version as pluginApiDocs } from '../../../../plugins/api-docs/package.json';\nimport { version as pluginAppBackend } from '../../../../plugins/app-backend/package.json';\nimport { version as pluginAuthBackend } from '../../../../plugins/auth-backend/package.json';\nimport { version as pluginCatalog } from '../../../../plugins/catalog/package.json';\nimport { version as pluginCatalogCommon } from '../../../../plugins/catalog-common/package.json';\nimport { version as pluginCatalogReact } from '../../../../plugins/catalog-react/package.json';\nimport { version as pluginCatalogBackend } from '../../../../plugins/catalog-backend/package.json';\nimport { version as pluginCatalogGraph } from '../../../../plugins/catalog-graph/package.json';\nimport { version as pluginCatalogImport } from '../../../../plugins/catalog-import/package.json';\nimport { version as pluginCircleci } from '../../../../plugins/circleci/package.json';\nimport { version as pluginExplore } from '../../../../plugins/explore/package.json';\nimport { version as pluginGithubActions } from '../../../../plugins/github-actions/package.json';\nimport { version as pluginLighthouse } from '../../../../plugins/lighthouse/package.json';\nimport { version as pluginOrg } from '../../../../plugins/org/package.json';\nimport { version as pluginPermissionCommon } from '../../../../plugins/permission-common/package.json';\nimport { version as pluginPermissionReact } from '../../../../plugins/permission-react/package.json';\nimport { version as pluginPermissionNode } from '../../../../plugins/permission-node/package.json';\nimport { version as pluginProxyBackend } from '../../../../plugins/proxy-backend/package.json';\nimport { version as pluginRollbarBackend } from '../../../../plugins/rollbar-backend/package.json';\nimport { version as pluginScaffolder } from '../../../../plugins/scaffolder/package.json';\nimport { version as pluginScaffolderBackend } from '../../../../plugins/scaffolder-backend/package.json';\nimport { version as pluginSearch } from '../../../../plugins/search/package.json';\nimport { version as pluginSearchReact } from '../../../../plugins/search-react/package.json';\nimport { version as pluginSearchBackend } from '../../../../plugins/search-backend/package.json';\nimport { version as pluginSearchBackendModulePg } from '../../../../plugins/search-backend-module-pg/package.json';\nimport { version as pluginSearchBackendNode } from '../../../../plugins/search-backend-node/package.json';\nimport { version as pluginTechRadar } from '../../../../plugins/tech-radar/package.json';\nimport { version as pluginTechdocs } from '../../../../plugins/techdocs/package.json';\nimport { version as pluginTechdocsReact } from '../../../../plugins/techdocs-react/package.json';\nimport { version as pluginTechdocsModuleAddonsContrib } from '../../../../plugins/techdocs-module-addons-contrib/package.json';\nimport { version as pluginTechdocsBackend } from '../../../../plugins/techdocs-backend/package.json';\nimport { version as pluginUserSettings } from '../../../../plugins/user-settings/package.json';\n\nexport const packageVersions = {\n root,\n '@backstage/app-defaults': appDefaults,\n '@backstage/backend-common': backendCommon,\n '@backstage/backend-tasks': backendTasks,\n '@backstage/catalog-client': catalogClient,\n '@backstage/catalog-model': catalogModel,\n '@backstage/cli': cli,\n '@backstage/config': config,\n '@backstage/core-app-api': coreAppApi,\n '@backstage/core-components': coreComponents,\n '@backstage/core-plugin-api': corePluginApi,\n '@backstage/errors': errors,\n '@backstage/integration-react': integrationReact,\n '@backstage/plugin-api-docs': pluginApiDocs,\n '@backstage/plugin-app-backend': pluginAppBackend,\n '@backstage/plugin-auth-backend': pluginAuthBackend,\n '@backstage/plugin-catalog': pluginCatalog,\n '@backstage/plugin-catalog-common': pluginCatalogCommon,\n '@backstage/plugin-catalog-react': pluginCatalogReact,\n '@backstage/plugin-catalog-backend': pluginCatalogBackend,\n '@backstage/plugin-catalog-graph': pluginCatalogGraph,\n '@backstage/plugin-catalog-import': pluginCatalogImport,\n '@backstage/plugin-circleci': pluginCircleci,\n '@backstage/plugin-explore': pluginExplore,\n '@backstage/plugin-github-actions': pluginGithubActions,\n '@backstage/plugin-lighthouse': pluginLighthouse,\n '@backstage/plugin-org': pluginOrg,\n '@backstage/plugin-permission-common': pluginPermissionCommon,\n '@backstage/plugin-permission-node': pluginPermissionNode,\n '@backstage/plugin-permission-react': pluginPermissionReact,\n '@backstage/plugin-proxy-backend': pluginProxyBackend,\n '@backstage/plugin-rollbar-backend': pluginRollbarBackend,\n '@backstage/plugin-scaffolder': pluginScaffolder,\n '@backstage/plugin-scaffolder-backend': pluginScaffolderBackend,\n '@backstage/plugin-search': pluginSearch,\n '@backstage/plugin-search-react': pluginSearchReact,\n '@backstage/plugin-search-backend': pluginSearchBackend,\n '@backstage/plugin-search-backend-module-pg': pluginSearchBackendModulePg,\n '@backstage/plugin-search-backend-node': pluginSearchBackendNode,\n '@backstage/plugin-tech-radar': pluginTechRadar,\n '@backstage/plugin-techdocs': pluginTechdocs,\n '@backstage/plugin-techdocs-react': pluginTechdocsReact,\n '@backstage/plugin-techdocs-module-addons-contrib':\n pluginTechdocsModuleAddonsContrib,\n '@backstage/plugin-techdocs-backend': pluginTechdocsBackend,\n '@backstage/plugin-user-settings': pluginUserSettings,\n '@backstage/test-utils': testUtils,\n '@backstage/theme': theme,\n};\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport chalk from 'chalk';\nimport fs from 'fs-extra';\nimport handlebars from 'handlebars';\nimport ora from 'ora';\nimport recursive from 'recursive-readdir';\nimport {\n basename,\n dirname,\n resolve as resolvePath,\n relative as relativePath,\n} from 'path';\nimport { exec as execCb } from 'child_process';\nimport { packageVersions } from './versions';\nimport { promisify } from 'util';\n\nconst TASK_NAME_MAX_LENGTH = 14;\nconst exec = promisify(execCb);\n\nexport class Task {\n static log(name: string = '') {\n process.stdout.write(`${chalk.green(name)}\\n`);\n }\n\n static error(message: string = '') {\n process.stdout.write(`\\n${chalk.red(message)}\\n\\n`);\n }\n\n static section(name: string) {\n const title = chalk.green(`${name}:`);\n process.stdout.write(`\\n ${title}\\n`);\n }\n\n static exit(code: number = 0) {\n process.exit(code);\n }\n\n static async forItem(\n task: string,\n item: string,\n taskFunc: () => Promise<void>,\n ): Promise<void> {\n const paddedTask = chalk.green(task.padEnd(TASK_NAME_MAX_LENGTH));\n\n const spinner = ora({\n prefixText: chalk.green(` ${paddedTask}${chalk.cyan(item)}`),\n spinner: 'arc',\n color: 'green',\n }).start();\n\n try {\n await taskFunc();\n spinner.succeed();\n } catch (error) {\n spinner.fail();\n throw error;\n }\n }\n}\n\n/**\n * Generate a templated backstage project\n *\n * @param templateDir - location containing template files\n * @param destinationDir - location to save templated project\n * @param context - template parameters\n */\nexport async function templatingTask(\n templateDir: string,\n destinationDir: string,\n context: any,\n) {\n const files = await recursive(templateDir).catch(error => {\n throw new Error(`Failed to read template directory: ${error.message}`);\n });\n\n for (const file of files) {\n const destinationFile = resolvePath(\n destinationDir,\n relativePath(templateDir, file),\n );\n await fs.ensureDir(dirname(destinationFile));\n\n if (file.endsWith('.hbs')) {\n await Task.forItem('templating', basename(file), async () => {\n const destination = destinationFile.replace(/\\.hbs$/, '');\n\n const template = await fs.readFile(file);\n const compiled = handlebars.compile(template.toString());\n const contents = compiled(\n { name: basename(destination), ...context },\n {\n helpers: {\n version(name: keyof typeof packageVersions) {\n if (name in packageVersions) {\n return packageVersions[name];\n }\n throw new Error(`No version available for package ${name}`);\n },\n },\n },\n );\n\n await fs.writeFile(destination, contents).catch(error => {\n throw new Error(\n `Failed to create file: ${destination}: ${error.message}`,\n );\n });\n });\n } else {\n await Task.forItem('copying', basename(file), async () => {\n await fs.copyFile(file, destinationFile).catch(error => {\n const destination = destinationFile;\n throw new Error(\n `Failed to copy file to ${destination} : ${error.message}`,\n );\n });\n });\n }\n }\n}\n\n/**\n * Verify that application target does not already exist\n *\n * @param rootDir - The directory to create application folder `name`\n * @param name - The specified name of the application\n * @Throws Error - If directory with name of `destination` already exists\n */\nexport async function checkAppExistsTask(rootDir: string, name: string) {\n await Task.forItem('checking', name, async () => {\n const destination = resolvePath(rootDir, name);\n\n if (await fs.pathExists(destination)) {\n const existing = chalk.cyan(destination.replace(`${rootDir}/`, ''));\n throw new Error(\n `A directory with the same name already exists: ${existing}\\nPlease try again with a different app name`,\n );\n }\n });\n}\n\n/**\n * Verify that application `path` exists, otherwise create the directory\n *\n * @param path - target to create directory\n * @throws if `path` is a file, or `fs.mkdir` fails\n */\nexport async function checkPathExistsTask(path: string) {\n await Task.forItem('checking', path, async () => {\n try {\n await fs.mkdirs(path);\n } catch (error) {\n // will fail if a file already exists at given `path`\n throw new Error(`Failed to create app directory: ${error.message}`);\n }\n });\n}\n\n/**\n * Create a folder to store templated files\n *\n * @param tempDir - target temporary directory\n * @throws if `fs.mkdir` fails\n */\nexport async function createTemporaryAppFolderTask(tempDir: string) {\n await Task.forItem('creating', 'temporary directory', async () => {\n try {\n await fs.mkdir(tempDir);\n } catch (error) {\n throw new Error(`Failed to create temporary app directory, ${error}`);\n }\n });\n}\n\n/**\n * Run `yarn install` and `run tsc` in application directory\n *\n * @param appDir - location of application to build\n */\nexport async function buildAppTask(appDir: string) {\n const runCmd = async (cmd: string) => {\n await Task.forItem('executing', cmd, async () => {\n process.chdir(appDir);\n await exec(cmd).catch(error => {\n process.stdout.write(error.stderr);\n process.stdout.write(error.stdout);\n throw new Error(`Could not execute command ${chalk.cyan(cmd)}`);\n });\n });\n };\n\n await runCmd('yarn install');\n await runCmd('yarn tsc');\n}\n\n/**\n * Move temporary directory to destination application folder\n *\n * @param tempDir - source path to copy files from\n * @param destination - target path to copy files\n * @param id - item ID\n * @throws if `fs.move` fails\n */\nexport async function moveAppTask(\n tempDir: string,\n destination: string,\n id: string,\n) {\n await Task.forItem('moving', id, async () => {\n await fs\n .move(tempDir, destination)\n .catch(error => {\n throw new Error(\n `Failed to move app from ${tempDir} to ${destination}: ${error.message}`,\n );\n })\n .finally(() => {\n // remove temporary files on both success and failure\n fs.removeSync(tempDir);\n });\n });\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport chalk from 'chalk';\nimport { OptionValues } from 'commander';\nimport inquirer, { Answers } from 'inquirer';\nimport { resolve as resolvePath } from 'path';\nimport { findPaths } from '@backstage/cli-common';\nimport os from 'os';\nimport {\n Task,\n buildAppTask,\n checkAppExistsTask,\n checkPathExistsTask,\n createTemporaryAppFolderTask,\n moveAppTask,\n templatingTask,\n} from './lib/tasks';\n\nexport default async (opts: OptionValues): Promise<void> => {\n /* eslint-disable-next-line no-restricted-syntax */\n const paths = findPaths(__dirname);\n\n const answers: Answers = await inquirer.prompt([\n {\n type: 'input',\n name: 'name',\n message: chalk.blue('Enter a name for the app [required]'),\n validate: (value: any) => {\n if (!value) {\n return chalk.red('Please enter a name for the app');\n } else if (!/^[a-z0-9]+(-[a-z0-9]+)*$/.test(value)) {\n return chalk.red(\n 'App name must be lowercase and contain only letters, digits, and dashes.',\n );\n }\n return true;\n },\n when: (a: Answers) => {\n const envName = process.env.BACKSTAGE_APP_NAME;\n if (envName) {\n a.name = envName;\n return false;\n }\n return true;\n },\n },\n ]);\n\n const templateDir = paths.resolveOwn('templates/default-app');\n const tempDir = resolvePath(os.tmpdir(), answers.name);\n\n // Use `--path` argument as application directory when specified, otherwise\n // create a directory using `answers.name`\n const appDir = opts.path\n ? resolvePath(paths.targetDir, opts.path)\n : resolvePath(paths.targetDir, answers.name);\n\n Task.log();\n Task.log('Creating the app...');\n\n try {\n if (opts.path) {\n // Template directly to specified path\n\n Task.section('Checking that supplied path exists');\n await checkPathExistsTask(appDir);\n\n Task.section('Preparing files');\n await templatingTask(templateDir, opts.path, answers);\n } else {\n // Template to temporary location, and then move files\n\n Task.section('Checking if the directory is available');\n await checkAppExistsTask(paths.targetDir, answers.name);\n\n Task.section('Creating a temporary app directory');\n await createTemporaryAppFolderTask(tempDir);\n\n Task.section('Preparing files');\n await templatingTask(templateDir, tempDir, answers);\n\n Task.section('Moving to final location');\n await moveAppTask(tempDir, appDir, answers.name);\n }\n\n if (!opts.skipInstall) {\n Task.section('Building the app');\n await buildAppTask(appDir);\n }\n\n Task.log();\n Task.log(\n chalk.green(`🥇 Successfully created ${chalk.cyan(answers.name)}`),\n );\n Task.log();\n Task.section('All set! Now you might want to');\n Task.log(` Run the app: ${chalk.cyan(`cd ${answers.name} && yarn dev`)}`);\n Task.log(\n ' Set up the software catalog: https://backstage.io/docs/features/software-catalog/configuration',\n );\n Task.log(' Add authentication: https://backstage.io/docs/auth/');\n Task.log();\n Task.exit();\n } catch (error) {\n Task.error(String(error));\n\n Task.log('It seems that something went wrong when creating the app 🤔');\n\n Task.error('🔥 Failed to create app!');\n Task.exit(1);\n }\n};\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * A CLI that helps you create your own Backstage app\n *\n * @packageDocumentation\n */\n\nimport { program } from 'commander';\nimport { exitWithError } from './lib/errors';\nimport { version } from '../../../package.json';\nimport createApp from './createApp';\n\nconst main = (argv: string[]) => {\n program\n .name('backstage-create-app')\n .version(version)\n .description('Creates a new app in a new directory or specified path')\n .option(\n '--path [directory]',\n 'Location to store the app defaulting to a new folder with the app name',\n )\n .option(\n '--skip-install',\n 'Skip the install and builds steps after creating the app',\n )\n .action(cmd => createApp(cmd));\n\n program.parse(argv);\n};\n\nprocess.on('unhandledRejection', rejection => {\n if (rejection instanceof Error) {\n exitWithError(rejection);\n } else {\n exitWithError(new Error(`Unknown rejection: '${rejection}'`));\n }\n});\n\nmain(process.argv);\n"],"names":["chalk","root","appDefaults","backendCommon","backendTasks","catalogClient","catalogModel","cli","config","coreAppApi","coreComponents","corePluginApi","errors","integrationReact","pluginApiDocs","pluginAppBackend","pluginAuthBackend","pluginCatalog","pluginCatalogCommon","pluginCatalogReact","pluginCatalogBackend","pluginCatalogGraph","pluginCatalogImport","pluginCircleci","pluginExplore","pluginGithubActions","pluginLighthouse","pluginOrg","pluginPermissionCommon","pluginPermissionNode","pluginPermissionReact","pluginProxyBackend","pluginRollbarBackend","pluginScaffolder","pluginScaffolderBackend","pluginSearch","pluginSearchReact","pluginSearchBackend","pluginSearchBackendModulePg","pluginSearchBackendNode","pluginTechRadar","pluginTechdocs","pluginTechdocsReact","pluginTechdocsModuleAddonsContrib","pluginTechdocsBackend","pluginUserSettings","testUtils","theme","promisify","execCb","ora","recursive","resolvePath","relativePath","fs","dirname","basename","handlebars","findPaths","inquirer","os","program","version"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;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I,CAAC,OAAO,CAAC,IAAI,CAAC;;"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../src/lib/errors.ts","../src/lib/versions.ts","../src/lib/tasks.ts","../src/createApp.ts","../src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport chalk from 'chalk';\n\nexport class CustomError extends Error {\n get name(): string {\n return this.constructor.name;\n }\n}\n\nexport class ExitCodeError extends CustomError {\n readonly code: number;\n\n constructor(code: number, command?: string) {\n if (command) {\n super(`Command '${command}' exited with code ${code}`);\n } else {\n super(`Child exited with code ${code}`);\n }\n this.code = code;\n }\n}\n\nexport function exitWithError(error: Error): never {\n if (error instanceof ExitCodeError) {\n process.stderr.write(`\\n${chalk.red(error.message)}\\n\\n`);\n process.exit(error.code);\n } else {\n process.stderr.write(`\\n${chalk.red(`${error}`)}\\n\\n`);\n process.exit(1);\n }\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* eslint-disable monorepo/no-relative-import */\n\n/*\nThis is a list of all packages used by the template. If dependencies are added or removed,\nthis list should be updated as well.\n\nThere is a release step that ensures that this package is always bumped with every\nrelease, meaning these version will always be up to date.\n\nThis does not create an actual dependency on these packages and does not bring in any code.\nRelative imports are used rather than package imports to make sure the packages aren't externalized.\nRollup will extract the value of the version field in each package at build time without\nleaving any imports in place.\n*/\n\nimport { version as root } from '../../../../package.json';\n\nimport { version as appDefaults } from '../../../app-defaults/package.json';\nimport { version as backendCommon } from '../../../backend-common/package.json';\nimport { version as backendTasks } from '../../../backend-tasks/package.json';\nimport { version as catalogClient } from '../../../catalog-client/package.json';\nimport { version as catalogModel } from '../../../catalog-model/package.json';\nimport { version as cli } from '../../../cli/package.json';\nimport { version as config } from '../../../config/package.json';\nimport { version as coreAppApi } from '../../../core-app-api/package.json';\nimport { version as coreComponents } from '../../../core-components/package.json';\nimport { version as corePluginApi } from '../../../core-plugin-api/package.json';\nimport { version as errors } from '../../../errors/package.json';\nimport { version as integrationReact } from '../../../integration-react/package.json';\nimport { version as testUtils } from '../../../test-utils/package.json';\nimport { version as theme } from '../../../theme/package.json';\n\nimport { version as pluginApiDocs } from '../../../../plugins/api-docs/package.json';\nimport { version as pluginAppBackend } from '../../../../plugins/app-backend/package.json';\nimport { version as pluginAuthBackend } from '../../../../plugins/auth-backend/package.json';\nimport { version as pluginCatalog } from '../../../../plugins/catalog/package.json';\nimport { version as pluginCatalogCommon } from '../../../../plugins/catalog-common/package.json';\nimport { version as pluginCatalogReact } from '../../../../plugins/catalog-react/package.json';\nimport { version as pluginCatalogBackend } from '../../../../plugins/catalog-backend/package.json';\nimport { version as pluginCatalogGraph } from '../../../../plugins/catalog-graph/package.json';\nimport { version as pluginCatalogImport } from '../../../../plugins/catalog-import/package.json';\nimport { version as pluginCircleci } from '../../../../plugins/circleci/package.json';\nimport { version as pluginExplore } from '../../../../plugins/explore/package.json';\nimport { version as pluginGithubActions } from '../../../../plugins/github-actions/package.json';\nimport { version as pluginLighthouse } from '../../../../plugins/lighthouse/package.json';\nimport { version as pluginOrg } from '../../../../plugins/org/package.json';\nimport { version as pluginPermissionCommon } from '../../../../plugins/permission-common/package.json';\nimport { version as pluginPermissionReact } from '../../../../plugins/permission-react/package.json';\nimport { version as pluginPermissionNode } from '../../../../plugins/permission-node/package.json';\nimport { version as pluginProxyBackend } from '../../../../plugins/proxy-backend/package.json';\nimport { version as pluginRollbarBackend } from '../../../../plugins/rollbar-backend/package.json';\nimport { version as pluginScaffolder } from '../../../../plugins/scaffolder/package.json';\nimport { version as pluginScaffolderBackend } from '../../../../plugins/scaffolder-backend/package.json';\nimport { version as pluginSearch } from '../../../../plugins/search/package.json';\nimport { version as pluginSearchReact } from '../../../../plugins/search-react/package.json';\nimport { version as pluginSearchBackend } from '../../../../plugins/search-backend/package.json';\nimport { version as pluginSearchBackendModulePg } from '../../../../plugins/search-backend-module-pg/package.json';\nimport { version as pluginSearchBackendNode } from '../../../../plugins/search-backend-node/package.json';\nimport { version as pluginTechRadar } from '../../../../plugins/tech-radar/package.json';\nimport { version as pluginTechdocs } from '../../../../plugins/techdocs/package.json';\nimport { version as pluginTechdocsReact } from '../../../../plugins/techdocs-react/package.json';\nimport { version as pluginTechdocsModuleAddonsContrib } from '../../../../plugins/techdocs-module-addons-contrib/package.json';\nimport { version as pluginTechdocsBackend } from '../../../../plugins/techdocs-backend/package.json';\nimport { version as pluginUserSettings } from '../../../../plugins/user-settings/package.json';\n\nexport const packageVersions = {\n root,\n '@backstage/app-defaults': appDefaults,\n '@backstage/backend-common': backendCommon,\n '@backstage/backend-tasks': backendTasks,\n '@backstage/catalog-client': catalogClient,\n '@backstage/catalog-model': catalogModel,\n '@backstage/cli': cli,\n '@backstage/config': config,\n '@backstage/core-app-api': coreAppApi,\n '@backstage/core-components': coreComponents,\n '@backstage/core-plugin-api': corePluginApi,\n '@backstage/errors': errors,\n '@backstage/integration-react': integrationReact,\n '@backstage/plugin-api-docs': pluginApiDocs,\n '@backstage/plugin-app-backend': pluginAppBackend,\n '@backstage/plugin-auth-backend': pluginAuthBackend,\n '@backstage/plugin-catalog': pluginCatalog,\n '@backstage/plugin-catalog-common': pluginCatalogCommon,\n '@backstage/plugin-catalog-react': pluginCatalogReact,\n '@backstage/plugin-catalog-backend': pluginCatalogBackend,\n '@backstage/plugin-catalog-graph': pluginCatalogGraph,\n '@backstage/plugin-catalog-import': pluginCatalogImport,\n '@backstage/plugin-circleci': pluginCircleci,\n '@backstage/plugin-explore': pluginExplore,\n '@backstage/plugin-github-actions': pluginGithubActions,\n '@backstage/plugin-lighthouse': pluginLighthouse,\n '@backstage/plugin-org': pluginOrg,\n '@backstage/plugin-permission-common': pluginPermissionCommon,\n '@backstage/plugin-permission-node': pluginPermissionNode,\n '@backstage/plugin-permission-react': pluginPermissionReact,\n '@backstage/plugin-proxy-backend': pluginProxyBackend,\n '@backstage/plugin-rollbar-backend': pluginRollbarBackend,\n '@backstage/plugin-scaffolder': pluginScaffolder,\n '@backstage/plugin-scaffolder-backend': pluginScaffolderBackend,\n '@backstage/plugin-search': pluginSearch,\n '@backstage/plugin-search-react': pluginSearchReact,\n '@backstage/plugin-search-backend': pluginSearchBackend,\n '@backstage/plugin-search-backend-module-pg': pluginSearchBackendModulePg,\n '@backstage/plugin-search-backend-node': pluginSearchBackendNode,\n '@backstage/plugin-tech-radar': pluginTechRadar,\n '@backstage/plugin-techdocs': pluginTechdocs,\n '@backstage/plugin-techdocs-react': pluginTechdocsReact,\n '@backstage/plugin-techdocs-module-addons-contrib':\n pluginTechdocsModuleAddonsContrib,\n '@backstage/plugin-techdocs-backend': pluginTechdocsBackend,\n '@backstage/plugin-user-settings': pluginUserSettings,\n '@backstage/test-utils': testUtils,\n '@backstage/theme': theme,\n};\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport chalk from 'chalk';\nimport fs from 'fs-extra';\nimport handlebars from 'handlebars';\nimport ora from 'ora';\nimport recursive from 'recursive-readdir';\nimport {\n basename,\n dirname,\n resolve as resolvePath,\n relative as relativePath,\n} from 'path';\nimport { exec as execCb } from 'child_process';\nimport { packageVersions } from './versions';\nimport { promisify } from 'util';\n\nconst TASK_NAME_MAX_LENGTH = 14;\nconst exec = promisify(execCb);\n\nexport class Task {\n static log(name: string = '') {\n process.stdout.write(`${chalk.green(name)}\\n`);\n }\n\n static error(message: string = '') {\n process.stdout.write(`\\n${chalk.red(message)}\\n\\n`);\n }\n\n static section(name: string) {\n const title = chalk.green(`${name}:`);\n process.stdout.write(`\\n ${title}\\n`);\n }\n\n static exit(code: number = 0) {\n process.exit(code);\n }\n\n static async forItem(\n task: string,\n item: string,\n taskFunc: () => Promise<void>,\n ): Promise<void> {\n const paddedTask = chalk.green(task.padEnd(TASK_NAME_MAX_LENGTH));\n\n const spinner = ora({\n prefixText: chalk.green(` ${paddedTask}${chalk.cyan(item)}`),\n spinner: 'arc',\n color: 'green',\n }).start();\n\n try {\n await taskFunc();\n spinner.succeed();\n } catch (error) {\n spinner.fail();\n throw error;\n }\n }\n}\n\n/**\n * Generate a templated backstage project\n *\n * @param templateDir - location containing template files\n * @param destinationDir - location to save templated project\n * @param context - template parameters\n */\nexport async function templatingTask(\n templateDir: string,\n destinationDir: string,\n context: any,\n) {\n const files = await recursive(templateDir).catch(error => {\n throw new Error(`Failed to read template directory: ${error.message}`);\n });\n\n for (const file of files) {\n const destinationFile = resolvePath(\n destinationDir,\n relativePath(templateDir, file),\n );\n await fs.ensureDir(dirname(destinationFile));\n\n if (file.endsWith('.hbs')) {\n await Task.forItem('templating', basename(file), async () => {\n const destination = destinationFile.replace(/\\.hbs$/, '');\n\n const template = await fs.readFile(file);\n const compiled = handlebars.compile(template.toString());\n const contents = compiled(\n { name: basename(destination), ...context },\n {\n helpers: {\n version(name: keyof typeof packageVersions) {\n if (name in packageVersions) {\n return packageVersions[name];\n }\n throw new Error(`No version available for package ${name}`);\n },\n },\n },\n );\n\n await fs.writeFile(destination, contents).catch(error => {\n throw new Error(\n `Failed to create file: ${destination}: ${error.message}`,\n );\n });\n });\n } else {\n await Task.forItem('copying', basename(file), async () => {\n await fs.copyFile(file, destinationFile).catch(error => {\n const destination = destinationFile;\n throw new Error(\n `Failed to copy file to ${destination} : ${error.message}`,\n );\n });\n });\n }\n }\n}\n\n/**\n * Verify that application target does not already exist\n *\n * @param rootDir - The directory to create application folder `name`\n * @param name - The specified name of the application\n * @Throws Error - If directory with name of `destination` already exists\n */\nexport async function checkAppExistsTask(rootDir: string, name: string) {\n await Task.forItem('checking', name, async () => {\n const destination = resolvePath(rootDir, name);\n\n if (await fs.pathExists(destination)) {\n const existing = chalk.cyan(destination.replace(`${rootDir}/`, ''));\n throw new Error(\n `A directory with the same name already exists: ${existing}\\nPlease try again with a different app name`,\n );\n }\n });\n}\n\n/**\n * Verify that application `path` exists, otherwise create the directory\n *\n * @param path - target to create directory\n * @throws if `path` is a file, or `fs.mkdir` fails\n */\nexport async function checkPathExistsTask(path: string) {\n await Task.forItem('checking', path, async () => {\n try {\n await fs.mkdirs(path);\n } catch (error) {\n // will fail if a file already exists at given `path`\n throw new Error(`Failed to create app directory: ${error.message}`);\n }\n });\n}\n\n/**\n * Create a folder to store templated files\n *\n * @param tempDir - target temporary directory\n * @throws if `fs.mkdir` fails\n */\nexport async function createTemporaryAppFolderTask(tempDir: string) {\n await Task.forItem('creating', 'temporary directory', async () => {\n try {\n await fs.mkdir(tempDir);\n } catch (error) {\n throw new Error(`Failed to create temporary app directory, ${error}`);\n }\n });\n}\n\n/**\n * Run `yarn install` and `run tsc` in application directory\n *\n * @param appDir - location of application to build\n */\nexport async function buildAppTask(appDir: string) {\n const runCmd = async (cmd: string) => {\n await Task.forItem('executing', cmd, async () => {\n process.chdir(appDir);\n await exec(cmd).catch(error => {\n process.stdout.write(error.stderr);\n process.stdout.write(error.stdout);\n throw new Error(`Could not execute command ${chalk.cyan(cmd)}`);\n });\n });\n };\n\n await runCmd('yarn install');\n await runCmd('yarn tsc');\n}\n\n/**\n * Move temporary directory to destination application folder\n *\n * @param tempDir - source path to copy files from\n * @param destination - target path to copy files\n * @param id - item ID\n * @throws if `fs.move` fails\n */\nexport async function moveAppTask(\n tempDir: string,\n destination: string,\n id: string,\n) {\n await Task.forItem('moving', id, async () => {\n await fs\n .move(tempDir, destination)\n .catch(error => {\n throw new Error(\n `Failed to move app from ${tempDir} to ${destination}: ${error.message}`,\n );\n })\n .finally(() => {\n // remove temporary files on both success and failure\n fs.removeSync(tempDir);\n });\n });\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport chalk from 'chalk';\nimport { OptionValues } from 'commander';\nimport inquirer, { Answers } from 'inquirer';\nimport { resolve as resolvePath } from 'path';\nimport { findPaths } from '@backstage/cli-common';\nimport os from 'os';\nimport {\n Task,\n buildAppTask,\n checkAppExistsTask,\n checkPathExistsTask,\n createTemporaryAppFolderTask,\n moveAppTask,\n templatingTask,\n} from './lib/tasks';\n\nexport default async (opts: OptionValues): Promise<void> => {\n /* eslint-disable-next-line no-restricted-syntax */\n const paths = findPaths(__dirname);\n\n const answers: Answers = await inquirer.prompt([\n {\n type: 'input',\n name: 'name',\n message: chalk.blue('Enter a name for the app [required]'),\n validate: (value: any) => {\n if (!value) {\n return chalk.red('Please enter a name for the app');\n } else if (!/^[a-z0-9]+(-[a-z0-9]+)*$/.test(value)) {\n return chalk.red(\n 'App name must be lowercase and contain only letters, digits, and dashes.',\n );\n }\n return true;\n },\n when: (a: Answers) => {\n const envName = process.env.BACKSTAGE_APP_NAME;\n if (envName) {\n a.name = envName;\n return false;\n }\n return true;\n },\n },\n ]);\n\n const templateDir = paths.resolveOwn('templates/default-app');\n const tempDir = resolvePath(os.tmpdir(), answers.name);\n\n // Use `--path` argument as application directory when specified, otherwise\n // create a directory using `answers.name`\n const appDir = opts.path\n ? resolvePath(paths.targetDir, opts.path)\n : resolvePath(paths.targetDir, answers.name);\n\n Task.log();\n Task.log('Creating the app...');\n\n try {\n if (opts.path) {\n // Template directly to specified path\n\n Task.section('Checking that supplied path exists');\n await checkPathExistsTask(appDir);\n\n Task.section('Preparing files');\n await templatingTask(templateDir, opts.path, answers);\n } else {\n // Template to temporary location, and then move files\n\n Task.section('Checking if the directory is available');\n await checkAppExistsTask(paths.targetDir, answers.name);\n\n Task.section('Creating a temporary app directory');\n await createTemporaryAppFolderTask(tempDir);\n\n Task.section('Preparing files');\n await templatingTask(templateDir, tempDir, answers);\n\n Task.section('Moving to final location');\n await moveAppTask(tempDir, appDir, answers.name);\n }\n\n if (!opts.skipInstall) {\n Task.section('Building the app');\n await buildAppTask(appDir);\n }\n\n Task.log();\n Task.log(\n chalk.green(`🥇 Successfully created ${chalk.cyan(answers.name)}`),\n );\n Task.log();\n Task.section('All set! Now you might want to');\n Task.log(` Run the app: ${chalk.cyan(`cd ${answers.name} && yarn dev`)}`);\n Task.log(\n ' Set up the software catalog: https://backstage.io/docs/features/software-catalog/configuration',\n );\n Task.log(' Add authentication: https://backstage.io/docs/auth/');\n Task.log();\n Task.exit();\n } catch (error) {\n Task.error(String(error));\n\n Task.log('It seems that something went wrong when creating the app 🤔');\n\n Task.error('🔥 Failed to create app!');\n Task.exit(1);\n }\n};\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * A CLI that helps you create your own Backstage app\n *\n * @packageDocumentation\n */\n\nimport { program } from 'commander';\nimport { exitWithError } from './lib/errors';\nimport { version } from '../../../package.json';\nimport createApp from './createApp';\n\nconst main = (argv: string[]) => {\n program\n .name('backstage-create-app')\n .version(version)\n .description('Creates a new app in a new directory or specified path')\n .option(\n '--path [directory]',\n 'Location to store the app defaulting to a new folder with the app name',\n )\n .option(\n '--skip-install',\n 'Skip the install and builds steps after creating the app',\n )\n .action(cmd => createApp(cmd));\n\n program.parse(argv);\n};\n\nprocess.on('unhandledRejection', rejection => {\n if (rejection instanceof Error) {\n exitWithError(rejection);\n } else {\n exitWithError(new Error(`Unknown rejection: '${rejection}'`));\n }\n});\n\nmain(process.argv);\n"],"names":["chalk","root","appDefaults","backendCommon","backendTasks","catalogClient","catalogModel","cli","config","coreAppApi","coreComponents","corePluginApi","errors","integrationReact","pluginApiDocs","pluginAppBackend","pluginAuthBackend","pluginCatalog","pluginCatalogCommon","pluginCatalogReact","pluginCatalogBackend","pluginCatalogGraph","pluginCatalogImport","pluginCircleci","pluginExplore","pluginGithubActions","pluginLighthouse","pluginOrg","pluginPermissionCommon","pluginPermissionNode","pluginPermissionReact","pluginProxyBackend","pluginRollbarBackend","pluginScaffolder","pluginScaffolderBackend","pluginSearch","pluginSearchReact","pluginSearchBackend","pluginSearchBackendModulePg","pluginSearchBackendNode","pluginTechRadar","pluginTechdocs","pluginTechdocsReact","pluginTechdocsModuleAddonsContrib","pluginTechdocsBackend","pluginUserSettings","testUtils","theme","promisify","execCb","ora","recursive","resolvePath","relativePath","fs","dirname","basename","handlebars","findPaths","inquirer","os","program","version"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAkBO,MAAM,oBAAoB,KAAM,CAAA;AAAA,EACrC,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AA,GAED,CAAA,MAAA;AAAA,IACC,gBAAA;AAAA,IACA,0DAAA;AAAA,GAED,CAAA,MAAA,CAAO,CAAO,GAAA,KAAA,SAAA,CAAU,GAAG,CAAC,CAAA,CAAA;AAE/B,EAAAD,iBAAA,CAAQ,MAAM,IAAI,CAAA,CAAA;AACpB,CAAA,CAAA;AAEA,OAAQ,CAAA,EAAA,CAAG,sBAAsB,CAAa,SAAA,KAAA;AAC5C,EAAA,IAAI,qBAAqB,KAAO,EAAA;AAC9B,IAAA,aAAA,CAAc,SAAS,CAAA,CAAA;AAAA,GAClB,MAAA;AACL,IAAA,aAAA,CAAc,IAAI,KAAA,CAAM,CAAuB,oBAAA,EAAA,SAAA,CAAA,CAAA,CAAY,CAAC,CAAA,CAAA;AAAA,GAC9D;AACF,CAAC,CAAA,CAAA;AAED,IAAA,CAAK,QAAQ,IAAI,CAAA;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@backstage/create-app",
3
3
  "description": "A CLI that helps you create your own Backstage app",
4
- "version": "0.4.30-next.3",
4
+ "version": "0.4.31-next.1",
5
5
  "private": false,
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -60,5 +60,5 @@
60
60
  "dist",
61
61
  "templates"
62
62
  ],
63
- "gitHead": "9b7d23351cdbe29fb16060f6f9e8442932d3fa29"
63
+ "gitHead": "64f2e93089b61902a3302933dfec197deb10506c"
64
64
  }
@@ -26,7 +26,7 @@ backend:
26
26
  origin: http://localhost:3000
27
27
  methods: [GET, HEAD, PATCH, POST, PUT, DELETE]
28
28
  credentials: true
29
- # This is for local developement only, it is not recommended to use this in production
29
+ # This is for local development only, it is not recommended to use this in production
30
30
  # The production database configuration is stored in app-config.production.yaml
31
31
  database:
32
32
  client: better-sqlite3
@@ -324,7 +324,10 @@ const systemPage = (
324
324
  <Grid item md={6} xs={12}>
325
325
  <EntityCatalogGraphCard variant="gridItem" height={400} />
326
326
  </Grid>
327
- <Grid item md={6}>
327
+ <Grid item md={4} xs={12}>
328
+ <EntityLinksCard />
329
+ </Grid>
330
+ <Grid item md={8}>
328
331
  <EntityHasComponentsCard variant="gridItem" />
329
332
  </Grid>
330
333
  <Grid item md={6}>
@@ -11,24 +11,30 @@
11
11
 
12
12
  FROM node:16-bullseye-slim
13
13
 
14
- WORKDIR /app
15
-
16
- # install sqlite3 dependencies, you can skip this if you don't use sqlite3 in the image
14
+ # Install sqlite3 dependencies. You can skip this if you don't use sqlite3 in the image,
15
+ # in which case you should also move better-sqlite3 to "devDependencies" in package.json.
17
16
  RUN apt-get update && \
18
17
  apt-get install -y --no-install-recommends libsqlite3-dev python3 build-essential && \
19
18
  rm -rf /var/lib/apt/lists/* && \
20
19
  yarn config set python /usr/bin/python3
21
20
 
21
+ # From here on we use the least-privileged `node` user to run the backend.
22
+ USER node
23
+ WORKDIR /app
24
+
25
+ # This switches many Node.js dependencies to production mode.
26
+ ENV NODE_ENV production
27
+
22
28
  # Copy repo skeleton first, to avoid unnecessary docker cache invalidation.
23
29
  # The skeleton contains the package.json of each package in the monorepo,
24
30
  # and along with yarn.lock and the root package.json, that's enough to run yarn install.
25
- COPY yarn.lock package.json packages/backend/dist/skeleton.tar.gz ./
31
+ COPY --chown=node:node yarn.lock package.json packages/backend/dist/skeleton.tar.gz ./
26
32
  RUN tar xzf skeleton.tar.gz && rm skeleton.tar.gz
27
33
 
28
34
  RUN yarn install --frozen-lockfile --production --network-timeout 300000 && rm -rf "$(yarn cache dir)"
29
35
 
30
36
  # Then copy the rest of the backend bundle, along with any other files we might want.
31
- COPY packages/backend/dist/bundle.tar.gz app-config*.yaml ./
37
+ COPY --chown=node:node packages/backend/dist/bundle.tar.gz app-config*.yaml ./
32
38
  RUN tar xzf bundle.tar.gz && rm bundle.tar.gz
33
39
 
34
40
  CMD ["node", "packages/backend", "--config", "app-config.yaml", "--config", "app-config.production.yaml"]
@@ -33,6 +33,7 @@
33
33
  "@backstage/plugin-search-backend-module-pg": "^{{version '@backstage/plugin-search-backend-module-pg'}}",
34
34
  "@backstage/plugin-search-backend-node": "^{{version '@backstage/plugin-search-backend-node'}}",
35
35
  "@backstage/plugin-techdocs-backend": "^{{version '@backstage/plugin-techdocs-backend'}}",
36
+ "better-sqlite3": "^7.5.0",
36
37
  "dockerode": "^3.3.1",
37
38
  "express": "^4.17.1",
38
39
  "express-promise-router": "^4.1.0",
@@ -44,8 +45,7 @@
44
45
  "@types/dockerode": "^3.3.0",
45
46
  "@types/express-serve-static-core": "^4.17.5",
46
47
  "@types/express": "^4.17.6",
47
- "@types/luxon": "^2.0.4",
48
- "better-sqlite3": "^7.5.0"
48
+ "@types/luxon": "^2.0.4"
49
49
  },
50
50
  "files": [
51
51
  "dist"
@@ -36,7 +36,7 @@ function makeCreateEnv(config: Config) {
36
36
  const reader = UrlReaders.default({ logger: root, config });
37
37
  const discovery = SingleHostDiscovery.fromConfig(config);
38
38
  const cacheManager = CacheManager.fromConfig(config);
39
- const databaseManager = DatabaseManager.fromConfig(config);
39
+ const databaseManager = DatabaseManager.fromConfig(config, { logger: root });
40
40
  const tokenManager = ServerTokenManager.noop();
41
41
  const taskScheduler = TaskScheduler.fromConfig(config);
42
42
  const permissions = ServerPermissionClient.fromConfig(config, {
@@ -104,6 +104,6 @@ async function main() {
104
104
 
105
105
  module.hot?.accept();
106
106
  main().catch(error => {
107
- console.error(`Backend failed to start up, ${error}`);
107
+ console.error('Backend failed to start up', error);
108
108
  process.exit(1);
109
109
  });
@@ -25,7 +25,7 @@ export default async function createPlugin(
25
25
  // This particular resolver makes all users share a single "guest" identity.
26
26
  // It should only be used for testing and trying out Backstage.
27
27
  //
28
- // If you want to use a production ready resolver you can switch to the
28
+ // If you want to use a production ready resolver you can switch to
29
29
  // the one that is commented out below, it looks up a user entity in the
30
30
  // catalog using the GitHub username of the authenticated user.
31
31
  // That resolver requires you to have user entities populated in the catalog,