@graftland/cli 0.0.0-stage → 0.2.0-beta.0

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/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+
package/README.md CHANGED
@@ -1,3 +1,23 @@
1
- # Temporary Holding Version
1
+ # @graftland/cli
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ English |
4
+ [简体中文](https://github.com/graftland/graft/blob/main/packages/cli/README.zh-CN.md)
5
+ |
6
+ [繁體中文](https://github.com/graftland/graft/blob/main/packages/cli/README.zh-TW.md)
7
+
8
+ The `graft` command: `start`, `create`, `add` and `remove`.
9
+
10
+ ```sh
11
+ npm install @graftland/cli effect
12
+ ```
13
+
14
+ Create a project with `npx @graftland/cli create my-app --install`. Then run it
15
+ with `npx graft start --watch`. You need Node.js 22.19 or later.
16
+
17
+ ## Documentation
18
+
19
+ - [Quickstart](https://graftland.github.io/graft/quickstart/)
20
+ - [Command line](https://graftland.github.io/graft/cli/)
21
+
22
+ Part of [Graft](https://github.com/graftland/graft). Licensed under
23
+ [Apache 2.0](https://github.com/graftland/graft/blob/main/LICENSE).
@@ -0,0 +1,22 @@
1
+ # @graftland/cli
2
+
3
+ [English](https://github.com/graftland/graft/blob/main/packages/cli/README.md)
4
+ | 简体中文 |
5
+ [繁體中文](https://github.com/graftland/graft/blob/main/packages/cli/README.zh-TW.md)
6
+
7
+ `graft` 命令:`start`、`create`、`add` 和 `remove`。
8
+
9
+ ```sh
10
+ npm install @graftland/cli effect
11
+ ```
12
+
13
+ 用 `npx @graftland/cli create my-app --install` 创建项目,然后用
14
+ `npx graft start --watch` 运行它。需要 Node.js 22.19 或更高版本。
15
+
16
+ ## 文档
17
+
18
+ - [快速开始](https://graftland.github.io/graft/zh-cn/quickstart/)
19
+ - [命令行](https://graftland.github.io/graft/zh-cn/cli/)
20
+
21
+ 属于 [Graft](https://github.com/graftland/graft)。基于
22
+ [Apache 2.0](https://github.com/graftland/graft/blob/main/LICENSE) 许可。
@@ -0,0 +1,22 @@
1
+ # @graftland/cli
2
+
3
+ [English](https://github.com/graftland/graft/blob/main/packages/cli/README.md) |
4
+ [简体中文](https://github.com/graftland/graft/blob/main/packages/cli/README.zh-CN.md)
5
+ | 繁體中文
6
+
7
+ `graft` 命令:`start`、`create`、`add` 和 `remove`。
8
+
9
+ ```sh
10
+ npm install @graftland/cli effect
11
+ ```
12
+
13
+ 用 `npx @graftland/cli create my-app --install` 建立專案,然後用
14
+ `npx graft start --watch` 執行它。需要 Node.js 22.19 或更新版本。
15
+
16
+ ## 文件
17
+
18
+ - [快速開始](https://graftland.github.io/graft/zh-tw/quickstart/)
19
+ - [命令列](https://graftland.github.io/graft/zh-tw/cli/)
20
+
21
+ 屬於 [Graft](https://github.com/graftland/graft)。採用
22
+ [Apache 2.0](https://github.com/graftland/graft/blob/main/LICENSE) 授權。
@@ -0,0 +1,13 @@
1
+ import { Effect, Option } from "effect";
2
+ declare namespace Manage_d_exports {
3
+ export { add, create, remove };
4
+ }
5
+ export declare const create: (options: {
6
+ readonly directory: string;
7
+ readonly name: Option.Option<string>;
8
+ readonly install: boolean;
9
+ }) => Effect.Effect<void, unknown, unknown>;
10
+ export declare const add: (specs: ReadonlyArray<string>) => Effect.Effect<void, unknown, any>;
11
+ export declare const remove: (names: ReadonlyArray<string>) => Effect.Effect<void, unknown, unknown>;
12
+ export { Manage_d_exports };
13
+ //# sourceMappingURL=Manage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Manage.d.ts","names":[],"sources":["../src/Manage.ts"],"mappings":";;;;qBAiDa,SAAM;WACT;WACA,MAAM,OAAO;WACb;MACT,OAAA;qBAaY,MAAG,OAAW,0BAAqB,OAAA;qBAcnC,SAAM,OAAW,0BAAqB,OAAA"}
package/dist/Manage.js ADDED
@@ -0,0 +1,49 @@
1
+ import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
+ import * as Create from "@graftland/create";
3
+ import * as PackageManager from "@graftland/package-manager";
4
+ import { Array, Config, Effect, Option, Predicate, Record, Schema } from "effect";
5
+ // src/Manage.ts
6
+ /**
7
+ * Creating projects and changing their dependencies.
8
+ */
9
+ var Manage_exports = /* @__PURE__ */ __exportAll({
10
+ add: () => add,
11
+ create: () => create,
12
+ remove: () => remove
13
+ });
14
+ const report = (result) => Effect.logInfo(`${result.agent}: ${result.added.length} added, ${result.updated.length} updated, ${result.removed.length} removed`);
15
+ /**
16
+ * `name@range`, split at the last `@` so a scope's `@` stays in the name. A
17
+ * bare name means the latest version.
18
+ */
19
+ const Spec = Schema.Union([Schema.TemplateLiteralParser([
20
+ PackageManager.PackageName,
21
+ "@",
22
+ Schema.String
23
+ ]), PackageManager.PackageName]);
24
+ const decodeSpecs = Schema.decodeEffect(Schema.Array(Spec));
25
+ const install = (directory, changes) => Effect.gen(function* () {
26
+ const decoded = yield* Schema.decodeEffect(PackageManager.Changes)(changes);
27
+ const userAgent = yield* Config.String("npm_config_user_agent").pipe(Config.withDefault(""));
28
+ const result = yield* (yield* PackageManager.make({
29
+ directory,
30
+ userAgent
31
+ })).install(decoded);
32
+ yield* report(result);
33
+ });
34
+ const create = (options) => Effect.gen(function* () {
35
+ const project = yield* Create.create({
36
+ directory: options.directory,
37
+ ...Option.match(options.name, {
38
+ onNone: () => ({}),
39
+ onSome: (name) => ({ name })
40
+ })
41
+ });
42
+ yield* Effect.logInfo(`Created ${project.name} in ${project.directory}`);
43
+ if (options.install) yield* install(project.directory, {});
44
+ });
45
+ const add = (specs) => Effect.flatMap(decodeSpecs(specs), (specs) => install(".", Record.fromEntries(Array.map(specs, (spec) => Predicate.isString(spec) ? [spec, "latest"] : [spec[0], spec[2]]))));
46
+ const remove = (names) => install(".", Record.fromEntries(Array.map(names, (name) => [name, null])));
47
+ export { Manage_exports, add, create, remove };
48
+
49
+ //# sourceMappingURL=Manage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Manage.js","names":[],"sources":["../src/Manage.ts"],"sourcesContent":["/**\n * Creating projects and changing their dependencies.\n */\nimport * as Create from \"@graftland/create\"\nimport * as PackageManager from \"@graftland/package-manager\"\nimport {\n\tArray,\n\tConfig,\n\tEffect,\n\tOption,\n\tPredicate,\n\tRecord,\n\tSchema,\n} from \"effect\"\n\nconst report = (result: PackageManager.InstallResult) =>\n\tEffect.logInfo(\n\t\t`${result.agent}: ${result.added.length} added, ${result.updated.length} updated, ${result.removed.length} removed`,\n\t)\n\n/**\n * `name@range`, split at the last `@` so a scope's `@` stays in the name. A\n * bare name means the latest version.\n */\nconst Spec = Schema.Union([\n\tSchema.TemplateLiteralParser([\n\t\tPackageManager.PackageName,\n\t\t\"@\",\n\t\tSchema.String,\n\t]),\n\tPackageManager.PackageName,\n])\nconst decodeSpecs = Schema.decodeEffect(Schema.Array(Spec))\n\nconst install = (\n\tdirectory: string,\n\tchanges: Readonly<Record<string, string | null>>,\n) =>\n\tEffect.gen(function* () {\n\t\tconst decoded = yield* Schema.decodeEffect(PackageManager.Changes)(changes)\n\t\t// Set by npm, pnpm and Yarn when they run graft, such as through `pnpm dlx`.\n\t\tconst userAgent = yield* Config.String(\"npm_config_user_agent\").pipe(\n\t\t\tConfig.withDefault(\"\"),\n\t\t)\n\t\tconst manager = yield* PackageManager.make({ directory, userAgent })\n\t\tconst result = yield* manager.install(decoded)\n\t\tyield* report(result)\n\t})\n\nexport const create = (options: {\n\treadonly directory: string\n\treadonly name: Option.Option<string>\n\treadonly install: boolean\n}) =>\n\tEffect.gen(function* () {\n\t\tconst project = yield* Create.create({\n\t\t\tdirectory: options.directory,\n\t\t\t...Option.match(options.name, {\n\t\t\t\tonNone: () => ({}),\n\t\t\t\tonSome: (name) => ({ name }),\n\t\t\t}),\n\t\t})\n\t\tyield* Effect.logInfo(`Created ${project.name} in ${project.directory}`)\n\t\tif (options.install) yield* install(project.directory, {})\n\t})\n\nexport const add = (specs: ReadonlyArray<string>) =>\n\tEffect.flatMap(decodeSpecs(specs), (specs) =>\n\t\tinstall(\n\t\t\t\".\",\n\t\t\tRecord.fromEntries(\n\t\t\t\tArray.map(specs, (spec) =>\n\t\t\t\t\tPredicate.isString(spec)\n\t\t\t\t\t\t? ([spec, \"latest\"] as const)\n\t\t\t\t\t\t: ([spec[0], spec[2]] as const),\n\t\t\t\t),\n\t\t\t),\n\t\t),\n\t)\n\nexport const remove = (names: ReadonlyArray<string>) =>\n\tinstall(\n\t\t\".\",\n\t\tRecord.fromEntries(Array.map(names, (name) => [name, null] as const)),\n\t)\n"],"mappings":";;;;;;;;;;;;;AAeA,MAAM,UAAU,WACf,OAAO,QACN,GAAG,OAAO,MAAM,IAAI,OAAO,MAAM,OAAO,UAAU,OAAO,QAAQ,OAAO,YAAY,OAAO,QAAQ,OAAO,SAC3G;;;;;AAMD,MAAM,OAAO,OAAO,MAAM,CACzB,OAAO,sBAAsB;CAC5B,eAAe;CACf;CACA,OAAO;AACR,CAAC,GACD,eAAe,WAChB,CAAC;AACD,MAAM,cAAc,OAAO,aAAa,OAAO,MAAM,IAAI,CAAC;AAE1D,MAAM,WACL,WACA,YAEA,OAAO,IAAI,aAAa;CACvB,MAAM,UAAU,OAAO,OAAO,aAAa,eAAe,OAAO,CAAC,CAAC,OAAO;CAE1E,MAAM,YAAY,OAAO,OAAO,OAAO,uBAAuB,CAAC,CAAC,KAC/D,OAAO,YAAY,EAAE,CACtB;CAEA,MAAM,SAAS,QAAO,OADC,eAAe,KAAK;EAAE;EAAW;CAAU,CAAC,EAAA,CACrC,QAAQ,OAAO;CAC7C,OAAO,OAAO,MAAM;AACrB,CAAC;AAEF,MAAa,UAAU,YAKtB,OAAO,IAAI,aAAa;CACvB,MAAM,UAAU,OAAO,OAAO,OAAO;EACpC,WAAW,QAAQ;EACnB,GAAG,OAAO,MAAM,QAAQ,MAAM;GAC7B,eAAe,CAAC;GAChB,SAAS,UAAU,EAAE,KAAK;EAC3B,CAAC;CACF,CAAC;CACD,OAAO,OAAO,QAAQ,WAAW,QAAQ,KAAK,MAAM,QAAQ,WAAW;CACvE,IAAI,QAAQ,SAAS,OAAO,QAAQ,QAAQ,WAAW,CAAC,CAAC;AAC1D,CAAC;AAEF,MAAa,OAAO,UACnB,OAAO,QAAQ,YAAY,KAAK,IAAI,UACnC,QACC,KACA,OAAO,YACN,MAAM,IAAI,QAAQ,SACjB,UAAU,SAAS,IAAI,IACnB,CAAC,MAAM,QAAQ,IACf,CAAC,KAAK,IAAI,KAAK,EAAE,CACtB,CACD,CACD,CACD;AAED,MAAa,UAAU,UACtB,QACC,KACA,OAAO,YAAY,MAAM,IAAI,QAAQ,SAAS,CAAC,MAAM,IAAI,CAAU,CAAC,CACrE"}
@@ -0,0 +1,25 @@
1
+ import { Effect, PlatformError, Schema } from "effect";
2
+ import { Graft } from "@graftland/graft";
3
+ import { Loader, Tree } from "@graftland/loader";
4
+ declare namespace Start_d_exports {
5
+ export { Options, run };
6
+ }
7
+ export interface Options {
8
+ /** Path of the config file. */
9
+ readonly config: string;
10
+ /** Reload plugin modules and the config file when they change. */
11
+ readonly watch: boolean;
12
+ /**
13
+ * A `.env` file that `!env` reads when the process environment does not set
14
+ * a variable. With `watch`, changes to it are read again.
15
+ */
16
+ readonly envFile?: string | undefined;
17
+ }
18
+ /**
19
+ * Loads the entries of the config file and runs until interrupted. Plugin
20
+ * modules are imported through the hot reloader, so bare specifiers resolve
21
+ * from the application directory whether or not `watch` is on.
22
+ */
23
+ export declare const run: (options: Options) => Effect.Effect<never, Graft.ServiceConflict | PlatformError.BadArgument | PlatformError.PlatformError | Schema.SchemaError | Loader.StoreError | Tree.InvalidOperation>;
24
+ export { Start_d_exports };
25
+ //# sourceMappingURL=Start.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Start.d.ts","names":[],"sources":["../src/Start.ts"],"mappings":";;;;;;iBAaiB;;WAEP;;WAEA;;;;;WAKA;;;;;;;qBAQG,MAAG,SACN,YACP,OAAO,cAEP,MAAM,kBACN,cAAc,cACd,cAAc,gBACd,OAAO,cACP,OAAO,aACP,KAAK"}
package/dist/Start.js ADDED
@@ -0,0 +1,58 @@
1
+ import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
+ import { EnvFile, layer, watchEnvFile } from "./internal/env.js";
3
+ import { layer as layer$1 } from "./internal/intercepts.js";
4
+ import { watchModules } from "./internal/watch.js";
5
+ import { Effect, FileSystem, Layer, Logger, Path } from "effect";
6
+ import { NodeServices } from "@effect/platform-node";
7
+ import { Graft, Plugin } from "@graftland/graft";
8
+ import * as Hmr from "@graftland/hmr";
9
+ import { Include, Loader, ModuleResolver } from "@graftland/loader";
10
+ // src/Start.ts
11
+ /**
12
+ * Runs a Graft application from its config file.
13
+ */
14
+ var Start_exports = /* @__PURE__ */ __exportAll({ run: () => run });
15
+ /**
16
+ * Loads the entries of the config file and runs until interrupted. Plugin
17
+ * modules are imported through the hot reloader, so bare specifiers resolve
18
+ * from the application directory whether or not `watch` is on.
19
+ */
20
+ const run = (options) => Effect.gen(function* () {
21
+ const path = yield* Path.Path;
22
+ const file = path.resolve(options.config);
23
+ const directory = path.dirname(file);
24
+ const base = yield* path.toFileUrl(file);
25
+ const hmr = yield* Hmr.make({ base: base.href });
26
+ const resolver = yield* ModuleResolver.make({
27
+ base: directory,
28
+ importer: hmr.importerScoped
29
+ });
30
+ yield* Graft.provide(ModuleResolver.ModuleResolver, resolver);
31
+ yield* (yield* Graft.plugin(Include.Include, {
32
+ path: file,
33
+ watch: options.watch
34
+ })).await;
35
+ if (options.watch) {
36
+ const { reload } = yield* EnvFile;
37
+ const envFile = options.envFile;
38
+ const reloader = Plugin.make({
39
+ name: "reloader",
40
+ inject: [
41
+ Loader.Loader,
42
+ FileSystem.FileSystem,
43
+ Path.Path
44
+ ],
45
+ apply: () => Effect.gen(function* () {
46
+ const loader = yield* Loader.Loader;
47
+ yield* watchModules(hmr, directory, loader.retry).pipe(Effect.forkScoped);
48
+ if (envFile !== void 0) yield* watchEnvFile(envFile, reload, loader.retry).pipe(Effect.forkScoped);
49
+ })
50
+ });
51
+ yield* Graft.plugin(reloader);
52
+ }
53
+ yield* Effect.logInfo(`Running ${path.relative(process.cwd(), file) || file}`);
54
+ return yield* Effect.never;
55
+ }).pipe(Effect.scoped, Effect.provide(Layer.provideMerge(Graft.layer, Layer.mergeAll(NodeServices.layer, layer$1, layer(options.envFile).pipe(Layer.provide(NodeServices.layer)), Logger.layer([Logger.consolePretty()])))));
56
+ export { Start_exports, run };
57
+
58
+ //# sourceMappingURL=Start.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Start.js","names":["intercepts","env"],"sources":["../src/Start.ts"],"sourcesContent":["/**\n * Runs a Graft application from its config file.\n */\nimport { NodeServices } from \"@effect/platform-node\"\nimport { Graft, Plugin } from \"@graftland/graft\"\nimport * as Hmr from \"@graftland/hmr\"\nimport { Include, Loader, ModuleResolver, type Tree } from \"@graftland/loader\"\nimport type { PlatformError, Schema } from \"effect\"\nimport { Effect, FileSystem, Layer, Logger, Path } from \"effect\"\nimport { EnvFile, layer as env, watchEnvFile } from \"./internal/env\"\nimport { layer as intercepts } from \"./internal/intercepts\"\nimport { watchModules } from \"./internal/watch\"\n\nexport interface Options {\n\t/** Path of the config file. */\n\treadonly config: string\n\t/** Reload plugin modules and the config file when they change. */\n\treadonly watch: boolean\n\t/**\n\t * A `.env` file that `!env` reads when the process environment does not set\n\t * a variable. With `watch`, changes to it are read again.\n\t */\n\treadonly envFile?: string | undefined\n}\n\n/**\n * Loads the entries of the config file and runs until interrupted. Plugin\n * modules are imported through the hot reloader, so bare specifiers resolve\n * from the application directory whether or not `watch` is on.\n */\nexport const run = (\n\toptions: Options,\n): Effect.Effect<\n\tnever,\n\t| Graft.ServiceConflict\n\t| PlatformError.BadArgument\n\t| PlatformError.PlatformError\n\t| Schema.SchemaError\n\t| Loader.StoreError\n\t| Tree.InvalidOperation\n> =>\n\tEffect.gen(function* () {\n\t\tconst path = yield* Path.Path\n\t\tconst file = path.resolve(options.config)\n\t\tconst directory = path.dirname(file)\n\t\tconst base = yield* path.toFileUrl(file)\n\t\tconst hmr = yield* Hmr.make({ base: base.href })\n\t\tconst resolver = yield* ModuleResolver.make({\n\t\t\tbase: directory,\n\t\t\timporter: hmr.importerScoped,\n\t\t})\n\t\tyield* Graft.provide(ModuleResolver.ModuleResolver, resolver)\n\t\tconst included = yield* Graft.plugin(Include.Include, {\n\t\t\tpath: file,\n\t\t\twatch: options.watch,\n\t\t})\n\t\tyield* included.await\n\t\tif (options.watch) {\n\t\t\tconst { reload } = yield* EnvFile\n\t\t\tconst envFile = options.envFile\n\t\t\tconst reloader = Plugin.make({\n\t\t\t\tname: \"reloader\",\n\t\t\t\tinject: [Loader.Loader, FileSystem.FileSystem, Path.Path],\n\t\t\t\tapply: () =>\n\t\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\t\tconst loader = yield* Loader.Loader\n\t\t\t\t\t\tyield* watchModules(hmr, directory, loader.retry).pipe(\n\t\t\t\t\t\t\tEffect.forkScoped,\n\t\t\t\t\t\t)\n\t\t\t\t\t\tif (envFile !== undefined)\n\t\t\t\t\t\t\tyield* watchEnvFile(envFile, reload, loader.retry).pipe(\n\t\t\t\t\t\t\t\tEffect.forkScoped,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t}),\n\t\t\t})\n\t\t\tyield* Graft.plugin(reloader)\n\t\t}\n\n\t\tyield* Effect.logInfo(\n\t\t\t`Running ${path.relative(process.cwd(), file) || file}`,\n\t\t)\n\t\treturn yield* Effect.never\n\t}).pipe(\n\t\tEffect.scoped,\n\t\t// @effect-diagnostics-next-line strictEffectProvide:off -- this runs the whole application, so it is an entry point\n\t\tEffect.provide(\n\t\t\tLayer.provideMerge(\n\t\t\t\tGraft.layer,\n\t\t\t\tLayer.mergeAll(\n\t\t\t\t\tNodeServices.layer,\n\t\t\t\t\tintercepts,\n\t\t\t\t\tenv(options.envFile).pipe(Layer.prov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,aACL,MAAM,OACN,MAAM,SACL,aAAa,OACbA,SACAC,MAAI,QAAQ,OAAO,CAAC,CAAC,KAAK,MAAM,QAAQ,aAAa,KAAK,CAAC,GAC3D,OAAO,MAAM,CAAC,OAAO,cAAc,CAAC,CAAC,CACtC,CACD,CACD,CACD"}
@@ -0,0 +1,12 @@
1
+ // \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __exportAll = (all, no_symbols) => {
4
+ let target = {};
5
+ for (var name in all) __defProp(target, name, {
6
+ get: all[name],
7
+ enumerable: true
8
+ });
9
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
10
+ return target;
11
+ };
12
+ export { __exportAll };
package/dist/bin.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {}
package/dist/bin.js ADDED
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env node
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
+ import { Effect, Option } from "effect";
6
+ import { NodeRuntime, NodeServices } from "@effect/platform-node";
7
+ import { Argument, Command, Flag } from "effect/cli";
8
+ // src/bin.ts
9
+ /**
10
+ * The `graft` executable. Running this module starts the program.
11
+ */
12
+ const start = Command.make("start", {
13
+ config: Argument.String("config").pipe(Argument.withDescription("Path of the config file"), Argument.withDefault("graft.yml")),
14
+ watch: Flag.Boolean("watch").pipe(Flag.withAlias("w"), Flag.withDescription("Reload plugins and config when files change"), Flag.withDefault(false)),
15
+ 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({
17
+ ...options,
18
+ envFile: Option.getOrUndefined(options.envFile)
19
+ })).pipe(Command.withDescription("Run the application described by a config file"));
20
+ const create = Command.make("create", {
21
+ directory: Argument.String("directory").pipe(Argument.withDescription("Where to create the project")),
22
+ name: Flag.String("name").pipe(Flag.withDescription("Package name; defaults to the directory name"), Flag.optional),
23
+ 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"));
27
+ const graft = Command.make("graft").pipe(Command.withDescription("Run and manage Graft applications"), Command.withSubcommands([
28
+ start,
29
+ create,
30
+ add,
31
+ remove
32
+ ]));
33
+ Command.run(graft, { version }).pipe(Effect.provide(NodeServices.layer), NodeRuntime.runMain);
34
+ export {};
35
+
36
+ //# sourceMappingURL=bin.js.map
@@ -0,0 +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,CACv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+ import { Start_d_exports } from "./Start.js";
3
+ export { Manage_d_exports as Manage, Start_d_exports as Start };
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ import { Manage_exports } from "./Manage.js";
2
+ import { Start_exports } from "./Start.js";
3
+ export { Manage_exports as Manage, Start_exports as Start };
@@ -0,0 +1,7 @@
1
+ import { JsonSchema } from "effect";
2
+ /** Draft-07, which YAML language servers support most widely. */
3
+ export declare const make: () => {
4
+ $schema: string;
5
+ definitions: JsonSchema.Definitions;
6
+ };
7
+ //# sourceMappingURL=configSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configSchema.d.ts","names":[],"sources":["../../src/internal/configSchema.ts"],"mappings":";;qBA0Ea"}
@@ -0,0 +1,44 @@
1
+ import { registrations } from "./intercepts.js";
2
+ import { Array, JsonSchema, Record, Schema } from "effect";
3
+ import { Entry } from "@graftland/loader";
4
+ // src/internal/configSchema.ts
5
+ /**
6
+ * The JSON Schema of the config file that graft start reads, derived from the
7
+ * loader's entry fields and the intercepts the CLI registers. The build writes
8
+ * it to the package's schema.json, so each release ships its own version.
9
+ */
10
+ const fields = Entry.Entry.schema.fields;
11
+ const Intercept$1 = Schema.Struct(Record.fromEntries(Array.map(registrations, ({ key, schema }) => [key, Schema.optionalKey(schema)]))).annotate({
12
+ identifier: "Intercept",
13
+ description: "Patches for references, applying to this entry and its descendants."
14
+ });
15
+ const Metadata = [Schema.Record(Schema.String, Schema.Unknown)];
16
+ const shared = {
17
+ ...fields,
18
+ id: Schema.optionalKey(fields.id.annotate({ description: "Identifies the entry. Graft adds one, and writes it to the file, if an entry has none." })),
19
+ intercept: Schema.optionalKey(Intercept$1)
20
+ };
21
+ const FileEntry = Schema.Union([Schema.StructWithRest(Schema.Struct({
22
+ ...shared,
23
+ group: Schema.Literal(true).annotate({ description: "true makes the entry a group of other entries." }),
24
+ config: Schema.optionalKey(Schema.Array(Schema.suspend(() => FileEntry)).annotate({ description: "The entries of this group." }))
25
+ }), Metadata), Schema.StructWithRest(Schema.Struct({
26
+ ...shared,
27
+ group: Schema.optionalKey(Schema.Literal(false).annotate({ description: "true makes the entry a group of other entries." }))
28
+ }), Metadata)]).annotate({ identifier: "Entry" });
29
+ const File = Schema.NullOr(Schema.Array(FileEntry)).annotate({
30
+ title: "Graft config file",
31
+ description: "The entries that graft start loads. Each entry loads one plugin, or groups other entries."
32
+ });
33
+ /** Draft-07, which YAML language servers support most widely. */
34
+ const make = () => {
35
+ const document = JsonSchema.toDocumentDraft07(Schema.toJsonSchemaDocument(File, { onExcessProperty: "error" }));
36
+ return {
37
+ $schema: JsonSchema.META_SCHEMA_URI_DRAFT_07,
38
+ ...document.schema,
39
+ definitions: document.definitions
40
+ };
41
+ };
42
+ export { make };
43
+
44
+ //# sourceMappingURL=configSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configSchema.js","names":["Intercept"],"sources":["../../src/internal/configSchema.ts"],"sourcesContent":["/**\n * The JSON Schema of the config file that graft start reads, derived from the\n * loader's entry fields and the intercepts the CLI registers. The build writes\n * it to the package's schema.json, so each release ships its own version.\n */\nimport { Entry } from \"@graftland/loader\"\nimport { Array, JsonSchema, Record, Schema } from \"effect\"\nimport { registrations } from \"./intercepts\"\n\nconst fields = Entry.Entry.schema.fields\n\nconst Intercept = Schema.Struct(\n\tRecord.fromEntries(\n\t\tArray.map(\n\t\t\tregistrations,\n\t\t\t({ key, schema }) => [key, Schema.optionalKey(schema)] as const,\n\t\t),\n\t),\n).annotate({\n\tidentifier: \"Intercept\",\n\tdescription:\n\t\t\"Patches for references, applying to this entry and its descendants.\",\n})\n\nconst Metadata = [Schema.Record(Schema.String, Schema.Unknown)] as const\n\nconst shared = {\n\t...fields,\n\tid: Schema.optionalKey(\n\t\tfields.id.annotate({\n\t\t\tdescription:\n\t\t\t\t\"Identifies the entry. Graft adds one, and writes it to the file, if an entry has none.\",\n\t\t}),\n\t),\n\tintercept: Schema.optionalKey(Intercept),\n}\n\n// Two shapes instead of one, so that only a group's config is checked as a\n// list of entries; a plugin's config is checked by the plugin's own Schema.\nconst FileEntry: Schema.Top = Schema.Union([\n\tSchema.StructWithRest(\n\t\tSchema.Struct({\n\t\t\t...shared,\n\t\t\tgroup: Schema.Literal(true).annotate({\n\t\t\t\tdescription: \"true makes the entry a group of other entries.\",\n\t\t\t}),\n\t\t\tconfig: Schema.optionalKey(\n\t\t\t\tSchema.Array(Schema.suspend(() => FileEntry)).annotate({\n\t\t\t\t\tdescription: \"The entries of this group.\",\n\t\t\t\t}),\n\t\t\t),\n\t\t}),\n\t\tMetadata,\n\t),\n\tSchema.StructWithRest(\n\t\tSchema.Struct({\n\t\t\t...shared,\n\t\t\tgroup: Schema.optionalKey(\n\t\t\t\tSchema.Literal(false).annotate({\n\t\t\t\t\tdescription: \"true makes the entry a group of other entries.\",\n\t\t\t\t}),\n\t\t\t),\n\t\t}),\n\t\tMetadata,\n\t),\n]).annotate({ identifier: \"Entry\" })\n\nconst File = Schema.NullOr(Schema.Array(FileEntry)).annotate({\n\ttitle: \"Graft config file\",\n\tdescription:\n\t\t\"The entries that graft start loads. Each entry loads one plugin, or groups other entries.\",\n})\n\n/** Draft-07, which YAML language servers support most widely. */\nexport const make = () => {\n\tconst document = JsonSchema.toDocumentDraft07(\n\t\t// Only the intercept struct is closed: entries keep a rest record for metadata.\n\t\tSchema.toJsonSchemaDocument(File, { onExcessProperty: \"error\" }),\n\t)\n\treturn {\n\t\t$schema: JsonSchema.META_SCHEMA_URI_DRAFT_07,\n\t\t...document.schema,\n\t\tdefinitions: document.definitions,\n\t}\n}\n"],"mappings":";;;;;;;;;AASA,MAAM,SAAS,MAAM,MAAM,OAAO;AAElC,MAAMA,cAAY,OAAO,OACxB,OAAO,YACN,MAAM,IACL,gBACC,EAAE,KAAK,aAAa,CAAC,KAAK,OAAO,YAAY,MAAM,CAAC,CACtD,CACD,CACD,CAAC,CAAC,SAAS;CACV,YAAY;CACZ,aACC;AACF,CAAC;AAED,MAAM,WAAW,CAAC,OAAO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