Merge pull request #3129 from spotify/rugvip/decouple
create-app,cli: decouple template versions from the templating package
This commit is contained in:
@@ -108,6 +108,12 @@
|
||||
"yn": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/backend-common": "^0.1.1-alpha.26",
|
||||
"@backstage/config": "^0.1.1-alpha.26",
|
||||
"@backstage/core": "^0.1.1-alpha.26",
|
||||
"@backstage/dev-utils": "^0.1.1-alpha.26",
|
||||
"@backstage/test-utils": "^0.1.1-alpha.26",
|
||||
"@backstage/theme": "^0.1.1-alpha.26",
|
||||
"@types/diff": "^4.0.2",
|
||||
"@types/fs-extra": "^9.0.1",
|
||||
"@types/html-webpack-plugin": "^3.2.2",
|
||||
|
||||
@@ -28,8 +28,8 @@ import {
|
||||
getCodeownersFilePath,
|
||||
} from '../../lib/codeowners';
|
||||
import { paths } from '../../lib/paths';
|
||||
import { packageVersions } from '../../lib/version';
|
||||
import { Task, templatingTask } from '../../lib/tasks';
|
||||
import { version as backstageVersion } from '../../lib/version';
|
||||
|
||||
const exec = promisify(execCb);
|
||||
|
||||
@@ -243,7 +243,7 @@ export default async (cmd: Command) => {
|
||||
? paths.resolveTargetRoot('plugins', pluginId)
|
||||
: paths.resolveTargetRoot(pluginId);
|
||||
const ownerIds = parseOwnerIds(answers.owner);
|
||||
const { version } = isMonoRepo
|
||||
const { version: pluginVersion } = isMonoRepo
|
||||
? await fs.readJson(paths.resolveTargetRoot('lerna.json'))
|
||||
: { version: '0.1.0' };
|
||||
|
||||
@@ -259,14 +259,18 @@ export default async (cmd: Command) => {
|
||||
|
||||
Task.section('Preparing files');
|
||||
|
||||
await templatingTask(templateDir, tempDir, {
|
||||
...answers,
|
||||
version,
|
||||
backstageVersion,
|
||||
name,
|
||||
privatePackage,
|
||||
npmRegistry,
|
||||
});
|
||||
await templatingTask(
|
||||
templateDir,
|
||||
tempDir,
|
||||
{
|
||||
...answers,
|
||||
pluginVersion,
|
||||
name,
|
||||
privatePackage,
|
||||
npmRegistry,
|
||||
},
|
||||
packageVersions,
|
||||
);
|
||||
|
||||
Task.section('Moving to final location');
|
||||
await movePlugin(tempDir, pluginDir, pluginId);
|
||||
@@ -276,7 +280,7 @@ export default async (cmd: Command) => {
|
||||
|
||||
if ((await fs.pathExists(appPackage)) && !cmd.backend) {
|
||||
Task.section('Adding plugin as dependency in app');
|
||||
await addPluginDependencyToApp(paths.targetRoot, name, version);
|
||||
await addPluginDependencyToApp(paths.targetRoot, name, pluginVersion);
|
||||
|
||||
Task.section('Import plugin in app');
|
||||
await addPluginToApp(paths.targetRoot, pluginId, name);
|
||||
|
||||
@@ -25,13 +25,12 @@ import {
|
||||
yesPromptFunc,
|
||||
} from '../../lib/diff';
|
||||
import { paths } from '../../lib/paths';
|
||||
import { version as backstageVersion } from '../../lib/version';
|
||||
|
||||
export type PluginData = {
|
||||
id: string;
|
||||
name: string;
|
||||
privatePackage: string;
|
||||
version: string;
|
||||
pluginVersion: string;
|
||||
npmRegistry: string;
|
||||
};
|
||||
|
||||
@@ -62,10 +61,7 @@ export default async (cmd: Command) => {
|
||||
}
|
||||
|
||||
const data = await readPluginData();
|
||||
const templateFiles = await diffTemplateFiles('default-plugin', {
|
||||
backstageVersion,
|
||||
...data,
|
||||
});
|
||||
const templateFiles = await diffTemplateFiles('default-plugin', data);
|
||||
await handleAllFiles(fileHandlers, templateFiles, promptFunc);
|
||||
await finalize();
|
||||
};
|
||||
@@ -74,13 +70,13 @@ export default async (cmd: Command) => {
|
||||
async function readPluginData(): Promise<PluginData> {
|
||||
let name: string;
|
||||
let privatePackage: string;
|
||||
let version: string;
|
||||
let pluginVersion: string;
|
||||
let npmRegistry: string;
|
||||
try {
|
||||
const pkg = require(paths.resolveTarget('package.json'));
|
||||
name = pkg.name;
|
||||
privatePackage = pkg.private;
|
||||
version = pkg.version;
|
||||
pluginVersion = pkg.version;
|
||||
const scope = name.split('/')[0];
|
||||
if (`${scope}:registry` in pkg.publishConfig) {
|
||||
const registryURL = pkg.publishConfig[`${scope}:registry`];
|
||||
@@ -102,5 +98,5 @@ async function readPluginData(): Promise<PluginData> {
|
||||
|
||||
const id = pluginIdMatch[1];
|
||||
|
||||
return { id, name, privatePackage, version, npmRegistry };
|
||||
return { id, name, privatePackage, pluginVersion, npmRegistry };
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import handlebars from 'handlebars';
|
||||
import recursiveReadDir from 'recursive-readdir';
|
||||
import { paths } from '../paths';
|
||||
import { FileDiff } from './types';
|
||||
import { packageVersions } from '../../lib/version';
|
||||
|
||||
export type TemplatedFile = {
|
||||
path: string;
|
||||
@@ -40,7 +41,16 @@ async function readTemplateFile(
|
||||
return contents;
|
||||
}
|
||||
|
||||
return handlebars.compile(contents)(templateVars);
|
||||
return handlebars.compile(contents)(templateVars, {
|
||||
helpers: {
|
||||
version(name: keyof typeof packageVersions) {
|
||||
if (name in packageVersions) {
|
||||
return packageVersions[name];
|
||||
}
|
||||
throw new Error(`No version available for package ${name}`);
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async function readTemplate(
|
||||
|
||||
@@ -33,7 +33,8 @@ describe('templatingTask', () => {
|
||||
|
||||
// Files content
|
||||
const testFileContent = 'testing';
|
||||
const testVersionFileContent = 'version: {{version}}';
|
||||
const testVersionFileContent =
|
||||
"version: {{pluginVersion}} {{version 'mock-pkg'}}";
|
||||
|
||||
mockFs({
|
||||
[tmplDir]: {
|
||||
@@ -45,15 +46,20 @@ describe('templatingTask', () => {
|
||||
[destDir]: {},
|
||||
});
|
||||
|
||||
await templatingTask(tmplDir, destDir, {
|
||||
version: '0.0.0',
|
||||
});
|
||||
await templatingTask(
|
||||
tmplDir,
|
||||
destDir,
|
||||
{
|
||||
pluginVersion: '0.0.0',
|
||||
},
|
||||
{ 'mock-pkg': '0.1.2' },
|
||||
);
|
||||
|
||||
await expect(
|
||||
fs.readFile(resolvePath(destDir, 'test.txt'), 'utf8'),
|
||||
).resolves.toBe(testFileContent);
|
||||
await expect(
|
||||
fs.readFile(resolvePath(destDir, 'sub/version.txt'), 'utf8'),
|
||||
).resolves.toBe('version: 0.0.0');
|
||||
).resolves.toBe('version: 0.0.0 0.1.2');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -69,6 +69,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}`);
|
||||
@@ -85,7 +86,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(
|
||||
|
||||
@@ -17,6 +17,38 @@
|
||||
import fs from 'fs-extra';
|
||||
import { paths } from './paths';
|
||||
|
||||
/* eslint-disable import/no-extraneous-dependencies,monorepo/no-internal-import */
|
||||
/*
|
||||
This is a list of all packages used by the templates. 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 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 devUtils } from '@backstage/dev-utils/package.json';
|
||||
import { version as testUtils } from '@backstage/test-utils/package.json';
|
||||
import { version as theme } from '@backstage/theme/package.json';
|
||||
|
||||
export const packageVersions = {
|
||||
'@backstage/backend-common': backendCommon,
|
||||
'@backstage/cli': cli,
|
||||
'@backstage/config': config,
|
||||
'@backstage/core': core,
|
||||
'@backstage/dev-utils': devUtils,
|
||||
'@backstage/test-utils': testUtils,
|
||||
'@backstage/theme': theme,
|
||||
};
|
||||
|
||||
export function findVersion() {
|
||||
const pkgContent = fs.readFileSync(paths.resolveOwn('package.json'), 'utf8');
|
||||
return JSON.parse(pkgContent).version;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "{{name}}",
|
||||
"version": "{{version}}",
|
||||
"version": "{{pluginVersion}}",
|
||||
"main": "src/index.ts",
|
||||
"types": "src/index.ts",
|
||||
"license": "Apache-2.0",
|
||||
@@ -23,8 +23,8 @@
|
||||
"clean": "backstage-cli clean"
|
||||
},
|
||||
"dependencies": {
|
||||
"@backstage/backend-common": "^{{backstageVersion}}",
|
||||
"@backstage/config": "^{{backstageVersion}}",
|
||||
"@backstage/backend-common": "^{{version '@backstage/backend-common'}}",
|
||||
"@backstage/config": "^{{version '@backstage/config'}}",
|
||||
"@types/express": "^4.17.6",
|
||||
"express": "^4.17.1",
|
||||
"express-promise-router": "^3.0.3",
|
||||
@@ -33,7 +33,7 @@
|
||||
"yn": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/cli": "^{{backstageVersion}}",
|
||||
"@backstage/cli": "^{{version '@backstage/cli'}}",
|
||||
"@types/supertest": "^2.0.8",
|
||||
"supertest": "^4.0.2",
|
||||
"msw": "^0.21.2"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "{{name}}",
|
||||
"version": "{{version}}",
|
||||
"version": "{{pluginVersion}}",
|
||||
"main": "src/index.ts",
|
||||
"types": "src/index.ts",
|
||||
"license": "Apache-2.0",
|
||||
@@ -24,8 +24,8 @@
|
||||
"clean": "backstage-cli clean"
|
||||
},
|
||||
"dependencies": {
|
||||
"@backstage/core": "^{{backstageVersion}}",
|
||||
"@backstage/theme": "^{{backstageVersion}}",
|
||||
"@backstage/core": "^{{version '@backstage/core'}}",
|
||||
"@backstage/theme": "^{{version '@backstage/theme'}}",
|
||||
"@material-ui/core": "^4.11.0",
|
||||
"@material-ui/icons": "^4.9.1",
|
||||
"@material-ui/lab": "4.0.0-alpha.45",
|
||||
@@ -34,9 +34,9 @@
|
||||
"react-use": "^15.3.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/cli": "^{{backstageVersion}}",
|
||||
"@backstage/dev-utils": "^{{backstageVersion}}",
|
||||
"@backstage/test-utils": "^{{backstageVersion}}",
|
||||
"@backstage/cli": "^{{version '@backstage/cli'}}",
|
||||
"@backstage/dev-utils": "^{{version '@backstage/dev-utils'}}",
|
||||
"@backstage/test-utils": "^{{version '@backstage/test-utils'}}",
|
||||
"@testing-library/jest-dom": "^5.10.1",
|
||||
"@testing-library/react": "^10.4.1",
|
||||
"@testing-library/user-event": "^12.0.7",
|
||||
|
||||
@@ -37,6 +37,30 @@
|
||||
"recursive-readdir": "^2.2.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/backend-common": "^0.1.1-alpha.26",
|
||||
"@backstage/catalog-model": "^0.1.1-alpha.26",
|
||||
"@backstage/cli": "^0.1.1-alpha.26",
|
||||
"@backstage/config": "^0.1.1-alpha.26",
|
||||
"@backstage/core": "^0.1.1-alpha.26",
|
||||
"@backstage/plugin-api-docs": "^0.1.1-alpha.26",
|
||||
"@backstage/plugin-auth-backend": "^0.1.1-alpha.26",
|
||||
"@backstage/plugin-catalog": "^0.1.1-alpha.26",
|
||||
"@backstage/plugin-catalog-backend": "^0.1.1-alpha.26",
|
||||
"@backstage/plugin-circleci": "^0.1.1-alpha.26",
|
||||
"@backstage/plugin-explore": "^0.1.1-alpha.26",
|
||||
"@backstage/plugin-github-actions": "^0.1.1-alpha.26",
|
||||
"@backstage/plugin-lighthouse": "^0.1.1-alpha.26",
|
||||
"@backstage/plugin-proxy-backend": "^0.1.1-alpha.26",
|
||||
"@backstage/plugin-register-component": "^0.1.1-alpha.26",
|
||||
"@backstage/plugin-rollbar-backend": "^0.1.1-alpha.26",
|
||||
"@backstage/plugin-scaffolder": "^0.1.1-alpha.26",
|
||||
"@backstage/plugin-scaffolder-backend": "^0.1.1-alpha.26",
|
||||
"@backstage/plugin-tech-radar": "^0.1.1-alpha.26",
|
||||
"@backstage/plugin-techdocs": "^0.1.1-alpha.26",
|
||||
"@backstage/plugin-techdocs-backend": "^0.1.1-alpha.26",
|
||||
"@backstage/plugin-user-settings": "^0.1.1-alpha.26",
|
||||
"@backstage/test-utils": "^0.1.1-alpha.26",
|
||||
"@backstage/theme": "^0.1.1-alpha.26",
|
||||
"@types/fs-extra": "^9.0.1",
|
||||
"@types/inquirer": "^7.3.1",
|
||||
"@types/ora": "^3.2.0",
|
||||
|
||||
@@ -22,7 +22,6 @@ 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 os from 'os';
|
||||
import { Task, templatingTask } from './lib/tasks';
|
||||
|
||||
@@ -133,7 +132,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);
|
||||
|
||||
Task.section('Moving to final location');
|
||||
await moveApp(tempDir, appDir, answers.name);
|
||||
|
||||
@@ -20,6 +20,7 @@ import handlebars from 'handlebars';
|
||||
import ora from 'ora';
|
||||
import { basename, dirname } from 'path';
|
||||
import recursive from 'recursive-readdir';
|
||||
import { packageVersions } from './versions';
|
||||
|
||||
const TASK_NAME_MAX_LENGTH = 14;
|
||||
|
||||
@@ -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: keyof typeof packageVersions) {
|
||||
if (name in packageVersions) {
|
||||
return packageVersions[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 packageVersions = {
|
||||
'@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",
|
||||
|
||||
@@ -84,11 +84,23 @@ async function buildDistWorkspace(workspaceName: string, rootDir: string) {
|
||||
const path = paths.resolveOwnRoot(pkgJsonPath);
|
||||
const pkgTemplate = await fs.readFile(path, 'utf8');
|
||||
const { dependencies = {}, devDependencies = {} } = JSON.parse(
|
||||
handlebars.compile(pkgTemplate)({
|
||||
version: '0.0.0',
|
||||
privatePackage: true,
|
||||
scopeName: '@backstage',
|
||||
}),
|
||||
handlebars.compile(pkgTemplate)(
|
||||
{
|
||||
privatePackage: true,
|
||||
scopeName: '@backstage',
|
||||
},
|
||||
{
|
||||
helpers: {
|
||||
version(name: string) {
|
||||
const pkg = require(`${name}/package.json`);
|
||||
if (!pkg) {
|
||||
throw new Error(`No version available for package ${name}`);
|
||||
}
|
||||
return pkg.version;
|
||||
},
|
||||
},
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
Array<string>()
|
||||
|
||||
Reference in New Issue
Block a user