Skip to content

Commit 60f0d78

Browse files
committed
Initial commit
1 parent dedd20c commit 60f0d78

File tree

15 files changed

+8523
-2
lines changed

15 files changed

+8523
-2
lines changed

.gitignore

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# Created by https://www.toptal.com/developers/gitignore/api/node
2+
# Edit at https://www.toptal.com/developers/gitignore?templates=node
3+
4+
### Node ###
5+
# Logs
6+
logs
7+
*.log
8+
npm-debug.log*
9+
yarn-debug.log*
10+
yarn-error.log*
11+
lerna-debug.log*
12+
13+
# Diagnostic reports (https://nodejs.org/api/report.html)
14+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
15+
16+
# Runtime data
17+
pids
18+
*.pid
19+
*.seed
20+
*.pid.lock
21+
22+
# Directory for instrumented libs generated by jscoverage/JSCover
23+
lib-cov
24+
25+
# Coverage directory used by tools like istanbul
26+
coverage
27+
*.lcov
28+
29+
# nyc test coverage
30+
.nyc_output
31+
32+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
33+
.grunt
34+
35+
# Bower dependency directory (https://bower.io/)
36+
bower_components
37+
38+
# node-waf configuration
39+
.lock-wscript
40+
41+
# Compiled binary addons (https://nodejs.org/api/addons.html)
42+
build/Release
43+
44+
# Dependency directories
45+
node_modules/
46+
jspm_packages/
47+
48+
# TypeScript v1 declaration files
49+
typings/
50+
51+
# TypeScript cache
52+
*.tsbuildinfo
53+
54+
# Optional npm cache directory
55+
.npm
56+
57+
# Optional eslint cache
58+
.eslintcache
59+
60+
# Optional stylelint cache
61+
.stylelintcache
62+
63+
# Microbundle cache
64+
.rpt2_cache/
65+
.rts2_cache_cjs/
66+
.rts2_cache_es/
67+
.rts2_cache_umd/
68+
69+
# Optional REPL history
70+
.node_repl_history
71+
72+
# Output of 'npm pack'
73+
*.tgz
74+
75+
# Yarn Integrity file
76+
.yarn-integrity
77+
78+
# dotenv environment variables file
79+
.env
80+
.env.test
81+
.env*.local
82+
83+
# parcel-bundler cache (https://parceljs.org/)
84+
.cache
85+
.parcel-cache
86+
87+
# Next.js build output
88+
.next
89+
90+
# Nuxt.js build / generate output
91+
.nuxt
92+
dist
93+
94+
# Gatsby files
95+
.cache/
96+
# Comment in the public line in if your project uses Gatsby and not Next.js
97+
# https://nextjs.org/blog/next-9-1#public-directory-support
98+
# public
99+
100+
# vuepress build output
101+
.vuepress/dist
102+
103+
# Serverless directories
104+
.serverless/
105+
106+
# FuseBox cache
107+
.fusebox/
108+
109+
# DynamoDB Local files
110+
.dynamodb/
111+
112+
# TernJS port file
113+
.tern-port
114+
115+
# Stores VSCode versions used for testing VSCode extensions
116+
.vscode-test
117+
118+
# End of https://www.toptal.com/developers/gitignore/api/node

.prettierrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"printWidth": 80,
3+
"tabWidth": 2,
4+
"useTabs": false,
5+
"semi": true,
6+
"singleQuote": true,
7+
"trailingComma": "none",
8+
"bracketSpacing": true,
9+
"jsxBracketSameLine": false,
10+
"fluid": false
11+
}

README.md

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,38 @@
1-
# my-starter-ts-npm-cli-and-lib
2-
Created with CodeSandbox
1+
# my-starter-npm-cli-and-lib
2+
3+
typescript で npm 用の CLI とライブラリのパッケージを作成するスターター。
4+
5+
## 利用方法
6+
7+
まだ記述の途中。
8+
9+
1. GitHub から import する(GitHubBox からは https://githubbox.com/hankei6km/my-starter-npm-cli-and-lib)
10+
1. fork
11+
1. `package.json``name` `version` `description` `license` あたりを新しいパッケージにあわせて変更。
12+
1. 新しい terminal を開き `$ npm run upgrade-interactive` 等でパッケージを更新。
13+
14+
これで 'npm run csb:test'(`jest --watchAll`) が terminal(「yarn start」タブ) 内で実行される。
15+
16+
コマンドとしての実行を試す場合は `npm run start -- foo.txt` のように実行する。
17+
18+
### CLI 部分の変更
19+
20+
- コマンド名(スクリプト名)を変更: `package.json``bin``src/main.ts``scriptName` を変更。
21+
- コマンドのフラグ等を変更: `src/main.ts` を編集。
22+
- コマンドの処理を変更: `src/cli.ts` を編集。
23+
24+
### ライブラリ部分の変更
25+
26+
`src/count.ts` を削除し、ライブラリのコードを記述。エクスポートしたい項目を `src/index.ts` へ記述。
27+
28+
## 既知の問題
29+
30+
## 参考
31+
32+
- [TypeScript で npm ライブラリ開発ことはじめ - Qiita](https://qiita.com/saltyshiomix/items/d889ba79978dadba63fd)
33+
- [TypeScript で CLI ツールを作って、npm パッケージにする - Qiita](https://qiita.com/suzuki_sh/items/f3349efbfe1bdfc0c634)
34+
- [yarn upgrade-interactive と同じように npm でも対話型な更新をしたい! - Qiita](https://qiita.com/kotarella1110/items/08afeb61d493829711eb)
35+
36+
## ライセンス
37+
38+
[CC0 1.0](http://creativecommons.org/publicdomain/zero/1.0/deed.ja)

jest.config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = {
2+
roots: ['<rootDir>/src'],
3+
testMatch: [
4+
'**/__tests__/**/*.+(ts|tsx|js)',
5+
'**/?(*.)+(spec|test).+(ts|tsx|js)'
6+
],
7+
transform: {
8+
'^.+\\.(ts|tsx)$': 'ts-jest'
9+
}
10+
};

0 commit comments

Comments
 (0)