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
65
0
Share
如何写出一个优秀的开源库
ningzbruc
November 27, 2020
More Decks by ningzbruc
See All by ningzbruc
去啊无线前端的一天
ningzbruc
1
180
React & Component
ningzbruc
0
44
阿里旅行去啊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
OCRを使ってゲームのアイテムをデータ化する
kishikawakatsumi
0
120
開発とはなにか、Essenceカーネルで見えるもの
ukin0k0
0
220
AIエージェントと協働するCLI開発 — BunとOpenClawで学んだこと
yoshikouki
1
220
生成AI時代にこそ効くGo | Why Go Works in the Age of Generative AI
mom0tomo
7
2.8k
バックエンドにElysiaJSを採用して気付いた、良い点・悪い点
wanko_it
1
180
Moments When Things Go Wrong
aurimas
3
120
Migrations : C'est une question d'hygiène !
vinceamstoutz
0
2.2k
ビジネスモデルから紐解く、AI+型駆動開発
hirokiomote
2
3k
Oxcを導入して開発体験が向上した話
yug1224
4
180
デフォルト運用のCodeRabbit、1年で何が変わったか / How CodeRabbit Changed Our Code Review in 1 Year
bake0937
1
110
New "Type" system on PicoRuby
pocke
1
220
JavaDoc 再入門
nagise
0
160
Featured
See All Featured
Raft: Consensus for Rubyists
vanstee
141
7.4k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.9k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
3.2k
Discover your Explorer Soul
emna__ayadi
2
1.1k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
820
WENDY [Excerpt]
tessaabrams
10
37k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.1k
Side Projects
sachag
455
43k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
200
A Tale of Four Properties
chriscoyier
163
24k
BBQ
matthewcrist
89
10k
Building Adaptive Systems
keathley
44
3k
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