Skip to content

Commit 874ce27

Browse files
Merge pull request chakra-ui#90 from chakra-ui/build/use-preconstruct
build: use preconstruct
2 parents f563023 + 782c6b5 commit 874ce27

File tree

49 files changed

+2896
-1007
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+2896
-1007
lines changed

.github/workflows/pr.yml

+43-3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ jobs:
1919
matrix:
2020
node-version: [14]
2121
steps:
22+
- name: Get Yarn cache path
23+
id: yarn-cache
24+
run: echo "::set-output name=dir::$(yarn cache dir)"
25+
2226
- name: Checkout
2327
uses: actions/checkout@v2
2428

@@ -27,16 +31,52 @@ jobs:
2731
with:
2832
node-version: ${{ matrix.node-version }}
2933

34+
- name: Load Yarn cache
35+
uses: actions/cache@v2
36+
with:
37+
path: ${{ steps.yarn-cache.outputs.dir }}
38+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
39+
restore-keys: |
40+
${{ runner.os }}-yarn-
41+
3042
- name: Install dependencies
31-
run: yarn install --frozen-lockfile && yarn bootstrap
43+
run: yarn install --frozen-lockfile
3244

3345
- name: Lint types and code
3446
run: yarn lint
3547

3648
- name: Build packages
37-
run: yarn build && yarn bootstrap
49+
run: yarn build
3850

3951
- name: Run tests
4052
run: yarn test
4153
env:
42-
CI: true
54+
CI: true
55+
56+
bundlesize:
57+
runs-on: ubuntu-latest
58+
steps:
59+
- name: Get Yarn cache path
60+
id: yarn-cache
61+
run: echo "::set-output name=dir::$(yarn cache dir)"
62+
63+
- name: Checkout
64+
uses: actions/checkout@master
65+
66+
- name: Setup Node.js 14.x
67+
uses: actions/setup-node@master
68+
with:
69+
node-version: 14.x
70+
71+
- name: Load Yarn cache
72+
uses: actions/cache@v2
73+
with:
74+
path: ${{ steps.yarn-cache.outputs.dir }}
75+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
76+
restore-keys: |
77+
${{ runner.os }}-yarn-
78+
- name: compressed-size-action
79+
uses: preactjs/compressed-size-action@v2
80+
with:
81+
repo-token: "${{ secrets.GITHUB_TOKEN }}"
82+
pattern: "**/dist/**/*.prod.js"

.github/workflows/release.yml

+12
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ jobs:
1515
name: Release
1616
runs-on: ubuntu-latest
1717
steps:
18+
- name: Get Yarn cache path
19+
id: yarn-cache
20+
run: echo "::set-output name=dir::$(yarn cache dir)"
21+
1822
- name: Checkout Repo
1923
uses: actions/checkout@master
2024
with:
@@ -27,6 +31,14 @@ jobs:
2731
with:
2832
node-version: 14
2933

34+
- name: Load Yarn cache
35+
uses: actions/cache@v2
36+
with:
37+
path: ${{ steps.yarn-cache.outputs.dir }}
38+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
39+
restore-keys: |
40+
${{ runner.os }}-yarn-
41+
3042
- name: Install dependencies
3143
run: yarn install --frozen-lockfile && yarn bootstrap
3244

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,5 @@ dist
9898
# vscode history extension
9999
.history
100100
website/.vite-ssg-temp
101-
.npmrc
101+
.npmrc
102+
cypress/screenshots

.size-limit.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[
2+
{
3+
"path": "packages/core/dist/chakra-ui-vue-next.cjs.prod.js",
4+
"limit": "85 KB",
5+
"ignore": [
6+
"vue",
7+
"@emotion/css"
8+
]
9+
},
10+
{
11+
"path": "packages/core/dist/chakra-ui-vue-next.esm.js",
12+
"limit": "85 KB",
13+
"ignore": [
14+
"vue",
15+
"@emotion/css"
16+
]
17+
}
18+
]

_templates/generator/component/package.json.ejs.t

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ to: packages/<%=h.changeCase.paramCase(name)%>/package.json
88
"version": "1.0.0",
99
"main": "dist/cjs/index.js",
1010
"module": "dist/esm/index.js",
11-
"types": "dist/types/index.d.ts",
12-
"typings": "dist/types/index.d.ts",
1311
"author": "Jonathan Bakebwa <codebender828@gmail.com>",
1412
"homepage": "https://github.com/chakra-ui/chakra-ui-vue-next#readme",
1513
"license": "MIT",

_templates/generator/module/package.json.ejs.t

-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ to: packages/<%=h.changeCase.paramCase(name)%>/package.json
77
"version": "1.0.0",
88
"main": "dist/cjs/index.js",
99
"module": "dist/esm/index.js",
10-
"types": "dist/types/index.d.ts",
11-
"typings": "dist/types/index.d.ts",
1210
"files": [
1311
"dist"
1412
],

_templates/generator/tooling/package.json.ejs.t

-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ to: tooling/<%=h.changeCase.paramCase(name)%>/package.json
77
"version": "1.0.0",
88
"main": "dist/cjs/index.js",
99
"module": "dist/esm/index.js",
10-
"types": "dist/types/index.d.ts",
11-
"typings": "dist/types/index.d.ts",
1210
"files": [
1311
"dist"
1412
],

components.d.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/**
2-
* Typescript support for @@chakra-ui/vue-next1.0.0-alpha.6 auto-imported
2+
* Typescript support for @@chakra-ui/vue-next1.0.0-alpha.7 auto-imported
33
* components using `vite-plugin-components`
44
*
55
* @see: https://github.com/antfu/vite-plugin-components#typescript
66
*
77
* This is a generated file. Do not edit it's contents.
88
*
9-
* This file was generated on 2021-07-29T05:01:14.847Z
9+
* This file was generated on 2021-08-24T10:32:03.469Z
1010
*/
1111

1212
import { ChakraProps } from '@chakra-ui/vue-system'
@@ -101,6 +101,7 @@ declare module 'vue' {
101101
CAlertDialogOverlay: typeof import('@chakra-ui/vue-next')['CAlertDialogOverlay']
102102
CMotion: typeof import('@chakra-ui/vue-next')['CMotion']
103103
CAnimatePresence: typeof import('@chakra-ui/vue-next')['CAnimatePresence']
104+
CCollapse: typeof import('@chakra-ui/vue-next')['CCollapse']
104105
CPortal: typeof import('@chakra-ui/vue-next')['CPortal']
105106
CScrollLock: typeof import('@chakra-ui/vue-next')['CScrollLock']
106107
CVisuallyHidden: typeof import('@chakra-ui/vue-next')['CVisuallyHidden']

jest.config.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ module.exports = {
1616
'@chakra-ui/vue-test-utils': '<rootDir>/packages/test-utils/src/index.ts',
1717
},
1818
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
19-
snapshotSerializers: [
20-
'@chakra-ui/vue-test-utils/dist/cjs/snapshot-serializer.js',
21-
],
19+
snapshotSerializers: ['@chakra-ui/vue-test-utils/src/snapshot-serializer.ts'],
2220
testMatch: ['**/**/*.test.(js|jsx|ts|tsx)'],
2321
}

package.json

+31-15
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,19 @@
1111
"website"
1212
],
1313
"scripts": {
14-
"pkg": "manypkg run",
15-
"pkgs:check": "manypkg check",
16-
"pkgs:fix": "manypkg fix",
17-
"postinstall": "yarn bootstrap",
14+
"postinstall": "preconstruct dev",
15+
"dev": "preconstruct dev",
16+
"clean": "yarn workspaces run clean",
17+
"prebuild": "yarn clean",
18+
"build": "yarn preconstruct build",
19+
"postbuild": "yarn size-limit",
20+
"start": "preconstruct watch",
1821
"csb:install": "yarn && yarn bootstrap",
1922
"bootstrap": "yarn run lerna bootstrap",
2023
"scaffold": "hygen generator",
2124
"release": "yarn changeset publish",
22-
"build": "lerna run build --no-private --stream",
23-
"dev": "NODE_ENV=development vite serve playground --config ./vite.config.ts --open",
24-
"playground:build": "yarn install && yarn build && yarn bootstrap && NODE_ENV=production vite build playground --config ./vite.config.ts",
25+
"playground:dev": "NODE_ENV=development vite serve playground --config ./vite.config.ts --open",
26+
"playground:build": "yarn install && yarn build && NODE_ENV=production vite build playground --config ./vite.config.ts",
2527
"cy:open": "cypress open-ct",
2628
"cy:run": "cypress run-ct --quiet",
2729
"test:component": "yarn cy:run",
@@ -33,18 +35,22 @@
3335
"docs:serve:legacy": "vitepress serve docs",
3436
"docs:dev": "yarn pkg @chakra-ui/vue-docs dev",
3537
"docs:generate": "yarn pkg @chakra-ui/vue-docs generate",
36-
"docs:serve": "yarn pkg @chakra-ui/vue-docs serve"
38+
"docs:serve": "yarn pkg @chakra-ui/vue-docs serve",
39+
"pkg": "manypkg run",
40+
"pkgs:check": "manypkg check",
41+
"pkgs:fix": "manypkg fix",
42+
"size": "size-limit",
43+
"analyze": "size-limit --why"
3744
},
3845
"license": "MIT",
3946
"private": true,
4047
"dependencies": {
4148
"@babel/cli": "^7.12.8",
4249
"@babel/core": "^7.12.9",
43-
"@babel/plugin-transform-runtime": "^7.13.15",
44-
"@babel/preset-env": "^7.12.7",
50+
"@babel/preset-env": "^7.15.0",
4551
"@babel/preset-typescript": "^7.12.7",
4652
"@chakra-ui/styled-system": "^1.10.0",
47-
"@chakra-ui/utils": "^1.8.0",
53+
"@chakra-ui/utils": "1.8.2",
4854
"@changesets/changelog-github": "^0.3.0",
4955
"@changesets/cli": "^2.14.1",
5056
"@commitlint/cli": "^11.0.0",
@@ -57,9 +63,12 @@
5763
"@emotion/server": "^11.0.0",
5864
"@manypkg/cli": "^0.17.0",
5965
"@popperjs/core": "^2.8.4",
60-
"@testing-library/jest-dom": "^5.11.9",
61-
"@testing-library/user-event": "^12.6.2",
62-
"@testing-library/vue": "^6.3.4",
66+
"@preconstruct/cli": "^2.1.1",
67+
"@size-limit/file": "^5.0.3",
68+
"@size-limit/webpack": "^5.0.3",
69+
"@testing-library/jest-dom": "^5.14.1",
70+
"@testing-library/user-event": "^13.2.1",
71+
"@testing-library/vue": "^6.4.2",
6372
"@types/body-scroll-lock": "^2.6.1",
6473
"@types/eslint": "^7.2.13",
6574
"@types/jest": "^26.0.20",
@@ -120,7 +129,7 @@
120129
"husky": "^4.3.8",
121130
"hygen": "^6.0.4",
122131
"jest": "^26.6.3",
123-
"jest-axe": "^4.1.0",
132+
"jest-axe": "^5.0.1",
124133
"jest-transform-stub": "^2.0.0",
125134
"lerna": "^3.22.1",
126135
"lint-staged": "^10.5.3",
@@ -134,6 +143,7 @@
134143
"react": "^17.0.1",
135144
"recursive-readdir": "^2.2.2",
136145
"shelljs": "^0.8.4",
146+
"size-limit": "^5.0.3",
137147
"tinycolor2": "^1.4.2",
138148
"ts-jest": "^26.5.0",
139149
"ts-node": "^9.0.0",
@@ -150,5 +160,11 @@
150160
"vue-prism-editor": "^2.0.0-alpha.2",
151161
"vue-router": "^4.0.10",
152162
"vue3-perfect-scrollbar": "^1.5.5"
163+
},
164+
"preconstruct": {
165+
"packages": [
166+
"packages/*",
167+
"tooling/*"
168+
]
153169
}
154170
}

packages/c-accordion/package.json

+15-11
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,34 @@
11
{
22
"name": "@chakra-ui/c-accordion",
33
"version": "0.1.0-alpha.5",
4-
"main": "dist/cjs/index.js",
5-
"module": "dist/esm/index.js",
6-
"types": "dist/types/index.d.ts",
7-
"typings": "dist/types/index.d.ts",
4+
"main": "dist/chakra-ui-c-accordion.cjs.js",
5+
"module": "dist/chakra-ui-c-accordion.esm.js",
86
"files": [
97
"dist"
108
],
119
"exports": {
1210
".": {
13-
"require": "./dist/cjs/index.js",
14-
"default": "./dist/esm/index.js"
11+
"require": "./dist/chakra-ui-c-accordion.cjs.js",
12+
"default": "./dist/chakra-ui-c-accordion.esm.js"
1513
}
1614
},
1715
"description": "Chakra UI Vue | CAccordion component",
1816
"repository": "https://github.com/chakra-ui/chakra-ui-vue-next/tree/master/packages/c-accordion",
1917
"author": "Jonathan Bakebwa [email protected]",
2018
"license": "MIT",
2119
"scripts": {
22-
"build": "rimraf ./dist && concurrently yarn:build:*",
23-
"build:esm": "cross-env BABEL_ENV=esm babel src --root-mode upward --extensions .ts,.tsx -d dist/esm --source-maps",
24-
"build:cjs": "cross-env BABEL_ENV=cjs babel src --root-mode upward --extensions .ts,.tsx -d dist/cjs --source-maps",
25-
"build:types": "cross-env tsc --emitDeclarationOnly --declaration --declarationDir dist/types"
20+
"clean": "rimraf dist"
2621
},
2722
"dependencies": {
2823
"@chakra-ui/vue-system": "0.1.0-alpha.5"
24+
},
25+
"peerDependencies": {
26+
"vue": ">=3.0.5"
27+
},
28+
"publishConfig": {
29+
"access": "public"
30+
},
31+
"devDependencies": {
32+
"vue": "^3.1.4"
2933
}
30-
}
34+
}

packages/c-alert/package.json

+12-15
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,36 @@
11
{
22
"name": "@chakra-ui/c-alert",
33
"version": "1.0.0-alpha.5",
4-
"main": "dist/cjs/index.js",
5-
"module": "dist/esm/index.js",
6-
"types": "dist/types/index.d.ts",
7-
"typings": "dist/types/index.d.ts",
4+
"main": "dist/chakra-ui-c-alert.cjs.js",
5+
"module": "dist/chakra-ui-c-alert.esm.js",
86
"files": [
97
"dist"
108
],
119
"exports": {
1210
".": {
13-
"require": "./dist/cjs/index.js",
14-
"default": "./dist/esm/index.js"
11+
"require": "./dist/chakra-ui-c-alert.cjs.js",
12+
"default": "./dist/chakra-ui-c-alert.esm.js"
1513
}
1614
},
1715
"description": "Chakra UI Vue | CAlert component",
1816
"repository": "https://github.com/chakra-ui/chakra-ui-vue-next/tree/master/packages/c-alert",
1917
"author": "Jonathan Bakebwa [email protected]",
2018
"license": "MIT",
2119
"scripts": {
22-
"build": "rimraf ./dist && concurrently yarn:build:*",
23-
"build:esm": "cross-env BABEL_ENV=esm babel src --root-mode upward --extensions .ts,.tsx -d dist/esm --source-maps",
24-
"build:cjs": "cross-env BABEL_ENV=cjs babel src --root-mode upward --extensions .ts,.tsx -d dist/cjs --source-maps",
25-
"build:types": "cross-env tsc --emitDeclarationOnly --declaration --declarationDir dist/types",
26-
"watch": "yarn:watch:*",
27-
"watch:esm": "cross-env BABEL_ENV=esm babel src --root-mode upward --extensions .ts,.tsx -d dist/esm --source-maps --watch",
28-
"watch:cjs": "cross-env BABEL_ENV=cjs babel src --root-mode upward --extensions .ts,.tsx -d dist/cjs --source-maps --watch",
29-
"watch:types": "cross-env tsc --emitDeclarationOnly --declaration --declarationDir dist/types --watch --incremental"
20+
"clean": "rimraf dist"
3021
},
3122
"dependencies": {
3223
"@chakra-ui/c-icon": "1.0.0-alpha.5",
3324
"@chakra-ui/vue-system": "0.1.0-alpha.5",
3425
"@chakra-ui/vue-utils": "0.1.0-alpha.5"
3526
},
27+
"peerDependencies": {
28+
"vue": ">=3.0.5"
29+
},
30+
"publishConfig": {
31+
"access": "public"
32+
},
3633
"devDependencies": {
3734
"vue": "^3.1.4"
3835
}
39-
}
36+
}

0 commit comments

Comments
 (0)