-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathget-started.js
executable file
·37 lines (30 loc) · 1.13 KB
/
get-started.js
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
#!/usr/bin/env node
const fs = require('fs');
const path = require('path');
const { execSync } = require('child_process');
const packageRoot = path.join(__dirname, '..');
const currentDir = process.cwd();
function copyFiles() {
const filesToCopy = ['src', 'scheduleWorkflow.ts', 'tsconfig.json'];
filesToCopy.forEach(file => {
fs.cpSync(path.join(packageRoot, file), path.join(currentDir, file), { recursive: true });
});
// Copy package.json separately and modify it
const packageJson = require(path.join(packageRoot, 'package.json'));
delete packageJson.bin;
delete packageJson.files;
fs.writeFileSync(path.join(currentDir, 'package.json'), JSON.stringify(packageJson, null, 2));
}
function installDependencies() {
console.log('Installing dependencies...');
execSync('npm install', { stdio: 'inherit', cwd: currentDir });
}
function main() {
console.log('Creating Restack get-started project...');
copyFiles();
installDependencies();
console.log('Project created successfully!');
console.log('To start the service, run: npm run service');
console.log('To schedule a workflow, run: npm run schedule');
}
main();