Skip to content

Commit

Permalink
fix: make sure npm run baseline creates proper symlinks (#309)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-fenster committed Mar 2, 2020
1 parent 769ca55 commit 5bd8a48
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion typescript/tools/update-baselines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ function getBaselineFilename(library: string, filename: string): string {
}

async function copyBaseline(library: string, root: string, directory = '.') {
const cwd = process.cwd();
const start = path.join(root, directory);
const targetDirectory = path.join(getBaselineDirectory(library), directory);
if (!existsSync(targetDirectory)) {
Expand All @@ -66,7 +67,10 @@ async function copyBaseline(library: string, root: string, directory = '.') {
if (relativePath.endsWith(`${path.sep}package.json`)) {
const packageJson = baseline.substring(0, baseline.lastIndexOf('.'));
await ncpp(absolutePath, packageJson);
await fssymlink(packageJson, baseline);
const dirname = path.dirname(packageJson);
process.chdir(dirname);
await fssymlink('package.json', 'package.json.baseline');
process.chdir(cwd);
} else {
await ncpp(absolutePath, baseline);
}
Expand Down

0 comments on commit 5bd8a48

Please sign in to comment.