Skip to content

Commit

Permalink
feat: option to not build into react app
Browse files Browse the repository at this point in the history
  • Loading branch information
Ansonhkg committed Aug 16, 2023
1 parent 5766c93 commit fced575
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tools/scripts/gen-react.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
// *******************************************************************************************************

import { exit } from 'process';
import { writeFile, getFiles, greenLog, listDirsRecursive } from './utils.mjs';
import { writeFile, getFiles, greenLog, listDirsRecursive, yellowLog } from './utils.mjs';
import {
GEN_STYLE,
GEN_FOOTER_SCRIPTS,
getConsoleTemplate,
} from './gen-utils.mjs';
import fs from 'fs';

// ------ Config ------
const TARGET_DIR = 'apps/react/src/app/';
Expand Down Expand Up @@ -103,6 +104,17 @@ const getBodyTemplate = (

const consoleLogs = modules
.map((mod, i) => {
// read the package.json from dir
const packageJson = fs.readFileSync(mod.dir + '/package.json', 'utf8');

const json = JSON.parse(packageJson);

// -- if buildOptions.genReact is false, skip
if(json?.buildOptions?.genReact === false){
yellowLog(`Skipping "${mod.moduleName}" because buildOptions.genReact is false`)
return
}

return getConsoleTemplate(
globalVarPrefix + mod.moduleName,
i,
Expand Down

0 comments on commit fced575

Please sign in to comment.