Skip to content

Commit 75f7777

Browse files
committed
fix: fix build
1 parent 6e237b7 commit 75f7777

10 files changed

+22
-151
lines changed

Earthfile

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
FROM node:14-alpine
1+
FROM node:18-alpine
22
WORKDIR /app
33

44
install:
55
COPY package.json ./
6-
COPY yarn.lock ./
7-
RUN yarn install
6+
COPY package-lock.json ./
7+
RUN npm install
88
COPY . .
99

1010
test:
1111
FROM +install
12-
RUN yarn typecheck
13-
RUN yarn test
12+
RUN npm run typecheck
13+
RUN npm run test
1414

1515
build:
1616
FROM +install
17-
RUN yarn build
17+
RUN npm run build
1818
SAVE ARTIFACT lib AS LOCAL ./lib
1919

2020
publish:

README.md

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ Progressive and type-safe feature flags.
44

55
An easy way to increase your deployment frequency and reduce stress of releases.
66

7-
[The library has just been released and I'm looking for your advice!](https://github.com/WitoDelnat/keat/issues/4)
8-
97
## Key Features
108

119
- 🚀 Progressive rollouts, 🎯 targeted audiences and 📅 scheduled launches.

migration-storybook.log

-97
This file was deleted.

src/core/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export type Config = Record<string, Rule | Rule[] | undefined>;
4646

4747
export type KeatInit<TFeatures extends AnyFeatures> = {
4848
features: TFeatures;
49-
plugins?: Plugin[];
49+
plugins?: Plugin<any>[];
5050
display?: Display;
5151
};
5252

src/plugins/localConfig.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { Config, Rule } from "../core";
2-
import { Plugin } from "../core/plugin";
2+
import { createPlugin } from "../core/plugin";
33

4-
export const localConfig = (config: Config): Plugin => {
5-
return {
4+
export const localConfig = (config: Config) => {
5+
return createPlugin({
66
onPluginInit: async (_ctx, { setConfig }) => {
77
setConfig(config);
88
},
99
matcher: (literal) => literal,
1010
evaluate: () => false,
11-
};
11+
});
1212
};
1313

1414
export function fromEnv(value?: string): Rule | undefined {

src/plugins/localStorage.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ type Options = {
3232
export const localStorage = (
3333
name: string,
3434
{ key, value, poll = false }: Options = {}
35-
): Plugin => {
35+
) => {
3636
const hasLocalStorage = typeof window !== "undefined" && window.localStorage;
3737
const hasSetInterval = typeof window !== "undefined" && window.setInterval;
3838
if (!hasLocalStorage || !hasSetInterval) return createNoopPlugin();

src/plugins/queryParam.ts

+1-31
Original file line numberDiff line numberDiff line change
@@ -16,37 +16,7 @@ type Options = {
1616
value?: string;
1717
};
1818

19-
// /**
20-
// * Toggles features based on the URL's query parameter.
21-
// */
22-
// export const queryParam = (
23-
// name: string,
24-
// { key, value }: Options = {}
25-
// ): Plugin => {
26-
// return {
27-
// onEval({ variates, rules }, { setResult }) {
28-
// if (typeof window === "undefined") return;
29-
30-
// const index = rules.findIndex((rule) =>
31-
// takeStrings(rule).some((r) => {
32-
// if (r !== name) return false;
33-
// const queryString = window.location.search;
34-
// const params = new URLSearchParams(queryString);
35-
// return value
36-
// ? params.get(key ?? name) === value
37-
// : params.has(key ?? name);
38-
// })
39-
// );
40-
41-
// if (index !== -1) setResult(variates[index]);
42-
// },
43-
// };
44-
// };
45-
46-
export const queryParam = (
47-
name: string,
48-
{ key, value }: Options = {}
49-
): Plugin => {
19+
export const queryParam = (name: string, { key, value }: Options = {}) => {
5020
return createPlugin({
5121
matcher: isString,
5222
evaluate({ literal }) {

src/plugins/remoteConfig.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Config } from "../core";
2-
import { Plugin } from "../core/plugin";
2+
import { createPlugin } from "../core/plugin";
33

44
type RemoteConfigPluginOptions = {
55
interval?: number;
@@ -13,7 +13,7 @@ const DEFAULT_OPTIONS = {
1313
export const remoteConfig = (
1414
url: string,
1515
rawOptions?: RemoteConfigPluginOptions
16-
): Plugin => {
16+
) => {
1717
const options = { ...DEFAULT_OPTIONS, ...rawOptions };
1818

1919
const fetchConfig = async (url: string) => {
@@ -48,7 +48,7 @@ export const remoteConfig = (
4848
}
4949
};
5050

51-
return {
51+
return createPlugin({
5252
onPluginInit: async (_ctx, { setConfig }) => {
5353
const remoteConfig = await fetchConfig(url);
5454
setConfig(remoteConfig);
@@ -59,7 +59,7 @@ export const remoteConfig = (
5959
},
6060
matcher: (literal) => literal,
6161
evaluate: () => false,
62-
};
62+
});
6363
};
6464

6565
function pause(ms: number): Promise<void> {

src/plugins/schedule.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createPlugin, isString, Plugin } from "../core";
1+
import { createPlugin, isString } from "../core";
22

33
const DAYS = [
44
"sunday",
@@ -10,14 +10,14 @@ const DAYS = [
1010
"saturday",
1111
] as const;
1212

13-
type Day = typeof DAYS[number];
13+
type Day = (typeof DAYS)[number];
1414
type Period = { from: number; to: number };
1515
type Schedule = Partial<Record<Day, Period[]>>;
1616

1717
export const businessHours = (
1818
name: string,
1919
schedule: Schedule = DEFAULT_SCHEDULE
20-
): Plugin => {
20+
) => {
2121
return createPlugin({
2222
matcher: isString,
2323
evaluate({ literal }) {

src/plugins/timeInterval.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { createPlugin, isString, Plugin } from "../core";
1+
import { createPlugin, isString } from "../core";
22

3-
export const timeInterval = (): Plugin => {
3+
export const timeInterval = () => {
44
return createPlugin({
55
matcher: isString,
66
evaluate({ literal }) {

0 commit comments

Comments
 (0)