Skip to content

Commit 2b53b8b

Browse files
Add ability to build one common package (#458)
* Add ability to build one common package * Add packageName to predefinedFlags and change the console output in the build scripts dependencies function
1 parent e3b0de3 commit 2b53b8b

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

make.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ const predefinedFlags = {
1111
'test'
1212
],
1313
string: [
14-
'suite'
14+
'suite',
15+
'packageName'
1516
]
1617
};
1718

@@ -27,21 +28,32 @@ const printLabel = (name) => {
2728
console.log('----------------------------------');
2829
}
2930

31+
const installBuildScriptsDependencies = () => {
32+
console.log('Installing dependencies for BuildScripts');
33+
util.cd('common-npm-packages/build-scripts');
34+
util.run('npm install');
35+
util.cd(__dirname);
36+
}
37+
3038
const buildPsTestHelpers = () => {
3139
console.log('Building Tests');
3240
util.cd('Tests');
3341
util.run('npm install');
3442
util.run(path.join('node_modules', '.bin', 'tsc'));
35-
util.cd('..');
43+
util.cd(__dirname);
3644
}
3745

46+
installBuildScriptsDependencies();
47+
3848
if (options.build) {
3949
buildPsTestHelpers();
4050

4151
console.log('\nBuilding shared npm packages');
4252
util.cd('common-npm-packages');
53+
4354
fs.readdirSync('./', { encoding: 'utf-8' }).forEach(child => {
4455
if (fs.statSync(child).isDirectory() && !ignoredFolders.includes(child)) {
56+
if (options.packageName && child !== options.packageName) return;
4557
printLabel(child);
4658

4759
util.cd(child);
@@ -66,6 +78,7 @@ if (options.test) {
6678
const startPath = process.cwd();
6779
fs.readdirSync(startPath, { encoding: 'utf-8' }).forEach(child => {
6880
if (fs.statSync(child).isDirectory() && !ignoredFolders.includes(child)) {
81+
if (options.packageName && child !== options.packageName) return;
6982
printLabel(child);
7083
const buildPath = path.join(startPath, child, '_build');
7184

@@ -86,7 +99,7 @@ if (options.test) {
8699
console.log('No tests found for the package');
87100
}
88101
} else {
89-
throw new Error('Package has not been built');
102+
throw new Error(`Package "${buildPath}" has not been built`);
90103
}
91104
}
92105
});

0 commit comments

Comments
 (0)