Remove scripts from and use tsx to execute them

This commit is contained in:
Emmanuel 2022-11-13 12:35:17 +01:00
parent 9232d2a80b
commit 9a7c62720c
9 changed files with 164 additions and 4 deletions

View file

@ -44,7 +44,6 @@ npm install
Create a `.env` file to set configuration variables (you can use `example.env` as a template). Then:
```sh
npm run package
npm run configure
```
@ -62,3 +61,11 @@ In production mode:
npm run build
npm run preview
```
### Package Generation & Publishing
```sh
npm version patch # or major or minor
npm run package
npm publish ./package
```

152
package-lock.json generated
View file

@ -47,6 +47,7 @@
"svelte2tsx": "^0.5.13",
"tailwindcss": "^3.1.5",
"tslib": "^2.3.1",
"tsx": "^3.12.1",
"typescript": "^4.7.4",
"vite": "^3.0.0"
}
@ -60,6 +61,36 @@
"node": ">=16"
}
},
"node_modules/@esbuild-kit/cjs-loader": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/@esbuild-kit/cjs-loader/-/cjs-loader-2.4.0.tgz",
"integrity": "sha512-DBBCiHPgL2B/elUpvCDhNHXnlZQ9sfO2uyt1OJyAXKT41beQEFY4OxZ6gwS+ZesRCbZ6JV8M7GEyOPkjv8kdIw==",
"dev": true,
"dependencies": {
"@esbuild-kit/core-utils": "^3.0.0",
"get-tsconfig": "^4.2.0"
}
},
"node_modules/@esbuild-kit/core-utils": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/@esbuild-kit/core-utils/-/core-utils-3.0.0.tgz",
"integrity": "sha512-TXmwH9EFS3DC2sI2YJWJBgHGhlteK0Xyu1VabwetMULfm3oYhbrsWV5yaSr2NTWZIgDGVLHbRf0inxbjXqAcmQ==",
"dev": true,
"dependencies": {
"esbuild": "~0.15.10",
"source-map-support": "^0.5.21"
}
},
"node_modules/@esbuild-kit/esm-loader": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/@esbuild-kit/esm-loader/-/esm-loader-2.5.0.tgz",
"integrity": "sha512-ySs0qOsiwj+hsgZM9/MniGdvfa9/WzqfFuIia8/5gSUPeIQIX2/tG91QakxPFOR35VFiwTB7wCiHtiS6dc6SkA==",
"dev": true,
"dependencies": {
"@esbuild-kit/core-utils": "^3.0.0",
"get-tsconfig": "^4.2.0"
}
},
"node_modules/@esbuild/android-arm": {
"version": "0.15.13",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.15.13.tgz",
@ -995,6 +1026,12 @@
"node": "*"
}
},
"node_modules/buffer-from": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
"integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==",
"dev": true
},
"node_modules/builtin-modules": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.3.0.tgz",
@ -2160,6 +2197,15 @@
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
"dev": true
},
"node_modules/get-tsconfig": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.2.0.tgz",
"integrity": "sha512-X8u8fREiYOE6S8hLbq99PeykTDoLVnxvF4DjWKJmz9xy2nNRdUcV8ZN9tniJFeKyTU3qnC9lL8n4Chd6LmVKHg==",
"dev": true,
"funding": {
"url": "https://github.com/privatenumber/get-tsconfig?sponsor=1"
}
},
"node_modules/glob": {
"version": "8.0.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz",
@ -3490,6 +3536,15 @@
"sorcery": "bin/index.js"
}
},
"node_modules/source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true,
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/source-map-js": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz",
@ -3499,6 +3554,16 @@
"node": ">=0.10.0"
}
},
"node_modules/source-map-support": {
"version": "0.5.21",
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz",
"integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==",
"dev": true,
"dependencies": {
"buffer-from": "^1.0.0",
"source-map": "^0.6.0"
}
},
"node_modules/sourcemap-codec": {
"version": "1.4.8",
"resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz",
@ -3867,6 +3932,23 @@
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
"dev": true
},
"node_modules/tsx": {
"version": "3.12.1",
"resolved": "https://registry.npmjs.org/tsx/-/tsx-3.12.1.tgz",
"integrity": "sha512-Rcg1x+rNe7qwlP8j7kx4VjP/pJo/V57k+17hlrn6a7FuQLNwkaw5W4JF75tYornNVCxkXdSUnqlIT8JY/ttvIw==",
"dev": true,
"dependencies": {
"@esbuild-kit/cjs-loader": "^2.4.0",
"@esbuild-kit/core-utils": "^3.0.0",
"@esbuild-kit/esm-loader": "^2.5.0"
},
"bin": {
"tsx": "dist/cli.js"
},
"optionalDependencies": {
"fsevents": "~2.3.2"
}
},
"node_modules/type-check": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
@ -4089,6 +4171,36 @@
"integrity": "sha512-/8yBGaaQueD8njJODPp9HiH0ZOiRJkCDwT9vFwO6iZMPWex6vhxVhZU7bxVm+AxYSFYFCCQVPps0vANRDRq0hg==",
"dev": true
},
"@esbuild-kit/cjs-loader": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/@esbuild-kit/cjs-loader/-/cjs-loader-2.4.0.tgz",
"integrity": "sha512-DBBCiHPgL2B/elUpvCDhNHXnlZQ9sfO2uyt1OJyAXKT41beQEFY4OxZ6gwS+ZesRCbZ6JV8M7GEyOPkjv8kdIw==",
"dev": true,
"requires": {
"@esbuild-kit/core-utils": "^3.0.0",
"get-tsconfig": "^4.2.0"
}
},
"@esbuild-kit/core-utils": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/@esbuild-kit/core-utils/-/core-utils-3.0.0.tgz",
"integrity": "sha512-TXmwH9EFS3DC2sI2YJWJBgHGhlteK0Xyu1VabwetMULfm3oYhbrsWV5yaSr2NTWZIgDGVLHbRf0inxbjXqAcmQ==",
"dev": true,
"requires": {
"esbuild": "~0.15.10",
"source-map-support": "^0.5.21"
}
},
"@esbuild-kit/esm-loader": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/@esbuild-kit/esm-loader/-/esm-loader-2.5.0.tgz",
"integrity": "sha512-ySs0qOsiwj+hsgZM9/MniGdvfa9/WzqfFuIia8/5gSUPeIQIX2/tG91QakxPFOR35VFiwTB7wCiHtiS6dc6SkA==",
"dev": true,
"requires": {
"@esbuild-kit/core-utils": "^3.0.0",
"get-tsconfig": "^4.2.0"
}
},
"@esbuild/android-arm": {
"version": "0.15.13",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.15.13.tgz",
@ -4715,6 +4827,12 @@
"integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==",
"dev": true
},
"buffer-from": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
"integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==",
"dev": true
},
"builtin-modules": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.3.0.tgz",
@ -5483,6 +5601,12 @@
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
"dev": true
},
"get-tsconfig": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.2.0.tgz",
"integrity": "sha512-X8u8fREiYOE6S8hLbq99PeykTDoLVnxvF4DjWKJmz9xy2nNRdUcV8ZN9tniJFeKyTU3qnC9lL8n4Chd6LmVKHg==",
"dev": true
},
"glob": {
"version": "8.0.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz",
@ -6432,12 +6556,28 @@
"sourcemap-codec": "^1.3.0"
}
},
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true
},
"source-map-js": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz",
"integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==",
"dev": true
},
"source-map-support": {
"version": "0.5.21",
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz",
"integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==",
"dev": true,
"requires": {
"buffer-from": "^1.0.0",
"source-map": "^0.6.0"
}
},
"sourcemap-codec": {
"version": "1.4.8",
"resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz",
@ -6671,6 +6811,18 @@
}
}
},
"tsx": {
"version": "3.12.1",
"resolved": "https://registry.npmjs.org/tsx/-/tsx-3.12.1.tgz",
"integrity": "sha512-Rcg1x+rNe7qwlP8j7kx4VjP/pJo/V57k+17hlrn6a7FuQLNwkaw5W4JF75tYornNVCxkXdSUnqlIT8JY/ttvIw==",
"dev": true,
"requires": {
"@esbuild-kit/cjs-loader": "^2.4.0",
"@esbuild-kit/core-utils": "^3.0.0",
"@esbuild-kit/esm-loader": "^2.5.0",
"fsevents": "~2.3.2"
}
},
"type-check": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",

View file

@ -13,7 +13,7 @@
"build": "vite build",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"configure": "node --experimental-specifier-resolution=node package/scripts/configure.js",
"configure": "tsx src/scripts/configure.ts",
"dev": "vite dev",
"format": "prettier --plugin-search-dir . --write .",
"lint": "prettier --plugin-search-dir . --check . && eslint .",
@ -60,6 +60,7 @@
"svelte2tsx": "^0.5.13",
"tailwindcss": "^3.1.5",
"tslib": "^2.3.1",
"tsx": "^3.12.1",
"typescript": "^4.7.4",
"vite": "^3.0.0"
}

View file

@ -5,10 +5,10 @@ import preprocess from "svelte-preprocess"
const config = {
package: {
exports: (filePath) => {
return !filePath.startsWith("scripts/") && !filePath.startsWith("server/")
return !filePath.startsWith("server/")
},
files: (filePath) => {
return !filePath.startsWith("scripts/") && !filePath.startsWith("server/")
return !filePath.startsWith("server/")
},
},