@systemfsoftware/alchemy-stack-layer 0.0.0-stage → 0.1.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/CHANGELOG.md +7 -0
- package/LICENSE +203 -0
- package/README.md +151 -2
- package/dist/index.d.ts +81 -0
- package/dist/index.mjs +177 -0
- package/package.json +78 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# @systemfsoftware/alchemy-stack-layer
|
|
2
|
+
|
|
3
|
+
# @systemfsoftware/alchemy-stack-layer@0.1.0
|
|
4
|
+
|
|
5
|
+
Rewrites the README: install with every peer dependency (adds `@effect/platform-node`), a quick start, a table of where to pass the layer and how often it deploys, how dev and cloud resolve, how stages are named, and the errors each failure raises.
|
|
6
|
+
|
|
7
|
+
New package. `alchemyStack(name, config)` returns a service tag, distinct for each stack name, whose service is the stack's outputs, with a `layer` that deploys the stack on `@alchemy.run/test`'s engine when acquired and destroys it when released. `config.deploy` takes a stack definition carrying its own `providers` and `state`, or a function that receives `deploy` and returns the outputs, with an optional `setup` layer for what that function needs; stacks are destroyed in reverse deploy order, and each is registered for destroy before its deploy starts. Dev mode and sidecar resolve as `@alchemy.run/test` resolves them; `dev`, `stage`, `sidecar` and `profile` are forwarded unchanged. Without a configured `stage`, the stage starts from a non-empty `ALCHEMY_TEST_STAGE`, otherwise from `test_$USER_<worktree>` when the working directory is inside a linked git worktree, as `@alchemy.run/test`'s runner names it, so two worktrees of one checkout never share a stage, and otherwise from `test_$USER`; it then gets `_` and 8 hex digits of the SHA-256 of the running test file's Vitest project name, root directory name and path from the root; `fileStage({ baseStage, testFile })` is exported to compute that stage outside a test. Before deploying, the layer destroys any deployment left at the stage; if that fails, acquiring fails with `StackDestroyFailed` and nothing new is deployed. A cloud deploy over local or in-memory state fails with `DurableStateRequired` before it deploys; a failed deploy fails with `StackDeployFailed` and a failed destroy with `StackDestroyFailed`, each naming the stack and the stage; a stack with no configured stage built outside a running test file, or whose `ALCHEMY_TEST_STAGE` cannot be read, fails with `StageUnresolved`. `alchemy`, `effect` and `@effect/platform-node` are peer dependencies.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
Copyright (c) 2026 Ryan Lee (systemfsoftware)
|
|
2
|
+
|
|
3
|
+
Apache License
|
|
4
|
+
Version 2.0, January 2004
|
|
5
|
+
http://www.apache.org/licenses/
|
|
6
|
+
|
|
7
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
8
|
+
|
|
9
|
+
1. Definitions.
|
|
10
|
+
|
|
11
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
12
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
13
|
+
|
|
14
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
15
|
+
the copyright owner that is granting the License.
|
|
16
|
+
|
|
17
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
18
|
+
other entities that control, are controlled by, or are under common
|
|
19
|
+
control with that entity. For the purposes of this definition,
|
|
20
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
21
|
+
direction or management of such entity, whether by contract or
|
|
22
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
23
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
24
|
+
|
|
25
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
26
|
+
exercising permissions granted by this License.
|
|
27
|
+
|
|
28
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
29
|
+
including but not limited to software source code, documentation
|
|
30
|
+
source, and configuration files.
|
|
31
|
+
|
|
32
|
+
"Object" form shall mean any form resulting from mechanical
|
|
33
|
+
transformation or translation of a Source form, including but
|
|
34
|
+
not limited to compiled object code, generated documentation,
|
|
35
|
+
and conversions to other media types.
|
|
36
|
+
|
|
37
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
38
|
+
Object form, made available under the License, as indicated by a
|
|
39
|
+
copyright notice that is included in or attached to the work
|
|
40
|
+
(an example is provided in the Appendix below).
|
|
41
|
+
|
|
42
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
43
|
+
form, that is based on (or derived from) the Work and for which the
|
|
44
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
45
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
46
|
+
of this License, Derivative Works shall not include works that remain
|
|
47
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
48
|
+
the Work and Derivative Works thereof.
|
|
49
|
+
|
|
50
|
+
"Contribution" shall mean any work of authorship, including
|
|
51
|
+
the original version of the Work and any modifications or additions
|
|
52
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
53
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
54
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
55
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
56
|
+
means any form of electronic, verbal, or written communication sent
|
|
57
|
+
to the Licensor or its representatives, including but not limited to
|
|
58
|
+
communication on electronic mailing lists, source code control systems,
|
|
59
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
60
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
61
|
+
excluding communication that is conspicuously marked or otherwise
|
|
62
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
63
|
+
|
|
64
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
65
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
66
|
+
subsequently incorporated within the Work.
|
|
67
|
+
|
|
68
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
69
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
70
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
71
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
72
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
73
|
+
Work and such Derivative Works in Source or Object form.
|
|
74
|
+
|
|
75
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
76
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
77
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
78
|
+
(except as stated in this section) patent license to make, have made,
|
|
79
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
80
|
+
where such license applies only to those patent claims licensable
|
|
81
|
+
by such Contributor that are necessarily infringed by their
|
|
82
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
83
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
84
|
+
institute patent litigation against any entity (including a
|
|
85
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
86
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
87
|
+
or contributory patent infringement, then any patent licenses
|
|
88
|
+
granted to You under this License for that Work shall terminate
|
|
89
|
+
as of the date such litigation is filed.
|
|
90
|
+
|
|
91
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
92
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
93
|
+
modifications, and in Source or Object form, provided that You
|
|
94
|
+
meet the following conditions:
|
|
95
|
+
|
|
96
|
+
(a) You must give any other recipients of the Work or
|
|
97
|
+
Derivative Works a copy of this License; and
|
|
98
|
+
|
|
99
|
+
(b) You must cause any modified files to carry prominent notices
|
|
100
|
+
stating that You changed the files; and
|
|
101
|
+
|
|
102
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
103
|
+
that You distribute, all copyright, patent, trademark, and
|
|
104
|
+
attribution notices from the Source form of the Work,
|
|
105
|
+
excluding those notices that do not pertain to any part of
|
|
106
|
+
the Derivative Works; and
|
|
107
|
+
|
|
108
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
109
|
+
distribution, then any Derivative Works that You distribute must
|
|
110
|
+
include a readable copy of the attribution notices contained
|
|
111
|
+
within such NOTICE file, excluding those notices that do not
|
|
112
|
+
pertain to any part of the Derivative Works, in at least one
|
|
113
|
+
of the following places: within a NOTICE text file distributed
|
|
114
|
+
as part of the Derivative Works; within the Source form or
|
|
115
|
+
documentation, if provided along with the Derivative Works; or,
|
|
116
|
+
within a display generated by the Derivative Works, if and
|
|
117
|
+
wherever such third-party notices normally appear. The contents
|
|
118
|
+
of the NOTICE file are for informational purposes only and
|
|
119
|
+
do not modify the License. You may add Your own attribution
|
|
120
|
+
notices within Derivative Works that You distribute, alongside
|
|
121
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
122
|
+
that such additional attribution notices cannot be construed
|
|
123
|
+
as modifying the License.
|
|
124
|
+
|
|
125
|
+
You may add Your own copyright statement to Your modifications and
|
|
126
|
+
may provide additional or different license terms and conditions
|
|
127
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
128
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
129
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
130
|
+
the conditions stated in this License.
|
|
131
|
+
|
|
132
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
133
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
134
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
135
|
+
this License, without any additional terms or conditions.
|
|
136
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
137
|
+
the terms of any separate license agreement you may have executed
|
|
138
|
+
with Licensor regarding such Contributions.
|
|
139
|
+
|
|
140
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
141
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
142
|
+
except as required for reasonable and customary use in describing the
|
|
143
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
144
|
+
|
|
145
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
146
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
147
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
148
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
149
|
+
implied, including, without limitation, any warranties or conditions
|
|
150
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
151
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
152
|
+
appropriateness of using or redistributing the Work and assume any
|
|
153
|
+
risks associated with Your exercise of permissions under this License.
|
|
154
|
+
|
|
155
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
156
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
157
|
+
unless required by applicable law (such as deliberate and grossly
|
|
158
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
159
|
+
liable to You for damages, including any direct, indirect, special,
|
|
160
|
+
incidental, or consequential damages of any character arising as a
|
|
161
|
+
result of this License or out of the use or inability to use the
|
|
162
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
163
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
164
|
+
other commercial damages or losses), even if such Contributor
|
|
165
|
+
has been advised of the possibility of such damages.
|
|
166
|
+
|
|
167
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
168
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
169
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
170
|
+
or other liability obligations and/or rights consistent with this
|
|
171
|
+
License. However, in accepting such obligations, You may act only
|
|
172
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
173
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
174
|
+
defend, and hold each Contributor harmless for any liability
|
|
175
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
176
|
+
of your accepting any such warranty or additional liability.
|
|
177
|
+
|
|
178
|
+
END OF TERMS AND CONDITIONS
|
|
179
|
+
|
|
180
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
181
|
+
|
|
182
|
+
To apply the Apache License to your work, attach the following
|
|
183
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
184
|
+
replaced with your own identifying information. (Don't include
|
|
185
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
186
|
+
comment syntax for the file format. We also recommend that a
|
|
187
|
+
file or class name and description of purpose be included on the
|
|
188
|
+
same "printed page" as the copyright notice for easier
|
|
189
|
+
identification within third-party archives.
|
|
190
|
+
|
|
191
|
+
Copyright 2026 Ryan Lee (systemfsoftware)
|
|
192
|
+
|
|
193
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
194
|
+
you may not use this file except in compliance with the License.
|
|
195
|
+
You may obtain a copy of the License at
|
|
196
|
+
|
|
197
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
198
|
+
|
|
199
|
+
Unless required by applicable law or agreed to in writing, software
|
|
200
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
201
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
202
|
+
See the License for the specific language governing permissions and
|
|
203
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,152 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @systemfsoftware/alchemy-stack-layer
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Integration tests against a deployed [Alchemy](https://alchemy.run) stack, written as plain [Effect](https://effect.website) layers. You declare the stack; the layer deploys it before your scenarios run and destroys it when they finish. The same test file runs against the local Workers runtime or a real Cloudflare account, chosen by Alchemy's own `ALCHEMY_TEST_DEV` toggle.
|
|
4
|
+
|
|
5
|
+
It is built for Gherkin Features written with [`@systemfsoftware/effect-gherkin-spec`](https://www.npmjs.com/package/@systemfsoftware/effect-gherkin-spec), but the layer is an ordinary `Layer`, so anything that accepts one can use it.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm add -D @systemfsoftware/alchemy-stack-layer alchemy effect @effect/platform-node
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
> [!NOTE]
|
|
14
|
+
> `alchemy`, `effect` and `@effect/platform-node` are peer dependencies, so the versions are yours. `@alchemy.run/test` comes with the package.
|
|
15
|
+
|
|
16
|
+
## Quick start
|
|
17
|
+
|
|
18
|
+
Name the stack, hand its layer to a Feature, and read its outputs in a step through the tag:
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { alchemyStack } from '@systemfsoftware/alchemy-stack-layer'
|
|
22
|
+
import { Gherkin, Given, it, makeFeature, sharedLayer, Then } from '@systemfsoftware/effect-gherkin-spec'
|
|
23
|
+
import SignInStack from '../alchemy.run.ts'
|
|
24
|
+
|
|
25
|
+
const Feature = makeFeature({ it })
|
|
26
|
+
|
|
27
|
+
const SignIn = alchemyStack('SignIn', { deploy: SignInStack })
|
|
28
|
+
|
|
29
|
+
const Shared = sharedLayer(SignIn.layer)
|
|
30
|
+
|
|
31
|
+
Feature('signing in').withLayer(Shared).body(({ scenario }) => {
|
|
32
|
+
scenario(
|
|
33
|
+
'the deployed worker has a URL',
|
|
34
|
+
Gherkin.Do.pipe(
|
|
35
|
+
Given('the sign-in stack')('stack', () => SignIn),
|
|
36
|
+
Then('it serves over HTTPS')((s, expect) => expect(s.stack.url.startsWith('https://')).toBe(true)),
|
|
37
|
+
),
|
|
38
|
+
)
|
|
39
|
+
})
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
There is no service class to declare, no output mapping, no `beforeAll` and no timeout. The tag's service is the stack's outputs, typed from the stack definition, and the tag is distinct for each stack name, so two stacks never collide in one layer graph.
|
|
43
|
+
|
|
44
|
+
## Sharing one deployment
|
|
45
|
+
|
|
46
|
+
Where you pass the layer decides how often the stack deploys:
|
|
47
|
+
|
|
48
|
+
| Passed as | Deploys |
|
|
49
|
+
| -------------------------------------- | ------------------------------------------------------ |
|
|
50
|
+
| `.withLayer(sharedLayer(Stack.layer))` | once per test file, shared by every Feature in it |
|
|
51
|
+
| `.withLayer(Stack.layer)` | once per Feature |
|
|
52
|
+
| `.withScenarioLayer(Stack.layer)` | once per scenario, which is almost never what you want |
|
|
53
|
+
|
|
54
|
+
A shared layer is built in the file's setup, before the first scenario starts, with no time limit. A deploy that takes minutes against Cloudflare therefore needs no `.live` and no raised timeout. Scenarios that share a deployment should not depend on each other's writes to it.
|
|
55
|
+
|
|
56
|
+
`.withLayer` chains, and a later layer may use what an earlier one provides. A client built over the stack's URL is one more layer:
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
Feature('signing in')
|
|
60
|
+
.withLayer(Shared)
|
|
61
|
+
.withLayer(SignInClient.layer) // requires SignIn; a missing requirement is a compile error
|
|
62
|
+
.body() /* ... */
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Deploying several stacks
|
|
66
|
+
|
|
67
|
+
`deploy` also takes a function. It receives a `deploy` you call once per stack, and returns whatever outputs your steps should see. Give it a `setup` layer when it needs something first, such as a database the worker connects to:
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
const Billing = alchemyStack('Billing', {
|
|
71
|
+
setup: PaymentsSandbox.layer,
|
|
72
|
+
deploy: (deploy) =>
|
|
73
|
+
Effect.gen(function*() {
|
|
74
|
+
const sandbox = yield* PaymentsSandbox
|
|
75
|
+
const api = yield* deploy(BillingApiStack)
|
|
76
|
+
const worker = yield* deploy(BillingWorkerStack)
|
|
77
|
+
return { api: api.url, worker: worker.url, sandbox: sandbox.id }
|
|
78
|
+
}),
|
|
79
|
+
})
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
`Billing.layer` then requires nothing further. Stacks are destroyed in reverse deploy order. Each stack is registered for destroy before its deploy starts, so a deploy that fails halfway still has what it created torn down.
|
|
83
|
+
|
|
84
|
+
## Local or cloud
|
|
85
|
+
|
|
86
|
+
The package adds no switch of its own. Dev mode resolves exactly as `@alchemy.run/test` resolves it, from one code path:
|
|
87
|
+
|
|
88
|
+
1. `ALCHEMY_TEST_DEV`, if set;
|
|
89
|
+
2. else the config's `dev`;
|
|
90
|
+
3. else `ALCHEMY_DEV`.
|
|
91
|
+
|
|
92
|
+
In dev mode the layer starts Alchemy's sidecar and deploys to the local Workers runtime. With `ALCHEMY_TEST_DEV=0` the same file deploys to Cloudflare:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
ALCHEMY_TEST_DEV=0 ALCHEMY_TEST_STAGE=ci_main pnpm vitest run
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
`ALCHEMY_TEST_DEV` is read once per process, so set it in the environment, not inside a test.
|
|
99
|
+
|
|
100
|
+
A cloud run needs durable state. A stack whose definition records state locally or in memory fails before it deploys, with `DurableStateRequired`, because a deployment recorded on one machine cannot be found or destroyed from another.
|
|
101
|
+
|
|
102
|
+
The config's `dev`, `stage`, `sidecar` and `profile` are passed to Alchemy unchanged.
|
|
103
|
+
|
|
104
|
+
## Stages
|
|
105
|
+
|
|
106
|
+
Every deployment lives under a stage. A `stage` in the config is used exactly as given. Without one, the stage is built from two parts.
|
|
107
|
+
|
|
108
|
+
The base is the first of:
|
|
109
|
+
|
|
110
|
+
- a non-empty `ALCHEMY_TEST_STAGE`;
|
|
111
|
+
- `test_<user>_<worktree>` inside a linked git worktree, so two worktrees running the same file at once never share a deployment;
|
|
112
|
+
- `test_<user>`.
|
|
113
|
+
|
|
114
|
+
The suffix is `_` plus 8 hex digits of a SHA-256 over the test file's Vitest project name, root directory name and path from the root. Two files that deploy the same stack get different stages. One file keeps the same stage across runs, machines and checkouts, which is what lets the next run find what a killed run left behind.
|
|
115
|
+
|
|
116
|
+
`fileStage({ baseStage, testFile })` computes that stage outside a test, for a CI job that checks a stage is empty after a run. It needs a `Digest` service such as `Digest.layerWebCrypto` from `effect/crypto/Digest`.
|
|
117
|
+
|
|
118
|
+
## Teardown and errors
|
|
119
|
+
|
|
120
|
+
Teardown runs when the layer is released, on success, failure and interruption. It has no opt-out.
|
|
121
|
+
|
|
122
|
+
Before deploying, the layer destroys any deployment already recorded at its stage. A run killed before its teardown is cleaned up by the next run at that stage. In CI, give each branch or job slot a stage that repeats, and run one job at a time per stage.
|
|
123
|
+
|
|
124
|
+
Every failure is a tagged error that names the stack and the stage:
|
|
125
|
+
|
|
126
|
+
| Error | When |
|
|
127
|
+
| ---------------------- | --------------------------------------------------------------------------------------------------- |
|
|
128
|
+
| `StackDeployFailed` | a deploy failed; whatever it created has been destroyed |
|
|
129
|
+
| `StackDestroyFailed` | a destroy failed, including the cleanup of a leftover deployment; the run fails, nothing is retried |
|
|
130
|
+
| `DurableStateRequired` | a cloud run was given local or in-memory state; nothing was deployed or destroyed |
|
|
131
|
+
| `StageUnresolved` | a stack with no configured stage was built outside a running test file |
|
|
132
|
+
|
|
133
|
+
## API
|
|
134
|
+
|
|
135
|
+
| Export | What it is |
|
|
136
|
+
| ------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------- |
|
|
137
|
+
| `alchemyStack(name, config)` | returns a tag for the stack's outputs, with `.layer` to deploy and destroy it |
|
|
138
|
+
| `config.deploy` | a stack definition, or a function `(deploy) => Effect` returning the outputs |
|
|
139
|
+
| `config.setup` | an optional layer providing what a `deploy` function needs |
|
|
140
|
+
| `config.dev`, `stage`, `sidecar`, `profile` | passed to Alchemy's test engine unchanged |
|
|
141
|
+
| `fileStage({ baseStage, testFile })` | the stage a test file deploys under |
|
|
142
|
+
| `StackDeployFailed`, `StackDestroyFailed`, `DurableStateRequired`, `StageUnresolved` | the error classes above |
|
|
143
|
+
|
|
144
|
+
`sharedLayer` comes from `@systemfsoftware/effect-gherkin-spec` (and `@systemfsoftware/effect-spec-runtime`).
|
|
145
|
+
|
|
146
|
+
## Support
|
|
147
|
+
|
|
148
|
+
Report bugs and ask questions in the [issue tracker](https://github.com/systemfsoftware/systemfsoftware/issues).
|
|
149
|
+
|
|
150
|
+
## License
|
|
151
|
+
|
|
152
|
+
[Apache-2.0](https://github.com/systemfsoftware/systemfsoftware/blob/main/packages/alchemy-stack-layer/LICENSE)
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import * as Core from "@alchemy.run/test/Core";
|
|
2
|
+
import { TestFileInfo } from "@systemfsoftware/effect-spec-runtime";
|
|
3
|
+
import { Context, Effect, Layer, Scope } from "effect";
|
|
4
|
+
import * as Digest from "effect/crypto/Digest";
|
|
5
|
+
import * as Schema from "effect/Schema";
|
|
6
|
+
import { CompiledStack, StackDefinition } from "alchemy/Stack";
|
|
7
|
+
import { Input } from "alchemy/Input";
|
|
8
|
+
import { ConfigError } from "effect/Config";
|
|
9
|
+
declare const StackDeployFailed_base: Schema.Class<StackDeployFailed, Schema.TaggedStruct<"StackDeployFailed", {
|
|
10
|
+
readonly stack: Schema.String;
|
|
11
|
+
readonly stage: Schema.String;
|
|
12
|
+
readonly reason: Schema.String;
|
|
13
|
+
}>, import("effect/Cause").YieldableError & {
|
|
14
|
+
readonly brand: unique symbol;
|
|
15
|
+
}>;
|
|
16
|
+
export declare class StackDeployFailed extends StackDeployFailed_base {
|
|
17
|
+
get message(): string;
|
|
18
|
+
}
|
|
19
|
+
declare const StackDestroyFailed_base: Schema.Class<StackDestroyFailed, Schema.TaggedStruct<"StackDestroyFailed", {
|
|
20
|
+
readonly stack: Schema.String;
|
|
21
|
+
readonly stage: Schema.String;
|
|
22
|
+
readonly reason: Schema.String;
|
|
23
|
+
}>, import("effect/Cause").YieldableError & {
|
|
24
|
+
readonly brand: unique symbol;
|
|
25
|
+
}>;
|
|
26
|
+
export declare class StackDestroyFailed extends StackDestroyFailed_base {
|
|
27
|
+
get message(): string;
|
|
28
|
+
}
|
|
29
|
+
declare const DurableStateRequired_base: Schema.Class<DurableStateRequired, Schema.TaggedStruct<"DurableStateRequired", {
|
|
30
|
+
readonly stack: Schema.String;
|
|
31
|
+
readonly stage: Schema.String;
|
|
32
|
+
readonly store: Schema.String;
|
|
33
|
+
}>, import("effect/Cause").YieldableError & {
|
|
34
|
+
readonly brand: unique symbol;
|
|
35
|
+
}>;
|
|
36
|
+
export declare class DurableStateRequired extends DurableStateRequired_base {
|
|
37
|
+
get message(): string;
|
|
38
|
+
}
|
|
39
|
+
declare const StageUnresolved_base: Schema.Class<StageUnresolved, Schema.TaggedStruct<"StageUnresolved", {
|
|
40
|
+
readonly stack: Schema.String;
|
|
41
|
+
}>, import("effect/Cause").YieldableError & {
|
|
42
|
+
readonly brand: unique symbol;
|
|
43
|
+
}>;
|
|
44
|
+
export declare class StageUnresolved extends StageUnresolved_base {
|
|
45
|
+
get message(): string;
|
|
46
|
+
}
|
|
47
|
+
type StackProgram<A> = Effect.Effect<CompiledStack<A>, ConfigError> & StackDefinition<never> & Required<Pick<StackDefinition<never>, 'providers' | 'state'>>;
|
|
48
|
+
type Deploy = <A>(stack: StackProgram<A>) => Effect.Effect<Input.Resolve<A>, StackDeployFailed | StackDestroyFailed | DurableStateRequired>;
|
|
49
|
+
type StackKey<Name extends string> = `@systemfsoftware/alchemy-stack-layer/${Name}`;
|
|
50
|
+
interface AlchemyStack<Name extends string, Outputs> extends Context.ServiceClass.Shape<StackKey<Name>, Outputs> {}
|
|
51
|
+
interface EngineConfig {
|
|
52
|
+
readonly dev?: boolean;
|
|
53
|
+
readonly stage?: string;
|
|
54
|
+
readonly sidecar?: boolean | Core.SidecarOptions;
|
|
55
|
+
readonly profile?: string;
|
|
56
|
+
}
|
|
57
|
+
type StackSetup<Outputs, E, R> = (deploy: Deploy) => Effect.Effect<Outputs, E, R>;
|
|
58
|
+
interface StandaloneConfig<A, Outputs, E> extends EngineConfig {
|
|
59
|
+
readonly deploy: StackProgram<A> | StackSetup<Outputs, E, Scope.Scope>;
|
|
60
|
+
readonly setup?: undefined;
|
|
61
|
+
}
|
|
62
|
+
interface SetupLayerConfig<Outputs, E, R, ESetup> extends EngineConfig {
|
|
63
|
+
readonly deploy: StackSetup<Outputs, E, R | Scope.Scope>;
|
|
64
|
+
readonly setup: Layer.Layer<R, ESetup>;
|
|
65
|
+
}
|
|
66
|
+
type StackLayerError = StackDeployFailed | StackDestroyFailed | DurableStateRequired | StageUnresolved;
|
|
67
|
+
interface AlchemyStackTag<Name extends string, Outputs, E> extends Context.ServiceClass<AlchemyStack<Name, Outputs>, StackKey<Name>, Outputs> {
|
|
68
|
+
readonly layer: Layer.Layer<AlchemyStack<Name, Outputs>, E>;
|
|
69
|
+
}
|
|
70
|
+
export declare const alchemyStack: {
|
|
71
|
+
<A = never, Outputs = never, E = never>(config: StandaloneConfig<A, Outputs, E>): <const Name extends string>(name: Name) => AlchemyStackTag<Name, Input.Resolve<A> | Outputs, StackLayerError | E>;
|
|
72
|
+
<Outputs, E, R, ESetup>(config: SetupLayerConfig<Outputs, E, R, ESetup>): <const Name extends string>(name: Name) => AlchemyStackTag<Name, Outputs, StackLayerError | E | ESetup>;
|
|
73
|
+
<const Name extends string, A = never, Outputs = never, E = never>(name: Name, config: StandaloneConfig<A, Outputs, E>): AlchemyStackTag<Name, Input.Resolve<A> | Outputs, StackLayerError | E>;
|
|
74
|
+
<const Name extends string, Outputs, E, R, ESetup>(name: Name, config: SetupLayerConfig<Outputs, E, R, ESetup>): AlchemyStackTag<Name, Outputs, StackLayerError | E | ESetup>;
|
|
75
|
+
};
|
|
76
|
+
interface FileStageInput {
|
|
77
|
+
readonly baseStage: string;
|
|
78
|
+
readonly testFile: TestFileInfo;
|
|
79
|
+
}
|
|
80
|
+
export declare const fileStage: (input: FileStageInput) => Effect.Effect<string, never, Digest.Digest>;
|
|
81
|
+
export type { AlchemyStack, AlchemyStackTag, Deploy, EngineConfig, FileStageInput, SetupLayerConfig, StackKey, StackLayerError, StackProgram, StackSetup, StandaloneConfig };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import * as Core from "@alchemy.run/test/Core";
|
|
2
|
+
import { worktreeStage } from "@alchemy.run/test/WorktreeStage";
|
|
3
|
+
import * as NodeFileSystem from "@effect/platform-node/NodeFileSystem";
|
|
4
|
+
import * as NodePath from "@effect/platform-node/NodePath";
|
|
5
|
+
import { TestFile } from "@systemfsoftware/effect-spec-runtime";
|
|
6
|
+
import { Cause, Config, Context, Effect, Exit, Layer, Option, Scope } from "effect";
|
|
7
|
+
import * as Digest from "effect/crypto/Digest";
|
|
8
|
+
import { dual } from "effect/Function";
|
|
9
|
+
import * as Schema from "effect/Schema";
|
|
10
|
+
import { evalStack } from "alchemy/EvalStack";
|
|
11
|
+
import { build } from "alchemy/Stack";
|
|
12
|
+
import * as State from "alchemy/State";
|
|
13
|
+
// src/StackErrors.schema.ts
|
|
14
|
+
var StackDeployFailed = class extends Schema.TaggedError()("StackDeployFailed", {
|
|
15
|
+
stack: Schema.String,
|
|
16
|
+
stage: Schema.String,
|
|
17
|
+
reason: Schema.String
|
|
18
|
+
}) {
|
|
19
|
+
get message() {
|
|
20
|
+
return `Deploying stack "${this.stack}" at stage "${this.stage}" failed: ${this.reason}`;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
var StackDestroyFailed = class extends Schema.TaggedError()("StackDestroyFailed", {
|
|
24
|
+
stack: Schema.String,
|
|
25
|
+
stage: Schema.String,
|
|
26
|
+
reason: Schema.String
|
|
27
|
+
}) {
|
|
28
|
+
get message() {
|
|
29
|
+
return `Destroying stack "${this.stack}" at stage "${this.stage}" failed: ${this.reason}`;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
var DurableStateRequired = class extends Schema.TaggedError()("DurableStateRequired", {
|
|
33
|
+
stack: Schema.String,
|
|
34
|
+
stage: Schema.String,
|
|
35
|
+
store: Schema.String
|
|
36
|
+
}) {
|
|
37
|
+
get message() {
|
|
38
|
+
return `Stack "${this.stack}" at stage "${this.stage}" deploys to the cloud, so durable state is required, but its state store is "${this.store}"`;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
var StageUnresolved = class extends Schema.TaggedError()("StageUnresolved", { stack: Schema.String }) {
|
|
42
|
+
get message() {
|
|
43
|
+
return `Stack "${this.stack}" has no stage: give its config a stage, or build its layer inside a test file`;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
// src/StackLifecycle.ts
|
|
47
|
+
const NON_DURABLE_STORES = Object.freeze(["local", "inmemory"]);
|
|
48
|
+
const engineEffect = Core.toEffect;
|
|
49
|
+
const inEngine = (call) => (effect) => Effect.catchCause(engineEffect(effect, call.engine.options, call.scope, call.engine.sidecar), (cause) => Effect.fail(call.onFailure(Cause.pretty(cause))));
|
|
50
|
+
const deployFailure = (engine, stack) => (reason) => new StackDeployFailed({
|
|
51
|
+
stack,
|
|
52
|
+
stage: engine.stage,
|
|
53
|
+
reason
|
|
54
|
+
});
|
|
55
|
+
const destroyFailure = (engine, stack) => (reason) => new StackDestroyFailed({
|
|
56
|
+
stack,
|
|
57
|
+
stage: engine.stage,
|
|
58
|
+
reason
|
|
59
|
+
});
|
|
60
|
+
const storeIdOf = (engine, stack) => {
|
|
61
|
+
const built = build({
|
|
62
|
+
name: stack.stackName,
|
|
63
|
+
state: stack.state,
|
|
64
|
+
providers: stack.providers
|
|
65
|
+
}).pipe(Effect.map((services) => ({ services })));
|
|
66
|
+
const call = {
|
|
67
|
+
engine,
|
|
68
|
+
scope: void 0,
|
|
69
|
+
onFailure: deployFailure(engine, stack.stackName)
|
|
70
|
+
};
|
|
71
|
+
return inEngine(call)(evalStack(built, ({ services }) => Effect.map(Context.get(services, State.State), (store) => store.id), {
|
|
72
|
+
stage: engine.stage,
|
|
73
|
+
dev: engine.dev
|
|
74
|
+
}));
|
|
75
|
+
};
|
|
76
|
+
const requireDurable = (engine, stack) => Effect.flatMap(storeIdOf(engine, stack), (store) => NON_DURABLE_STORES.includes(store) ? Effect.fail(new DurableStateRequired({
|
|
77
|
+
stack: stack.stackName,
|
|
78
|
+
stage: engine.stage,
|
|
79
|
+
store
|
|
80
|
+
})) : Effect.void);
|
|
81
|
+
const checkDurability = (engine, stack) => engine.dev ? Effect.void : requireDurable(engine, stack);
|
|
82
|
+
const destroyIn = (call, stack, child) => inEngine(call)(Core.destroy(call.engine.options, stack, {
|
|
83
|
+
stage: call.engine.stage,
|
|
84
|
+
scope: child
|
|
85
|
+
}));
|
|
86
|
+
const destroyThenClose = (destroy, child) => destroy.pipe(Effect.orDie, Effect.ensuring(Scope.close(child, Exit.void)));
|
|
87
|
+
const deployStack = (engine) => (stack) => Effect.gen(function* () {
|
|
88
|
+
yield* checkDurability(engine, stack);
|
|
89
|
+
const child = yield* Scope.fork(engine.scope, "sequential");
|
|
90
|
+
const destroy = destroyIn({
|
|
91
|
+
engine,
|
|
92
|
+
scope: child,
|
|
93
|
+
onFailure: destroyFailure(engine, stack.stackName)
|
|
94
|
+
}, stack, child);
|
|
95
|
+
yield* Scope.addFinalizer(engine.scope, destroyThenClose(destroy, child));
|
|
96
|
+
yield* destroy;
|
|
97
|
+
return yield* inEngine({
|
|
98
|
+
engine,
|
|
99
|
+
scope: child,
|
|
100
|
+
onFailure: deployFailure(engine, stack.stackName)
|
|
101
|
+
})(Core.deploy(engine.options, stack, {
|
|
102
|
+
stage: engine.stage,
|
|
103
|
+
scope: child
|
|
104
|
+
}));
|
|
105
|
+
});
|
|
106
|
+
const openSidecar = (scope) => (options) => Effect.suspend(() => {
|
|
107
|
+
const sidecar = Core.makeSidecarHandle(options);
|
|
108
|
+
if (sidecar === void 0) return Effect.succeed(sidecar);
|
|
109
|
+
return Scope.addFinalizer(scope, sidecar.close).pipe(Effect.as(sidecar));
|
|
110
|
+
});
|
|
111
|
+
// src/StageName.ts
|
|
112
|
+
const SUFFIX_LENGTH = 8;
|
|
113
|
+
const encoder = new TextEncoder();
|
|
114
|
+
const identityOf = (testFile) => [
|
|
115
|
+
testFile.projectName ?? "",
|
|
116
|
+
testFile.rootName,
|
|
117
|
+
testFile.name
|
|
118
|
+
].join("\0");
|
|
119
|
+
const fileSuffix = (testFile) => Digest.Digest.use((digest) => digest.digestHex(Digest.sha256, encoder.encode(identityOf(testFile)))).pipe(Effect.map((hex) => hex.slice(0, SUFFIX_LENGTH)));
|
|
120
|
+
const fileStage = (input) => Effect.map(fileSuffix(input.testFile), (suffix) => `${input.baseStage}_${suffix}`);
|
|
121
|
+
// src/AlchemyStack.ts
|
|
122
|
+
var StackOwnProviders = class extends Context.Service()("@systemfsoftware/alchemy-stack-layer/StackOwnProviders") {};
|
|
123
|
+
const stackOwnProviders = Layer.succeed(StackOwnProviders, true);
|
|
124
|
+
const configuredTestStage = Config.option(Config.String("ALCHEMY_TEST_STAGE"));
|
|
125
|
+
const worktreeOrUserStage = Effect.gen(function* () {
|
|
126
|
+
const cwd = yield* Effect.sync(() => process.cwd());
|
|
127
|
+
return (yield* worktreeStage(cwd)) ?? Core.resolveStage({});
|
|
128
|
+
}).pipe(Effect.provide(Layer.merge(NodeFileSystem.layer, NodePath.layer)));
|
|
129
|
+
const checkoutStage = (name) => Effect.flatMap(configuredTestStage, (configured) => Option.match(Option.filter(configured, (stage) => stage !== ""), {
|
|
130
|
+
onNone: () => worktreeOrUserStage,
|
|
131
|
+
onSome: Effect.succeed
|
|
132
|
+
})).pipe(Effect.mapError(() => new StageUnresolved({ stack: name })));
|
|
133
|
+
const stageOfRunningFile = (name) => Effect.flatMap(TestFile, (file) => Option.match(file, {
|
|
134
|
+
onNone: () => Effect.fail(new StageUnresolved({ stack: name })),
|
|
135
|
+
onSome: (testFile) => Effect.flatMap(checkoutStage(name), (baseStage) => fileStage({
|
|
136
|
+
baseStage,
|
|
137
|
+
testFile
|
|
138
|
+
}).pipe(Effect.provide(Digest.layerWebCrypto)))
|
|
139
|
+
}));
|
|
140
|
+
const resolveStage = (name, configured) => configured === void 0 ? stageOfRunningFile(name) : Effect.succeed(configured);
|
|
141
|
+
const engineOptionsOf = (config) => {
|
|
142
|
+
const { stage: _stage, ...engine } = config;
|
|
143
|
+
return engine;
|
|
144
|
+
};
|
|
145
|
+
const makeEngine = (name, config) => Effect.gen(function* () {
|
|
146
|
+
const scope = yield* Effect.scope;
|
|
147
|
+
const stage = yield* resolveStage(name, config.stage);
|
|
148
|
+
const options = {
|
|
149
|
+
...engineOptionsOf(config),
|
|
150
|
+
providers: stackOwnProviders,
|
|
151
|
+
stage
|
|
152
|
+
};
|
|
153
|
+
return {
|
|
154
|
+
options,
|
|
155
|
+
sidecar: yield* openSidecar(scope)(options),
|
|
156
|
+
stage,
|
|
157
|
+
dev: Core.resolveDev(config),
|
|
158
|
+
scope
|
|
159
|
+
};
|
|
160
|
+
});
|
|
161
|
+
const setupOf = (deploy) => {
|
|
162
|
+
if (typeof deploy === "function") return deploy;
|
|
163
|
+
return (run) => run(deploy);
|
|
164
|
+
};
|
|
165
|
+
const acquireOf = (name, config, setup) => Effect.flatMap(makeEngine(name, config), (engine) => setup(deployStack(engine)));
|
|
166
|
+
const keyOf = (name) => `@systemfsoftware/alchemy-stack-layer/${name}`;
|
|
167
|
+
const standaloneImpl = (name, config) => {
|
|
168
|
+
class Tag extends Context.Service()(keyOf(name)) {}
|
|
169
|
+
return Object.assign(Tag, { layer: Layer.effect(Tag, acquireOf(name, config, setupOf(config.deploy))) });
|
|
170
|
+
};
|
|
171
|
+
const withSetupImpl = (name, config) => {
|
|
172
|
+
class Tag extends Context.Service()(keyOf(name)) {}
|
|
173
|
+
return Object.assign(Tag, { layer: Layer.provide(Layer.effect(Tag, acquireOf(name, config, config.deploy)), config.setup) });
|
|
174
|
+
};
|
|
175
|
+
const alchemyStackImpl = (name, config) => config.setup === void 0 ? standaloneImpl(name, config) : withSetupImpl(name, config);
|
|
176
|
+
const alchemyStack = dual(2, alchemyStackImpl);
|
|
177
|
+
export { DurableStateRequired, StackDeployFailed, StackDestroyFailed, StageUnresolved, alchemyStack, fileStage };
|
package/package.json
CHANGED
|
@@ -1,6 +1,81 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@systemfsoftware/alchemy-stack-layer",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"license": "Apache-2.0",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"author": "Ryan Lee <drdgvhbh@gmail.com>",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/systemfsoftware/systemfsoftware.git",
|
|
9
|
+
"directory": "packages/alchemy-stack-layer"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/systemfsoftware/systemfsoftware/tree/main/packages/alchemy-stack-layer#readme",
|
|
12
|
+
"bugs": "https://github.com/systemfsoftware/systemfsoftware/issues",
|
|
13
|
+
"description": "An alchemy stack as a scoped Effect layer: deploys on acquire, destroys on release, and runs against the local Workers runtime or real Cloudflare by alchemy's own toggle.",
|
|
14
|
+
"keywords": [
|
|
15
|
+
"alchemy",
|
|
16
|
+
"cloudflare",
|
|
17
|
+
"effect",
|
|
18
|
+
"effect-ts",
|
|
19
|
+
"layer",
|
|
20
|
+
"integration-testing",
|
|
21
|
+
"gherkin",
|
|
22
|
+
"typescript"
|
|
23
|
+
],
|
|
24
|
+
"type": "module",
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"default": "./dist/index.mjs"
|
|
29
|
+
},
|
|
30
|
+
"./package.json": "./package.json"
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"dist"
|
|
34
|
+
],
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@alchemy.run/test": "2.0.0-beta.87",
|
|
37
|
+
"@systemfsoftware/effect-spec-runtime": "^1.4.0"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@alchemy.run/cloudflare": "2.0.0-beta.87",
|
|
41
|
+
"@effect/platform-node": "^4.1.4",
|
|
42
|
+
"@microsoft/api-extractor": "^7.60.1",
|
|
43
|
+
"@systemfsoftware/arethetypeswrong-cli": "^4.2.0",
|
|
44
|
+
"@systemfsoftware/effect-gherkin-spec": "^8.4.0",
|
|
45
|
+
"@systemfsoftware/oxlint-config-recommended": "^9.0.2",
|
|
46
|
+
"@systemfsoftware/tsconfig": "^2.1.0",
|
|
47
|
+
"@systemfsoftware/tsdown-config": "^0.2.0",
|
|
48
|
+
"@systemfsoftware/vitest": "^4.2.1",
|
|
49
|
+
"@systemfsoftware/vitest-config": "^0.1.4",
|
|
50
|
+
"@types/node": "^26.6.6",
|
|
51
|
+
"alchemy": "2.0.0-beta.87",
|
|
52
|
+
"effect": "^4.1.4",
|
|
53
|
+
"fast-check": "^4.10.2",
|
|
54
|
+
"oxlint": "~1.93.0",
|
|
55
|
+
"rimraf": "^6.1.4",
|
|
56
|
+
"tsdown": "^0.23.7",
|
|
57
|
+
"tstyche": "^7.2.5",
|
|
58
|
+
"vitest": "^5.1.0"
|
|
59
|
+
},
|
|
60
|
+
"peerDependencies": {
|
|
61
|
+
"@effect/platform-node": "^4.1.4",
|
|
62
|
+
"alchemy": "2.0.0-beta.87",
|
|
63
|
+
"effect": "^4.1.4"
|
|
64
|
+
},
|
|
65
|
+
"publishConfig": {
|
|
66
|
+
"access": "public",
|
|
67
|
+
"provenance": true
|
|
68
|
+
},
|
|
69
|
+
"scripts": {
|
|
70
|
+
"clean": "rimraf dist",
|
|
71
|
+
"build": "tsdown -l warn && pnpm api:check",
|
|
72
|
+
"typecheck": "tsc -b",
|
|
73
|
+
"test": "vitest run && vitest run --config vitest.toggle.config.ts",
|
|
74
|
+
"test:cloud": "vitest run --config vitest.cloud.config.ts",
|
|
75
|
+
"test:types": "TSTYCHE_TYPESCRIPT_MODULE=tstyche-typescript tstyche",
|
|
76
|
+
"lint": "f=${OXLINT_FORMAT:-${AGENT:+agent}}; effect-tsgo oxlint . --format=${f:-default}",
|
|
77
|
+
"attw": "attw --pack .",
|
|
78
|
+
"api:check": "api-extractor-quiet run",
|
|
79
|
+
"api:update": "api-extractor run --local"
|
|
80
|
+
}
|
|
6
81
|
}
|