create-app: decouple versions
This commit is contained in:
@@ -37,6 +37,30 @@
|
||||
"recursive-readdir": "^2.2.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/backend-common": "^0.1.1-alpha.25",
|
||||
"@backstage/catalog-model": "^0.1.1-alpha.25",
|
||||
"@backstage/cli": "^0.1.1-alpha.25",
|
||||
"@backstage/config": "^0.1.1-alpha.25",
|
||||
"@backstage/core": "^0.1.1-alpha.25",
|
||||
"@backstage/plugin-api-docs": "^0.1.1-alpha.25",
|
||||
"@backstage/plugin-auth-backend": "^0.1.1-alpha.25",
|
||||
"@backstage/plugin-catalog": "^0.1.1-alpha.25",
|
||||
"@backstage/plugin-catalog-backend": "^0.1.1-alpha.25",
|
||||
"@backstage/plugin-circleci": "^0.1.1-alpha.25",
|
||||
"@backstage/plugin-explore": "^0.1.1-alpha.25",
|
||||
"@backstage/plugin-github-actions": "^0.1.1-alpha.25",
|
||||
"@backstage/plugin-lighthouse": "^0.1.1-alpha.25",
|
||||
"@backstage/plugin-proxy-backend": "^0.1.1-alpha.25",
|
||||
"@backstage/plugin-register-component": "^0.1.1-alpha.25",
|
||||
"@backstage/plugin-rollbar-backend": "^0.1.1-alpha.25",
|
||||
"@backstage/plugin-scaffolder": "^0.1.1-alpha.25",
|
||||
"@backstage/plugin-scaffolder-backend": "^0.1.1-alpha.25",
|
||||
"@backstage/plugin-tech-radar": "^0.1.1-alpha.25",
|
||||
"@backstage/plugin-techdocs": "^0.1.1-alpha.25",
|
||||
"@backstage/plugin-techdocs-backend": "^0.1.1-alpha.25",
|
||||
"@backstage/plugin-user-settings": "^0.1.1-alpha.25",
|
||||
"@backstage/test-utils": "^0.1.1-alpha.25",
|
||||
"@backstage/theme": "^0.1.1-alpha.25",
|
||||
"@types/fs-extra": "^9.0.1",
|
||||
"@types/inquirer": "^7.3.1",
|
||||
"@types/ora": "^3.2.0",
|
||||
|
||||
@@ -22,7 +22,7 @@ import inquirer, { Answers, Question } from 'inquirer';
|
||||
import { exec as execCb } from 'child_process';
|
||||
import { resolve as resolvePath } from 'path';
|
||||
import { findPaths } from '@backstage/cli-common';
|
||||
import { version } from '../package.json';
|
||||
import { versions } from './versions';
|
||||
import os from 'os';
|
||||
import { Task, templatingTask } from './lib/tasks';
|
||||
|
||||
@@ -133,7 +133,7 @@ export default async (cmd: Command): Promise<void> => {
|
||||
await createTemporaryAppFolder(tempDir);
|
||||
|
||||
Task.section('Preparing files');
|
||||
await templatingTask(templateDir, tempDir, { ...answers, version });
|
||||
await templatingTask(templateDir, tempDir, answers, versions);
|
||||
|
||||
Task.section('Moving to final location');
|
||||
await moveApp(tempDir, appDir, answers.name);
|
||||
|
||||
@@ -68,6 +68,7 @@ export async function templatingTask(
|
||||
templateDir: string,
|
||||
destinationDir: string,
|
||||
context: any,
|
||||
versions: { [name: string]: string },
|
||||
) {
|
||||
const files = await recursive(templateDir).catch(error => {
|
||||
throw new Error(`Failed to read template directory: ${error.message}`);
|
||||
@@ -83,7 +84,19 @@ export async function templatingTask(
|
||||
|
||||
const template = await fs.readFile(file);
|
||||
const compiled = handlebars.compile(template.toString());
|
||||
const contents = compiled({ name: basename(destination), ...context });
|
||||
const contents = compiled(
|
||||
{ name: basename(destination), ...context },
|
||||
{
|
||||
helpers: {
|
||||
version(name: string) {
|
||||
if (versions[name]) {
|
||||
return versions[name];
|
||||
}
|
||||
throw new Error(`No version available for package ${name}`);
|
||||
},
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
await fs.writeFile(destination, contents).catch(error => {
|
||||
throw new Error(
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright 2020 Spotify AB
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* eslint-disable import/no-extraneous-dependencies,monorepo/no-internal-import */
|
||||
|
||||
/*
|
||||
This is a list of all packages used by the template. If dependencies are added or removed,
|
||||
this list should be updated as well.
|
||||
|
||||
The list, and the accompanying devDependencies entries, are here to ensure correct versioning
|
||||
and bumping of this package. Without this list the version would not be bumped unless we
|
||||
manually trigger a release.
|
||||
|
||||
This does not create an actual dependency on these packages and does not bring in any code.
|
||||
Rollup will extract the value of the version field in each package at build time without
|
||||
leaving any imports in place.
|
||||
*/
|
||||
|
||||
import { version as backendCommon } from '@backstage/backend-common/package.json';
|
||||
import { version as catalogModel } from '@backstage/catalog-model/package.json';
|
||||
import { version as cli } from '@backstage/cli/package.json';
|
||||
import { version as config } from '@backstage/config/package.json';
|
||||
import { version as core } from '@backstage/core/package.json';
|
||||
import { version as pluginApiDocs } from '@backstage/plugin-api-docs/package.json';
|
||||
import { version as pluginAuthBackend } from '@backstage/plugin-auth-backend/package.json';
|
||||
import { version as pluginCatalog } from '@backstage/plugin-catalog/package.json';
|
||||
import { version as pluginCatalogBackend } from '@backstage/plugin-catalog-backend/package.json';
|
||||
import { version as pluginCircleci } from '@backstage/plugin-circleci/package.json';
|
||||
import { version as pluginExplore } from '@backstage/plugin-explore/package.json';
|
||||
import { version as pluginGithubActions } from '@backstage/plugin-github-actions/package.json';
|
||||
import { version as pluginLighthouse } from '@backstage/plugin-lighthouse/package.json';
|
||||
import { version as pluginProxyBackend } from '@backstage/plugin-proxy-backend/package.json';
|
||||
import { version as pluginRegisterComponent } from '@backstage/plugin-register-component/package.json';
|
||||
import { version as pluginRollbarBackend } from '@backstage/plugin-rollbar-backend/package.json';
|
||||
import { version as pluginScaffolder } from '@backstage/plugin-scaffolder/package.json';
|
||||
import { version as pluginScaffolderBackend } from '@backstage/plugin-scaffolder-backend/package.json';
|
||||
import { version as pluginTechRadar } from '@backstage/plugin-tech-radar/package.json';
|
||||
import { version as pluginTechdocs } from '@backstage/plugin-techdocs/package.json';
|
||||
import { version as pluginTechdocsBackend } from '@backstage/plugin-techdocs-backend/package.json';
|
||||
import { version as pluginUserSettings } from '@backstage/plugin-user-settings/package.json';
|
||||
import { version as testUtils } from '@backstage/test-utils/package.json';
|
||||
import { version as theme } from '@backstage/theme/package.json';
|
||||
|
||||
export const versions = {
|
||||
'@backstage/backend-common': backendCommon,
|
||||
'@backstage/catalog-model': catalogModel,
|
||||
'@backstage/cli': cli,
|
||||
'@backstage/config': config,
|
||||
'@backstage/core': core,
|
||||
'@backstage/plugin-api-docs': pluginApiDocs,
|
||||
'@backstage/plugin-auth-backend': pluginAuthBackend,
|
||||
'@backstage/plugin-catalog': pluginCatalog,
|
||||
'@backstage/plugin-catalog-backend': pluginCatalogBackend,
|
||||
'@backstage/plugin-circleci': pluginCircleci,
|
||||
'@backstage/plugin-explore': pluginExplore,
|
||||
'@backstage/plugin-github-actions': pluginGithubActions,
|
||||
'@backstage/plugin-lighthouse': pluginLighthouse,
|
||||
'@backstage/plugin-proxy-backend': pluginProxyBackend,
|
||||
'@backstage/plugin-register-component': pluginRegisterComponent,
|
||||
'@backstage/plugin-rollbar-backend': pluginRollbarBackend,
|
||||
'@backstage/plugin-scaffolder': pluginScaffolder,
|
||||
'@backstage/plugin-scaffolder-backend': pluginScaffolderBackend,
|
||||
'@backstage/plugin-tech-radar': pluginTechRadar,
|
||||
'@backstage/plugin-techdocs': pluginTechdocs,
|
||||
'@backstage/plugin-techdocs-backend': pluginTechdocsBackend,
|
||||
'@backstage/plugin-user-settings': pluginUserSettings,
|
||||
'@backstage/test-utils': testUtils,
|
||||
'@backstage/theme': theme,
|
||||
};
|
||||
@@ -26,7 +26,7 @@
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/cli": "^{{version}}",
|
||||
"@backstage/cli": "^{{version '@backstage/cli'}}",
|
||||
"@spotify/prettier-config": "^7.0.0",
|
||||
"lerna": "^3.20.2",
|
||||
"prettier": "^1.19.1"
|
||||
|
||||
@@ -6,22 +6,22 @@
|
||||
"dependencies": {
|
||||
"@material-ui/core": "^4.11.0",
|
||||
"@material-ui/icons": "^4.9.1",
|
||||
"@backstage/cli": "^{{version}}",
|
||||
"@backstage/core": "^{{version}}",
|
||||
"@backstage/plugin-api-docs": "^{{version}}",
|
||||
"@backstage/plugin-catalog": "^{{version}}",
|
||||
"@backstage/plugin-register-component": "^{{version}}",
|
||||
"@backstage/plugin-scaffolder": "^{{version}}",
|
||||
"@backstage/plugin-techdocs": "^{{version}}",
|
||||
"@backstage/catalog-model": "^{{version}}",
|
||||
"@backstage/plugin-circleci": "^{{version}}",
|
||||
"@backstage/plugin-explore": "^{{version}}",
|
||||
"@backstage/plugin-lighthouse": "^{{version}}",
|
||||
"@backstage/plugin-tech-radar": "^{{version}}",
|
||||
"@backstage/plugin-github-actions": "^{{version}}",
|
||||
"@backstage/plugin-user-settings": "^{{version}}",
|
||||
"@backstage/test-utils": "^{{version}}",
|
||||
"@backstage/theme": "^{{version}}",
|
||||
"@backstage/cli": "^{{version '@backstage/cli'}}",
|
||||
"@backstage/core": "^{{version '@backstage/core'}}",
|
||||
"@backstage/plugin-api-docs": "^{{version '@backstage/plugin-api-docs'}}",
|
||||
"@backstage/plugin-catalog": "^{{version '@backstage/plugin-catalog'}}",
|
||||
"@backstage/plugin-register-component": "^{{version '@backstage/plugin-register-component'}}",
|
||||
"@backstage/plugin-scaffolder": "^{{version '@backstage/plugin-scaffolder'}}",
|
||||
"@backstage/plugin-techdocs": "^{{version '@backstage/plugin-techdocs'}}",
|
||||
"@backstage/catalog-model": "^{{version '@backstage/catalog-model'}}",
|
||||
"@backstage/plugin-circleci": "^{{version '@backstage/plugin-circleci'}}",
|
||||
"@backstage/plugin-explore": "^{{version '@backstage/plugin-explore'}}",
|
||||
"@backstage/plugin-lighthouse": "^{{version '@backstage/plugin-lighthouse'}}",
|
||||
"@backstage/plugin-tech-radar": "^{{version '@backstage/plugin-tech-radar'}}",
|
||||
"@backstage/plugin-github-actions": "^{{version '@backstage/plugin-github-actions'}}",
|
||||
"@backstage/plugin-user-settings": "^{{version '@backstage/plugin-user-settings'}}",
|
||||
"@backstage/test-utils": "^{{version '@backstage/test-utils'}}",
|
||||
"@backstage/theme": "^{{version '@backstage/theme'}}",
|
||||
"history": "^5.0.0",
|
||||
"react": "^16.13.1",
|
||||
"react-dom": "^16.13.1",
|
||||
|
||||
@@ -17,15 +17,15 @@
|
||||
"migrate:create": "knex migrate:make -x ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@backstage/backend-common": "^{{version}}",
|
||||
"@backstage/catalog-model": "^{{version}}",
|
||||
"@backstage/config": "^{{version}}",
|
||||
"@backstage/plugin-auth-backend": "^{{version}}",
|
||||
"@backstage/plugin-catalog-backend": "^{{version}}",
|
||||
"@backstage/plugin-proxy-backend": "^{{version}}",
|
||||
"@backstage/plugin-rollbar-backend": "^{{version}}",
|
||||
"@backstage/plugin-scaffolder-backend": "^{{version}}",
|
||||
"@backstage/plugin-techdocs-backend": "^{{version}}",
|
||||
"@backstage/backend-common": "^{{version '@backstage/backend-common'}}",
|
||||
"@backstage/catalog-model": "^{{version '@backstage/catalog-model'}}",
|
||||
"@backstage/config": "^{{version '@backstage/config'}}",
|
||||
"@backstage/plugin-auth-backend": "^{{version '@backstage/plugin-auth-backend'}}",
|
||||
"@backstage/plugin-catalog-backend": "^{{version '@backstage/plugin-catalog-backend'}}",
|
||||
"@backstage/plugin-proxy-backend": "^{{version '@backstage/plugin-proxy-backend'}}",
|
||||
"@backstage/plugin-rollbar-backend": "^{{version '@backstage/plugin-rollbar-backend'}}",
|
||||
"@backstage/plugin-scaffolder-backend": "^{{version '@backstage/plugin-scaffolder-backend'}}",
|
||||
"@backstage/plugin-techdocs-backend": "^{{version '@backstage/plugin-techdocs-backend'}}",
|
||||
"@octokit/rest": "^18.0.0",
|
||||
"@gitbeaker/node": "^23.5.0",
|
||||
"dockerode": "^3.2.0",
|
||||
@@ -41,7 +41,7 @@
|
||||
"winston": "^3.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/cli": "^{{version}}",
|
||||
"@backstage/cli": "^{{version '@backstage/cli'}}",
|
||||
"@types/dockerode": "^2.5.32",
|
||||
"@types/express": "^4.17.6",
|
||||
"@types/express-serve-static-core": "^4.17.5",
|
||||
|
||||
Reference in New Issue
Block a user