flaghoist 0.0.1 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +47 -8
- package/dist/chunk-S4XXPMMW.js +51 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +431 -0
- package/dist/lib.d.ts +22 -0
- package/dist/lib.js +12 -0
- package/package.json +50 -15
- package/bin.js +0 -5
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 Derivative
|
|
95
|
+
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 do
|
|
117
|
+
not modify the License. You may add Your own attribution notices
|
|
118
|
+
within Derivative Works that You distribute, alongside or as an
|
|
119
|
+
addendum to the NOTICE text from the Work, provided that such
|
|
120
|
+
additional attribution notices cannot be construed as modifying
|
|
121
|
+
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 Damilola Oluwafemi and the Flaghoist contributors
|
|
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
CHANGED
|
@@ -1,13 +1,52 @@
|
|
|
1
1
|
# flaghoist
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
for $0.
|
|
3
|
+
Feature flags you run yourself. This is the command line tool for setting up a Flaghoist server and
|
|
4
|
+
managing the flags on it.
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
Your whole project is one `flaghoist.toml` file. The CLI turns that into a Cloudflare Worker, or
|
|
7
|
+
hands you the code if you would rather own it.
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
```bash
|
|
10
|
+
npm create flaghoist@latest team-flags
|
|
11
|
+
cd team-flags
|
|
12
|
+
npx flaghoist deploy
|
|
13
|
+
```
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
That gives you an OFREP read API, an admin API, and a dashboard at `/admin`, all from a single
|
|
16
|
+
deploy. On Cloudflare KV, the first deploy also creates the KV namespace for you and writes its id
|
|
17
|
+
into `wrangler.toml`.
|
|
18
|
+
|
|
19
|
+
## Managing flags
|
|
20
|
+
|
|
21
|
+
Point the CLI at your server with `--url` and `--token`, or set `FLAGS_URL` and
|
|
22
|
+
`FLAGS_ADMIN_TOKEN`.
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
flaghoist flag list
|
|
26
|
+
flaghoist flag create new-checkout --desc "The redesigned checkout"
|
|
27
|
+
flaghoist flag toggle new-checkout --on
|
|
28
|
+
flaghoist flag rollout new-checkout 25
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Rollouts are sticky. A user who lands inside 25 percent stays inside it as you go to 50, so nobody
|
|
32
|
+
flickers in and out between deploys.
|
|
33
|
+
|
|
34
|
+
## Owning the code
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npx flaghoist eject
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Writes `src/index.ts`, `wrangler.toml` and `package.json` into your project. From there it is a
|
|
41
|
+
normal Worker and the CLI steps out of the way.
|
|
42
|
+
|
|
43
|
+
Flags are boolean only. There are no multivariate flags, experiments or scheduled rules, and there
|
|
44
|
+
is no plan to imply otherwise.
|
|
45
|
+
|
|
46
|
+
## Status
|
|
47
|
+
|
|
48
|
+
Pre-alpha, built and maintained by one person. The API can still change without notice, and
|
|
49
|
+
production use is not recommended yet. If you try it and something breaks, an issue is genuinely
|
|
50
|
+
useful.
|
|
51
|
+
|
|
52
|
+
Apache-2.0. Part of [Flaghoist](https://github.com/flaghoist/flaghoist).
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// src/config.ts
|
|
2
|
+
import { parse } from "smol-toml";
|
|
3
|
+
var DEFAULT_CONFIG = {
|
|
4
|
+
name: "team-flags",
|
|
5
|
+
storage: "cloudflare-kv",
|
|
6
|
+
auth: { admin: "bearer-token", read: "api-key" },
|
|
7
|
+
dashboard: true
|
|
8
|
+
};
|
|
9
|
+
var STORAGE_KINDS = [
|
|
10
|
+
"cloudflare-kv",
|
|
11
|
+
"redis",
|
|
12
|
+
"postgres",
|
|
13
|
+
"memory"
|
|
14
|
+
];
|
|
15
|
+
function parseConfig(text) {
|
|
16
|
+
const raw = parse(text);
|
|
17
|
+
const name = typeof raw.name === "string" && raw.name ? raw.name : DEFAULT_CONFIG.name;
|
|
18
|
+
const storage = STORAGE_KINDS.includes(raw.storage) ? raw.storage : DEFAULT_CONFIG.storage;
|
|
19
|
+
const authRaw = typeof raw.auth === "object" && raw.auth !== null ? raw.auth : {};
|
|
20
|
+
const admin = authRaw.admin === "oidc" ? "oidc" : "bearer-token";
|
|
21
|
+
const allowedOrigins = Array.isArray(raw.allowedOrigins) ? raw.allowedOrigins.filter((x) => typeof x === "string") : void 0;
|
|
22
|
+
const dashboard = raw.dashboard !== false;
|
|
23
|
+
return { name, storage, auth: { admin, read: "api-key" }, allowedOrigins, dashboard };
|
|
24
|
+
}
|
|
25
|
+
function serializeConfig(config) {
|
|
26
|
+
const lines = [
|
|
27
|
+
`name = ${JSON.stringify(config.name)}`,
|
|
28
|
+
`storage = ${JSON.stringify(config.storage)}`
|
|
29
|
+
];
|
|
30
|
+
if (config.allowedOrigins && config.allowedOrigins.length > 0) {
|
|
31
|
+
lines.push(`allowedOrigins = ${JSON.stringify(config.allowedOrigins)}`);
|
|
32
|
+
}
|
|
33
|
+
if (!config.dashboard) {
|
|
34
|
+
lines.push("dashboard = false");
|
|
35
|
+
}
|
|
36
|
+
lines.push(
|
|
37
|
+
"",
|
|
38
|
+
"[auth]",
|
|
39
|
+
`admin = ${JSON.stringify(config.auth.admin)}`,
|
|
40
|
+
`read = ${JSON.stringify(config.auth.read)}`
|
|
41
|
+
);
|
|
42
|
+
return `${lines.join("\n")}
|
|
43
|
+
`;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export {
|
|
47
|
+
DEFAULT_CONFIG,
|
|
48
|
+
STORAGE_KINDS,
|
|
49
|
+
parseConfig,
|
|
50
|
+
serializeConfig
|
|
51
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
DEFAULT_CONFIG,
|
|
4
|
+
STORAGE_KINDS,
|
|
5
|
+
parseConfig,
|
|
6
|
+
serializeConfig
|
|
7
|
+
} from "./chunk-S4XXPMMW.js";
|
|
8
|
+
|
|
9
|
+
// src/index.ts
|
|
10
|
+
import { spawnSync } from "child_process";
|
|
11
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
12
|
+
import { dirname, join } from "path";
|
|
13
|
+
import { parseArgs } from "util";
|
|
14
|
+
|
|
15
|
+
// src/admin.ts
|
|
16
|
+
function createAdminClient(options) {
|
|
17
|
+
const doFetch = options.fetch ?? ((input, init) => fetch(input, init));
|
|
18
|
+
const api = `${options.url.replace(/\/+$/, "")}/api/v1`;
|
|
19
|
+
const headers = {
|
|
20
|
+
authorization: `Bearer ${options.token}`,
|
|
21
|
+
"content-type": "application/json"
|
|
22
|
+
};
|
|
23
|
+
const path = (key) => `${api}/flags/${encodeURIComponent(key)}`;
|
|
24
|
+
return {
|
|
25
|
+
async list() {
|
|
26
|
+
const res = await doFetch(`${api}/flags`, { headers });
|
|
27
|
+
if (!res.ok) throw new Error(`Failed to list flags (${res.status})`);
|
|
28
|
+
return (await res.json()).flags;
|
|
29
|
+
},
|
|
30
|
+
async get(key) {
|
|
31
|
+
const res = await doFetch(path(key), { headers });
|
|
32
|
+
if (res.status === 404) return null;
|
|
33
|
+
if (!res.ok) throw new Error(`Failed to read flag "${key}" (${res.status})`);
|
|
34
|
+
return await res.json();
|
|
35
|
+
},
|
|
36
|
+
async put(key, input) {
|
|
37
|
+
const res = await doFetch(path(key), { method: "PUT", headers, body: JSON.stringify(input) });
|
|
38
|
+
if (!res.ok)
|
|
39
|
+
throw new Error(`Failed to save flag "${key}" (${res.status}): ${await res.text()}`);
|
|
40
|
+
return await res.json();
|
|
41
|
+
},
|
|
42
|
+
async delete(key) {
|
|
43
|
+
const res = await doFetch(path(key), { method: "DELETE", headers });
|
|
44
|
+
if (!res.ok && res.status !== 404)
|
|
45
|
+
throw new Error(`Failed to delete flag "${key}" (${res.status})`);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function requireFlag(flag, key) {
|
|
50
|
+
if (!flag) throw new Error(`Flag "${key}" not found`);
|
|
51
|
+
return flag;
|
|
52
|
+
}
|
|
53
|
+
function createFlag(client, key, opts) {
|
|
54
|
+
return client.put(key, {
|
|
55
|
+
enabled: opts.enabled ?? false,
|
|
56
|
+
rollout: { percentage: opts.percentage ?? 0 },
|
|
57
|
+
rules: [],
|
|
58
|
+
description: opts.description ?? ""
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
async function toggleFlag(client, key, to) {
|
|
62
|
+
const flag = requireFlag(await client.get(key), key);
|
|
63
|
+
const enabled = to === "flip" ? !flag.enabled : to;
|
|
64
|
+
return client.put(key, {
|
|
65
|
+
enabled,
|
|
66
|
+
rollout: flag.rollout,
|
|
67
|
+
rules: flag.rules,
|
|
68
|
+
description: flag.description
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
async function setRollout(client, key, percentage) {
|
|
72
|
+
const flag = requireFlag(await client.get(key), key);
|
|
73
|
+
return client.put(key, {
|
|
74
|
+
enabled: flag.enabled,
|
|
75
|
+
rollout: { percentage },
|
|
76
|
+
rules: flag.rules,
|
|
77
|
+
description: flag.description
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
async function setRules(client, key, rules) {
|
|
81
|
+
const flag = requireFlag(await client.get(key), key);
|
|
82
|
+
return client.put(key, {
|
|
83
|
+
enabled: flag.enabled,
|
|
84
|
+
rollout: flag.rollout,
|
|
85
|
+
rules,
|
|
86
|
+
description: flag.description
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// src/generate.ts
|
|
91
|
+
function storageSnippet(storage) {
|
|
92
|
+
switch (storage) {
|
|
93
|
+
case "cloudflare-kv":
|
|
94
|
+
return {
|
|
95
|
+
imports: [`import { cloudflareKV } from '@flaghoist/adapter-cloudflare-kv'`],
|
|
96
|
+
expr: "cloudflareKV(env.FLAGS)",
|
|
97
|
+
pkg: "@flaghoist/adapter-cloudflare-kv"
|
|
98
|
+
};
|
|
99
|
+
case "redis":
|
|
100
|
+
return {
|
|
101
|
+
imports: [
|
|
102
|
+
`import { redisAdapter } from '@flaghoist/adapter-redis'`,
|
|
103
|
+
`import { Redis } from '@upstash/redis/cloudflare'`
|
|
104
|
+
],
|
|
105
|
+
expr: "redisAdapter(Redis.fromEnv(env))",
|
|
106
|
+
pkg: "@flaghoist/adapter-redis",
|
|
107
|
+
extraDeps: { "@upstash/redis": "^1.34.0" }
|
|
108
|
+
};
|
|
109
|
+
case "postgres":
|
|
110
|
+
return {
|
|
111
|
+
imports: [
|
|
112
|
+
`import { postgresAdapter } from '@flaghoist/adapter-postgres'`,
|
|
113
|
+
`import { Pool } from 'pg'`
|
|
114
|
+
],
|
|
115
|
+
expr: "postgresAdapter(new Pool({ connectionString: env.DATABASE_URL }))",
|
|
116
|
+
pkg: "@flaghoist/adapter-postgres",
|
|
117
|
+
extraDeps: { pg: "^8.13.0" }
|
|
118
|
+
};
|
|
119
|
+
case "memory":
|
|
120
|
+
return {
|
|
121
|
+
imports: [`import { memoryAdapter } from '@flaghoist/adapter-memory'`],
|
|
122
|
+
expr: "memoryAdapter()",
|
|
123
|
+
pkg: "@flaghoist/adapter-memory"
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function adminExpr(admin) {
|
|
128
|
+
return admin === "oidc" ? "oidc({ issuer: env.OIDC_ISSUER, audience: env.OIDC_AUDIENCE, groupsClaim: 'cognito:groups', allowedGroups: (env.ADMIN_GROUPS ?? '').split(',') })" : "bearerToken(env.ADMIN_TOKEN)";
|
|
129
|
+
}
|
|
130
|
+
function generateWorkerEntry(config) {
|
|
131
|
+
const storage = storageSnippet(config.storage);
|
|
132
|
+
const serverImports = [
|
|
133
|
+
"apiKey",
|
|
134
|
+
"createFlagServer",
|
|
135
|
+
config.auth.admin === "oidc" ? "oidc" : "bearerToken"
|
|
136
|
+
].sort();
|
|
137
|
+
const imports = [
|
|
138
|
+
...storage.imports,
|
|
139
|
+
`import { ${serverImports.join(", ")} } from '@flaghoist/server'`,
|
|
140
|
+
// A subpath import, so a Worker built with `dashboard = false` never pulls the HTML in.
|
|
141
|
+
...config.dashboard ? [`import { dashboardHtml } from '@flaghoist/server/dashboard'`] : []
|
|
142
|
+
].join("\n");
|
|
143
|
+
const origins = config.allowedOrigins && config.allowedOrigins.length > 0 ? `
|
|
144
|
+
allowedOrigins: ${JSON.stringify(config.allowedOrigins)},` : "";
|
|
145
|
+
const dashboard = config.dashboard ? "\n dashboard: dashboardHtml," : "";
|
|
146
|
+
return `${imports}
|
|
147
|
+
|
|
148
|
+
export default createFlagServer((env) => ({
|
|
149
|
+
storage: ${storage.expr},
|
|
150
|
+
auth: {
|
|
151
|
+
admin: ${adminExpr(config.auth.admin)},
|
|
152
|
+
read: apiKey(env.READ_API_KEY),
|
|
153
|
+
},${origins}${dashboard}
|
|
154
|
+
}))
|
|
155
|
+
`;
|
|
156
|
+
}
|
|
157
|
+
var KV_NAMESPACE_PLACEHOLDER = "<your-kv-namespace-id>";
|
|
158
|
+
function generateWranglerToml(config) {
|
|
159
|
+
const lines = [
|
|
160
|
+
`name = ${JSON.stringify(config.name)}`,
|
|
161
|
+
`main = "src/index.ts"`,
|
|
162
|
+
`compatibility_date = "2025-01-01"`
|
|
163
|
+
];
|
|
164
|
+
if (config.storage === "cloudflare-kv") {
|
|
165
|
+
lines.push(
|
|
166
|
+
"",
|
|
167
|
+
"# Created for you by `flaghoist deploy`, or by: npx wrangler kv namespace create FLAGS",
|
|
168
|
+
"kv_namespaces = [",
|
|
169
|
+
` { binding = "FLAGS", id = ${JSON.stringify(KV_NAMESPACE_PLACEHOLDER)} }`,
|
|
170
|
+
"]"
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
return `${lines.join("\n")}
|
|
174
|
+
`;
|
|
175
|
+
}
|
|
176
|
+
function needsKvNamespace(toml) {
|
|
177
|
+
return toml.includes(KV_NAMESPACE_PLACEHOLDER);
|
|
178
|
+
}
|
|
179
|
+
function fillKvNamespaceId(toml, id) {
|
|
180
|
+
return toml.replace(/^# Created for you by `flaghoist deploy`.*\n/m, "").replaceAll(KV_NAMESPACE_PLACEHOLDER, id);
|
|
181
|
+
}
|
|
182
|
+
function parseKvNamespaceId(output) {
|
|
183
|
+
const patterns = [
|
|
184
|
+
/\bid\s*=\s*"([0-9a-f]{32})"/i,
|
|
185
|
+
/"id"\s*:\s*"([0-9a-f]{32})"/i,
|
|
186
|
+
/\b([0-9a-f]{32})\b/i
|
|
187
|
+
];
|
|
188
|
+
for (const re of patterns) {
|
|
189
|
+
const match = re.exec(output);
|
|
190
|
+
if (match) return match[1];
|
|
191
|
+
}
|
|
192
|
+
return void 0;
|
|
193
|
+
}
|
|
194
|
+
function generatePackageJson(config) {
|
|
195
|
+
const storage = storageSnippet(config.storage);
|
|
196
|
+
const dependencies = {
|
|
197
|
+
"@flaghoist/server": "^0.1.0",
|
|
198
|
+
[storage.pkg]: "^0.1.0",
|
|
199
|
+
...storage.extraDeps
|
|
200
|
+
};
|
|
201
|
+
const pkg = {
|
|
202
|
+
name: config.name,
|
|
203
|
+
version: "0.0.0",
|
|
204
|
+
private: true,
|
|
205
|
+
type: "module",
|
|
206
|
+
scripts: { dev: "wrangler dev", deploy: "wrangler deploy" },
|
|
207
|
+
dependencies,
|
|
208
|
+
devDependencies: { wrangler: "^4.0.0" }
|
|
209
|
+
};
|
|
210
|
+
return `${JSON.stringify(pkg, null, 2)}
|
|
211
|
+
`;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// src/version.ts
|
|
215
|
+
import { createRequire } from "module";
|
|
216
|
+
var VERSION = createRequire(import.meta.url)("../package.json").version;
|
|
217
|
+
|
|
218
|
+
// src/index.ts
|
|
219
|
+
function writeFileSafe(path, content) {
|
|
220
|
+
mkdirSync(dirname(path) || ".", { recursive: true });
|
|
221
|
+
writeFileSync(path, content);
|
|
222
|
+
}
|
|
223
|
+
function loadConfig() {
|
|
224
|
+
if (!existsSync("flaghoist.toml")) {
|
|
225
|
+
throw new Error("No flaghoist.toml found in this directory. Run `flaghoist init` first.");
|
|
226
|
+
}
|
|
227
|
+
return parseConfig(readFileSync("flaghoist.toml", "utf8"));
|
|
228
|
+
}
|
|
229
|
+
function clientFrom(values) {
|
|
230
|
+
const url = values.url ?? process.env.FLAGS_URL;
|
|
231
|
+
const token = values.token ?? process.env.FLAGS_ADMIN_TOKEN;
|
|
232
|
+
if (!url) throw new Error("Missing server URL. Pass --url or set FLAGS_URL.");
|
|
233
|
+
if (!token) throw new Error("Missing admin token. Pass --token or set FLAGS_ADMIN_TOKEN.");
|
|
234
|
+
return createAdminClient({ url, token });
|
|
235
|
+
}
|
|
236
|
+
function flagState(flag) {
|
|
237
|
+
if (!flag.enabled) return "disabled";
|
|
238
|
+
const pct = flag.rollout.percentage;
|
|
239
|
+
return pct >= 100 ? "on" : pct <= 0 ? "off" : `${pct}%`;
|
|
240
|
+
}
|
|
241
|
+
function printFlag(flag) {
|
|
242
|
+
const rules = flag.rules && flag.rules.length > 0 ? ` \xB7 ${flag.rules.length} rule(s)` : "";
|
|
243
|
+
console.log(`${flag.key.padEnd(28)} ${flagState(flag).padEnd(10)}${rules}`);
|
|
244
|
+
}
|
|
245
|
+
async function runFlag(args) {
|
|
246
|
+
const { values, positionals } = parseArgs({
|
|
247
|
+
args,
|
|
248
|
+
allowPositionals: true,
|
|
249
|
+
options: {
|
|
250
|
+
url: { type: "string" },
|
|
251
|
+
token: { type: "string" },
|
|
252
|
+
on: { type: "boolean" },
|
|
253
|
+
off: { type: "boolean" },
|
|
254
|
+
rollout: { type: "string" },
|
|
255
|
+
desc: { type: "string" },
|
|
256
|
+
file: { type: "string" }
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
const [sub, a, b] = positionals;
|
|
260
|
+
switch (sub) {
|
|
261
|
+
case "list": {
|
|
262
|
+
const flags = await clientFrom(values).list();
|
|
263
|
+
if (flags.length === 0) return console.log("No flags.");
|
|
264
|
+
for (const flag of flags.sort((x, y) => x.key.localeCompare(y.key))) printFlag(flag);
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
case "get": {
|
|
268
|
+
if (!a) throw new Error("Usage: flaghoist flag get <key>");
|
|
269
|
+
const flag = await clientFrom(values).get(a);
|
|
270
|
+
if (!flag) {
|
|
271
|
+
console.error(`Flag "${a}" not found`);
|
|
272
|
+
process.exit(1);
|
|
273
|
+
}
|
|
274
|
+
return console.log(JSON.stringify(flag, null, 2));
|
|
275
|
+
}
|
|
276
|
+
case "create": {
|
|
277
|
+
if (!a)
|
|
278
|
+
throw new Error('Usage: flaghoist flag create <key> [--on] [--rollout N] [--desc "..."]');
|
|
279
|
+
const flag = await createFlag(clientFrom(values), a, {
|
|
280
|
+
enabled: values.on ?? false,
|
|
281
|
+
percentage: values.rollout != null ? Number(values.rollout) : 0,
|
|
282
|
+
description: values.desc
|
|
283
|
+
});
|
|
284
|
+
console.log(`Created "${a}"`);
|
|
285
|
+
return printFlag(flag);
|
|
286
|
+
}
|
|
287
|
+
case "toggle": {
|
|
288
|
+
if (!a) throw new Error("Usage: flaghoist flag toggle <key> [--on|--off]");
|
|
289
|
+
const to = values.on ? true : values.off ? false : "flip";
|
|
290
|
+
return printFlag(await toggleFlag(clientFrom(values), a, to));
|
|
291
|
+
}
|
|
292
|
+
case "rollout": {
|
|
293
|
+
if (!a || b == null) throw new Error("Usage: flaghoist flag rollout <key> <percentage>");
|
|
294
|
+
return printFlag(await setRollout(clientFrom(values), a, Number(b)));
|
|
295
|
+
}
|
|
296
|
+
case "delete": {
|
|
297
|
+
if (!a) throw new Error("Usage: flaghoist flag delete <key>");
|
|
298
|
+
await clientFrom(values).delete(a);
|
|
299
|
+
return console.log(`Deleted "${a}"`);
|
|
300
|
+
}
|
|
301
|
+
case "rules": {
|
|
302
|
+
if (a !== "set" || !b)
|
|
303
|
+
throw new Error("Usage: flaghoist flag rules set <key> --file rules.json");
|
|
304
|
+
if (!values.file) throw new Error("Missing --file <rules.json>");
|
|
305
|
+
const rules = JSON.parse(readFileSync(values.file, "utf8"));
|
|
306
|
+
if (!Array.isArray(rules)) throw new Error("Rules file must contain a JSON array");
|
|
307
|
+
const flag = await setRules(clientFrom(values), b, rules);
|
|
308
|
+
console.log(`Updated rules for "${b}"`);
|
|
309
|
+
return printFlag(flag);
|
|
310
|
+
}
|
|
311
|
+
default:
|
|
312
|
+
throw new Error(`Unknown flag command: ${sub ?? "(none)"}. Try "flaghoist flag list".`);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
function runInit(args) {
|
|
316
|
+
const { values } = parseArgs({
|
|
317
|
+
args,
|
|
318
|
+
allowPositionals: true,
|
|
319
|
+
options: { name: { type: "string" }, storage: { type: "string" } }
|
|
320
|
+
});
|
|
321
|
+
if (existsSync("flaghoist.toml")) throw new Error("flaghoist.toml already exists.");
|
|
322
|
+
if (values.storage && !STORAGE_KINDS.includes(values.storage)) {
|
|
323
|
+
throw new Error(`Unknown storage "${values.storage}". One of: ${STORAGE_KINDS.join(", ")}.`);
|
|
324
|
+
}
|
|
325
|
+
const config = {
|
|
326
|
+
...DEFAULT_CONFIG,
|
|
327
|
+
name: values.name ?? DEFAULT_CONFIG.name,
|
|
328
|
+
storage: values.storage ?? DEFAULT_CONFIG.storage
|
|
329
|
+
};
|
|
330
|
+
writeFileSync("flaghoist.toml", serializeConfig(config));
|
|
331
|
+
console.log("Created flaghoist.toml");
|
|
332
|
+
console.log("Next: `flaghoist deploy` to ship it, or `flaghoist eject` to own the code.");
|
|
333
|
+
}
|
|
334
|
+
function writeProject(config, dir) {
|
|
335
|
+
writeFileSafe(join(dir, "src/index.ts"), generateWorkerEntry(config));
|
|
336
|
+
writeFileSafe(join(dir, "wrangler.toml"), generateWranglerToml(config));
|
|
337
|
+
writeFileSafe(join(dir, "package.json"), generatePackageJson(config));
|
|
338
|
+
}
|
|
339
|
+
function runEject() {
|
|
340
|
+
const config = loadConfig();
|
|
341
|
+
if (existsSync("src/index.ts")) throw new Error("src/index.ts already exists \u2014 already ejected?");
|
|
342
|
+
writeProject(config, ".");
|
|
343
|
+
console.log("Ejected to a code project you own: src/index.ts, wrangler.toml, package.json");
|
|
344
|
+
if (config.storage === "cloudflare-kv") {
|
|
345
|
+
console.log("Create your KV namespace and paste the id into wrangler.toml:");
|
|
346
|
+
console.log(" npx wrangler kv namespace create FLAGS");
|
|
347
|
+
}
|
|
348
|
+
console.log("Edit src/index.ts freely, then: npm install && npx wrangler deploy");
|
|
349
|
+
}
|
|
350
|
+
function ensureKvNamespace(config) {
|
|
351
|
+
if (config.storage !== "cloudflare-kv") return;
|
|
352
|
+
const toml = readFileSync("wrangler.toml", "utf8");
|
|
353
|
+
if (!needsKvNamespace(toml)) return;
|
|
354
|
+
console.log("Creating the FLAGS KV namespace...");
|
|
355
|
+
const created = spawnSync("npx", ["wrangler", "kv", "namespace", "create", "FLAGS"], {
|
|
356
|
+
stdio: ["inherit", "pipe", "inherit"],
|
|
357
|
+
encoding: "utf8"
|
|
358
|
+
});
|
|
359
|
+
const output = created.stdout ?? "";
|
|
360
|
+
if (output) process.stdout.write(output);
|
|
361
|
+
if (created.status !== 0) {
|
|
362
|
+
throw new Error(
|
|
363
|
+
"Could not create the KV namespace. Run `npx wrangler kv namespace create FLAGS` yourself, then paste the id into wrangler.toml."
|
|
364
|
+
);
|
|
365
|
+
}
|
|
366
|
+
const id = parseKvNamespaceId(output);
|
|
367
|
+
if (!id) {
|
|
368
|
+
throw new Error(
|
|
369
|
+
"Created the namespace but could not read its id from wrangler output. Paste the id above into wrangler.toml, then run `flaghoist deploy` again."
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
writeFileSync("wrangler.toml", fillKvNamespaceId(toml, id));
|
|
373
|
+
console.log(`Bound FLAGS to namespace ${id} in wrangler.toml`);
|
|
374
|
+
}
|
|
375
|
+
function runDeploy() {
|
|
376
|
+
const config = loadConfig();
|
|
377
|
+
if (!existsSync("src/index.ts")) writeProject(config, ".");
|
|
378
|
+
ensureKvNamespace(config);
|
|
379
|
+
console.log("Deploying with wrangler...");
|
|
380
|
+
const result = spawnSync("npx", ["wrangler", "deploy"], { stdio: "inherit" });
|
|
381
|
+
process.exit(result.status ?? 0);
|
|
382
|
+
}
|
|
383
|
+
function printHelp() {
|
|
384
|
+
console.log(`flaghoist ${VERSION} \u2014 hoist your own feature flags
|
|
385
|
+
|
|
386
|
+
Usage: flaghoist <command>
|
|
387
|
+
|
|
388
|
+
Scaffolding
|
|
389
|
+
init [--name N] [--storage cloudflare-kv|redis|postgres|memory]
|
|
390
|
+
eject Generate a code project you own
|
|
391
|
+
deploy Deploy to Cloudflare via wrangler
|
|
392
|
+
|
|
393
|
+
Flag management (needs --url/--token or FLAGS_URL/FLAGS_ADMIN_TOKEN)
|
|
394
|
+
flag list
|
|
395
|
+
flag get <key>
|
|
396
|
+
flag create <key> [--on] [--rollout N] [--desc "..."]
|
|
397
|
+
flag toggle <key> [--on|--off]
|
|
398
|
+
flag rollout <key> <percentage>
|
|
399
|
+
flag rules set <key> --file rules.json
|
|
400
|
+
flag delete <key>`);
|
|
401
|
+
}
|
|
402
|
+
async function main() {
|
|
403
|
+
const [command, ...rest] = process.argv.slice(2);
|
|
404
|
+
switch (command) {
|
|
405
|
+
case "flag":
|
|
406
|
+
return runFlag(rest);
|
|
407
|
+
case "init":
|
|
408
|
+
return runInit(rest);
|
|
409
|
+
case "eject":
|
|
410
|
+
return runEject();
|
|
411
|
+
case "deploy":
|
|
412
|
+
return runDeploy();
|
|
413
|
+
case "-v":
|
|
414
|
+
case "--version":
|
|
415
|
+
return console.log(VERSION);
|
|
416
|
+
case void 0:
|
|
417
|
+
case "help":
|
|
418
|
+
case "-h":
|
|
419
|
+
case "--help":
|
|
420
|
+
return printHelp();
|
|
421
|
+
default:
|
|
422
|
+
console.error(`Unknown command: ${command}
|
|
423
|
+
`);
|
|
424
|
+
printHelp();
|
|
425
|
+
process.exit(1);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
main().then(() => process.exit(0)).catch((error) => {
|
|
429
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
430
|
+
process.exit(1);
|
|
431
|
+
});
|
package/dist/lib.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
type StorageKind = 'cloudflare-kv' | 'redis' | 'postgres' | 'memory';
|
|
2
|
+
type AdminAuthKind = 'bearer-token' | 'oidc';
|
|
3
|
+
interface FlaghoistConfig {
|
|
4
|
+
name: string;
|
|
5
|
+
storage: StorageKind;
|
|
6
|
+
auth: {
|
|
7
|
+
admin: AdminAuthKind;
|
|
8
|
+
read: 'api-key';
|
|
9
|
+
};
|
|
10
|
+
allowedOrigins?: string[];
|
|
11
|
+
/** Serve the admin dashboard at `/admin`. On by default. */
|
|
12
|
+
dashboard: boolean;
|
|
13
|
+
}
|
|
14
|
+
declare const DEFAULT_CONFIG: FlaghoistConfig;
|
|
15
|
+
/** Every storage backend selectable by name in `flaghoist.toml`. */
|
|
16
|
+
declare const STORAGE_KINDS: readonly StorageKind[];
|
|
17
|
+
/** Parse a `flaghoist.toml` into a validated config, falling back to defaults for unknown values. */
|
|
18
|
+
declare function parseConfig(text: string): FlaghoistConfig;
|
|
19
|
+
/** Render a config back to `flaghoist.toml` text. */
|
|
20
|
+
declare function serializeConfig(config: FlaghoistConfig): string;
|
|
21
|
+
|
|
22
|
+
export { type AdminAuthKind, DEFAULT_CONFIG, type FlaghoistConfig, STORAGE_KINDS, type StorageKind, parseConfig, serializeConfig };
|
package/dist/lib.js
ADDED
package/package.json
CHANGED
|
@@ -1,25 +1,60 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flaghoist",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Scaffold, deploy, and manage your Flaghoist feature-flag service from the terminal.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"flaghoist": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": {
|
|
13
|
+
"types": "./dist/lib.d.ts",
|
|
14
|
+
"default": "./dist/lib.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"./package.json": "./package.json"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=20"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"smol-toml": "^1.7.1"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@flaghoist/adapter-memory": "0.1.1",
|
|
30
|
+
"@flaghoist/core": "0.1.1",
|
|
31
|
+
"@flaghoist/server": "0.1.1"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
11
35
|
},
|
|
12
36
|
"keywords": [
|
|
13
37
|
"feature-flags",
|
|
14
|
-
"feature-
|
|
38
|
+
"feature-toggles",
|
|
15
39
|
"openfeature",
|
|
16
40
|
"ofrep",
|
|
17
|
-
"
|
|
41
|
+
"cloudflare-workers",
|
|
42
|
+
"self-hosted",
|
|
43
|
+
"cli"
|
|
18
44
|
],
|
|
19
|
-
"
|
|
20
|
-
"
|
|
45
|
+
"repository": {
|
|
46
|
+
"type": "git",
|
|
47
|
+
"url": "git+https://github.com/flaghoist/flaghoist.git",
|
|
48
|
+
"directory": "packages/cli"
|
|
21
49
|
},
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
50
|
+
"homepage": "https://github.com/flaghoist/flaghoist#readme",
|
|
51
|
+
"bugs": {
|
|
52
|
+
"url": "https://github.com/flaghoist/flaghoist/issues"
|
|
53
|
+
},
|
|
54
|
+
"scripts": {
|
|
55
|
+
"build": "tsup src/index.ts src/lib.ts --format esm --dts --clean",
|
|
56
|
+
"test": "vitest run --passWithNoTests",
|
|
57
|
+
"typecheck": "tsc --noEmit",
|
|
58
|
+
"check:package": "publint --strict && attw --pack . --profile esm-only"
|
|
59
|
+
}
|
|
60
|
+
}
|
package/bin.js
DELETED