Skip to content

Commit 4756f25

Browse files
committed
chore: remove effect platform usage in scripts
1 parent 3f7df15 commit 4756f25

File tree

11 files changed

+106
-298
lines changed

11 files changed

+106
-298
lines changed

eslint.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,9 @@ export default tseslint.config(
318318
warnOnUnsupportedTypeScriptVersion: false,
319319
},
320320
},
321+
rules: {
322+
"no-console": "off",
323+
},
321324
},
322325
{
323326
files: GLOB_CONFIG,

package.json

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,6 @@
5252
},
5353
"devDependencies": {
5454
"@changesets/cli": "^2.27.11",
55-
"@effect/platform-bun": "^0.52.1",
56-
"@effect/platform-node": "^0.68.1",
57-
"@effect/platform": "^0.72.1",
58-
"@effect/schema": "^0.75.5",
5955
"@eslint/config-inspector": "^0.7.1",
6056
"@eslint/js": "^9.17.0",
6157
"@eslint/markdown": "^6.2.1",
@@ -65,39 +61,40 @@
6561
"@tsconfig/node22": "^22.0.0",
6662
"@tsconfig/strictest": "^2.0.5",
6763
"@types/node": "^22.10.5",
68-
"@types/react-dom": "^19.0.2",
6964
"@types/react": "^19.0.4",
65+
"@types/react-dom": "^19.0.2",
7066
"@typescript-eslint/parser": "^8.19.1",
7167
"@typescript-eslint/rule-tester": "^8.19.1",
7268
"@typescript-eslint/types": "^8.19.1",
7369
"@vitest/ui": "^2.1.8",
7470
"@workspace/configs": "workspace:*",
75-
"eslint-plugin-eslint-plugin": "^6.4.0",
76-
"eslint-plugin-import-x": "^4.6.1",
77-
"eslint-plugin-jsdoc": "^50.6.1",
78-
"eslint-plugin-perfectionist": "^4.6.0",
79-
"eslint-plugin-regexp": "^2.7.0",
80-
"eslint-plugin-simple-import-sort": "^12.1.1",
81-
"eslint-plugin-unicorn": "^56.0.1",
82-
"eslint-plugin-vitest": "^0.5.4",
8371
"@workspace/eslint-plugin-local": "workspace:*",
8472
"concurrently": "^9.1.2",
8573
"cspell": "^8.17.1",
8674
"dedent": "^1.5.3",
8775
"dprint": "^0.48.0",
88-
"effect": "^3.12.1",
8976
"esbuild": "^0.24.2",
9077
"eslint": "^9.17.0",
9178
"eslint-config-flat-gitignore": "^0.3.0",
9279
"eslint-import-resolver-oxc": "^0.8.0",
80+
"eslint-plugin-eslint-plugin": "^6.4.0",
81+
"eslint-plugin-import-x": "^4.6.1",
82+
"eslint-plugin-jsdoc": "^50.6.1",
83+
"eslint-plugin-perfectionist": "^4.6.0",
84+
"eslint-plugin-regexp": "^2.7.0",
85+
"eslint-plugin-simple-import-sort": "^12.1.1",
86+
"eslint-plugin-unicorn": "^56.0.1",
87+
"eslint-plugin-vitest": "^0.5.4",
9388
"fixpkg": "^1.0.2",
9489
"importx": "^0.5.1",
9590
"lefthook": "^1.10.1",
9691
"markdownlint": "^0.37.3",
92+
"picocolors": "^1.1.1",
9793
"publint": "^0.3.0",
9894
"react": "^19.0.0",
9995
"react-dom": "^19.0.0",
10096
"skott": "^0.35.4",
97+
"tinyexec": "^0.3.2",
10198
"tinyglobby": "^0.2.10",
10299
"ts-pattern": "^5.6.0",
103100
"tsup": "^8.3.5",
@@ -117,17 +114,17 @@
117114
"packageManager": "[email protected]",
118115
"pnpm": {
119116
"overrides": {
120-
"is-core-module": "npm:@nolyfill/is-core-module@^1.0.39",
121-
"safe-buffer": "npm:@nolyfill/safe-buffer@^1.0.41",
122-
"safer-buffer": "npm:@nolyfill/safer-buffer@^1.0.41",
123-
"typedarray": "npm:@nolyfill/typedarray@^1.0.29",
124117
"@types/react": "^19.0.4",
125118
"@types/react-dom": "^19.0.2",
126119
"cross-spawn": "^7.0.6",
120+
"is-core-module": "npm:@nolyfill/is-core-module@^1.0.39",
127121
"next": "^15.1.4",
128122
"react": "^19.0.0",
129123
"react-dom": "^19.0.0",
124+
"safe-buffer": "npm:@nolyfill/safe-buffer@^1.0.41",
125+
"safer-buffer": "npm:@nolyfill/safer-buffer@^1.0.41",
130126
"ts-api-utils": "^2.0.0",
127+
"typedarray": "npm:@nolyfill/typedarray@^1.0.29",
131128
"typescript": "^5.7.3"
132129
}
133130
}

pnpm-lock.yaml

Lines changed: 6 additions & 96 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/ignores.ts

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
1-
import { FileSystem } from "@effect/platform";
2-
import { Array, Effect, Function as F, String as Str } from "effect";
3-
import { not, or } from "effect/Predicate";
1+
// import { FileSystem } from "@effect/platform";
2+
// import { Array, Effect, Function as F, String as Str } from "effect";
3+
// import { not, or } from "effect/Predicate";
44

5-
export const ignores = F.pipe(
6-
FileSystem.FileSystem,
7-
Effect.flatMap(fs => fs.readFileString(".gitignore")),
8-
Effect.map(Str.split("\n")),
9-
Effect.map(Array.map(Str.trim)),
10-
Effect.map(Array.filter(not(or(Str.startsWith("#"), Str.startsWith("!"))))),
11-
Effect.map(Array.map(Str.replace(/^\//, ""))),
12-
Effect.map(Array.filter(Str.isNonEmpty)),
13-
);
5+
// export const ignores = F.pipe(
6+
// FileSystem.FileSystem,
7+
// Effect.flatMap(fs => fs.readFileString(".gitignore")),
8+
// Effect.map(Str.split("\n")),
9+
// Effect.map(Array.map(Str.trim)),
10+
// Effect.map(Array.filter(not(or(Str.startsWith("#"), Str.startsWith("!"))))),
11+
// Effect.map(Array.map(Str.replace(/^\//, ""))),
12+
// Effect.map(Array.filter(Str.isNonEmpty)),
13+
// );
14+
15+
import fs from "fs/promises";
16+
17+
export const ignores = await fs.readFile(".gitignore", "utf-8")
18+
.then(v => v.split("\n"))
19+
.then(v => v.map(v => v.trim()))
20+
.then(v => v.filter(v => !v.startsWith("#") && !v.startsWith("!")))
21+
.then(v => v.map(v => v.replace(/^\//, "")))
22+
.then(v => v.filter(v => v !== ""));

scripts/libs/glob.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
import { Effect } from "effect";
21
import { globSync } from "tinyglobby";
32

4-
export const glob = (patterns: string[], exclude: ReadonlyArray<string> = ["**/node_modules/**"]) =>
5-
Effect.try({
6-
catch: (error) => error,
7-
try: () =>
8-
globSync(patterns, {
9-
ignore: [...exclude],
10-
}),
3+
export function glob(patterns: string[], exclude = ["**/node_modules/**"]) {
4+
return globSync(patterns, {
5+
ignore: [...exclude],
116
});
7+
}

scripts/libs/json.ts

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,20 @@
1-
import { FileSystem } from "@effect/platform";
2-
import { Effect } from "effect";
1+
/* eslint-disable @susisu/safe-typescript/no-type-assertion */
2+
import fs from "fs/promises";
3+
import type { JsonValue } from "type-fest";
34

4-
export const readJsonFile = (path: string): Effect.Effect<unknown, never, FileSystem.FileSystem> =>
5-
Effect.gen(function*() {
6-
const fs = yield* FileSystem.FileSystem;
7-
const content = yield* Effect.orDie(fs.readFileString(path));
8-
return yield* Effect.orDie(Effect.try({
9-
catch: (error) => `[FileSystem] Unable to read and parse JSON file from '${path}': ${String(error)}`,
10-
try: () => JSON.parse(content) as unknown,
11-
}));
12-
});
5+
export function readJsonFile(path: string) {
6+
return fs.readFile(path, "utf-8")
7+
.then(v => JSON.parse(v) as JsonValue);
8+
}
139

14-
export const writeJsonFile = (
10+
export function writeJsonFile(
1511
path: string,
16-
data: unknown,
12+
data: JsonValue,
1713
indent = 2,
1814
insertFinalNewline = true,
19-
): Effect.Effect<unknown, never, FileSystem.FileSystem> =>
20-
Effect.gen(function*() {
21-
const fs = yield* FileSystem.FileSystem;
22-
const content = yield* Effect.orDie(Effect.try({
23-
catch: (error) => `[FileSystem] Unable to stringify JSON data: ${String(error)}`,
24-
try: () => JSON.stringify(data, null, indent),
25-
}));
26-
const finalContent = insertFinalNewline ? `${content}\n` : content;
27-
yield* Effect.orDie(fs.writeFileString(path, finalContent));
28-
});
15+
) {
16+
return fs.writeFile(
17+
path,
18+
JSON.stringify(data, null, indent) + (insertFinalNewline ? "\n" : ""),
19+
);
20+
}

scripts/update-readme.ts

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,6 @@
1-
import { FileSystem } from "@effect/platform";
2-
import { NodeFileSystem, NodeRuntime } from "@effect/platform-node";
3-
import { Effect } from "effect";
1+
import fs from "fs/promises";
42

5-
const source = "README.md";
6-
7-
const program = Effect.gen(function*() {
8-
const fs = yield* FileSystem.FileSystem;
9-
yield* Effect.orDie(fs.copyFile(source, "packages/plugins/eslint-plugin/README.md"));
10-
});
11-
12-
const runnable = program.pipe(
13-
Effect.provide(NodeFileSystem.layer),
3+
await fs.copyFile(
4+
"README.md",
5+
"packages/plugins/eslint-plugin/README.md",
146
);
15-
16-
NodeRuntime.runMain(runnable);
17-
// BunRuntime.runMain(runnable);

0 commit comments

Comments
 (0)