Skip to content

Commit 8d04644

Browse files
authored
Merge pull request #5 from hankei6km/topic/update-package-info
Update package info
2 parents 448723c + 41c199d commit 8d04644

File tree

5 files changed

+37
-20
lines changed

5 files changed

+37
-20
lines changed

README.md

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,15 @@ CodeSandbox 上でコードを編集し、GitHub Actions から npm レジスト
55

66
## 利用方法
77

8-
まだ記述の途中。
9-
108
1. GitHub から import する(GitHubBox からは https://githubbox.com/hankei6km/my-starter-npm-cli-and-lib)
119
1. fork
12-
1. `package.json` `name` `version` `description` `license``LICENSE` あたりを新しいパッケージにあわせて変更
10+
1. `package.json` `LICENSE` 等を新しいパッケージにあわせて変更(付録にテンプレート)
1311
1. 新しい terminal を開き `$ npm run upgrade-interactive` 等でパッケージを更新
12+
1. ブラウザーをリロードする
1413

15-
これで 'npm run csb:test'(`jest --watchAll`) が terminal(「yarn start」タブ) 内で実行される
14+
これで terminal(「yarn start」タブ) 内で `start` スクリプトが実行される(通常はエラーとなる)、後は必要に応じてコードの編集等を行う
1615

17-
コマンドとしての実行を試す場合は `npm run start -- foo.txt` のように実行する。
16+
テストの実行は CodeSandbox 上では `npm run csb:test` を利用する。コマンドとしての実行を試す場合は `npm run start -- foo.txt` のように実行する。
1817

1918
### CLI 部分の変更
2019

@@ -28,24 +27,40 @@ CodeSandbox 上でコードを編集し、GitHub Actions から npm レジスト
2827

2928
### npm publish
3029

31-
GitHub で Release を Publish するとビルド実行後に `npm pulish` される。
30+
GitHub で Release を Publish すると `npm pbulish` される。
31+
32+
なお、`prepublishOnly` 等は定義されていないので、手動で `npm publish` を実行してもビルドはされないので注意。
3233

33-
なお、`prepublishOnly` 等は定義されていないので、手動で `npm publish` 等を実行してもビルドはされないので注意。
34+
## 付録
3435

36+
`package.json` に記述する情報のテンプレート。`license` を変更したら `LICENSE` ファイルの変更も忘れずに。
3537

36-
## 既知の問題
38+
```
39+
"name": "<package-name>",
40+
"version": "0.1.0",
41+
"description": "<description>",
42+
"author": "user <mail addr> (website url)",
43+
"license": "MIT",
44+
"repository": {
45+
"type": "git",
46+
"url": "git://github.com/<user>/<repository>.git"
47+
},
48+
"bugs": {
49+
"url": "https://github.com/<user>/<repository>/issues"
50+
},
51+
"keywords": []
52+
```
3753

3854
## 参考
3955

4056
- [TypeScript で npm ライブラリ開発ことはじめ - Qiita](https://qiita.com/saltyshiomix/items/d889ba79978dadba63fd)
4157
- [TypeScript で CLI ツールを作って、npm パッケージにする - Qiita](https://qiita.com/suzuki_sh/items/f3349efbfe1bdfc0c634)
4258
- [yarn upgrade-interactive と同じように npm でも対話型な更新をしたい! - Qiita](https://qiita.com/kotarella1110/items/08afeb61d493829711eb)
43-
- [Node.jsパッケージの公開 - GitHub Docs](https://docs.github.com/ja/actions/guides/publishing-nodejs-packages)
44-
- [GitHub Actionsでnpmに自動でリリースするworkflowを作ってみた | DevelopersIO](https://dev.classmethod.jp/articles/github-actions-npm-automatic-release/)
59+
- [Node.js パッケージの公開 - GitHub Docs](https://docs.github.com/ja/actions/guides/publishing-nodejs-packages)
60+
- [GitHub Actions で npm に自動でリリースする workflow を作ってみた | DevelopersIO](https://dev.classmethod.jp/articles/github-actions-npm-automatic-release/)
4561

4662
## ライセンス
4763

4864
MIT License
4965

5066
Copyright (c) 2021 hankei6km
51-

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
{
22
"name": "my-starter-ts-npm-cli-and-lib",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"description": "Typescript で CLI とライブラリの npm パッケージを作成するためのスターター。",
5+
"license": "MIT",
6+
"keywords": [],
57
"main": "dist/index.js",
8+
"types": "dist/index.d.ts",
69
"files": [
710
"dist"
811
],
912
"bin": {
10-
"count": "./dist/main.js"
13+
"count": "dist/main.js"
1114
},
12-
"license": "MIT",
1315
"scripts": {
1416
"start": "tsc && node dist/main.js",
1517
"start:watch": "nodemon --watch src --ext ts --exec ts-node src/main.ts",
1618
"build": "tsc",
1719
"test": "jest",
1820
"clean": "rm dist/*",
1921
"upgrade-interactive": "npm-check --update",
20-
"csb:test": "npm test -- --watchAll"
22+
"csb:test": "npm test -- --runInBand --watchAll"
2123
},
2224
"dependencies": {
2325
"yargs": "^16.2.0"
@@ -32,6 +34,5 @@
3234
"ts-jest": "^26.5.5",
3335
"ts-node": "^9.1.1",
3436
"typescript": "^4.2.4"
35-
},
36-
"keywords": []
37+
}
3738
}

sandbox.config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"view": "browser",
55
"template": "node",
66
"container": {
7-
"startScript": "csb:test",
7+
"startScript": "start",
88
"node": "14"
99
}
1010
}

src/main.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import cli from './cli';
55

66
const argv = yargs(hideBin(process.argv))
77
.scriptName('count')
8-
.usage('$0 [args]')
8+
.usage('$0 [FILE]...')
9+
.example('$0 foo.ts bar.ts', 'count chars in files')
910
.demand(1)
1011
.help().argv;
1112

0 commit comments

Comments
 (0)