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
29
如何写出一个优秀的开源库
ningzbruc
November 27, 2020
Tweet
Share
More Decks by ningzbruc
See All by ningzbruc
去啊无线前端的一天
ningzbruc
1
140
React & Component
ningzbruc
0
19
阿里旅行去啊H5首页总结&Promise
ningzbruc
0
240
KISSY.Base - all about that Base
ningzbruc
0
91
Hammer.js
ningzbruc
1
310
淘宝旅行门票iPad版开发
ningzbruc
0
100
Travel on KISSY mini
ningzbruc
0
160
Events
ningzbruc
2
110
Why YUI3
ningzbruc
0
180
Other Decks in Programming
See All in Programming
Immutable ActiveRecord
megane42
0
140
Unity Android XR入門
sakutama_11
0
150
『GO』アプリ データ基盤のログ収集システムコスト削減
mot_techtalk
0
120
時計仕掛けのCompose
mkeeda
1
290
パスキーのすべて ── 導入・UX設計・実装の紹介 / 20250213 パスキー開発者の集い
kuralab
3
730
最近のVS Codeで気になるニュース 2025/01
74th
1
260
動作確認やテストで漏れがちな観点3選
starfish719
6
1k
ソフトウェアエンジニアの成長
masuda220
PRO
10
920
TokyoR116_BeginnersSession1_環境構築
kotatyamtema
0
110
“あなた” の開発を支援する AI エージェント Bedrock Engineer / introducing-bedrock-engineer
gawa
11
1.9k
定理証明プラットフォーム lapisla.net
abap34
1
1.8k
Domain-Driven Transformation
hschwentner
2
1.9k
Featured
See All Featured
Building a Scalable Design System with Sketch
lauravandoore
460
33k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7.1k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
193
16k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
49
2.3k
A designer walks into a library…
pauljervisheath
205
24k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
40
2k
Raft: Consensus for Rubyists
vanstee
137
6.8k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
33
2.8k
Thoughts on Productivity
jonyablonski
69
4.5k
Fireside Chat
paigeccino
34
3.2k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.3k
A Modern Web Designer's Workflow
chriscoyier
693
190k
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