Files
packager/node-api-docs/demo-simple.js
T
Lu Yifei 5dfdf70e4b feat: add compiled project protection and GitHub Pages deployment
- promote compiled packaging as a primary product feature
- add VM access and configurable JavaScript obfuscation
- support global debug protection and self-defending options
- package compiled artifacts with integrity verification
- update SB3C branding, documentation, and dependency URLs
- fix standalone builds and production service worker caching
- configure GitHub Pages deployment workflow
2026-08-05 20:51:52 +08:00

25 lines
721 B
JavaScript

const fs = require('fs');
const path = require('path');
// You should use require('@luyifei2011/tw-packager') instead
// We use a strange require() in this demo because we use this to test the API internally
const Packager = require('../dist/packager');
const run = async () => {
const projectData = fs.readFileSync(path.join(__dirname, '..', 'static', 'example.sb3'));
const loadedProject = await Packager.loadProject(projectData);
const packager = new Packager.Packager();
packager.project = loadedProject;
const result = await packager.package();
fs.writeFileSync(path.join(__dirname, 'demo_output.html'), result.data);
};
run()
.catch((err) => {
console.error(err);
process.exit(1);
});