Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .hintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": [
"development"
],
"hints": {
"typescript-config/consistent-casing": "off",
"typescript-config/strict": "off"
}
}
2 changes: 2 additions & 0 deletions .history/packages/react/src/index_20240529172407.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { createAbby, type withDevtoolsFunction, type ABTestReturnValue } from "./context";
export { type ABConfig, type AbbyConfig, defineConfig } from "@tryabby/core";
2 changes: 2 additions & 0 deletions .history/packages/react/src/index_20240530155809.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { createAbby, type withDevtoolsFunction, type ABTestReturnValue } from "./context";
export { type ABConfig, type AbbyConfig, defineConfig } from "@tryabby/core";
2 changes: 2 additions & 0 deletions .history/packages/react/src/index_20240530162245.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { createAbby, type withDevtoolsFunction, type ABTestReturnValue } from "./context";
export { type ABConfig, type AbbyConfig, defineConfig } from "@tryabby/core";
4 changes: 4 additions & 0 deletions .history/packages/vue/dist/useAbby.d_20240530164028.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export declare function useAbby(experimentName: string): {
variant: import("vue").Ref<any>;
onAct: any;
Comment on lines +2 to +3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specify more precise types instead of any for better type safety.

-    variant: import("vue").Ref<any>;
-    onAct: any;
+    variant: import("vue").Ref<VariantType>; // Define VariantType as needed
+    onAct: (action: ActionType) => void; // Define ActionType as needed

Committable suggestion was skipped due low confidence.

};
4 changes: 4 additions & 0 deletions .history/packages/vue/dist/useAbby.d_20240530164251.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export declare function useAbby(experimentName: string): {
variant: import("vue").Ref<any>;
onAct: any;
};
17 changes: 17 additions & 0 deletions .history/packages/vue/dist/useAbby.d_20240530164253.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { ref, onMounted } from 'vue';
import { createAbby } from '@tryabby/core';
import type { ABTestReturnValue } from '@tryabby/core';

export function useAbby(experimentName: string): ABTestReturnValue {
const abby = createAbby();
const variant = ref<string | null>(null);

onMounted(() => {
variant.value = abby.getVariant(experimentName);
});

return {
variant,
onAct: abby.onAct
};
}
5 changes: 5 additions & 0 deletions .history/packages/vue/dist/useAbby.d_20240530164259.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export declare function useAbby(experimentName: string): {
variant: import("vue").Ref<any>;
onAct: any;
};
a
4 changes: 4 additions & 0 deletions .history/packages/vue/dist/useAbby.d_20240530164303.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export declare function useAbby(experimentName: string): {
variant: import("vue").Ref<any>;
onAct: any;
};
47 changes: 47 additions & 0 deletions .history/packages/vue/package_20240530163311.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "vue",
"version": "0.0.0",
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "run-p type-check \"build-only {@}\" --",
"preview": "vite preview",
"test:unit": "vitest",
"test:e2e": "start-server-and-test preview http://localhost:4173 'cypress run --e2e'",
"test:e2e:dev": "start-server-and-test 'vite dev --port 4173' http://localhost:4173 'cypress open --e2e'",
"build-only": "vite build",
"type-check": "vue-tsc --build --force",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
"format": "prettier --write src/"
},
"dependencies": {
"@tryabby/core": "workspace:^",
"@vue/compiler-sfc": "^3.4.27",
"vue": "^3.4.21"
},
"devDependencies": {
"@rushstack/eslint-patch": "^1.8.0",
"@tsconfig/node20": "^20.1.4",
"@types/jsdom": "^21.1.6",
"@types/node": "^20.12.5",
"@vitejs/plugin-vue": "^5.0.4",
"@vue/eslint-config-prettier": "^9.0.0",
"@vue/eslint-config-typescript": "^13.0.0",
"@vue/test-utils": "^2.4.5",
"@vue/tsconfig": "^0.5.1",
"cypress": "^13.7.2",
"eslint": "^8.57.0",
"eslint-plugin-cypress": "^2.15.1",
"eslint-plugin-vue": "^9.23.0",
"jsdom": "^24.0.0",
"npm-run-all2": "^6.1.2",
"prettier": "^3.2.5",
"start-server-and-test": "^2.0.3",
"typescript": "~5.4.2",
"vite": "^5.2.8",
"vite-plugin-vue-devtools": "^7.0.25",
"vitest": "^1.4.0",
"vue-tsc": "^2.0.11"
}
}
48 changes: 48 additions & 0 deletions .history/packages/vue/package_20240530163408.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"name": "vue",
"version": "0.0.0",
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "run-p type-check \"build-only {@}\" --",
"preview": "vite preview",
"test:unit": "vitest",
"test:e2e": "start-server-and-test preview http://localhost:4173 'cypress run --e2e'",
"test:e2e:dev": "start-server-and-test 'vite dev --port 4173' http://localhost:4173 'cypress open --e2e'",
"build-only": "vite build",
"type-check": "vue-tsc --build --force",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
"format": "prettier --write src/"
},
"dependencies": {
"@tryabby/core": "workspace:^",
"@vue/compiler-sfc": "^3.4.27",
"vue": "^3.4.21"
},
"devDependencies": {
"@rushstack/eslint-patch": "^1.8.0",
"@tsconfig/node20": "^20.1.4",
"@types/jsdom": "^21.1.6",
"@types/node": "^20.12.5",
"@vitejs/plugin-vue": "^5.0.4",
"@vue/eslint-config-prettier": "^9.0.0",
"@vue/eslint-config-typescript": "^13.0.0",
"@vue/test-utils": "^2.4.5",
"@vue/tsconfig": "^0.5.1",
"cypress": "^13.7.2",
"eslint": "^8.57.0",
"eslint-plugin-cypress": "^2.15.1",
"eslint-plugin-vue": "^9.23.0",
"jsdom": "^24.0.0",
"npm-run-all2": "^6.1.2",
"prettier": "^3.2.5",
"start-server-and-test": "^2.0.3",
"typescript": "~5.4.2",
"vite": "^5.2.8",
"vite-plugin-vue-devtools": "^7.0.25",
"vitest": "^1.4.0",
"vue-tsc": "^2.0.11"
}
}
a
Empty file.
20 changes: 20 additions & 0 deletions .history/packages/vue/package_20240530163417.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "@tryabby/vue",
"version": "0.1.0",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"build": "tsc",
"test": "jest"
},
"dependencies": {
"@tryabby/core": "^1.0.0",
"vue": "^3.0.0"
},
"devDependencies": {
"typescript": "^4.0.0",
"@vue/compiler-sfc": "^3.0.0",
"jest": "^26.0.0",
"@types/jest": "^26.0.0"
}
}
Empty file.
20 changes: 20 additions & 0 deletions .history/packages/vue/src/context_20240530162009.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { inject, provide, reactive } from 'vue';

const AbbySymbol = Symbol();

export function provideAbby(abby) {
const state = reactive({
flags: abby.getFeatureFlags(),
tests: abby.getTests(),
});

provide(AbbySymbol, state);
}

export function useFeatureFlag(flagName) {
const abby = inject(AbbySymbol);
if (!abby) {
throw new Error("useFeatureFlag must be used within a component that provides Abby data.");
}
return abby.flags[flagName];
}
Empty file.
3 changes: 3 additions & 0 deletions .history/packages/vue/src/index_20240530163802.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export { useAbby } from './useAbby';
export { useFeatureFlag } from './useFeatureFlag';
export { useRemoteConfig } from './useRemoteConfig';
6 changes: 6 additions & 0 deletions .history/packages/vue/src/main_20240530155710.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import './assets/main.css'

import { createApp } from 'vue'
import App from './App.vue'

createApp(App).mount('#app')
6 changes: 6 additions & 0 deletions .history/packages/vue/src/main_20240530155817.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import './assets/main.css'

import { createApp } from 'vue'
import App from './App.vue'

createApp(App).mount('#app')
2 changes: 2 additions & 0 deletions .history/packages/vue/src/main_20240530155819.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { createAbby, type withDevtoolsFunction, type ABTestReturnValue } from "./context";
export { type ABConfig, type AbbyConfig, defineConfig } from "@tryabby/core";
2 changes: 2 additions & 0 deletions .history/packages/vue/src/main_20240530162023.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { createAbby, type withDevtoolsFunction, type ABTestReturnValue } from "./context";
export { type ABConfig, type AbbyConfig, defineConfig } from "@tryabby/core";
2 changes: 2 additions & 0 deletions .history/packages/vue/src/main_20240530162028.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { createAbby, type withDevtoolsFunction, type ABTestReturnValue } from "./";
export { type ABConfig, type AbbyConfig, defineConfig } from "@tryabby/core";
2 changes: 2 additions & 0 deletions .history/packages/vue/src/main_20240530162037.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { createAbby, type withDevtoolsFunction, type ABTestReturnValue } from "./packages/vue/src/context.tsx";
export { type ABConfig, type AbbyConfig, defineConfig } from "@tryabby/core";
6 changes: 6 additions & 0 deletions .history/packages/vue/src/main_20240530162052.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import './assets/main.css'

import { createApp } from 'vue'
import App from './App.vue'

createApp(App).mount('#app')
Empty file.
6 changes: 6 additions & 0 deletions .history/packages/vue/src/main_20240530162113.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import './assets/main.css'

import { createApp } from 'vue'
import App from './App.vue'

createApp(App).mount('#app')
Empty file.
15 changes: 15 additions & 0 deletions .history/packages/vue/src/useAbby_20240530163549.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { onMounted, ref } from 'vue';
import { getCurrentVariant, onAct } from '@tryabby/core';

export function useAbby(experimentName: string) {
const variant = ref<string | null>(null);

onMounted(() => {
variant.value = getCurrentVariant(experimentName);
});

return {
variant,
onAct
};
}
16 changes: 16 additions & 0 deletions .history/packages/vue/src/useAbby_20240530163710.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { onMounted, ref } from 'vue';
import { getCurrentVariant, onAct } from '@tryabby/core';

export function useAbby(experimentName: string) {
const variant = ref<string | null>(null);

onMounted(() => {
variant.value = getCurrentVariant(experimentName);
});

return {
variant,
onAct
};
}
a
15 changes: 15 additions & 0 deletions .history/packages/vue/src/useAbby_20240530163712.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { onMounted, ref } from 'vue';
import { getVariant, onAct } from '@tryabby/core';

export function useAbby(experimentName: string) {
const variant = ref<string | null>(null);

onMounted(() => {
variant.value = getVariant(experimentName);
});

return {
variant,
onAct
};
}
Empty file.
14 changes: 14 additions & 0 deletions .history/packages/vue/src/useFeatureFlag_20240530163740.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { onMounted, ref } from 'vue';
import { getFlag } from '@tryabby/core';

export function useFeatureFlag(flagName: string) {
const flagValue = ref<boolean | null>(null);

onMounted(() => {
flagValue.value = getFlag(flagName);
});

return {
flagValue
};
}
Empty file.
14 changes: 14 additions & 0 deletions .history/packages/vue/src/useRemoteConfig_20240530163751.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { onMounted, ref } from 'vue';
import { getConfig } from '@tryabby/core';

export function useRemoteConfig(configName: string) {
const configValue = ref<any>(null);

onMounted(() => {
configValue.value = getConfig(configName);
});

return {
configValue
};
}
Comment on lines +1 to +14
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The useRemoteConfig function is implemented correctly using Vue's composition API. However, consider specifying a more precise type than any for configValue.

- 5~
-  const configValue = ref<any>(null);
+  const configValue = ref<ConfigType | null>(null); // Replace `ConfigType` with the actual expected type

Committable suggestion was skipped due low confidence.

Empty file.
16 changes: 16 additions & 0 deletions .history/packages/vue/tests/useAbby.test_20240530163906.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { useAbby } from '../src/useAbby';
import { mount } from '@vue/test-utils';

test('useAbby returns correct variant', () => {
const experimentName = 'test-experiment';
const wrapper = mount({
template: '<div>{{ variant }}</div>',
setup() {
const { variant } = useAbby(experimentName);
return { variant };
}
});

// Mock the result to match your expectations
expect(wrapper.text()).toBe('variant-A'); // Assuming 'variant-A' is the expected result
});
Comment on lines +4 to +16
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider improving the test to reflect actual functionality rather than using a mocked result.

-  // Mock the result to match your expectations
-  expect(wrapper.text()).toBe('variant-A'); // Assuming 'variant-A' is the expected result
+  // TODO: Implement a more realistic test that does not rely on mocked results

Committable suggestion was skipped due low confidence.

17 changes: 17 additions & 0 deletions .history/packages/vue/tsconfig_20240530155710.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"files": [],
"references": [
{
"path": "./tsconfig.node.json"
},
{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.vitest.json"
}
],
"compilerOptions": {
"module": "NodeNext"
}
}
17 changes: 17 additions & 0 deletions .history/packages/vue/tsconfig_20240530160123.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"files": [],
"references": [
{
"path": "./tsconfig.node.json"
},
{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.vitest.json"
}
],
"compilerOptions": {
"module": "NodeNext"
}
}
Empty file.
Loading