mirror of
https://gitee.com/antv/g6.git
synced 2024-12-14 01:21:33 +08:00
ced681f309
* feat: api reference builder * chore: generate api docs before build site --------- Co-authored-by: yvonneyx <banxuan.zyx@antgroup.com>
21 lines
543 B
JavaScript
21 lines
543 B
JavaScript
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
const fs = require('fs');
|
|
|
|
const setEnv = (env, value) => {
|
|
process.env[env] = value;
|
|
};
|
|
|
|
const updatePackageJson = () => {
|
|
const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8'));
|
|
if (process.env.USE_TS_NODE === 'true') {
|
|
packageJson.type = 'module';
|
|
} else {
|
|
delete packageJson.type;
|
|
}
|
|
fs.writeFileSync('package.json', JSON.stringify(packageJson, null, 2));
|
|
};
|
|
|
|
const [, , env, value] = process.argv;
|
|
setEnv(env, value);
|
|
updatePackageJson();
|