-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprepublish.js
More file actions
21 lines (16 loc) · 763 Bytes
/
prepublish.js
File metadata and controls
21 lines (16 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// prepublish.js
const fs = require('fs');
const path = require('path');
const packageDirs = ['spacelift', 'spacelift-backend'];
packageDirs.forEach((dir) => {
const source = path.resolve(__dirname, 'README.md');
const destination = path.resolve(__dirname, dir, 'README.md');
// Read the contents of the top-level README.md
const readmeContent = fs.readFileSync(source, 'utf8');
// Replace the relative paths
const updatedContent = readmeContent
.replace(/!\[Stacks\]\(\.\/docs\/stacks\.png\)/g, ``)
.replace(/!\[Runs\]\(\.\/docs\/runs\.png\)/g, ``);
// Write the updated content to the subdirectory README.md
fs.writeFileSync(destination, updatedContent);
});