Create new app in temp dir

This commit is contained in:
Marcus Eide
2020-04-15 14:58:20 +02:00
parent ce950bed7a
commit 300a891f71
10 changed files with 74 additions and 17 deletions
+5 -1
View File
@@ -19,7 +19,11 @@ const path = require('path');
// Figure out whether we're running inside the backstage repo or as an installed dependency
const isLocal = require('fs').existsSync(path.resolve(__dirname, '../src'));
if (!isLocal) {
// This is used for e2e-tests where we create a new app in a tmp folder
const isTemp = path.resolve(__dirname).includes(require('os').tmpdir());
if (!isLocal || isTemp || process.env.E2E) {
// src-relative imports are a pain to get to work with plain tsc compilation, as the
// transpiled code will maintain the imports as they are in the source. Which means an
// import for `helpers/paths` will start like that in the output, which won't work in NodeJS.
@@ -30,7 +30,7 @@ export async function withCache(
buildFunc: () => Promise<void>,
): Promise<void> {
const key = await Cache.readInputKey(options.inputs);
if (!key) {
if (!key || process.env.E2E) {
print('input directory is dirty, skipping cache');
await fs.remove(options.output);
await buildFunc();
@@ -46,6 +46,7 @@ export default {
json(),
typescript({
include: `${paths.resolveTarget('src')}/**/*.{js,jsx,ts,tsx}`,
clean: true,
}),
],
} as RollupWatchOptions;
@@ -25,5 +25,8 @@
"@backstage/cli": "^{{version}}",
"lerna": "^3.20.2",
"prettier": "^1.19.1"
},
"resolutions": {
"@backstage/cli": "file:/home/runner/work/backstage/backstage/packages/cli"
}
}
@@ -5,6 +5,7 @@
"dependencies": {
"@material-ui/core": "^4.9.1",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.45",
"@backstage/cli": "^{{version}}",
"@backstage/core": "^{{version}}",
"@backstage/theme": "^{{version}}",
@@ -17,7 +18,8 @@
"plugin-welcome": "0.0.0",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-router-dom": "^5.1.2"
"react-router-dom": "^5.1.2",
"react-use": "^13.24.0"
},
"scripts": {
"start": "backstage-cli app:serve",