@riboseinc/anafero-cli 0.0.47 → 0.0.48

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
@@ -1,5 +1,5 @@
1
1
  import { join, basename } from 'node:path';
2
- import { rmdir, readFile, cp, mkdtemp, stat } from 'node:fs/promises';
2
+ import { readdir, rmdir, readFile, cp, mkdtemp, stat, mkdir, writeFile } from 'node:fs/promises';
3
3
  import vm, { type Module as VMModule } from 'node:vm';
4
4
  import { tmpdir } from 'node:os';
5
5
  import fs from 'node:fs';
@@ -31,7 +31,7 @@ const preloaded = {
31
31
  'prosemirror-schema-list': pmSchemaList,
32
32
  'react-helmet': helmet,
33
33
  'react': react,
34
- } as Record<string, unknown>;
34
+ } as Readonly<Record<string, unknown>>;
35
35
 
36
36
 
37
37
  const depRegistry: Record<string, Promise<unknown>> = {};
@@ -140,6 +140,9 @@ const decoder = new TextDecoder();
140
140
  * with instantiated module and a map of any other generated files.
141
141
  * NOTE: Doesn’t really validate that returned module conforms to anything.
142
142
  *
143
+ * Handles caching (if a module was already requested, will resolve
144
+ * the same promise).
145
+ *
143
146
  * This currently relies on Node, and is therefore here in the CLI module;
144
147
  * see TODO about resolveDir about making dependencies buildable
145
148
  * in the browser.
@@ -149,194 +152,343 @@ async function fetchDependency(
149
152
  moduleRef,
150
153
  onProgress,
151
154
  ) {
152
- if (depRegistry[moduleRef]) {
153
- return await depRegistry[moduleRef];
155
+
156
+ if (!depRegistry[moduleRef]) {
157
+ depRegistry[moduleRef] = async function resolveDep() {
158
+ let sourceDir: string;
159
+
160
+ const localPath = moduleRef.split('file:')[1];
161
+ if (!localPath) {
162
+ //throw new Error("Only dependencies on local filesystem are supported for now.");
163
+ onProgress({ state: `fetching ${moduleRef} to ${localPath}` });
164
+ sourceDir = await fetchSourceFromGit(moduleRef, onProgress);
165
+ } else {
166
+ sourceDir = localPath;
167
+ }
168
+
169
+ const [bundledCode, otherFiles] = await getDependencyAssets(
170
+ moduleRef,
171
+ sourceDir,
172
+ onProgress,
173
+ );
174
+
175
+ const code = decoder.decode(bundledCode);
176
+
177
+ onProgress({ state: "instantiating module" });
178
+
179
+ // const fn = `${process.cwd()}/test.js`;
180
+ // console.debug("Will write to", fn);
181
+ // await writeFile(fn, result.outputFiles[0]!.contents, { encoding: 'utf-8' })
182
+
183
+ const context = vm.createContext({
184
+ Array,
185
+ Object,
186
+ crypto,
187
+ XPathResult,
188
+ document: getDoc(),
189
+ console,
190
+ Function,
191
+ setTimeout,
192
+ clearTimeout,
193
+ setInterval,
194
+ TextEncoder,
195
+ TextDecoder,
196
+ Blob,
197
+ btoa,
198
+ atob,
199
+ });
200
+ const mod = new vm.SourceTextModule(code, {
201
+ // TODO: Try moduleRef as VM module identifier?
202
+ // Take care of special characters, though.
203
+ identifier: 'anafero-dependency',
204
+ context,
205
+ });
206
+
207
+ async function link(specifier: string, referencingModule: VMModule) {
208
+ const isAbsoluteURL = specifier.startsWith('https://');
209
+ let base: string | undefined;
210
+ try {
211
+ new URL(referencingModule.identifier);
212
+ base = referencingModule.identifier;
213
+ // The module that does the importing is referenced by URL.
214
+ } catch (e) {
215
+ // The module that does the importing is not referenced by URL.
216
+ base = undefined;
217
+ }
218
+ const isRelativePath =
219
+ specifier.startsWith('/')
220
+ || specifier.startsWith('./')
221
+ || specifier.startsWith('../');
222
+ const isRelativeURL = isRelativePath && base !== undefined;
223
+
224
+ if (isAbsoluteURL || isRelativeURL) {
225
+ // Create a new absolute URL from the imported
226
+ // module's URL (specifier) and the parent module's
227
+ // URL (referencingModule.identifier).
228
+ //console.debug("anafero: building module URL", specifier, 'imported from', referencingModule.identifier);
229
+ if (isRelativeURL && base === undefined) {
230
+ throw new Error("Unable to resolve relative specifier without a base");
231
+ }
232
+ const url = new URL(specifier, base).toString();
233
+ // Download the raw source code.
234
+ //console.debug("anafero: fetching module", url);
235
+ const source = await (await fetch(url)).text();
236
+ // TODO: Fetched source needs to be cached appropriately
237
+ // Version needs to be taken into account?
238
+
239
+ // Instantiate a new module and return it.
240
+ return new vm.SourceTextModule(source, {
241
+ identifier: url,
242
+ context: referencingModule.context,
243
+ });
244
+ } else {
245
+ //console.debug("anafero: fetching preloaded", specifier);
246
+ const madeAvailable = preloaded[specifier]
247
+ ? preloaded[specifier]
248
+ // TODO: Don’t do the following
249
+ : await import(specifier);
250
+ const exportNames = Object.keys(madeAvailable);
251
+ // Construct a new module from the actual import
252
+ return new vm.SyntheticModule(
253
+ exportNames,
254
+ function () {
255
+ for (const name of exportNames) {
256
+ this.setExport(name, madeAvailable[name]);
257
+ }
258
+ },
259
+ {
260
+ identifier: specifier,
261
+ context: referencingModule.context,
262
+ },
263
+ );
264
+ }
265
+ }
266
+
267
+ await mod.link(link);
268
+
269
+ await mod.evaluate();
270
+
271
+ const defaultExport = (mod.namespace as any).default as any;
272
+
273
+ dependencySources[moduleRef] = code;
274
+ dependencySupportingFiles[moduleRef] = otherFiles;
275
+
276
+ return defaultExport;
277
+
278
+ // It would be nice if this did work…
279
+ //let module = {};
280
+ //const req = (pkg: string) => {
281
+ // console.debug("REQUIRED", pkg);
282
+ // const result = import(pkg);
283
+ // console.debug("GOT", result);
284
+ // return result;
285
+ //};
286
+ //console.debug((new Function('module', 'require', decoder.decode(result.outputFiles[0]!.contents)))(module, req));
287
+ //const out = await import(fn);
288
+ //console.debug(out.name);
289
+ //throw new Error("TODO");
290
+ //const data = await readFile(outfile, { encoding: 'utf-8' });
291
+ //return new Function(data);
292
+ }();
154
293
  }
155
- depRegistry[moduleRef] = async function resolveDep() {
156
- let sourceDir: string;
157
-
158
- const localPath = moduleRef.split('file:')[1];
159
- if (!localPath) {
160
- //throw new Error("Only dependencies on local filesystem are supported for now.");
161
- onProgress({ state: `fetching ${moduleRef} to ${localPath}` });
162
- sourceDir = await fetchSourceFromGit(moduleRef, onProgress);
163
- } else {
164
- sourceDir = localPath;
165
- }
166
294
 
167
- const buildDir = await mkdtemp(join(
168
- tmpRoot,
169
- `anafero-dist-${moduleRef.replace(/[^a-z0-9]/gi, '_')}-`,
170
- ));
295
+ return await depRegistry[moduleRef] as any;
296
+ };
171
297
 
172
- onProgress({ state: `copying into build dir ${buildDir}` });
173
-
174
- await cp(sourceDir, buildDir, { recursive: true });
175
-
176
- //const outfile = join(buildDir, 'out.mjs');
177
- //await esbuildTransform('oi');
178
-
179
- onProgress({ state: "compiling" });
180
-
181
- const result = await esbuild({
182
- //entryPoints: [join(buildDir, 'index.mts')],
183
- stdin: {
184
- contents: await readFile(join(buildDir, 'index.mts')),
185
- loader: 'ts',
186
-
187
- // TODO: This means we use filesystem when resolving
188
- // imports in the entry point. That’s not great, if we
189
- // want to build e.g. in the browser.
190
- // It may be possible to avoid this by writing a custom
191
- // resolver plugin for esbuild. See
192
- // - https://github.com/evanw/esbuild/issues/591#issuecomment-742962090
193
- // - https://esbuild.github.io/plugins/#on-resolve-arguments
194
- resolveDir: buildDir,
195
-
196
- sourcefile: 'index.mts',
197
- },
198
- loader: {
199
- '.mts': 'ts',
200
- '.css': 'local-css',
201
- },
202
- entryNames: '[dir]/[name]',
203
- assetNames: '[dir]/[name]',
204
- format: 'esm',
205
- target: ['es2022'],
206
- tsconfigRaw: '{}',
207
- //external: [],
208
- packages: 'external',
209
- //plugins: [{
210
- // name: 'plugin-resolver',
211
- // setup(build) {
212
- // build.onLoad({ filter: /^prosemirror-model-metanorma/ }, args => {
213
- // return import(args.path);
214
- // });
215
- // },
216
- //}],
217
- minify: false,
218
- platform: 'browser',
219
- write: false,
220
- logLevel: 'silent',
221
- //logLevel: 'info',
222
- sourcemap: true,
223
- bundle: true,
224
- outfile: 'index.js',
225
- treeShaking: true,
226
- //outfile,
227
- });
228
298
 
229
- const otherFiles: Record<string, Uint8Array> = {};
299
+ /**
300
+ * Builds dependency from TypeScript if needed,
301
+ * returns dependency source as string.
302
+ *
303
+ * Does not cache anything.
304
+ */
305
+ async function getDependencyAssets(
306
+ moduleRef: string,
307
+ sourceDirPath: string,
308
+ onProgress: (progress: Progress) => void,
309
+ ): Promise<[
310
+ dependency: Uint8Array,
311
+ assets: Record<string, Uint8Array>,
312
+ ]> {
313
+ if (await isPreBuilt(sourceDirPath)) {
314
+ console.debug("Using pre-built", moduleRef);
315
+ return await readPreBuiltDependency(sourceDirPath);
316
+ } else {
317
+ return await buildDependency(moduleRef, sourceDirPath, onProgress);
318
+ }
319
+ }
230
320
 
231
- const mainOutput = result.outputFiles.
232
- find(({ path }) => basename(path) === 'index.js')?.contents;
233
321
 
234
- if (!mainOutput) {
235
- throw new Error("Fetching dependency: no main output after building");
236
- } else if (result.outputFiles.length > 1) {
237
- for (const { path, contents } of result.outputFiles) {
238
- if (!path.endsWith('/index.js')) {
239
- otherFiles[basename(path)] = contents;
240
- }
241
- }
242
- }
322
+ function getPreBuiltRoot(sourceDirPath: string): string {
323
+ return join(sourceDirPath, 'dist');
324
+ }
243
325
 
244
- const code = decoder.decode(mainOutput);
245
-
246
- onProgress({ state: "instantiating module" });
247
-
248
- // const fn = `${process.cwd()}/test.js`;
249
- // console.debug("Will write to", fn);
250
- // await writeFile(fn, result.outputFiles[0]!.contents, { encoding: 'utf-8' })
251
-
252
- const context = vm.createContext({
253
- Array,
254
- Object,
255
- crypto,
256
- XPathResult,
257
- document: getDoc(),
258
- console,
259
- Function,
260
- setTimeout,
261
- setInterval,
262
- TextEncoder,
263
- });
264
- const mod = new vm.SourceTextModule(code, {
265
- // TODO: Try moduleRef as VM module identifier?
266
- // Take care of special characters, though.
267
- identifier: 'anafero-dependency',
268
- context,
269
- });
270
326
 
271
- async function link(specifier: string, referencingModule: VMModule) {
272
- if (specifier.startsWith('https://')) {
273
- // Create a new absolute URL from the imported
274
- // module's URL (specifier) and the parent module's
275
- // URL (referencingModule.identifier).
276
- const url = new URL(
277
- specifier,
278
- referencingModule.identifier,
279
- ).toString();
280
- // Download the raw source code.
281
- const source = await (await fetch(url)).text();
282
- // Instantiate a new module and return it.
283
- return new vm.SourceTextModule(source, {
284
- identifier: url,
285
- context: referencingModule.context,
286
- });
287
- } else {
288
- const madeAvailable = preloaded[specifier]
289
- ? preloaded[specifier]
290
- // TODO: Don’t do the following
291
- : await import(specifier);
292
- const exportNames = Object.keys(madeAvailable);
293
- // Construct a new module from the actual import
294
- return new vm.SyntheticModule(
295
- exportNames,
296
- function () {
297
- for (const name of exportNames) {
298
- this.setExport(name, madeAvailable[name]);
299
- }
300
- },
301
- {
302
- identifier: specifier,
303
- context: referencingModule.context,
304
- },
305
- );
327
+ async function readPreBuiltJSBundle(sourceDirPath: string):
328
+ Promise<Uint8Array> {
329
+ const bundlePath = join(
330
+ getPreBuiltRoot(sourceDirPath),
331
+ PRE_BUILT_JS_BUNDLE_FILENAME);
332
+ const bundleStat = await stat(bundlePath);
333
+ if (bundleStat.isFile()) {
334
+ return readFile(bundlePath);
335
+ } else {
336
+ throw new Error("Pre-built entry point is not a file");
337
+ }
338
+ }
306
339
 
307
- }
308
- }
309
340
 
310
- await mod.link(link);
341
+ const PRE_BUILT_JS_BUNDLE_FILENAME = 'index.js';
342
+
311
343
 
312
- await mod.evaluate();
344
+ async function readPreBuiltAssets(sourceDirPath: string):
345
+ Promise<Record<string, Uint8Array>> {
346
+ const distroot = getPreBuiltRoot(sourceDirPath);
347
+ const filenames = await readdir(distroot);
348
+ const assets = filenames.filter(fn => fn !== PRE_BUILT_JS_BUNDLE_FILENAME);
349
+ return (
350
+ (await Promise.all(
351
+ assets.map(async (fn) => ({ [fn]: await readFile(join(distroot, fn)) }))
352
+ )).
353
+ reduce((prev, curr) => ({ ...prev, ...curr }), {})
354
+ );
355
+ }
313
356
 
314
- const defaultExport = (mod.namespace as any).default as any;
315
357
 
316
- onProgress({ state: `removing build dir ${buildDir}` });
358
+ export async function writePreBuiltAssets(
359
+ sourceDirPath: string,
360
+ bundledCode: Uint8Array,
361
+ assets: Record<string, Uint8Array>,
362
+ ) {
363
+ const distDir = getPreBuiltRoot(sourceDirPath);
364
+ await mkdir(distDir);
365
+ console.debug("Writing index.js");
366
+ await writeFile(join(distDir, PRE_BUILT_JS_BUNDLE_FILENAME), bundledCode);
367
+ for (const [fn, blob] of Object.entries(assets)) {
368
+ console.debug("Writing asset", fn);
369
+ await writeFile(join(distDir, fn), blob);
370
+ }
371
+ }
317
372
 
318
- await rmdir(buildDir, { recursive: true });
319
373
 
320
- dependencySources[moduleRef] = code;
321
- dependencySupportingFiles[moduleRef] = otherFiles;
374
+ async function isPreBuilt(sourceDirPath: string): Promise<boolean> {
375
+ try {
376
+ // A pre-built dependency contains directory “dist”
377
+ // with index.js and possibly other assets.
378
+ // Subdirectories under dist are ignored.
379
+ await readPreBuiltJSBundle(sourceDirPath);
380
+ await readPreBuiltAssets(sourceDirPath);
381
+ return true;
382
+ } catch (e) {
383
+ console.error(e);
384
+ return false;
385
+ }
386
+ }
322
387
 
323
- return defaultExport;
324
388
 
325
- // It would be nice if this did work…
326
- //let module = {};
327
- //const req = (pkg: string) => {
328
- // console.debug("REQUIRED", pkg);
329
- // const result = import(pkg);
330
- // console.debug("GOT", result);
331
- // return result;
332
- //};
333
- //console.debug((new Function('module', 'require', decoder.decode(result.outputFiles[0]!.contents)))(module, req));
334
- //const out = await import(fn);
335
- //console.debug(out.name);
336
- //throw new Error("TODO");
337
- //const data = await readFile(outfile, { encoding: 'utf-8' });
338
- //return new Function(data);
339
- }();
389
+ async function readPreBuiltDependency(
390
+ sourceDirPath: string,
391
+ ): Promise<[
392
+ bundledCode: Uint8Array,
393
+ supportingAssets: Record<string, Uint8Array>,
394
+ ]> {
395
+ return [
396
+ await readPreBuiltJSBundle(sourceDirPath),
397
+ await readPreBuiltAssets(sourceDirPath),
398
+ ];
399
+ }
340
400
 
341
- return await depRegistry[moduleRef] as any;
401
+
402
+ export async function buildDependency(
403
+ /**
404
+ * Acts only as cache key to avoid build directories clashing.
405
+ */
406
+ moduleRef: string,
407
+ sourceDir: string,
408
+ onProgress: (progress: Progress) => void,
409
+ ): Promise<[
410
+ bundledCode: Uint8Array,
411
+ supportingAssets: Record<string, Uint8Array>,
412
+ ]> {
413
+ const buildDir = await mkdtemp(join(
414
+ tmpRoot,
415
+ `anafero-dist-${moduleRef.replace(/[^a-z0-9]/gi, '_')}-`,
416
+ ));
417
+
418
+ onProgress({ state: `copying into build dir ${buildDir}` });
419
+
420
+ await cp(sourceDir, buildDir, { recursive: true });
421
+
422
+ //const outfile = join(buildDir, 'out.mjs');
423
+ //await esbuildTransform('oi');
424
+
425
+ onProgress({ state: "compiling" });
426
+
427
+ const result = await esbuild({
428
+ //entryPoints: [join(buildDir, 'index.mts')],
429
+ stdin: {
430
+ contents: await readFile(join(buildDir, 'index.mts')),
431
+ loader: 'ts',
432
+
433
+ // TODO: This means we use filesystem when resolving
434
+ // imports in the entry point. That’s not great, if we
435
+ // want to build e.g. in the browser.
436
+ // It may be possible to avoid this by writing a custom
437
+ // resolver plugin for esbuild. See
438
+ // - https://github.com/evanw/esbuild/issues/591#issuecomment-742962090
439
+ // - https://esbuild.github.io/plugins/#on-resolve-arguments
440
+ resolveDir: buildDir,
441
+
442
+ sourcefile: 'index.mts',
443
+ },
444
+ loader: {
445
+ '.mts': 'ts',
446
+ '.css': 'local-css',
447
+ },
448
+ entryNames: '[dir]/[name]',
449
+ assetNames: '[dir]/[name]',
450
+ format: 'esm',
451
+ target: ['es2022'],
452
+ tsconfigRaw: '{}',
453
+ //external: [],
454
+ packages: 'external',
455
+ //plugins: [{
456
+ // name: 'plugin-resolver',
457
+ // setup(build) {
458
+ // build.onLoad({ filter: /^prosemirror-model-metanorma/ }, args => {
459
+ // return import(args.path);
460
+ // });
461
+ // },
462
+ //}],
463
+ minify: false,
464
+ platform: 'browser',
465
+ write: false,
466
+ logLevel: 'silent',
467
+ //logLevel: 'info',
468
+ sourcemap: true,
469
+ bundle: true,
470
+ outfile: 'index.js',
471
+ treeShaking: true,
472
+ //outfile,
473
+ });
474
+
475
+ onProgress({ state: `removing build dir ${buildDir}` });
476
+ await rmdir(buildDir, { recursive: true });
477
+
478
+ const otherFiles: Record<string, Uint8Array> = {};
479
+
480
+ const mainOutput = result.outputFiles.
481
+ find(({ path }) => basename(path) === 'index.js')?.contents;
482
+
483
+ if (!mainOutput) {
484
+ throw new Error("Fetching dependency: no main output after building");
485
+ } else if (result.outputFiles.length > 1) {
486
+ for (const { path, contents } of result.outputFiles) {
487
+ if (!path.endsWith('/index.js')) {
488
+ otherFiles[basename(path)] = contents;
489
+ }
490
+ }
491
+ }
492
+
493
+ return [mainOutput, otherFiles];
342
494
  }
@@ -42,6 +42,8 @@ import { type VersionBuildConfig, type VersionMeta } from 'anafero/index.mjs';
42
42
 
43
43
  import {
44
44
  fetchDependency,
45
+ buildDependency,
46
+ writePreBuiltAssets,
45
47
  getDependencySources,
46
48
  getDependencySupportingFiles,
47
49
  } from './dependencies.mjs';
@@ -57,6 +59,10 @@ console.debug("Package root", PACKAGE_ROOT);
57
59
 
58
60
  const decoder = new TextDecoder();
59
61
 
62
+ const cwd = process.cwd();
63
+ console.debug("Current working directory", cwd);
64
+
65
+
60
66
  Effect.
61
67
  suspend(() => main(process.argv)).
62
68
  pipe(
@@ -64,13 +70,50 @@ Effect.
64
70
  NodeRuntime.runMain,
65
71
  );
66
72
 
73
+
67
74
  function unpackOption<T>(opt: Option.Option<T>, df?: T): T | undefined {
68
75
  return Option.isNone(opt) ? df : opt.value;
69
76
  }
70
77
 
71
- const build = Command.
78
+
79
+ const dispatch = Command.
80
+ make(
81
+ "npx --node-options='--experimental-vm-modules' -y @riboseinc/anafero-cli",
82
+ {},
83
+ () => Effect.log("Pass --help for usage instructions")).
84
+ pipe(
85
+ Command.withDescription("Anafero builder. Use with a subcommand."),
86
+ );
87
+
88
+ const buildPackage = Command.
89
+ make('build-package', reportingOptions, () => Effect.gen(function * (_) {
90
+ const moduleRef = yield * _(
91
+ Effect.tryPromise(() => readFile(join(cwd, 'package.json'))),
92
+ Effect.flatMap(blob => Effect.try(() => decoder.decode(blob))),
93
+ Effect.flatMap(pkgRaw => Effect.try(() => JSON.parse(pkgRaw))),
94
+ Effect.flatMap(pkg => Effect.succeed(pkg['name'])),
95
+ );
96
+ yield * _(Effect.log(`Building package ${moduleRef}`));
97
+ const [bundledCode, assets] = yield * _(Effect.tryPromise(() => {
98
+ return buildDependency(
99
+ moduleRef,
100
+ cwd,
101
+ (progress) => console.debug(JSON.stringify(progress)),
102
+ );
103
+ }));
104
+ yield * _(Effect.tryPromise(() => writePreBuiltAssets(
105
+ cwd,
106
+ bundledCode,
107
+ assets,
108
+ )));
109
+ })).
110
+ pipe(
111
+ Command.withDescription("For developers: builds adapter in current directory into `./dist`."),
112
+ );
113
+
114
+ const buildSite = Command.
72
115
  make(
73
- 'build',
116
+ 'build-site',
74
117
  {
75
118
 
76
119
  targetDirectoryPath: Options.directory('target-dir'),
@@ -174,11 +217,11 @@ const build = Command.
174
217
  ),
175
218
  ).
176
219
  pipe(
177
- Command.withDescription('build site'),
220
+ Command.withDescription("Builds a website using current directory as source."),
178
221
  );
179
222
 
180
223
 
181
- const dev = Command.
224
+ const devSite = Command.
182
225
  make(
183
226
  'develop',
184
227
  {
@@ -198,14 +241,14 @@ const dev = Command.
198
241
  ({ pkg, skipBuild }) =>
199
242
  Effect.
200
243
  gen(function * (_) {
201
- const buildCfg = yield * _(build);
244
+ const buildCfg = yield * _(buildSite);
202
245
 
203
246
  const { targetDirectoryPath } = buildCfg;
204
247
 
205
248
  // Maybe build
206
249
 
207
250
  if (!skipBuild) {
208
- yield * build.handler(buildCfg);
251
+ yield * buildSite.handler(buildCfg);
209
252
  }
210
253
 
211
254
 
@@ -271,14 +314,17 @@ const dev = Command.
271
314
  })
272
315
  ).
273
316
  pipe(
274
- Command.withDescription('dev mode (watching for changes & copying client-side JS)'),
317
+ Command.withDescription("Build site in dev mode (watching for changes & copying client-side JS)."),
275
318
  );
276
319
 
277
320
 
278
321
 
279
- const main = build.
322
+ const main = dispatch.
280
323
  pipe(
281
- Command.withSubcommands([dev]),
324
+ Command.withSubcommands([
325
+ buildSite.pipe(Command.withSubcommands([devSite])),
326
+ buildPackage,
327
+ ]),
282
328
  Command.run({
283
329
  name: "Anafero builder",
284
330
  version: "N/A",
@@ -286,8 +332,8 @@ const main = build.
286
332
  );
287
333
 
288
334
 
289
- // TODO: Refactor gitdir handling, avoid the globa
290
- const gitdir = join(process.cwd(), '.git');
335
+ // TODO: Refactor gitdir handling, avoid the global
336
+ const gitdir = join(cwd, '.git');
291
337
 
292
338
  async function areWeInGitRepoRoot(): Promise<boolean> {
293
339
  const gitRepoStat = await stat(gitdir);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@riboseinc/anafero-cli",
3
3
  "type": "module",
4
- "version": "0.0.47",
4
+ "version": "0.0.48",
5
5
  "packageManager": "yarn@4.5.0",
6
6
  "bin": {
7
7
  "build-site": "build-site.mjs"
Binary file
Binary file