-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
57 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*.html | ||
*.json | ||
*.md | ||
*.min.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,30 @@ | ||
// @ts-check | ||
|
||
import { readFile, readdir, writeFile } from "fs/promises" | ||
import { resolve } from "path" | ||
import { readFile, readdir, writeFile } from 'fs/promises' | ||
import { resolve } from 'path' | ||
|
||
const args = process.argv.splice(2) | ||
const arg0 = args[0] | ||
|
||
async function* getFiles(dir) { | ||
const dirents = await readdir(dir, { withFileTypes: true }); | ||
const dirents = await readdir(dir, { withFileTypes: true }) | ||
for (const dirent of dirents) { | ||
const res = resolve(dir, dirent.name); | ||
const res = resolve(dir, dirent.name) | ||
if (dirent.isDirectory()) { | ||
yield* getFiles(res); | ||
yield* getFiles(res) | ||
} else { | ||
yield res; | ||
yield res | ||
} | ||
} | ||
} | ||
|
||
if (arg0 === "add-jest-environment") { | ||
const str = "/**\n* @jest-environment node\n*/\n\n" | ||
if (arg0 === 'add-jest-environment') { | ||
const str = '/**\n* @jest-environment node\n*/\n\n' | ||
|
||
for await (const f of getFiles("test")) { | ||
for await (const f of getFiles('test')) { | ||
if (/ssr\.test\.js/.test(f) || /e2e\/core\.test\.js/.test(f)) { | ||
const file = await readFile(f, { encoding: "utf-8" }) | ||
await writeFile(f, str + file, { encoding: "utf-8" }) | ||
const file = await readFile(f, { encoding: 'utf-8' }) | ||
await writeFile(f, str + file, { encoding: 'utf-8' }) | ||
} | ||
} | ||
|
||
} | ||
} |