Skip to content

Commit cb07027

Browse files
authored
fix: sanitise output filename
1 parent 6aa4805 commit cb07027

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

scripts/build.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ if (argv.help) {
2323
process.exit(0)
2424
}
2525

26+
function toSanitizedDirname(name) {
27+
return name.replace(/[^a-zA-Z0-9-\.]/g, '-').replace(/[-+]/g, '-')
28+
}
29+
2630
const require = createRequire(import.meta.url)
2731

2832
async function findModuleDir(cwd) {
@@ -201,7 +205,7 @@ if (Object.keys(packageJson.dependencies).length) {
201205
}
202206

203207
// Create tgz of the build
204-
let tgzFile = `${manifestJson.name}-${manifestJson.version}`
208+
let tgzFile = toSanitizedDirname(`${manifestJson.id}-${manifestJson.version}`)
205209
if (typeof argv['output'] === 'string') {
206210
// -o flag, to allow legacy behaviour creating pkg.tgz output
207211
tgzFile = argv['output']

0 commit comments

Comments
 (0)