@grest-ts/create-starter 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +6 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/tsconfig.json +13 -0
- package/dist/tsconfig.publish.tsbuildinfo +1 -0
- package/index.mjs +94 -0
- package/package.json +43 -0
- package/template/_package.json +9 -0
- package/template/api/_package.json +13 -0
- package/template/api/src/api/HelloApi.ts +32 -0
- package/template/api/tsconfig.json +20 -0
- package/template/client/_package.json +17 -0
- package/template/client/index.html +28 -0
- package/template/client/src/main.ts +25 -0
- package/template/client/tsconfig.json +20 -0
- package/template/client/vite.config.ts +26 -0
- package/template/server/_package.json +30 -0
- package/template/server/esbuild.config.ts +45 -0
- package/template/server/src/AppRuntime.ts +22 -0
- package/template/server/src/services/HelloApiImpl.ts +8 -0
- package/template/server/test/TestContext.ts +4 -0
- package/template/server/test/integration/hello.test.ts +22 -0
- package/template/server/tsconfig.json +24 -0
- package/template/server/vitest.config.ts +15 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Grest Games OÜ
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<!-- GREST-TS-BANNER-START -->
|
|
2
|
+
> Part of the [grest-ts](https://github.com/grest-ts/grest-ts) framework.
|
|
3
|
+
> [Documentation](https://github.com/grest-ts/grest-ts#readme) | [All packages](https://github.com/grest-ts/grest-ts#package-reference)
|
|
4
|
+
<!-- GREST-TS-BANNER-END -->
|
|
5
|
+
|
|
6
|
+
This is a simple starter project template to get going with grest-ts.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/typescript/lib/lib.es2021.d.ts","../../../node_modules/typescript/lib/lib.es2022.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../node_modules/typescript/lib/lib.es2022.array.d.ts","../../../node_modules/typescript/lib/lib.es2022.error.d.ts","../../../node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../node_modules/typescript/lib/lib.es2022.object.d.ts","../../../node_modules/typescript/lib/lib.es2022.string.d.ts","../../../node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../src/index.ts","../../../node_modules/@types/node/compatibility/disposable.d.ts","../../../node_modules/@types/node/compatibility/indexable.d.ts","../../../node_modules/@types/node/compatibility/iterators.d.ts","../../../node_modules/@types/node/compatibility/index.d.ts","../../../node_modules/@types/node/globals.typedarray.d.ts","../../../node_modules/@types/node/buffer.buffer.d.ts","../../../node_modules/@types/node/globals.d.ts","../../../node_modules/@types/node/web-globals/abortcontroller.d.ts","../../../node_modules/@types/node/web-globals/domexception.d.ts","../../../node_modules/@types/node/web-globals/events.d.ts","../../../node_modules/buffer/index.d.ts","../../../node_modules/undici-types/header.d.ts","../../../node_modules/undici-types/readable.d.ts","../../../node_modules/undici-types/file.d.ts","../../../node_modules/undici-types/fetch.d.ts","../../../node_modules/undici-types/formdata.d.ts","../../../node_modules/undici-types/connector.d.ts","../../../node_modules/undici-types/client.d.ts","../../../node_modules/undici-types/errors.d.ts","../../../node_modules/undici-types/dispatcher.d.ts","../../../node_modules/undici-types/global-dispatcher.d.ts","../../../node_modules/undici-types/global-origin.d.ts","../../../node_modules/undici-types/pool-stats.d.ts","../../../node_modules/undici-types/pool.d.ts","../../../node_modules/undici-types/handlers.d.ts","../../../node_modules/undici-types/balanced-pool.d.ts","../../../node_modules/undici-types/agent.d.ts","../../../node_modules/undici-types/mock-interceptor.d.ts","../../../node_modules/undici-types/mock-agent.d.ts","../../../node_modules/undici-types/mock-client.d.ts","../../../node_modules/undici-types/mock-pool.d.ts","../../../node_modules/undici-types/mock-errors.d.ts","../../../node_modules/undici-types/proxy-agent.d.ts","../../../node_modules/undici-types/env-http-proxy-agent.d.ts","../../../node_modules/undici-types/retry-handler.d.ts","../../../node_modules/undici-types/retry-agent.d.ts","../../../node_modules/undici-types/api.d.ts","../../../node_modules/undici-types/interceptors.d.ts","../../../node_modules/undici-types/util.d.ts","../../../node_modules/undici-types/cookies.d.ts","../../../node_modules/undici-types/patch.d.ts","../../../node_modules/undici-types/websocket.d.ts","../../../node_modules/undici-types/eventsource.d.ts","../../../node_modules/undici-types/filereader.d.ts","../../../node_modules/undici-types/diagnostics-channel.d.ts","../../../node_modules/undici-types/content-type.d.ts","../../../node_modules/undici-types/cache.d.ts","../../../node_modules/undici-types/index.d.ts","../../../node_modules/@types/node/web-globals/fetch.d.ts","../../../node_modules/@types/node/web-globals/navigator.d.ts","../../../node_modules/@types/node/web-globals/storage.d.ts","../../../node_modules/@types/node/assert.d.ts","../../../node_modules/@types/node/assert/strict.d.ts","../../../node_modules/@types/node/async_hooks.d.ts","../../../node_modules/@types/node/buffer.d.ts","../../../node_modules/@types/node/child_process.d.ts","../../../node_modules/@types/node/cluster.d.ts","../../../node_modules/@types/node/console.d.ts","../../../node_modules/@types/node/constants.d.ts","../../../node_modules/@types/node/crypto.d.ts","../../../node_modules/@types/node/dgram.d.ts","../../../node_modules/@types/node/diagnostics_channel.d.ts","../../../node_modules/@types/node/dns.d.ts","../../../node_modules/@types/node/dns/promises.d.ts","../../../node_modules/@types/node/domain.d.ts","../../../node_modules/@types/node/events.d.ts","../../../node_modules/@types/node/fs.d.ts","../../../node_modules/@types/node/fs/promises.d.ts","../../../node_modules/@types/node/http.d.ts","../../../node_modules/@types/node/http2.d.ts","../../../node_modules/@types/node/https.d.ts","../../../node_modules/@types/node/inspector.d.ts","../../../node_modules/@types/node/inspector.generated.d.ts","../../../node_modules/@types/node/module.d.ts","../../../node_modules/@types/node/net.d.ts","../../../node_modules/@types/node/os.d.ts","../../../node_modules/@types/node/path.d.ts","../../../node_modules/@types/node/perf_hooks.d.ts","../../../node_modules/@types/node/process.d.ts","../../../node_modules/@types/node/punycode.d.ts","../../../node_modules/@types/node/querystring.d.ts","../../../node_modules/@types/node/readline.d.ts","../../../node_modules/@types/node/readline/promises.d.ts","../../../node_modules/@types/node/repl.d.ts","../../../node_modules/@types/node/sea.d.ts","../../../node_modules/@types/node/sqlite.d.ts","../../../node_modules/@types/node/stream.d.ts","../../../node_modules/@types/node/stream/promises.d.ts","../../../node_modules/@types/node/stream/consumers.d.ts","../../../node_modules/@types/node/stream/web.d.ts","../../../node_modules/@types/node/string_decoder.d.ts","../../../node_modules/@types/node/test.d.ts","../../../node_modules/@types/node/timers.d.ts","../../../node_modules/@types/node/timers/promises.d.ts","../../../node_modules/@types/node/tls.d.ts","../../../node_modules/@types/node/trace_events.d.ts","../../../node_modules/@types/node/tty.d.ts","../../../node_modules/@types/node/url.d.ts","../../../node_modules/@types/node/util.d.ts","../../../node_modules/@types/node/v8.d.ts","../../../node_modules/@types/node/vm.d.ts","../../../node_modules/@types/node/wasi.d.ts","../../../node_modules/@types/node/worker_threads.d.ts","../../../node_modules/@types/node/zlib.d.ts","../../../node_modules/@types/node/index.d.ts"],"fileIdsList":[[64,110,111,113,130,131],[64,112,113,130,131],[113,130,131],[64,113,118,130,131,148],[64,113,114,119,124,130,131,133,145,156],[64,113,114,115,124,130,131,133],[64,113,130,131],[59,60,61,64,113,130,131],[64,113,116,130,131,157],[64,113,117,118,125,130,131,134],[64,113,118,130,131,145,153],[64,113,119,121,124,130,131,133],[64,112,113,120,130,131],[64,113,121,122,130,131],[64,113,123,124,130,131],[64,112,113,124,130,131],[64,113,124,125,126,130,131,145,156],[64,113,124,125,126,130,131,140,145,148],[64,106,113,121,124,127,130,131,133,145,156],[64,113,124,125,127,128,130,131,133,145,153,156],[64,113,127,129,130,131,145,153,156],[62,63,64,65,66,67,68,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162],[64,113,124,130,131],[64,113,130,131,132,156],[64,113,121,124,130,131,133,145],[64,113,130,131,134],[64,113,130,131,135],[64,112,113,130,131,136],[64,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162],[64,113,130,131,138],[64,113,130,131,139],[64,113,124,130,131,140,141],[64,113,130,131,140,142,157,159],[64,113,125,130,131],[64,113,124,130,131,145,146,148],[64,113,130,131,147,148],[64,113,130,131,145,146],[64,113,130,131,148],[64,113,130,131,149],[64,110,113,130,131,145,150,156],[64,113,124,130,131,151,152],[64,113,130,131,151,152],[64,113,118,130,131,133,145,153],[64,113,130,131,154],[64,113,130,131,133,155],[64,113,127,130,131,139,156],[64,113,118,130,131,157],[64,113,130,131,145,158],[64,113,130,131,132,159],[64,113,130,131,160],[64,106,113,130,131],[64,106,113,124,126,130,131,136,145,148,156,158,159,161],[64,113,130,131,145,162],[64,78,82,113,130,131,156],[64,78,113,130,131,145,156],[64,73,113,130,131],[64,75,78,113,130,131,153,156],[64,113,130,131,133,153],[64,113,130,131,163],[64,73,113,130,131,163],[64,75,78,113,130,131,133,156],[64,70,71,74,77,113,124,130,131,145,156],[64,78,85,113,130,131],[64,70,76,113,130,131],[64,78,99,100,113,130,131],[64,74,78,113,130,131,148,156,163],[64,99,113,130,131,163],[64,72,73,113,130,131,163],[64,78,113,130,131],[64,72,73,74,75,76,77,78,79,80,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,100,101,102,103,104,105,113,130,131],[64,78,93,113,130,131],[64,78,85,86,113,130,131],[64,76,78,86,87,113,130,131],[64,77,113,130,131],[64,70,73,78,113,130,131],[64,78,82,86,87,113,130,131],[64,82,113,130,131],[64,76,78,81,113,130,131,156],[64,70,75,78,85,113,130,131],[64,113,130,131,145],[64,73,78,99,113,130,131,161,163]],"fileInfos":[{"version":"c430d44666289dae81f30fa7b2edebf186ecc91a2d4c71266ea6ae76388792e1","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","impliedFormat":1},{"version":"ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"fb0f136d372979348d59b3f5020b4cdb81b5504192b1cacff5d1fbba29378aa1","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"a680117f487a4d2f30ea46f1b4b7f58bef1480456e18ba53ee85c2746eeca012","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedFormat":1},{"version":"8cdf8847677ac7d20486e54dd3fcf09eda95812ac8ace44b4418da1bbbab6eb8","affectsGlobalScope":true,"impliedFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"6c7176368037af28cb72f2392010fa1cef295d6d6744bca8cfb54985f3a18c3e","affectsGlobalScope":true,"impliedFormat":1},{"version":"ab41ef1f2cdafb8df48be20cd969d875602483859dc194e9c97c8a576892c052","affectsGlobalScope":true,"impliedFormat":1},{"version":"437e20f2ba32abaeb7985e0afe0002de1917bc74e949ba585e49feba65da6ca1","affectsGlobalScope":true,"impliedFormat":1},{"version":"21d819c173c0cf7cc3ce57c3276e77fd9a8a01d35a06ad87158781515c9a438a","impliedFormat":1},{"version":"98cffbf06d6bab333473c70a893770dbe990783904002c4f1a960447b4b53dca","affectsGlobalScope":true,"impliedFormat":1},{"version":"3af97acf03cc97de58a3a4bc91f8f616408099bc4233f6d0852e72a8ffb91ac9","affectsGlobalScope":true,"impliedFormat":1},{"version":"808069bba06b6768b62fd22429b53362e7af342da4a236ed2d2e1c89fcca3b4a","affectsGlobalScope":true,"impliedFormat":1},{"version":"1db0b7dca579049ca4193d034d835f6bfe73096c73663e5ef9a0b5779939f3d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"9798340ffb0d067d69b1ae5b32faa17ab31b82466a3fc00d8f2f2df0c8554aaa","affectsGlobalScope":true,"impliedFormat":1},{"version":"f26b11d8d8e4b8028f1c7d618b22274c892e4b0ef5b3678a8ccbad85419aef43","affectsGlobalScope":true,"impliedFormat":1},{"version":"4967529644e391115ca5592184d4b63980569adf60ee685f968fd59ab1557188","impliedFormat":1},{"version":"5929864ce17fba74232584d90cb721a89b7ad277220627cc97054ba15a98ea8f","impliedFormat":1},{"version":"763fe0f42b3d79b440a9b6e51e9ba3f3f91352469c1e4b3b67bfa4ff6352f3f4","impliedFormat":1},{"version":"25c8056edf4314820382a5fdb4bb7816999acdcb929c8f75e3f39473b87e85bc","impliedFormat":1},{"version":"c464d66b20788266e5353b48dc4aa6bc0dc4a707276df1e7152ab0c9ae21fad8","impliedFormat":1},{"version":"78d0d27c130d35c60b5e5566c9f1e5be77caf39804636bc1a40133919a949f21","impliedFormat":1},{"version":"c6fd2c5a395f2432786c9cb8deb870b9b0e8ff7e22c029954fabdd692bff6195","impliedFormat":1},{"version":"1d6e127068ea8e104a912e42fc0a110e2aa5a66a356a917a163e8cf9a65e4a75","impliedFormat":1},{"version":"5ded6427296cdf3b9542de4471d2aa8d3983671d4cac0f4bf9c637208d1ced43","impliedFormat":1},{"version":"7f182617db458e98fc18dfb272d40aa2fff3a353c44a89b2c0ccb3937709bfb5","impliedFormat":1},{"version":"cadc8aced301244057c4e7e73fbcae534b0f5b12a37b150d80e5a45aa4bebcbd","impliedFormat":1},{"version":"385aab901643aa54e1c36f5ef3107913b10d1b5bb8cbcd933d4263b80a0d7f20","impliedFormat":1},{"version":"9670d44354bab9d9982eca21945686b5c24a3f893db73c0dae0fd74217a4c219","impliedFormat":1},{"version":"0b8a9268adaf4da35e7fa830c8981cfa22adbbe5b3f6f5ab91f6658899e657a7","impliedFormat":1},{"version":"11396ed8a44c02ab9798b7dca436009f866e8dae3c9c25e8c1fbc396880bf1bb","impliedFormat":1},{"version":"ba7bc87d01492633cb5a0e5da8a4a42a1c86270e7b3d2dea5d156828a84e4882","impliedFormat":1},{"version":"4893a895ea92c85345017a04ed427cbd6a1710453338df26881a6019432febdd","impliedFormat":1},{"version":"c21dc52e277bcfc75fac0436ccb75c204f9e1b3fa5e12729670910639f27343e","impliedFormat":1},{"version":"13f6f39e12b1518c6650bbb220c8985999020fe0f21d818e28f512b7771d00f9","impliedFormat":1},{"version":"9b5369969f6e7175740bf51223112ff209f94ba43ecd3bb09eefff9fd675624a","impliedFormat":1},{"version":"4fe9e626e7164748e8769bbf74b538e09607f07ed17c2f20af8d680ee49fc1da","impliedFormat":1},{"version":"24515859bc0b836719105bb6cc3d68255042a9f02a6022b3187948b204946bd2","impliedFormat":1},{"version":"ea0148f897b45a76544ae179784c95af1bd6721b8610af9ffa467a518a086a43","impliedFormat":1},{"version":"24c6a117721e606c9984335f71711877293a9651e44f59f3d21c1ea0856f9cc9","impliedFormat":1},{"version":"dd3273ead9fbde62a72949c97dbec2247ea08e0c6952e701a483d74ef92d6a17","impliedFormat":1},{"version":"405822be75ad3e4d162e07439bac80c6bcc6dbae1929e179cf467ec0b9ee4e2e","impliedFormat":1},{"version":"0db18c6e78ea846316c012478888f33c11ffadab9efd1cc8bcc12daded7a60b6","impliedFormat":1},{"version":"e61be3f894b41b7baa1fbd6a66893f2579bfad01d208b4ff61daef21493ef0a8","impliedFormat":1},{"version":"bd0532fd6556073727d28da0edfd1736417a3f9f394877b6d5ef6ad88fba1d1a","impliedFormat":1},{"version":"89167d696a849fce5ca508032aabfe901c0868f833a8625d5a9c6e861ef935d2","impliedFormat":1},{"version":"615ba88d0128ed16bf83ef8ccbb6aff05c3ee2db1cc0f89ab50a4939bfc1943f","impliedFormat":1},{"version":"a4d551dbf8746780194d550c88f26cf937caf8d56f102969a110cfaed4b06656","impliedFormat":1},{"version":"8bd86b8e8f6a6aa6c49b71e14c4ffe1211a0e97c80f08d2c8cc98838006e4b88","impliedFormat":1},{"version":"317e63deeb21ac07f3992f5b50cdca8338f10acd4fbb7257ebf56735bf52ab00","impliedFormat":1},{"version":"4732aec92b20fb28c5fe9ad99521fb59974289ed1e45aecb282616202184064f","impliedFormat":1},{"version":"2e85db9e6fd73cfa3d7f28e0ab6b55417ea18931423bd47b409a96e4a169e8e6","impliedFormat":1},{"version":"c46e079fe54c76f95c67fb89081b3e399da2c7d109e7dca8e4b58d83e332e605","impliedFormat":1},{"version":"bf67d53d168abc1298888693338cb82854bdb2e69ef83f8a0092093c2d562107","impliedFormat":1},{"version":"b52476feb4a0cbcb25e5931b930fc73cb6643fb1a5060bf8a3dda0eeae5b4b68","affectsGlobalScope":true,"impliedFormat":1},{"version":"f9501cc13ce624c72b61f12b3963e84fad210fbdf0ffbc4590e08460a3f04eba","affectsGlobalScope":true,"impliedFormat":1},{"version":"e7721c4f69f93c91360c26a0a84ee885997d748237ef78ef665b153e622b36c1","affectsGlobalScope":true,"impliedFormat":1},{"version":"0fa06ada475b910e2106c98c68b10483dc8811d0c14a8a8dd36efb2672485b29","impliedFormat":1},{"version":"33e5e9aba62c3193d10d1d33ae1fa75c46a1171cf76fef750777377d53b0303f","impliedFormat":1},{"version":"2b06b93fd01bcd49d1a6bd1f9b65ddcae6480b9a86e9061634d6f8e354c1468f","impliedFormat":1},{"version":"6a0cd27e5dc2cfbe039e731cf879d12b0e2dded06d1b1dedad07f7712de0d7f4","affectsGlobalScope":true,"impliedFormat":1},{"version":"13f5c844119c43e51ce777c509267f14d6aaf31eafb2c2b002ca35584cd13b29","impliedFormat":1},{"version":"e60477649d6ad21542bd2dc7e3d9ff6853d0797ba9f689ba2f6653818999c264","impliedFormat":1},{"version":"c2510f124c0293ab80b1777c44d80f812b75612f297b9857406468c0f4dafe29","affectsGlobalScope":true,"impliedFormat":1},{"version":"5524481e56c48ff486f42926778c0a3cce1cc85dc46683b92b1271865bcf015a","impliedFormat":1},{"version":"4c829ab315f57c5442c6667b53769975acbf92003a66aef19bce151987675bd1","affectsGlobalScope":true,"impliedFormat":1},{"version":"b2ade7657e2db96d18315694789eff2ddd3d8aea7215b181f8a0b303277cc579","impliedFormat":1},{"version":"9855e02d837744303391e5623a531734443a5f8e6e8755e018c41d63ad797db2","impliedFormat":1},{"version":"4d631b81fa2f07a0e63a9a143d6a82c25c5f051298651a9b69176ba28930756d","impliedFormat":1},{"version":"836a356aae992ff3c28a0212e3eabcb76dd4b0cc06bcb9607aeef560661b860d","impliedFormat":1},{"version":"1e0d1f8b0adfa0b0330e028c7941b5a98c08b600efe7f14d2d2a00854fb2f393","impliedFormat":1},{"version":"41670ee38943d9cbb4924e436f56fc19ee94232bc96108562de1a734af20dc2c","affectsGlobalScope":true,"impliedFormat":1},{"version":"c906fb15bd2aabc9ed1e3f44eb6a8661199d6c320b3aa196b826121552cb3695","impliedFormat":1},{"version":"22295e8103f1d6d8ea4b5d6211e43421fe4564e34d0dd8e09e520e452d89e659","impliedFormat":1},{"version":"f949f7f6c7802a338039cfc2156d1fe285cdd1e092c64437ebe15ae8edc854e0","impliedFormat":1},{"version":"6b4e081d55ac24fc8a4631d5dd77fe249fa25900abd7d046abb87d90e3b45645","impliedFormat":1},{"version":"a10f0e1854f3316d7ee437b79649e5a6ae3ae14ffe6322b02d4987071a95362e","impliedFormat":1},{"version":"e208f73ef6a980104304b0d2ca5f6bf1b85de6009d2c7e404028b875020fa8f2","impliedFormat":1},{"version":"d163b6bc2372b4f07260747cbc6c0a6405ab3fbcea3852305e98ac43ca59f5bc","impliedFormat":1},{"version":"e6fa9ad47c5f71ff733744a029d1dc472c618de53804eae08ffc243b936f87ff","affectsGlobalScope":true,"impliedFormat":1},{"version":"83e63d6ccf8ec004a3bb6d58b9bb0104f60e002754b1e968024b320730cc5311","impliedFormat":1},{"version":"24826ed94a78d5c64bd857570fdbd96229ad41b5cb654c08d75a9845e3ab7dde","impliedFormat":1},{"version":"8b479a130ccb62e98f11f136d3ac80f2984fdc07616516d29881f3061f2dd472","impliedFormat":1},{"version":"928af3d90454bf656a52a48679f199f64c1435247d6189d1caf4c68f2eaf921f","affectsGlobalScope":true,"impliedFormat":1},{"version":"d2bc7425ef40526650d6db7e072c1ff4a51101c3ac2cc4b666623b19496a6e27","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f16a7e4deafa527ed9995a772bb380eb7d3c2c0fd4ae178c5263ed18394db2c","impliedFormat":1},{"version":"933921f0bb0ec12ef45d1062a1fc0f27635318f4d294e4d99de9a5493e618ca2","impliedFormat":1},{"version":"71a0f3ad612c123b57239a7749770017ecfe6b66411488000aba83e4546fde25","impliedFormat":1},{"version":"77fbe5eecb6fac4b6242bbf6eebfc43e98ce5ccba8fa44e0ef6a95c945ff4d98","impliedFormat":1},{"version":"4f9d8ca0c417b67b69eeb54c7ca1bedd7b56034bb9bfd27c5d4f3bc4692daca7","impliedFormat":1},{"version":"814118df420c4e38fe5ae1b9a3bafb6e9c2aa40838e528cde908381867be6466","impliedFormat":1},{"version":"a3fc63c0d7b031693f665f5494412ba4b551fe644ededccc0ab5922401079c95","impliedFormat":1},{"version":"f27524f4bef4b6519c604bdb23bf4465bddcccbf3f003abb901acbd0d7404d99","impliedFormat":1},{"version":"37ba7b45141a45ce6e80e66f2a96c8a5ab1bcef0fc2d0f56bb58df96ec67e972","impliedFormat":1},{"version":"45650f47bfb376c8a8ed39d4bcda5902ab899a3150029684ee4c10676d9fbaee","impliedFormat":1},{"version":"6b039f55681caaf111d5eb84d292b9bee9e0131d0db1ad0871eef0964f533c73","affectsGlobalScope":true,"impliedFormat":1},{"version":"18fd40412d102c5564136f29735e5d1c3b455b8a37f920da79561f1fde068208","impliedFormat":1},{"version":"c8d3e5a18ba35629954e48c4cc8f11dc88224650067a172685c736b27a34a4dc","impliedFormat":1},{"version":"f0be1b8078cd549d91f37c30c222c2a187ac1cf981d994fb476a1adc61387b14","affectsGlobalScope":true,"impliedFormat":1},{"version":"0aaed1d72199b01234152f7a60046bc947f1f37d78d182e9ae09c4289e06a592","impliedFormat":1},{"version":"0dba70b3fb0dcd713fda33c2df64fa6751fff6460e536971cee917260fb17882","impliedFormat":1},{"version":"66ba1b2c3e3a3644a1011cd530fb444a96b1b2dfe2f5e837a002d41a1a799e60","impliedFormat":1},{"version":"7e514f5b852fdbc166b539fdd1f4e9114f29911592a5eb10a94bb3a13ccac3c4","impliedFormat":1},{"version":"5b7aa3c4c1a5d81b411e8cb302b45507fea9358d3569196b27eb1a27ae3a90ef","affectsGlobalScope":true,"impliedFormat":1},{"version":"5987a903da92c7462e0b35704ce7da94d7fdc4b89a984871c0e2b87a8aae9e69","affectsGlobalScope":true,"impliedFormat":1},{"version":"ea08a0345023ade2b47fbff5a76d0d0ed8bff10bc9d22b83f40858a8e941501c","impliedFormat":1},{"version":"47613031a5a31510831304405af561b0ffaedb734437c595256bb61a90f9311b","impliedFormat":1},{"version":"ae062ce7d9510060c5d7e7952ae379224fb3f8f2dd74e88959878af2057c143b","impliedFormat":1},{"version":"8a1a0d0a4a06a8d278947fcb66bf684f117bf147f89b06e50662d79a53be3e9f","affectsGlobalScope":true,"impliedFormat":1},{"version":"9f663c2f91127ef7024e8ca4b3b4383ff2770e5f826696005de382282794b127","impliedFormat":1},{"version":"9f55299850d4f0921e79b6bf344b47c420ce0f507b9dcf593e532b09ea7eeea1","impliedFormat":1}],"root":[58],"options":{"allowJs":false,"checkJs":false,"composite":false,"declaration":true,"declarationMap":true,"esModuleInterop":true,"module":99,"noImplicitAny":true,"noImplicitReturns":true,"noImplicitThis":true,"noUnusedLocals":true,"noUnusedParameters":false,"outDir":"./","rootDir":"..","skipLibCheck":true,"sourceMap":true,"target":9},"referencedMap":[[110,1],[111,1],[112,2],[64,3],[113,4],[114,5],[115,6],[59,7],[62,8],[60,7],[61,7],[116,9],[117,10],[118,11],[119,12],[120,13],[121,14],[122,14],[123,15],[124,16],[125,17],[126,18],[65,7],[63,7],[127,19],[128,20],[129,21],[163,22],[130,23],[131,7],[132,24],[133,25],[134,26],[135,27],[136,28],[137,29],[138,30],[139,31],[140,32],[141,32],[142,33],[143,7],[144,34],[145,35],[147,36],[146,37],[148,38],[149,39],[150,40],[151,41],[152,42],[153,43],[154,44],[155,45],[156,46],[157,47],[158,48],[159,49],[160,50],[66,7],[67,7],[68,7],[107,51],[108,7],[109,7],[161,52],[162,53],[69,7],[56,7],[57,7],[11,7],[10,7],[2,7],[12,7],[13,7],[14,7],[15,7],[16,7],[17,7],[18,7],[19,7],[3,7],[20,7],[21,7],[4,7],[22,7],[26,7],[23,7],[24,7],[25,7],[27,7],[28,7],[29,7],[5,7],[30,7],[31,7],[32,7],[33,7],[6,7],[37,7],[34,7],[35,7],[36,7],[38,7],[7,7],[39,7],[44,7],[45,7],[40,7],[41,7],[42,7],[43,7],[8,7],[49,7],[46,7],[47,7],[48,7],[50,7],[9,7],[51,7],[52,7],[53,7],[55,7],[54,7],[1,7],[85,54],[95,55],[84,54],[105,56],[76,57],[75,58],[104,59],[98,60],[103,61],[78,62],[92,63],[77,64],[101,65],[73,66],[72,59],[102,67],[74,68],[79,69],[80,7],[83,69],[70,7],[106,70],[96,71],[87,72],[88,73],[90,74],[86,75],[89,76],[99,59],[81,77],[82,78],[91,79],[71,80],[94,71],[93,69],[97,7],[100,81],[58,7]],"semanticDiagnosticsPerFile":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163],"checkPending":true,"version":"5.9.3"}
|
package/index.mjs
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { cpSync, readdirSync, renameSync, readFileSync, writeFileSync, statSync, existsSync } from "fs"
|
|
4
|
+
import { join, dirname } from "path"
|
|
5
|
+
import { fileURLToPath } from "url"
|
|
6
|
+
import { createInterface } from "readline/promises"
|
|
7
|
+
|
|
8
|
+
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
9
|
+
const templateDir = join(__dirname, "template")
|
|
10
|
+
|
|
11
|
+
function titleize(name) {
|
|
12
|
+
return name
|
|
13
|
+
.replace(/[-_]/g, " ")
|
|
14
|
+
.replace(/\b\w/g, c => c.toUpperCase())
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function walkFiles(dir) {
|
|
18
|
+
const results = []
|
|
19
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
20
|
+
const full = join(dir, entry.name)
|
|
21
|
+
if (entry.isDirectory()) {
|
|
22
|
+
results.push(...walkFiles(full))
|
|
23
|
+
} else {
|
|
24
|
+
results.push(full)
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return results
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async function main() {
|
|
31
|
+
let name = process.argv[2]
|
|
32
|
+
|
|
33
|
+
if (!name) {
|
|
34
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout })
|
|
35
|
+
name = await rl.question("Project name: ")
|
|
36
|
+
rl.close()
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
name = name.trim()
|
|
40
|
+
|
|
41
|
+
if (!name) {
|
|
42
|
+
console.error("Error: project name is required.")
|
|
43
|
+
process.exit(1)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (existsSync(name)) {
|
|
47
|
+
console.error(`Error: directory "${name}" already exists.`)
|
|
48
|
+
process.exit(1)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const title = titleize(name)
|
|
52
|
+
const targetDir = join(process.cwd(), name)
|
|
53
|
+
|
|
54
|
+
console.log()
|
|
55
|
+
console.log(` Creating grest-ts project in ./${name}...`)
|
|
56
|
+
console.log()
|
|
57
|
+
|
|
58
|
+
// 1. Copy template
|
|
59
|
+
cpSync(templateDir, targetDir, { recursive: true })
|
|
60
|
+
|
|
61
|
+
// 2. Rename _package.json → package.json
|
|
62
|
+
for (const file of walkFiles(targetDir)) {
|
|
63
|
+
if (file.endsWith("_package.json")) {
|
|
64
|
+
renameSync(file, join(dirname(file), "package.json"))
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// 3. Replace placeholders in .json, .ts, .html files
|
|
69
|
+
for (const file of walkFiles(targetDir)) {
|
|
70
|
+
if (/\.(json|ts|html)$/.test(file)) {
|
|
71
|
+
let content = readFileSync(file, "utf-8")
|
|
72
|
+
const original = content
|
|
73
|
+
content = content.replaceAll("@newproject/", `@${name}/`)
|
|
74
|
+
content = content.replaceAll('"new-project"', `"${name}"`)
|
|
75
|
+
content = content.replaceAll("New Project", title)
|
|
76
|
+
if (content !== original) {
|
|
77
|
+
writeFileSync(file, content)
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
console.log(` Done! Next steps:`)
|
|
83
|
+
console.log()
|
|
84
|
+
console.log(` cd ${name}`)
|
|
85
|
+
console.log(` npm install`)
|
|
86
|
+
console.log(` cd server && npm run dev # start the server`)
|
|
87
|
+
console.log(` cd client && npm run dev # start the client (in another terminal)`)
|
|
88
|
+
console.log()
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
main().catch(err => {
|
|
92
|
+
console.error(err)
|
|
93
|
+
process.exit(1)
|
|
94
|
+
})
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@grest-ts/create-starter",
|
|
3
|
+
"version": "0.0.14",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"description": "Scaffold a new grest-ts project",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"index.mjs",
|
|
10
|
+
"template"
|
|
11
|
+
],
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/grest-ts/grest-ts.git",
|
|
18
|
+
"directory": "packages-tooling/create-starter"
|
|
19
|
+
},
|
|
20
|
+
"homepage": "https://github.com/grest-ts/grest-ts/tree/master/packages-tooling/create-starter",
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/grest-ts/grest-ts/issues"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"typescript",
|
|
26
|
+
"framework",
|
|
27
|
+
"contract",
|
|
28
|
+
"api",
|
|
29
|
+
"microservices",
|
|
30
|
+
"testing",
|
|
31
|
+
"grest-ts",
|
|
32
|
+
"create",
|
|
33
|
+
"scaffold",
|
|
34
|
+
"starter"
|
|
35
|
+
],
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=25"
|
|
38
|
+
},
|
|
39
|
+
"bin": "./index.mjs",
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@grest-ts/x-packager": "0.0.14"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {GGContractClass, IsObject, IsString, VALIDATION_ERROR, SERVER_ERROR} from "@grest-ts/schema"
|
|
2
|
+
import {httpSchema, GGRpc} from "@grest-ts/http"
|
|
3
|
+
|
|
4
|
+
// --- Types ---
|
|
5
|
+
|
|
6
|
+
export const IsHelloRequest = IsObject({
|
|
7
|
+
name: IsString
|
|
8
|
+
})
|
|
9
|
+
export type HelloRequest = typeof IsHelloRequest.infer
|
|
10
|
+
|
|
11
|
+
export const IsHelloResponse = IsObject({
|
|
12
|
+
message: IsString
|
|
13
|
+
})
|
|
14
|
+
export type HelloResponse = typeof IsHelloResponse.infer
|
|
15
|
+
|
|
16
|
+
// --- Contract ---
|
|
17
|
+
|
|
18
|
+
export const HelloApiContract = new GGContractClass("HelloApi", {
|
|
19
|
+
hello: {
|
|
20
|
+
input: IsHelloRequest,
|
|
21
|
+
success: IsHelloResponse,
|
|
22
|
+
errors: [VALIDATION_ERROR, SERVER_ERROR]
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
// --- HTTP Schema ---
|
|
27
|
+
|
|
28
|
+
export const HelloApi = httpSchema(HelloApiContract)
|
|
29
|
+
.pathPrefix("api/hello")
|
|
30
|
+
.routes({
|
|
31
|
+
hello: GGRpc.POST("hello")
|
|
32
|
+
})
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"include": ["src/**/*.ts"],
|
|
3
|
+
"exclude": ["node_modules"],
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"experimentalDecorators": true,
|
|
6
|
+
"outDir": "dist",
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"sourceMap": true,
|
|
10
|
+
"module": "ESNext",
|
|
11
|
+
"moduleResolution": "bundler",
|
|
12
|
+
"noImplicitAny": true,
|
|
13
|
+
"noImplicitReturns": true,
|
|
14
|
+
"noImplicitThis": true,
|
|
15
|
+
"noUnusedLocals": true,
|
|
16
|
+
"noUnusedParameters": false,
|
|
17
|
+
"target": "es6",
|
|
18
|
+
"lib": ["esnext"]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@newproject/client",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "vite",
|
|
7
|
+
"build": "vite build",
|
|
8
|
+
"preview": "vite preview"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@newproject/api": "*"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"typescript": "^5.9.3",
|
|
15
|
+
"vite": "^7.3.1"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8"/>
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
6
|
+
<title>New Project</title>
|
|
7
|
+
<style>
|
|
8
|
+
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
9
|
+
body { font-family: system-ui, sans-serif; padding: 2rem; background: #f5f5f5; }
|
|
10
|
+
h1 { margin-bottom: 1rem; color: #1a1a1a; }
|
|
11
|
+
.card { background: white; padding: 1.5rem; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); max-width: 400px; }
|
|
12
|
+
input { padding: 0.5rem; border: 1px solid #ddd; border-radius: 4px; width: 100%; margin-bottom: 0.75rem; font-size: 1rem; }
|
|
13
|
+
button { padding: 0.5rem 1rem; background: #2563eb; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 1rem; }
|
|
14
|
+
button:hover { background: #1d4ed8; }
|
|
15
|
+
#result { margin-top: 1rem; padding: 0.75rem; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 4px; display: none; }
|
|
16
|
+
#result.error { background: #fef2f2; border-color: #fecaca; }
|
|
17
|
+
</style>
|
|
18
|
+
</head>
|
|
19
|
+
<body>
|
|
20
|
+
<h1>New Project</h1>
|
|
21
|
+
<div class="card">
|
|
22
|
+
<input type="text" id="nameInput" placeholder="Enter your name..." value="World"/>
|
|
23
|
+
<button id="callBtn">Call HelloApi</button>
|
|
24
|
+
<div id="result"></div>
|
|
25
|
+
</div>
|
|
26
|
+
<script type="module" src="/src/main.ts"></script>
|
|
27
|
+
</body>
|
|
28
|
+
</html>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {GGHttpClientConfig} from "@grest-ts/http"
|
|
2
|
+
import {HelloApi} from "@newproject/api/api/HelloApi"
|
|
3
|
+
|
|
4
|
+
// Create typed API client. Vite proxy forwards /api/* to the server.
|
|
5
|
+
const clientConfig: GGHttpClientConfig = {url: ""}
|
|
6
|
+
const helloApi = HelloApi.createClient(clientConfig)
|
|
7
|
+
|
|
8
|
+
// ---
|
|
9
|
+
|
|
10
|
+
const nameInput = document.getElementById("nameInput") as HTMLInputElement
|
|
11
|
+
const callBtn = document.getElementById("callBtn") as HTMLButtonElement
|
|
12
|
+
const resultDiv = document.getElementById("result") as HTMLDivElement
|
|
13
|
+
|
|
14
|
+
callBtn.addEventListener("click", async () => {
|
|
15
|
+
try {
|
|
16
|
+
const response = await helloApi.hello({name: nameInput.value})
|
|
17
|
+
resultDiv.textContent = response.message
|
|
18
|
+
resultDiv.style.display = "block"
|
|
19
|
+
resultDiv.className = ""
|
|
20
|
+
} catch (err) {
|
|
21
|
+
resultDiv.textContent = "Error: " + String(err)
|
|
22
|
+
resultDiv.style.display = "block"
|
|
23
|
+
resultDiv.className = "error"
|
|
24
|
+
}
|
|
25
|
+
})
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"include": ["src/**/*.ts"],
|
|
3
|
+
"exclude": ["node_modules"],
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"alwaysStrict": true,
|
|
6
|
+
"esModuleInterop": true,
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
"sourceMap": true,
|
|
9
|
+
"module": "ESNext",
|
|
10
|
+
"moduleResolution": "bundler",
|
|
11
|
+
"noImplicitAny": true,
|
|
12
|
+
"noImplicitReturns": true,
|
|
13
|
+
"noImplicitThis": true,
|
|
14
|
+
"target": "ES2022",
|
|
15
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
16
|
+
"paths": {
|
|
17
|
+
"@newproject/api/*": ["../api/src/*"]
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {defineConfig} from 'vite'
|
|
2
|
+
// @ts-ignore
|
|
3
|
+
import path from 'path'
|
|
4
|
+
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
server: {
|
|
7
|
+
port: 3000,
|
|
8
|
+
proxy: {
|
|
9
|
+
'/api': 'http://localhost:9000',
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
build: {
|
|
13
|
+
outDir: 'build',
|
|
14
|
+
rollupOptions: {
|
|
15
|
+
external: ['@gg/discovery'],
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
resolve: {
|
|
19
|
+
alias: {
|
|
20
|
+
'@newproject/api': path.resolve(__dirname, '../api/src'),
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
optimizeDeps: {
|
|
24
|
+
exclude: ['@newproject/api'],
|
|
25
|
+
},
|
|
26
|
+
})
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@newproject/server",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"start": "tsx src/AppRuntime.ts",
|
|
8
|
+
"dev": "tsx watch src/AppRuntime.ts",
|
|
9
|
+
"test": "vitest",
|
|
10
|
+
"build": "tsx esbuild.config.ts"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@grest-ts/http": "*",
|
|
14
|
+
"@grest-ts/locator": "*",
|
|
15
|
+
"@grest-ts/logger": "*",
|
|
16
|
+
"@grest-ts/logger-console": "*",
|
|
17
|
+
"@grest-ts/runtime": "*",
|
|
18
|
+
"@grest-ts/schema": "*",
|
|
19
|
+
"@grest-ts/testkit": "*",
|
|
20
|
+
"@grest-ts/testkit-vitest": "*",
|
|
21
|
+
"@newproject/api": "*"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@types/node": "^22.0.0",
|
|
25
|
+
"esbuild": "^0.27.3",
|
|
26
|
+
"tsx": "^4.0.0",
|
|
27
|
+
"typescript": "^5.9.3",
|
|
28
|
+
"vitest": "^4.0.18"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as esbuild from 'esbuild';
|
|
2
|
+
import { readFileSync, writeFileSync, mkdirSync } from 'fs';
|
|
3
|
+
|
|
4
|
+
const pkg = JSON.parse(readFileSync('package.json', 'utf-8'));
|
|
5
|
+
const runtimeDeps = Object.keys(pkg.dependencies || {});
|
|
6
|
+
|
|
7
|
+
// Generate a production package.json with only runtime dependencies
|
|
8
|
+
mkdirSync('dist', { recursive: true });
|
|
9
|
+
writeFileSync('dist/package.json', JSON.stringify({
|
|
10
|
+
name: pkg.name,
|
|
11
|
+
version: pkg.version,
|
|
12
|
+
type: pkg.type,
|
|
13
|
+
scripts: { start: "node ./server.js" },
|
|
14
|
+
dependencies: pkg.dependencies,
|
|
15
|
+
}, null, 2));
|
|
16
|
+
|
|
17
|
+
esbuild.build({
|
|
18
|
+
entryPoints: ['src/AppRuntime.ts'],
|
|
19
|
+
bundle: true,
|
|
20
|
+
platform: 'node',
|
|
21
|
+
format: 'esm',
|
|
22
|
+
target: 'node20',
|
|
23
|
+
outfile: 'dist/server.js',
|
|
24
|
+
sourcemap: true,
|
|
25
|
+
tsconfig: 'tsconfig.json',
|
|
26
|
+
banner: {
|
|
27
|
+
js: "import { createRequire } from 'module';\nconst require = createRequire(import.meta.url);",
|
|
28
|
+
},
|
|
29
|
+
plugins: [{
|
|
30
|
+
name: 'externalize-deps',
|
|
31
|
+
setup(build) {
|
|
32
|
+
// Only externalize packages listed in dependencies (runtime deps).
|
|
33
|
+
// Everything else (@grest-ts/*, @newproject/*) gets bundled.
|
|
34
|
+
build.onResolve({ filter: /^[^./]/ }, (args) => {
|
|
35
|
+
const pkg = args.path.startsWith('@')
|
|
36
|
+
? args.path.split('/').slice(0, 2).join('/')
|
|
37
|
+
: args.path.split('/')[0];
|
|
38
|
+
if (runtimeDeps.includes(pkg)) {
|
|
39
|
+
return { path: args.path, external: true };
|
|
40
|
+
}
|
|
41
|
+
return undefined;
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
}],
|
|
45
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {GGHttp, GGHttpServer} from "@grest-ts/http"
|
|
2
|
+
import {GGRuntime} from "@grest-ts/runtime"
|
|
3
|
+
import {GG_LOG} from "@grest-ts/logger"
|
|
4
|
+
import {GGLoggerConsole} from "@grest-ts/logger-console"
|
|
5
|
+
import {HelloApi} from "@newproject/api/api/HelloApi"
|
|
6
|
+
import {HelloApiImpl} from "./services/HelloApiImpl"
|
|
7
|
+
|
|
8
|
+
export class AppRuntime extends GGRuntime {
|
|
9
|
+
|
|
10
|
+
public static readonly NAME = "app"
|
|
11
|
+
|
|
12
|
+
protected compose(): void {
|
|
13
|
+
GG_LOG.get().addLogger(new GGLoggerConsole({showData: true}))
|
|
14
|
+
|
|
15
|
+
const httpServer = new GGHttpServer()
|
|
16
|
+
|
|
17
|
+
new GGHttp(httpServer)
|
|
18
|
+
.http(HelloApi, new HelloApiImpl())
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
AppRuntime.cli(import.meta.url).then()
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {GGTest} from "@grest-ts/testkit"
|
|
2
|
+
import {AppRuntime} from "../../src/AppRuntime"
|
|
3
|
+
import {HelloApi} from "@newproject/api/api/HelloApi"
|
|
4
|
+
import {TestContext} from "../TestContext"
|
|
5
|
+
|
|
6
|
+
describe("Hello API", () => {
|
|
7
|
+
|
|
8
|
+
GGTest.startWorker(AppRuntime)
|
|
9
|
+
|
|
10
|
+
const ctx = new TestContext("Test")
|
|
11
|
+
.apis({hello: HelloApi})
|
|
12
|
+
|
|
13
|
+
test("hello returns greeting", async () => {
|
|
14
|
+
await ctx.hello.hello({name: "World"})
|
|
15
|
+
.toMatchObject({message: "Hello, World!"})
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
test("hello returns greeting with custom name", async () => {
|
|
19
|
+
await ctx.hello.hello({name: "Alice"})
|
|
20
|
+
.toMatchObject({message: "Hello, Alice!"})
|
|
21
|
+
})
|
|
22
|
+
})
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"include": ["src/**/*.ts", "test/**/*.ts"],
|
|
3
|
+
"exclude": ["node_modules"],
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"experimentalDecorators": true,
|
|
6
|
+
"outDir": "dist",
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"sourceMap": true,
|
|
10
|
+
"module": "ESNext",
|
|
11
|
+
"moduleResolution": "bundler",
|
|
12
|
+
"noImplicitAny": true,
|
|
13
|
+
"noImplicitReturns": true,
|
|
14
|
+
"noImplicitThis": true,
|
|
15
|
+
"noUnusedLocals": true,
|
|
16
|
+
"noUnusedParameters": false,
|
|
17
|
+
"target": "es6",
|
|
18
|
+
"lib": ["esnext"],
|
|
19
|
+
"types": ["vitest/globals", "grest-ts-testkits"],
|
|
20
|
+
"paths": {
|
|
21
|
+
"@newproject/api/*": ["../api/src/*"]
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {defineConfig} from 'vitest/config';
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
test: {
|
|
5
|
+
globals: true,
|
|
6
|
+
environment: 'node',
|
|
7
|
+
include: ['test/**/*.test.ts'],
|
|
8
|
+
globalSetup: ['@grest-ts/testkit-vitest/globalSetup'],
|
|
9
|
+
setupFiles: [
|
|
10
|
+
'@grest-ts/testkit-vitest',
|
|
11
|
+
],
|
|
12
|
+
hookTimeout: 60000,
|
|
13
|
+
teardownTimeout: 10000,
|
|
14
|
+
}
|
|
15
|
+
});
|