@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/CLI.tsx +2 -2
- package/bootstrap.js +101 -124
- package/bootstrap.js.map +4 -4
- package/build-site.mjs +2400 -2782
- package/dependencies.mts +1 -1
- package/generate-to-filesystem.tsx +61 -55
- package/package.json +1 -1
- package/riboseinc-anafero-cli-0.0.7.tgz +0 -0
- package/sqlite-cache.mts +9 -5
- package/riboseinc-anafero-cli-0.0.5.tgz +0 -0
package/dependencies.mts
CHANGED
|
@@ -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,
|
|
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
|
-
|
|
156
|
+
// serve: Options.boolean('serve').pipe(
|
|
157
|
+
// Options.withDefault(false)),
|
|
157
158
|
|
|
158
|
-
port: Options.integer('port').pipe(
|
|
159
|
-
|
|
159
|
+
// port: Options.integer('port').pipe(
|
|
160
|
+
// Options.withDefault(8080)),
|
|
160
161
|
},
|
|
161
|
-
({ pkg, skipBuild
|
|
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
|
-
|
|
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
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
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
|
Binary file
|
package/sqlite-cache.mts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|