@graftland/cli 0.2.0-beta.0 → 0.2.0-beta.1

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/bin.js CHANGED
@@ -1,7 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
  import { version } from "./package.js";
3
- import { add as add$1, create as create$1, remove as remove$1 } from "./Manage.js";
4
- import { run } from "./Start.js";
5
3
  import { Effect, Option } from "effect";
6
4
  import { NodeRuntime, NodeServices } from "@effect/platform-node";
7
5
  import { Argument, Command, Flag } from "effect/cli";
@@ -13,17 +11,17 @@ const start = Command.make("start", {
13
11
  config: Argument.String("config").pipe(Argument.withDescription("Path of the config file"), Argument.withDefault("graft.yml")),
14
12
  watch: Flag.Boolean("watch").pipe(Flag.withAlias("w"), Flag.withDescription("Reload plugins and config when files change"), Flag.withDefault(false)),
15
13
  envFile: Flag.String("env-file").pipe(Flag.withDescription("Read variables for !env from a .env file; the process environment takes precedence"), Flag.optional)
16
- }, (options) => run({
14
+ }, (options) => Effect.promise(() => import("./Start.js")).pipe(Effect.flatMap((Start) => Start.run({
17
15
  ...options,
18
16
  envFile: Option.getOrUndefined(options.envFile)
19
- })).pipe(Command.withDescription("Run the application described by a config file"));
17
+ })))).pipe(Command.withDescription("Run the application described by a config file"));
20
18
  const create = Command.make("create", {
21
19
  directory: Argument.String("directory").pipe(Argument.withDescription("Where to create the project")),
22
20
  name: Flag.String("name").pipe(Flag.withDescription("Package name; defaults to the directory name"), Flag.optional),
23
21
  install: Flag.Boolean("install").pipe(Flag.withDescription("Install dependencies afterwards"), Flag.withDefault(false))
24
- }, create$1).pipe(Command.withDescription("Create a new Graft project"));
25
- const add = Command.make("add", { packages: Argument.variadic(Argument.String("package")) }, ({ packages }) => add$1(packages)).pipe(Command.withDescription("Add dependencies, restoring the project if installing fails"));
26
- const remove = Command.make("remove", { packages: Argument.variadic(Argument.String("package")) }, ({ packages }) => remove$1(packages)).pipe(Command.withDescription("Remove dependencies, restoring the project if installing fails"));
22
+ }, (options) => Effect.promise(() => import("./Manage.js")).pipe(Effect.flatMap((Manage) => Manage.create(options)))).pipe(Command.withDescription("Create a new Graft project"));
23
+ const add = Command.make("add", { packages: Argument.variadic(Argument.String("package")) }, ({ packages }) => Effect.promise(() => import("./Manage.js")).pipe(Effect.flatMap((Manage) => Manage.add(packages)))).pipe(Command.withDescription("Add dependencies, restoring the project if installing fails"));
24
+ const remove = Command.make("remove", { packages: Argument.variadic(Argument.String("package")) }, ({ packages }) => Effect.promise(() => import("./Manage.js")).pipe(Effect.flatMap((Manage) => Manage.remove(packages)))).pipe(Command.withDescription("Remove dependencies, restoring the project if installing fails"));
27
25
  const graft = Command.make("graft").pipe(Command.withDescription("Run and manage Graft applications"), Command.withSubcommands([
28
26
  start,
29
27
  create,
package/dist/bin.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"bin.js","names":["Start.run","Manage.create","Manage.add","Manage.remove"],"sources":["../src/bin.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * The `graft` executable. Running this module starts the program.\n */\nimport { NodeRuntime, NodeServices } from \"@effect/platform-node\"\nimport { Effect, Option } from \"effect\"\nimport { Argument, Command, Flag } from \"effect/cli\"\nimport { version } from \"../package.json\" with { type: \"json\" }\nimport * as Manage from \"./Manage\"\nimport * as Start from \"./Start\"\n\nconst start = Command.make(\n\t\"start\",\n\t{\n\t\tconfig: Argument.String(\"config\").pipe(\n\t\t\tArgument.withDescription(\"Path of the config file\"),\n\t\t\tArgument.withDefault(\"graft.yml\"),\n\t\t),\n\t\twatch: Flag.Boolean(\"watch\").pipe(\n\t\t\tFlag.withAlias(\"w\"),\n\t\t\tFlag.withDescription(\"Reload plugins and config when files change\"),\n\t\t\tFlag.withDefault(false),\n\t\t),\n\t\tenvFile: Flag.String(\"env-file\").pipe(\n\t\t\tFlag.withDescription(\n\t\t\t\t\"Read variables for !env from a .env file; the process environment takes precedence\",\n\t\t\t),\n\t\t\tFlag.optional,\n\t\t),\n\t},\n\t(options) =>\n\t\tStart.run({ ...options, envFile: Option.getOrUndefined(options.envFile) }),\n).pipe(\n\tCommand.withDescription(\"Run the application described by a config file\"),\n)\n\nconst create = Command.make(\n\t\"create\",\n\t{\n\t\tdirectory: Argument.String(\"directory\").pipe(\n\t\t\tArgument.withDescription(\"Where to create the project\"),\n\t\t),\n\t\tname: Flag.String(\"name\").pipe(\n\t\t\tFlag.withDescription(\"Package name; defaults to the directory name\"),\n\t\t\tFlag.optional,\n\t\t),\n\t\tinstall: Flag.Boolean(\"install\").pipe(\n\t\t\tFlag.withDescription(\"Install dependencies afterwards\"),\n\t\t\tFlag.withDefault(false),\n\t\t),\n\t},\n\tManage.create,\n).pipe(Command.withDescription(\"Create a new Graft project\"))\n\nconst add = Command.make(\n\t\"add\",\n\t{ packages: Argument.variadic(Argument.String(\"package\")) },\n\t({ packages }) => Manage.add(packages),\n).pipe(\n\tCommand.withDescription(\n\t\t\"Add dependencies, restoring the project if installing fails\",\n\t),\n)\n\nconst remove = Command.make(\n\t\"remove\",\n\t{ packages: Argument.variadic(Argument.String(\"package\")) },\n\t({ packages }) => Manage.remove(packages),\n).pipe(\n\tCommand.withDescription(\n\t\t\"Remove dependencies, restoring the project if installing fails\",\n\t),\n)\n\nconst graft = Command.make(\"graft\").pipe(\n\tCommand.withDescription(\"Run and manage Graft applications\"),\n\tCommand.withSubcommands([start, create, add, remove]),\n)\n\nCommand.run(graft, { version }).pipe(\n\tEffect.provide(NodeServices.layer),\n\tNodeRuntime.runMain,\n)\n"],"mappings":";;;;;;;;;;;AAWA,MAAM,QAAQ,QAAQ,KACrB,SACA;CACC,QAAQ,SAAS,OAAO,QAAQ,CAAC,CAAC,KACjC,SAAS,gBAAgB,yBAAyB,GAClD,SAAS,YAAY,WAAW,CACjC;CACA,OAAO,KAAK,QAAQ,OAAO,CAAC,CAAC,KAC5B,KAAK,UAAU,GAAG,GAClB,KAAK,gBAAgB,6CAA6C,GAClE,KAAK,YAAY,KAAK,C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cesContent":["#!/usr/bin/env node\n/**\n * The `graft` executable. Running this module starts the program.\n */\nimport { NodeRuntime, NodeServices } from \"@effect/platform-node\"\nimport { Effect, Option } from \"effect\"\nimport { Argument, Command, Flag } from \"effect/cli\"\nimport { version } from \"../package.json\" with { type: \"json\" }\n\nconst start = Command.make(\n\t\"start\",\n\t{\n\t\tconfig: Argument.String(\"config\").pipe(\n\t\t\tArgument.withDescription(\"Path of the config file\"),\n\t\t\tArgument.withDefault(\"graft.yml\"),\n\t\t),\n\t\twatch: Flag.Boolean(\"watch\").pipe(\n\t\t\tFlag.withAlias(\"w\"),\n\t\t\tFlag.withDescription(\"Reload plugins and config when files change\"),\n\t\t\tFlag.withDefault(false),\n\t\t),\n\t\tenvFile: Flag.String(\"env-file\").pipe(\n\t\t\tFlag.withDescription(\n\t\t\t\t\"Read variables for !env from a .env file; the process environment takes precedence\",\n\t\t\t),\n\t\t\tFlag.optional,\n\t\t),\n\t},\n\t(options) =>\n\t\tEffect.promise(() => import(\"./Start\")).pipe(\n\t\t\tEffect.flatMap((Start) =>\n\t\t\t\tStart.run({\n\t\t\t\t\t...options,\n\t\t\t\t\tenvFile: Option.getOrUndefined(options.envFile),\n\t\t\t\t}),\n\t\t\t),\n\t\t),\n).pipe(\n\tCommand.withDescription(\"Run the application described by a config file\"),\n)\n\nconst create = Command.make(\n\t\"create\",\n\t{\n\t\tdirectory: Argument.String(\"directory\").pipe(\n\t\t\tArgument.withDescription(\"Where to create the project\"),\n\t\t),\n\t\tname: Flag.String(\"name\").pipe(\n\t\t\tFlag.withDescription(\"Package name; defaults to the directory name\"),\n\t\t\tFlag.optional,\n\t\t),\n\t\tinstall: Flag.Boolean(\"install\").pipe(\n\t\t\tFlag.withDescription(\"Install dependencies afterwards\"),\n\t\t\tFlag.withDefault(false),\n\t\t),\n\t},\n\t(options) =>\n\t\tEffect.promise(() => import(\"./Manage\")).pipe(\n\t\t\tEffect.flatMap((Manage) => Manage.create(options)),\n\t\t),\n).pipe(Command.withDescription(\"Create a new Graft project\"))\n\nconst add = Command.make(\n\t\"add\",\n\t{ packages: Argument.variadic(Argument.String(\"package\")) },\n\t({ packages }) =>\n\t\tEffect.promise(() => import(\"./Manage\")).pipe(\n\t\t\tEffect.flatMap((Manage) => Manage.add(packages)),\n\t\t),\n).pipe(\n\tCommand.withDescription(\n\t\t\"Add dependencies, restoring the project if installing fails\",\n\t),\n)\n\nconst remove = Command.make(\n\t\"remove\",\n\t{ packages: Argument.variadic(Argument.String(\"package\")) },\n\t({ packages }) =>\n\t\tEffect.promise(() => import(\"./Manage\")).pipe(\n\t\t\tEffect.flatMap((Manage) => Manage.remove(packages)),\n\t\t),\n).pipe(\n\tCommand.withDescription(\n\t\t\"Remove dependencies, restoring the project if installing fails\",\n\t),\n)\n\nconst graft = Command.make(\"graft\").pipe(\n\tCommand.withDescription(\"Run and manage Graft applications\"),\n\tCommand.withSubcommands([start, create, add, remove]),\n)\n\nCommand.run(graft, { version }).pipe(\n\tEffect.provide(NodeServices.layer),\n\tNodeRuntime.runMain,\n)\n"],"mappings":";;;;;;;;;AASA,MAAM,QAAQ,QAAQ,KACrB,SACA;CACC,QAAQ,SAAS,OAAO,QAAQ,CAAC,CAAC,KACjC,SAAS,gBAAgB,yBAAyB,GAClD,SAAS,YAAY,WAAW,CACjC;CACA,OAAO,KAAK,QAAQ,OAAO,CAAC,CAAC,KAC5B,KAAK,UAAU,GAAG,GAClB,KAAK,gBAAgB,6CAA6C,GAClE,KAAK,YAAY,KAAK,CACvB;CACA,SAAS,KAAK,OAAO,UAAU,CAAC,CAAC,KAChC,KAAK,gBACJ,oFACD,GACA,KAAK,QACN;AACD,IACC,YACA,OAAO,cAAc,OAAO,aAAU,CAAC,CAAC,KACvC,OAAO,SAAS,UACf,MAAM,IAAI;CACT,GAAG;CACH,SAAS,OAAO,eAAe,QAAQ,OAAO;AAC/C,CAAC,CACF,CACD,CACF,CAAC,CAAC,KACD,QAAQ,gBAAgB,gDAAgD,CACzE;AAEA,MAAM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2
2
  "name": "@graftland/cli",
3
- "version": "0.2.0-beta.0",
3
+ "version": "0.2.0-beta.1",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=22.19.0"
@@ -35,11 +35,11 @@
35
35
  "vitest": "5.1.0"
36
36
  },
37
37
  "dependencies": {
38
- "@graftland/graft": "0.2.0-beta.0",
39
- "@graftland/loader": "0.2.0-beta.0",
40
- "@graftland/hmr": "0.2.0-beta.0",
41
- "@graftland/create": "0.2.0-beta.0",
42
- "@graftland/package-manager": "0.2.0-beta.0",
38
+ "@graftland/graft": "0.2.0-beta.1",
39
+ "@graftland/loader": "0.2.0-beta.1",
40
+ "@graftland/hmr": "0.2.0-beta.1",
41
+ "@graftland/create": "0.2.0-beta.1",
42
+ "@graftland/package-manager": "0.2.0-beta.1",
43
43
  "@effect/platform-node": "4.1.2"
44
44
  },
45
45
  "bin": {
package/src/bin.ts CHANGED
@@ -6,8 +6,6 @@ import { NodeRuntime, NodeServices } from "@effect/platform-node"
6
6
  import { Effect, Option } from "effect"
7
7
  import { Argument, Command, Flag } from "effect/cli"
8
8
  import { version } from "../package.json" with { type: "json" }
9
- import * as Manage from "./Manage"
10
- import * as Start from "./Start"
11
9
 
12
10
  const start = Command.make(
13
11
  "start",
@@ -29,7 +27,14 @@ const start = Command.make(
29
27
  ),
30
28
  },
31
29
  (options) =>
32
- Start.run({ ...options, envFile: Option.getOrUndefined(options.envFile) }),
30
+ Effect.promise(() => import("./Start")).pipe(
31
+ Effect.flatMap((Start) =>
32
+ Start.run({
33
+ ...options,
34
+ envFile: Option.getOrUndefined(options.envFile),
35
+ }),
36
+ ),
37
+ ),
33
38
  ).pipe(
34
39
  Command.withDescription("Run the application described by a config file"),
35
40
  )
@@ -49,13 +54,19 @@ const create = Command.make(
49
54
  Flag.withDefault(false),
50
55
  ),
51
56
  },
52
- Manage.create,
57
+ (options) =>
58
+ Effect.promise(() => import("./Manage")).pipe(
59
+ Effect.flatMap((Manage) => Manage.create(options)),
60
+ ),
53
61
  ).pipe(Command.withDescription("Create a new Graft project"))
54
62
 
55
63
  const add = Command.make(
56
64
  "add",
57
65
  { packages: Argument.variadic(Argument.String("package")) },
58
- ({ packages }) => Manage.add(packages),
66
+ ({ packages }) =>
67
+ Effect.promise(() => import("./Manage")).pipe(
68
+ Effect.flatMap((Manage) => Manage.add(packages)),
69
+ ),
59
70
  ).pipe(
60
71
  Command.withDescription(
61
72
  "Add dependencies, restoring the project if installing fails",
@@ -65,7 +76,10 @@ const add = Command.make(
65
76
  const remove = Command.make(
66
77
  "remove",
67
78
  { packages: Argument.variadic(Argument.String("package")) },
68
- ({ packages }) => Manage.remove(packages),
79
+ ({ packages }) =>
80
+ Effect.promise(() => import("./Manage")).pipe(
81
+ Effect.flatMap((Manage) => Manage.remove(packages)),
82
+ ),
69
83
  ).pipe(
70
84
  Command.withDescription(
71
85
  "Remove dependencies, restoring the project if installing fails",