Skip to content

Commit fee2e60

Browse files
Ismail NGUYENIsmail NGUYEN
Ismail NGUYEN
authored and
Ismail NGUYEN
committed
Add action worflow to push on NPM
1 parent 30d7f81 commit fee2e60

File tree

5 files changed

+54
-45
lines changed

5 files changed

+54
-45
lines changed

Diff for: .github/workflows/main.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- master
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v1
12+
- uses: actions/setup-node@v1
13+
with:
14+
node-version: 12
15+
registry-url: https://registry.npmjs.org/
16+
- run: npm install
17+
- run: npm publish --access public
18+
env:
19+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

Diff for: README.md

+23-16
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,31 @@
11
# vue-dark-mode-switch
22

3-
## Project setup
3+
## Install
44
```
5-
npm install
5+
npm install --save vue-dark-mode-switch
66
```
77

8-
### Compiles and hot-reloads for development
9-
```
10-
npm run serve
11-
```
8+
### Usage
129

13-
### Compiles and minifies for production
14-
```
15-
npm run build
16-
```
10+
Import the `DarkModeSwitch` component, and it will emit its state through `@switched` event method.
1711

18-
### Lints and fixes files
19-
```
20-
npm run lint
21-
```
12+
```html
13+
<template>
14+
<DarkModeSwitch @switched="onSwitched" />
15+
</template>
16+
17+
<script>
18+
import DarkModeSwitch from './components/DarkModeSwitch.vue'
2219
23-
### Customize configuration
24-
See [Configuration Reference](https://cli.vuejs.org/config/).
20+
export default {
21+
components: {
22+
DarkModeSwitch
23+
},
24+
methods: {
25+
onSwitched: function (isSwitched) {
26+
console.log('dark mode is enabled :', isSwitched);
27+
}
28+
}
29+
}
30+
</script>
31+
```

Diff for: package.json

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
{
22
"name": "vue-dark-mode-switch",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"author": "Ismaïl NGUYEN <nguyen.ismail@gmail.com>",
55
"repository": "https://github.com/ismailnguyen/vue-dark-mode-switch.git",
66
"license": "WTFPL (http://www.wtfpl.net)",
7+
"main": "./dist/vue-dark-mode-switch.common.js",
78
"scripts": {
89
"serve": "vue-cli-service serve",
910
"build": "vue-cli-service build",
11+
"build-library": "vue-cli-service build --target lib --name vue-dark-mode-switch ./src/main.js",
1012
"lint": "vue-cli-service lint"
1113
},
1214
"dependencies": {
@@ -42,5 +44,12 @@
4244
"> 1%",
4345
"last 2 versions",
4446
"not dead"
47+
],
48+
"files": [
49+
"dist/*",
50+
"src/*",
51+
"public/*",
52+
"*.json",
53+
"*.js"
4554
]
4655
}

Diff for: src/App.vue

-21
This file was deleted.

Diff for: src/main.js

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
import Vue from 'vue'
2-
import App from './App.vue'
1+
import DarkModeSwitch from './components/DarkModeSwitch.vue'
32

4-
Vue.config.productionTip = false
5-
6-
new Vue({
7-
render: h => h(App),
8-
}).$mount('#app')
3+
export default DarkModeSwitch

0 commit comments

Comments
 (0)