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

Commit 38312c7

Browse files
committed
fix: package versions
1 parent 8984d3c commit 38312c7

File tree

14 files changed

+354
-106
lines changed

14 files changed

+354
-106
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@
6363
"@babel/runtime-corejs2": "^7.8.7",
6464
"@chakra-ui/styled-system": "^1.12.2",
6565
"@changesets/changelog-github": "^0.2.7",
66-
"@changesets/cli": "^2.7.1",
66+
"@changesets/cli": "^2.16.0",
6767
"@changesets/get-github-info": "^0.4.4",
6868
"@commitlint/cli": "^8.3.5",
6969
"@commitlint/config-conventional": "^8.3.4",
7070
"@emotion/babel-plugin": "^11.1.2",
71-
"@emotion/css": "^11.0.0",
71+
"@emotion/css": "^11.1.3",
7272
"@emotion/eslint-plugin": "^11.0.0",
7373
"@emotion/jest": "^11.3.0",
7474
"@manypkg/cli": "^0.18.0",

packages/chakra-ui-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"vue": ">=2.6.10"
5555
},
5656
"devDependencies": {
57-
"@emotion/css": "^11.0.0",
57+
"@emotion/css": "^11.1.3",
5858
"@fortawesome/fontawesome-common-types": "^0.2.36",
5959
"rimraf": "^3.0.2",
6060
"vue": "^2.6.12"

packages/chakra-ui-nuxt/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
"name": "Kelvin Omereshone <[email protected]>"
1010
}
1111
],
12-
"files": ["lib"],
12+
"files": [
13+
"lib"
14+
],
1315
"main": "lib/module.js",
1416
"types": "types/index.d.ts",
1517
"scripts": {
@@ -21,7 +23,7 @@
2123
"dependencies": {
2224
"@chakra-ui/theme-vue": "^0.3.2",
2325
"@chakra-ui/vue": "^0.10.2",
24-
"@emotion/css": "^11.0.0",
26+
"@emotion/css": "^11.1.3",
2527
"chakra-loader": "latest"
2628
},
2729
"peerDependencies": {

packages/vue-cli-plugin/LICENSE.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
MIT License
2+
3+
Copyright (c) 2020 Kelvin Omereshone
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6+
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

packages/vue-cli-plugin/README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# vue-cli-plugin-chakra-ui 🔥
2+
3+
This plugin setups Chakra UI Vue in your Vue CLI generated project.
4+
5+
## Install Vue CLI 3 🔌
6+
If you haven't yet installed vue-cli 3, install it like so:
7+
8+
```
9+
npm install -g @vue/cli
10+
```
11+
12+
or
13+
14+
```
15+
yarn global add @vue/cli
16+
```
17+
18+
>If you still need the legacy `vue init` functionality, you can install a global bridge by following the instructions [here](https://cli.vuejs.org/guide/creating-a-project.html#pulling-2-x-templates-legacy)
19+
20+
Generate a project using vue-cli 3.0:
21+
22+
```vue create my-app```
23+
24+
Before installing the chakra-ui plugin, make sure to commit or stash your changes in case you need to revert the changes.
25+
26+
## Usage 😎
27+
To install the chakra-ui plugin simply navigate to your application's folder and add chakra-ui.
28+
29+
```
30+
vue add chakra-ui
31+
```
32+
33+
The plugin will install [`@chakra-ui/vue`](https://vue.chakra-ui.com) and it's peer dependency - [Emotion](https://emotion.sh)
34+
35+
> As of v1.0.0, If you chose to allow automatic import of Chakra UI components from the prompt in the installation, [Chakra-Loader](https://github.com/chakra-ui/chakra-loader) will be installed for you.
36+
37+
The plugin will also touch `main.js` and `App.vue` to set up your project for consumption of Chakra UI components.
38+
39+
MIT © [Chakra UI](https://github.com/chakra-ui)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const fs = require('fs');
2+
module.exports = function addChakraLoaderConfig(api) {
3+
let content = "const { ChakraLoaderPlugin } = require('chakra-loader')\n\n";
4+
content += "module.exports = {\n";
5+
content += "\tconfigureWebpack: {\n";
6+
content += "\t\tplugins: [\n";
7+
content += "\t\t\tnew ChakraLoaderPlugin()\n";
8+
content += "\t\t]\n";
9+
content += "\t}\n";
10+
content += "}\n"
11+
fs.appendFileSync("vue.config.js", content);
12+
13+
api.exitLog('Auto import setup completed 🔥');
14+
api.exitLog('You can use Chakra UI components without importing and registering them now')
15+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module.exports = function registerChakraVuePlugin(api) {
2+
let vueUseLine = `\n\nVue.use(Chakra)`;
3+
4+
const fs = require('fs');
5+
6+
let contentMain = fs.readFileSync(api.entryFile, { encoding: 'utf-8' });
7+
8+
const lines = contentMain.split(/\r?\n/g).reverse();
9+
10+
const lastImportIndex = lines.findIndex((line) => line.match(/^import/));
11+
12+
lines[lastImportIndex] += vueUseLine;
13+
14+
// modify app
15+
contentMain = lines.reverse().join('\n');
16+
17+
fs.writeFileSync(api.entryFile, contentMain, { encoding: 'utf-8' });
18+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
const addChakraLoaderConfig = require('./helpers/add-chakra-loader-config');
2+
const registerChakraVuePlugin = require('./helpers/register-chakra-vue-plugin');
3+
const chakraPkg = require('@chakra-ui/vue/package.json')
4+
const emotionPkg = require('@emotion/css/package.json')
5+
const chakraLoaderPkg = require('chakra-loader/package.json')
6+
7+
module.exports = (api, options) => {
8+
api.extendPackage({
9+
dependencies: {
10+
'@chakra-ui/vue': `^${chakraPkg.version}`,
11+
'@emotion/css': `^${emotionPkg.version}`,
12+
},
13+
});
14+
15+
if (options.addChakraLoader) {
16+
api.extendPackage({
17+
devDependencies: {
18+
'chakra-loader': `^${chakraLoaderPkg.version}`,
19+
},
20+
});
21+
}
22+
23+
api.injectImports(api.entryFile, `import Chakra from '@chakra-ui/vue'`);
24+
25+
api.render('./template', {
26+
hasVueRouter: options.hasVueRouter,
27+
hasChakraLoader: options.addChakraLoader,
28+
});
29+
api.onCreateComplete(() => {
30+
registerChakraVuePlugin(api);
31+
32+
if (options.addChakraLoader) {
33+
addChakraLoaderConfig(api);
34+
}
35+
});
36+
37+
api.exitLog('Chakra UI Vue is ready');
38+
api.exitLog('Join the community on Discord - https://discord.gg/Tv8Jca');
39+
};
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<template>
2+
<c-theme-provider>
3+
<c-reset />
4+
<%_ if (hasVueRouter) { _%>
5+
<router-view />
6+
<%_ } else { _%>
7+
<!--Your application goes here -->
8+
<%_ } _%>
9+
</c-theme-provider>
10+
</template>
11+
12+
<script>
13+
<%_ if (!hasChakraLoader) { _%>
14+
import { CThemeProvider, CReset } from "@chakra-ui/vue";
15+
<%_ } _%>
16+
17+
export default {
18+
name: "App",
19+
<%_ if (!hasChakraLoader) { _%>
20+
components: {
21+
CThemeProvider,
22+
CReset
23+
}
24+
<%_ } _%>
25+
};
26+
</script>

packages/vue-cli-plugin/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = (api, options) => { }

0 commit comments

Comments
 (0)