@backstage/create-app 0.4.31 → 0.4.32-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,42 @@
1
1
  # @backstage/create-app
2
2
 
3
+ ## 0.4.32-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 7c6306fc8a: Initializes a git repository when creating an app using @packages/create-app
8
+ - Updated dependencies
9
+ - @backstage/cli-common@0.1.10
10
+
11
+ ## 0.4.32-next.0
12
+
13
+ ### Patch Changes
14
+
15
+ - 58c2264325: Newly created Backstage repositories now use the stable version 6 of
16
+ `react-router`, just like the main repo does. Please let us know if you find any
17
+ issues with this.
18
+
19
+ Migrating to the stable version of `react-router` is optional for the time
20
+ being. But if you want to do the same for your existing repository, please
21
+ follow [this
22
+ guide](https://backstage.io/docs/tutorials/react-router-stable-migration).
23
+
24
+ - e05e0f021b: Update versions of packages used in the create-app template, to match those in the main repo
25
+ - 52f25858a8: Added `*.session.sql` Visual Studio Code database functionality files to `.gitignore` in the default template. This is optional but potentially helpful if your developers use Visual Studio Code; you can add a line with that exact value to your own root `.gitignore` if you want the same.
26
+ - 6d00e80146: Updated the root `test` scripts to use `backstage-cli repo test`.
27
+
28
+ To apply this change to an existing app, make the following change to the root `package.json`:
29
+
30
+ ```diff
31
+ - "test": "backstage-cli test",
32
+ - "test:all": "lerna run test -- --coverage",
33
+ + "test": "backstage-cli repo test",
34
+ + "test:all": "backstage-cli repo test --coverage",
35
+ ```
36
+
37
+ - Updated dependencies
38
+ - @backstage/cli-common@0.1.10
39
+
3
40
  ## 0.4.31
4
41
 
5
42
  ### Patch Changes
package/dist/index.cjs.js CHANGED
@@ -12,6 +12,7 @@ var ora = require('ora');
12
12
  var recursive = require('recursive-readdir');
13
13
  var child_process = require('child_process');
14
14
  var util = require('util');
15
+ var commandExists = require('command-exists');
15
16
 
16
17
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
17
18
 
@@ -22,6 +23,7 @@ var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
22
23
  var handlebars__default = /*#__PURE__*/_interopDefaultLegacy(handlebars);
23
24
  var ora__default = /*#__PURE__*/_interopDefaultLegacy(ora);
24
25
  var recursive__default = /*#__PURE__*/_interopDefaultLegacy(recursive);
26
+ var commandExists__default = /*#__PURE__*/_interopDefaultLegacy(commandExists);
25
27
 
26
28
  class CustomError extends Error {
27
29
  get name() {
@@ -57,101 +59,101 @@ ${chalk__default["default"].red(`${error}`)}
57
59
  }
58
60
  }
59
61
 
60
- var version$L = "1.6.0";
62
+ var version$L = "1.7.0-next.1";
61
63
 
62
- var version$K = "1.0.6";
64
+ var version$K = "1.0.7-next.1";
63
65
 
64
- var version$J = "0.15.1";
66
+ var version$J = "0.15.2-next.1";
65
67
 
66
- var version$I = "0.3.5";
68
+ var version$I = "0.3.6-next.1";
67
69
 
68
- var version$H = "1.1.0";
70
+ var version$H = "1.1.1-next.1";
69
71
 
70
- var version$G = "1.1.1";
72
+ var version$G = "1.1.2-next.1";
71
73
 
72
- var version$F = "0.19.0";
74
+ var version$F = "0.20.0-next.1";
73
75
 
74
- var version$E = "1.0.2";
76
+ var version$E = "1.0.3-next.1";
75
77
 
76
- var version$D = "1.1.0";
78
+ var version$D = "1.1.1-next.1";
77
79
 
78
- var version$C = "0.11.1";
80
+ var version$C = "0.11.2-next.1";
79
81
 
80
- var version$B = "1.0.6";
82
+ var version$B = "1.0.7-next.1";
81
83
 
82
- var version$A = "1.1.1";
84
+ var version$A = "1.1.2-next.1";
83
85
 
84
- var version$z = "1.1.4";
86
+ var version$z = "1.1.5-next.1";
85
87
 
86
- var version$y = "1.2.0";
88
+ var version$y = "1.2.1-next.1";
87
89
 
88
90
  var version$x = "0.2.16";
89
91
 
90
- var version$w = "0.8.9";
92
+ var version$w = "0.8.10-next.1";
91
93
 
92
- var version$v = "0.3.36";
94
+ var version$v = "0.3.37-next.1";
93
95
 
94
- var version$u = "0.16.0";
96
+ var version$u = "0.17.0-next.1";
95
97
 
96
- var version$t = "0.2.5";
98
+ var version$t = "0.2.6-next.1";
97
99
 
98
- var version$s = "1.5.1";
100
+ var version$s = "1.6.0-next.1";
99
101
 
100
- var version$r = "1.0.6";
102
+ var version$r = "1.0.7-next.1";
101
103
 
102
- var version$q = "1.1.4";
104
+ var version$q = "1.2.0-next.1";
103
105
 
104
- var version$p = "1.4.0";
106
+ var version$p = "1.4.1-next.1";
105
107
 
106
- var version$o = "0.2.21";
108
+ var version$o = "0.2.22-next.1";
107
109
 
108
- var version$n = "0.8.12";
110
+ var version$n = "0.8.13-next.1";
109
111
 
110
- var version$m = "0.3.9";
112
+ var version$m = "0.3.10-next.1";
111
113
 
112
- var version$l = "0.3.40";
114
+ var version$l = "0.3.41-next.1";
113
115
 
114
- var version$k = "0.5.9";
116
+ var version$k = "0.5.10-next.1";
115
117
 
116
- var version$j = "0.3.9";
118
+ var version$j = "0.3.10-next.1";
117
119
 
118
- var version$i = "0.5.9";
120
+ var version$i = "0.5.10-next.1";
119
121
 
120
- var version$h = "0.6.4";
122
+ var version$h = "0.6.5-next.1";
121
123
 
122
- var version$g = "0.4.5";
124
+ var version$g = "0.4.6-next.1";
123
125
 
124
- var version$f = "0.6.5";
126
+ var version$f = "0.6.6-next.1";
125
127
 
126
- var version$e = "0.2.30";
128
+ var version$e = "0.2.31-next.1";
127
129
 
128
- var version$d = "0.1.33";
130
+ var version$d = "0.1.34-next.1";
129
131
 
130
- var version$c = "1.6.0";
132
+ var version$c = "1.7.0-next.1";
131
133
 
132
- var version$b = "1.6.0";
134
+ var version$b = "1.7.0-next.1";
133
135
 
134
- var version$a = "1.0.2";
136
+ var version$a = "1.0.3-next.1";
135
137
 
136
- var version$9 = "1.1.0";
138
+ var version$9 = "1.2.0-next.1";
137
139
 
138
- var version$8 = "1.0.2";
140
+ var version$8 = "1.1.0-next.1";
139
141
 
140
- var version$7 = "0.4.0";
142
+ var version$7 = "0.4.1-next.1";
141
143
 
142
- var version$6 = "1.0.2";
144
+ var version$6 = "1.0.3-next.1";
143
145
 
144
- var version$5 = "0.5.16";
146
+ var version$5 = "0.5.17-next.1";
145
147
 
146
- var version$4 = "1.3.2";
148
+ var version$4 = "1.3.3-next.1";
147
149
 
148
- var version$3 = "1.0.4";
150
+ var version$3 = "1.0.5-next.1";
149
151
 
150
- var version$2 = "1.0.4";
152
+ var version$2 = "1.0.5-next.1";
151
153
 
152
- var version$1 = "1.3.0";
154
+ var version$1 = "1.3.1-next.1";
153
155
 
154
- var version = "0.4.8";
156
+ var version = "0.5.0-next.1";
155
157
 
156
158
  const packageVersions = {
157
159
  root: version$L,
@@ -343,8 +345,60 @@ async function moveAppTask(tempDir, destination, id) {
343
345
  });
344
346
  });
345
347
  }
348
+ async function readGitConfig() {
349
+ var _a, _b, _c, _d, _e;
350
+ const tempDir = path.resolve(os__default["default"].tmpdir(), "git-temp-dir");
351
+ const runCmd = (cmd) => exec(cmd, { cwd: tempDir }).catch((error) => {
352
+ process.stdout.write(error.stderr);
353
+ process.stdout.write(error.stdout);
354
+ throw new Error(`Could not execute command ${chalk__default["default"].cyan(cmd)}`);
355
+ });
356
+ const isGitAvailable = await commandExists__default["default"]("git").catch(() => false);
357
+ if (!isGitAvailable)
358
+ return {};
359
+ try {
360
+ await fs__default["default"].mkdir(tempDir);
361
+ const [gitUsername, gitEmail] = await Promise.all([
362
+ runCmd("git config user.name"),
363
+ runCmd("git config user.email")
364
+ ]);
365
+ const gitCredentials = Boolean(
366
+ ((_a = gitUsername.stdout) == null ? void 0 : _a.trim()) && ((_b = gitEmail.stdout) == null ? void 0 : _b.trim())
367
+ );
368
+ if (!gitCredentials)
369
+ return {};
370
+ await runCmd("git init");
371
+ await runCmd('git commit --allow-empty -m "Initial commit"');
372
+ const gitDefaultBranch = await runCmd(
373
+ 'git branch --format="%(refname:short)"'
374
+ );
375
+ return {
376
+ name: (_c = gitUsername.stdout) == null ? void 0 : _c.trim(),
377
+ email: (_d = gitEmail.stdout) == null ? void 0 : _d.trim(),
378
+ defaultBranch: (_e = gitDefaultBranch.stdout) == null ? void 0 : _e.trim()
379
+ };
380
+ } catch (error) {
381
+ throw new Error(`Failed to read git config, ${error}`);
382
+ } finally {
383
+ await fs__default["default"].rm(tempDir, { recursive: true });
384
+ }
385
+ }
386
+ async function initGitRepository(dir) {
387
+ const runCmd = (cmd) => exec(cmd).catch((error) => {
388
+ process.stdout.write(error.stderr);
389
+ process.stdout.write(error.stdout);
390
+ throw new Error(`Could not execute command ${chalk__default["default"].cyan(cmd)}`);
391
+ });
392
+ await Task.forItem("init", "git repository", async () => {
393
+ process.chdir(dir);
394
+ await runCmd("git init");
395
+ await runCmd('git commit --allow-empty -m "Initial commit"');
396
+ });
397
+ }
346
398
 
399
+ const DEFAULT_BRANCH = "master";
347
400
  var createApp = async (opts) => {
401
+ var _a, _b;
348
402
  const paths = cliCommon.findPaths(__dirname);
349
403
  const answers = await inquirer__default["default"].prompt([
350
404
  {
@@ -377,21 +431,32 @@ var createApp = async (opts) => {
377
431
  Task.log();
378
432
  Task.log("Creating the app...");
379
433
  try {
434
+ const gitConfig = await readGitConfig();
380
435
  if (opts.path) {
381
436
  Task.section("Checking that supplied path exists");
382
437
  await checkPathExistsTask(appDir);
383
438
  Task.section("Preparing files");
384
- await templatingTask(templateDir, opts.path, answers);
439
+ await templatingTask(templateDir, opts.path, {
440
+ ...answers,
441
+ defaultBranch: (_a = gitConfig == null ? void 0 : gitConfig.defaultBranch) != null ? _a : DEFAULT_BRANCH
442
+ });
385
443
  } else {
386
444
  Task.section("Checking if the directory is available");
387
445
  await checkAppExistsTask(paths.targetDir, answers.name);
388
446
  Task.section("Creating a temporary app directory");
389
447
  await createTemporaryAppFolderTask(tempDir);
390
448
  Task.section("Preparing files");
391
- await templatingTask(templateDir, tempDir, answers);
449
+ await templatingTask(templateDir, tempDir, {
450
+ ...answers,
451
+ defaultBranch: (_b = gitConfig == null ? void 0 : gitConfig.defaultBranch) != null ? _b : DEFAULT_BRANCH
452
+ });
392
453
  Task.section("Moving to final location");
393
454
  await moveAppTask(tempDir, appDir, answers.name);
394
455
  }
456
+ if ((gitConfig == null ? void 0 : gitConfig.name) && (gitConfig == null ? void 0 : gitConfig.email)) {
457
+ Task.section("Initializing git repository");
458
+ await initGitRepository(appDir);
459
+ }
395
460
  if (!opts.skipInstall) {
396
461
  Task.section("Building the app");
397
462
  await buildAppTask(appDir);
@@ -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 pluginAuthNode } from '../../../../plugins/auth-node/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-auth-node': pluginAuthNode,\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","pluginAuthNode","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,IAAI,IAAe,GAAA;AACjB,IAAA,OAAO,KAAK,WAAY,CAAA,IAAA,CAAA;AAAA,GAC1B;AACF,CAAA;AAEO,MAAM,sBAAsB,WAAY,CAAA;AAAA,EAG7C,WAAA,CAAY,MAAc,OAAkB,EAAA;AAAA,IAAA,IAAA,OAAA,GAAA,CAAA,GAAA,IAAA,KAAA;AAAA,MAAA,KAAA,CAAA,GAAA,IAAA,CAAA,CAAA;AAAA,KAAA,CAAA;AAC1C,IAAA,IAAI,OAAS,EAAA;AACX,MAAM,OAAA,CAAA,CAAA,SAAA,EAAY,6BAA6B,IAAM,CAAA,CAAA,CAAA,CAAA;AAAA,KAChD,MAAA;AACL,MAAA,OAAA,CAAM,0BAA0B,IAAM,CAAA,CAAA,CAAA,CAAA;AAAA,KACxC;AACA,IAAA,IAAA,CAAK,IAAO,GAAA,IAAA,CAAA;AAAA,GACd;AACF,CAAA;AAEO,SAAS,cAAc,KAAqB,EAAA;AACjD,EAAA,IAAI,iBAAiB,aAAe,EAAA;AAClC,IAAA,OAAA,CAAQ,OAAO,KAAM,CAAA,CAAA;AAAA,EAAKA,yBAAA,CAAM,GAAI,CAAA,KAAA,CAAM,OAAO,CAAA,CAAA;AAAA;AAAA,CAAO,CAAA,CAAA;AACxD,IAAQ,OAAA,CAAA,IAAA,CAAK,MAAM,IAAI,CAAA,CAAA;AAAA,GAClB,MAAA;AACL,IAAA,OAAA,CAAQ,OAAO,KAAM,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AAA,IAAA,CAAK,IAAI,oEAA6D,CAAA,CAAA;AAEtE,IAAA,IAAA,CAAK,MAAM,kCAA2B,CAAA,CAAA;AACtC,IAAA,IAAA,CAAK,KAAK,CAAC,CAAA,CAAA;AAAA,GACb;AACF,CAAA;;AClGA,MAAM,IAAA,GAAO,CAAC,IAAmB,KAAA;AAC/B,EACG8D,iBAAA,CAAA,IAAA,CAAK,sBAAsB,CAC3B,CAAA,OAAA,CAAQC,SAAO,CACf,CAAA,WAAA,CAAY,wDAAwD,CACpE,CAAA,MAAA;AAAA,IACC,oBAAA;AAAA,IACA,wEAAA;AAAA,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;;"}
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 pluginAuthNode } from '../../../../plugins/auth-node/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-auth-node': pluginAuthNode,\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';\nimport commandExists from 'command-exists';\nimport os from 'os';\n\nconst TASK_NAME_MAX_LENGTH = 14;\nconst exec = promisify(execCb);\n\nexport type GitConfig = {\n name?: string;\n email?: string;\n defaultBranch?: string;\n};\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/**\n * Read git configs by creating a temp folder and initializing a repo\n *\n * @throws if `exec` fails\n */\nexport async function readGitConfig(): Promise<GitConfig> {\n const tempDir = resolvePath(os.tmpdir(), 'git-temp-dir');\n\n const runCmd = (cmd: string) =>\n exec(cmd, { cwd: tempDir }).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 const isGitAvailable = await commandExists('git').catch(() => false);\n\n if (!isGitAvailable) return {};\n\n try {\n await fs.mkdir(tempDir);\n\n const [gitUsername, gitEmail] = await Promise.all([\n runCmd('git config user.name'),\n runCmd('git config user.email'),\n ]);\n\n const gitCredentials = Boolean(\n gitUsername.stdout?.trim() && gitEmail.stdout?.trim(),\n );\n\n if (!gitCredentials) return {};\n\n await runCmd('git init');\n await runCmd('git commit --allow-empty -m \"Initial commit\"');\n\n const gitDefaultBranch = await runCmd(\n 'git branch --format=\"%(refname:short)\"',\n );\n\n return {\n name: gitUsername.stdout?.trim(),\n email: gitEmail.stdout?.trim(),\n defaultBranch: gitDefaultBranch.stdout?.trim(),\n };\n } catch (error) {\n throw new Error(`Failed to read git config, ${error}`);\n } finally {\n await fs.rm(tempDir, { recursive: true });\n }\n}\n\n/**\n * Initializes a git repository in the destination folder\n *\n * @param dir - source path to initialize git repository in\n * @throws if `exec` fails\n */\nexport async function initGitRepository(dir: string) {\n const runCmd = (cmd: string) =>\n 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 await Task.forItem('init', 'git repository', async () => {\n process.chdir(dir);\n\n await runCmd('git init');\n await runCmd('git commit --allow-empty -m \"Initial commit\"');\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 initGitRepository,\n readGitConfig,\n} from './lib/tasks';\n\nconst DEFAULT_BRANCH = 'master';\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 const gitConfig = await readGitConfig();\n\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, {\n ...answers,\n defaultBranch: gitConfig?.defaultBranch ?? DEFAULT_BRANCH,\n });\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, {\n ...answers,\n defaultBranch: gitConfig?.defaultBranch ?? DEFAULT_BRANCH,\n });\n\n Task.section('Moving to final location');\n await moveAppTask(tempDir, appDir, answers.name);\n }\n\n if (gitConfig?.name && gitConfig?.email) {\n Task.section('Initializing git repository');\n await initGitRepository(appDir);\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","pluginAuthNode","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","os","commandExists","findPaths","inquirer","program","version"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBO,MAAM,oBAAoB,KAAM,CAAA;AAAA,EACrC,IAAI,IAAe,GAAA;AACjB,IAAA,OAAO,KAAK,WAAY,CAAA,IAAA,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U,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.31",
4
+ "version": "0.4.32-next.1",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -29,11 +29,12 @@
29
29
  "clean": "backstage-cli package clean",
30
30
  "prepack": "node scripts/prepack.js",
31
31
  "postpack": "node scripts/postpack.js",
32
- "start": "nodemon --"
32
+ "start": "yarn nodemon --"
33
33
  },
34
34
  "dependencies": {
35
35
  "@backstage/cli-common": "^0.1.10",
36
36
  "chalk": "^4.0.0",
37
+ "command-exists": "^1.2.9",
37
38
  "commander": "^9.1.0",
38
39
  "fs-extra": "10.1.0",
39
40
  "handlebars": "^4.7.3",
@@ -42,12 +43,14 @@
42
43
  "recursive-readdir": "^2.2.2"
43
44
  },
44
45
  "devDependencies": {
45
- "@backstage/cli": "^0.19.0",
46
+ "@backstage/cli": "^0.20.0-next.1",
47
+ "@types/command-exists": "^1.2.0",
46
48
  "@types/fs-extra": "^9.0.1",
47
49
  "@types/inquirer": "^8.1.3",
48
50
  "@types/node": "^16.11.26",
49
51
  "@types/recursive-readdir": "^2.2.0",
50
52
  "mock-fs": "^5.1.1",
53
+ "nodemon": "^2.0.2",
51
54
  "ts-node": "^10.0.0"
52
55
  },
53
56
  "nodemonConfig": {
@@ -59,6 +62,5 @@
59
62
  "bin",
60
63
  "dist",
61
64
  "templates"
62
- ],
63
- "gitHead": "25b94e63455f1fb170506f9e84e3f430f4b79406"
64
- }
65
+ ]
66
+ }
@@ -46,3 +46,6 @@ site
46
46
 
47
47
  # Sensitive credentials
48
48
  *-credentials.yaml
49
+
50
+ # vscode database functionality support files
51
+ *.session.sql
@@ -14,9 +14,9 @@
14
14
  "tsc": "tsc",
15
15
  "tsc:full": "tsc --skipLibCheck false --incremental false",
16
16
  "clean": "backstage-cli repo clean",
17
- "test": "backstage-cli test",
18
- "test:all": "lerna run test -- --coverage",
19
- "lint": "backstage-cli repo lint --since origin/master",
17
+ "test": "backstage-cli repo test",
18
+ "test:all": "backstage-cli repo test --coverage",
19
+ "lint": "backstage-cli repo lint --since origin/{{defaultBranch}}",
20
20
  "lint:all": "backstage-cli repo lint",
21
21
  "prettier:check": "prettier --check .",
22
22
  "create-plugin": "backstage-cli create-plugin --scope internal",
@@ -6,6 +6,17 @@
6
6
  "backstage": {
7
7
  "role": "frontend"
8
8
  },
9
+ "scripts": {
10
+ "start": "backstage-cli package start",
11
+ "build": "backstage-cli package build",
12
+ "clean": "backstage-cli package clean",
13
+ "test": "backstage-cli package test",
14
+ "lint": "backstage-cli package lint",
15
+ "test:e2e": "cross-env PORT=3001 start-server-and-test start http://localhost:3001 cy:dev",
16
+ "test:e2e:ci": "cross-env PORT=3001 start-server-and-test start http://localhost:3001 cy:run",
17
+ "cy:dev": "cypress open",
18
+ "cy:run": "cypress run --browser chrome"
19
+ },
9
20
  "dependencies": {
10
21
  "@backstage/app-defaults": "^{{version '@backstage/app-defaults'}}",
11
22
  "@backstage/catalog-model": "^{{version '@backstage/catalog-model'}}",
@@ -37,33 +48,22 @@
37
48
  "history": "^5.0.0",
38
49
  "react": "^17.0.2",
39
50
  "react-dom": "^17.0.2",
40
- "react-router": "6.0.0-beta.0",
41
- "react-router-dom": "6.0.0-beta.0",
42
- "react-use": "^15.3.3"
51
+ "react-router": "^6.3.0",
52
+ "react-router-dom": "^6.3.0",
53
+ "react-use": "^17.2.4"
43
54
  },
44
55
  "devDependencies": {
45
56
  "@backstage/test-utils": "^{{version '@backstage/test-utils'}}",
46
57
  "@testing-library/jest-dom": "^5.10.1",
47
58
  "@testing-library/react": "^12.1.3",
48
- "@testing-library/user-event": "^12.0.7",
49
- "@types/node": "^14.14.32",
59
+ "@testing-library/user-event": "^14.0.0",
60
+ "@types/node": "^16.11.26",
50
61
  "@types/react-dom": "*",
51
62
  "cross-env": "^7.0.0",
52
63
  "cypress": "^9.7.0",
53
64
  "eslint-plugin-cypress": "^2.10.3",
54
65
  "start-server-and-test": "^1.10.11"
55
66
  },
56
- "scripts": {
57
- "start": "backstage-cli package start",
58
- "build": "backstage-cli package build",
59
- "clean": "backstage-cli package clean",
60
- "test": "backstage-cli package test",
61
- "lint": "backstage-cli package lint",
62
- "test:e2e": "cross-env PORT=3001 start-server-and-test start http://localhost:3001 cy:dev",
63
- "test:e2e:ci": "cross-env PORT=3001 start-server-and-test start http://localhost:3001 cy:run",
64
- "cy:dev": "cypress open",
65
- "cy:run": "cypress run --browser chrome"
66
- },
67
67
  "browserslist": {
68
68
  "production": [
69
69
  ">0.2%",
@@ -31,7 +31,7 @@ import { AlertDisplay, OAuthRequestDialog } from '@backstage/core-components';
31
31
  import { createApp } from '@backstage/app-defaults';
32
32
  import { FlatRoutes } from '@backstage/core-app-api';
33
33
  import { CatalogGraphPage } from '@backstage/plugin-catalog-graph';
34
- import { PermissionedRoute } from '@backstage/plugin-permission-react';
34
+ import { RequirePermission } from '@backstage/plugin-permission-react';
35
35
  import { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common/alpha';
36
36
 
37
37
  const app = createApp({
@@ -58,7 +58,7 @@ const AppRouter = app.getRouter();
58
58
 
59
59
  const routes = (
60
60
  <FlatRoutes>
61
- <Navigate key="/" to="catalog" />
61
+ <Route path="/" element={<Navigate to="/catalog" />} />
62
62
  <Route path="/catalog" element={<CatalogIndexPage />} />
63
63
  <Route
64
64
  path="/catalog/:namespace/:kind/:name"
@@ -81,10 +81,13 @@ const routes = (
81
81
  path="/tech-radar"
82
82
  element={<TechRadarPage width={1500} height={800} />}
83
83
  />
84
- <PermissionedRoute
84
+ <Route
85
85
  path="/catalog-import"
86
- permission={catalogEntityCreatePermission}
87
- element={<CatalogImportPage />}
86
+ element={
87
+ <RequirePermission permission={catalogEntityCreatePermission}>
88
+ <CatalogImportPage />
89
+ </RequirePermission>
90
+ }
88
91
  />
89
92
  <Route path="/search" element={<SearchPage />}>
90
93
  {searchPage}
@@ -1,19 +1,3 @@
1
- /*
2
- * Copyright 2020 The Backstage Authors
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
1
  import React from 'react';
18
2
  import { makeStyles } from '@material-ui/core';
19
3
 
@@ -1,19 +1,3 @@
1
- /*
2
- * Copyright 2020 The Backstage Authors
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
1
  import React from 'react';
18
2
  import { makeStyles } from '@material-ui/core';
19
3
 
@@ -1,19 +1,3 @@
1
- /*
2
- * Copyright 2020 The Backstage Authors
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
1
  import React, { PropsWithChildren } from 'react';
18
2
  import { Link, makeStyles } from '@material-ui/core';
19
3
  import HomeIcon from '@material-ui/icons/Home';
@@ -1,17 +1 @@
1
- /*
2
- * Copyright 2020 The Backstage Authors
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
1
  export { Root } from './Root';
@@ -1,18 +1,3 @@
1
- /*
2
- * Copyright 2020 The Backstage Authors
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
1
  import React from 'react';
17
2
  import { Button, Grid } from '@material-ui/core';
18
3
  import {
@@ -0,0 +1 @@
1
+ # intentionally left empty
package/LICENSE DELETED
@@ -1,201 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright 2020 The Backstage Authors
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.