Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit c75e9fa

Browse files
committed
feat: add vite component resolver
1 parent 7c107a9 commit c75e9fa

File tree

12 files changed

+130
-2
lines changed

12 files changed

+130
-2
lines changed

_templates/generator/component/README.md.ejs.t renamed to _templates/generator/tooling/README.md.ejs.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
to: packages/<%=h.changeCase.paramCase(name)%>/README.md
2+
to: tooling/<%=h.changeCase.paramCase(name)%>/README.md
33
---
44

55
# @chakra-ui/<%=h.changeCase.paramCase(name)%>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
to: tooling/<%=h.changeCase.paramCase(name)%>/package.json
3+
---
4+
5+
{
6+
"name": "<%= '@chakra-ui/' + h.changeCase.paramCase(name)%>",
7+
"version": "1.0.0",
8+
"main": "dist/cjs/index.js",
9+
"module": "dist/esm/index.js",
10+
"types": "dist/types/index.d.ts",
11+
"typings": "dist/types/index.d.ts",
12+
"files": [
13+
"dist"
14+
],
15+
"description": "<%= 'Chakra UI Vue | ' + h.changeCase.pascalCase(name) + ' module'%>",
16+
"repository": "https://github.com/chakra-ui/chakra-ui-vue-next.git",
17+
"author": "Jonathan Bakebwa [email protected]",
18+
"license": "MIT",
19+
"scripts": {
20+
"build": "rimraf ./dist && concurrently yarn:build:*",
21+
"build:esm": "cross-env BABEL_ENV=esm babel src --root-mode upward --extensions .ts,.tsx -d dist/esm --source-maps",
22+
"build:cjs": "cross-env BABEL_ENV=cjs babel src --root-mode upward --extensions .ts,.tsx -d dist/cjs --source-maps",
23+
"watch": "concurrently yarn:watch:*",
24+
"watch:esm": "cross-env BABEL_ENV=esm babel src --root-mode upward --extensions .ts,.tsx -d dist/esm --source-maps --watch",
25+
"watch:cjs": "cross-env BABEL_ENV=cjs babel src --root-mode upward --extensions .ts,.tsx -d dist/cjs --source-maps --watch",
26+
"watch:types": "cross-env tsc --emitDeclarationOnly --declaration --declarationDir dist/types --watch --incremental"
27+
}
28+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
to: tooling/<%=h.changeCase.paramCase(name)%>/src/index.ts
3+
---
4+
const <%= h.changeCase.pascalCase(name) %> = () => {
5+
return {}
6+
}
7+
8+
export {
9+
<%= h.changeCase.pascalCase(name) %>
10+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
to: tooling/<%=h.changeCase.paramCase(name)%>/tests/<%=h.changeCase.paramCase(name)%>.test.ts
3+
---
4+
import { <%= h.changeCase.pascalCase(name) %> } from '../'
5+
6+
7+
it('should be truthy', () => {
8+
expect(1).toBe(1)
9+
})
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
to: tooling/<%=h.changeCase.paramCase(name)%>/tsconfig.json
3+
---
4+
5+
{
6+
"extends": "../../tsconfig.json",
7+
"include": ["src"]
8+
}

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"packages": ["packages/*", "website", "docs"],
2+
"packages": ["packages/*", "website", "docs", "tooling/*"],
33
"version": "independent",
44
"npmClient": "yarn",
55
"useWorkspaces": true,

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"author": "Jonathan Bakebwa [email protected]",
88
"workspaces": [
99
"packages/*",
10+
"tooling/*",
1011
"website"
1112
],
1213
"scripts": {
@@ -28,6 +29,7 @@
2829
"system": "yarn workspace @chakra-ui/vue-system",
2930
"utils": "yarn workspace @chakra-ui/vue-utils",
3031
"theme": "yarn workspace @chakra-ui/vue-theme",
32+
"auto-import": "yarn workspace @chakra-ui/vue-auto-import",
3133
"c-alert": "yarn workspace @chakra-ui/c-alert",
3234
"c-theme-provider": "yarn workspace @chakra-ui/c-theme-provider",
3335
"c-box": "yarn workspace @chakra-ui/c-box",

tooling/auto-import/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# @chakra-ui/vue-auto-import
2+
3+
Vite auto import resolver for chakra ui vue
4+
5+
## Installation
6+
7+
```sh
8+
yarn add @chakra-ui/vue-auto-import
9+
# or
10+
npm i @chakra-ui/vue-auto-import
11+
```

tooling/auto-import/package.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "@chakra-ui/vue-auto-import",
3+
"version": "1.0.0",
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",
8+
"files": [
9+
"dist"
10+
],
11+
"description": "Chakra UI Vue | VueAutoImport module",
12+
"repository": "https://github.com/chakra-ui/chakra-ui-vue-next.git",
13+
"author": "Jonathan Bakebwa [email protected]",
14+
"license": "MIT",
15+
"scripts": {
16+
"build": "rimraf ./dist && concurrently yarn:build:*",
17+
"build:esm": "cross-env BABEL_ENV=esm babel src --root-mode upward --extensions .ts,.tsx -d dist/esm --source-maps",
18+
"build:cjs": "cross-env BABEL_ENV=cjs babel src --root-mode upward --extensions .ts,.tsx -d dist/cjs --source-maps",
19+
"watch": "concurrently yarn:watch:*",
20+
"watch:esm": "cross-env BABEL_ENV=esm babel src --root-mode upward --extensions .ts,.tsx -d dist/esm --source-maps --watch",
21+
"watch:cjs": "cross-env BABEL_ENV=cjs babel src --root-mode upward --extensions .ts,.tsx -d dist/cjs --source-maps --watch",
22+
"watch:types": "cross-env tsc --emitDeclarationOnly --declaration --declarationDir dist/types --watch --incremental"
23+
},
24+
"dependencies": {
25+
"lodash.kebabcase": "^4.1.1"
26+
},
27+
"peerDependencies": {
28+
"vite": "^2.0.0-beta.44",
29+
"vue": "^3.0.5",
30+
"vite-plugin-components": "^0.6.6"
31+
}
32+
}

tooling/auto-import/src/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import kebabCase from 'lodash.kebabcase'
2+
3+
export const componentResolver = (name: string) => {
4+
if (kebabCase(name).startsWith('c-'))
5+
return {
6+
importName: name,
7+
path: `@chakra-ui/vue-next`,
8+
}
9+
}

0 commit comments

Comments
 (0)