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

Update deps use vite bundling #133

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
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
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module.exports = {
'plugin:@typescript-eslint/recommended',
'prettier',
],
ignorePatterns: ['dist/**'],
rules: {
'prettier/prettier': 'error',
'no-async-promise-executor': 'error',
Expand All @@ -20,7 +21,7 @@ module.exports = {
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
// giving false positives
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'error',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'error',
},
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
id: changesets
uses: changesets/action@v1
with:
version: pnpm cut:version
publish: pnpm -r publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: [master]

jobs:
validate:
test:
name: testing code
runs-on: ubuntu-latest
strategy:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ jobs:
- run: pnpm validate
env:
CI: true
- run: pnpm typecheck
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/node_modules/*
/node_modules/*
dist/*
15 changes: 9 additions & 6 deletions examples/react-esm/.storybook/main.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
/**
* @type {import('@storybook/react-vite').StorybookConfig}
*/
const config = {
stories: ['../../stories/**/*.stories.*'],
stories: ['../../stories/*.stories.*'],
addons: ['storybook-addon-performance'],
framework: {
name: '@storybook/react-webpack5',
options: {}
name: '@storybook/react-vite',
options: {},
},
docs: {
docsPage: 'automatic'
}
autodocs: 'tag',
},
};

export default config;
export default config;
3 changes: 3 additions & 0 deletions examples/react-esm/.storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<script>
window.global = window;
</script>
9 changes: 4 additions & 5 deletions examples/react-esm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@
"@babel/preset-env": "^7.20.2",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.18.6",
"@storybook/react": "7.0.0-beta.2",
"@storybook/react-webpack5": "7.0.0-beta.2",
"babel-loader": "^9.1.0",
"@storybook/react": "7.0.0-beta.50",
"@storybook/react-vite": "7.0.0-beta.50",
"http-server": "^14.1.1",
"storybook": "7.0.0-beta.2",
"storybook": "7.0.0-beta.50",
"storybook-addon-performance": "workspace:*",
"typescript": "^4.9.4",
"webpack": "^5.75.0"
"vite": "^4.0.0"
},
"scripts": {
"storybook:dev": "pnpm storybook dev --port 9005",
Expand Down
13 changes: 8 additions & 5 deletions examples/react-v16.8/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
/**
* @type {import('@storybook/react-vite').StorybookConfig}
*/
module.exports = {
stories: ['../../stories/**/*.stories.*'],
stories: ['../../stories/*.stories.*'],
addons: ['storybook-addon-performance'],
framework: {
name: '@storybook/react-webpack5',
options: {}
name: '@storybook/react-vite',
options: {},
},
docs: {
docsPage: 'automatic'
}
autodocs: 'tag',
},
};
3 changes: 3 additions & 0 deletions examples/react-v16.8/.storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<script>
window.global = window;
</script>
9 changes: 4 additions & 5 deletions examples/react-v16.8/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@
"@babel/preset-env": "^7.20.2",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.18.6",
"@storybook/react": "7.0.0-beta.2",
"@storybook/react-webpack5": "7.0.0-beta.2",
"babel-loader": "^9.1.0",
"@storybook/react": "7.0.0-beta.50",
"@storybook/react-vite": "7.0.0-beta.50",
"http-server": "^14.1.1",
"storybook": "7.0.0-beta.2",
"storybook": "7.0.0-beta.50",
"storybook-addon-performance": "workspace:*",
"typescript": "^4.9.4",
"webpack": "^5.75.0"
"vite": "^4.0.0"
},
"scripts": {
"storybook:dev": "pnpm storybook dev --port 9003",
Expand Down
13 changes: 8 additions & 5 deletions examples/react-v17/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
/**
* @type {import('@storybook/react-vite').StorybookConfig}
*/
module.exports = {
stories: ['../../stories/**/*.stories.*'],
stories: ['../../stories/*.stories.*'],
addons: ['storybook-addon-performance'],
framework: {
name: '@storybook/react-webpack5',
options: {}
name: '@storybook/react-vite',
options: {},
},
docs: {
docsPage: 'automatic'
}
autodocs: 'tag',
},
};
3 changes: 3 additions & 0 deletions examples/react-v17/.storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<script>
window.global = window;
</script>
10 changes: 5 additions & 5 deletions examples/react-v17/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
"@babel/preset-env": "^7.20.2",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.18.6",
"@storybook/react": "7.0.0-beta.2",
"@storybook/react-webpack5": "7.0.0-beta.2",
"babel-loader": "^9.1.0",
"@storybook/react": "7.0.0-beta.50",
"@storybook/react-vite": "7.0.0-beta.50",
"http-server": "^14.1.1",
"storybook": "7.0.0-beta.2",
"stories": "workspace:*",
"storybook": "7.0.0-beta.50",
"storybook-addon-performance": "workspace:*",
"typescript": "^4.9.4",
"webpack": "^5.75.0"
"vite": "^4.0.0"
},
"scripts": {
"storybook:dev": "pnpm storybook dev --port 9004",
Expand Down
13 changes: 8 additions & 5 deletions examples/react-v18/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
/**
* @type {import('@storybook/react-vite').StorybookConfig}
*/
module.exports = {
stories: ['../../stories/**/*.stories.*'],
stories: ['../../stories/*.stories.*'],
addons: ['storybook-addon-performance'],
framework: {
name: '@storybook/react-webpack5',
options: {}
name: '@storybook/react-vite',
options: {},
},
docs: {
docsPage: 'automatic'
}
autodocs: 'tag',
},
};
3 changes: 3 additions & 0 deletions examples/react-v18/.storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<script>
window.global = window;
</script>
9 changes: 4 additions & 5 deletions examples/react-v18/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@
"@babel/preset-env": "^7.20.2",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.18.6",
"@storybook/react": "7.0.0-beta.2",
"@storybook/react-webpack5": "7.0.0-beta.2",
"babel-loader": "^9.1.0",
"@storybook/react": "7.0.0-beta.50",
"@storybook/react-vite": "7.0.0-beta.50",
"http-server": "^14.1.1",
"storybook": "7.0.0-beta.2",
"storybook": "7.0.0-beta.50",
"storybook-addon-performance": "workspace:*",
"typescript": "^4.9.4",
"webpack": "^5.75.0"
"vite": "^4.0.0"
},
"scripts": {
"storybook:dev": "pnpm storybook dev --port 9006",
Expand Down
7 changes: 2 additions & 5 deletions examples/stories/landing.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { findByText, fireEvent } from '@testing-library/dom';
import { findByText, fireEvent } from '@testing-library/react';
import React from 'react';
import Select from 'react-select';
import invariant from 'tiny-invariant';
import {
InteractionTaskArgs,
PublicInteractionTask,
} from '../../packages/storybook-addon-performance/src';
import { InteractionTaskArgs, PublicInteractionTask } from 'storybook-addon-performance';

export default {
title: 'Examples',
Expand Down
16 changes: 16 additions & 0 deletions examples/stories/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"private": true,
"name": "stories",
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@testing-library/react": "^11.0.0",
"react-dom": "^17.0.0",
"react-select": "^5.7.0",
"react": "^17.0.0",
"storybook-addon-performance": "workspace:*",
"tiny-invariant": "^1.3.1"
}
}
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
{
"name": "root",
"private": true,
"engines": {
"node": ">=16",
"pnpm": ">=6"
"pnpm": ">=7"
},
"scripts": {
"build": "turbo build",
"test": "turbo test",
"validate": "turbo validate"
"validate": "turbo validate",
"typecheck": "turbo typecheck",
"cut:version": "pnpm changeset version && pnpm changeset tag"
},
"devDependencies": {
"@changesets/cli": "^2.26.0",
Expand Down
8 changes: 5 additions & 3 deletions packages/storybook-addon-performance-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"build": "tsc && chmod +x dist/index.js",
"build": "tsup && chmod +x dist/index.js",
"prepublishOnly": "pnpm build",
"test": "jest",
"validate": "pnpm prettier:check && pnpm eslint:check",
"typescript:check": "tsc --noEmit",
"typecheck": "tsc --noEmit",
"typescript:watch": "tsc --watch",
"prettier:check": "prettier src --debug-check --config ../../.prettierrc",
"prettier:write": "prettier src -write --config ../../.prettierrc",
"eslint:check": "eslint -c ../../.eslintrc.js --max-warnings=0"
"eslint:check": "eslint -c ../../.eslintrc.js --max-warnings=0 src"
},
"bin": {
"sb-perf": "dist/index.js"
Expand All @@ -34,6 +34,7 @@
},
"devDependencies": {
"@types/jest": "^29.2.4",
"@types/node": "^16.0.0",
"@typescript-eslint/eslint-plugin": "^5.46.0",
"@typescript-eslint/parser": "^5.46.0",
"eslint": "^8.29.0",
Expand All @@ -45,6 +46,7 @@
"rimraf": "^3.0.2",
"ts-jest": "^29.0.3",
"tslib": "^2.4.1",
"tsup": "^6.5.0",
"typescript": "^4.9.4"
},
"engines": {
Expand Down
1 change: 1 addition & 0 deletions packages/storybook-addon-performance-cli/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as fs from 'fs';
import * as path from 'path';

// has
import type { TaskGroupResult } from 'storybook-addon-performance';

import calculate from './calculate';
Expand Down
3 changes: 2 additions & 1 deletion packages/storybook-addon-performance-cli/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"allowSyntheticDefaultImports": false,
},
"include": [
"src"
"src",
"test"
],
}
10 changes: 10 additions & 0 deletions packages/storybook-addon-performance-cli/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineConfig } from 'tsup';

export default defineConfig({
entry: ['src/**/!(*.d).(ts|tsx)'],
format: ['cjs'],
dts: true,
clean: true,
minify: false,
platform: 'node',
});
15 changes: 15 additions & 0 deletions packages/storybook-addon-performance/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { StorybookConfig } from '@storybook/react-vite';

const conifg: StorybookConfig = {
stories: ['../stories/*.stories.*'],
addons: ['storybook-addon-performance'],
framework: {
name: '@storybook/react-vite',
options: {},
},
docs: {
autodocs: 'tag',
},
};

export default conifg;
6 changes: 6 additions & 0 deletions packages/storybook-addon-performance/.storybook/manager.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { addons } from '@storybook/addons';
import { themes } from '@storybook/theming';

addons.setConfig({
theme: themes.normal,
});
3 changes: 3 additions & 0 deletions packages/storybook-addon-performance/.storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { withPerformance } from '../src';

export const decorators = [withPerformance];
11 changes: 3 additions & 8 deletions packages/storybook-addon-performance/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import { defineConfig } from 'cypress'
import { defineConfig } from 'cypress';

export default defineConfig({
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require('./cypress/plugins/index.ts')(on, config)
},
supportFile: 'cypress/support/e2e.ts',
supportFile: false,
},
})
});
Loading