forked from nocodb/nocodb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstallLocalSdk.js
More file actions
42 lines (37 loc) · 1.39 KB
/
installLocalSdk.js
File metadata and controls
42 lines (37 loc) · 1.39 KB
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
42
const { exec } = require('child_process');
const path = require('path');
const sdkPath = path.join(__dirname, '..', 'packages', 'nocodb-sdk');
const guiPath = path.join(__dirname, '..', 'packages', 'nc-gui');
const nocodbPath = path.join(__dirname, '..', 'packages', 'nocodb');
exec(`cd ${sdkPath} && pnpm i && npm run build`, (err, stdout, stderr) => {
if (err) {
console.error(`Error installing dependencies and building nocodb-sdk: ${err}`);
return;
}
console.log(`Dependencies installed and nocodb-sdk built: ${stdout}`);
const guiPromise = new Promise((resolve, reject) => {
exec(`cd ${guiPath} && pnpm i ${sdkPath}`, (err, stdout, stderr) => {
if (err) {
reject(`Error installing dependencies for nc-gui: ${err}`);
} else {
resolve(`Dependencies installed for nc-gui: ${stdout}`);
}
});
});
const nocodbPromise = new Promise((resolve, reject) => {
exec(`cd ${nocodbPath} && pnpm i ${sdkPath}`, (err, stdout, stderr) => {
if (err) {
reject(`Error installing dependencies for nocodb: ${err}`);
} else {
resolve(`Dependencies installed for nocodb: ${stdout}`);
}
});
});
Promise.all([guiPromise, nocodbPromise])
.then((results) => {
console.log(results.join('\n'));
})
.catch((err) => {
console.error(err);
});
});