Skip to content

Commit 4d1d525

Browse files
committed
🔥 chore: upgrade dev env
1 parent 6fbff4c commit 4d1d525

File tree

8 files changed

+3662
-2292
lines changed

8 files changed

+3662
-2292
lines changed

.babelrc

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
{
2-
"presets": ["es2015"],
3-
"env": {
4-
"development": {
5-
"sourceMaps": "inline"
6-
},
7-
"test": {
8-
"sourceMaps": "inline"
2+
"presets": [[
3+
"env",
4+
{
5+
"targets": {
6+
"node": "8"
7+
}
98
}
10-
}
9+
]]
1110
}

.eslintrc

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

.eslintrc.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
'use strict'
2+
3+
module.exports = {
4+
root: true,
5+
env: {
6+
node: true
7+
},
8+
extends: [
9+
'plugin:vue-libs/recommended'
10+
],
11+
plugins: [],
12+
parserOptions: {
13+
ecmaVersion: 2015
14+
},
15+
rules: {
16+
}
17+
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
coverage
22
coverage.lcov
33
node_modules
4+
.nyc_output
45
.DS_Store
56
*.log
67
*.swp

.nyc_output/.gitkeep

Whitespace-only changes.

lib/index.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
'use strict';
1+
"use strict";
22

33
Object.defineProperty(exports, "__esModule", {
44
value: true
@@ -8,24 +8,26 @@ exports.default = function (content) {
88
if (this.version && this.version >= 2) {
99
try {
1010
this.cacheable && this.cacheable();
11-
this.callback(null, 'module.exports = ' + generateCode(content));
11+
this.callback(null, `module.exports = ${generateCode(content)}`);
1212
} catch (err) {
1313
this.emitError(err.message);
1414
this.callback(err);
1515
}
1616
} else {
17-
var message = 'support webpack 2 later';
17+
const message = 'support webpack 2 later';
1818
this.emitError(message);
1919
this.callback(new Error(message));
2020
}
2121
};
2222

2323
function generateCode(content) {
24-
var code = '';
25-
26-
var value = typeof content === 'string' ? JSON.parse(content) : content;
24+
let code = '';
25+
let value = typeof content === 'string' ? JSON.parse(content) : content;
2726
value = JSON.stringify(value).replace(/\u2028/g, '\\u2028').replace(/\u2029/g, '\\u2029').replace(/\\/g, '\\\\');
28-
29-
code += 'function (Component) {\n Component.options.__i18n = Component.options.__i18n || []\n Component.options.__i18n.push(\'' + value.replace(/\u0027/g, '\\u0027') + '\')\n delete Component.options._Ctor\n}\n';
27+
code += `function (Component) {
28+
Component.options.__i18n = Component.options.__i18n || []
29+
Component.options.__i18n.push('${value.replace(/\u0027/g, '\\u0027')}')
30+
delete Component.options._Ctor
31+
}\n`;
3032
return code;
3133
}

package.json

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,30 @@
88
},
99
"ava": {
1010
"require": [
11-
"babel-core/register"
11+
"@babel/register"
1212
]
1313
},
1414
"bugs": {
1515
"url": "https://github.com/kazupon/vue-i18n-loader/issues"
1616
},
1717
"devDependencies": {
18-
"ava": "^0.18.2",
19-
"babel-cli": "^6.24.0",
20-
"babel-eslint": "^7.2.1",
21-
"babel-preset-es2015": "^6.22.0",
22-
"conventional-changelog-cli": "^1.2.0",
23-
"conventional-github-releaser": "^1.1.3",
24-
"cross-env": "^5.0.5",
25-
"eslint": "^3.18.0",
26-
"eslint-config-vue": "^2.0.2",
27-
"eslint-plugin-vue": "^2.0.1",
18+
"@babel/cli": "^7.5.0",
19+
"@babel/core": "^7.5.4",
20+
"@babel/register": "^7.4.4",
21+
"ava": "^1.0.0",
22+
"babel-eslint": "^10.0.2",
23+
"babel-preset-env": "^1.7.0",
24+
"conventional-changelog-cli": "^2.0.12",
25+
"conventional-github-releaser": "^3.1.2",
26+
"cross-env": "^5.2.0",
27+
"eslint": "^6.0.0",
28+
"eslint-plugin-vue-libs": "^4.0.0",
2829
"git-commit-message-convention": "git://github.com/kazupon/git-commit-message-convention.git",
29-
"nyc": "^10.2.0"
30+
"nyc": "^13.3.0",
31+
"opener": "^1.5.1"
3032
},
3133
"engines": {
32-
"node": ">= 4.0"
34+
"node": ">= 8"
3335
},
3436
"files": [
3537
"lib",
@@ -52,11 +54,12 @@
5254
"build": "cross-env BABEL_ENV=production babel ./src --out-dir ./lib",
5355
"changelog": "conventional-changelog -i CHANGELOG.md -s -n ./node_modules/git-commit-message-convention/convention.js",
5456
"clean": "rm -rf ./coverage && rm -rf ./lib/*.js*",
55-
"coverage": "./node_modules/.bin/nyc report --reporter=text-lcov > coverage.lcov",
57+
"ci:coverage": "nyc report --reporter=text-lcov > coverage.lcov",
58+
"coverage": "nyc report --reporter lcov && opener coverage/lcov-report/index.html",
5659
"lint": "eslint ./src ./test",
5760
"release": "conventional-github-releaser -n ./node_modules/git-commit-message-convention/convention.js",
5861
"test": "npm run lint && npm run test:cover",
59-
"test:cover": "cross-env BABEL_ENV=test ./node_modules/.bin/nyc report --reporter=html ava",
62+
"test:cover": "cross-env BABEL_ENV=test nyc ava",
6063
"test:unit": "cross-env BABEL_ENV=test ava",
6164
"watch": "cross-env BABEL_ENV=development babel ./src --out-dir ./lib --watch"
6265
}

0 commit comments

Comments
 (0)