Skip to content

Commit bfbc988

Browse files
committed
feat: 升级jslib-base
1 parent 24e51c9 commit bfbc988

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+14875
-9040
lines changed

.babelrc

+22-18
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,31 @@
11
{
2-
"presets": [
3-
["@babel/preset-env",
2+
"presets": [
3+
[
4+
"@babel/preset-env",
45
{
56
"targets": {
6-
"browsers": "last 2 versions, > 1%, ie >= 6, Chrome >= 29, Firefox >= 55, Safari >= 9, Android >= 4, iOS >= 9, and_uc > 11",
7-
"node": "4"
7+
"browsers": "last 2 versions, > 1%, ie >= 11, Android >= 4.1, iOS >= 10.3",
8+
"node": "14"
89
},
910
"modules": "commonjs",
1011
"loose": false
11-
}]
12-
],
13-
"plugins": [
14-
["@babel/plugin-transform-runtime", {
15-
"helpers": false,
16-
"regenerator": false
17-
}]
18-
],
19-
"env": {
20-
"test": {
21-
"plugins": [
22-
"istanbul"
23-
]
2412
}
13+
]
14+
],
15+
"plugins": [
16+
// [
17+
// "@babel/plugin-transform-runtime",
18+
// {
19+
// "corejs": 3,
20+
// "versions": "^7.22.15",
21+
// "helpers": true,
22+
// "regenerator": false
23+
// }
24+
// ]
25+
],
26+
"env": {
27+
"test": {
28+
"plugins": ["istanbul"]
2529
}
2630
}
27-
31+
}

.editorconfig

+24-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,30 @@
1+
# 根目录的配置
12
root = true
23

3-
[{*.js,*.css,*.html}]
4-
indent_style = space
5-
indent_size = 4
6-
end_of_line = lf
4+
[*]
75
charset = utf-8
6+
end_of_line = lf
87
insert_final_newline = true
9-
10-
[{package.json,.*rc,*.yml}]
118
indent_style = space
9+
indent_size = 4
10+
11+
[*.html]
12+
indent_size = 2
13+
14+
[*.{css,less,scss}]
15+
indent_size = 2
16+
17+
[*.{js,mjs,cjs,ts,cts,mts}]
18+
indent_size = 2
19+
20+
[*.{json,yml,yaml}]
21+
indent_size = 2
22+
23+
[*.{sh}]
24+
indent_size = 2
25+
26+
[*.{md,makrdown}]
27+
indent_size = 2
28+
29+
[*rc]
1230
indent_size = 2

.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist
2+
require.js
3+
*.ts

.eslintrc.cjs

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
module.exports = {
2+
parser: '@babel/eslint-parser',
3+
env: {
4+
browser: true,
5+
es2021: true,
6+
node: true,
7+
mocha: true,
8+
},
9+
parserOptions: {
10+
ecmaVersion: 'latest',
11+
sourceType: 'module',
12+
// 即使没有 babelrc 配置文件,也使用 babel-eslint 来解析
13+
requireConfigFile: false,
14+
},
15+
extends: [
16+
'eslint:recommended',
17+
'plugin:prettier/recommended',
18+
'plugin:import/recommended',
19+
],
20+
rules: {
21+
'no-unused-vars': [
22+
2,
23+
{
24+
vars: 'local',
25+
args: 'after-used',
26+
ignoreRestSiblings: true,
27+
varsIgnorePattern: '^_',
28+
argsIgnorePattern: '^_',
29+
},
30+
],
31+
eqeqeq: [2],
32+
'import/no-unresolved': [1],
33+
},
34+
};

.eslintrc.js

-32
This file was deleted.

.github/FUNDING.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# These are supported funding model platforms
2+
3+
custom: ['https://yanhaijing.com/mywallet/']

.github/workflows/ci.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
3+
4+
name: CI
5+
6+
on:
7+
push:
8+
branches: ['master']
9+
pull_request:
10+
branches: ['master']
11+
12+
jobs:
13+
commitlint:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0
19+
- uses: wagoid/commitlint-github-action@v4
20+
21+
lint:
22+
needs: commitlint
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v3
26+
- name: Use Node.js 18.x
27+
uses: actions/setup-node@v3
28+
with:
29+
node-version: '18.x'
30+
cache: 'npm'
31+
- run: npm ci
32+
- run: npm run lint
33+
34+
test:
35+
needs: lint
36+
runs-on: ubuntu-latest
37+
strategy:
38+
matrix:
39+
node-version: [14.x, 16.x, 18.x]
40+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
41+
steps:
42+
- uses: actions/checkout@v3
43+
- name: Use Node.js ${{ matrix.node-version }}
44+
uses: actions/setup-node@v3
45+
with:
46+
node-version: ${{ matrix.node-version }}
47+
cache: 'npm'
48+
- run: npm i
49+
- run: npm test
50+
# - run: npm run coveralls --if-present
51+
- run: npm run build --if-present

.gitignore

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1+
coverage
12
node_modules
23
dist
3-
.nyc_output
4-
coverage
4+
.eslintcache
5+
.nyc_output

.husky/commit-msg

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npx --no -- commitlint --edit "$1"

.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npx lint-staged

.lintstagedrc.cjs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
'**/*.{js,mjs,cjs,ts,cts,mts}': ['prettier --write', 'eslint --cache'],
3+
};

.nycrc

+2-7
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,8 @@
44
"statements": 75,
55
"functions": 0,
66
"branches": 75,
7-
"require": [
8-
"@babel/register"
9-
],
10-
"reporter": [
11-
"lcov",
12-
"text"
13-
],
7+
"reporter": ["lcov", "text"],
8+
"require": ["@babel/register"],
149
"sourceMap": false,
1510
"instrument": false
1611
}

.prettierignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist
2+
coverage
3+
package-lock.json

.prettierrc.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"singleQuote": true
3+
}

.travis.yml

-8
This file was deleted.

.vscode/extensions.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
3+
}

.vscode/settings.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"editor.formatOnSave": true,
3+
"editor.defaultFormatter": "esbenp.prettier-vscode"
4+
}

CHANGELOG.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# 变更日志
22

3+
## 0.9.0 / 2023-9-24
4+
5+
- 升级最新版 jslib-base
6+
- 支持 Node.js ESM
7+
38
## 0.8.0 / 2019-3-2
49

510
- 增加.d.ts文件,支持ts调用
@@ -10,7 +15,7 @@
1015

1116
## 0.6.0 / 2018-4-6
1217

13-
- 迁移项目,更改名称
18+
- 迁移项目,更改名称
1419

1520
## 0.5.0 / 2018-3-31
1621

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (C) 2018-2019 yanhaijing
1+
Copyright (C) 2018-2023 yanhaijing
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
44

README-zh_CN.md

+21-12
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
# [guid](https://github.com/jsmini/guid/)
2+
23
[![](https://img.shields.io/badge/Powered%20by-jslib%20base-brightgreen.svg)](https://github.com/yanhaijing/jslib-base)
34
[![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/jsmini/guid/blob/master/LICENSE)
4-
[![Build Status](https://travis-ci.org/jsmini/guid.svg?branch=master)](https://travis-ci.org/jsmini/guid)
5-
[![Coveralls](https://img.shields.io/coveralls/jsmini/guid.svg)](https://coveralls.io/github/jsmini/guid)
5+
[![CI](https://github.com/jsmini/guid/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/jsmini/guid/actions/workflows/ci.yml)
66
[![npm](https://img.shields.io/badge/npm-0.8.0-orange.svg)](https://www.npmjs.com/package/@jsmini/guid)
77
[![NPM downloads](http://img.shields.io/npm/dm/@jsmini/guid.svg?style=flat-square)](http://www.npmtrends.com/@jsmini/guid)
8-
[![Percentage of issues still open](http://isitmaintained.com/badge/open/jsmini/guid.svg)](http://isitmaintained.com/project/jsmini/guid "Percentage of issues still open")
8+
[![Percentage of issues still open](http://isitmaintained.com/badge/open/jsmini/guid.svg)](http://isitmaintained.com/project/jsmini/guid 'Percentage of issues still open')
99

1010
简单好用的JS全局ID生成工具,原生兼容IE6
1111

1212
[English](./README.md) | 简体中文
1313

1414
## 兼容性
15+
1516
单元测试保证支持如下环境:
1617

17-
| IE | CH | FF | SF | OP | IOS | 安卓 | Node |
18-
| ---- | ---- | ---- | ---- | ---- | ---- | ---- | ----- |
19-
| 6+ | 23+ | 4+ | 6+ | 10+ | 5+ | 2.3+ | 0.10+ |
18+
| IE | CH | FF | SF | OP | IOS | 安卓 | Node |
19+
| --- | --- | --- | --- | --- | --- | ---- | ----- |
20+
| 6+ | 23+ | 4+ | 6+ | 10+ | 5+ | 2.3+ | 0.10+ |
2021

2122
## 目录介绍
2223

@@ -32,6 +33,7 @@
3233
```
3334

3435
## 如何使用
36+
3537
通过npm下载安装代码
3638

3739
```bash
@@ -57,11 +59,14 @@ guid();
5759
如果你是requirejs环境
5860

5961
```js
60-
requirejs(['node_modules/@jsmini/guid/dist/index.aio.js'], function (jsmini_guid) {
62+
requirejs(
63+
['node_modules/@jsmini/guid/dist/index.aio.js'],
64+
function (jsmini_guid) {
6165
var guid = jsmini_guid.guid;
6266

6367
guid();
64-
})
68+
},
69+
);
6570
```
6671

6772
如果你是浏览器环境
@@ -70,16 +75,18 @@ requirejs(['node_modules/@jsmini/guid/dist/index.aio.js'], function (jsmini_guid
7075
<script src="node_modules/@jsmini/guid/dist/index.aio.js"></script>
7176

7277
<script>
73-
var guid = jsmini_guid.guid;
78+
var guid = jsmini_guid.guid;
7479
75-
guid();
80+
guid();
7681
</script>
7782
```
7883

7984
## 文档
85+
8086
[API](https://github.com/jsmini/guid/blob/master/doc/api.md)
8187

82-
## 贡献指南 ![PRs welcome](<https://img.shields.io/badge/PRs-welcome-brightgreen.svg>)
88+
## 贡献指南 ![PRs welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)
89+
8390
首次运行需要先安装依赖
8491

8592
```bash
@@ -118,9 +125,11 @@ $ npm publish --access=public
118125
- test/browser/index.html 中的仓库名称
119126

120127
## 更新日志
128+
121129
[CHANGELOG.md](https://github.com/jsmini/guid/blob/master/CHANGELOG.md)
122130

123131
## 计划列表
124-
[TODO.md](<https://github.com/jsmini/guid/blob/master/TODO.md>)
132+
133+
[TODO.md](https://github.com/jsmini/guid/blob/master/TODO.md)
125134

126135
## 谁在使用

0 commit comments

Comments
 (0)