From 9a7c62720c7ccef34f6ba054c6cd9c596664096c Mon Sep 17 00:00:00 2001 From: Emmanuel Raviart Date: Sun, 13 Nov 2022 12:35:17 +0100 Subject: [PATCH] Remove scripts from and use tsx to execute them --- README.md | 9 +- package-lock.json | 152 +++++++++++++++++++++++++++ package.json | 3 +- src/{lib => }/scripts/configure.ts | 0 src/{lib => }/scripts/import_dole.ts | 0 src/{lib => }/scripts/import_jorf.ts | 0 src/{lib => }/scripts/import_kali.ts | 0 src/{lib => }/scripts/import_legi.ts | 0 svelte.config.js | 4 +- 9 files changed, 164 insertions(+), 4 deletions(-) rename src/{lib => }/scripts/configure.ts (100%) rename src/{lib => }/scripts/import_dole.ts (100%) rename src/{lib => }/scripts/import_jorf.ts (100%) rename src/{lib => }/scripts/import_kali.ts (100%) rename src/{lib => }/scripts/import_legi.ts (100%) diff --git a/README.md b/README.md index ebc51e8..a161e8d 100644 --- a/README.md +++ b/README.md @@ -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 +``` diff --git a/package-lock.json b/package-lock.json index 6e7de6c..64f736b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index b724fb0..e30fcf8 100644 --- a/package.json +++ b/package.json @@ -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" } diff --git a/src/lib/scripts/configure.ts b/src/scripts/configure.ts similarity index 100% rename from src/lib/scripts/configure.ts rename to src/scripts/configure.ts diff --git a/src/lib/scripts/import_dole.ts b/src/scripts/import_dole.ts similarity index 100% rename from src/lib/scripts/import_dole.ts rename to src/scripts/import_dole.ts diff --git a/src/lib/scripts/import_jorf.ts b/src/scripts/import_jorf.ts similarity index 100% rename from src/lib/scripts/import_jorf.ts rename to src/scripts/import_jorf.ts diff --git a/src/lib/scripts/import_kali.ts b/src/scripts/import_kali.ts similarity index 100% rename from src/lib/scripts/import_kali.ts rename to src/scripts/import_kali.ts diff --git a/src/lib/scripts/import_legi.ts b/src/scripts/import_legi.ts similarity index 100% rename from src/lib/scripts/import_legi.ts rename to src/scripts/import_legi.ts diff --git a/svelte.config.js b/svelte.config.js index 6e13ffb..37b1c4b 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -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/") }, },