-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.mjs
More file actions
executable file
·43 lines (32 loc) · 1.24 KB
/
Copy pathbuild.mjs
File metadata and controls
executable file
·43 lines (32 loc) · 1.24 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
#!/usr/bin/env node
import chalk from 'chalk';
import { execSync } from 'child_process';
import { chmodSync, readdirSync, statSync } from 'fs';
import * as path from "path";
console.log(chalk.bold('Installing dependencies'));
let res = execSync('npm install');
console.log(chalk.bold('Generating client from production Neris API'));
res = execSync('npm run generate');
console.log(chalk.grey(res.toLocaleString()));
console.log(chalk.bold('Running tests'));
res = execSync('npm test run');
console.log(chalk.grey(res.toLocaleString()));
console.log(chalk.bold('Building the api-client library'));
res = execSync('npm run build');
console.log(chalk.bold('Installing tsx globally for tools'));
execSync('npm install -g tsx');
console.log(chalk.bold('Making tools executable'));
function chmodRecursive(dirPath, mode) {
chmodSync(dirPath, mode);
readdirSync(dirPath).forEach(file => {
const filePath = path.join(dirPath, file);
const stat = statSync(filePath);
if (stat.isDirectory()) {
chmodRecursive(filePath, mode);
} else {
chmodSync(filePath, mode);
}
});
}
chmodRecursive("./tools", 0o755); // Set permissions to rwxr-xr-x
console.log(chalk.bold.green('\n✨ Success ✨ \n'));