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
25
如何写出一个优秀的开源库
ningzbruc
November 27, 2020
Tweet
Share
More Decks by ningzbruc
See All by ningzbruc
去啊无线前端的一天
ningzbruc
1
130
React & Component
ningzbruc
0
14
阿里旅行去啊H5首页总结&Promise
ningzbruc
0
230
KISSY.Base - all about that Base
ningzbruc
0
87
Hammer.js
ningzbruc
1
310
淘宝旅行门票iPad版开发
ningzbruc
0
94
Travel on KISSY mini
ningzbruc
0
160
Events
ningzbruc
2
100
Why YUI3
ningzbruc
0
170
Other Decks in Programming
See All in Programming
[Do iOS '24] Ship your app on a Friday...and enjoy your weekend!
polpielladev
0
110
Compose 1.7のTextFieldはPOBox Plusで日本語変換できない
tomoya0x00
0
200
色々なIaCツールを実際に触って比較してみる
iriikeita
0
340
Remix on Hono on Cloudflare Workers
yusukebe
1
310
シェーダーで魅せるMapLibreの動的ラスタータイル
satoshi7190
1
480
Vapor Revolution
kazupon
1
180
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
100
Click-free releases & the making of a CLI app
oheyadam
2
120
as(型アサーション)を書く前にできること
marokanatani
10
2.7k
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
340
watsonx.ai Dojo #4 生成AIを使ったアプリ開発、応用編
oniak3ibm
PRO
1
180
Jakarta EE meets AI
ivargrimstad
0
670
Featured
See All Featured
Embracing the Ebb and Flow
colly
84
4.5k
A designer walks into a library…
pauljervisheath
204
24k
Navigating Team Friction
lara
183
14k
Making the Leap to Tech Lead
cromwellryan
133
8.9k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Keith and Marios Guide to Fast Websites
keithpitt
409
22k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
16
2.1k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.3k
Code Review Best Practice
trishagee
64
17k
How STYLIGHT went responsive
nonsquared
95
5.2k
Statistics for Hackers
jakevdp
796
220k
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