-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild.mjs
41 lines (34 loc) · 1.35 KB
/
build.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* ---------------------------------------------------------------------------------------------
* Copyright (c) Infiniscene, Inc. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* -------------------------------------------------------------------------------------------- */
import { exec } from 'child_process'
import parseCommandLineArgsToJSON from './args.mjs'
const args = parseCommandLineArgsToJSON()
// Define the commands as an array
const commands = [
'npm run add-license',
'tsc -p ./tsconfig.json --declaration --skipLibCheck --emitDeclarationOnly --jsx react --esModuleInterop --outDir types',
`vite build ${args.sdkversion ? `-- --sdkversion=${args.sdkversion}` : ''}`
];
// Function to execute the commands in sequence
function executeCommands(commands) {
if (commands.length === 0) {
console.log('All commands executed successfully!');
return;
}
const command = commands.shift();
console.log(`Executing: ${command}`);
exec(command, (error, stdout, stderr) => {
if (error) {
console.error(`Error executing: ${command}`);
console.error(stderr);
} else {
console.log(stdout);
// Call the next command recursively
executeCommands(commands);
}
});
}
// Call the function to start executing the commands
executeCommands(commands);