Skip to content

Commit

Permalink
Merge pull request #2569 from brionmario/fix-redux-dev-tools-issue
Browse files Browse the repository at this point in the history
Add a dev build script for `@wso2is/theme`
  • Loading branch information
brionmario authored Oct 5, 2021
2 parents 05666cc + 0054e23 commit b025f58
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
1 change: 1 addition & 0 deletions modules/theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"scripts": {
"prebuild": "npm run clean",
"build": "npm run compile -- --skipSample --skipManifest",
"build:dev": "npm run build -- --skipHashing",
"clean": "rimraf ./dist && rimraf ./src/themes/sample",
"compile": "node scripts/build.js",
"watch": "watch \"npm run build\" src"
Expand Down
15 changes: 11 additions & 4 deletions modules/theme/scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const MANIFEST_FILE_NAME = "assets-manifest.json";

const skipSample = process.argv.indexOf("--skipSample") > -1; // CLI arg to skip the sample theme generation.
const skipManifest = process.argv.indexOf("--skipManifest") > -1; // CLI arg to skip the asset manifest generation.
const skipHashing = process.argv.indexOf("--skipHashing") > -1; // CLI arg to skip the hashing the css artifacts.

/*
* Generate Default Site Variables JSON files
Expand Down Expand Up @@ -206,13 +207,19 @@ const generateThemes = () => {
};

Object.keys(files).map((key) => {
const hash = files[ key ] && crypto.createHash("sha1").update(files[ key ]).digest("hex");
const ext = hash
? `.${ hash.substr(0, 8) }${ key }`
: key;

let ext = key;

if (!skipHashing) {
const hash = files[ key ] && crypto.createHash("sha1").update(files[ key ]).digest("hex");
ext = hash
? `.${ hash.substr(0, 8) }${ key }`
: key;
}

writeFile(theme, ext, files[ key ], themeIndexFile);
});

copyAssets(theme, filePath);

if (!skipManifest) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"scripts": {
"bootstrap": "npm install && npx lerna bootstrap",
"bootstrap:hoist": "npm install && npx lerna bootstrap --hoist --no-ci",
"build:dev": "npm run bootstrap && npm run build",
"build:dev": "npm run bootstrap && npm run build -- --ignore @wso2is/theme && npx lerna run build:dev --stream --scope @wso2is/theme",
"build": "npx lerna run build --stream",
"build:apps": "npx lerna run build --stream --scope '{@wso2is/myaccount,@wso2is/console}'",
"build:modules": "npx lerna run build --stream --scope '{@wso2is/core,@wso2is/forms,@wso2is/form,@wso2is/i18n,@wso2is/react-components,@wso2is/theme,@wso2is/validation}'",
Expand Down

0 comments on commit b025f58

Please sign in to comment.