-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5fdb34e
Showing
13 changed files
with
421 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"rules": { | ||
"indent": [ | ||
2, | ||
4 | ||
], | ||
"quotes": [ | ||
2, | ||
"double" | ||
], | ||
"linebreak-style": [ | ||
2, | ||
"unix" | ||
], | ||
"semi": [ | ||
2, | ||
"always" | ||
], | ||
"no-console": 0, | ||
"no-var": 2 | ||
}, | ||
"env": { | ||
"es6": true, | ||
"node": true, | ||
"browser": true, | ||
"jquery": true, | ||
"mocha": true | ||
}, | ||
"ecmaFeatures": { | ||
"modules": true | ||
}, | ||
"extends": "eslint:recommended" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
### https://raw.github.com/github/gitignore/408c616ae0ad8f4b8101d8e876b9b67ac6b14059/Node.gitignore | ||
|
||
# Logs | ||
logs | ||
*.log | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directory | ||
# Commenting this out is preferred by some people, see | ||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- | ||
node_modules | ||
|
||
|
||
### https://raw.github.com/github/gitignore/408c616ae0ad8f4b8101d8e876b9b67ac6b14059/Global/JetBrains.gitignore | ||
|
||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm | ||
|
||
*.iml | ||
|
||
## Directory-based project format: | ||
.idea/ | ||
# if you remove the above rule, at least ignore the following: | ||
|
||
# User-specific stuff: | ||
# .idea/workspace.xml | ||
# .idea/tasks.xml | ||
# .idea/dictionaries | ||
|
||
# Sensitive or high-churn files: | ||
# .idea/dataSources.ids | ||
# .idea/dataSources.xml | ||
# .idea/sqlDataSources.xml | ||
# .idea/dynamic.xml | ||
# .idea/uiDesigner.xml | ||
|
||
# Gradle: | ||
# .idea/gradle.xml | ||
# .idea/libraries | ||
|
||
# Mongo Explorer plugin: | ||
# .idea/mongoSettings.xml | ||
|
||
## File-based project format: | ||
*.ipr | ||
*.iws | ||
|
||
## Plugin-specific files: | ||
|
||
# IntelliJ | ||
out/ | ||
|
||
# mpeltonen/sbt-idea plugin | ||
.idea_modules/ | ||
|
||
# JIRA plugin | ||
atlassian-ide-plugin.xml | ||
|
||
# Crashlytics plugin (for Android Studio and IntelliJ) | ||
com_crashlytics_export_strings.xml | ||
crashlytics.properties | ||
crashlytics-build.properties | ||
|
||
|
||
# Book build output | ||
_book | ||
|
||
# eBook build output | ||
*.epub | ||
*.mobi | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"rules": { | ||
"no-undef": 0, | ||
"no-unused-vars": 0 | ||
}, | ||
"plugins": [ | ||
"markdown" | ||
], | ||
"extends": ".eslintrc" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"rules": { | ||
"max-ten": { | ||
"max": 3 | ||
}, | ||
"spellcheck-tech-word": true, | ||
"no-mix-dearu-desumasu": true, | ||
"no-start-duplicated-conjunction": { | ||
"interval": 2 | ||
}, | ||
"prh": { | ||
"rulePaths": [ | ||
"prh.yml" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# gitbook-start-kit | ||
|
||
[GitBook](https://www.gitbook.com/)のスタートアップキット。 | ||
|
||
## Installation | ||
|
||
GitBookを使った書籍を以下のようにするだけで書き始めることができます。 | ||
|
||
``` | ||
git clone gitbook-start-kit | ||
npm install | ||
npm start | ||
``` | ||
|
||
## Usage | ||
|
||
npm start | ||
|
||
GitBookのローカルサーバが立ち上がり、 http://localhost:4000/ にアクセスすることでプレビューできます。 | ||
|
||
npm run build | ||
|
||
単純にビルドだけをしたい場合は、`npm run build`で行うことができます。 | ||
|
||
### 文章を追加する | ||
|
||
gitbook-start-kitでは以下のようなディレクトリ構造になっています。 | ||
|
||
``` | ||
. | ||
├── README.md | ||
├── SUMMARY.md <= 目次 | ||
├── ja/ <= .mdの文章を追加する | ||
├── prh.yml | ||
├── src/ <= サンプルコード | ||
└── test/ <= サンプルコードのテスト | ||
``` | ||
|
||
文章を追加する`ja/`というディレクトリ名には独別な意味はないため好きな名前に変更して問題ありません。 | ||
|
||
文章を追加する場合は以下の手順で行うことができます。 | ||
|
||
1. `ja/` 以下にMarkdownファイルで文章を追加する | ||
2. `SUMMARY.md` に追加したMarkdownファイルへのリンクを書く | ||
|
||
追加した後は`npm start`などでGitBookでプレビューすれば表示を確認することができます。 | ||
(デフォルトで自動的にリロードされるようになっています。) | ||
|
||
|
||
## Tests | ||
|
||
|
||
npm test | ||
|
||
|
||
npm testで以下のテストが実行されます。 | ||
|
||
- [ESLint](http://eslint.org/ "ESLint")でのコードチェック | ||
- [textlint](https://github.com/azu/textlint "textlint")での文章チェック | ||
- [Mocha](http://mochajs.org/ "Mocha")でのテスト | ||
|
||
並列でテストを実行できるように[npm-run-all](https://github.com/mysticatea/npm-run-all "npm-run-all")を利用しています。 | ||
テスト結果の表示が混ざるのが気になる場合は、`--parallel`オプションを外してみてください。 | ||
|
||
## 表記揺れ | ||
|
||
[prh.yml](./prh.yml)に辞書を追加することで表記揺れをチェックすることができます。 | ||
詳しい設定方法については以下を参照して下さい。 | ||
|
||
- [textlint + prhで表記ゆれを検出する | Web Scratch](http://efcl.info/2015/09/14/textlint-rule-prh/ "textlint + prhで表記ゆれを検出する | Web Scratch") | ||
|
||
## Contributing | ||
|
||
1. Fork it! | ||
2. Create your feature branch: `git checkout -b my-new-feature` | ||
3. Commit your changes: `git commit -am 'Add some feature'` | ||
4. Push to the branch: `git push origin my-new-feature` | ||
5. Submit a pull request :D | ||
|
||
## License | ||
|
||
MIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
- [はじめに](ja/introduction.md) | ||
- [Hello World](ja/hello-world.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Hello World | ||
|
||
Hello World! | ||
|
||
`[import](path/to/file)` でJavaScriptファイルを読み込んで、CodeBlockとして展開することができます。 | ||
|
||
[import, hello-world.js](../src/hello-world.js) | ||
|
||
この機能はGitBookのプラグインで実装されています。 | ||
|
||
- [azu/gitbook-plugin-include-codeblock](https://github.com/azu/gitbook-plugin-include-codeblock "azu/gitbook-plugin-include-codeblock") | ||
|
||
外部JavaScriptファイルはESLintによりチェックされます。 | ||
ESLintのルールは[.eslintrc](../.eslintrc)で定義されています。 | ||
|
||
また、インラインコードをCodeBlockに書いたJavaScriptもESLintによりチェックされます。 | ||
|
||
```js | ||
function helloWorld(name){ | ||
return `Hello World ${name}!`; | ||
} | ||
``` | ||
|
||
インラインコードのESLintのルールは[.md.eslintrc](../.md.eslintrc)で定義されています。 | ||
|
||
ESLintについての詳細は公式サイトを参照して下さい | ||
|
||
- [ESLint - Pluggable JavaScript linter](http://eslint.org/ "ESLint - Pluggable JavaScript linter") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# はじめに | ||
|
||
これはGitBookで書かれたスタートアップキットです。 | ||
|
||
主にJavaScriptについての書籍を書ける構成にしています。 | ||
|
||
構成要素としては以下のようになっています。 | ||
|
||
- [GitBook](https://www.gitbook.com/) | ||
- [textlint](https://github.com/azu/textlint "textlint") | ||
- [ESLint](http://eslint.org/ "ESLint") | ||
|
||
またデフォルトでは、ES6でコードを書きMochaでテストができるように設定されいます。 | ||
|
||
- [Babel](https://babeljs.io/ "Babel") | ||
- [Mocha](http://mochajs.org/ "Mocha") | ||
- [power-assert](https://github.com/power-assert-js/power-assert "power-assert") | ||
|
||
この部分はそれぞれの好みに変更して利用するといいと思います。 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"name": "gitbook-start-kit", | ||
"private": true, | ||
"license": "MIT", | ||
"version": "1.0.0", | ||
"description": "GitBook start kit.", | ||
"main": "index.js", | ||
"directories": { | ||
"test": "test" | ||
}, | ||
"scripts": { | ||
"prepublish": "gitbook install", | ||
"start": "gitbook serve", | ||
"build": "gitbook build", | ||
"eslint": "eslint src/**/*.js", | ||
"eslint:md": "eslint -c .md.eslintrc --ext .md ja/**/*.md", | ||
"textlint": "summary-to-path | xargs textlint -f pretty-error", | ||
"test:example": "find ./src -name '*-example.js' | xargs babel-node", | ||
"test:js": "mocha", | ||
"test": "npm-run-all --parallel test:js test:example textlint eslint:md eslint build" | ||
}, | ||
"keywords": [ | ||
"gitbook", | ||
"textlint" | ||
], | ||
"devDependencies": { | ||
"babel": "^5.8.23", | ||
"eslint": "^1.3.0", | ||
"eslint-plugin-markdown": "git://github.com/eslint/eslint-plugin-markdown.git", | ||
"espower-babel": "^3.3.0", | ||
"gitbook-cli": "^0.3.6", | ||
"gitbook-plugin-include-codeblock": "^1.4.0", | ||
"gitbook-plugin-japanese-support": "0.0.1", | ||
"gitbook-summary-to-path": "^1.0.1", | ||
"mocha": "^2.2.5", | ||
"power-assert": "^1.0.0", | ||
"npm-run-all": "^1.0.0", | ||
"textlint": "^3.6.0", | ||
"textlint-rule-max-ten": "^1.1.0", | ||
"textlint-rule-no-mix-dearu-desumasu": "^1.0.1", | ||
"textlint-rule-no-start-duplicated-conjunction": "^1.0.3", | ||
"textlint-rule-prh": "^1.0.1", | ||
"textlint-rule-spellcheck-tech-word": "^4.0.1" | ||
} | ||
} |
Oops, something went wrong.