Skip to content

Commit

Permalink
chore: migrate to swc
Browse files Browse the repository at this point in the history
  • Loading branch information
mogusbi-motech committed Apr 14, 2023
1 parent da7ec75 commit 56e6112
Show file tree
Hide file tree
Showing 5 changed files with 2,081 additions and 3,352 deletions.
1 change: 1 addition & 0 deletions packages/project-tailwind/.storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module.exports = {
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
'storybook-addon-swc',
],
framework: '@storybook/react',
core: {
Expand Down
12 changes: 0 additions & 12 deletions packages/project-tailwind/babel.config.js

This file was deleted.

47 changes: 40 additions & 7 deletions packages/project-tailwind/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@
"module": "lib/index.esm.js",
"types": "lib/index.d.ts",
"scripts": {
"build": "run prebuild && NODE_ENV=production rollup -c && run postbuild",
"build": "run prebuild && rollup -c",
"deploy": "storybook-to-ghpages --ci --host-token-env-variable=GITHUB_TOKEN",
"lint": "eslint --cache './src/**/*.{ts,tsx}'",
"package": "run build",
"postbuild": "tsc --project tsconfig.build.json --emitDeclarationOnly",
"prebuild": "rimraf ./lib",
"start": "start-storybook -p 6006",
"test": "jest --watch",
Expand All @@ -36,12 +35,10 @@
"react-textarea-autosize": "8.4.0"
},
"devDependencies": {
"@babel/core": "7.20.12",
"@mdx-js/react": "1.6.22",
"@motech-development/eslint-config-motech-react": "workspace:*",
"@motech-development/prettier-motech-config": "workspace:*",
"@motech-development/semantic-release": "workspace:*",
"@rollup/plugin-babel": "6.0.3",
"@rollup/plugin-commonjs": "23.0.7",
"@rollup/plugin-node-resolve": "15.0.1",
"@storybook/addon-actions": "6.5.16",
Expand All @@ -54,6 +51,8 @@
"@storybook/react": "6.5.16",
"@storybook/storybook-deployer": "2.8.16",
"@storybook/testing-library": "0.0.13",
"@swc/core": "1.3.49",
"@swc/jest": "0.2.24",
"@tailwindcss/forms": "0.5.3",
"@testing-library/jest-dom": "5.16.5",
"@testing-library/react": "14.0.0",
Expand All @@ -63,19 +62,35 @@
"@types/react": "18.0.28",
"@types/react-dom": "18.0.11",
"@types/react-textarea-autosize": "8.0.0",
"@typescript-eslint/eslint-plugin": "5.50.0",
"@typescript-eslint/parser": "5.50.0",
"autoprefixer": "10.4.13",
"babel-loader": "8.3.0",
"eslint": "8.33.0",
"eslint": "8.38.0",
"eslint-config-airbnb": "19.0.4",
"eslint-config-airbnb-typescript": "17.0.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-cypress": "2.12.1",
"eslint-plugin-import": "2.25.3",
"eslint-plugin-jest": "27.2.1",
"eslint-plugin-jsx-a11y": "6.5.1",
"eslint-plugin-react": "7.28.0",
"eslint-plugin-react-hooks": "4.3.0",
"jest": "29.4.3",
"jest-date-mock": "1.0.8",
"jest-environment-jsdom": "29.4.3",
"jest-watch-typeahead": "2.2.2",
"jsdom-testing-mocks": "1.7.0",
"postcss": "8.4.21",
"postcss-loader": "7.2.4",
"prettier": "2.3.0",
"rimraf": "3.0.2",
"rollup": "2.79.1",
"rollup-plugin-dts": "5.3.0",
"rollup-plugin-exclude-dependencies-from-bundle": "1.1.23",
"rollup-plugin-postcss": "4.0.2",
"rollup-plugin-swc3": "0.8.1",
"snapshot-diff": "0.10.0",
"storybook-addon-swc": "1.1.9",
"tailwindcss": "3.2.6",
"typescript": "4.9.5"
},
Expand All @@ -94,7 +109,25 @@
"setupFilesAfterEnv": [
"<rootDir>/src/setupTests.ts"
],
"testEnvironment": "jsdom"
"testEnvironment": "jsdom",
"transform": {
"^.+\\.(t|j)sx?$": [
"@swc/jest",
{
"jsc": {
"transform": {
"react": {
"runtime": "automatic"
}
}
}
}
]
},
"watchPlugins": [
"jest-watch-typeahead/filename",
"jest-watch-typeahead/testname"
]
},
"lint-staged": {
"*": "prettier --ignore-unknown --write",
Expand Down
30 changes: 26 additions & 4 deletions packages/project-tailwind/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,34 @@
import { babel } from '@rollup/plugin-babel';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import dts from 'rollup-plugin-dts';
import external from 'rollup-plugin-exclude-dependencies-from-bundle';
import postcss from 'rollup-plugin-postcss';
import { swc } from 'rollup-plugin-swc3';
import pkg from './package.json';

export default [
{
input: 'src/index.ts',
output: [
{
file: pkg.types,
format: 'es',
},
],
plugins: [
postcss({
config: {
path: 'postcss.config.js',
},
extensions: ['.css'],
inject: {
insertAt: 'top',
},
minimize: true,
}),
dts(),
],
},
{
input: 'src/index.ts',
output: [
Expand Down Expand Up @@ -36,9 +59,8 @@ export default [
extensions: ['.js', '.jsx', '.ts', '.tsx'],
}),
commonjs(),
babel({
babelHelpers: 'runtime',
extensions: ['.js', '.jsx', '.ts', '.tsx'],
swc({
sourceMaps: true,
}),
],
},
Expand Down
Loading

0 comments on commit 56e6112

Please sign in to comment.