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

Commit a230a41

Browse files
committed
feat(playground): create vie playground
1 parent 5044a42 commit a230a41

31 files changed

+931
-102
lines changed

.eslintignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
node_modules
2-
dist
2+
dist
3+
4+
# At the time of writing this, I could not find any helpful
5+
# documentation for adding ESLint for Vue 3 projects running on Vite.
6+
# For this reason, we ignore the playground directory.
7+
playground

.eslintrc.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,20 @@ env:
55
extends:
66
- prettier/@typescript-eslint
77
- plugin:prettier/recommended
8+
- plugin:vue/essential
9+
- '@vue/typescript/recommended'
810
parser: '@typescript-eslint/parser'
911
parserOptions:
1012
ecmaVersion: 12
1113
sourceType: module
1214
plugins:
1315
- '@typescript-eslint'
14-
rules: {}
16+
rules:
17+
'@typescript-eslint/member-delimiter-style':
18+
- error
19+
- multiline:
20+
delimiter: none
21+
requireLast: false
22+
singleline:
23+
delimiter: comma
24+
requireLast: false

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

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

5-
import { h, defineComponent } from 'vue'
5+
import { h, defineComponent, PropType } from 'vue'
66

77
const <%= h.changeCase.pascalCase(name) %> = defineComponent({
88
props: {

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,21 @@ to: packages/<%=h.changeCase.paramCase(name)%>/package.json
55
{
66
"name": "<%= '@chakra-ui/' + h.changeCase.paramCase(name)%>",
77
"version": "1.0.0",
8-
"main": "index.js",
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+
],
915
"description": "<%= 'Chakra UI Vue | ' + h.changeCase.pascalCase(name) + ' component'%>",
1016
"repository": "https://github.com/chakra-ui/chakra-ui-vue-next.git",
1117
"author": "codebender828 [email protected]",
1218
"license": "MIT",
1319
"scripts": {
1420
"build": "concurrently yarn:build:*",
1521
"build:esm": "cross-env swc src --out-dir dist/esm/",
16-
"build:cjs": "cross-env swc -C module.type=commonjs src --out-dir dist/cjs/"
22+
"build:cjs": "cross-env swc -C module.type=commonjs src --out-dir dist/cjs/",
23+
"build:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist/types"
1724
}
1825
}

index.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

package.json

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,50 @@
1010
],
1111
"scripts": {
1212
"build": "lerna run build",
13-
"lint": "eslint '*/**/*.{js,ts,tsx}' --quiet --fix"
13+
"lint": "eslint '*/**/*.{js,ts,tsx}' --quiet --fix",
14+
15+
"scaffold": "hygen",
16+
17+
"playground": "ts-node ./scripts/parse-routes.ts && vite serve playground",
18+
"playground:build": "vite build",
19+
20+
"c-alert": "yarn workspace @chakra-ui/c-alert",
21+
"c-box": "yarn workspace @chakra-ui/c-box",
22+
"c-button": "yarn workspace @chakra-ui/c-button",
23+
"nuxt": "yarn workspace @chakra-ui/nuxt-next"
1424
},
1525
"license": "MIT",
1626
"private": true,
1727
"devDependencies": {
1828
"@swc/cli": "^0.1.26",
1929
"@swc/core": "^1.2.28",
20-
"@typescript-eslint/eslint-plugin": "^4.1.1",
21-
"@typescript-eslint/parser": "^4.1.1",
30+
"@types/recursive-readdir": "^2.2.0",
31+
"@typescript-eslint/eslint-plugin": "^2.34.0",
32+
"@typescript-eslint/parser": "^2.34.0",
33+
"@vue/eslint-config-typescript": "^5.1.0",
2234
"concurrently": "^5.3.0",
2335
"cross-env": "^7.0.2",
24-
"eslint": "^7.9.0",
36+
"eslint": "^7.0.0",
2537
"eslint-config-prettier": "^6.12.0",
2638
"eslint-config-standard": "^14.1.1",
2739
"eslint-plugin-import": "^2.22.0",
2840
"eslint-plugin-node": "^11.1.0",
2941
"eslint-plugin-prettier": "^3.1.4",
3042
"eslint-plugin-promise": "^4.2.1",
3143
"eslint-plugin-standard": "^4.0.1",
44+
"eslint-plugin-vue": "^7.0.0",
45+
"fs-extra": "^9.0.1",
46+
"hygen": "^6.0.4",
3247
"lerna": "^3.22.1",
3348
"prettier": "^2.1.2",
49+
"recursive-readdir": "^2.2.2",
50+
"ts-node": "^9.0.0",
51+
"typescript": "^4.0.3",
3452
"vite": "^1.0.0-rc.4",
3553
"vue": "^3.0.0",
3654
"vue-router": "4.0.0-beta.10"
55+
},
56+
"dependencies": {
57+
"change-case": "^4.1.1"
3758
}
3859
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<template>
2+
<div>
3+
HELLO ALERT
4+
</div>
5+
</template>
6+
7+
<script lang="ts">
8+
import CAlert from '@chakra-ui/c-alert'
9+
import { defineComponent } from 'vue'
10+
11+
export default defineComponent({
12+
setup () {
13+
return {}
14+
}
15+
})
16+
</script>

packages/c-alert/package.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "@chakra-ui/c-alert",
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 | CAlert component",
12+
"repository": "https://github.com/chakra-ui/chakra-ui-vue-next.git",
13+
"author": "codebender828 [email protected]",
14+
"license": "MIT",
15+
"scripts": {
16+
"build": "concurrently yarn:build:*",
17+
"build:esm": "cross-env swc src --out-dir dist/esm/",
18+
"build:cjs": "cross-env swc -C module.type=commonjs src --out-dir dist/cjs/",
19+
"build:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist/types"
20+
}
21+
}

packages/c-alert/src/index.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { h, defineComponent, PropType } from 'vue'
2+
3+
const CAlert = defineComponent({
4+
props: {
5+
as: {
6+
type: String as PropType<string>,
7+
default: 'div',
8+
},
9+
},
10+
render() {
11+
return h(this?.as, { ...this.$props, ...this.$attrs }, this.$slots.default)
12+
},
13+
})
14+
15+
export default CAlert
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { render } from '@chakra-ui/vue-test-utils'
2+
import CAlert from '../'
3+
4+
5+
it('should render properly', () => {
6+
const { html } = render(CAlert)
7+
expect(html()).toMatchSnapshot()
8+
})

0 commit comments

Comments
 (0)