chore: improve init tests (#3590)
This commit is contained in:
@@ -89,6 +89,7 @@
|
||||
"npm:autoprefixer@^10.4.21": "10.4.21_postcss@8.5.6",
|
||||
"npm:cssnano@^6.1.2": "6.1.2_postcss@8.5.6",
|
||||
"npm:esbuild-wasm@0.25.7": "0.25.7",
|
||||
"npm:esbuild-wasm@~0.25.11": "0.25.11",
|
||||
"npm:esbuild@0.25.7": "0.25.7",
|
||||
"npm:esbuild@~0.25.5": "0.25.7",
|
||||
"npm:feed@^5.1.0": "5.1.0",
|
||||
@@ -2250,6 +2251,10 @@
|
||||
"es-errors"
|
||||
]
|
||||
},
|
||||
"esbuild-wasm@0.25.11": {
|
||||
"integrity": "sha512-60gllbYFIRGzB6KALBB5Va9Wy3VeCi2U0NgmM7r+TFnRgzeEyoCn2D7fhacW2zWbd7MUeTKLDE7RlfYGBQ00bw==",
|
||||
"bin": true
|
||||
},
|
||||
"esbuild-wasm@0.25.7": {
|
||||
"integrity": "sha512-x3t1BlU59YOMtpwzayHxF4LPVujOvNKqm7y6jPvFKC13J8FmJRCdHPJwHq86er7ik+f7uwGcMbe+6KVzLGmsGw==",
|
||||
"bin": true
|
||||
@@ -3874,6 +3879,7 @@
|
||||
"jsr:@std/uuid@^1.0.9",
|
||||
"npm:@opentelemetry/api@^1.9.0",
|
||||
"npm:@types/node@^24.2.1",
|
||||
"npm:esbuild-wasm@~0.25.11",
|
||||
"npm:preact-render-to-string@^6.6.3",
|
||||
"npm:preact@^10.27.2"
|
||||
]
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
"@std/semver": "jsr:@std/semver@^1.0.6",
|
||||
"@std/uuid": "jsr:@std/uuid@^1.0.9",
|
||||
"@types/node": "npm:@types/node@^24.2.1",
|
||||
"esbuild-wasm": "npm:esbuild-wasm@^0.25.11",
|
||||
"preact": "npm:preact@^10.27.2",
|
||||
"preact-render-to-string": "npm:preact-render-to-string@^6.6.3"
|
||||
}
|
||||
|
||||
@@ -62,7 +62,11 @@ async function patchProject(dir: string): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
const ignore = /[/\\]+(.|[^/\\]+_test\..*|tests[^/\\])/;
|
||||
const ignore = (entry: Deno.DirEntry, _full: string) => {
|
||||
return /^(\.|tmp_)/.test(entry.name) ||
|
||||
/_test\.[tj]sx?$/.test(entry.name) ||
|
||||
entry.name === "tests" || entry.name === "test";
|
||||
};
|
||||
|
||||
await copyRecursive(
|
||||
path.join(import.meta.dirname!, "..", "..", "fresh"),
|
||||
@@ -77,6 +81,7 @@ async function patchProject(dir: string): Promise<void> {
|
||||
);
|
||||
|
||||
json.workspace = ["./_linked/*"];
|
||||
json.exclude = [...json.exclude ?? [], "**/_linked/*"];
|
||||
|
||||
// assert with this stricter rule, before adding it to initialized projects
|
||||
json.lint.rules.include = ["verbatim-module-syntax"];
|
||||
@@ -101,13 +106,15 @@ async function patchProject(dir: string): Promise<void> {
|
||||
async function copyRecursive(
|
||||
from: string,
|
||||
to: string,
|
||||
ignore?: RegExp,
|
||||
ignore?: (entry: Deno.DirEntry, full: string) => boolean,
|
||||
): Promise<void> {
|
||||
for await (const entry of Deno.readDir(from)) {
|
||||
const source = path.join(from, entry.name);
|
||||
const target = path.join(to, entry.name);
|
||||
|
||||
if (ignore && ignore.test(source)) continue;
|
||||
if (ignore && ignore(entry, source)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (entry.isFile) {
|
||||
try {
|
||||
@@ -119,7 +126,7 @@ async function copyRecursive(
|
||||
}
|
||||
await Deno.copyFile(source, target);
|
||||
} else if (entry.isDirectory) {
|
||||
await copyRecursive(source, target);
|
||||
await copyRecursive(source, target, ignore);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user