Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions npm-packages/cli/build.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import {execa} from 'execa';

/**
* Build the cli executable and copy necessary files to dist
*/
async function main() {
console.log('🚧 Building the CLI package...');

// Run the build command
await execa('tsc', {
stdio: 'inherit',
shell: true,
});

// Copy files to dist
const filesToCopy = [
'lib/server/preview/frontend/index.html',
'lib/server/preview/backend/load-remote.cjs',
];

for (const filePath of filesToCopy) {
if (process.platform === 'win32') {
await execa(
'copy',
[
`source\\${filePath.replace(/\//g, '\\')}`,
`dist\\${filePath.replace(/\//g, '\\')}`,
],
{
shell: true,
},
);
} else {
await execa('cp', [`source/${filePath}`, `dist/${filePath}`], {
shell: true,
});
}
}

console.log('✅ Build completed successfully.');
}

main();
Loading
Loading