@riboseinc/anafero-cli 0.0.5 → 0.0.7

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/dependencies.mts CHANGED
@@ -85,7 +85,7 @@ async function fetchSourceFromGit(
85
85
  `anafero-source-${moduleRef.replace(/[^a-z0-9]/gi, '_')}-`,
86
86
  ));
87
87
 
88
- onProgress({ state: `cloning to ${dir}` });
88
+ onProgress({ state: `cloning ${url} at ${ref} to ${dir}` });
89
89
 
90
90
  await git.clone({
91
91
  fs,
@@ -18,7 +18,7 @@ import git, { type CommitObject } from 'isomorphic-git';
18
18
  import { pointsToLFS } from '@riboseinc/isogit-lfs/util.js';
19
19
  import { readPointer, downloadBlobFromPointer } from '@riboseinc/isogit-lfs';
20
20
 
21
- import { pipe, Effect, Layer, Logger, Runtime, LogLevel, Option, Stream, Console } from 'effect';
21
+ import { pipe, Effect, Logger, LogLevel, Option, Stream, Console } from 'effect';
22
22
  import { NodeContext, NodeRuntime } from '@effect/platform-node';
23
23
  import { FileSystem } from '@effect/platform';
24
24
  import { Options, Command } from '@effect/cli';
@@ -146,19 +146,20 @@ const dev = Command.
146
146
  make(
147
147
  'develop',
148
148
  {
149
- pkg: Options.directory('package'),
149
+ pkg: Options.directory('package').
150
+ pipe(Options.optional),
150
151
 
151
152
  // Useful when site took a long time to generate
152
153
  // & we want to iterate on front-end
153
154
  skipBuild: Options.boolean('skip-build'),
154
155
 
155
- serve: Options.boolean('serve').pipe(
156
- Options.withDefault(false)),
156
+ // serve: Options.boolean('serve').pipe(
157
+ // Options.withDefault(false)),
157
158
 
158
- port: Options.integer('port').pipe(
159
- Options.withDefault(8080)),
159
+ // port: Options.integer('port').pipe(
160
+ // Options.withDefault(8080)),
160
161
  },
161
- ({ pkg, skipBuild, serve, port }) =>
162
+ ({ pkg, skipBuild }) =>
162
163
  Effect.
163
164
  gen(function * (_) {
164
165
  const buildCfg = yield * _(build);
@@ -172,60 +173,65 @@ const dev = Command.
172
173
  }
173
174
 
174
175
 
176
+ // Serve
177
+ // (this is not working, possibly Effect API change)
178
+ // if (serve) {
179
+ // console.debug("Starting serve");
180
+ // yield * _(
181
+ // Effect.fork(
182
+ // Layer.launch(Layer.scopedDiscard(
183
+ // Effect.gen(function * (_) {
184
+ // //const srv = yield * _(ServerContext);
185
+ // const runtime = yield * _(Effect.runtime<never>());
186
+ // const runFork = Runtime.runFork(runtime);
187
+ // yield * _(
188
+ // Effect.acquireRelease(
189
+ // Effect.sync(() => simpleServe(
190
+ // targetDirectoryPath,
191
+ // port,
192
+ // {
193
+ // onDebug: (msg) => runFork(Effect.logDebug(msg)),
194
+ // onError: (msg) => runFork(Effect.logError(msg)),
195
+ // },
196
+ // )),
197
+ // (srv) => Effect.sync(() => srv.close()),
198
+ // ),
199
+ // );
200
+ // })
201
+ // )),
202
+ // ),
203
+ // Logger.withMinimumLogLevel(LogLevel.Debug),
204
+ // );
205
+ // }
206
+
207
+
175
208
  // Watch
176
209
 
177
- if (serve) {
210
+ const packageDir = unpackOption(pkg);
211
+ if (packageDir) {
212
+ const ignorePrefixes = [
213
+ // Spurious changes:
214
+ // Outdir is modified during build
215
+ // and reacting to it would cause infinite rebuilds:
216
+ resolve(targetDirectoryPath),
217
+ '.git',
218
+ ];
219
+
220
+ // TODO: Also watch data dir?
221
+ const watchedDirs = [packageDir];
222
+
178
223
  yield * _(
179
- Effect.fork(
180
- Layer.launch(Layer.scopedDiscard(
181
- Effect.gen(function * (_) {
182
- //const srv = yield * _(ServerContext);
183
- const runtime = yield * _(Effect.runtime<never>());
184
- const runFork = Runtime.runFork(runtime);
185
- yield * _(
186
- Effect.acquireRelease(
187
- Effect.sync(() => simpleServe(
188
- targetDirectoryPath,
189
- port,
190
- {
191
- onDebug: (msg) => runFork(Effect.logDebug(msg)),
192
- onError: (msg) => runFork(Effect.logError(msg)),
193
- },
194
- )),
195
- (srv) => Effect.sync(() => srv.close()),
196
- ),
197
- );
198
- })
199
- )),
200
- ),
224
+ debouncedWatcher(watchedDirs, ignorePrefixes, 1000),
225
+ Stream.runForEach(path => Effect.gen(function * (_) {
226
+ yield * _(Effect.logDebug(`Path changed: ${path}`));
227
+ yield * _(Effect.logDebug(`Want to copy ${packageDir} into ${targetDirectoryPath}`));
228
+ yield * _(Effect.all([
229
+ copyBootstrapScript(packageDir, targetDirectoryPath),
230
+ ], { concurrency: 5 }));
231
+ })),
201
232
  Logger.withMinimumLogLevel(LogLevel.Debug),
202
233
  );
203
234
  }
204
-
205
-
206
- // Watch
207
-
208
- const ignorePrefixes = [
209
- // Spurious changes:
210
- // Outdir is modified during build
211
- // and reacting to it would cause infinite rebuilds:
212
- resolve(targetDirectoryPath),
213
- '.git',
214
- ];
215
-
216
- const watchedDirs = [pkg];
217
-
218
- yield * _(
219
- debouncedWatcher(watchedDirs, ignorePrefixes, 1000),
220
- Stream.runForEach(path => Effect.gen(function * (_) {
221
- yield * _(Effect.logDebug(`Path changed: ${path}`));
222
- yield * _(Effect.logDebug(`Want to copy ${pkg} into ${targetDirectoryPath}`));
223
- yield * _(Effect.all([
224
- copyBootstrapScript(pkg, targetDirectoryPath),
225
- ], { concurrency: 5 }));
226
- })),
227
- Logger.withMinimumLogLevel(LogLevel.Debug),
228
- );
229
235
  })
230
236
  ).
231
237
  pipe(
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@riboseinc/anafero-cli",
3
3
  "type": "module",
4
- "version": "0.0.5",
4
+ "version": "0.0.7",
5
5
  "packageManager": "yarn@4.5.0",
6
6
  "bin": {
7
7
  "build-site": "build-site.mjs"
Binary file
package/sqlite-cache.mts CHANGED
@@ -1,5 +1,9 @@
1
- //import { type Cache } from 'anafero/cache.mjs';
2
- //
3
- //
4
- //export function makeSqliteCache(): Cache {
5
- //}
1
+ import { DatabaseSync } from 'node:sqlite';
2
+ import { type Cache } from 'anafero/cache.mjs';
3
+
4
+
5
+ export function makeSQLiteCache(): Cache {
6
+ const db = new DatabaseSync(':memory');
7
+ return {
8
+ };
9
+ }
Binary file