Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
如何写出一个优秀的开源库
Search
ningzbruc
November 27, 2020
Programming
0
54
如何写出一个优秀的开源库
ningzbruc
November 27, 2020
Tweet
Share
More Decks by ningzbruc
See All by ningzbruc
去啊无线前端的一天
ningzbruc
1
160
React & Component
ningzbruc
0
38
阿里旅行去啊H5首页总结&Promise
ningzbruc
0
260
KISSY.Base - all about that Base
ningzbruc
0
120
Hammer.js
ningzbruc
1
330
淘宝旅行门票iPad版开发
ningzbruc
0
130
Travel on KISSY mini
ningzbruc
0
190
Events
ningzbruc
2
130
Why YUI3
ningzbruc
0
180
Other Decks in Programming
See All in Programming
AIコードレビューがチームの"文脈"を 読めるようになるまで
marutaku
0
350
UIデザインに役立つ 2025年の最新CSS / The Latest CSS for UI Design 2025
clockmaker
18
7.4k
大体よく分かるscala.collection.immutable.HashMap ~ Compressed Hash-Array Mapped Prefix-tree (CHAMP) ~
matsu_chara
2
220
Flutter On-device AI로 완성하는 오프라인 앱, 박제창 @DevFest INCHEON 2025
itsmedreamwalker
1
110
組み合わせ爆発にのまれない - 責務分割 x テスト
halhorn
1
150
リリース時」テストから「デイリー実行」へ!開発マネージャが取り組んだ、レガシー自動テストのモダン化戦略
goataka
0
130
手軽に積ん読を増やすには?/読みたい本と付き合うには?
o0h
PRO
1
170
dotfiles 式年遷宮 令和最新版
masawada
1
760
WebRTC、 綺麗に見るか滑らかに見るか
sublimer
1
160
Context is King? 〜Verifiability時代とコンテキスト設計 / Beyond "Context is King"
rkaga
9
1.1k
AIの誤りが許されない業務システムにおいて“信頼されるAI” を目指す / building-trusted-ai-systems
yuya4
6
3.2k
Full-Cycle Reactivity in Angular: SignalStore mit Signal Forms und Resources
manfredsteyer
PRO
0
130
Featured
See All Featured
Build The Right Thing And Hit Your Dates
maggiecrowley
38
3k
Writing Fast Ruby
sferik
630
62k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Rails Girls Zürich Keynote
gr2m
95
14k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
51k
Mobile First: as difficult as doing things right
swwweet
225
10k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.2k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.8k
The Language of Interfaces
destraynor
162
25k
Building Adaptive Systems
keathley
44
2.9k
Documentation Writing (for coders)
carmenintech
76
5.2k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.6k
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