@carlonicora/nextjs-jsonapi 3.27.0 → 3.27.1
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/package.json +1 -1
- package/scripts/dev-watch.mjs +27 -2
package/package.json
CHANGED
package/scripts/dev-watch.mjs
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
//
|
|
14
14
|
// The release build (`pnpm build`) is untouched: it still emits bundled types.
|
|
15
15
|
import { spawn } from "node:child_process";
|
|
16
|
-
import { readdir, readFile, stat, writeFile } from "node:fs/promises";
|
|
16
|
+
import { mkdir, readdir, readFile, stat, writeFile } from "node:fs/promises";
|
|
17
17
|
import path from "node:path";
|
|
18
18
|
import { fileURLToPath } from "node:url";
|
|
19
19
|
|
|
@@ -111,11 +111,36 @@ function shutdown(code) {
|
|
|
111
111
|
process.on("SIGINT", () => shutdown(0));
|
|
112
112
|
process.on("SIGTERM", () => shutdown(0));
|
|
113
113
|
|
|
114
|
+
// tsc reads its own config, which extends the package's and always leaves the
|
|
115
|
+
// tests out: some packages' tsconfig.json still includes them, and the bundled
|
|
116
|
+
// dts build never saw them (it starts from the entry points), so tsc would flood
|
|
117
|
+
// the dev output with test-only type errors and emit declarations for them.
|
|
118
|
+
const devTsconfig = path.join(root, "node_modules", ".cache", "dev-watch", "tsconfig.json");
|
|
119
|
+
await mkdir(path.dirname(devTsconfig), { recursive: true });
|
|
120
|
+
await writeFile(
|
|
121
|
+
devTsconfig,
|
|
122
|
+
JSON.stringify(
|
|
123
|
+
{
|
|
124
|
+
extends: "../../../tsconfig.json",
|
|
125
|
+
include: ["../../../src/**/*.ts", "../../../src/**/*.tsx"],
|
|
126
|
+
exclude: [
|
|
127
|
+
"../../../src/**/*.spec.ts",
|
|
128
|
+
"../../../src/**/*.spec.tsx",
|
|
129
|
+
"../../../src/**/*.test.ts",
|
|
130
|
+
"../../../src/**/*.test.tsx",
|
|
131
|
+
"../../../src/**/__tests__/**/*",
|
|
132
|
+
],
|
|
133
|
+
},
|
|
134
|
+
null,
|
|
135
|
+
2,
|
|
136
|
+
),
|
|
137
|
+
);
|
|
138
|
+
|
|
114
139
|
let rewriting = Promise.resolve();
|
|
115
140
|
run(bin("tsup"), ["--watch"], { TSUP_NO_DTS: "1" });
|
|
116
141
|
run(
|
|
117
142
|
bin("tsc"),
|
|
118
|
-
["-p",
|
|
143
|
+
["-p", devTsconfig, "--watch", "--emitDeclarationOnly", "--preserveWatchOutput"],
|
|
119
144
|
{},
|
|
120
145
|
(line) => {
|
|
121
146
|
if (line.includes("Watching for file changes")) {
|