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

Commit b8826a2

Browse files
committed
feat: improve template generation
1 parent e70f92f commit b8826a2

File tree

18 files changed

+74
-47
lines changed

18 files changed

+74
-47
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
to: packages/<%=h.changeCase.paramCase(name)%>/README.md
3+
---
4+
5+
# @chakra-ui/<%=h.changeCase.paramCase(name)%>
6+
7+
<%=h.changeCase.sentence(description)%>
8+
9+
## Installation
10+
11+
```sh
12+
yarn add @chakra-ui/<%=h.changeCase.paramCase(name)%>
13+
# or
14+
npm i @chakra-ui/<%=h.changeCase.paramCase(name)%>
15+
```

_templates/generator/component/component.ts.ejs.t

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ to: packages/<%=h.changeCase.paramCase(name)%>/src/index.ts
44

55
import { h, defineComponent, PropType } from 'vue'
66

7-
const <%= h.changeCase.pascalCase(name) %> = defineComponent({
7+
export const <%= h.changeCase.pascalCase(name) %> = defineComponent({
88
props: {
99
as: {
1010
type: Object as PropType<string>,
@@ -15,5 +15,3 @@ const <%= h.changeCase.pascalCase(name) %> = defineComponent({
1515
return h(props?.as, { ...attrs }, slots.default?.())
1616
},
1717
})
18-
19-
export default <%= h.changeCase.pascalCase(name) %>

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

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,35 @@ to: packages/<%=h.changeCase.paramCase(name)%>/package.json
44

55
{
66
"name": "<%= '@chakra-ui/' + h.changeCase.paramCase(name)%>",
7+
"description": "<%= 'Chakra UI Vue | ' + h.changeCase.sentence(description) + ' component'%>",
78
"version": "1.0.0",
89
"main": "dist/cjs/index.js",
910
"module": "dist/esm/index.js",
1011
"types": "dist/types/index.d.ts",
1112
"typings": "dist/types/index.d.ts",
13+
"author": "Jonathan Bakebwa <codebender828@gmail.com>",
14+
"homepage": "https://github.com/chakra-ui/chakra-ui-vue-next#readme",
15+
"license": "MIT",
1216
"files": [
1317
"dist"
1418
],
15-
"description": "<%= 'Chakra UI Vue | ' + h.changeCase.pascalCase(name) + ' component'%>",
16-
"repository": "https://github.com/chakra-ui/chakra-ui-vue-next.git",
17-
"author": "Jonathan Bakebwa [email protected]",
18-
"license": "MIT",
19+
"exports": {
20+
".": {
21+
"require": "./dist/cjs/index.js",
22+
"default": "./dist/esm/index.js"
23+
}
24+
},
25+
"publishConfig": {
26+
"access": "public"
27+
},
28+
"repository": {
29+
"type": "git",
30+
"url": "git+https://github.com/chakra-ui/chakra-ui-vue-next.git"
31+
},
32+
"bugs": {
33+
"url": "https://github.com/chakra-ui/chakra-ui=vue-next/issues"
34+
},
35+
"sideEffects": false,
1936
"scripts": {
2037
"build": "concurrently yarn:build:*",
2138
"build:esm": "cross-env BABEL_ENV=esm babel src --root-mode upward --extensions .ts -d dist/esm --source-maps",
@@ -25,5 +42,13 @@ to: packages/<%=h.changeCase.paramCase(name)%>/package.json
2542
"watch:esm": "cross-env BABEL_ENV=esm babel src --root-mode upward --extensions .ts -d dist/esm --source-maps --watch",
2643
"watch:cjs": "cross-env BABEL_ENV=cjs babel src --root-mode upward --extensions .ts -d dist/cjs --source-maps --watch",
2744
"watch:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist/types --watch"
45+
},
46+
"dependencies": {
47+
"@chakra-ui/styled-system": "^1.4.1",
48+
"@chakra-ui/vue-system": "*",
49+
"@chakra-ui/vue-utils": "*"
50+
},
51+
"peerDependencies": {
52+
"vue": ">=3.0.5"
2853
}
2954
}

_templates/generator/component/test-file.test.ts.ejs.t

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
to: packages/<%=h.changeCase.paramCase(name)%>/tests/<%=h.changeCase.paramCase(name)%>.test.ts
33
---
44
import { render } from '../../test-utils/src'
5-
import <%= h.changeCase.pascalCase(name) %> from '../'
6-
5+
import { <%= h.changeCase.pascalCase(name) %> } from '../src'
76

87
it('should render properly', () => {
9-
const { html } = render(<%= h.changeCase.pascalCase(name) %>)
10-
expect(html()).toMatchSnapshot()
8+
const { asFragment } = render(<%= h.changeCase.pascalCase(name) %>)
9+
expect(asFragment()).toMatchSnapshot()
1110
})

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
"c-theme-provider": "yarn workspace @chakra-ui/c-theme-provider",
2424
"c-box": "yarn workspace @chakra-ui/c-box",
2525
"c-button": "yarn workspace @chakra-ui/c-button",
26-
"system": "yarn workspace @chakra-ui/system-vue",
26+
"c-icon": "yarn workspace @chakra-ui/c-icon",
27+
"system": "yarn workspace @chakra-ui/vue-system",
2728
"theme": "yarn workspace @chakra-ui/vue-theme",
2829
"nuxt": "yarn workspace @chakra-ui/nuxt-next",
2930
"test-utils": "yarn workspace @chakra-ui/vue-test-utils"
@@ -62,6 +63,7 @@
6263
"eslint-plugin-promise": "^4.2.1",
6364
"eslint-plugin-standard": "^4.0.1",
6465
"eslint-plugin-vue": "^7.0.0",
66+
"feather-icons-paths": "^1.0.8",
6567
"fs-extra": "^9.0.1",
6668
"husky": "^4.3.8",
6769
"hygen": "^6.0.4",

packages/c-accordion/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
"build:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist/types"
2020
},
2121
"dependencies": {
22-
"@chakra-ui/system-vue": "1.0.0"
22+
"@chakra-ui/vue-system": "1.0.0"
2323
}
2424
}

packages/c-accordion/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { h, defineComponent, PropType } from 'vue'
2-
import { chakra, DOMElements } from '@chakra-ui/system-vue'
2+
import { chakra, DOMElements } from '@chakra-ui/vue-system'
33

44
const CAccordion = defineComponent({
55
props: {

packages/c-alert/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "@chakra-ui/c-alert",
33
"version": "1.0.0",
44
"main": "dist/cjs/index.js",
5+
56
"module": "dist/esm/index.js",
67
"types": "dist/types/index.d.ts",
78
"typings": "dist/types/index.d.ts",
@@ -24,7 +25,6 @@
2425
},
2526
"dependencies": {
2627
"@chakra-ui/styled-system": "^1.4.1",
27-
"@chakra-ui/system-vue": "1.0.0",
28-
"@chakra-ui/vue-theme": "^1.0.0"
28+
"@chakra-ui/vue-system": "1.0.0"
2929
}
3030
}

packages/c-alert/src/alert.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
provideComponentStyles,
99
useComponentStyles,
1010
DOMElements,
11-
} from '@chakra-ui/system-vue'
11+
} from '@chakra-ui/vue-system'
1212
import { SystemStyleObject } from '@chakra-ui/styled-system'
1313

1414
const STATUSES = {

packages/c-button/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
"build:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist/types"
2020
},
2121
"dependencies": {
22-
"@chakra-ui/system-vue": "1.0.0"
22+
"@chakra-ui/vue-system": "1.0.0"
2323
}
2424
}

0 commit comments

Comments
 (0)