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
64
0
Share
如何写出一个优秀的开源库
ningzbruc
November 27, 2020
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
130
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
Vibe NLP for Applied NLP
inesmontani
PRO
0
360
Running Swift without an OS
kishikawakatsumi
0
780
3分でわかるatama plusのQA/about atama plus QA
atamaplus
0
150
レガシーPHP転生 〜父がドメインエキスパートだったのでDDD+Claude Codeでチート開発します〜
panda_program
0
710
Offline should be the norm: building local-first apps with CRDTs & Kotlin Multiplatform
renaudmathieu
0
190
CursorとClaudeCodeとCodexとOpenCodeを実際に比較してみた
terisuke
1
420
存在論的プログラミング: 時間と存在を記述する
koriym
5
860
LM Linkで(非力な!)ノートPCでローカルLLM
seosoft
0
460
瑠璃の宝石に学ぶ技術の声の聴き方 / 【劇場版】アニメから得た学びを発表会2026 #エンジニアニメ
mazrean
0
230
Claude Codeをカスタムして自分だけのClaude Codeを作ろう
terisuke
0
120
Laravel Nightwatchの裏側 - Laravel公式Observabilityツールを支える設計と実装
avosalmon
1
330
AI-DLC Deep Dive
yuukiyo
5
1.1k
Featured
See All Featured
Building Applications with DynamoDB
mza
96
7k
The agentic SEO stack - context over prompts
schlessera
0
740
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
64
53k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.4k
Thoughts on Productivity
jonyablonski
76
5.1k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
200
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
25k
SEO for Brand Visibility & Recognition
aleyda
0
4.5k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
490
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
430
How GitHub (no longer) Works
holman
316
150k
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