-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
switch to esbuild + AWS_REGION env var
- Loading branch information
Showing
13 changed files
with
860 additions
and
942 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
}, | ||
"ignorePatterns": [ | ||
// Auto-generated files | ||
"**/*.cjs", | ||
"dist/**/*", | ||
"api/**/*" | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,4 @@ externals | |
|
||
/build/**/* | ||
/dist/**/*.map | ||
!/dist/main.js.map | ||
!/dist/index.js.map |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
yarn build | ||
git add dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/usr/bin/env node | ||
|
||
const fs = require('fs'); | ||
const path = require('path'); | ||
const { execSync } = require('child_process'); | ||
|
||
if (fs.existsSync(path.join(__dirname, '.git'))) { | ||
try { | ||
console.log("Activating Husky's Git hooks..."); | ||
execSync(path.join(__dirname, 'node_modules', '.bin', 'husky'), { stdio: 'inherit' }); | ||
} catch (e) { | ||
console.warn('Failed to activate Husky Git hooks:', e.message); | ||
} | ||
} | ||
|
||
const build = async () => { | ||
const esbuild = await import('esbuild'); | ||
try { | ||
await esbuild.build({ | ||
entryPoints: ['cli/index.ts'], | ||
bundle: true, | ||
outdir: 'dist', | ||
minify: true, | ||
sourcemap: true, | ||
platform: 'node', | ||
target: ['node18'], | ||
external: [], | ||
loader: { | ||
'.node': 'file', // TODO: This is a hack to prevent esbuild from trying to bundle .node files | ||
}, | ||
}); | ||
} catch (error) { | ||
console.error('Build failed:', error); | ||
} | ||
}; | ||
|
||
const watch = async () => { | ||
if (process.argv.includes('--watch')) { | ||
const chokidar = await import('chokidar'); | ||
console.log('Watching for changes...'); | ||
chokidar.watch('src/**/*.{ts,js}', { ignoreInitial: true }).on('all', (event, path) => { | ||
console.log(`${event} detected at ${path}. Rebuilding...`); | ||
build(); | ||
}); | ||
} | ||
}; | ||
|
||
// Initial build | ||
build(); | ||
watch(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.