Skip to content

Commit 17740b8

Browse files
authored
Merge pull request #121 from ClayPulse/dev
Simplify app dev, build, server, preview usage via cli
2 parents e7e87f7 + e585c4a commit 17740b8

File tree

29 files changed

+7573
-3357
lines changed

29 files changed

+7573
-3357
lines changed

npm-packages/cli/build.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import {execa} from 'execa';
2+
3+
/**
4+
* Build the cli executable and copy necessary files to dist
5+
*/
6+
async function main() {
7+
console.log('🚧 Building the CLI package...');
8+
9+
// Run the build command
10+
await execa('tsc', {
11+
stdio: 'inherit',
12+
shell: true,
13+
});
14+
15+
// Copy files to dist
16+
const filesToCopy = [
17+
'lib/server/preview/frontend/index.html',
18+
'lib/server/preview/backend/load-remote.cjs',
19+
];
20+
21+
for (const filePath of filesToCopy) {
22+
if (process.platform === 'win32') {
23+
await execa(
24+
'copy',
25+
[
26+
`source\\${filePath.replace(/\//g, '\\')}`,
27+
`dist\\${filePath.replace(/\//g, '\\')}`,
28+
],
29+
{
30+
shell: true,
31+
},
32+
);
33+
} else {
34+
await execa('cp', [`source/${filePath}`, `dist/${filePath}`], {
35+
shell: true,
36+
});
37+
}
38+
}
39+
40+
console.log('✅ Build completed successfully.');
41+
}
42+
43+
main();

0 commit comments

Comments
 (0)