Skip to content

Commit

Permalink
feat: 升级jslib-base
Browse files Browse the repository at this point in the history
  • Loading branch information
yanhaijing committed Sep 24, 2023
1 parent c1b6727 commit 9d12ea8
Show file tree
Hide file tree
Showing 42 changed files with 16,285 additions and 9,261 deletions.
40 changes: 22 additions & 18 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
{
"presets": [
["@babel/preset-env",
"presets": [
[
"@babel/preset-env",
{
"targets": {
"browsers": "last 2 versions, > 1%, ie >= 6, Chrome >= 29, Firefox >= 55, Safari >= 9, Android >= 4, iOS >= 9, and_uc > 11",
"node": "4"
"browsers": "last 2 versions, > 1%, ie >= 11, Android >= 4.1, iOS >= 10.3",
"node": "14"
},
"modules": "commonjs",
"loose": false
}]
],
"plugins": [
["@babel/plugin-transform-runtime", {
"helpers": false,
"regenerator": false
}]
],
"env": {
"test": {
"plugins": [
"istanbul"
]
}
]
],
"plugins": [
// [
// "@babel/plugin-transform-runtime",
// {
// "corejs": 3,
// "versions": "^7.22.15",
// "helpers": true,
// "regenerator": false
// }
// ]
],
"env": {
"test": {
"plugins": ["istanbul"]
}
}
}
30 changes: 24 additions & 6 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
# 根目录的配置
root = true

[{*.js,*.css,*.html}]
indent_style = space
indent_size = 4
end_of_line = lf
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true

[{package.json,.*rc,*.yml}]
indent_style = space
indent_size = 4

[*.html]
indent_size = 2

[*.{css,less,scss}]
indent_size = 2

[*.{js,mjs,cjs,ts,cts,mts}]
indent_size = 2

[*.{json,yml,yaml}]
indent_size = 2

[*.{sh}]
indent_size = 2

[*.{md,makrdown}]
indent_size = 2

[*rc]
indent_size = 2
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist
require.js
*.ts
34 changes: 34 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
module.exports = {
parser: '@babel/eslint-parser',
env: {
browser: true,
es2021: true,
node: true,
mocha: true,
},
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
// 即使没有 babelrc 配置文件,也使用 babel-eslint 来解析
requireConfigFile: false,
},
extends: [
'eslint:recommended',
'plugin:prettier/recommended',
'plugin:import/recommended',
],
rules: {
'no-unused-vars': [
2,
{
vars: 'local',
args: 'after-used',
ignoreRestSiblings: true,
varsIgnorePattern: '^_',
argsIgnorePattern: '^_',
},
],
eqeqeq: [2],
'import/no-unresolved': [1],
},
};
32 changes: 0 additions & 32 deletions .eslintrc.js

This file was deleted.

3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms

custom: ['https://yanhaijing.com/mywallet/']
51 changes: 51 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# 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
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: CI

on:
push:
branches: ['master']
pull_request:
branches: ['master']

jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v4

lint:
needs: commitlint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: '18.x'
cache: 'npm'
- run: npm ci
- run: npm run lint

test:
needs: lint
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm i
- run: npm test
# - run: npm run coveralls --if-present
- run: npm run build --if-present
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
!index.d.ts
*.d.ts
.rpt2_cache
coverage
node_modules
dist
.nyc_output
.eslintcache
.nyc_output
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no -- commitlint --edit "$1"
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
3 changes: 3 additions & 0 deletions .lintstagedrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
'**/*.{js,mjs,cjs,ts,cts,mts}': ['prettier --write', 'eslint --cache'],
};
15 changes: 5 additions & 10 deletions .nycrc
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
{
"check-coverage": true,
"lines": 50,
"statements": 50,
"lines": 75,
"statements": 75,
"functions": 0,
"branches": 50,
"require": [
"@babel/register"
],
"reporter": [
"lcov",
"text"
],
"branches": 75,
"reporter": ["lcov", "text"],
"require": ["@babel/register"],
"sourceMap": false,
"instrument": false
}
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist
coverage
package-lock.json
3 changes: 3 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleQuote": true
}
8 changes: 0 additions & 8 deletions .travis.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
}
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# 变更日志

## 0.4.0 / 2023-9-24

- 升级最新版 jslib-base
- 支持 Node.js ESM
- 升级 @jsmini/is

## 0.3.3 / 2019-10-10

- fix: 修复丢失d.ts的问题
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (C) 2017-2019 yanhaijing
Copyright (C) 2017-2023 yanhaijing

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:

Expand Down
33 changes: 22 additions & 11 deletions README-zh_CN.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
# [extend](https://github.com/jsmini/extend)
# [extend](https://github.com/jsmini/extend)

[![](https://img.shields.io/badge/Powered%20by-jslib%20extend-brightgreen.svg)](https://github.com/yanhaijing/jslib-extend)
[![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/jsmini/extend/blob/master/LICENSE)
[![Build Status](https://travis-ci.org/jsmini/extend.svg?branch=master)](https://travis-ci.org/jsmini/extend)
[![Coveralls](https://img.shields.io/coveralls/jsmini/extend.svg)](https://coveralls.io/github/jsmini/extend)
[![CI](https://github.com/jsmini/extend/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/jsmini/extend/actions/workflows/ci.yml)
[![npm](https://img.shields.io/badge/npm-0.3.3-orange.svg)](https://www.npmjs.com/package/@jsmini/extend)
[![NPM downloads](http://img.shields.io/npm/dm/@jsmini/extend.svg?style=flat-square)](http://www.npmtrends.com/@jsmini/extend)
[![Percentage of issues still open](http://isitmaintained.com/badge/open/jsmini/extend.svg)](http://isitmaintained.com/project/jsmini/extend "Percentage of issues still open")
[![Percentage of issues still open](http://isitmaintained.com/badge/open/jsmini/extend.svg)](http://isitmaintained.com/project/jsmini/extend 'Percentage of issues still open')

将对象属性递归放到目标对象,类似jQuery的`$.extend`

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

## 兼容性

单元测试保证支持如下环境:

| IE | CH | FF | SF | OP | IOS | 安卓 | Node |
| ---- | ---- | ---- | ---- | ---- | ---- | ---- | ----- |
| 6+ | 23+ | 4+ | 6+ | 10+ | 5+ | 2.3+ | 0.10+ |
| IE | CH | FF | SF | OP | IOS | 安卓 | Node |
| --- | --- | --- | --- | --- | --- | ---- | ----- |
| 6+ | 23+ | 4+ | 6+ | 10+ | 5+ | 2.3+ | 0.10+ |

## 目录介绍

Expand All @@ -31,6 +33,7 @@
```

## 如何使用

通过npm下载安装代码

```bash
Expand All @@ -52,9 +55,12 @@ import { name } from '@jsmini/extend';
如果你是requirejs环境

```js
requirejs(['node_modules/@jsmini/extend/dist/index.aio.js'], function (jsmini_extend) {
requirejs(
['node_modules/@jsmini/extend/dist/index.aio.js'],
function (jsmini_extend) {
var name = jsmini_extend.name;
})
},
);
```

如果你是浏览器环境
Expand All @@ -63,14 +69,16 @@ requirejs(['node_modules/@jsmini/extend/dist/index.aio.js'], function (jsmini_ex
<script src="node_modules/@jsmini/extend/dist/index.aio.js"></script>

<script>
var name = jsmini_extend.name;
var name = jsmini_extend.name;
</script>
```

## 文档

[API](https://github.com/jsmini/extend/blob/master/doc/api.md)

## 贡献指南 ![PRs welcome](<https://img.shields.io/badge/PRs-welcome-brightgreen.svg>)
## 贡献指南 ![PRs welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)

首次运行需要先安装依赖

```bash
Expand Down Expand Up @@ -113,12 +121,15 @@ $ npm run rename # 重命名命令
```

## 贡献者列表

[contributors](https://github.com/jsmini/extend/graphs/contributors)

## 更新日志

[CHANGELOG.md](https://github.com/jsmini/extend/blob/master/CHANGELOG.md)

## 计划列表

[TODO.md](https://github.com/jsmini/extend/blob/master/TODO.md)

## 谁在使用
Loading

0 comments on commit 9d12ea8

Please sign in to comment.