Skip to content

Commit

Permalink
feat(build): only commonjs format files are provided
Browse files Browse the repository at this point in the history
  • Loading branch information
伍程凯 committed Jul 11, 2018
1 parent 841f1ea commit 34a0884
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 52 deletions.
19 changes: 4 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,24 @@

Javascript utility library, applicable to business scenes. Without dependencies.

### Download

* [UMD Version](https://unpkg.com/sewing/libs/index.min.js)
* [IIFE Version](https://unpkg.com/sewing/libs/index.iife.js)

### Quick Start

Using npm:
```bash
$ npm i sewing
```

In a browser:
```html
<script src="https://unpkg.com/sewing"></script>
In TypeScript/ESM:
```js
import sewing from 'sewing'
```

In Node.js:
```js
const sewing = require('sewing')
// You can't require whole library, it contains browser env code.
const isEmpty = require('sewing/isEmpty')
```

In TypeScript:
```js
import sewing from 'sewing'
import isEmpty from 'sewing/dist/src/isEmpty'
```

### Examples

```javascript
Expand Down
25 changes: 0 additions & 25 deletions index.ts

This file was deleted.

15 changes: 5 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
"name": "sewing",
"version": "0.0.47",
"description": "A JavaScript utility library in business scenarios",
"main": "libs/index.cjs.js",
"module": "libs/index.es.js",
"unpkg": "libs/index.min.js",
"jsdelivr": "libs/index.min.js",
"types": "dist/index.d.ts",
"main": "libs/index.js",
"files": [
"dist",
"libs"
Expand All @@ -16,11 +12,11 @@
"docs:lint": "documentation lint dist/src/**",
"docs:deploy": "npm run docs && cp -r .circleci docs && gh-pages -d docs -t",
"docs": "rm -rf docs/ dist/ && npm run dev && documentation build dist/src/** -f html -o docs",
"build": "rm -rf dist/ libs/ && tsc && bili --format cjs,es,umd,umd-min,iife",
"dev": "tsc",
"build": "rm -rf dist/ libs/ && tsc && bili --format cjs --filename '[name].js'",
"dev": "rm -rf dist/ && tsc",
"test:unit": "jest",
"postversion": "npm run build && npm run docs:deploy",
"postbuild": "cp dist/src/*.d.ts libs"
"postbuild": "cp dist/*.d.ts libs"
},
"author": "Army-U <[email protected]>",
"homepage": "https://github.com/Army-U/sewing",
Expand Down Expand Up @@ -48,8 +44,7 @@
},
"bili": {
"input": [
"./dist/index.js",
"./dist/src/*.js"
"./dist/*.js"
],
"outDir": "libs/",
"banner": true
Expand Down
25 changes: 25 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
export { default as baseCreateElement } from './internal/baseCreateElement'
export { default as createStyleElement } from './createStyleElement'
export { default as renameObjectKeys } from './renameObjectKeys'
export { default as createSrcElement } from './createSrcElement'
export { default as searchString2Map } from './searchString2Map'
export { default as map2SearchString } from './map2SearchString'
export { default as isEmptyValueObj } from './isEmptyValueObj'
export { default as isEncodedString } from './isEncodedString'
export { default as parseJSONString } from './parseJSONString'
export { default as isEmptyObject } from './isEmptyObject'
export { default as throttleWith } from './throttleWith'
export { default as isPrimitive } from './isPrimitive'
export { default as parseString } from './parseString'
export { default as removeOne } from './removeOne'
export { default as isMobile } from './isMobile'
export { default as debounce } from './debounce'
export { default as throttle } from './throttle'
export { default as isEmpty } from './isEmpty'
export { default as inRange } from './inRange'
export { default as isType } from './isType'
export { default as insert } from './insert'
export { default as isDate } from './isDate'
export { default as clone } from './clone'
export { default as cache } from './cache'
export { default as get } from './get'
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
"experimentalDecorators": true,
"noUnusedParameters": true,
"noUnusedLocals": true,
"module": "ESNext",
"module": "CommonJS",
"lib": [
"es2017",
"es2016",
"dom"
]
},
"include": ["src/**/*.ts", "index.ts"],
"include": ["src/**/*.ts"],
"exclude": [
"node_modules"
]
Expand Down

0 comments on commit 34a0884

Please sign in to comment.