Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add postinstall theme copy #1454

Draft
wants to merge 1 commit into
base: release/4.x
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ dist/
coverage/
node_modules/
apis/snapshooter/client.js
apis/*/core/**/*.js
apis/*/core/**/*.js
tools/
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"test:rendering": "playwright test --config=./test/rendering/playwright.config.rendering.js --quiet",
"test:integration": "aw puppet -c aw.config.js --testExt '*.int.js' --glob 'test/integration/**/*.int.js'",
"test:component": "aw puppet -c aw.config.js --testExt '*.comp.js' --glob 'test/component/**/*.comp.js'",
"prepare": "husky install"
"prepare": "husky install",
"postinstall": "node tools/install-themes.js"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -107,4 +108,4 @@
"apis/*",
"test/component/*"
]
}
}
29 changes: 29 additions & 0 deletions tools/install-themes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
var child_process = require('child_process');

function install(modules, callback) {
if (modules.length == 0) {
if (callback) callback(null);
return;
}
var module = modules.shift();
child_process.exec('npm install ' + module + ' --no-save --silent', {}, function (error, stdout, stderr) {
process.stdout.write(stdout + '\n');
process.stderr.write(stderr + '\n');
if (error !== null) {
if (callback) callback(error);
} else {
install(modules, callback);
}
});
}

function copyFiles(error) {
if (!error) {
child_process.exec('cp -a node_modules/@qlik-trial/sense-themes-default/dist/. apis/theme/src/themes/');
}
child_process.exec('git restore yarn.lock');
}

/* Example */

install(['@qlik-trial/sense-themes-default'], copyFiles);