Skip to content

Commit

Permalink
0.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
yanhaijing committed Sep 24, 2023
1 parent 83a2f0f commit 30b829b
Show file tree
Hide file tree
Showing 41 changed files with 14,868 additions and 9,017 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],
},
};
33 changes: 0 additions & 33 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
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
coverage
node_modules
dist
.nyc_output
coverage
.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'],
};
9 changes: 2 additions & 7 deletions .nycrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,8 @@
"statements": 75,
"functions": 0,
"branches": 50,
"require": [
"@babel/register"
],
"reporter": [
"lcov",
"text"
],
"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"
}
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# 变更日志

## 0.7.0 / 2023-9-24

- 升级最新版 jslib-base
- 支持 Node.js ESM

## 0.6.0 / 2018-4-6

- 迁移项目,更改名称

## 0.5.0 / 2018-3-31

- 原生支持ie6-8
- 原生支持ie6-8

## 0.4.0 / 2018-3-31

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) 2013-2019 yanhaijing
Copyright (C) 2013-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
29 changes: 20 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
# [console](https://github.com/jsmini/console)

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

console.js is a small javascript library, fix console is undefined, like html5shim and reset.css.

In ie6 ie7,console is undefined. In ie8 ie9, first open the developer tools before, console is undefined.

## Guides

Download and install through the npm

```bash
Expand All @@ -29,11 +30,14 @@ polyfill(); // polyfill console undefined
If you are use requirejs

```js
requirejs(['node_modules/@jsmini/console/dist/index.aio.js'], function (console_js) {
requirejs(
['node_modules/@jsmini/console/dist/index.aio.js'],
function (console_js) {
var polyfill = console_js.polyfill;

polyfill(); // polyfill console undefined
})
},
);
```

If you are use browser
Expand All @@ -42,19 +46,22 @@ If you are use browser
<script src="node_modules/@jsmini/console/dist/index.aio.js"></script>

<script>
var polyfill = console_js.polyfill;
polyfill(); // polyfill console undefined
var polyfill = console_js.polyfill;
polyfill(); // polyfill console undefined
</script>
```

## Document

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

## Principle & Blog

[use console.js](http://yanhaijing.com/js/2014/11/03/use-console.js/)

## Contribution

The first run requires installation of dependencies

```bash
Expand Down Expand Up @@ -93,19 +100,23 @@ You may need to modify it as follows:
- test/browser/index.html

## CHANGELOG

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

## TODO

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

## Who use

## Refrence

- [MSDN](http://msdn.microsoft.com/en-us/library/ie/gg589530.aspx)
- [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Console)
- [Firebug](http://getfirebug.com/wiki/index.php/Console_API)

## Related projects

- [browser-shim](https://github.com/ishmaelthedestroyer/browser-shim)
- [console-shim(liamnewmarch)](https://github.com/liamnewmarch/console-shim)
- [console-shim(kayahr)](https://github.com/kayahr/console-shim)
Expand Down
Loading

0 comments on commit 30b829b

Please sign in to comment.