Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

216 Evaluate yarn workspaces to accommodate nohoist feature #224

Draft
wants to merge 4 commits into
base: 200-investigate-a-way-to-develop-and-test-components-on-both-vue-versions
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion build/postbuild.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { existsSync } from 'fs';
import { appendFile, mkdir, readFile, rm, writeFile } from 'fs/promises';
import glob from 'glob';
import sass from 'sass';
import * as sass from 'sass';

const COMPONENT_STYLE_COMMENT = '\n/** Lume component styles */\n';

Expand Down
32 changes: 0 additions & 32 deletions nx.json

This file was deleted.

58 changes: 21 additions & 37 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@
"version": "0.5.3",
"description": "Lume is a component library for visual representations of data, built for Vue with D3.",
"type": "module",
"workspaces": [
"packages/lib",
"packages/vue2",
"packages/vue3"
],
"private": true,
"workspaces": {
"packages": [
"packages/*"
],
"nohoist": [
"**/@storybook/**",
"**/@vue/test-utils",
"**/@vue/test-utils/**"
]
},
"license": "MIT",
"contributors": [
{
Expand All @@ -32,17 +38,18 @@
"url": "https://github.com/Adyen/lume.git"
},
"scripts": {
"build": "nx run-many --target=build",
"build": "yarn workspace @adyen/lume run build & yarn workspace @adyen/lume-vue3 run build",
"build:storybook": "NODE_ENV=production build-storybook -c .storybook -o storybook",
"confighooks": "git config core.hooksPath ./git-hooks",
"prepare": "npm run confighooks && echo \" ✔ Git hooks path configured to ./git-hooks\"",
"prepare": "yarn run confighooks && echo \" ✔ Git hooks path configured to ./git-hooks\"",
"release": "release-it",
"storybook:vue2": "npm run storybook --workspace=packages/vue2",
"storybook:vue3": "npm run storybook --workspace=packages/vue3",
"test": "nx test lib",
"test:watch": "nx test:watch lib",
"test:update:snapshot": "nx test:update:snapshot lib",
"test:coverage": "nx test:coverage lib"
"storybook:vue2": "yarn workspace @adyen/lume run storybook",
"storybook:vue3": "yarn workspace @adyen/lume-vue3 run storybook",
"storybook": "yarn workspace @adyen/lume run storybook & yarn workspace @adyen/lume-vue3 run storybook",
"test": "yarn workspace @adyen/lume-core run test",
"test:vue2": "yarn workspace @adyen/lume run test",
"test:vue3": "yarn workspace @adyen/lume-vue3 run test",
"pack": "yarn workspace @adyen/lume-vue3 pack & yarn workspace @adyen/lume pack"
},
"dependencies": {
"@popperjs/core": "^2.11.4",
Expand All @@ -51,44 +58,21 @@
},
"devDependencies": {
"@release-it-plugins/workspaces": "^3.2.0",
"@storybook/addon-a11y": "^7.0.11",
"@storybook/addon-essentials": "^7.0.11",
"@storybook/cli": "^7.0.11",
"@storybook/manager-api": "^7.0.11",
"@storybook/theming": "^7.0.11",
"@types/d3": "^7.4.0",
"@types/d3-sankey": "^0.12.0",
"@types/jest": "^29.2.2",
"@types/node": "^18.11.5",
"@typescript-eslint/eslint-plugin": "^5.17.0",
"@typescript-eslint/parser": "^5.43.0",
"@vitest/coverage-istanbul": "^0.27.0",
"@vue/test-utils": "^2.3.0",
"auto-changelog": "^2.4.0",
"css-loader": "^6.7.2",
"eslint": "^8.27.0",
"eslint-plugin-vue": "^9.9.0",
"glob": "^8.0.3",
"html-webpack-plugin": "^5.5.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.3.1",
"jsdom": "^20.0.3",
"mini-css-extract-plugin": "^2.7.0",
"nx": "14.8.2",
"prettier": "^2.7.1",
"release-it": "^15.6.0",
"resize-observer-polyfill": "^1.5.1",
"sass": "^1.43.4",
"sass": "^1.63.6",
"sass-loader": "^13.2.0",
"ts-jest": "^29.0.3",
"typescript": "^4.6.3",
"vite": "^4.0.0",
"vite-plugin-static-copy": "^0.13.0",
"vitest": "^0.27.0",
"vue": "^3.2.47",
"vue-loader": "^15.10.0",
"vue-style-loader": "^4.1.3",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.0"
},
Expand Down
19 changes: 9 additions & 10 deletions packages/lib/package.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
{
"name": "@adyen/lume-core",
"version": "*",
"version": "0.5.3",
"private": true,
"description": "",
"main": "index.js",
"directories": {
"test": "test"
},
"exports": {
".": "./src/index.ts",
"./plugin": "./src/plugin.ts",
"./font": "./src/styles/font.scss"
},
"scripts": {
"lint:fix": "npm run lint -- --fix",
"lint:fix": "yarn run lint -- --fix",
"lint:pretty": "prettier --write --ignore-unknown .",
"lint": "eslint ./src ./test --ext .js,.ts,.vue",
"test": "vitest run --config=vitest.config.ts --silent",
"test:watch": "vitest --config=vitest.config.ts",
"test:update:snapshot": "vitest --config=vitest.config.ts -u",
"test:coverage": "vitest run --coverage"
"lint": "eslint ./src ./test --ext .js,.ts,.vue"
},
"devDependencies": {
"@storybook/addon-actions": "^7.0.22",
"@vue/test-utils": "^2.3.2",
"vitest": "^0.32.0"
},
"keywords": [],
"author": "",
Expand Down
5 changes: 0 additions & 5 deletions packages/lib/project.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe('lume-alluvial-diagram.vue', () => {

const data = [{ values }];

mount(LumeAlluvialDiagram, { props: { data } });
mount(LumeAlluvialDiagram, { props: { data }, propsData: { data } });

await nextTick();

Expand All @@ -101,7 +101,7 @@ describe('lume-alluvial-diagram.vue', () => {
},
];

mount(LumeAlluvialDiagram, { props: { data } });
mount(LumeAlluvialDiagram, { props: { data }, propsData: { data } });

await nextTick();

Expand Down Expand Up @@ -139,7 +139,7 @@ describe('lume-alluvial-diagram.vue', () => {
},
];

mount(LumeAlluvialDiagram, { props: { data } });
mount(LumeAlluvialDiagram, { props: { data }, propsData: { data } });

await nextTick();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@ describe('lume-single-bar-chart.vue', () => {

// check +ve bars
expect(
el.findAllComponents('[data-j-lume-bar]')[0].props('isNegative')
el.findAllComponents('[data-j-lume-bar]').at(0).props('isNegative')
).toBeFalsy();
expect(
el.findAllComponents('[data-j-lume-bar]')[2].props('isNegative')
el.findAllComponents('[data-j-lume-bar]').at(2).props('isNegative')
).toBeFalsy();
expect(
el.findAllComponents('[data-j-lume-bar]')[3].props('isNegative')
el.findAllComponents('[data-j-lume-bar]').at(3).props('isNegative')
).toBeFalsy();
expect(
el.findAllComponents('[data-j-lume-bar]')[6].props('isNegative')
el.findAllComponents('[data-j-lume-bar]').at(6).props('isNegative')
).toBeFalsy();
expect(
el
Expand All @@ -71,10 +71,10 @@ describe('lume-single-bar-chart.vue', () => {
).toHaveLength(numberOfPositiveBars);
// check -ve bars
expect(
el.findAllComponents('[data-j-lume-bar]')[1].props('isNegative')
el.findAllComponents('[data-j-lume-bar]').at(1).props('isNegative')
).toBeTruthy();
expect(
el.findAllComponents('[data-j-lume-bar]')[4].props('isNegative')
el.findAllComponents('[data-j-lume-bar]').at(4).props('isNegative')
).toBeTruthy();
expect(
el
Expand All @@ -83,7 +83,7 @@ describe('lume-single-bar-chart.vue', () => {
).toHaveLength(numberOfNegativeBars);
// check null bars
expect(
el.findAllComponents('[data-j-lume-bar]')[5].props('isNegative')
el.findAllComponents('[data-j-lume-bar]').at(5).props('isNegative')
).toBeFalsy();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe('lume-sparkline.vue', () => {
data: mutatedData,
labels,
xScale,
options: { ...defaultOptions, showArea: true },
options: { showArea: true },
}).run().wrapper;

const el = wrapper.findComponent(LumeSparkline);
Expand Down
36 changes: 26 additions & 10 deletions packages/lib/src/components/core/lume-axis/lume-axis.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ const scale: Scale = scaleBand<number>()
describe('lume-axis.vue', () => {
test('mounts component and sets prop values', () => {
const wrapper = mount(LumeAxis, {
props: {
scale,
},
props: { scale },
propsData: { scale },
});

const el = wrapper.find('[data-j-axis]');
Expand All @@ -35,6 +34,10 @@ describe('lume-axis.vue', () => {
scale,
options: { skip: false },
},
propsData: {
scale,
options: { skip: false },
},
});

expect(
Expand All @@ -51,6 +54,10 @@ describe('lume-axis.vue', () => {
scale,
options: { skip },
},
propsData: {
scale,
options: { skip },
},
});

await nextTick();
Expand All @@ -64,31 +71,40 @@ describe('lume-axis.vue', () => {

describe('Events API', () => {
it('should dispatch `click` if user clicks an axis tick', async () => {
const wrapper = mount(LumeAxis, { props: { scale } });
const wrapper = mount(LumeAxis, {
props: { scale },
propsData: { scale },
});

const ticks = wrapper.findAll('[data-j-axis__tick=""]');

await ticks[0].trigger('click');
await ticks[3].trigger('click');
await ticks.at(0).trigger('click');
await ticks.at(3).trigger('click');

expect(wrapper.emitted()).toHaveProperty('click');
expect(wrapper.emitted().click).toHaveLength(2);
});

it('should dispatch `mouseenter` if user mouses over an axis tick', async () => {
const wrapper = mount(LumeAxis, { props: { scale } });
const wrapper = mount(LumeAxis, {
props: { scale },
propsData: { scale },
});

const ticks = wrapper.findAll('[data-j-axis__tick=""]');

await ticks[0].trigger('mouseenter');
await ticks[3].trigger('mouseenter');
await ticks.at(0).trigger('mouseenter');
await ticks.at(3).trigger('mouseenter');

expect(wrapper.emitted()).toHaveProperty('mouseenter');
expect(wrapper.emitted().mouseenter).toHaveLength(2);
});

it('should dispatch `mouseleave` if user moves mouse away from an axis', async () => {
const wrapper = mount(LumeAxis, { props: { scale } });
const wrapper = mount(LumeAxis, {
props: { scale },
propsData: { scale },
});

await wrapper.trigger('mouseleave');

Expand Down
Loading