Skip to content

Commit f91aaf6

Browse files
authored
Setup (#4)
* + srcDir: 'src/' * テストを実行できるようにした * Lint を実行できるようにした * SCSS を使えるようにした * + normalize.css@^8.0.1 * @nuxtjs/style-resources を導入した * stylelint を導入した * yarn stylelint:fix * fix: stylelint と eslint(with prettier)が競合 * コメントを書きたかったため .stylelintrc.json -> stylelint.config.js * new file: .circleci/config.yml * new file: .node-version * Git コミット前に Lint を実行するようにした * imagemin で画像を圧縮できるようにした * /2019/ 配下で配信するようにした * README を更新した * Netlify にて / -> /2019/ へリダイレクトさせるようにした * Revert "Netlify にて / -> /2019/ へリダイレクトさせるようにした" This reverts commit 516317d. * CircleCI の Status Badge を表示させるようにした * fix: ERROR (node:22138) DeprecationWarning: Tapable.plugin is deprecated. Use new API on .hooks instead * + "description": "Vue Fes Japan 2019", * 不要になったコメントを削除した * fix typo
1 parent b882cc8 commit f91aaf6

37 files changed

+2845
-519
lines changed

.circleci/config.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Javascript Node CircleCI 2.0 configuration file
2+
#
3+
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
4+
#
5+
version: 2
6+
jobs:
7+
build:
8+
docker:
9+
# specify the version you desire here
10+
- image: circleci/node:10.15.3-browsers
11+
12+
# Specify service dependencies here if necessary
13+
# CircleCI maintains a library of pre-built images
14+
# documented at https://circleci.com/docs/2.0/circleci-images/
15+
# - image: circleci/mongo:3.4.4
16+
17+
working_directory: ~/repo
18+
19+
steps:
20+
- checkout
21+
22+
# Download and cache dependencies
23+
- restore_cache:
24+
keys:
25+
- v1-dependencies-{{ checksum "package.json" }}
26+
# fallback to using the latest cache if no exact match is found
27+
- v1-dependencies-
28+
29+
- run: yarn install
30+
31+
- save_cache:
32+
paths:
33+
- node_modules
34+
key: v1-dependencies-{{ checksum "package.json" }}
35+
36+
- run: yarn lint
37+
- run: yarn test:ci

.eslintrc.js

+11-5
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,15 @@ module.exports = {
1212
'plugin:nuxt/recommended',
1313
'plugin:prettier/recommended'
1414
],
15-
plugins: [
16-
'prettier'
17-
],
18-
// add your custom rules here
19-
rules: {}
15+
plugins: ['prettier'],
16+
rules: {
17+
'vue/html-self-closing': [
18+
'error',
19+
{
20+
html: {
21+
void: 'always'
22+
}
23+
}
24+
]
25+
}
2026
}

.node-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
10.15.3

README.md

+35-14
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,43 @@
1-
# vuefes-2019
1+
# Vue Fes Japan 2019
22

3-
> My tiptop Nuxt.js project
3+
[![CircleCI](https://circleci.com/gh/kazupon/vuefes-2019.svg?style=svg&circle-token=2e5a81f10b558c9aa99c38a2acc9bc862b20c860)](https://circleci.com/gh/kazupon/vuefes-2019)
44

5-
## Build Setup
5+
このリポジトリは Vue Fes Japan 2019 の Web サイトのソースコードです。
66

7-
``` bash
8-
# install dependencies
9-
$ yarn install
7+
## Setup
108

11-
# serve with hot reload at localhost:3000
12-
$ yarn run dev
9+
```shell
10+
yarn install
11+
```
12+
13+
## Development
14+
15+
下記コマンドを実行すると Web サーバーがホットリロードで起動して `http://localhost:3000/2019/` で確認できます。
16+
17+
```shell
18+
yarn dev
19+
```
20+
21+
### 画像の最適化
1322

14-
# build for production and launch server
15-
$ yarn run build
16-
$ yarn start
23+
画像ファイルを追加または変更した場合には、コミット時に imagemin により自動で最適化されます。
1724

18-
# generate static project
19-
$ yarn run generate
25+
ただし Windows を使っている場合にエラーが発生するという報告を受けています。画像の最適化をスキップする場合はコミット時に `--no-verify` オプションを使ってください。
26+
27+
```shell
28+
git commit --no-verify
29+
```
30+
31+
## Testing
32+
33+
```shell
34+
yarn test
2035
```
2136

22-
For detailed explanation on how things work, checkout [Nuxt.js docs](https://nuxtjs.org).
37+
## Generate
38+
39+
下記コマンドを実行すると、静的ファイルを `dist/2019/` 配下に生成できます。
40+
41+
```shell
42+
yarn generate
43+
```

bin/imagemin

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
3+
# Fail on unset variables and command errors
4+
set -ue -o pipefail
5+
6+
# Prevent commands misbehaving due to locale differences
7+
export LC_ALL=C
8+
9+
for file in `git diff --cached --name-status | \
10+
awk '$1 ~ /[AM]/ && tolower($2) ~ /\.(jpe?g|png|gif|svg)$/ {print $2}'`
11+
do
12+
echo $file を最適化します
13+
cat $file | ./node_modules/.bin/imagemin \
14+
--plugin=mozjpeg \
15+
--plugin=gifsicle \
16+
--plugin=pngquant \
17+
--plugin=optipng \
18+
--plugin=svgo > ${file}.new
19+
mv -f ${file}.new $file
20+
git add $file
21+
done

jest.config.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
module.exports = {
22
moduleNameMapper: {
3-
'^@/(.*)$': '<rootDir>/$1',
4-
'^~/(.*)$': '<rootDir>/$1',
3+
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
4+
'<rootDir>/test/unit/__mocks__/fileMock.js',
5+
'\\.(css|scss)$': '<rootDir>/test/unit/__mocks__/styleMock.js',
6+
'^@/(.*)$': '<rootDir>/src/$1',
7+
'^~/(.*)$': '<rootDir>/src/$1',
58
'^vue$': 'vue/dist/vue.common.js'
69
},
710
moduleFileExtensions: ['js', 'vue', 'json'],

nuxt.config.js

+33-32
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
const pkg = require('./package')
1+
import StylelintPlugin from 'stylelint-webpack-plugin'
2+
import pkg from './package'
23

3-
module.exports = {
4+
export default {
45
mode: 'universal',
5-
6-
/*
7-
** Headers of the page
8-
*/
6+
srcDir: 'src/',
7+
router: {
8+
base: '/2019/'
9+
},
910
head: {
1011
title: pkg.name,
1112
meta: [
@@ -15,44 +16,44 @@ module.exports = {
1516
],
1617
link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }]
1718
},
18-
19-
/*
20-
** Customize the progress-bar color
21-
*/
2219
loading: { color: '#fff' },
23-
24-
/*
25-
** Global CSS
26-
*/
27-
css: [],
28-
29-
/*
30-
** Plugins to load before mounting the App
31-
*/
20+
css: [{ src: '~/assets/stylesheets/main.scss', lang: 'scss' }],
3221
plugins: [],
33-
34-
/*
35-
** Nuxt.js modules
36-
*/
37-
modules: ['@nuxtjs/pwa'],
38-
39-
/*
40-
** Build configuration
41-
*/
22+
modules: [
23+
'@nuxtjs/style-resources',
24+
[
25+
'@nuxtjs/pwa',
26+
{
27+
icon: {
28+
iconSrc: 'src/static/apple-touch-icon.png'
29+
}
30+
}
31+
]
32+
],
4233
build: {
43-
/*
44-
** You can extend webpack config here
45-
*/
4634
extend(config, ctx) {
47-
// Run ESLint on save
4835
if (ctx.isDev && ctx.isClient) {
4936
config.module.rules.push({
5037
enforce: 'pre',
5138
test: /\.(js|vue)$/,
5239
loader: 'eslint-loader',
5340
exclude: /(node_modules)/
5441
})
42+
config.plugins.push(
43+
new StylelintPlugin({
44+
files: ['**/*.vue', '**/*.scss']
45+
})
46+
)
5547
}
5648
}
49+
},
50+
generate: {
51+
dir: 'dist/2019'
52+
},
53+
styleResources: {
54+
scss: [
55+
'~/assets/stylesheets/foundation/variables.scss',
56+
'~/assets/stylesheets/foundation/colors.scss'
57+
]
5758
}
5859
}

package.json

+41-15
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,70 @@
11
{
22
"name": "vuefes-2019",
33
"version": "1.0.0",
4-
"description": "My tiptop Nuxt.js project",
5-
"author": "INOUE Takuya",
4+
"description": "Vue Fes Japan 2019",
5+
"author": "INOUE Takuya <[email protected]>",
66
"private": true,
77
"scripts": {
88
"dev": "nuxt",
99
"build": "nuxt build",
1010
"start": "nuxt start",
1111
"generate": "nuxt generate",
12-
"lint": "eslint --ext .js,.vue --ignore-path .gitignore .",
13-
"precommit": "npm run lint",
14-
"test": "jest"
12+
"imagemin": "imagemin --plugin=mozjpeg --plugin=gifsicle --plugin=pngquant --plugin=optipng --plugin=svgo",
13+
"lint": "yarn eslint && yarn stylelint",
14+
"lint:fix": "yarn eslint:fix && yarn stylelint:fix",
15+
"eslint": "eslint --ext .js,.vue --ignore-path .gitignore .",
16+
"eslint:fix": "yarn eslint --fix",
17+
"stylelint": "stylelint 'src/**/*.vue' 'src/**/*.scss'",
18+
"stylelint:fix": "yarn stylelint --fix",
19+
"test": "jest --verbose",
20+
"test:ci": "jest --ci --coverage --no-cache"
21+
},
22+
"husky": {
23+
"hooks": {
24+
"pre-commit": "yarn lint && ./bin/imagemin"
25+
}
1526
},
1627
"dependencies": {
28+
"@nuxtjs/pwa": "^3.0.0-beta.12",
1729
"cross-env": "^5.2.0",
18-
"nuxt": "^2.4.0",
19-
"@nuxtjs/pwa": "^2.6.0"
30+
"normalize.css": "^8.0.1",
31+
"nuxt": "^2.4.0"
2032
},
2133
"devDependencies": {
22-
"nodemon": "^1.18.9",
2334
"@nuxtjs/eslint-config": "^0.0.1",
35+
"@nuxtjs/style-resources": "^0.1.2",
36+
"@vue/test-utils": "^1.0.0-beta.27",
37+
"babel-core": "7.0.0-bridge.0",
2438
"babel-eslint": "^8.2.1",
39+
"babel-jest": "^24.1.0",
2540
"eslint": "^5.0.1",
41+
"eslint-config-prettier": "^3.1.0",
2642
"eslint-config-standard": ">=12.0.0",
43+
"eslint-loader": "^2.0.0",
2744
"eslint-plugin-import": ">=2.14.0",
2845
"eslint-plugin-jest": ">=21.24.1",
2946
"eslint-plugin-node": ">=7.0.1",
3047
"eslint-plugin-nuxt": ">=0.4.2",
48+
"eslint-plugin-prettier": "2.6.2",
3149
"eslint-plugin-promise": ">=4.0.1",
3250
"eslint-plugin-standard": ">=4.0.0",
33-
"eslint-loader": "^2.0.0",
3451
"eslint-plugin-vue": "^5.0.0",
35-
"eslint-config-prettier": "^3.1.0",
36-
"eslint-plugin-prettier": "2.6.2",
37-
"prettier": "1.14.3",
38-
"@vue/test-utils": "^1.0.0-beta.27",
39-
"babel-core": "7.0.0-bridge.0",
40-
"babel-jest": "^24.1.0",
52+
"husky": "^1.3.1",
53+
"imagemin-cli": "^4.0.1",
54+
"imagemin-gifsicle": "^6.0.1",
55+
"imagemin-mozjpeg": "^8.0.0",
56+
"imagemin-optipng": "^6.0.0",
57+
"imagemin-pngquant": "^7.0.0",
58+
"imagemin-svgo": "^7.0.0",
4159
"jest": "^24.1.0",
60+
"node-sass": "^4.11.0",
61+
"nodemon": "^1.18.9",
62+
"prettier": "1.14.3",
63+
"sass-loader": "^7.1.0",
64+
"stylelint": "^9.10.1",
65+
"stylelint-config-standard": "^18.2.0",
66+
"stylelint-scss": "^3.5.4",
67+
"stylelint-webpack-plugin": "^0.10.5",
4268
"vue-jest": "^3.0.3"
4369
}
4470
}
File renamed without changes.

src/assets/images/icon-github.svg

+1
Loading

src/assets/images/icon-twitter.svg

+1
Loading

src/assets/images/logo-facebook.svg

+1
Loading
Loading

src/assets/images/logo-twitter.svg

+1
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
$vue-dark-blue: #34495e;
2+
$vue-green: #42b983;
3+
4+
$white: #fff;
5+
$gray: #d4d4d4;
6+
$black: #000;
7+
8+
// Primary color
9+
10+
$primary-color: $vue-dark-blue;
11+
12+
// Text color
13+
14+
$primary-text-color: $black;
15+
$primary-text-color--inverse: $white;
16+
$haze-text-color: $gray;

0 commit comments

Comments
 (0)