diff --git a/Makefile b/Makefile index 6062752..ade5e59 100644 --- a/Makefile +++ b/Makefile @@ -20,8 +20,8 @@ JS_SKYPACK_PACKAGE_CHECK_REQ += artifacts/dist ################################################################################ .PHONY: run-example -run-example: artifacts/link-dependencies.touch - source test/fixture/example/invalid-values.sh; node --loader ts-node/esm test/fixture/example/run.ts +run-example: artifacts/link-dependencies.touch artifacts/dist + source test/fixture/example/invalid-values.sh; node test/fixture/example/run.js .PHONY: copy-example copy-example: artifacts/link-dependencies.touch @@ -53,5 +53,5 @@ artifacts/dist/esm: tsconfig.build.esm.json tsconfig.json artifacts/link-depende echo '{"type":"module"}' > "$@/package.json" @touch "$@" -ENVIRONMENT.md: artifacts/link-dependencies.touch $(JS_SOURCE_FILES) $(JS_TEST_FILES) +ENVIRONMENT.md: artifacts/link-dependencies.touch artifacts/dist $(JS_SOURCE_FILES) $(JS_TEST_FILES) AUSTENITE_SPEC=true AUSTENITE_APP=example node test/fixture/example/run.js > "$@" diff --git a/package.json b/package.json index 6b02b9b..0733ac2 100644 --- a/package.json +++ b/package.json @@ -95,7 +95,6 @@ "prettier": "^3.3.3", "prettier-plugin-organize-imports": "^4.1.0", "publint": "^0.2.12", - "ts-node": "^10.9.2", "typescript": "^5.6.3", "typescript-eslint": "^8.13.0", "vite-tsconfig-paths": "^5.1.0", diff --git a/test/fixture/example/env.ts b/test/fixture/example/env.js similarity index 98% rename from test/fixture/example/env.ts rename to test/fixture/example/env.js index 6f75358..cece00f 100644 --- a/test/fixture/example/env.ts +++ b/test/fixture/example/env.js @@ -11,7 +11,7 @@ import { number, string, url, -} from "../../../src/index.js"; +} from "../../../artifacts/dist/esm/index.js"; export const cdnUrl = url("CDN_URL", "CDN to use when serving static assets", { protocols: ["http:", "https:"], diff --git a/test/fixture/example/run.js b/test/fixture/example/run.js index 5bdbd73..74b9ee4 100644 --- a/test/fixture/example/run.js +++ b/test/fixture/example/run.js @@ -1,5 +1,34 @@ -import { register } from "node:module"; -import { pathToFileURL } from "node:url"; +import { initialize } from "../../../artifacts/dist/esm/node.js"; +import { + cdnUrl, + earthAtomCount, + grpcTimeout, + isDebug, + logLevel, + port, + readDsn, + redisPrimary, + sampleRatio, + sessionKey, + weight, +} from "./env.js"; -register("ts-node/esm", pathToFileURL("./")); -await import("./run.ts"); +await initialize(); + +console.log(""); +console.log("Environment is valid 🎉"); +console.log(""); + +console.table({ + cdnUrl: cdnUrl.value().toString(), + earthAtomCount: earthAtomCount.value(), + grpcTimeout: grpcTimeout.value()?.total("millisecond"), + isDebug: isDebug.value(), + logLevel: logLevel.value(), + port: port.value(), + readDsn: readDsn.value(), + redisPrimary: `${redisPrimary.value().host}:${redisPrimary.value().port}`, + sampleRatio: sampleRatio.value(), + sessionKey: sessionKey.value().toString("base64"), + weight: weight.value(), +}); diff --git a/test/fixture/example/run.ts b/test/fixture/example/run.ts deleted file mode 100644 index 6a1375e..0000000 --- a/test/fixture/example/run.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { initialize } from "../../../src/node.js"; -import { - cdnUrl, - earthAtomCount, - grpcTimeout, - isDebug, - logLevel, - port, - readDsn, - redisPrimary, - sampleRatio, - sessionKey, - weight, -} from "./env.js"; - -await initialize(); - -console.log(""); -console.log("Environment is valid 🎉"); -console.log(""); - -console.table({ - cdnUrl: cdnUrl.value().toString(), - earthAtomCount: earthAtomCount.value(), - grpcTimeout: grpcTimeout.value()?.total("millisecond"), - isDebug: isDebug.value(), - logLevel: logLevel.value(), - port: port.value(), - readDsn: readDsn.value(), - redisPrimary: `${redisPrimary.value().host}:${redisPrimary.value().port}`, - sampleRatio: sampleRatio.value(), - sessionKey: sessionKey.value().toString("base64"), - weight: weight.value(), -});