Skip to content

Commit

Permalink
setup packaging to support importable submodules
Browse files Browse the repository at this point in the history
  • Loading branch information
lilioid committed Sep 13, 2022
1 parent 9dbcdda commit 1ad4786
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
26 changes: 23 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
"name": "vite-plugin-runtime-config",
"version": "1.0.0-dev1",
"description": "A vite plugin for runtime configuration",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"author": {
"name": "Viva con Agua",
"email": "[email protected]",
Expand All @@ -18,14 +16,27 @@
"lint:eslint": "eslint src/",
"lint:prettier": "prettier --check src/",
"format": "prettier --write src/",
"build": "run-s clean build:compile_ts build:bundle_patch_script build:bundle_patch_bin:gnu_linux build:bundle_patch_bin:alpine",
"build": "run-s clean build:compile_ts build:bundle_plugin_entry build:bundle_patch_script build:bundle_patch_bin:gnu_linux build:bundle_patch_bin:alpine",
"build:compile_ts": "tsc --build",
"build:bundle_plugin_entry": "esbuild --bundle --platform=node --external:lodash --outfile=dist/index.cjs src/index.ts",
"build:bundle_patch_script": "esbuild --bundle --platform=node --outfile=dist/assets/patch_runtime_config.js src/script_entrypoint.ts",
"build:bundle_patch_bin:gnu_linux": "pkg --public --targets node16-linux-x64 -o dist/assets/patch_runtime_config.gnu_linux.bin dist/assets/patch_runtime_config.js",
"build:bundle_patch_bin:alpine": "pkg --public --targets node16-alpine-x64 -o dist/assets/patch_runtime_config.alpine.bin dist/assets/patch_runtime_config.js",
"clean": "rm -rf dist",
"test": "vitest run"
},
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs",
"node": "./dist/index.cjs"
},
"./testing": {
"types": "./dist/testing.d.ts",
"import": "./dist/testing.js"
}
},
"files": [
"dist",
"src"
Expand Down Expand Up @@ -53,5 +64,14 @@
"vite": "^3.1.0",
"vite-plugin-inspect": "^0.6.1",
"vitest": "^0.23.2"
},
"peerDependencies": {
"vite": "^3.1.0",
"vitest": "^0.23.2"
},
"peerDependenciesMeta": {
"vitest": {
"optional": true
}
}
}
7 changes: 3 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
"exclude": ["src/script_entrypoint.ts"],
"compilerOptions": {
"outDir": "dist/",
"declaration": true,
"lib": ["ES2021", "DOM", "DOM.Iterable"],
"target": "ES2021",
"module": "CommonJS",
"moduleResolution": "Node",
"skipLibCheck": true,
"target": "ESNext",
"strict": true,
"allowSyntheticDefaultImports": true,
"declaration": true,
"module": "ESNext",
"paths": {
"@/*": ["./src/*"]
}
Expand Down

0 comments on commit 1ad4786

Please sign in to comment.