mirror of
https://github.com/LukeHagar/skeleton.git
synced 2025-12-10 12:47:45 +00:00
Build scripts and updated
This commit is contained in:
12
package.json
12
package.json
@@ -6,8 +6,7 @@
|
||||
"scripts": {
|
||||
"dev": "vite dev",
|
||||
"build": "vite build",
|
||||
"package": "svelte-kit sync && svelte-package",
|
||||
"patch-package": "npm version patch && svelte-kit package",
|
||||
"package": "node ./scripts/pre-build.js && svelte-kit sync && svelte-package && node ./scripts/post-build.js",
|
||||
"publish": "npm publish ./package",
|
||||
"preview": "vite preview",
|
||||
"check": "svelte-check --tsconfig ./tsconfig.json",
|
||||
@@ -29,6 +28,7 @@
|
||||
"@typescript-eslint/parser": "^5.44.0",
|
||||
"autoprefixer": "^10.4.13",
|
||||
"c8": "^7.12.0",
|
||||
"edit-package-json": "^0.7.12",
|
||||
"eslint": "^8.28.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-plugin-svelte3": "^4.0.0",
|
||||
@@ -51,5 +51,11 @@
|
||||
"vitest": "^0.24.5"
|
||||
},
|
||||
"type": "module",
|
||||
"types": "index.d.ts"
|
||||
"types": "index.d.ts",
|
||||
"exports": {
|
||||
".": "./src/lib/index.ts",
|
||||
"./themes/*": "./src/lib/themes/*",
|
||||
"./styles/*": "./src/lib/styles/*",
|
||||
"./tailwind/*": "./src/lib/tailwind/*"
|
||||
}
|
||||
}
|
||||
|
||||
18
scripts/post-build.js
Normal file
18
scripts/post-build.js
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env node
|
||||
import { readFileSync, writeFileSync } from 'fs'
|
||||
|
||||
//Put the exports field back into package.json so that monorepos can work again
|
||||
let packageJson = readFileSync('package.json').toString()
|
||||
packageJson = packageJson.slice(0, packageJson.lastIndexOf('}')-1) //strip closing }
|
||||
packageJson +=
|
||||
`,
|
||||
"exports": {
|
||||
".": "./src/lib/index.ts",
|
||||
"./themes/*": "./src/lib/themes/*",
|
||||
"./styles/*": "./src/lib/styles/*",
|
||||
"./tailwind/*": "./src/lib/tailwind/*"
|
||||
}
|
||||
}`
|
||||
|
||||
writeFileSync('package.json', packageJson);
|
||||
|
||||
7
scripts/pre-build.js
Normal file
7
scripts/pre-build.js
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
import { del } from "edit-package-json";
|
||||
import { readFileSync, writeFileSync } from 'fs'
|
||||
|
||||
//We chop out the exports field of ../package.json rather than manipulate the one in ../package/package.json in case there
|
||||
//are changes to the behaviour of 'vite build'. post-build.js will patch it back in so that monorepos work again.
|
||||
writeFileSync('package.json', del(readFileSync('package.json').toString(), 'exports'))
|
||||
Reference in New Issue
Block a user