@skaile/provider-fly 0.0.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 +5 -0
- package/LICENSE +201 -0
- package/README.md +56 -0
- package/dist/index.d.ts +90 -0
- package/dist/index.js +243 -0
- package/dist/index.js.map +1 -0
- package/package.json +53 -0
package/CHANGELOG.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
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 2026 Skaile
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# @skaile/provider-fly
|
|
2
|
+
|
|
3
|
+
A [Fly Machines](https://fly.io/docs/machines/) deploy target for
|
|
4
|
+
[`@skaile/workspaces`](https://www.npmjs.com/package/@skaile/workspaces). It
|
|
5
|
+
stands a workspace up as a Fly Machine and reaches it over the app's public TLS
|
|
6
|
+
edge.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
skaile plugin install @skaile/provider-fly
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Add it to `skaile.yaml`:
|
|
15
|
+
|
|
16
|
+
```yaml
|
|
17
|
+
plugins:
|
|
18
|
+
- "@skaile/provider-fly@^0.1.0"
|
|
19
|
+
|
|
20
|
+
deploy:
|
|
21
|
+
target: fly
|
|
22
|
+
config:
|
|
23
|
+
app: my-skaile-app
|
|
24
|
+
region: ams
|
|
25
|
+
apiToken: ${FLY_API_TOKEN}
|
|
26
|
+
buildStrategy: remote
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Config
|
|
30
|
+
|
|
31
|
+
| Field | Type | Default | Notes |
|
|
32
|
+
|---|---|---|---|
|
|
33
|
+
| `app` | string | — | Fly app name (required) |
|
|
34
|
+
| `region` | string | `ams` | Fly region code |
|
|
35
|
+
| `image` | string | — | Required unless `buildStrategy: remote` |
|
|
36
|
+
| `size` | string | `shared-cpu-1x` | Fly machine preset |
|
|
37
|
+
| `port` | number | `8080` | Workspace WS port |
|
|
38
|
+
| `apiToken` | string | — | `FLY_API_TOKEN` (required) |
|
|
39
|
+
| `apiBaseUrl` | string | `https://api.machines.dev` | Machines API base |
|
|
40
|
+
| `buildStrategy` | `local \| remote \| managed` | `remote` | `remote` builds via the `fly` CLI |
|
|
41
|
+
|
|
42
|
+
## How it works
|
|
43
|
+
|
|
44
|
+
- No external SDK — talks to the Fly Machines REST API over `globalThis.fetch`.
|
|
45
|
+
- `buildStrategy: remote` invokes the `fly` CLI (`node:child_process`) to build
|
|
46
|
+
and push an image; `local`/`managed` require a pre-built `image`.
|
|
47
|
+
- `wsUrl` resolves to `wss://<app>.fly.dev:<port>` (TLS terminated at Fly's
|
|
48
|
+
edge, `tlsTermination: "edge"`).
|
|
49
|
+
|
|
50
|
+
## Limitations (v0.1.0)
|
|
51
|
+
|
|
52
|
+
- `wsUrl` uses the public `<app>.fly.dev` host; private `.internal` addressing
|
|
53
|
+
is not yet exposed.
|
|
54
|
+
- The remote build path requires the `fly` CLI on `PATH`.
|
|
55
|
+
- `restore()` reads `FLY_API_TOKEN` / `FLY_API_HOSTNAME` from the environment
|
|
56
|
+
(config is not persisted in the handle payload).
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { DeployTarget, PluginRegistry } from '@skaile/workspaces/plugin-registry';
|
|
2
|
+
import * as z from 'zod';
|
|
3
|
+
|
|
4
|
+
type FetchImpl = (input: string, init?: {
|
|
5
|
+
method?: string;
|
|
6
|
+
headers?: Record<string, string>;
|
|
7
|
+
body?: string;
|
|
8
|
+
signal?: AbortSignal;
|
|
9
|
+
}) => Promise<{
|
|
10
|
+
ok: boolean;
|
|
11
|
+
status: number;
|
|
12
|
+
text(): Promise<string>;
|
|
13
|
+
json(): Promise<unknown>;
|
|
14
|
+
}>;
|
|
15
|
+
/** Result of a spawned `fly` CLI invocation. */
|
|
16
|
+
interface SpawnResult {
|
|
17
|
+
exitCode: number;
|
|
18
|
+
stdout: string;
|
|
19
|
+
stderr: string;
|
|
20
|
+
}
|
|
21
|
+
type SpawnFly = (args: string[], opts: {
|
|
22
|
+
cwd: string;
|
|
23
|
+
signal: AbortSignal;
|
|
24
|
+
}) => Promise<SpawnResult>;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* `flyDeployTarget` — deploy a workspace as a Fly Machine and reach it over the
|
|
28
|
+
* app's public edge (`wss://<app>.fly.dev`). `tlsTermination: "edge"` because
|
|
29
|
+
* Fly terminates TLS at its anycast edge before forwarding to the machine.
|
|
30
|
+
*
|
|
31
|
+
* The Fly Machines API is plain HTTP, so this carries no SDK dependency — see
|
|
32
|
+
* `fly-client.ts`. The CLI spawner and `fetch` are injectable through the
|
|
33
|
+
* `opts` bag so the tests run without a network or a real `fly` binary.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
declare const flyConfigSchema: z.ZodObject<{
|
|
37
|
+
app: z.ZodString;
|
|
38
|
+
region: z.ZodDefault<z.ZodString>;
|
|
39
|
+
image: z.ZodOptional<z.ZodString>;
|
|
40
|
+
size: z.ZodDefault<z.ZodString>;
|
|
41
|
+
port: z.ZodDefault<z.ZodNumber>;
|
|
42
|
+
apiToken: z.ZodString;
|
|
43
|
+
apiBaseUrl: z.ZodDefault<z.ZodString>;
|
|
44
|
+
buildStrategy: z.ZodDefault<z.ZodEnum<{
|
|
45
|
+
local: "local";
|
|
46
|
+
remote: "remote";
|
|
47
|
+
managed: "managed";
|
|
48
|
+
}>>;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
type FlyConfig = z.infer<typeof flyConfigSchema>;
|
|
51
|
+
declare const flyPayloadSchema: z.ZodObject<{
|
|
52
|
+
machineId: z.ZodString;
|
|
53
|
+
app: z.ZodString;
|
|
54
|
+
}, z.core.$strip>;
|
|
55
|
+
type FlyPayload = z.infer<typeof flyPayloadSchema>;
|
|
56
|
+
/** Injectable seams so the target's tests never touch a real network/CLI. */
|
|
57
|
+
interface FlyTargetOptions {
|
|
58
|
+
fetchImpl?: FetchImpl;
|
|
59
|
+
spawnFly?: SpawnFly;
|
|
60
|
+
pollIntervalMs?: number;
|
|
61
|
+
}
|
|
62
|
+
/** Build the Fly deploy target with optional injected seams. */
|
|
63
|
+
declare function makeFlyDeployTarget(opts?: FlyTargetOptions): DeployTarget<FlyConfig, FlyPayload>;
|
|
64
|
+
/** Default Fly deploy target registered by `register()`. */
|
|
65
|
+
declare const flyDeployTarget: DeployTarget<{
|
|
66
|
+
app: string;
|
|
67
|
+
region: string;
|
|
68
|
+
size: string;
|
|
69
|
+
port: number;
|
|
70
|
+
apiToken: string;
|
|
71
|
+
apiBaseUrl: string;
|
|
72
|
+
buildStrategy: "local" | "remote" | "managed";
|
|
73
|
+
image?: string | undefined;
|
|
74
|
+
}, {
|
|
75
|
+
machineId: string;
|
|
76
|
+
app: string;
|
|
77
|
+
}>;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* `@skaile/provider-fly` — Fly Machines deploy target for `@skaile/workspaces`.
|
|
81
|
+
*
|
|
82
|
+
* Install via `skaile plugin install @skaile/provider-fly`; the plugin loader
|
|
83
|
+
* calls `register(pluginRegistry)` at startup so `fly` becomes resolvable as a
|
|
84
|
+
* `deploy.target`.
|
|
85
|
+
*/
|
|
86
|
+
|
|
87
|
+
/** Register this plugin's deploy target with a registry. */
|
|
88
|
+
declare function register(registry: PluginRegistry): void;
|
|
89
|
+
|
|
90
|
+
export { type FlyTargetOptions, flyDeployTarget, makeFlyDeployTarget, register };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
// src/target.ts
|
|
2
|
+
import * as z from "zod";
|
|
3
|
+
|
|
4
|
+
// src/fly-client.ts
|
|
5
|
+
var defaultSpawnFly = async (args, opts) => {
|
|
6
|
+
const { spawn } = await import("child_process");
|
|
7
|
+
return await new Promise((resolve, reject) => {
|
|
8
|
+
const child = spawn("fly", args, { cwd: opts.cwd, signal: opts.signal });
|
|
9
|
+
let stdout = "";
|
|
10
|
+
let stderr = "";
|
|
11
|
+
child.stdout?.on("data", (d) => {
|
|
12
|
+
stdout += d.toString();
|
|
13
|
+
});
|
|
14
|
+
child.stderr?.on("data", (d) => {
|
|
15
|
+
stderr += d.toString();
|
|
16
|
+
});
|
|
17
|
+
child.on("error", reject);
|
|
18
|
+
child.on("close", (code) => resolve({ exitCode: code ?? 0, stdout, stderr }));
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var FlyClient = class {
|
|
22
|
+
baseUrl;
|
|
23
|
+
token;
|
|
24
|
+
fetchImpl;
|
|
25
|
+
constructor(opts) {
|
|
26
|
+
this.baseUrl = opts.apiBaseUrl.replace(/\/$/, "");
|
|
27
|
+
this.token = opts.apiToken;
|
|
28
|
+
this.fetchImpl = opts.fetchImpl ?? globalThis.fetch;
|
|
29
|
+
}
|
|
30
|
+
headers() {
|
|
31
|
+
return {
|
|
32
|
+
Authorization: `Bearer ${this.token}`,
|
|
33
|
+
"Content-Type": "application/json"
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
async request(method, path, signal, body) {
|
|
37
|
+
const res = await this.fetchImpl(`${this.baseUrl}${path}`, {
|
|
38
|
+
method,
|
|
39
|
+
headers: this.headers(),
|
|
40
|
+
body: body === void 0 ? void 0 : JSON.stringify(body),
|
|
41
|
+
signal
|
|
42
|
+
});
|
|
43
|
+
if (!res.ok) {
|
|
44
|
+
const detail = await res.text().catch(() => "");
|
|
45
|
+
throw new Error(`fly ${method} ${path} failed: ${res.status} ${detail}`);
|
|
46
|
+
}
|
|
47
|
+
const text = await res.text();
|
|
48
|
+
return text ? JSON.parse(text) : {};
|
|
49
|
+
}
|
|
50
|
+
/** `POST /v1/apps/{app}/machines` — create a machine, returns its resource. */
|
|
51
|
+
async createMachine(app, spec, signal) {
|
|
52
|
+
return await this.request("POST", `/v1/apps/${app}/machines`, signal, spec);
|
|
53
|
+
}
|
|
54
|
+
/** `GET /v1/apps/{app}/machines/{id}`. */
|
|
55
|
+
async getMachine(app, machineId, signal) {
|
|
56
|
+
return await this.request(
|
|
57
|
+
"GET",
|
|
58
|
+
`/v1/apps/${app}/machines/${machineId}`,
|
|
59
|
+
signal
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
/** `DELETE /v1/apps/{app}/machines/{id}?force=true` — idempotent teardown. */
|
|
63
|
+
async deleteMachine(app, machineId, signal) {
|
|
64
|
+
try {
|
|
65
|
+
await this.request("DELETE", `/v1/apps/${app}/machines/${machineId}?force=true`, signal);
|
|
66
|
+
} catch {
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
// src/target.ts
|
|
72
|
+
var flyConfigSchema = z.object({
|
|
73
|
+
app: z.string().min(1),
|
|
74
|
+
region: z.string().default("ams"),
|
|
75
|
+
image: z.string().optional(),
|
|
76
|
+
size: z.string().default("shared-cpu-1x"),
|
|
77
|
+
port: z.number().int().positive().default(8080),
|
|
78
|
+
apiToken: z.string().min(1),
|
|
79
|
+
apiBaseUrl: z.string().url().default("https://api.machines.dev"),
|
|
80
|
+
buildStrategy: z.enum(["local", "remote", "managed"]).default("remote")
|
|
81
|
+
}).refine((c) => c.buildStrategy === "remote" || c.image !== void 0, {
|
|
82
|
+
message: "image required when buildStrategy is local or managed",
|
|
83
|
+
path: ["image"]
|
|
84
|
+
});
|
|
85
|
+
var flyPayloadSchema = z.object({
|
|
86
|
+
machineId: z.string(),
|
|
87
|
+
app: z.string()
|
|
88
|
+
});
|
|
89
|
+
var DEFAULT_POLL_INTERVAL_MS = 1e3;
|
|
90
|
+
var DEFAULT_READY_TIMEOUT_MS = 12e4;
|
|
91
|
+
function guestForSize(size) {
|
|
92
|
+
const cpuKind = size.startsWith("performance") ? "performance" : "shared";
|
|
93
|
+
const match = size.match(/-(\d+)x$/);
|
|
94
|
+
const cpus = match ? Number(match[1]) : 1;
|
|
95
|
+
return { cpu_kind: cpuKind, cpus, memory_mb: 256 * cpus };
|
|
96
|
+
}
|
|
97
|
+
async function sleep(ms, signal) {
|
|
98
|
+
return await new Promise((resolve, reject) => {
|
|
99
|
+
const timer = setTimeout(() => {
|
|
100
|
+
signal.removeEventListener("abort", onAbort);
|
|
101
|
+
resolve();
|
|
102
|
+
}, ms);
|
|
103
|
+
const onAbort = () => {
|
|
104
|
+
clearTimeout(timer);
|
|
105
|
+
reject(new Error("aborted while polling fly machine state"));
|
|
106
|
+
};
|
|
107
|
+
if (signal.aborted) onAbort();
|
|
108
|
+
else signal.addEventListener("abort", onAbort);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
function buildHandle(client, payload, config, ctx, ready, initialState) {
|
|
112
|
+
let state = initialState;
|
|
113
|
+
return {
|
|
114
|
+
// Fly terminates TLS at the edge; the public form is the app's fly.dev host.
|
|
115
|
+
wsUrl: `wss://${payload.app}.fly.dev:${config.port}`,
|
|
116
|
+
wsAuth: ctx.wsAuth ? "<redacted>" : void 0,
|
|
117
|
+
get state() {
|
|
118
|
+
return state;
|
|
119
|
+
},
|
|
120
|
+
payload,
|
|
121
|
+
async waitReady(timeoutMs) {
|
|
122
|
+
try {
|
|
123
|
+
await ready();
|
|
124
|
+
state = "ready";
|
|
125
|
+
} catch (err) {
|
|
126
|
+
state = "errored";
|
|
127
|
+
throw err;
|
|
128
|
+
}
|
|
129
|
+
void timeoutMs;
|
|
130
|
+
},
|
|
131
|
+
async health() {
|
|
132
|
+
try {
|
|
133
|
+
const machine = await client.getMachine(payload.app, payload.machineId, ctx.signal);
|
|
134
|
+
const healthy = machine.state === "started";
|
|
135
|
+
return healthy ? { healthy } : { healthy, detail: `machine ${payload.machineId} state=${machine.state}` };
|
|
136
|
+
} catch (err) {
|
|
137
|
+
return { healthy: false, detail: err.message };
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
async stop() {
|
|
141
|
+
state = "stopping";
|
|
142
|
+
await client.deleteMachine(payload.app, payload.machineId, ctx.signal);
|
|
143
|
+
state = "stopped";
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function makeFlyDeployTarget(opts = {}) {
|
|
148
|
+
const spawnFly = opts.spawnFly ?? defaultSpawnFly;
|
|
149
|
+
const pollIntervalMs = opts.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
|
|
150
|
+
return {
|
|
151
|
+
id: "fly",
|
|
152
|
+
displayName: "Fly Machines",
|
|
153
|
+
apiVersion: 1,
|
|
154
|
+
tlsTermination: "edge",
|
|
155
|
+
configSchema: flyConfigSchema,
|
|
156
|
+
payloadSchema: flyPayloadSchema,
|
|
157
|
+
async create(config, ctx) {
|
|
158
|
+
const log = ctx.log;
|
|
159
|
+
const client = new FlyClient({
|
|
160
|
+
apiBaseUrl: config.apiBaseUrl,
|
|
161
|
+
apiToken: config.apiToken,
|
|
162
|
+
fetchImpl: opts.fetchImpl
|
|
163
|
+
});
|
|
164
|
+
let image = config.image ?? ctx.imageRef;
|
|
165
|
+
if (config.buildStrategy === "remote") {
|
|
166
|
+
const res = await spawnFly(["deploy", "--app", config.app, "--build-only", "--push"], {
|
|
167
|
+
cwd: process.cwd(),
|
|
168
|
+
signal: ctx.signal
|
|
169
|
+
});
|
|
170
|
+
if (res.exitCode !== 0) {
|
|
171
|
+
throw new Error(
|
|
172
|
+
`fly deploy (remote build) failed: ${res.stderr.trim() || res.stdout.trim()}`
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
const pushed = res.stdout.match(/image:\s*(\S+)/i)?.[1];
|
|
176
|
+
image = config.image ?? pushed ?? `registry.fly.io/${config.app}:latest`;
|
|
177
|
+
}
|
|
178
|
+
if (!image) {
|
|
179
|
+
throw new Error("no image resolved for fly deploy");
|
|
180
|
+
}
|
|
181
|
+
const machine = await client.createMachine(
|
|
182
|
+
config.app,
|
|
183
|
+
{
|
|
184
|
+
region: config.region,
|
|
185
|
+
config: {
|
|
186
|
+
image,
|
|
187
|
+
env: ctx.env,
|
|
188
|
+
guest: guestForSize(config.size),
|
|
189
|
+
services: [
|
|
190
|
+
{
|
|
191
|
+
ports: [{ port: config.port, handlers: ["tls", "http"] }],
|
|
192
|
+
protocol: "tcp",
|
|
193
|
+
internal_port: config.port
|
|
194
|
+
}
|
|
195
|
+
]
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
ctx.signal
|
|
199
|
+
);
|
|
200
|
+
log.info("fly machine created", { app: config.app, machineId: machine.id });
|
|
201
|
+
const payload = { machineId: machine.id, app: config.app };
|
|
202
|
+
const ready = async () => {
|
|
203
|
+
const deadline = Date.now() + DEFAULT_READY_TIMEOUT_MS;
|
|
204
|
+
let current = machine;
|
|
205
|
+
while (current.state !== "started") {
|
|
206
|
+
if (Date.now() > deadline) {
|
|
207
|
+
throw new Error(`timed out waiting for fly machine ${machine.id} to start`);
|
|
208
|
+
}
|
|
209
|
+
await sleep(pollIntervalMs, ctx.signal);
|
|
210
|
+
current = await client.getMachine(config.app, machine.id, ctx.signal);
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
return buildHandle(client, payload, config, ctx, ready, "starting");
|
|
214
|
+
},
|
|
215
|
+
async restore(payload, ctx) {
|
|
216
|
+
const apiBaseUrl = ctx.env.FLY_API_HOSTNAME ?? "https://api.machines.dev";
|
|
217
|
+
const apiToken = ctx.env.FLY_API_TOKEN ?? "";
|
|
218
|
+
const client = new FlyClient({ apiBaseUrl, apiToken, fetchImpl: opts.fetchImpl });
|
|
219
|
+
const machine = await client.getMachine(payload.app, payload.machineId, ctx.signal);
|
|
220
|
+
if (machine.state !== "started") {
|
|
221
|
+
throw new Error(`fly machine ${payload.machineId} is not started (state=${machine.state})`);
|
|
222
|
+
}
|
|
223
|
+
ctx.log.info("re-attached to fly machine", {
|
|
224
|
+
app: payload.app,
|
|
225
|
+
machineId: payload.machineId
|
|
226
|
+
});
|
|
227
|
+
return buildHandle(client, payload, { port: 8080 }, ctx, async () => {
|
|
228
|
+
}, "ready");
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
var flyDeployTarget = makeFlyDeployTarget();
|
|
233
|
+
|
|
234
|
+
// src/index.ts
|
|
235
|
+
function register(registry) {
|
|
236
|
+
registry.register("deployTarget", flyDeployTarget);
|
|
237
|
+
}
|
|
238
|
+
export {
|
|
239
|
+
flyDeployTarget,
|
|
240
|
+
makeFlyDeployTarget,
|
|
241
|
+
register
|
|
242
|
+
};
|
|
243
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/target.ts","../src/fly-client.ts","../src/index.ts"],"sourcesContent":["/**\n * `flyDeployTarget` — deploy a workspace as a Fly Machine and reach it over the\n * app's public edge (`wss://<app>.fly.dev`). `tlsTermination: \"edge\"` because\n * Fly terminates TLS at its anycast edge before forwarding to the machine.\n *\n * The Fly Machines API is plain HTTP, so this carries no SDK dependency — see\n * `fly-client.ts`. The CLI spawner and `fetch` are injectable through the\n * `opts` bag so the tests run without a network or a real `fly` binary.\n */\n\nimport type { DeployContext, DeployHandle, DeployTarget } from \"@skaile/workspaces/plugin-registry\";\nimport * as z from \"zod\";\nimport {\n defaultSpawnFly,\n type FetchImpl,\n FlyClient,\n type FlyMachine,\n type SpawnFly,\n} from \"./fly-client.js\";\n\nconst flyConfigSchema = z\n .object({\n app: z.string().min(1),\n region: z.string().default(\"ams\"),\n image: z.string().optional(),\n size: z.string().default(\"shared-cpu-1x\"),\n port: z.number().int().positive().default(8080),\n apiToken: z.string().min(1),\n apiBaseUrl: z.string().url().default(\"https://api.machines.dev\"),\n buildStrategy: z.enum([\"local\", \"remote\", \"managed\"]).default(\"remote\"),\n })\n .refine((c) => c.buildStrategy === \"remote\" || c.image !== undefined, {\n message: \"image required when buildStrategy is local or managed\",\n path: [\"image\"],\n });\n\ntype FlyConfig = z.infer<typeof flyConfigSchema>;\n\nconst flyPayloadSchema = z.object({\n machineId: z.string(),\n app: z.string(),\n});\n\ntype FlyPayload = z.infer<typeof flyPayloadSchema>;\n\nconst DEFAULT_POLL_INTERVAL_MS = 1_000;\nconst DEFAULT_READY_TIMEOUT_MS = 120_000;\n\n/** Injectable seams so the target's tests never touch a real network/CLI. */\nexport interface FlyTargetOptions {\n fetchImpl?: FetchImpl;\n spawnFly?: SpawnFly;\n pollIntervalMs?: number;\n}\n\n/** Map a Fly size string to the guest shape the Machines API expects. */\nfunction guestForSize(size: string): { cpu_kind: string; cpus: number; memory_mb: number } {\n // \"shared-cpu-1x\" → shared / 1 cpu / 256mb. We only special-case the cpu kind;\n // memory follows Fly's default for the smallest shared preset.\n const cpuKind = size.startsWith(\"performance\") ? \"performance\" : \"shared\";\n const match = size.match(/-(\\d+)x$/);\n const cpus = match ? Number(match[1]) : 1;\n return { cpu_kind: cpuKind, cpus, memory_mb: 256 * cpus };\n}\n\nasync function sleep(ms: number, signal: AbortSignal): Promise<void> {\n return await new Promise<void>((resolve, reject) => {\n const timer = setTimeout(() => {\n signal.removeEventListener(\"abort\", onAbort);\n resolve();\n }, ms);\n const onAbort = () => {\n clearTimeout(timer);\n reject(new Error(\"aborted while polling fly machine state\"));\n };\n if (signal.aborted) onAbort();\n else signal.addEventListener(\"abort\", onAbort);\n });\n}\n\nfunction buildHandle(\n client: FlyClient,\n payload: FlyPayload,\n config: Pick<FlyConfig, \"port\">,\n ctx: DeployContext,\n ready: () => Promise<void>,\n initialState: DeployHandle[\"state\"],\n): DeployHandle<FlyPayload> {\n let state: DeployHandle[\"state\"] = initialState;\n return {\n // Fly terminates TLS at the edge; the public form is the app's fly.dev host.\n wsUrl: `wss://${payload.app}.fly.dev:${config.port}`,\n wsAuth: ctx.wsAuth ? \"<redacted>\" : undefined,\n get state() {\n return state;\n },\n payload,\n async waitReady(timeoutMs?: number) {\n try {\n await ready();\n state = \"ready\";\n } catch (err) {\n state = \"errored\";\n throw err;\n }\n void timeoutMs;\n },\n async health() {\n try {\n const machine = await client.getMachine(payload.app, payload.machineId, ctx.signal);\n const healthy = machine.state === \"started\";\n return healthy\n ? { healthy }\n : { healthy, detail: `machine ${payload.machineId} state=${machine.state}` };\n } catch (err) {\n return { healthy: false, detail: (err as Error).message };\n }\n },\n async stop() {\n state = \"stopping\";\n await client.deleteMachine(payload.app, payload.machineId, ctx.signal);\n state = \"stopped\";\n },\n };\n}\n\n/** Build the Fly deploy target with optional injected seams. */\nexport function makeFlyDeployTarget(\n opts: FlyTargetOptions = {},\n): DeployTarget<FlyConfig, FlyPayload> {\n const spawnFly = opts.spawnFly ?? defaultSpawnFly;\n const pollIntervalMs = opts.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;\n\n return {\n id: \"fly\",\n displayName: \"Fly Machines\",\n apiVersion: 1,\n tlsTermination: \"edge\",\n configSchema: flyConfigSchema as unknown as z.ZodType<FlyConfig>,\n payloadSchema: flyPayloadSchema,\n\n async create(config, ctx) {\n const log = ctx.log;\n const client = new FlyClient({\n apiBaseUrl: config.apiBaseUrl,\n apiToken: config.apiToken,\n fetchImpl: opts.fetchImpl,\n });\n\n // Resolve the image: remote builds publish one via `fly deploy`; local /\n // managed strategies require the operator to supply `config.image`.\n let image = config.image ?? ctx.imageRef;\n if (config.buildStrategy === \"remote\") {\n const res = await spawnFly([\"deploy\", \"--app\", config.app, \"--build-only\", \"--push\"], {\n cwd: process.cwd(),\n signal: ctx.signal,\n });\n if (res.exitCode !== 0) {\n throw new Error(\n `fly deploy (remote build) failed: ${res.stderr.trim() || res.stdout.trim()}`,\n );\n }\n // `fly deploy --build-only --push` prints the pushed image ref; fall back\n // to a registry-derived default when the operator pins one explicitly.\n const pushed = res.stdout.match(/image:\\s*(\\S+)/i)?.[1];\n image = config.image ?? pushed ?? `registry.fly.io/${config.app}:latest`;\n }\n if (!image) {\n throw new Error(\"no image resolved for fly deploy\");\n }\n\n const machine = await client.createMachine(\n config.app,\n {\n region: config.region,\n config: {\n image,\n env: ctx.env as Record<string, string>,\n guest: guestForSize(config.size),\n services: [\n {\n ports: [{ port: config.port, handlers: [\"tls\", \"http\"] }],\n protocol: \"tcp\",\n internal_port: config.port,\n },\n ],\n },\n },\n ctx.signal,\n );\n log.info(\"fly machine created\", { app: config.app, machineId: machine.id });\n\n const payload: FlyPayload = { machineId: machine.id, app: config.app };\n const ready = async () => {\n const deadline = Date.now() + DEFAULT_READY_TIMEOUT_MS;\n let current: FlyMachine = machine;\n while (current.state !== \"started\") {\n if (Date.now() > deadline) {\n throw new Error(`timed out waiting for fly machine ${machine.id} to start`);\n }\n await sleep(pollIntervalMs, ctx.signal);\n current = await client.getMachine(config.app, machine.id, ctx.signal);\n }\n };\n return buildHandle(client, payload, config, ctx, ready, \"starting\");\n },\n\n async restore(payload, ctx) {\n // Restore re-reads the machine; a started machine yields a live handle.\n // Config is not persisted, so apiBaseUrl/token come from the environment.\n const apiBaseUrl = ctx.env.FLY_API_HOSTNAME ?? \"https://api.machines.dev\";\n const apiToken = ctx.env.FLY_API_TOKEN ?? \"\";\n const client = new FlyClient({ apiBaseUrl, apiToken, fetchImpl: opts.fetchImpl });\n\n const machine = await client.getMachine(payload.app, payload.machineId, ctx.signal);\n if (machine.state !== \"started\") {\n throw new Error(`fly machine ${payload.machineId} is not started (state=${machine.state})`);\n }\n ctx.log.info(\"re-attached to fly machine\", {\n app: payload.app,\n machineId: payload.machineId,\n });\n // Port is not persisted in the payload; default to the standard ws port.\n return buildHandle(client, payload, { port: 8080 }, ctx, async () => {}, \"ready\");\n },\n };\n}\n\n/** Default Fly deploy target registered by `register()`. */\nexport const flyDeployTarget = makeFlyDeployTarget();\n","/**\n * Thin Fly Machines REST client over `globalThis.fetch`, plus an injectable\n * `fly` CLI spawn used only for the remote build strategy.\n *\n * The client carries no SDK dependency — Fly's Machines API is plain HTTP, so a\n * handful of typed `fetch` calls cover create/get/delete. `fetchImpl` and\n * `spawnFly` are injectable so the target's tests stay fully hermetic (no real\n * network, no real CLI).\n */\n\n/** Subset of the Fly Machine resource this provider reads. */\nexport interface FlyMachine {\n id: string;\n name?: string;\n state: string;\n region?: string;\n private_ip?: string;\n}\n\nexport type FetchImpl = (\n input: string,\n init?: {\n method?: string;\n headers?: Record<string, string>;\n body?: string;\n signal?: AbortSignal;\n },\n) => Promise<{\n ok: boolean;\n status: number;\n text(): Promise<string>;\n json(): Promise<unknown>;\n}>;\n\n/** Result of a spawned `fly` CLI invocation. */\nexport interface SpawnResult {\n exitCode: number;\n stdout: string;\n stderr: string;\n}\n\nexport type SpawnFly = (\n args: string[],\n opts: { cwd: string; signal: AbortSignal },\n) => Promise<SpawnResult>;\n\nexport interface FlyClientOptions {\n apiBaseUrl: string;\n apiToken: string;\n fetchImpl?: FetchImpl;\n}\n\n/** Default CLI spawner: runs the user's `fly` binary via `node:child_process`. */\nexport const defaultSpawnFly: SpawnFly = async (args, opts) => {\n const { spawn } = await import(\"node:child_process\");\n return await new Promise<SpawnResult>((resolve, reject) => {\n const child = spawn(\"fly\", args, { cwd: opts.cwd, signal: opts.signal });\n let stdout = \"\";\n let stderr = \"\";\n child.stdout?.on(\"data\", (d: Buffer) => {\n stdout += d.toString();\n });\n child.stderr?.on(\"data\", (d: Buffer) => {\n stderr += d.toString();\n });\n child.on(\"error\", reject);\n child.on(\"close\", (code) => resolve({ exitCode: code ?? 0, stdout, stderr }));\n });\n};\n\nexport class FlyClient {\n private readonly baseUrl: string;\n private readonly token: string;\n private readonly fetchImpl: FetchImpl;\n\n constructor(opts: FlyClientOptions) {\n this.baseUrl = opts.apiBaseUrl.replace(/\\/$/, \"\");\n this.token = opts.apiToken;\n this.fetchImpl = opts.fetchImpl ?? (globalThis.fetch as unknown as FetchImpl);\n }\n\n private headers(): Record<string, string> {\n return {\n Authorization: `Bearer ${this.token}`,\n \"Content-Type\": \"application/json\",\n };\n }\n\n private async request(\n method: string,\n path: string,\n signal: AbortSignal,\n body?: unknown,\n ): Promise<unknown> {\n const res = await this.fetchImpl(`${this.baseUrl}${path}`, {\n method,\n headers: this.headers(),\n body: body === undefined ? undefined : JSON.stringify(body),\n signal,\n });\n if (!res.ok) {\n const detail = await res.text().catch(() => \"\");\n throw new Error(`fly ${method} ${path} failed: ${res.status} ${detail}`);\n }\n // DELETE may return an empty body.\n const text = await res.text();\n return text ? JSON.parse(text) : {};\n }\n\n /** `POST /v1/apps/{app}/machines` — create a machine, returns its resource. */\n async createMachine(\n app: string,\n spec: {\n region: string;\n config: {\n image: string;\n env?: Record<string, string>;\n guest?: { cpu_kind: string; cpus: number; memory_mb: number };\n services?: unknown[];\n };\n },\n signal: AbortSignal,\n ): Promise<FlyMachine> {\n return (await this.request(\"POST\", `/v1/apps/${app}/machines`, signal, spec)) as FlyMachine;\n }\n\n /** `GET /v1/apps/{app}/machines/{id}`. */\n async getMachine(app: string, machineId: string, signal: AbortSignal): Promise<FlyMachine> {\n return (await this.request(\n \"GET\",\n `/v1/apps/${app}/machines/${machineId}`,\n signal,\n )) as FlyMachine;\n }\n\n /** `DELETE /v1/apps/{app}/machines/{id}?force=true` — idempotent teardown. */\n async deleteMachine(app: string, machineId: string, signal: AbortSignal): Promise<void> {\n try {\n await this.request(\"DELETE\", `/v1/apps/${app}/machines/${machineId}?force=true`, signal);\n } catch {\n // A 404 (already gone) is a successful teardown for our purposes.\n }\n }\n}\n","/**\n * `@skaile/provider-fly` — Fly Machines deploy target for `@skaile/workspaces`.\n *\n * Install via `skaile plugin install @skaile/provider-fly`; the plugin loader\n * calls `register(pluginRegistry)` at startup so `fly` becomes resolvable as a\n * `deploy.target`.\n */\n\nimport type { PluginRegistry } from \"@skaile/workspaces/plugin-registry\";\nimport { flyDeployTarget } from \"./target.js\";\n\nexport { flyDeployTarget, makeFlyDeployTarget } from \"./target.js\";\nexport type { FlyTargetOptions } from \"./target.js\";\n\n/** Register this plugin's deploy target with a registry. */\nexport function register(registry: PluginRegistry): void {\n registry.register(\"deployTarget\", flyDeployTarget);\n}\n"],"mappings":";AAWA,YAAY,OAAO;;;AC0CZ,IAAM,kBAA4B,OAAO,MAAM,SAAS;AAC7D,QAAM,EAAE,MAAM,IAAI,MAAM,OAAO,eAAoB;AACnD,SAAO,MAAM,IAAI,QAAqB,CAAC,SAAS,WAAW;AACzD,UAAM,QAAQ,MAAM,OAAO,MAAM,EAAE,KAAK,KAAK,KAAK,QAAQ,KAAK,OAAO,CAAC;AACvE,QAAI,SAAS;AACb,QAAI,SAAS;AACb,UAAM,QAAQ,GAAG,QAAQ,CAAC,MAAc;AACtC,gBAAU,EAAE,SAAS;AAAA,IACvB,CAAC;AACD,UAAM,QAAQ,GAAG,QAAQ,CAAC,MAAc;AACtC,gBAAU,EAAE,SAAS;AAAA,IACvB,CAAC;AACD,UAAM,GAAG,SAAS,MAAM;AACxB,UAAM,GAAG,SAAS,CAAC,SAAS,QAAQ,EAAE,UAAU,QAAQ,GAAG,QAAQ,OAAO,CAAC,CAAC;AAAA,EAC9E,CAAC;AACH;AAEO,IAAM,YAAN,MAAgB;AAAA,EACJ;AAAA,EACA;AAAA,EACA;AAAA,EAEjB,YAAY,MAAwB;AAClC,SAAK,UAAU,KAAK,WAAW,QAAQ,OAAO,EAAE;AAChD,SAAK,QAAQ,KAAK;AAClB,SAAK,YAAY,KAAK,aAAc,WAAW;AAAA,EACjD;AAAA,EAEQ,UAAkC;AACxC,WAAO;AAAA,MACL,eAAe,UAAU,KAAK,KAAK;AAAA,MACnC,gBAAgB;AAAA,IAClB;AAAA,EACF;AAAA,EAEA,MAAc,QACZ,QACA,MACA,QACA,MACkB;AAClB,UAAM,MAAM,MAAM,KAAK,UAAU,GAAG,KAAK,OAAO,GAAG,IAAI,IAAI;AAAA,MACzD;AAAA,MACA,SAAS,KAAK,QAAQ;AAAA,MACtB,MAAM,SAAS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AAa,IAAI,IAAI,oBAAoB;AAC/C,YAAM,WAAW,IAAI,IAAI,iBAAiB;AAC1C,YAAM,SAAS,IAAI,UAAU,EAAE,YAAY,UAAU,WAAW,KAAK,UAAU,CAAC;AAEhF,YAAM,UAAU,MAAM,OAAO,WAAW,QAAQ,KAAK,QAAQ,WAAW,IAAI,MAAM;AAClF,UAAI,QAAQ,UAAU,WAAW;AAC/B,cAAM,IAAI,MAAM,eAAe,QAAQ,SAAS,0BAA0B,QAAQ,KAAK,GAAG;AAAA,MAC5F;AACA,UAAI,IAAI,KAAK,8BAA8B;AAAA,QACzC,KAAK,QAAQ;AAAA,QACb,WAAW,QAAQ;AAAA,MACrB,CAAC;AAED,aAAO,YAAY,QAAQ,SAAS,EAAE,MAAM,KAAK,GAAG,KAAK,YAAY;AAAA,MAAC,GAAG,OAAO;AAAA,IAClF;AAAA,EACF;AACF;AAGO,IAAM,kBAAkB,oBAAoB;;;AEtN5C,SAAS,SAAS,UAAgC;AACvD,WAAS,SAAS,gBAAgB,eAAe;AACnD;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@skaile/provider-fly",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "Fly Machines deploy target for @skaile/workspaces",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"README.md",
|
|
17
|
+
"CHANGELOG.md",
|
|
18
|
+
"LICENSE"
|
|
19
|
+
],
|
|
20
|
+
"sideEffects": false,
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=20"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"@skaile/workspaces": ">=0.22.0-0"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@skaile/workspaces": "0.21.0"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsup",
|
|
32
|
+
"typecheck": "tsc --noEmit",
|
|
33
|
+
"test": "vitest run",
|
|
34
|
+
"test:watch": "vitest",
|
|
35
|
+
"format": "biome format --write .",
|
|
36
|
+
"lint": "biome lint .",
|
|
37
|
+
"check": "biome check ."
|
|
38
|
+
},
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "git+https://github.com/skaile-ai/workspaces.git",
|
|
45
|
+
"directory": "packages/provider-fly"
|
|
46
|
+
},
|
|
47
|
+
"homepage": "https://github.com/skaile-ai/workspaces/tree/main/packages/provider-fly#readme",
|
|
48
|
+
"bugs": "https://github.com/skaile-ai/workspaces/issues",
|
|
49
|
+
"license": "Apache-2.0",
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"zod": "^4.4.0"
|
|
52
|
+
}
|
|
53
|
+
}
|