Skip to content

Commit

Permalink
add shader graph packaging code (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
knoxHuang authored Jan 22, 2024
1 parent 38709d6 commit ce686b6
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
29 changes: 29 additions & 0 deletions extensions/shader-graph/lib/pack.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import AdmZip from 'adm-zip';
import { basename, join } from 'path';

// creating archives
const zip = new AdmZip();

// add folders
[
join(__dirname, '../node_modules'),
join(__dirname, '../dist'),
join(__dirname, '../i18n'),
join(__dirname, '../static'),
join(__dirname, '../shader-node'),
join(__dirname, '../readme'),
].forEach((folder) => {
zip.addLocalFolder(folder, basename(folder));
});

// add files
[
join(__dirname, '../package.json'),
join(__dirname, '../README.zh-CN.md'),
join(__dirname, '../README.md'),

].forEach((file) => {
zip.addLocalFile(file);
});

zip.writeZip(process.argv[2] ? join(process.argv[2], 'shader-graph.zip') : join(__dirname, '../shader-graph.zip'));
2 changes: 1 addition & 1 deletion extensions/shader-graph/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"build": "npm run build-less && tsc",
"watch": "tsc -w",
"build-less": "lessc ./static/shader-graph/style.less > ./static/shader-graph/style.css",
"pack": "npx ts-node ./build/pack.ts",
"pack": "npx ts-node ./lib/pack.ts",
"test": "node --test ./tests"
},
"dependencies": {
Expand Down

0 comments on commit ce686b6

Please sign in to comment.