forked from accountlabs-static/k-cms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpull.js
More file actions
executable file
·50 lines (42 loc) · 1.86 KB
/
pull.js
File metadata and controls
executable file
·50 lines (42 loc) · 1.86 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
43
44
45
46
47
48
49
50
const { spawn } = require('child_process');
function runCommand(command) {
return new Promise((resolve, reject) => {
const options = {
shell: true
};
const child = spawn(command, options);
child.stdout.on('data', (data) => {
console.log(`stdout: ${data}`);
});
child.stderr.on('data', (data) => {
console.error(`stderr: ${data}`);
});
child.on('error', (error) => {
reject(error);
});
child.on('exit', (code) => {
if (code !== 0) {
reject(new Error(`Script exited with code ${code}`));
} else {
resolve();
}
});
});
}
const commands = [
'dotenv -- cross-var docu-notion -n "%DOCU_NOTION_INTEGRATION_TOKEN%" -r "%DOCU_NOTION_DOCS_ROOT_PAGE_EN%" -t "%AVAILABLE_STATUS%"',
'dotenv -- cross-var docu-notion -n "%DOCU_NOTION_INTEGRATION_TOKEN%" -r "%DOCU_NOTION_BLOG_ROOT_PAGE_EN%" -m blog -t "%AVAILABLE_STATUS%"',
'dotenv -- cross-var docu-notion -n "%DOCU_NOTION_INTEGRATION_TOKEN%" -r "%DOCU_NOTION_DOCS_ROOT_PAGE_HANT%" -m i18n/zh/docusaurus-plugin-content-docs/current -t "%AVAILABLE_STATUS%"',
'dotenv -- cross-var docu-notion -n "%DOCU_NOTION_INTEGRATION_TOKEN%" -r "%DOCU_NOTION_BLOG_ROOT_PAGE_HANT%" -m i18n/zh/docusaurus-plugin-content-blog -t "%AVAILABLE_STATUS%"',
'dotenv -- cross-var docu-notion -n "%DOCU_NOTION_INTEGRATION_TOKEN%" -r "%DOCU_NOTION_DOCS_ROOT_PAGE_KO%" -m i18n/ko/docusaurus-plugin-content-docs/current -t "%AVAILABLE_STATUS%"',
'dotenv -- cross-var docu-notion -n "%DOCU_NOTION_INTEGRATION_TOKEN%" -r "%DOCU_NOTION_BLOG_ROOT_PAGE_KO%" -m i18n/ko/docusaurus-plugin-content-blog -t "%AVAILABLE_STATUS%"',
];
(async () => {
try {
await Promise.all(commands.map((command) => runCommand(command)));
console.log('All commands executed successfully');
} catch (error) {
console.error(`Error: ${error.message}`);
process.exit(1);
}
})();