diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..5acb4c9 --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +*.hbs \ No newline at end of file diff --git a/config/webpack/webpack.base.js b/config/webpack/webpack.base.js index 098c586..42f2ae9 100644 --- a/config/webpack/webpack.base.js +++ b/config/webpack/webpack.base.js @@ -1,3 +1,4 @@ +import p from "bundle-declarations-webpack-plugin"; import path from "path"; const __dirname = path.resolve(); @@ -26,5 +27,16 @@ export default { "@": path.resolve(__dirname, "src/") } }, - target: "node" + target: "node", + plugins: [ + new p.BundleDeclarationsWebpackPlugin({ + entry: ["./src/utils/types.ts"], + outFile: "types.d.ts", + compilationOptions: { + libraries: { + inlinedLibraries: ["zod"] + } + } + }) + ] }; diff --git a/package.json b/package.json index 86c820b..ba6b628 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "@trivago/prettier-plugin-sort-imports": "^4.3.0", "@types/node": "^20.10.6", "@typescript-eslint/eslint-plugin": "^6.16.0", + "bundle-declarations-webpack-plugin": "^5.0.0", "chalk": "^5.3.0", "eslint": "^8.56.0", "eslint-plugin-optimize-regex": "^1.2.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 15a1dd1..25e1757 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -40,6 +40,9 @@ devDependencies: "@typescript-eslint/eslint-plugin": specifier: ^6.16.0 version: 6.17.0(@typescript-eslint/parser@6.17.0)(eslint@8.56.0)(typescript@5.3.3) + bundle-declarations-webpack-plugin: + specifier: ^5.0.0 + version: 5.0.0(webpack@5.89.0) chalk: specifier: ^5.3.0 version: 5.3.0 @@ -79,12 +82,6 @@ devDependencies: swc-loader: specifier: ^0.2.3 version: 0.2.3(@swc/core@1.3.102)(webpack@5.89.0) - ts-loader: - specifier: ^9.5.1 - version: 9.5.1(typescript@5.3.3)(webpack@5.89.0) - tsup: - specifier: ^8.0.1 - version: 8.0.1(@swc/core@1.3.102)(typescript@5.3.3) typescript: specifier: ^5.3.3 version: 5.3.3 @@ -93,7 +90,7 @@ devDependencies: version: 1.1.3(@types/node@20.10.6) webpack: specifier: ^5.89.0 - version: 5.89.0(@swc/core@1.3.102)(esbuild@0.19.11)(webpack-cli@5.1.4) + version: 5.89.0(@swc/core@1.3.102)(webpack-cli@5.1.4) webpack-cli: specifier: ^5.1.4 version: 5.1.4(webpack@5.89.0) @@ -756,19 +753,6 @@ packages: { integrity: sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw== } dev: true - /@isaacs/cliui@8.0.2: - resolution: - { integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA== } - engines: { node: ">=12" } - dependencies: - string-width: 5.1.2 - string-width-cjs: /string-width@4.2.3 - strip-ansi: 7.1.0 - strip-ansi-cjs: /strip-ansi@6.0.1 - wrap-ansi: 8.1.0 - wrap-ansi-cjs: /wrap-ansi@7.0.0 - dev: true - /@jest/schemas@29.6.3: resolution: { integrity: sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA== } @@ -881,14 +865,6 @@ packages: fastq: 1.16.0 dev: true - /@pkgjs/parseargs@0.11.0: - resolution: - { integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg== } - engines: { node: ">=14" } - requiresBuild: true - dev: true - optional: true - /@pkgr/core@0.1.0: resolution: { integrity: sha512-Zwq5OCzuwJC2jwqmpEQt7Ds1DTi6BWSwoGkbb1n9pO3hzb35BoJELx7c0T23iDkBGkh2e7tvOtjF3tr3OaQHDQ== } @@ -1685,7 +1661,7 @@ packages: webpack: 5.x.x webpack-cli: 5.x.x dependencies: - webpack: 5.89.0(@swc/core@1.3.102)(esbuild@0.19.11)(webpack-cli@5.1.4) + webpack: 5.89.0(@swc/core@1.3.102)(webpack-cli@5.1.4) webpack-cli: 5.1.4(webpack@5.89.0) dev: true @@ -1697,7 +1673,7 @@ packages: webpack: 5.x.x webpack-cli: 5.x.x dependencies: - webpack: 5.89.0(@swc/core@1.3.102)(esbuild@0.19.11)(webpack-cli@5.1.4) + webpack: 5.89.0(@swc/core@1.3.102)(webpack-cli@5.1.4) webpack-cli: 5.1.4(webpack@5.89.0) dev: true @@ -1713,7 +1689,7 @@ packages: webpack-dev-server: optional: true dependencies: - webpack: 5.89.0(@swc/core@1.3.102)(esbuild@0.19.11)(webpack-cli@5.1.4) + webpack: 5.89.0(@swc/core@1.3.102)(webpack-cli@5.1.4) webpack-cli: 5.1.4(webpack@5.89.0) dev: true @@ -1847,20 +1823,6 @@ packages: engines: { node: ">=12" } dev: true - /any-promise@1.3.0: - resolution: - { integrity: sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A== } - dev: true - - /anymatch@3.1.3: - resolution: - { integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== } - engines: { node: ">= 8" } - dependencies: - normalize-path: 3.0.0 - picomatch: 2.3.1 - dev: true - /arch@2.2.0: resolution: { integrity: sha512-Of/R0wqp83cgHozfIYLbBMnej79U/SVGOOyuB3VVFv1NRM/PSFMK12x9KVtiYzJqmnU5WR2qp0Z5rHb7sWGnFQ== } @@ -1975,12 +1937,6 @@ packages: find-versions: 5.1.0 dev: true - /binary-extensions@2.2.0: - resolution: - { integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== } - engines: { node: ">=8" } - dev: true - /brace-expansion@1.1.11: resolution: { integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== } @@ -2028,15 +1984,15 @@ packages: { integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== } dev: true - /bundle-require@4.0.2(esbuild@0.19.11): + /bundle-declarations-webpack-plugin@5.0.0(webpack@5.89.0): resolution: - { integrity: sha512-jwzPOChofl67PSTW2SGubV9HBQAhhR2i6nskiOThauo9dzwDUgOWQScFVaJkjEfYX+UXiD+LEx8EblQMc2wIag== } - engines: { node: ^12.20.0 || ^14.13.1 || >=16.0.0 } + { integrity: sha512-6ODWeo5ecSgj/TKuGu6ExTKMdL9W9vAeirgGlNdjDitxRS+U1so8VV9siIHb5zoSlbtulS04/PGhi1WABeuC+Q== } + engines: { node: ">= 16" } peerDependencies: - esbuild: ">=0.17" + webpack: ^5.0.0 dependencies: - esbuild: 0.19.11 - load-tsconfig: 0.2.5 + dts-bundle-generator: 9.2.1 + webpack: 5.89.0(@swc/core@1.3.102)(webpack-cli@5.1.4) dev: true /cac@6.7.14: @@ -2152,22 +2108,6 @@ packages: get-func-name: 2.0.2 dev: true - /chokidar@3.5.3: - resolution: - { integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw== } - engines: { node: ">= 8.10.0" } - dependencies: - anymatch: 3.1.3 - braces: 3.0.2 - glob-parent: 5.1.2 - is-binary-path: 2.1.0 - is-glob: 4.0.3 - normalize-path: 3.0.0 - readdirp: 3.6.0 - optionalDependencies: - fsevents: 2.3.3 - dev: true - /chrome-trace-event@1.0.3: resolution: { integrity: sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg== } @@ -2285,12 +2225,6 @@ packages: { integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== } dev: true - /commander@4.1.1: - resolution: - { integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA== } - engines: { node: ">= 6" } - dev: true - /commander@7.2.0: resolution: { integrity: sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw== } @@ -2483,9 +2417,14 @@ packages: esutils: 2.0.3 dev: true - /eastasianwidth@0.2.0: + /dts-bundle-generator@9.2.1: resolution: - { integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== } + { integrity: sha512-sMyIGJcn+FSc4f4VzRgX4muZS2uG91c/DjC++HkpZJyudGedSpGNR5bY9HEkSyyYFay0ERzjoDM7uKgUycaRvw== } + engines: { node: ">=14.0.0" } + hasBin: true + dependencies: + typescript: 5.3.3 + yargs: 17.7.2 dev: true /electron-to-chromium@1.4.622: @@ -2503,11 +2442,6 @@ packages: { integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== } dev: true - /emoji-regex@9.2.2: - resolution: - { integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg== } - dev: true - /end-of-stream@1.4.4: resolution: { integrity: sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== } @@ -3107,15 +3041,6 @@ packages: is-callable: 1.2.7 dev: true - /foreground-child@3.1.1: - resolution: - { integrity: sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg== } - engines: { node: ">=14" } - dependencies: - cross-spawn: 7.0.3 - signal-exit: 4.1.0 - dev: true - /fs-extra@7.0.1: resolution: { integrity: sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw== } @@ -3265,19 +3190,6 @@ packages: { integrity: sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== } dev: true - /glob@10.3.10: - resolution: - { integrity: sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g== } - engines: { node: ">=16 || 14 >=14.17" } - hasBin: true - dependencies: - foreground-child: 3.1.1 - jackspeak: 2.3.6 - minimatch: 9.0.3 - minipass: 7.0.4 - path-scurry: 1.10.1 - dev: true - /glob@7.2.3: resolution: { integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== } @@ -3578,14 +3490,6 @@ packages: has-bigints: 1.0.2 dev: true - /is-binary-path@2.1.0: - resolution: - { integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== } - engines: { node: ">=8" } - dependencies: - binary-extensions: 2.2.0 - dev: true - /is-boolean-object@1.1.2: resolution: { integrity: sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA== } @@ -3791,16 +3695,6 @@ packages: engines: { node: ">=0.10.0" } dev: true - /jackspeak@2.3.6: - resolution: - { integrity: sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ== } - engines: { node: ">=14" } - dependencies: - "@isaacs/cliui": 8.0.2 - optionalDependencies: - "@pkgjs/parseargs": 0.11.0 - dev: true - /javascript-natural-sort@0.7.1: resolution: { integrity: sha512-nO6jcEfZWQXDhOiBtG2KvKyEptz7RVbpGP4vTD2hLBdmNQSsCiicO2Ioinv6UI4y9ukqnBpy+XZ9H6uLNgJTlw== } @@ -3822,12 +3716,6 @@ packages: hasBin: true dev: false - /joycon@3.1.1: - resolution: - { integrity: sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw== } - engines: { node: ">=10" } - dev: true - /js-tokens@4.0.0: resolution: { integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== } @@ -3961,12 +3849,6 @@ packages: wrap-ansi: 9.0.0 dev: true - /load-tsconfig@0.2.5: - resolution: - { integrity: sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg== } - engines: { node: ^12.20.0 || ^14.13.1 || >=16.0.0 } - dev: true - /load-yaml-file@0.2.0: resolution: { integrity: sha512-OfCBkGEw4nN6JLtgRidPX6QxjBQGQf72q3si2uvqyFEMbycSFFHwAZeXx6cJgFM9wmLrf9zBwCP3Ivqa+LLZPw== } @@ -4014,11 +3896,6 @@ packages: { integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== } dev: true - /lodash.sortby@4.7.0: - resolution: - { integrity: sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA== } - dev: true - /lodash.startcase@4.4.0: resolution: { integrity: sha512-+WKqsK294HMSc2jEbNgpHpd0JfIBhp7rEV4aqXWqFr6AlXov+SlcgB1Fv01y2kGe3Gc8nMW7VA0SrGuSkRfIEg== } @@ -4054,12 +3931,6 @@ packages: engines: { node: ">=8" } dev: true - /lru-cache@10.1.0: - resolution: - { integrity: sha512-/1clY/ui8CzjKFyjdvwPWJUYKiFVXG2I2cY0ssG7h4+hwk+XOIX7ZSG9Q7TW8TW3Kp3BUSqgFWBLgL4PJ+Blag== } - engines: { node: 14 || >=16.14 } - dev: true - /lru-cache@4.1.5: resolution: { integrity: sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g== } @@ -4203,12 +4074,6 @@ packages: kind-of: 6.0.3 dev: true - /minipass@7.0.4: - resolution: - { integrity: sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ== } - engines: { node: ">=16 || 14 >=14.17" } - dev: true - /mixme@0.5.10: resolution: { integrity: sha512-5H76ANWinB1H3twpJ6JY8uvAtpmFvHNArpilJAjXRKXSDDLPIMoZArw5SH0q9z+lLs8IrMw7Q2VWpWimFKFT1Q== } @@ -4230,15 +4095,6 @@ packages: { integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== } dev: true - /mz@2.7.0: - resolution: - { integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q== } - dependencies: - any-promise: 1.3.0 - object-assign: 4.1.1 - thenify-all: 1.6.0 - dev: true - /nanoid@3.3.7: resolution: { integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g== } @@ -4271,12 +4127,6 @@ packages: validate-npm-package-license: 3.0.4 dev: true - /normalize-path@3.0.0: - resolution: - { integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== } - engines: { node: ">=0.10.0" } - dev: true - /normalize-url@6.1.0: resolution: { integrity: sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A== } @@ -4307,12 +4157,6 @@ packages: path-key: 4.0.0 dev: true - /object-assign@4.1.1: - resolution: - { integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== } - engines: { node: ">=0.10.0" } - dev: true - /object-inspect@1.13.1: resolution: { integrity: sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ== } @@ -4516,15 +4360,6 @@ packages: { integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== } dev: true - /path-scurry@1.10.1: - resolution: - { integrity: sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ== } - engines: { node: ">=16 || 14 >=14.17" } - dependencies: - lru-cache: 10.1.0 - minipass: 7.0.4 - dev: true - /path-type@4.0.0: resolution: { integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== } @@ -4577,12 +4412,6 @@ packages: engines: { node: ">=6" } dev: true - /pirates@4.0.6: - resolution: - { integrity: sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg== } - engines: { node: ">= 6" } - dev: true - /pkg-dir@4.2.0: resolution: { integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ== } @@ -4600,23 +4429,6 @@ packages: pathe: 1.1.1 dev: true - /postcss-load-config@4.0.2: - resolution: - { integrity: sha512-bSVhyJGL00wMVoPUzAVAnbEoWyqRxkjv64tUl427SKnPrENtq6hJwUojroMz2VB+Q1edmi4IfrAPpami5VVgMQ== } - engines: { node: ">= 14" } - peerDependencies: - postcss: ">=8.0.9" - ts-node: ">=9.0.0" - peerDependenciesMeta: - postcss: - optional: true - ts-node: - optional: true - dependencies: - lilconfig: 3.0.0 - yaml: 2.3.4 - dev: true - /postcss@8.4.33: resolution: { integrity: sha512-Kkpbhhdjw2qQs2O2DGX+8m5OVqEcbB9HRBvuYM9pgrjEFUg30A9LmXNlTAUj4S9kgtGyrMbTzVjH7E+s5Re2yg== } @@ -4790,14 +4602,6 @@ packages: readable-stream: 3.6.2 dev: true - /readdirp@3.6.0: - resolution: - { integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA== } - engines: { node: ">=8.10.0" } - dependencies: - picomatch: 2.3.1 - dev: true - /rechoir@0.8.0: resolution: { integrity: sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ== } @@ -5241,14 +5045,6 @@ packages: engines: { node: ">= 8" } dev: true - /source-map@0.8.0-beta.0: - resolution: - { integrity: sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA== } - engines: { node: ">= 8" } - dependencies: - whatwg-url: 7.1.0 - dev: true - /spawndamnit@2.0.0: resolution: { integrity: sha512-j4JKEcncSjFlqIwU5L/rp2N5SIPsdxaRsIv678+TZxZ0SRDJTm8JrxJMjE/XuiEZNEir3S8l0Fa3Ke339WI4qA== } @@ -5321,16 +5117,6 @@ packages: strip-ansi: 6.0.1 dev: true - /string-width@5.1.2: - resolution: - { integrity: sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA== } - engines: { node: ">=12" } - dependencies: - eastasianwidth: 0.2.0 - emoji-regex: 9.2.2 - strip-ansi: 7.1.0 - dev: true - /string-width@7.0.0: resolution: { integrity: sha512-GPQHj7row82Hjo9hKZieKcHIhaAIKOJvFSIZXuCU9OASVZrMNUaZuz++SPVrBjnLsnk4k+z9f2EIypgxf2vNFw== } @@ -5452,21 +5238,6 @@ packages: peek-readable: 5.0.0 dev: true - /sucrase@3.35.0: - resolution: - { integrity: sha512-8EbVDiu9iN/nESwxeSxDKe0dunta1GOlHufmSSXxMD2z2/tMZpDMpvXQGsc+ajGo8y2uYUmixaSRUc/QPoQ0GA== } - engines: { node: ">=16 || 14 >=14.17" } - hasBin: true - dependencies: - "@jridgewell/gen-mapping": 0.3.3 - commander: 4.1.1 - glob: 10.3.10 - lines-and-columns: 1.2.4 - mz: 2.7.0 - pirates: 4.0.6 - ts-interface-checker: 0.1.13 - dev: true - /supports-color@5.5.0: resolution: { integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== } @@ -5505,7 +5276,7 @@ packages: webpack: ">=2" dependencies: "@swc/core": 1.3.102 - webpack: 5.89.0(@swc/core@1.3.102)(esbuild@0.19.11)(webpack-cli@5.1.4) + webpack: 5.89.0(@swc/core@1.3.102)(webpack-cli@5.1.4) dev: true /synckit@0.9.0: @@ -5529,7 +5300,7 @@ packages: engines: { node: ">=8" } dev: true - /terser-webpack-plugin@5.3.10(@swc/core@1.3.102)(esbuild@0.19.11)(webpack@5.89.0): + /terser-webpack-plugin@5.3.10(@swc/core@1.3.102)(webpack@5.89.0): resolution: { integrity: sha512-BKFPWlPDndPs+NGGCr1U59t0XScL5317Y0UReNrHaw9/FwhPENlq6bfgs+4yPfyP51vqC1bQ4rp1EfXW5ZSH9w== } engines: { node: ">= 10.13.0" } @@ -5548,12 +5319,11 @@ packages: dependencies: "@jridgewell/trace-mapping": 0.3.20 "@swc/core": 1.3.102 - esbuild: 0.19.11 jest-worker: 27.5.1 schema-utils: 3.3.0 serialize-javascript: 6.0.1 terser: 5.26.0 - webpack: 5.89.0(@swc/core@1.3.102)(esbuild@0.19.11)(webpack-cli@5.1.4) + webpack: 5.89.0(@swc/core@1.3.102)(webpack-cli@5.1.4) dev: true /terser@5.26.0: @@ -5573,21 +5343,6 @@ packages: { integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== } dev: true - /thenify-all@1.6.0: - resolution: - { integrity: sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA== } - engines: { node: ">=0.8" } - dependencies: - thenify: 3.3.1 - dev: true - - /thenify@3.3.1: - resolution: - { integrity: sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw== } - dependencies: - any-promise: 1.3.0 - dev: true - /tinybench@2.5.1: resolution: { integrity: sha512-65NKvSuAVDP/n4CqH+a9w2kTlLReS9vhsAP06MWx+/89nMinJyB2icyl58RIcqCmIggpojIGeuJGhjU1aGMBSg== } @@ -5636,19 +5391,6 @@ packages: ieee754: 1.2.1 dev: true - /tr46@1.0.1: - resolution: - { integrity: sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA== } - dependencies: - punycode: 2.3.1 - dev: true - - /tree-kill@1.2.2: - resolution: - { integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A== } - hasBin: true - dev: true - /trim-newlines@3.0.1: resolution: { integrity: sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw== } @@ -5673,74 +5415,11 @@ packages: typescript: 5.3.3 dev: true - /ts-interface-checker@0.1.13: - resolution: - { integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA== } - dev: true - - /ts-loader@9.5.1(typescript@5.3.3)(webpack@5.89.0): - resolution: - { integrity: sha512-rNH3sK9kGZcH9dYzC7CewQm4NtxJTjSEVRJ2DyBZR7f8/wcta+iV44UPCXc5+nzDzivKtlzV6c9P4e+oFhDLYg== } - engines: { node: ">=12.0.0" } - peerDependencies: - typescript: "*" - webpack: ^5.0.0 - dependencies: - chalk: 4.1.2 - enhanced-resolve: 5.15.0 - micromatch: 4.0.5 - semver: 7.5.4 - source-map: 0.7.4 - typescript: 5.3.3 - webpack: 5.89.0(@swc/core@1.3.102)(esbuild@0.19.11)(webpack-cli@5.1.4) - dev: true - /tslib@2.6.2: resolution: { integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== } dev: true - /tsup@8.0.1(@swc/core@1.3.102)(typescript@5.3.3): - resolution: - { integrity: sha512-hvW7gUSG96j53ZTSlT4j/KL0q1Q2l6TqGBFc6/mu/L46IoNWqLLUzLRLP1R8Q7xrJTmkDxxDoojV5uCVs1sVOg== } - engines: { node: ">=18" } - hasBin: true - peerDependencies: - "@microsoft/api-extractor": ^7.36.0 - "@swc/core": ^1 - postcss: ^8.4.12 - typescript: ">=4.5.0" - peerDependenciesMeta: - "@microsoft/api-extractor": - optional: true - "@swc/core": - optional: true - postcss: - optional: true - typescript: - optional: true - dependencies: - "@swc/core": 1.3.102 - bundle-require: 4.0.2(esbuild@0.19.11) - cac: 6.7.14 - chokidar: 3.5.3 - debug: 4.3.4 - esbuild: 0.19.11 - execa: 5.1.1 - globby: 11.1.0 - joycon: 3.1.1 - postcss-load-config: 4.0.2 - resolve-from: 5.0.0 - rollup: 4.9.3 - source-map: 0.8.0-beta.0 - sucrase: 3.35.0 - tree-kill: 1.2.2 - typescript: 5.3.3 - transitivePeerDependencies: - - supports-color - - ts-node - dev: true - /tty-table@4.2.3: resolution: { integrity: sha512-Fs15mu0vGzCrj8fmJNP7Ynxt5J7praPXqFN0leZeZBXJwkMxv9cb2D454k1ltrtUSJbZ4yH4e0CynsHLxmUfFA== } @@ -6040,11 +5719,6 @@ packages: defaults: 1.0.4 dev: true - /webidl-conversions@4.0.2: - resolution: - { integrity: sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg== } - dev: true - /webpack-cli@5.1.4(webpack@5.89.0): resolution: { integrity: sha512-pIDJHIEI9LR0yxHXQ+Qh95k2EvXpWzZ5l+d+jIo+RdSm9MiHfzazIxwwni/p7+x4eJZuvG1AJwgC4TNQ7NRgsg== } @@ -6075,7 +5749,7 @@ packages: import-local: 3.1.0 interpret: 3.1.1 rechoir: 0.8.0 - webpack: 5.89.0(@swc/core@1.3.102)(esbuild@0.19.11)(webpack-cli@5.1.4) + webpack: 5.89.0(@swc/core@1.3.102)(webpack-cli@5.1.4) webpack-merge: 5.10.0 dev: true @@ -6095,7 +5769,7 @@ packages: engines: { node: ">=10.13.0" } dev: true - /webpack@5.89.0(@swc/core@1.3.102)(esbuild@0.19.11)(webpack-cli@5.1.4): + /webpack@5.89.0(@swc/core@1.3.102)(webpack-cli@5.1.4): resolution: { integrity: sha512-qyfIC10pOr70V+jkmud8tMfajraGCZMBWJtrmuBymQKCrLTRejBI8STDp1MCyZu/QTdZSeacCQYpYNQVOzX5kw== } engines: { node: ">=10.13.0" } @@ -6127,7 +5801,7 @@ packages: neo-async: 2.6.2 schema-utils: 3.3.0 tapable: 2.2.1 - terser-webpack-plugin: 5.3.10(@swc/core@1.3.102)(esbuild@0.19.11)(webpack@5.89.0) + terser-webpack-plugin: 5.3.10(@swc/core@1.3.102)(webpack@5.89.0) watchpack: 2.4.0 webpack-cli: 5.1.4(webpack@5.89.0) webpack-sources: 3.2.3 @@ -6137,15 +5811,6 @@ packages: - uglify-js dev: true - /whatwg-url@7.1.0: - resolution: - { integrity: sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg== } - dependencies: - lodash.sortby: 4.7.0 - tr46: 1.0.1 - webidl-conversions: 4.0.2 - dev: true - /which-boxed-primitive@1.0.2: resolution: { integrity: sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg== } @@ -6235,16 +5900,6 @@ packages: strip-ansi: 6.0.1 dev: true - /wrap-ansi@8.1.0: - resolution: - { integrity: sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ== } - engines: { node: ">=12" } - dependencies: - ansi-styles: 6.2.1 - string-width: 5.1.2 - strip-ansi: 7.1.0 - dev: true - /wrap-ansi@9.0.0: resolution: { integrity: sha512-G8ura3S+3Z2G+mkgNRq8dqaFZAuxfsxpBB8OCTGRTCtp+l/v9nbFNmCUP1BZMts3G1142MsZfn6eeUKrr4PD1Q== } diff --git a/defaultConfig.ts b/src/defaultConfig.ts similarity index 100% rename from defaultConfig.ts rename to src/defaultConfig.ts diff --git a/src/index.ts b/src/index.ts index 21a876c..4eb5c59 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,8 +4,11 @@ import { getConfiguration } from "@/functions"; import { logging, prompter } from "@/utils"; import { spawnSync } from "child_process"; import { program } from "commander"; +// import { copyFileSync } from "fs"; import path from "path"; +export * from "@/utils/types"; + const EXECUTED_PATH = path.join(path.resolve()); program.version(PACKAGE_VERSION); @@ -49,8 +52,38 @@ program program .command("init") .description("Init configuration file") - .action(() => { - logging.info("Init"); + .action(async () => { + logging.info("Init your config file!"); + + const defaultTemp: Record = { + ts: { filename: "commitSmile.ts", path: path.join(import.meta.url, "./templates/configs/config.ts.hbs") }, + js: { filename: "commitSmile.json", path: path.join(path.resolve(), "../templates/configs/config.js.hbs") }, + json: { filename: "commitSmile.json", path: path.join(process.cwd(), "../templates/configs/config.json.hbs") } + }; + const answers = { ext: "", module: "", fileName: "" }; + + answers.ext = (await prompter.select({ + label: "Choose config template:", + options: [ + { label: "🟦 Typescript", value: "ts", hint: "Default" }, + { label: "🟨 Javascript", value: "js" }, + { label: "{} JSON", value: "json" } + ] + })) as string; + answers.module = (await prompter.select({ + label: "Choose module type:", + options: [ + { label: "EcmaScript", value: "esm", hint: "default - import/export" }, + { label: "CommonJS", value: "commonjs", hint: "require/module.exports" } + ] + })) as string; + answers.fileName = (await prompter.text({ + label: "Choose file name:", + placeholder: `${defaultTemp[answers.ext].filename}`, + default: `${defaultTemp[answers.ext].filename}` + })) as string; + + // await copyFileSync(defaultTemp[answers.ext].path, `${import.meta.url}/${answers.fileName}`, 1); }); program.parse(process.argv); diff --git a/src/templates/configs/config.json.hbs b/src/templates/configs/config.json.hbs new file mode 100644 index 0000000..ce0a310 --- /dev/null +++ b/src/templates/configs/config.json.hbs @@ -0,0 +1,6 @@ +import type { configSchema } from "commitsmile"; +import type z from "zod"; + +export const Config: z.input = {}; + +export default Config; diff --git a/src/templates/configs/config.ts.hbs b/src/templates/configs/config.ts.hbs new file mode 100644 index 0000000..ce0a310 --- /dev/null +++ b/src/templates/configs/config.ts.hbs @@ -0,0 +1,6 @@ +import type { configSchema } from "commitsmile"; +import type z from "zod"; + +export const Config: z.input = {}; + +export default Config; diff --git a/src/utils/types.ts b/src/utils/types.ts index 3a0c313..edd873f 100644 --- a/src/utils/types.ts +++ b/src/utils/types.ts @@ -1,4 +1,4 @@ -import defaultConfig from "@/../defaultConfig"; +import defaultConfig from "@/defaultConfig"; import z from "zod"; export const TOptionSelect = z.object({ diff --git a/tsconfig.json b/tsconfig.json index 8b02a8e..ffab454 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,11 +1,14 @@ { "$schema": "http://json.schemastore.org/tsconfig", "compilerOptions": { + "declaration": true, + "outDir": "./dist", "baseUrl": "./src", "paths": { "@/*": ["*"] } }, + // "include": ["src"], "extends": "./config/tsconfig/base.json" }