Skip to content

Commit 93a66f4

Browse files
committed
feat: add @effect/language-service dependency and update related scripts
1 parent 40647eb commit 93a66f4

File tree

5 files changed

+25
-15
lines changed

5 files changed

+25
-15
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"update:website": "tsx ./scripts/update-website.ts"
5252
},
5353
"devDependencies": {
54+
"@effect/language-service": "^0.35.2",
5455
"@effect/platform": "^0.90.6",
5556
"@effect/platform-node": "^0.96.0",
5657
"@eslint/config-inspector": "^1.2.0",

pnpm-lock.yaml

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

scripts/update-version.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,38 +15,36 @@ const GLOB_PACKAGE_JSON = [
1515
"packages/*/*/package.json",
1616
];
1717

18-
function update(path: string) {
18+
function update(filename: string) {
1919
return Effect.gen(function*() {
2020
const fs = yield* FileSystem.FileSystem;
21-
const packageJsonText = yield* fs.readFileString(path, "utf8");
21+
const packageJsonText = yield* fs.readFileString(filename, "utf8");
2222
const packageJson = JSON.parse(packageJsonText);
2323
if (!isMatching({ version: P.string }, packageJson)) {
24-
yield* Effect.fail(new Error(`Invalid package.json at ${path}: invalid or missing version field`));
24+
return yield* Effect.fail(new Error(`Invalid package.json at ${filename}: invalid or missing version field`));
2525
}
2626
const newVersion = yield* version;
2727
const oldVersion = match(packageJson)
2828
.with({ version: P.select(P.string) }, (v) => v)
2929
.otherwise(() => "0.0.0");
3030
if (oldVersion === newVersion) {
31-
yield* Effect.log(ansis.greenBright(`Skipping ${path} as it's already on version ${newVersion}`));
31+
yield* Effect.log(ansis.greenBright(`Skipping ${filename} as it's already on version ${newVersion}`));
3232
return false;
3333
}
3434
const packageJsonUpdated = {
3535
...packageJson,
3636
version: newVersion,
3737
};
38-
yield* fs.writeFileString(path, `${JSON.stringify(packageJsonUpdated, null, 2)}\n`);
39-
yield* Effect.log(`Updated ${path} to version ${packageJsonUpdated.version}`);
38+
yield* fs.writeFileString(filename, `${JSON.stringify(packageJsonUpdated, null, 2)}\n`);
39+
yield* Effect.log(`Updated ${filename} to version ${packageJsonUpdated.version}`);
4040
return true;
4141
});
4242
}
4343

4444
const program = Effect.gen(function*() {
4545
const ignorePatterns = yield* ignores;
46-
return yield* Effect.all(glob(GLOB_PACKAGE_JSON, ignorePatterns).map(update), { concurrency: 8 });
46+
const packageJsonFiles = glob(GLOB_PACKAGE_JSON, ignorePatterns);
47+
return yield* Effect.all(packageJsonFiles.map(update), { concurrency: 8 });
4748
});
4849

49-
program.pipe(
50-
Effect.provide(NodeFileSystem.layer),
51-
NodeRuntime.runMain,
52-
);
50+
program.pipe(Effect.provide(NodeFileSystem.layer), NodeRuntime.runMain);

scripts/verify-lockfile.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { Command, CommandExecutor } from "@effect/platform";
22
import { NodeCommandExecutor, NodeFileSystem, NodeRuntime } from "@effect/platform-node";
33
import { Effect } from "effect";
4+
import * as Fn from "effect/Function";
5+
import * as Layer from "effect/Layer";
46

57
const command = Command.make("git", "diff", "HEAD@{1}", "--stat", "--", "./pnpm-lock.yaml");
68
const program = Effect.gen(function*() {
@@ -13,8 +15,9 @@ const program = Effect.gen(function*() {
1315
yield* Effect.logWarning("Please run `pnpm install --fix-lockfile && pnpm dedupe` to update local dependencies.");
1416
});
1517

16-
program.pipe(
17-
Effect.provide(NodeCommandExecutor.layer),
18-
Effect.provide(NodeFileSystem.layer),
19-
NodeRuntime.runMain,
18+
const MainLive = Fn.pipe(
19+
NodeCommandExecutor.layer,
20+
Layer.provideMerge(NodeFileSystem.layer),
2021
);
22+
23+
program.pipe(Effect.provide(MainLive), NodeRuntime.runMain);

tsconfig.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
"noEmit": true,
2020
"types": [
2121
"@types/node"
22+
],
23+
"plugins": [
24+
{
25+
"name": "@effect/language-service"
26+
}
2227
]
2328
},
2429
"include": [

0 commit comments

Comments
 (0)