ccc-devtools/scripts/package.js

14 lines
580 B
JavaScript
Raw Permalink Normal View History

2022-07-17 08:48:06 +00:00
const AdmZip = require('adm-zip');
const path = require('path');
const fs = require('fs');
const versionPath = path.join(__dirname, '../release/preview-template/version.json');
const versionContent = fs.readFileSync(versionPath, 'utf-8');
const fileObject = JSON.parse(versionContent);
fileObject.version = new Date().toLocaleDateString();
fs.writeFileSync(versionPath, JSON.stringify(fileObject), 'utf-8');
const zip = new AdmZip();
zip.addLocalFolder(path.join(__dirname, '../release/preview-template'));
zip.writeZip(path.join(__dirname, '../release/preview-template.zip'));