File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# what-the-dep
22
33compile time async dependency injection plugin
4+
5+ ## Installation
6+
7+ ```
8+ bun install @softnetics/what-the-dep
9+ ```
Original file line number Diff line number Diff line change 55 "types" : " dist/index.d.ts" ,
66 "module" : " dist/index.js" ,
77 "license" : " MIT" ,
8+ "bin" : {
9+ "what-the-dep" : " dist/create.js"
10+ },
811 "homepage" : " https://github.com/softnetics/what-the-dep" ,
912 "bugs" : {
1013 "url" : " https://github.com/softnetics/what-the-dep"
Original file line number Diff line number Diff line change 1+ import fs from "fs" ;
2+ import path from "path" ;
3+
4+ const rootPath = path . resolve ( import . meta. dir , ".." , ".." ) ;
5+ const configPath = path . join ( rootPath , "bunfig.toml" ) ;
6+
7+ const pluginPreloadConfig = `
8+ preload = ['./what-the-dep.ts']
9+ ` ;
10+
11+ if ( ! fs . existsSync ( configPath ) ) {
12+ fs . writeFileSync ( configPath , pluginPreloadConfig ) ;
13+ } else {
14+ fs . appendFileSync ( configPath , pluginPreloadConfig ) ;
15+ }
16+
17+ fs . writeFileSync (
18+ path . join ( rootPath , "what-the-dep.ts" ) ,
19+ `
20+ import { whatTheDep } from "@softnetics/what-the-dep";
21+ import { plugin } from "bun";
22+
23+ plugin(whatTheDep())
24+ `
25+ ) ;
26+
27+ fs . writeFileSync (
28+ path . join ( rootPath , "build.ts" ) ,
29+ `
30+ import { whatTheDep } from "@softnetics/what-the-dep";
31+
32+ await Bun.build({
33+ // edit to your entrypoints
34+ entrypoints: ["src/index.ts"],
35+ // edit to your outdir
36+ outdir: "dist/out",
37+ target: "bun",
38+ plugins: [whatTheDep()],
39+ })
40+ `
41+ ) ;
42+
43+ console . info (
44+ 'what-the-dep is initialized! 🎉 \n Don\'t for get to add script \n \n "build":"bun run build.ts" \n \n In your package.json'
45+ ) ;
Original file line number Diff line number Diff line change 11import { defineConfig } from "tsup" ;
22
33export default defineConfig ( {
4- entry : [ "src/index.ts" ] ,
4+ entry : [ "src/index.ts" , "src/create.ts" ] ,
55 splitting : true ,
66 minify : true ,
77 clean : true ,
You can’t perform that action at this time.
0 commit comments