Skip to content

Commit

Permalink
feat: add generate.js file.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Jun 5, 2022
1 parent dedc142 commit 2686a41
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions scripts/start.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,16 @@ const createScript = (funName, content) => `(function (global, factory) {
await fs.promises.writeFile(togsccType, `declare const obj: Record<string, string | string[]>;\nexport default obj;`);
console.log(`${pathLog(togsccType)}`);

const shendiaoObj = await import('../data/shendiao.object.json', {
assert: { type: 'json' }
});
const shendiaoScript = path.resolve(root, 'dist/shendiao.js');
await fs.promises.writeFile(shendiaoScript, createScript('shendiao', JSON.stringify(shendiaoObj, null, 0)));
console.log(`${pathLog(shendiaoScript)}`);

const shendiaoType = path.resolve(root, 'dist/shendiao.d.ts');
await fs.promises.writeFile(shendiaoType, `declare const obj: Record<string, string | string[]>;\nexport default obj;`);
console.log(`${pathLog(shendiaoType)}`);


})();

0 comments on commit 2686a41

Please sign in to comment.