Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding env var for custom out directory #3130

Open
wants to merge 2 commits into
base: next
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions packages/evidence/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ const buildHelper = function (command, args) {
const flatArgs = flattenArguments(args);

const dataDir = process.env.EVIDENCE_DATA_DIR ?? './static/data';
const outDir = process.env.EVIDENCE_OUT_DIR ?? '.evidence/template/build';

// Run svelte kit build in the hidden directory
const child = spawn(command, flatArgs, {
Expand All @@ -182,7 +183,6 @@ const buildHelper = function (command, args) {
});
// Copy the outputs to the root of the project upon successful exit
child.on('exit', function (code) {
const outDir = '.evidence/template/build';
if (code === 0) {
const staticlessDataDir = removeStaticDir(dataDir);
const buildDataDir = path.join(outDir, staticlessDataDir);
Expand Down Expand Up @@ -217,8 +217,10 @@ const buildHelper = function (command, args) {
fs.writeJsonSync(manifestFile, manifest);
}

fs.copySync(outDir, './build');
console.log(`Build complete --> ${process.env.EVIDENCE_BUILD_DIR ?? './build'} `);
const buildDest = process.env.EVIDENCE_BUILD_DIR ?? './build';

fs.copySync(outDir, buildDest);
console.log(`Build complete --> ${buildDest} `);
} else {
console.error('Build failed');
}
Expand Down