Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
如何写出一个优秀的开源库
Search
ningzbruc
November 27, 2020
Programming
66
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
如何写出一个优秀的开源库
ningzbruc
November 27, 2020
More Decks by ningzbruc
See All by ningzbruc
去啊无线前端的一天
ningzbruc
1
190
React & Component
ningzbruc
0
45
阿里旅行去啊H5首页总结&Promise
ningzbruc
0
270
KISSY.Base - all about that Base
ningzbruc
0
140
Hammer.js
ningzbruc
1
340
淘宝旅行门票iPad版开发
ningzbruc
0
140
Travel on KISSY mini
ningzbruc
0
210
Events
ningzbruc
2
130
Why YUI3
ningzbruc
0
190
Other Decks in Programming
See All in Programming
任せる範囲はこう広がった / How the Scope of AI Delegation Has Expanded
nrslib
1
280
関数型プログラミングのメリットって何だろう?
wanko_it
0
200
Embedded SREと共に達成した会員管理システムのAWS移行 - SRE NEXT 2026 ランチスポンサーセッション
niftycorp
PRO
1
3.1k
AI時代のPHPer生存戦略 ~「言語、もうなんでもよくない?」に本気で向き合う~
vivion
0
190
霧の中の代数的エフェクト
funnyycat
1
430
jsmini JavaScript Engine を作ってみた話
yosuke_furukawa
PRO
0
250
はてなアカウント基盤 State of the Union
cockscomb
1
1.3k
為什麼你並不需要ViewModel / No, you don't need a ViewModel
lovee
1
410
琵琶湖の水は止められてもNet--HTTPのリトライは止められない / You might be able to stop the water flow of Lake Biwa but you can't stop Net::HTTP retries
luccafort
PRO
0
460
AIエージェントで 変わるAndroid開発環境
takahirom
2
730
これからAgentCoreを触る方へトレンドはGatewayです
har1101
6
510
PHPだって関数型したい 〜できること、できないこと〜 / fp-in-php
jsoizo
1
250
Featured
See All Featured
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Designing for Timeless Needs
cassininazir
1
410
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
62
45k
Everyday Curiosity
cassininazir
0
260
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
880
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
190
The browser strikes back
jonoalderson
0
1.4k
Tell your own story through comics
letsgokoyo
1
1k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
Balancing Empowerment & Direction
lara
6
1.2k
Skip the Path - Find Your Career Trail
mkilby
1
170
Transcript
⻁⽛ 2020-11-27 如何写出⼀个优秀的开源库 $ npx create-nice-lib
# 优秀?
完整、严谨、规范、⾃动化 优秀 - 标准 优秀 = 信任
优秀 - 徽章 优秀 = 信任 = 点亮徽章
# 初始化
初始化 - init & npm init
初始化 - license
初始化 - license React BSD Lisence ⻛波
初始化 - license DEF License 检查
初始化 - eslint $ npm i eslint --save-dev $ npx
eslint --init "scripts": { "eslint": "eslint src/** --fix" }
初始化 - scripts https://docs.npmjs.com/cli/v6/using-npm/scripts https://www.ruanyifeng.com/blog/2016/10/npm_scripts.html
# 构建
构建 - 产物 • lib: commonjs => mai n •
esm: esmodule => modul e • dist: umd? => browser? https://unpkg.alibaba-inc.com/browse/
[email protected]
/dist/index.umd.js
构建 - ⼯具 • lib: commonjs => babe l •
esm: esmodule => babe l • dist: umd => rollup/webpack https://www.rollupjs.com/guide/tools/#babel
# 测试
测试 - ⼯具 https://medium.com/@ollelauribostr/start-measuring-coverage-with-jest-travis-ci-and-coveralls-1867928aca42 https://efe.baidu.com/blog/front-end-continuous-integration-tools/
测试 - 测试⽤例 import add from '../src/add' ; test('add: 1
+ 2 = 3',() => { expect(add(1, 2)).toBe(3) ; }) ; https://jestjs.io/docs/zh-Hans/getting-started
测试 - 覆盖率
测试 - 持续集成 https://travis-ci.com/
测试 - 覆盖率 https://coveralls.io/
# 提交
提交 - 规范 https://www.conventionalcommits.org/zh-hans/v1.0.0-beta.4/ conventionalcommits
提交 - 校验 https://www.npmjs.com/package/@commitlint/cli @commitlint/cli
提交 - ⼯具 https://www.npmjs.com/package/commitizen commitizen
# 发布
发布 - changelog & version standard-version https://www.npmjs.com/package/standard-version
发布 - github release https://www.npmjs.com/package/conventional-github-releaser conventional-github-releaser
发布 - npm beta
发布 - 徽章 https://shields.io/
发布 - readme/demo/site https://d.umijs.org/zh-CN
The End. $ npx create-nice-lib