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
0
46
如何写出一个优秀的开源库
ningzbruc
November 27, 2020
Tweet
Share
More Decks by ningzbruc
See All by ningzbruc
去啊无线前端的一天
ningzbruc
1
150
React & Component
ningzbruc
0
31
阿里旅行去啊H5首页总结&Promise
ningzbruc
0
250
KISSY.Base - all about that Base
ningzbruc
0
110
Hammer.js
ningzbruc
1
330
淘宝旅行门票iPad版开发
ningzbruc
0
120
Travel on KISSY mini
ningzbruc
0
180
Events
ningzbruc
2
120
Why YUI3
ningzbruc
0
180
Other Decks in Programming
See All in Programming
Navigation 2 を 3 に移行する(予定)ためにやったこと
yokomii
0
180
プロポーザル駆動学習 / Proposal-Driven Learning
mackey0225
2
1.3k
旅行プランAIエージェント開発の裏側
ippo012
2
900
ぬるぬる動かせ! Riveでアニメーション実装🐾
kno3a87
1
220
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
370
Ruby×iOSアプリ開発 ~共に歩んだエコシステムの物語~
temoki
0
270
Ruby Parser progress report 2025
yui_knk
1
440
ProxyによるWindow間RPC機構の構築
syumai
3
1.2k
請來的 AI Agent 同事們在寫程式時,怎麼用 pytest 去除各種幻想與盲點
keitheis
0
120
AIコーディングAgentとの向き合い方
eycjur
0
270
Processing Gem ベースの、2D レトロゲームエンジンの開発
tokujiros
2
130
go test -json そして testing.T.Attr / Kyoto.go #63
utgwkk
3
300
Featured
See All Featured
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.7k
Git: the NoSQL Database
bkeepers
PRO
431
66k
jQuery: Nuts, Bolts and Bling
dougneiner
64
7.9k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
229
22k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.5k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
44
2.5k
Unsuck your backbone
ammeep
671
58k
KATA
mclloyd
32
14k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
36
2.5k
Gamification - CAS2011
davidbonilla
81
5.4k
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