lalph 0.2.17 → 0.2.18
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/dist/cli.mjs +208 -204
- package/package.json +3 -3
- package/src/Settings.ts +10 -7
- package/src/commands/projects/rm.ts +11 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lalph",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.18",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
"@changesets/changelog-github": "^0.5.2",
|
|
24
24
|
"@changesets/cli": "^2.29.8",
|
|
25
25
|
"@effect/language-service": "^0.72.0",
|
|
26
|
-
"@effect/platform-node": "https://pkg.pr.new/Effect-TS/effect-smol/@effect/platform-node@
|
|
26
|
+
"@effect/platform-node": "https://pkg.pr.new/Effect-TS/effect-smol/@effect/platform-node@a5fa8be",
|
|
27
27
|
"@linear/sdk": "^72.0.0",
|
|
28
28
|
"@octokit/plugin-rest-endpoint-methods": "^17.0.0",
|
|
29
29
|
"@octokit/types": "^16.0.0",
|
|
30
|
-
"effect": "https://pkg.pr.new/Effect-TS/effect-smol/effect@
|
|
30
|
+
"effect": "https://pkg.pr.new/Effect-TS/effect-smol/effect@a5fa8be",
|
|
31
31
|
"husky": "^9.1.7",
|
|
32
32
|
"lint-staged": "^16.2.7",
|
|
33
33
|
"octokit": "^5.0.5",
|
package/src/Settings.ts
CHANGED
|
@@ -20,9 +20,10 @@ export class Settings extends ServiceMap.Service<Settings>()("lalph/Settings", {
|
|
|
20
20
|
make: Effect.gen(function* () {
|
|
21
21
|
const kvs = yield* KeyValueStore.KeyValueStore
|
|
22
22
|
const projectKvs = yield* ProjectsKvs
|
|
23
|
-
const store = KeyValueStore.prefix(kvs, "settings.")
|
|
24
23
|
const reactivity = yield* Reactivity.Reactivity
|
|
25
24
|
|
|
25
|
+
const store = KeyValueStore.prefix(kvs, "settings.")
|
|
26
|
+
|
|
26
27
|
const cache = yield* Cache.make({
|
|
27
28
|
lookup(setting: Setting<string, Schema.Codec<any, any>>) {
|
|
28
29
|
const s = KeyValueStore.toSchemaStore(store, setting.schema)
|
|
@@ -63,7 +64,7 @@ export class Settings extends ServiceMap.Service<Settings>()("lalph/Settings", {
|
|
|
63
64
|
onSome: (v) => Effect.orDie(s.set(setting.name, v)),
|
|
64
65
|
})
|
|
65
66
|
return reactivity.mutation(
|
|
66
|
-
[`settings
|
|
67
|
+
[`settings:${setting.name}`],
|
|
67
68
|
Effect.andThen(update, setCache),
|
|
68
69
|
)
|
|
69
70
|
}
|
|
@@ -109,7 +110,7 @@ export class Settings extends ServiceMap.Service<Settings>()("lalph/Settings", {
|
|
|
109
110
|
onSome: (v) => Effect.orDie(s.set(setting.name, v)),
|
|
110
111
|
})
|
|
111
112
|
yield* reactivity.mutation(
|
|
112
|
-
[`settings.${projectId}
|
|
113
|
+
[`settings.${projectId}:${setting.name}`],
|
|
113
114
|
Effect.andThen(update, setCache),
|
|
114
115
|
)
|
|
115
116
|
},
|
|
@@ -162,7 +163,9 @@ export class Settings extends ServiceMap.Service<Settings>()("lalph/Settings", {
|
|
|
162
163
|
> {
|
|
163
164
|
const read = pipe(
|
|
164
165
|
Settings.runtime.atom(Settings.get(setting)),
|
|
165
|
-
atomRuntime.withReactivity(
|
|
166
|
+
atomRuntime.withReactivity({
|
|
167
|
+
settings: [setting.name],
|
|
168
|
+
}),
|
|
166
169
|
)
|
|
167
170
|
const set = Settings.runtime.fn<Option.Option<S["Type"]>>()((value) =>
|
|
168
171
|
Settings.set(setting, value),
|
|
@@ -198,9 +201,9 @@ export class Settings extends ServiceMap.Service<Settings>()("lalph/Settings", {
|
|
|
198
201
|
Effect.provideService(CurrentProjectId, options.projectId),
|
|
199
202
|
),
|
|
200
203
|
),
|
|
201
|
-
atomRuntime.withReactivity(
|
|
202
|
-
`settings.${options.projectId}
|
|
203
|
-
|
|
204
|
+
atomRuntime.withReactivity({
|
|
205
|
+
[`settings.${options.projectId}`]: [options.setting.name],
|
|
206
|
+
}),
|
|
204
207
|
)
|
|
205
208
|
const set = Settings.runtime.fn<Option.Option<S["Type"]>>()((value) =>
|
|
206
209
|
Settings.setProject(options.setting, value).pipe(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Effect, Option } from "effect"
|
|
1
|
+
import { Effect, FileSystem, Option, Path } from "effect"
|
|
2
2
|
import { Command } from "effect/unstable/cli"
|
|
3
3
|
import { allProjects, getAllProjects, selectProject } from "../../Projects.ts"
|
|
4
4
|
import { Settings } from "../../Settings.ts"
|
|
@@ -8,6 +8,8 @@ export const commandProjectsRm = Command.make("rm").pipe(
|
|
|
8
8
|
Command.withDescription("Remove a project"),
|
|
9
9
|
Command.withHandler(
|
|
10
10
|
Effect.fnUntraced(function* () {
|
|
11
|
+
const fs = yield* FileSystem.FileSystem
|
|
12
|
+
const pathService = yield* Path.Path
|
|
11
13
|
const projects = yield* getAllProjects
|
|
12
14
|
if (projects.length === 0) {
|
|
13
15
|
return yield* Effect.log("There are no projects to remove.")
|
|
@@ -15,6 +17,14 @@ export const commandProjectsRm = Command.make("rm").pipe(
|
|
|
15
17
|
const project = yield* selectProject
|
|
16
18
|
const newProjects = projects.filter((p) => p.id !== project.id)
|
|
17
19
|
yield* Settings.set(allProjects, Option.some(newProjects))
|
|
20
|
+
const kvsPath = pathService.join(
|
|
21
|
+
".lalph",
|
|
22
|
+
"projects",
|
|
23
|
+
encodeURIComponent(project.id),
|
|
24
|
+
)
|
|
25
|
+
if (yield* fs.exists(kvsPath)) {
|
|
26
|
+
yield* fs.remove(kvsPath)
|
|
27
|
+
}
|
|
18
28
|
}),
|
|
19
29
|
),
|
|
20
30
|
Command.provide(Settings.layer),
|