Skip to content

Commit 1af3698

Browse files
authored
add example (#88)
* add prettier * fix format * add jest watch * update eslint env * upgrade webpack * add simple example * add e2e * switch to github actions
1 parent 95f387d commit 1af3698

22 files changed

+2186
-383
lines changed

.circleci/config.yml

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

.eslintrc.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,33 @@
22

33
module.exports = {
44
root: true,
5+
globals: {
6+
page: true,
7+
browser: true,
8+
context: true,
9+
jestPuppeteer: true
10+
},
511
env: {
612
node: true,
713
jest: true
814
},
915
extends: [
10-
'plugin:vue-libs/recommended'
11-
],
12-
plugins: [
13-
'@typescript-eslint'
16+
'plugin:vue-libs/recommended',
17+
'plugin:@typescript-eslint/recommended',
18+
'plugin:@typescript-eslint/eslint-recommended',
19+
'prettier/@typescript-eslint',
20+
'plugin:prettier/recommended'
1421
],
22+
plugins: ['@typescript-eslint'],
1523
parser: 'vue-eslint-parser',
1624
parserOptions: {
1725
parser: '@typescript-eslint/parser',
1826
sourceType: 'module'
1927
},
2028
rules: {
21-
'no-unused-vars': 'off', // HACK: due to override with @typescript-eslint/no-unused-vars
22-
'@typescript-eslint/no-unused-vars': [2, { 'vars': 'all', 'args': 'none' }]
29+
'object-curly-spacing': 'off',
30+
'@typescript-eslint/explicit-function-return-type': 'off',
31+
'@typescript-eslint/member-delimiter-style': 'off',
32+
'@typescript-eslint/no-use-before-define': 'off'
2333
}
2434
}

.github/workflows/test.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Test
2+
on:
3+
push:
4+
branches-ignore:
5+
- gh-pages
6+
pull_request:
7+
env:
8+
CI: true
9+
10+
jobs:
11+
test:
12+
name: "Test on Node.js ${{ matrix.node }} OS: ${{matrix.os}}"
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
os: [ubuntu-latest]
17+
node: [10, 12]
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v2
21+
- name: Setup Node.js ${{ matrix.node }}
22+
uses: actions/setup-node@v1
23+
with:
24+
node-version: ${{ matrix.node }}
25+
- name: Install
26+
run: yarn install
27+
- name: Test
28+
run: yarn test

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
lib
2+
coverage
3+
tsconfig.json

.prettierrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
semi: false
2+
singleQuote: true
3+
printWidth: 80
4+
trailingComma: "none"
5+
endOfLine: "auto"
6+
arrowParens: "avoid"

.vscode/settings.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"eslint.validate": [
3-
"javascript",
4-
{"language": "typescript", "autoFix": true}
5-
],
6-
"eslint.packageManager": "yarn",
7-
"eslint.enable": true,
8-
"typescript.tsdk": "node_modules/typescript/lib"
9-
}
2+
"eslint.validate": [
3+
"javascript",
4+
{ "language": "typescript", "autoFix": true }
5+
],
6+
"eslint.packageManager": "yarn",
7+
"eslint.enable": true,
8+
"typescript.tsdk": "node_modules/typescript/lib"
9+
}

e2e/example.test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
describe('example', () => {
2+
beforeAll(async () => {
3+
await page.goto('http://localhost:8080/')
4+
})
5+
6+
test('rendering', async () => {
7+
await expect(page).toMatch('こんにちは、世界!')
8+
})
9+
})

example/App.vue

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<template>
2+
<p>{{ $t('hello') }}</p>
3+
</template>
4+
5+
<script>
6+
export default {
7+
name: 'App'
8+
}
9+
</script>
10+
11+
<i18n>
12+
{
13+
"en": {
14+
"hello": "hello, world!"
15+
},
16+
"ja": {
17+
"hello": "こんにちは、世界!"
18+
}
19+
}
20+
</i18n>

example/index.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>vue-i18n-loader example</title>
6+
</head>
7+
<body>
8+
<div id="app"></div>
9+
<script src="/dist/bundle.js"></script>
10+
</body>
11+
</html>

example/main.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import Vue from 'vue'
2+
import VueI18n from 'vue-i18n'
3+
import App from './App.vue'
4+
5+
Vue.use(VueI18n)
6+
7+
const i18n = new VueI18n({
8+
locale: 'ja',
9+
messages: {}
10+
})
11+
12+
new Vue({
13+
i18n,
14+
el: '#app',
15+
render: h => h(App)
16+
})

0 commit comments

Comments
 (0)