-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bundling de la CLI avec migrations + cronjobs
- Loading branch information
Showing
6 changed files
with
657 additions
and
46 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { readdirSync } from 'node:fs'; | ||
import { basename } from 'node:path'; | ||
|
||
import { defineConfig } from 'tsup'; | ||
|
||
export default defineConfig(() => { | ||
const entry = { | ||
cli: 'scripts/cli.ts', | ||
}; | ||
// keep the structure | ||
const migrationFiles = readdirSync('./src/db/migrations'); | ||
for (const filename of migrationFiles) { | ||
entry[`migrations/${basename(filename, '.ts')}`] = `src/db/migrations/${filename}`; | ||
} | ||
|
||
return { | ||
entry, | ||
format: ['cjs'], | ||
outDir: '.next/cli/', | ||
bundle: true, | ||
splitting: false, | ||
sourcemap: false, | ||
clean: true, | ||
minify: true, | ||
env: { | ||
KNEX_MIGRATIONS_DIR: './migrations', | ||
}, | ||
|
||
// include node_modules dependencies | ||
external: [], | ||
noExternal: ['*'], | ||
}; | ||
}); |
Oops, something went wrong.