Merge pull request #3995 from backstage/rugvip/capedeps

create-app: move version marker dependencies to peer deps
This commit is contained in:
Patrik Oldsberg
2021-01-20 21:29:49 +01:00
committed by GitHub
4 changed files with 36 additions and 13 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/create-app': patch
---
Ensured that versions bumps of packages used in the app template trigger a release of this package when needed.
+8 -6
View File
@@ -37,6 +37,13 @@
"recursive-readdir": "^2.2.2"
},
"devDependencies": {
"@types/fs-extra": "^9.0.1",
"@types/inquirer": "^7.3.1",
"@types/react-dev-utils": "^9.0.4",
"@types/recursive-readdir": "^2.2.0",
"ts-node": "^8.6.2"
},
"peerDependencies": {
"@backstage/backend-common": "^0.4.3",
"@backstage/catalog-model": "^0.6.1",
"@backstage/cli": "^0.4.6",
@@ -62,12 +69,7 @@
"@backstage/plugin-techdocs-backend": "^0.5.3",
"@backstage/plugin-user-settings": "^0.2.3",
"@backstage/test-utils": "^0.1.6",
"@backstage/theme": "^0.2.2",
"@types/fs-extra": "^9.0.1",
"@types/inquirer": "^7.3.1",
"@types/react-dev-utils": "^9.0.4",
"@types/recursive-readdir": "^2.2.0",
"ts-node": "^8.6.2"
"@backstage/theme": "^0.2.2"
},
"nodemonConfig": {
"watch": "./src",
+6 -1
View File
@@ -15,7 +15,7 @@
"license": "Apache-2.0",
"main": "src/index.ts",
"scripts": {
"start": "node .",
"start": "nodemon --",
"lint": "backstage-cli lint",
"test": "backstage-cli test",
"test:e2e": "yarn start"
@@ -36,5 +36,10 @@
"tree-kill": "^1.2.2",
"ts-node": "^8.6.2",
"zombie": "^6.1.4"
},
"nodemonConfig": {
"watch": "./src",
"exec": "bin/e2e-test",
"ext": "ts"
}
}
+17 -6
View File
@@ -80,10 +80,22 @@ async function buildDistWorkspace(workspaceName: string, rootDir: string) {
// We grab the needed dependencies from the create app template
const createAppDeps = new Set<string>();
function appendDeps(pkg: any) {
Array<string>()
.concat(
Object.keys(pkg.dependencies ?? {}),
Object.keys(pkg.devDependencies ?? {}),
Object.keys(pkg.peerDependencies ?? {}),
)
.filter(name => name.startsWith('@backstage/'))
.forEach(dep => createAppDeps.add(dep));
}
for (const pkgJsonPath of templatePackagePaths) {
const path = paths.resolveOwnRoot(pkgJsonPath);
const pkgTemplate = await fs.readFile(path, 'utf8');
const { dependencies = {}, devDependencies = {} } = JSON.parse(
const pkg = JSON.parse(
handlebars.compile(pkgTemplate)(
{
privatePackage: true,
@@ -102,13 +114,12 @@ async function buildDistWorkspace(workspaceName: string, rootDir: string) {
},
),
);
Array<string>()
.concat(Object.keys(dependencies), Object.keys(devDependencies))
.filter(name => name.startsWith('@backstage/'))
.forEach(dep => createAppDeps.add(dep));
appendDeps(pkg);
}
// eslint-disable-next-line import/no-extraneous-dependencies
appendDeps(require('@backstage/create-app/package.json'));
print(`Preparing workspace`);
await runPlain([
'yarn',