Update workflows
This commit is contained in:
parent
ae9fd3e8ba
commit
5f52a14c85
103
.eslintrc
103
.eslintrc
|
@ -1,21 +1,32 @@
|
||||||
{
|
{
|
||||||
"root": true,
|
"extends": [
|
||||||
"env": {
|
"eslint:recommended",
|
||||||
"node" : true,
|
"plugin:node/recommended"
|
||||||
"es6" : true,
|
],
|
||||||
"mocha" : true
|
"parserOptions": {
|
||||||
},
|
"ecmaVersion": 2020
|
||||||
"globals": {
|
},
|
||||||
"expect" : true,
|
"overrides": [
|
||||||
"chai" : true,
|
{
|
||||||
"sinon" : true
|
"files": [
|
||||||
},
|
"**/*.test.js"
|
||||||
"extends": ["eslint:recommended"],
|
],
|
||||||
"parserOptions": {
|
"env": {
|
||||||
"ecmaVersion": 8,
|
"jest": true
|
||||||
"ecmaFeatures": {
|
},
|
||||||
"experimentalObjectRestSpread": true
|
"plugins": ["jest"],
|
||||||
|
"rules": {
|
||||||
|
"jest/no-disabled-tests": "warn",
|
||||||
|
"jest/no-focused-tests": "error",
|
||||||
|
"jest/no-identical-title": "error",
|
||||||
|
"jest/prefer-to-have-length": "warn",
|
||||||
|
"jest/valid-expect": "error"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"env": {
|
||||||
|
"node": true,
|
||||||
|
"es6": true
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
"arrow-parens": ["error", "as-needed"],
|
"arrow-parens": ["error", "as-needed"],
|
||||||
|
@ -49,68 +60,14 @@
|
||||||
"keyword-spacing": ["error", { "before": true, "after": true }],
|
"keyword-spacing": ["error", { "before": true, "after": true }],
|
||||||
"space-before-blocks": ["error"],
|
"space-before-blocks": ["error"],
|
||||||
"space-before-function-paren": ["error", {"anonymous": "always", "named": "never", "asyncArrow": "always"}],
|
"space-before-function-paren": ["error", {"anonymous": "always", "named": "never", "asyncArrow": "always"}],
|
||||||
"space-infix-ops": ["error"],
|
|
||||||
"space-unary-ops": [
|
|
||||||
"error", {
|
|
||||||
"words": true,
|
|
||||||
"nonwords": false,
|
|
||||||
"overrides": {
|
|
||||||
"!": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"spaced-comment": [0],
|
|
||||||
"camelcase": ["error"],
|
"camelcase": ["error"],
|
||||||
"no-tabs": [0],
|
"no-tabs": [0],
|
||||||
"comma-dangle": [0],
|
|
||||||
"global-require": [0],
|
"global-require": [0],
|
||||||
"func-names": [0],
|
|
||||||
"no-param-reassign": [0],
|
|
||||||
"no-underscore-dangle": [0],
|
"no-underscore-dangle": [0],
|
||||||
"no-restricted-syntax": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
"selector": "LabeledStatement",
|
|
||||||
"message": "Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"selector": "WithStatement",
|
|
||||||
"message": "`with` is disallowed in strict mode because it makes code impossible to predict and optimize."
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"no-mixed-operators": [0],
|
|
||||||
"no-plusplus": [0],
|
"no-plusplus": [0],
|
||||||
"comma-spacing": [0],
|
|
||||||
"default-case": [0],
|
|
||||||
"no-shadow": [0],
|
"no-shadow": [0],
|
||||||
"no-console": [0],
|
"node/no-unpublished-require": [0],
|
||||||
"key-spacing": [0],
|
"no-process-exit": [0],
|
||||||
"no-return-assign": [0],
|
"no-console": [0]
|
||||||
"consistent-return": [0],
|
|
||||||
"class-methods-use-this": [0],
|
|
||||||
"no-multi-spaces": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
"exceptions": {
|
|
||||||
"VariableDeclarator": true,
|
|
||||||
"Property": true,
|
|
||||||
"ImportDeclaration": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"array-callback-return": [0],
|
|
||||||
"no-use-before-define": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
"functions": false,
|
|
||||||
"classes": true,
|
|
||||||
"variables": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"padded-blocks": [0],
|
|
||||||
"space-in-parens": [0],
|
|
||||||
"valid-jsdoc": [0],
|
|
||||||
"no-unused-expressions": [0],
|
|
||||||
"import/no-dynamic-require": [0]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
name: Lint
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 14.16.0
|
||||||
|
- run: npm ci
|
||||||
|
- run: npm run eslint
|
|
@ -10,7 +10,12 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-node@v1
|
- uses: actions/setup-node@v1
|
||||||
|
|
10
README.md
10
README.md
|
@ -90,9 +90,9 @@ export default cpbin;
|
||||||
|
|
||||||
It is useful for development builds. Use it in your **src/package.json**:
|
It is useful for development builds. Use it in your **src/package.json**:
|
||||||
```
|
```
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "node-gyp rebuild && node -e \"require('addon-tools-raub/cpbin')('ADDON')\""
|
"build": "node-gyp rebuild && node -e \"require('addon-tools-raub/cpbin')('ADDON')\""
|
||||||
},
|
},
|
||||||
```
|
```
|
||||||
Here ADDON should be replaced with the name of your addon, without `.node` extension.
|
Here ADDON should be replaced with the name of your addon, without `.node` extension.
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ To use it, create a new script for your package, which may as well be named
|
||||||
'use strict';
|
'use strict';
|
||||||
const install = require('addon-tools-raub/install');
|
const install = require('addon-tools-raub/install');
|
||||||
const prefix = 'https://github.com/USER/ADDON-NAME/releases/download';
|
const prefix = 'https://github.com/USER/ADDON-NAME/releases/download';
|
||||||
const tag = process.env.npm_package_config_install;
|
const tag = 'v1.0.0';
|
||||||
install(`${prefix}/${tag}`);
|
install(`${prefix}/${tag}`);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ export const rmdir: (name: string) => Promise<void>;
|
||||||
export const rm: (name: string) => Promise<void>;
|
export const rm: (name: string) => Promise<void>;
|
||||||
```
|
```
|
||||||
|
|
||||||
* `read` - (async) Reads a whole file to string, NOT A Buffer.
|
* `read` - (async) Reads a whole file to string, NOT a Buffer.
|
||||||
* `write` - (async) Write a file.
|
* `write` - (async) Write a file.
|
||||||
* `copy` - (async) Copy a file.
|
* `copy` - (async) Copy a file.
|
||||||
* `exists` - (async) Check if a file/folder exists.
|
* `exists` - (async) Check if a file/folder exists.
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -40,6 +40,7 @@
|
||||||
"npm": ">=6.14.1"
|
"npm": ">=6.14.1"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"eslint": "eslint .",
|
||||||
"test": "cd test && npm run test && cd ..",
|
"test": "cd test && npm run test && cd ..",
|
||||||
"test-ci": "cd test && npm run test-ci && cd ..",
|
"test-ci": "cd test && npm run test-ci && cd ..",
|
||||||
"test-install": "cd test && npm ci && cd ..",
|
"test-install": "cd test && npm ci && cd ..",
|
||||||
|
@ -52,5 +53,10 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"adm-zip": "0.5.4",
|
"adm-zip": "0.5.4",
|
||||||
"node-addon-api": "3.1.0"
|
"node-addon-api": "3.1.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"eslint": "^7.23.0",
|
||||||
|
"eslint-plugin-jest": "^24.3.3",
|
||||||
|
"eslint-plugin-node": "^11.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ class WritableBuffer extends Writable {
|
||||||
|
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this._buffer = new Buffer(INITIAL_SIZE);
|
this._buffer = Buffer.alloc(INITIAL_SIZE);
|
||||||
this._size = 0;
|
this._size = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ class WritableBuffer extends Writable {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = new Buffer(this._size);
|
const data = Buffer.alloc(this._size);
|
||||||
this._buffer.copy(data, 0, 0, this._size);
|
this._buffer.copy(data, 0, 0, this._size);
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
@ -41,7 +41,7 @@ class WritableBuffer extends Writable {
|
||||||
const freeSpace = this._buffer.length - this._size;
|
const freeSpace = this._buffer.length - this._size;
|
||||||
const factor = Math.ceil((incomingSize - freeSpace) / INCREMENT_SIZE);
|
const factor = Math.ceil((incomingSize - freeSpace) / INCREMENT_SIZE);
|
||||||
|
|
||||||
const newBuffer = new Buffer(this._buffer.length + (INCREMENT_SIZE * factor));
|
const newBuffer = Buffer.alloc(this._buffer.length + (INCREMENT_SIZE * factor));
|
||||||
this._buffer.copy(newBuffer, 0, 0, this._size);
|
this._buffer.copy(newBuffer, 0, 0, this._size);
|
||||||
|
|
||||||
this._buffer = newBuffer;
|
this._buffer = newBuffer;
|
||||||
|
|
Loading…
Reference in New Issue