mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-05 02:52:39 +08:00
37 lines
853 B
JavaScript
37 lines
853 B
JavaScript
#!/usr/bin/env node
|
|
|
|
'use strict';
|
|
|
|
const yargs = require('yargs');
|
|
const path_ = require('path');
|
|
const shdcLib = require('./shdc-lib');
|
|
|
|
let argv = yargs
|
|
.usage('shdc --chunks [path] --templates [path]')
|
|
.options({
|
|
chunks: {
|
|
type: 'string',
|
|
alias: 'c',
|
|
desc: 'Provide the chunk path.',
|
|
demandOption: true
|
|
},
|
|
templates: {
|
|
type: 'string',
|
|
alias: 't',
|
|
desc: 'Provide the template path.',
|
|
demandOption: true
|
|
},
|
|
})
|
|
.help('help')
|
|
.argv
|
|
;
|
|
|
|
let chunksCache = {};
|
|
let chunksFile = path_.join(argv.chunks, 'index.js');
|
|
console.log(`generate ${chunksFile}`);
|
|
shdcLib.buildChunks(chunksFile, argv.chunks, chunksCache);
|
|
|
|
let templateFile = path_.join(argv.templates, 'index.js');
|
|
console.log(`generate ${templateFile}`);
|
|
shdcLib.buildTemplates(templateFile, argv.templates, chunksCache);
|