akanjs 2.0.0-beta.3 → 2.0.0-beta.4

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/index.js CHANGED
@@ -9946,11 +9946,12 @@ class ApplicationCommand extends command("application", [ApplicationScript], ({
9946
9946
  })) {
9947
9947
  }
9948
9948
 
9949
+ import path36 from "path";
9949
9950
  var {$: $2 } = globalThis.Bun;
9950
9951
 
9951
9952
  class PackageRunner extends runner("package") {
9952
- async version({ log = true } = {}) {
9953
- const pkgJson = await FileSys.readJson("package.json");
9953
+ async version(workspace, { log = true } = {}) {
9954
+ const pkgJson = await FileSys.readJson(process.env.USE_AKANJS_PKGS === "true" ? `${workspace.workspaceRoot}/pkgs/akanjs/package.json` : `${path36.dirname(Bun.main)}/package.json`);
9954
9955
  const version = pkgJson.version;
9955
9956
  if (log)
9956
9957
  Logger.rawLog(`${pkgJson.name}@${version}`);
@@ -10005,8 +10006,8 @@ class PackageRunner extends runner("package") {
10005
10006
  }
10006
10007
 
10007
10008
  class PackageScript extends script("package", [PackageRunner]) {
10008
- async version({ log = true } = {}) {
10009
- return await this.packageRunner.version({ log });
10009
+ async version(workspace, { log = true } = {}) {
10010
+ return await this.packageRunner.version(workspace, { log });
10010
10011
  }
10011
10012
  async createPackage(workspace, pkgName) {
10012
10013
  const spinner2 = workspace.spinning(`Creating package in pkgs/${pkgName}...`);
@@ -10265,14 +10266,14 @@ class GuidelinePrompt extends Prompter {
10265
10266
  async#getScanFilePaths(matchPattern, { avoidDirs = ["node_modules", ".next"], filterText } = {}) {
10266
10267
  const glob = new Bun.Glob(matchPattern);
10267
10268
  const paths = [];
10268
- for await (const path36 of glob.scan({ cwd: this.workspace.workspaceRoot, absolute: true })) {
10269
- if (avoidDirs.some((dir) => path36.includes(dir)))
10269
+ for await (const path37 of glob.scan({ cwd: this.workspace.workspaceRoot, absolute: true })) {
10270
+ if (avoidDirs.some((dir) => path37.includes(dir)))
10270
10271
  continue;
10271
- const fileContent = await FileSys.readText(path36);
10272
+ const fileContent = await FileSys.readText(path37);
10272
10273
  const textFilter = filterText ? new RegExp(filterText) : null;
10273
10274
  if (filterText && !textFilter?.test(fileContent))
10274
10275
  continue;
10275
- paths.push(path36);
10276
+ paths.push(path37);
10276
10277
  }
10277
10278
  return paths;
10278
10279
  }
@@ -11052,8 +11053,8 @@ class ModuleCommand extends command("module", [ModuleScript], ({ public: target
11052
11053
  }
11053
11054
 
11054
11055
  class PackageCommand extends command("package", [PackageScript], ({ public: target }) => ({
11055
- version: target({ desc: "Show version information for all packages" }).exec(async function() {
11056
- await this.packageScript.version();
11056
+ version: target({ desc: "Show version information for all packages" }).with(Workspace).exec(async function(workspace) {
11057
+ await this.packageScript.version(workspace);
11057
11058
  }),
11058
11059
  createPackage: target({ desc: "Create a new package in pkgs/akanjs/" }).option("name", String, { desc: "name of package" }).with(Workspace).exec(async function(name, workspace) {
11059
11060
  await this.packageScript.createPackage(workspace, name.toLowerCase().replace(/ /g, "-"));
@@ -11258,13 +11259,13 @@ class ScalarCommand extends command("scalar", [ScalarScript], ({ public: target
11258
11259
  })) {
11259
11260
  }
11260
11261
 
11261
- import path37 from "path";
11262
+ import path38 from "path";
11262
11263
 
11263
- import path36 from "path";
11264
+ import path37 from "path";
11264
11265
  class WorkspaceRunner extends runner("workspace") {
11265
11266
  async createWorkspace(repoName, appName, { dirname: dirname3 = ".", init = true, akanVersion }) {
11266
11267
  const cwdPath = process.cwd();
11267
- const workspaceRoot = path36.join(cwdPath, dirname3, repoName);
11268
+ const workspaceRoot = path37.join(cwdPath, dirname3, repoName);
11268
11269
  const workspace = WorkspaceExecutor.fromRoot({ workspaceRoot, repoName });
11269
11270
  const templateSpinner = workspace.spinning(`Creating workspace template files in ${dirname3}/${repoName}...`);
11270
11271
  await workspace.applyTemplate({
@@ -11327,7 +11328,7 @@ class WorkspaceScript extends script("workspace", [
11327
11328
  } catch (_) {
11328
11329
  gitSpinner.fail("Git repository initialization failed. It's not fatal, you can commit manually");
11329
11330
  }
11330
- const workspacePath = path37.join(dirname3, repoName);
11331
+ const workspacePath = path38.join(dirname3, repoName);
11331
11332
  Logger.rawLog(`
11332
11333
  \uD83C\uDF89 Welcome aboard! Workspace created in ${dirname3}/${repoName}`);
11333
11334
  Logger.rawLog(`\uD83D\uDE80 Run \`cd ${workspacePath} && akan start ${appName}\` to start the development server.`);
@@ -3,9 +3,11 @@ import { command, Pkg, Workspace } from "akanjs/devkit";
3
3
  import { PackageScript } from "./package.script";
4
4
 
5
5
  export class PackageCommand extends command("package", [PackageScript], ({ public: target }) => ({
6
- version: target({ desc: "Show version information for all packages" }).exec(async function () {
7
- await this.packageScript.version();
8
- }),
6
+ version: target({ desc: "Show version information for all packages" })
7
+ .with(Workspace)
8
+ .exec(async function (workspace) {
9
+ await this.packageScript.version(workspace);
10
+ }),
9
11
  createPackage: target({ desc: "Create a new package in pkgs/akanjs/" })
10
12
  .option("name", String, { desc: "name of package" })
11
13
  .with(Workspace)
@@ -1,3 +1,4 @@
1
+ import path from "node:path";
1
2
  import { Logger } from "akanjs/common";
2
3
  import {
3
4
  FileSys,
@@ -10,8 +11,12 @@ import {
10
11
  import { $ } from "bun";
11
12
 
12
13
  export class PackageRunner extends runner("package") {
13
- async version({ log = true }: { log?: boolean } = {}) {
14
- const pkgJson = await FileSys.readJson<PackageJson>("package.json");
14
+ async version(workspace: Workspace, { log = true }: { log?: boolean } = {}) {
15
+ const pkgJson = await FileSys.readJson<PackageJson>(
16
+ process.env.USE_AKANJS_PKGS === "true"
17
+ ? `${workspace.workspaceRoot}/pkgs/akanjs/package.json`
18
+ : `${path.dirname(Bun.main)}/package.json`,
19
+ );
15
20
  const version = pkgJson.version;
16
21
  if (log) Logger.rawLog(`${pkgJson.name}@${version}`);
17
22
  return version;
@@ -3,8 +3,8 @@ import { type Pkg, script, type Workspace } from "akanjs/devkit";
3
3
  import { PackageRunner } from "./package.runner";
4
4
 
5
5
  export class PackageScript extends script("package", [PackageRunner]) {
6
- async version({ log = true }: { log?: boolean } = {}) {
7
- return await this.packageRunner.version({ log });
6
+ async version(workspace: Workspace, { log = true }: { log?: boolean } = {}) {
7
+ return await this.packageRunner.version(workspace, { log });
8
8
  }
9
9
  async createPackage(workspace: Workspace, pkgName: string) {
10
10
  const spinner = workspace.spinning(`Creating package in pkgs/${pkgName}...`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akanjs",
3
- "version": "2.0.0-beta.3",
3
+ "version": "2.0.0-beta.4",
4
4
  "sourceType": "module",
5
5
  "type": "module",
6
6
  "bin": {