1.0.51 • Published 6 months ago

hedelib v1.0.51

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

项目运行需同时打开两个终端

第一个:

npm start # or yarn start

第二个:

Storybook

Run inside another terminal:

yarn storybook

例子

Then run the example inside another:

cd example
npm i # or yarn to install dependencies
npm start # or yarn start

To do a one-off build, use npm run build or yarn build.

To run tests, use npm test or yarn test.

配置

Code quality is set up for you with prettier, husky, and lint-staged. Adjust the respective fields in package.json accordingly.

测试

Jest tests are set up to run with npm test or yarn test.

Bundle 分析

Calculates the real cost of your library using size-limit with npm run size and visulize it with npm run analyze.

文件结构

/example
  index.html
  index.tsx       # test your component here in a demo app
  package.json
  tsconfig.json
/src
  index.tsx       # EDIT THIS
/test
  blah.test.tsx   # EDIT THIS
/stories
  Thing.stories.tsx # EDIT THIS
/.storybook
  main.js
  preview.js
.gitignore
package.json
README.md         # EDIT THIS
tsconfig.json

Rollup

TSDX uses Rollup as a bundler and generates multiple rollup configs for various module formats and build settings. See Optimizations for details.

TypeScript

tsconfig.json is set up to interpret dom and esnext types, as well as react for jsx. Adjust according to your needs.

Continuous Integration

GitHub Actions

Two actions are added by default:

  • main which installs deps w/ cache, lints, tests, and builds on all pushes against a Node and OS matrix
  • size which comments cost comparison of your library on every pull request using size-limit

Optimizations

Please see the main tsdx optimizations docs. In particular, know that you can take advantage of development-only optimizations:

// ./types/index.d.ts
declare var __DEV__: boolean;

// inside your code...
if (__DEV__) {
  console.log('foo');
}

模块规范

CJS, ESModules, and UMD module formats are supported.

部署 the Example

The Playground is just a simple Parcel app, you can deploy it anywhere you would normally deploy that. Here are some guidelines for manually deploying with the Netlify CLI (npm i -g netlify-cli):

cd example # if not already in the example folder
npm run build # builds to dist
netlify deploy # deploy the dist folder

Alternatively, if you already have a git repo connected, you can set up continuous deployment with Netlify:

netlify init
# build command: yarn build && cd example && yarn && yarn build
# directory to deploy: example/dist
# pick yes for netlify.toml

命名导出

Per Palmer Group guidelines, always use named exports. Code split inside your React app instead of your React library.

发布

npm publish

业务导入组件过程

1.0.48

6 months ago

1.0.47

6 months ago

1.0.46

6 months ago

1.0.45

6 months ago

1.0.49

6 months ago

1.0.51

6 months ago

1.0.50

6 months ago

1.0.44

7 months ago

1.0.43

7 months ago

1.0.42

7 months ago

1.0.41

9 months ago

1.0.39

1 year ago

1.0.38

1 year ago

1.0.40

1 year ago

1.0.37

1 year ago

1.0.36

1 year ago

1.0.33

1 year ago

1.0.32

1 year ago

1.0.35

1 year ago

1.0.34

1 year ago

1.0.22

1 year ago

1.0.21

2 years ago

1.0.26

1 year ago

1.0.25

1 year ago

1.0.24

1 year ago

1.0.23

1 year ago

1.0.29

1 year ago

1.0.28

1 year ago

1.0.27

1 year ago

1.0.31

1 year ago

1.0.30

1 year ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.20

2 years ago

1.0.15

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.4

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.3

2 years ago

1.0.1

2 years ago

0.1.0

2 years ago