diff --git a/.extfiles b/.extfiles index 827c625..6061f72 100644 --- a/.extfiles +++ b/.extfiles @@ -3,6 +3,7 @@ LICENSE icon.png redhat-icon.woff2 README.md -dist/** -www/** -!**/yarn.lock \ No newline at end of file +!dist/package.json +!dist/pnpm-lock.yaml +dist/**/** +www/** \ No newline at end of file diff --git a/scripts/build.cjs b/scripts/build.cjs index 031507e..6642a9b 100755 --- a/scripts/build.cjs +++ b/scripts/build.cjs @@ -45,30 +45,38 @@ if (fs.existsSync(builtinDirectory)) { } // install external modules into dist folder -cproc.exec('pnpm add object-hash@2.2.0', { cwd: './dist' }, (error, stdout, stderr) => { +cproc.exec('pnpm init', { cwd: './dist' }, (error, stdout, stderr) => { if (error) { console.log(stdout); console.log(stderr); throw error; } - byline(fileStream) - .on('data', line => { - line.startsWith('!') ? excludedFiles.push(line.substring(1)) : includedFiles.push(line); - }) - .on('error', () => { - throw new Error('Error reading .extfiles'); - }) - .on('end', () => { - includedFiles.push(zipDirectory); // add destination dir - mkdirp.sync(zipDirectory); - console.log(`Copying files to ${zipDirectory}`); - cp(includedFiles, { exclude: excludedFiles }, error => { - if (error) { - throw new Error('Error copying files', error); - } - console.log(`Zipping files to ${destFile}`); - zipper.sync.zip(zipDirectory).compress().save(destFile); + cproc.exec('pnpm install object-hash@2.2.0', { cwd: './dist' }, (error, stdout, stderr) => { + if (error) { + console.log(stdout); + console.log(stderr); + throw error; + } + + byline(fileStream) + .on('data', line => { + line.startsWith('!') ? excludedFiles.push(line.substring(1)) : includedFiles.push(line); + }) + .on('error', () => { + throw new Error('Error reading .extfiles'); + }) + .on('end', () => { + includedFiles.push(zipDirectory); // add destination dir + mkdirp.sync(zipDirectory); + console.log(`Copying ${includedFiles} to ${zipDirectory}`); + cp(includedFiles, { exclude: excludedFiles }, error => { + if (error) { + throw new Error('Error copying files', error); + } + console.log(`Zipping files to ${destFile}`); + zipper.sync.zip(zipDirectory).compress().save(destFile); + }); }); - }); + }); });