Skip to content
This repository has been archived by the owner on May 15, 2023. It is now read-only.

Commit

Permalink
feat: migrate to pnpm 😱 (#193)
Browse files Browse the repository at this point in the history
* feat: migrate to pnpm

* feat: add gitignore
  • Loading branch information
irfan-maulana-tkp authored Apr 8, 2020
1 parent 2f5e6e7 commit 7c0b498
Show file tree
Hide file tree
Showing 78 changed files with 12,330 additions and 10,280 deletions.
10 changes: 7 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
.DS_Store
node_modules
/dist
/lib-out/*.js
/lib-out/*.ts
dist

# local env files
.env.local
Expand All @@ -12,6 +10,8 @@ node_modules
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
pnpm-error.log*

# Editor directories and files
.idea
Expand All @@ -21,3 +21,7 @@ yarn-error.log*
*.njsproj
*.sln
*.sw?

.rts2_cache_cjs
.rts2_cache_es
.rts2_cache_umd
27 changes: 16 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,36 @@
language: node_js
node_js: '8'
node_js: '12'

branches:
only:
- master
- /^greenkeeper/.*$/

cache:
yarn: true
directories:
- node_modules

before_install:
- npm install -g pnpm

install:
- yarn install
- pnpm install

script:
- yarn build:demo
# only for test the build process
- yarn build:lib:tsc
- yarn check:size
# temporary hide
# - yarn test
- pnpm run build:demo
- pnpm run build:lib
- pnpm run bundlesize
# - pnpm run test

# after_script:
# - npm install -g codecov
# - codecov

deploy:
provider: pages
skip-cleanup: true
github-token: $GITHUB_TOKEN
keep-history: true
local-dir: dist
local-dir: packages/demo/dist
verbose: true
on:
branch: master
40 changes: 15 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
# 🍒 Vue Currency Filter

<p align="center"><a href="https://mazipan.github.io/vue-currency-filter/" target="_blank" rel="noopener noreferrer"><img width="128" src="https://raw.githubusercontent.com/mazipan/vue-currency-filter/master/assets/VueJS-Currency-128px.png" alt="Vue Currency Logo"></a></p>
<p align="center">
<a href="https://mazipan.github.io/vue-currency-filter/" target="_blank" rel="noopener noreferrer"><img width="128" src="https://raw.githubusercontent.com/mazipan/vue-currency-filter/master/assets/VueJS-Currency-128px.png" alt="Vue Currency Logo"></a>
<h2 align="center">Lightweight vue currency filter based on accounting.js<h2>
</p>

<p align="center">
<a href="https://www.npmjs.com/package/vue-currency-filter">
<img src="https://img.shields.io/npm/v/vue-currency-filter.svg" alt="NPM Version">
<img height="15" src="https://img.shields.io/npm/v/vue-currency-filter.svg" alt="NPM Version">
</a>
<a href="https://bundlephobia.com/result?p=vue-currency-filter">
<img src="https://badgen.net/bundlephobia/minzip/vue-currency-filter" alt="Bundlephobia Size">
<img height="15" src="https://badgen.net/bundlephobia/minzip/vue-currency-filter" alt="Bundlephobia Size">
</a>
<a href="https://www.npmjs.com/package/vue-currency-filter">
<img src="https://img.shields.io/npm/dt/vue-currency-filter.svg" alt="Download All Time">
<img height="15" src="https://img.shields.io/npm/dt/vue-currency-filter.svg" alt="Download All Time">
</a>
<a href="https://travis-ci.org/mazipan/vue-currency-filter">
<img src="https://img.shields.io/travis/mazipan/vue-currency-filter.svg" alt="Travis Build">
<img height="15" src="https://img.shields.io/travis/mazipan/vue-currency-filter.svg" alt="Travis Build">
</a>
<a href="#contributors">
<img src="https://img.shields.io/badge/all_contributors-4-orange.svg" alt="All Contributors">
<img height="15" src="https://img.shields.io/badge/all_contributors-4-orange.svg" alt="All Contributors">
</a>
</p>

> Lightweight vue currency filter based on accounting.js
<p align="center">
<img src="screenshoot-bundlesize.png" alt="Bundle Size">
</p>

## Demo

Expand Down Expand Up @@ -101,10 +106,7 @@ Add script dependencies
```html
<!-- Vue Dependency -->
<script src="https://cdn.jsdelivr.net/npm/vue"></script>

<!-- Vue Currency Filter Dependency -->
<script src="https://unpkg.com/vue-currency-filter@3.2.3/dist/vue-currency-filter.iife.js"></script>
<!-- Change 3.2.3 with latest version -->
<script src="https://unpkg.com/vue-currency-filter"></script>
```

Use filters in global
Expand Down Expand Up @@ -170,18 +172,6 @@ configFractionSeparator, configSymbolPosition, configSymbolSpacing)}}
}
```

## Update Global Configs

Since global config only can be setted from `Vue.use(VueCurrencyFilter, configs)`, but sometimes we need to update this global configs on runtime process.

from v3.1.0 we intoduce prototype method that can be update this global configs. You can use anywhere in your components like this code below:

```js
this.$CurrencyFilter.setConfig(newConfigs)
```

But please be aware, this method is only update global configs without trigger to re-run filter function. So maybe you will face not sync data from your configs and your view. You need to update some value to trigger this new configs applied.

## How to test in Unit Test

Using `@vue/test-utils` we can create test for any Vue Plugins, like:
Expand Down Expand Up @@ -226,7 +216,7 @@ If you'd like to contribute, head to the [contributing guidelines](/CONTRIBUTING
- [@iqbalhood](https://github.com/iqbalhood) as logo creator (see [#19](https://github.com/mazipan/vue-currency-filter/issues/19))
- [Jetbrain](https://www.jetbrains.com/?from=vue-currency-filter) for amazing WebStorm IDE

[<img src="https://raw.githubusercontent.com/mazipan/vue-currency-filter/master/jetbrains.png" width="100px;" />](https://www.jetbrains.com/?from=vue-currency-filter)
[<img src="https://raw.githubusercontent.com/mazipan/vue-currency-filter/master/jetbrains.png" width="100px;" />](https://www.jetbrains.com/?from=vue-currency-filter)

## Hope this will be useful for you all

Expand All @@ -238,7 +228,7 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/all-contri

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore -->
<table><tr><td align="center"><a href="https://www.mazipan.xyz/"><img src="https://avatars0.githubusercontent.com/u/7221389?v=4" width="100px;" alt="Irfan Maulana"/><br /><sub><b>Irfan Maulana</b></sub></a><br /><a href="https://github.com/mazipan/vue-currency-filter/commits?author=mazipan" title="Code">💻</a></td><td align="center"><a href="https://about.me/iqbalhood"><img src="https://avatars3.githubusercontent.com/u/1563756?v=4" width="100px;" alt="iqbalhood"/><br /><sub><b>iqbalhood</b></sub></a><br /><a href="#design-iqbalhood" title="Design">🎨</a></td><td align="center"><a href="https://sunhengzhe.com"><img src="https://avatars3.githubusercontent.com/u/8614151?v=4" width="100px;" alt="孙恒哲"/><br /><sub><b>孙恒哲</b></sub></a><br /><a href="https://github.com/mazipan/vue-currency-filter/commits?author=sunhengzhe" title="Code">💻</a></td><td align="center"><a href="https://github.com/ricardogobbosouza"><img src="https://avatars3.githubusercontent.com/u/13064722?v=4" width="100px;" alt="Ricardo Gobbo de Souza"/><br /><sub><b>Ricardo Gobbo de Souza</b></sub></a><br /><a href="https://github.com/mazipan/vue-currency-filter/commits?author=ricardogobbosouza" title="Code">💻</a></td><td align="center"><a href="https://github.com/dsfx3d"><img src="https://avatars1.githubusercontent.com/u/14162837?v=4" width="100px;" alt="Yashodhan Singh Rathore"/><br /><sub><b>Yashodhan Singh Rathore</b></sub></a><br /><a href="https://github.com/mazipan/vue-currency-filter/commits?author=dsfx3d" title="Code">💻</a></td><td align="center"><a href="http://gijsroge.github.io"><img src="https://avatars0.githubusercontent.com/u/2242498?v=4" width="100px;" alt="Gijs Rogé"/><br /><sub><b>Gijs Rogé</b></sub></a><br /><a href="https://github.com/mazipan/vue-currency-filter/commits?author=gijsroge" title="Code">💻</a></td></tr></table>
<table><tr><td align="center"><a href="https://www.mazipan.xyz/"><img src="https://avatars0.githubusercontent.com/u/7221389?v=4" width="100px;" alt="Irfan Maulana"/><br /><sub><b>Irfan Maulana</b></sub></a><br /><a href="https://github.com/mazipan/vue-currency-filter/commits?author=mazipan" title="Code">💻</a></td><td align="center"><a href="https://about.me/iqbalhood"><img src="https://avatars3.githubusercontent.com/u/1563756?v=4" width="100px;" alt="iqbalhood"/><br /><sub><b>iqbalhood</b></sub></a><br /><a href="#design-iqbalhood" title="Design">🎨</a></td><td align="center"><a href="https://sunhengzhe.com"><img src="https://avatars3.githubusercontent.com/u/8614151?v=4" width="100px;" alt="孙恒哲"/><br /><sub><b>孙恒哲</b></sub></a><br /><a href="https://github.com/mazipan/vue-currency-filter/commits?author=sunhengzhe" title="Code">💻</a></td><td align="center"><a href="https://github.com/ricardogobbosouza"><img src="https://avatars3.githubusercontent.com/u/13064722?v=4" width="100px;" alt="Ricardo Gobbo de Souza"/><br /><sub><b>Ricardo Gobbo de Souza</b></sub></a><br /><a href="https://github.com/mazipan/vue-currency-filter/commits?author=ricardogobbosouza" title="Code">💻</a></td><td align="center"><a href="https://github.com/dsfx3d"><img src="https://avatars1.githubusercontent.com/u/14162837?v=4" width="100px;" alt="Yashodhan Singh Rathore"/><br /><sub><b>Yashodhan Singh Rathore</b></sub></a><br /><a href="https://github.com/mazipan/vue-currency-filter/commits?author=dsfx3d" title="Code">💻</a></td><td align="center"><a href="http://gijsroge.github.io"><img src="https://avatars0.githubusercontent.com/u/2242498?v=4" width="100px;" alt="Gijs Rogé"/><br /><sub><b>Gijs Rogé</b></sub></a><br /><a href="https://github.com/mazipan/vue-currency-filter/commits?author=gijsroge" title="Code">💻</a></td></tr></table>

<!-- ALL-CONTRIBUTORS-LIST:END -->

Expand Down
2 changes: 1 addition & 1 deletion check-size.js → bundlesize.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function readDirs (dirname, onDir, onError) {
}

setTimeout(() => {
readDirs(path.resolve('./lib-out/'), async (filepath, filename) => {
readDirs(path.resolve('./packages/vue-currency-filter/dist/'), async (filepath, filename) => {
try {
console.log(chalk.greenBright(`> ${filename}: ${bytes(gzipSize.fileSync(filepath))}`))
} catch (err) {
Expand Down
Empty file removed lib-out/.gitkeep
Empty file.
102 changes: 18 additions & 84 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,42 +1,23 @@
{
"name": "vue-currency-filter",
"description": "🍒 Lightweight vue currency filter based on accounting.js",
"version": "4.0.3",
"license": "MIT",
"private": false,
"name": "@vue-currency-filter/monorepo",
"description": "🍒 Lightweight vue currency filter based on accounting.js",
"version": "5.0.0",
"license": "MIT",
"author": "Irfan Maulana (https://github.com/mazipan/)",
"homepage": "https://mazipan.github.io/vue-currency-filter/",
"scripts": {
"dev": "vue-cli-service serve",
"serve": "vue-cli-service serve",
"prepare": "yarn build:lib:tsc",
"build:demo": "vue-cli-service build",
"build:lib": "vue-cli-service build --dest lib-out --target lib --name VueCurrencyFilter ./src/lib/VueCurrencyFilter.ts",
"build:lib:tsc": "tsc ./src/lib/VueCurrencyFilter.ts -m CommonJS --outDir ./lib-out",
"check:size": "node ./check-size.js",
"lint": "vue-cli-service lint --fix"
},
"lint-staged": {
"*.{js,vue}": [
"yarn lint",
"git add"
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"author": "Irfan Maulana (https://github.com/mazipan/)",
"homepage": "https://mazipan.github.io/vue-currency-filter/",
"main": "lib-out/VueCurrencyFilter.js",
"module": "lib-out/VueCurrencyFilter.js",
"unpkg": "lib-out/VueCurrencyFilter.js",
"jsdelivr": "lib-out/VueCurrencyFilter.js",
"typings": "types/index.d.ts",
"files": [
"lib-out",
"nuxt",
"types"
],
"test": "echo \"Error: no test specified\" && exit 0",
"build:lib": "pnpm run build --filter vue-currency-filter",
"build:demo": "pnpm run build --filter @vue-currency-filter/demo",
"bundlesize": "node ./bundlesize.js"
},
"devDependencies": {
"bytes": "3.1.0",
"chalk": "3.0.0",
"gzip-size": "5.1.1",
"husky": "3.1.0",
"lint-staged": "9.5.0"
},
"keywords": [
"vue 2 currency",
"vue currency",
Expand All @@ -49,52 +30,5 @@
},
"bugs": {
"url": "https://github.com/mazipan/vue-currency-filter/issues"
},
"peerDependencies": {
"vue": "2.6.11"
},
"dependencies": {
},
"devDependencies": {
"@types/node": "12.12.22",
"@typescript-eslint/eslint-plugin": "2.18.0",
"@typescript-eslint/parser": "2.18.0",
"@vue/cli-plugin-babel": "4.1.2",
"@vue/cli-plugin-eslint": "4.1.2",
"@vue/cli-plugin-pwa": "4.1.2",
"@vue/cli-plugin-router": "4.1.2",
"@vue/cli-plugin-typescript": "4.1.2",
"@vue/cli-plugin-vuex": "4.1.2",
"@vue/cli-service": "4.1.2",
"@vue/eslint-config-standard": "5.1.0",
"@vue/eslint-config-typescript": "5.0.1",
"babel-eslint": "10.0.3",
"bulma-dracula": "1.0.3",
"bytes": "3.1.0",
"core-js": "3.6.4",
"chalk": "3.0.0",
"eslint": "6.8.0",
"eslint-plugin-import": "2.20.1",
"eslint-plugin-node": "11.0.0",
"eslint-plugin-promise": "4.2.1",
"eslint-plugin-standard": "4.0.1",
"eslint-plugin-vue": "6.1.2",
"gzip-size": "5.1.1",
"husky": "3.1.0",
"lint-staged": "10.0.7",
"node-sass": "4.13.1",
"prismjs": "1.19.0",
"register-service-worker": "1.6.2",
"sass-loader": "8.0.2",
"tsc": "latest",
"typescript": "3.7.5",
"vue-class-component": "7.2.2",
"vue-google-adsense": "1.8.0",
"vue-prism-component": "1.1.1",
"vue-property-decorator": "8.3.0",
"vue-router": "3.1.5",
"vue-script2": "2.1.0",
"vue-template-compiler": "2.6.11",
"vuex": "3.1.2"
}
}
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion babel.config.js → packages/demo/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
'@vue/cli-plugin-babel/preset',
]
}
53 changes: 53 additions & 0 deletions packages/demo/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"name": "@vue-currency-filter/demo",
"description": "🍒 Lightweight vue currency filter based on accounting.js",
"version": "5.0.0",
"license": "MIT",
"author": "Irfan Maulana (https://github.com/mazipan/)",
"homepage": "https://mazipan.github.io/vue-currency-filter/",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "vue-cli-service serve",
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint --fix"
},
"devDependencies": {
"vue-currency-filter": "file:../vue-currency-filter",
"@typescript-eslint/eslint-plugin": "2.13.0",
"@typescript-eslint/parser": "2.13.0",
"@vue/cli-plugin-babel": "4.1.1",
"@vue/cli-plugin-eslint": "4.1.1",
"@vue/cli-plugin-pwa": "4.1.1",
"@vue/cli-plugin-router": "4.1.1",
"@vue/cli-plugin-typescript": "4.1.1",
"@vue/cli-plugin-vuex": "4.1.1",
"@vue/cli-service": "4.1.1",
"@vue/eslint-config-standard": "5.0.1",
"@vue/eslint-config-typescript": "5.0.1",
"babel-eslint": "10.0.3",
"babel-loader": "^8.1.0",
"bulma-dracula": "1.0.3",
"core-js": "3.6.1",
"eslint": "6.8.0",
"eslint-plugin-import": "2.19.1",
"eslint-plugin-node": "11.0.0",
"eslint-plugin-promise": "4.2.1",
"eslint-plugin-standard": "4.0.1",
"eslint-plugin-vue": "6.1.0",
"node-sass": "4.13.0",
"prismjs": "1.17.1",
"register-service-worker": "1.6.2",
"sass-loader": "8.0.0",
"typescript": "3.7.4",
"vue": "2.6.11",
"vue-class-component": "7.1.0",
"vue-google-adsense": "1.8.0",
"vue-prism-component": "1.1.1",
"vue-property-decorator": "8.3.0",
"vue-router": "3.1.3",
"vue-script2": "2.1.0",
"vue-template-compiler": "2.6.11",
"vuex": "3.1.2"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
2 changes: 1 addition & 1 deletion src/main.ts → packages/demo/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import App from './App.vue'
import './registerServiceWorker'
import router from './router'
import store from './store'
import VueCurrencyFilter from './lib/VueCurrencyFilter'
import VueCurrencyFilter from 'vue-currency-filter'

const script2 = require('vue-script2')

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
17 changes: 10 additions & 7 deletions src/views/Home.vue → packages/demo/src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,12 @@ import 'prismjs/plugins/autolinker/prism-autolinker.min'
import 'prismjs/plugins/autolinker/prism-autolinker.css'
import Prism from 'vue-prism-component'
import utils from '../lib/utils'
Vue.component('prism', Prism)
function __isNull (obj) {
return typeof obj === 'undefined' || obj === null
};
export default {
name: 'Home',
data () {
Expand Down Expand Up @@ -411,22 +414,22 @@ module.exports = {
},
methods: {
updateData (options) {
if (!utils.__isNull(options.symbol)) {
if (!__isNull(options.symbol)) {
this.configSymbol = options.symbol
}
if (!utils.__isNull(options.thousandsSeparator)) {
if (!__isNull(options.thousandsSeparator)) {
this.configSeparator = options.thousandsSeparator
}
if (!utils.__isNull(options.fractionCount)) {
if (!__isNull(options.fractionCount)) {
this.configFractionCount = options.fractionCount
}
if (!utils.__isNull(options.fractionSeparator)) {
if (!__isNull(options.fractionSeparator)) {
this.configFractionSeparator = options.fractionSeparator
}
if (!utils.__isNull(options.symbolPosition)) {
if (!__isNull(options.symbolPosition)) {
this.configSymbolPosition = options.symbolPosition
}
if (!utils.__isNull(options.symbolSpacing)) {
if (!__isNull(options.symbolSpacing)) {
this.configSymbolSpacing = options.symbolSpacing
}
}
Expand Down
Loading

0 comments on commit 7c0b498

Please sign in to comment.