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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
ningzbruc
November 27, 2020
Programming
0
64
如何写出一个优秀的开源库
ningzbruc
November 27, 2020
Tweet
Share
More Decks by ningzbruc
See All by ningzbruc
去啊无线前端的一天
ningzbruc
1
170
React & Component
ningzbruc
0
43
阿里旅行去啊H5首页总结&Promise
ningzbruc
0
270
KISSY.Base - all about that Base
ningzbruc
0
120
Hammer.js
ningzbruc
1
340
淘宝旅行门票iPad版开发
ningzbruc
0
140
Travel on KISSY mini
ningzbruc
0
200
Events
ningzbruc
2
130
Why YUI3
ningzbruc
0
180
Other Decks in Programming
See All in Programming
PHPのバージョンアップ時にも役立ったAST(2026年版)
matsuo_atsushi
0
240
Rで始めるML・LLM活用入門
wakamatsu_takumu
0
200
我々はなぜ「層」を分けるのか〜「関心の分離」と「抽象化」で手に入れる変更に強いシンプルな設計〜 #phperkaigi / PHPerKaigi 2026
shogogg
2
380
Nostalgia Meets Technology: Super Mario with TypeScript
manfredsteyer
PRO
0
110
コードレビューをしない選択 #でぃーぷらすトウキョウ
kajitack
3
1.1k
Fundamentals of Software Engineering In the Age of AI
therealdanvega
2
290
Angular-Apps smarter machen mit Gen AI: Lokal und offlinefähig - Hands-on Workshop!
christianliebel
PRO
0
130
条件判定に名前、つけてますか? #phperkaigi #c
77web
2
790
Java 21/25 Virtual Threads 소개
debop
0
270
S3ストレージクラスの「見える」「ある」「使える」は全部違う ─ 体験から見た、仕様の深淵を覗く
ya_ma23
0
1k
20260315 AWSなんもわからん🥲
chiilog
2
170
最初からAWS CDKで技術検証してもいいんじゃない?
akihisaikeda
4
170
Featured
See All Featured
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.5k
How to Think Like a Performance Engineer
csswizardry
28
2.5k
Rails Girls Zürich Keynote
gr2m
96
14k
Designing for Performance
lara
611
70k
Design in an AI World
tapps
0
180
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
160
Agile that works and the tools we love
rasmusluckow
331
21k
Building Adaptive Systems
keathley
44
3k
AI: The stuff that nobody shows you
jnunemaker
PRO
3
480
A designer walks into a library…
pauljervisheath
210
24k
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