mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Update Vulcanize script for element tests
The Vulcanize script can now build the UI, the element test files, or both, defaulting to the latter. The `mkdirp` package is used as it's the simplest way of getting recursive `mkdir`, ie. `mkdir -p`, to work.
This commit is contained in:
+31
-3
@@ -6,9 +6,15 @@ const path = require('path');
|
||||
const fs = require('fs');
|
||||
const helpers = require('./helpers');
|
||||
const Vulcanize = require('vulcanize');
|
||||
const mkdirp = require('mkdirp');
|
||||
|
||||
// Initialise from command line parameters.
|
||||
let rootPath = '.';
|
||||
if (process.argv.length > 2) {
|
||||
let buildType = 'ui';
|
||||
if (process.argv.length > 3) {
|
||||
rootPath = process.argv[2];
|
||||
buildType = process.argv[3];
|
||||
} else if (process.argv.length > 2) {
|
||||
rootPath = process.argv[2];
|
||||
}
|
||||
|
||||
@@ -22,7 +28,7 @@ const vulcanize = new Vulcanize({
|
||||
|
||||
function mkdir(dir) {
|
||||
try {
|
||||
fs.mkdirSync(dir);
|
||||
mkdirp.sync(dir);
|
||||
} catch (e) {
|
||||
if (e.code !== 'EEXIST') {
|
||||
console.log(e);
|
||||
@@ -51,4 +57,26 @@ function vulcanizeRelease(releasePath) {
|
||||
vulcanizeFile(inputPath, outputPath);
|
||||
}
|
||||
|
||||
helpers.getAppReleasePaths(rootPath).forEach(vulcanizeRelease);
|
||||
function vulcanizeTests(releasePath) {
|
||||
const inputPath = path.join(rootPath, 'src', 'tests', 'gui', 'html', 'elements');
|
||||
const outputPath = path.join(releasePath.path, 'html_tests', 'elements');
|
||||
|
||||
const tests = [
|
||||
'test_loot-custom-icons.html',
|
||||
];
|
||||
|
||||
tests.forEach((test) => {
|
||||
vulcanizeFile(path.join(inputPath, test), path.join(outputPath, test));
|
||||
});
|
||||
}
|
||||
|
||||
// Run the appropriate build(s).
|
||||
const releasePaths = helpers.getAppReleasePaths(rootPath);
|
||||
|
||||
if (buildType === 'ui' || buildType === 'all') {
|
||||
releasePaths.forEach(vulcanizeRelease);
|
||||
}
|
||||
|
||||
if (buildType === 'tests' || buildType === 'all') {
|
||||
releasePaths.forEach(vulcanizeTests);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user