Skip to content

Commit

Permalink
release v4.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
saqqdy committed May 23, 2023
1 parent 969cff2 commit 42f0364
Show file tree
Hide file tree
Showing 10 changed files with 107 additions and 81 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"filesize",
"iife",
"jscool",
"onwarn",
"samesite",
"saqqdy",
"tscjs",
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change logs

## 2023.05.23 v4.4.0

1. fix outputs
2. fix exports

## 2023.05.22 v4.3.0

1. fix export default
Expand Down
6 changes: 3 additions & 3 deletions README-zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ getOsVersion() // 返回系统版本

```html
<!-- 在你的html代码上加上script标签,使用CDN链接引入 -->
<script src="https://unpkg.com/js-cool@4.0.0/dist/js-cool.global.prod.js"></script>
<script src="https://unpkg.com/js-cool@4.0.0/dist/index.global.prod.js"></script>
```

## 所有方法汇总
Expand Down Expand Up @@ -172,8 +172,8 @@ const functionList = {
[codecov-url]: https://codecov.io/github/saqqdy/js-cool?branch=master
[download-image]: https://img.shields.io/npm/dm/js-cool.svg?style=flat-square
[download-url]: https://npmjs.org/package/js-cool
[gzip-image]: http://img.badgesize.io/https://unpkg.com/js-cool/dist/js-cool.global.prod.js?compression=gzip&label=gzip%20size:%20JS
[gzip-url]: http://img.badgesize.io/https://unpkg.com/js-cool/dist/js-cool.global.prod.js?compression=gzip&label=gzip%20size:%20JS
[gzip-image]: http://img.badgesize.io/https://unpkg.com/js-cool/dist/index.global.prod.js?compression=gzip&label=gzip%20size:%20JS
[gzip-url]: http://img.badgesize.io/https://unpkg.com/js-cool/dist/index.global.prod.js?compression=gzip&label=gzip%20size:%20JS
[license-image]: https://img.shields.io/badge/License-MIT-blue.svg
[license-url]: LICENSE
[sonar-image]: https://sonarcloud.io/api/project_badges/quality_gate?project=saqqdy_js-cool
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ getOsVersion() // return the system version

```html
<! -- Add script tags to your html code, using CDN links to bring in -->
<script src="https://unpkg.com/js-cool@4.0.0/dist/js-cool.global.prod.js"></script>
<script src="https://unpkg.com/js-cool@4.0.0/dist/index.global.prod.js"></script>
```

## Summary of all methods
Expand Down Expand Up @@ -174,8 +174,8 @@ Please open an issue [here](https://github.com/saqqdy/js-cool/issues).
[codecov-url]: https://codecov.io/github/saqqdy/js-cool?branch=master
[download-image]: https://img.shields.io/npm/dm/js-cool.svg?style=flat-square
[download-url]: https://npmjs.org/package/js-cool
[gzip-image]: http://img.badgesize.io/https://unpkg.com/js-cool/dist/js-cool.global.prod.js?compression=gzip&label=gzip%20size:%20JS
[gzip-url]: http://img.badgesize.io/https://unpkg.com/js-cool/dist/js-cool.global.prod.js?compression=gzip&label=gzip%20size:%20JS
[gzip-image]: http://img.badgesize.io/https://unpkg.com/js-cool/dist/index.global.prod.js?compression=gzip&label=gzip%20size:%20JS
[gzip-url]: http://img.badgesize.io/https://unpkg.com/js-cool/dist/index.global.prod.js?compression=gzip&label=gzip%20size:%20JS
[license-image]: https://img.shields.io/badge/License-MIT-blue.svg
[license-url]: LICENSE
[sonar-image]: https://sonarcloud.io/api/project_badges/quality_gate?project=saqqdy_js-cool
Expand Down
31 changes: 13 additions & 18 deletions build/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,41 +34,41 @@ export interface Options extends RollupOptions {
const configs: Config[] = [
{
input: 'src/index.ts',
file: 'dist/js-cool.esm-browser.js',
file: 'dist/index.esm-browser.js',
format: 'es',
browser: true,
env: 'development'
},
{
input: 'src/index.ts',
file: 'dist/js-cool.esm-browser.prod.js',
file: 'dist/index.esm-browser.prod.js',
format: 'es',
browser: true,
minify: true,
env: 'production'
},
{
input: 'src/index.ts',
file: 'dist/js-cool.esm-bundler.js',
file: 'dist/index.esm-bundler.js',
format: 'es',
env: 'development'
},
{
input: 'src/index.default.ts',
file: 'dist/js-cool.global.js',
file: 'dist/index.global.js',
format: 'iife',
env: 'development'
},
{
input: 'src/index.default.ts',
file: 'dist/js-cool.global.prod.js',
file: 'dist/index.global.prod.js',
format: 'iife',
minify: true,
env: 'production'
},
{
input: 'src/index.default.ts',
file: 'dist/js-cool.cjs.js',
file: 'dist/index.cjs.js',
format: 'cjs',
env: 'development'
}
Expand All @@ -81,10 +81,6 @@ function createEntries() {
function createEntry(config: Config) {
const isGlobalBuild = config.format === 'iife'
const isTypeScript = config.input.endsWith('.ts')
const isTranspiled =
config.file.endsWith('bundler.js') ||
config.file.endsWith('browser.js') ||
config.file.endsWith('prod.js')

const _config: Options = {
external: [],
Expand Down Expand Up @@ -133,14 +129,13 @@ function createEntry(config: Config) {
)

if (config.transpile !== false) {
!isTranspiled &&
_config.plugins.push(
babel({
babelHelpers: 'bundled',
extensions,
exclude: [/node_modules[\\/]core-js/]
})
)
_config.plugins.push(
babel({
babelHelpers: 'bundled',
extensions,
exclude: [/node_modules[\\/]core-js/]
})
)
isTypeScript &&
_config.plugins.push(
typescript({
Expand Down
40 changes: 23 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"name": "js-cool",
"description": "This is a pure native js front-end common method library",
"version": "4.3.0",
"version": "4.4.0",
"packageManager": "pnpm@8.5.1",
"main": "dist/js-cool.cjs.js",
"module": "dist/js-cool.esm-bundler.js",
"browser": "dist/js-cool.esm-browser.js",
"unpkg": "dist/js-cool.global.js",
"jsdelivr": "dist/js-cool.global.js",
"main": "dist/index.cjs.js",
"module": "dist/index.esm-bundler.js",
"browser": "dist/index.esm-browser.js",
"unpkg": "dist/index.global.js",
"jsdelivr": "dist/index.global.js",
"types": "dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"module": "./dist/js-cool.esm-bundler.js",
"require": "./dist/js-cool.cjs.js",
"import": "./dist/js-cool.mjs"
"module": "./dist/index.esm-bundler.js",
"require": "./dist/index.cjs.js",
"import": "./dist/index.mjs"
},
"./*": "./*"
},
Expand All @@ -32,8 +32,8 @@
"gen:version": "tscjs scripts/version",
"tag:version": "tscjs scripts/tag",
"build": "run-s clean build:{bundle,types}",
"build:bundle": "rollup -c build/rollup.config.ts --configPlugin @rollup/plugin-typescript",
"build:types": "tsc -p src/tsconfig.declaration.json && pnpm roll-types",
"build:bundle": "tscjs scripts/build",
"build:types": "tsc -p src/tsconfig.json && pnpm roll-types",
"build:docs": "rm-all docs && typedoc && prettier --write \"**/*.md\"",
"deploy": "sh scripts/deploy.sh",
"roll-types": "api-extractor run && rm-all temp",
Expand All @@ -50,12 +50,12 @@
"pub.bak": "git add . && git commit -m $npm_package_version && git pull && git push"
},
"dependencies": {
"load-source": "^1.0.0",
"mount-css": "^1.0.0",
"mount-image": "^1.0.0",
"mount-script": "^1.0.0",
"mount-style": "^1.0.0",
"use-downloads": "^1.0.0"
"load-source": "^1.1.0",
"mount-css": "^1.1.0",
"mount-image": "^1.1.0",
"mount-script": "^1.1.0",
"mount-style": "^1.1.1",
"use-downloads": "^1.1.0"
},
"devDependencies": {
"@babel/core": "^7.21.8",
Expand Down Expand Up @@ -101,6 +101,12 @@
"engines": {
"node": ">=12.20"
},
"resolutions": {
"mount-css": "1.1.0",
"mount-image": "1.1.0",
"mount-script": "1.1.0",
"mount-style": "1.1.1"
},
"pnpm": {
"peerDependencyRules": {
"ignoreMissing": [
Expand Down
64 changes: 35 additions & 29 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions scripts/build.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { spawn } from 'child_process'
import { cp } from '@node-kit/extra.fs'

async function run() {
await Promise.all([build(), copy()])
}

async function build() {
await spawn(
'rollup',
['-c', 'build/rollup.config.ts', '--configPlugin', '@rollup/plugin-typescript'],
{ stdio: 'inherit' }
)
}

async function copy() {
await cp('src/index.mjs', 'dist')
}

run()
10 changes: 0 additions & 10 deletions src/tsconfig.declaration.json

This file was deleted.

5 changes: 4 additions & 1 deletion src/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"compilerOptions": {
"target": "ES5",
"declaration": true,
"sourceMap": true
"emitDeclarationOnly": true,
"sourceMap": false,
"outDir": "../temp",
"rootDir": "."
}
}

0 comments on commit 42f0364

Please sign in to comment.