mirror of
https://github.com/noodlapp/noodl.git
synced 2026-01-11 23:02:53 +01:00
Initial commit
Co-Authored-By: Eric Tuvesson <eric.tuvesson@gmail.com> Co-Authored-By: mikaeltellhed <2311083+mikaeltellhed@users.noreply.github.com> Co-Authored-By: kotte <14197736+mrtamagotchi@users.noreply.github.com> Co-Authored-By: Anders Larsson <64838990+anders-topp@users.noreply.github.com> Co-Authored-By: Johan <4934465+joolsus@users.noreply.github.com> Co-Authored-By: Tore Knudsen <18231882+torekndsn@users.noreply.github.com> Co-Authored-By: victoratndl <99176179+victoratndl@users.noreply.github.com>
This commit is contained in:
32
packages/noodl-viewer-cloud/scripts/pack.js
Normal file
32
packages/noodl-viewer-cloud/scripts/pack.js
Normal file
@@ -0,0 +1,32 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const publishDir = path.join(__dirname, '../publish');
|
||||
const publishDistDir = path.join(__dirname, '../publish/dist/');
|
||||
|
||||
// Delete the publish folder if it exists
|
||||
if (fs.existsSync(publishDir)) {
|
||||
fs.rmdirSync(publishDir, { recursive: true, force: true });
|
||||
}
|
||||
|
||||
// Create the publish folders
|
||||
fs.mkdirSync(publishDistDir, { recursive: true });
|
||||
|
||||
// Copy over the wanted files
|
||||
const files = ['dist/main.js', 'package.json', 'README.md', 'LICENSE'];
|
||||
|
||||
files.forEach((file) => {
|
||||
const fromPath = path.join(__dirname, '..', file);
|
||||
const toPath = path.join(publishDir, file);
|
||||
fs.copyFileSync(fromPath, toPath);
|
||||
});
|
||||
|
||||
// Clean up package.json
|
||||
const packageFilePath = path.join(publishDir, 'package.json');
|
||||
const packageJson = JSON.parse(fs.readFileSync(packageFilePath));
|
||||
|
||||
delete packageJson.scripts;
|
||||
delete packageJson.dependencies;
|
||||
delete packageJson.devDependencies;
|
||||
|
||||
fs.writeFileSync(packageFilePath, JSON.stringify(packageJson, null, 2));
|
||||
Reference in New Issue
Block a user