chore: upgrade to yarn3
This commit is contained in:
parent
135b27acf4
commit
1531489e18
31 changed files with 10028 additions and 6954 deletions
|
@ -24,7 +24,7 @@ task:
|
|||
echo "~~~~ yarn --version ~~~~"
|
||||
yarn --version
|
||||
test_script:
|
||||
- yarn install --ignore-platform --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org
|
||||
- yarn install --immutable --network-timeout 300000
|
||||
- yarn build
|
||||
- cargo test -p napi-sys --lib -- --nocapture
|
||||
- yarn build:test
|
||||
|
|
12
.gitattributes
vendored
Normal file
12
.gitattributes
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
|
||||
|
||||
*.ts text eol=lf merge=union
|
||||
*.tsx text eol=lf merge=union
|
||||
*.rs text eol=lf merge=union
|
||||
*.js text eol=lf merge=union
|
||||
*.json text eol=lf merge=union
|
||||
*.debug text eol=lf merge=union
|
||||
|
||||
.yarn/releases/*.js linguist-detectable=false
|
2
.github/workflows/android-armv7.yml
vendored
2
.github/workflows/android-armv7.yml
vendored
|
@ -58,7 +58,7 @@ jobs:
|
|||
key: npm-cache-linux-android-node@16-${{ hashFiles('yarn.lock') }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
||||
run: yarn install --immutable --network-timeout 300000
|
||||
|
||||
- name: 'Build TypeScript'
|
||||
run: yarn build
|
||||
|
|
2
.github/workflows/android.yml
vendored
2
.github/workflows/android.yml
vendored
|
@ -58,7 +58,7 @@ jobs:
|
|||
key: npm-cache-linux-android-node@16-${{ hashFiles('yarn.lock') }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
||||
run: yarn install --immutable --network-timeout 300000
|
||||
|
||||
- name: 'Build TypeScript'
|
||||
run: yarn build
|
||||
|
|
2
.github/workflows/asan.yml
vendored
2
.github/workflows/asan.yml
vendored
|
@ -62,7 +62,7 @@ jobs:
|
|||
key: npm-cache-${{ matrix.os }}-node@${{ matrix.node }}-${{ hashFiles('yarn.lock') }}
|
||||
|
||||
- name: 'Install dependencies'
|
||||
run: yarn install --frozen-lockfile --ignore-platform --registry https://registry.npmjs.org --network-timeout 300000
|
||||
run: yarn install --immutable --network-timeout 300000
|
||||
|
||||
- name: 'Build TypeScript'
|
||||
run: yarn build
|
||||
|
|
2
.github/workflows/bench.yaml
vendored
2
.github/workflows/bench.yaml
vendored
|
@ -56,7 +56,7 @@ jobs:
|
|||
key: bench-${{ hashFiles('yarn.lock') }}
|
||||
|
||||
- name: 'Install dependencies'
|
||||
run: yarn install --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
||||
run: yarn install --immutable --network-timeout 300000
|
||||
|
||||
- name: 'Build ts'
|
||||
run: yarn build
|
||||
|
|
2
.github/workflows/lint.yaml
vendored
2
.github/workflows/lint.yaml
vendored
|
@ -53,7 +53,7 @@ jobs:
|
|||
key: lint-${{ hashFiles('yarn.lock') }}
|
||||
|
||||
- name: 'Install dependencies'
|
||||
run: yarn install --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
||||
run: yarn install --immutable --network-timeout 300000
|
||||
|
||||
- name: 'Lint JS/TS'
|
||||
run: yarn lint
|
||||
|
|
2
.github/workflows/linux-aarch64-musl.yaml
vendored
2
.github/workflows/linux-aarch64-musl.yaml
vendored
|
@ -43,7 +43,7 @@ jobs:
|
|||
key: npm-cache-linux-aarch64-gnu-node@16-${{ hashFiles('yarn.lock') }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile --ignore-platform --registry https://registry.npmjs.org --network-timeout 300000
|
||||
run: yarn install --immutable --network-timeout 300000
|
||||
|
||||
- name: 'Build TypeScript'
|
||||
run: yarn build
|
||||
|
|
2
.github/workflows/linux-aarch64.yaml
vendored
2
.github/workflows/linux-aarch64.yaml
vendored
|
@ -66,7 +66,7 @@ jobs:
|
|||
sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu -y
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile --ignore-platform --registry https://registry.npmjs.org --network-timeout 300000
|
||||
run: yarn install --immutable --network-timeout 300000
|
||||
|
||||
- name: 'Build TypeScript'
|
||||
run: yarn build
|
||||
|
|
2
.github/workflows/linux-armv7.yaml
vendored
2
.github/workflows/linux-armv7.yaml
vendored
|
@ -66,7 +66,7 @@ jobs:
|
|||
sudo apt-get install gcc-arm-linux-gnueabihf -y
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile --ignore-platform --registry https://registry.npmjs.org --network-timeout 300000
|
||||
run: yarn install --immutable --network-timeout 300000
|
||||
|
||||
- name: 'Build TypeScript'
|
||||
run: yarn build
|
||||
|
|
2
.github/workflows/linux-musl.yaml
vendored
2
.github/workflows/linux-musl.yaml
vendored
|
@ -25,7 +25,7 @@ jobs:
|
|||
cache: 'yarn'
|
||||
|
||||
- name: 'Install dependencies'
|
||||
run: yarn install --ignore-platform --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
||||
run: yarn install --immutable --network-timeout 300000
|
||||
|
||||
- name: 'Build TypeScript'
|
||||
run: yarn build
|
||||
|
|
2
.github/workflows/memory-test.yml
vendored
2
.github/workflows/memory-test.yml
vendored
|
@ -61,7 +61,7 @@ jobs:
|
|||
key: memory-leak-detect-${{ hashFiles('yarn.lock') }}
|
||||
|
||||
- name: 'Install dependencies'
|
||||
run: yarn install --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
||||
run: yarn install --immutable --network-timeout 300000
|
||||
|
||||
- name: 'Build TypeScript'
|
||||
run: yarn build
|
||||
|
|
14
.github/workflows/test.yaml
vendored
14
.github/workflows/test.yaml
vendored
|
@ -14,7 +14,7 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node: ['12', '14', '16', '17']
|
||||
node: ['14', '16', '17']
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
|
||||
name: stable - ${{ matrix.os }} - node@${{ matrix.node }}
|
||||
|
@ -46,22 +46,16 @@ jobs:
|
|||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.cargo/registry
|
||||
key: stable-${{ matrix.os }}-node@${{ matrix.node }}-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}
|
||||
key: stable-${{ matrix.os }}-node@${{ matrix.node }}-cargo-registry-trimmed
|
||||
|
||||
- name: Cache cargo index
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.cargo/git
|
||||
key: stable-${{ matrix.os }}gnu-node@${{ matrix.node }}-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: Cache NPM dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: node_modules
|
||||
key: npm-cache-${{ matrix.os }}-node@${{ matrix.node }}-${{ hashFiles('yarn.lock') }}
|
||||
key: stable-${{ matrix.os }}gnu-node@${{ matrix.node }}-cargo-index-trimmed
|
||||
|
||||
- name: 'Install dependencies'
|
||||
run: yarn install --frozen-lockfile --ignore-platform --registry https://registry.npmjs.org --network-timeout 300000
|
||||
run: yarn install --immutable --network-timeout 300000
|
||||
|
||||
- name: 'Build TypeScript'
|
||||
run: yarn build
|
||||
|
|
2
.github/workflows/windows-arm.yml
vendored
2
.github/workflows/windows-arm.yml
vendored
|
@ -25,7 +25,7 @@ jobs:
|
|||
cache: 'yarn'
|
||||
|
||||
- name: 'Install dependencies'
|
||||
run: yarn install --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
||||
run: yarn install --immutable --network-timeout 300000
|
||||
|
||||
- name: 'Build TypeScript'
|
||||
run: yarn build
|
||||
|
|
2
.github/workflows/windows-i686.yml
vendored
2
.github/workflows/windows-i686.yml
vendored
|
@ -26,7 +26,7 @@ jobs:
|
|||
cache: 'yarn'
|
||||
|
||||
- name: 'Install dependencies'
|
||||
run: yarn install --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
||||
run: yarn install --immutable --network-timeout 300000
|
||||
|
||||
- name: 'Build TypeScript'
|
||||
run: yarn build
|
||||
|
|
4
.github/workflows/zig.yaml
vendored
4
.github/workflows/zig.yaml
vendored
|
@ -51,7 +51,7 @@ jobs:
|
|||
path: node_modules
|
||||
key: npm-cache-linux-aarch64-gnu-node@16-${{ hashFiles('yarn.lock') }}
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile --ignore-platform --registry https://registry.npmjs.org --network-timeout 300000
|
||||
run: yarn install --immutable --network-timeout 300000
|
||||
- name: 'Build TypeScript'
|
||||
run: yarn build
|
||||
- name: Cross build native tests
|
||||
|
@ -103,7 +103,7 @@ jobs:
|
|||
path: node_modules
|
||||
key: npm-cache-${{ matrix.settings.host }}-node@16-${{ hashFiles('yarn.lock') }}
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile --ignore-platform --registry https://registry.npmjs.org --network-timeout 300000
|
||||
run: yarn install --immutable --network-timeout 300000
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
|
|
7
.gitignore
vendored
7
.gitignore
vendored
|
@ -156,3 +156,10 @@ scripts
|
|||
|
||||
sys/.node-headers
|
||||
bench.txt
|
||||
.pnp.*
|
||||
.yarn/*
|
||||
!.yarn/patches
|
||||
!.yarn/plugins
|
||||
!.yarn/releases
|
||||
!.yarn/sdks
|
||||
!.yarn/versions
|
||||
|
|
|
@ -3,3 +3,4 @@ node_modules
|
|||
scripts
|
||||
triples/index.js
|
||||
examples/napi/index.d.ts
|
||||
.yarn
|
768
.yarn/releases/yarn-3.1.1.cjs
vendored
Executable file
768
.yarn/releases/yarn-3.1.1.cjs
vendored
Executable file
File diff suppressed because one or more lines are too long
3
.yarnrc.yml
Normal file
3
.yarnrc.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
yarnPath: .yarn/releases/yarn-3.1.1.cjs
|
||||
nodeLinker: node-modules
|
||||
npmRegistryServer: https://registry.npmjs.org
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "test-module",
|
||||
"name": "bench",
|
||||
"version": "1.0.0",
|
||||
"scripts": {
|
||||
"build": "node ../cli/scripts/index.js build --js false --release"
|
||||
|
|
|
@ -44,11 +44,11 @@
|
|||
"@types/inquirer": "^8.1.3",
|
||||
"@types/js-yaml": "^4.0.5",
|
||||
"@types/lodash-es": "^4.17.5",
|
||||
"chalk": "4",
|
||||
"clipanion": "^3.1.0",
|
||||
"colorette": "^2.0.16",
|
||||
"debug": "^4.3.3",
|
||||
"env-paths": "^3.0.0",
|
||||
"fdir": "^5.1.0",
|
||||
"fdir": "^5.2.0",
|
||||
"inquirer": "^8.2.0",
|
||||
"js-yaml": "^4.1.0",
|
||||
"lodash-es": "4.17.21",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "test-module",
|
||||
"name": "compat-mode-examples",
|
||||
"version": "1.0.0",
|
||||
"scripts": {
|
||||
"build": "node ../../cli/scripts/index.js build --js false --features \"latest\"",
|
||||
|
|
|
@ -320,7 +320,7 @@ test('async', async (t) => {
|
|||
await t.notThrowsAsync(bufPromise)
|
||||
const buf = await bufPromise
|
||||
const { name } = JSON.parse(buf.toString())
|
||||
t.is(name, 'napi-examples')
|
||||
t.is(name, 'examples')
|
||||
|
||||
await t.throwsAsync(() => readFileAsync('some_nonexist_path.file'))
|
||||
})
|
||||
|
|
|
@ -23,7 +23,7 @@ Generated by [AVA](https://avajs.dev).
|
|||
'ava',
|
||||
'benny',
|
||||
'c8',
|
||||
'chalk',
|
||||
'colorette',
|
||||
'cross-env',
|
||||
'esbuild',
|
||||
'eslint',
|
||||
|
|
Binary file not shown.
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "napi-examples",
|
||||
"name": "examples",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"main": "./index.node",
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
"build": "node ../cli/scripts/index.js build --release"
|
||||
},
|
||||
"dependencies": {
|
||||
"chalk": "4",
|
||||
"colorette": "^2.0.16",
|
||||
"dockerode": "^3.3.1",
|
||||
"pretty-bytes": "^5.6.0",
|
||||
"table": "^6.7.5"
|
||||
"table": "^6.8.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/dockerode": "^3.3.1"
|
||||
|
|
|
@ -1,23 +1,21 @@
|
|||
const chalk = require('chalk')
|
||||
const { whiteBright, red, green, gray } = require('colorette')
|
||||
const prettyBytes = require('pretty-bytes')
|
||||
const { table } = require('table')
|
||||
|
||||
module.exports = function displayMemoryUsageFromNode(initialMemoryUsage) {
|
||||
const finalMemoryUsage = process.memoryUsage()
|
||||
const titles = Object.keys(initialMemoryUsage).map((k) =>
|
||||
chalk.whiteBright(k),
|
||||
)
|
||||
const titles = Object.keys(initialMemoryUsage).map((k) => whiteBright(k))
|
||||
const tableData = [titles]
|
||||
const diffColumn = []
|
||||
for (const [key, value] of Object.entries(initialMemoryUsage)) {
|
||||
const diff = finalMemoryUsage[key] - value
|
||||
const prettyDiff = prettyBytes(diff, { signed: true })
|
||||
if (diff > 0) {
|
||||
diffColumn.push(chalk.red(prettyDiff))
|
||||
diffColumn.push(red(prettyDiff))
|
||||
} else if (diff < 0) {
|
||||
diffColumn.push(chalk.green(prettyDiff))
|
||||
diffColumn.push(green(prettyDiff))
|
||||
} else {
|
||||
diffColumn.push(chalk.grey(prettyDiff))
|
||||
diffColumn.push(gray(prettyDiff))
|
||||
}
|
||||
}
|
||||
tableData.push(diffColumn)
|
||||
|
|
55
package.json
55
package.json
|
@ -2,12 +2,13 @@
|
|||
"name": "napi-rs",
|
||||
"version": "0.0.0",
|
||||
"description": "A minimal library for building compiled Node add-ons in Rust.",
|
||||
"private": "true",
|
||||
"workspaces": [
|
||||
"bench",
|
||||
"cli",
|
||||
"triples",
|
||||
"memory-testing",
|
||||
"examples/napi"
|
||||
"examples/napi",
|
||||
"examples/napi-compat-mode"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -17,14 +18,14 @@
|
|||
"scripts": {
|
||||
"bench": "cross-env TS_NODE_PROJECT='./bench/tsconfig.json' node -r ts-node/register/transpile-only bench/bench.ts",
|
||||
"build": "tsc -p tsconfig.json -m esnext && yarn bundle && shx chmod 777 cli/scripts/index.js && node -r ts-node/register/transpile-only ./generate-triple-list.ts",
|
||||
"build:bench": "yarn --cwd ./bench build",
|
||||
"build:memory": "yarn --cwd ./memory-testing build",
|
||||
"build:test": "yarn --cwd ./examples/napi-compat-mode build && yarn --cwd ./examples/napi build",
|
||||
"build:test:asan": "yarn --cwd ./examples/napi-compat-mode build --cargo-flags='-Zbuild-std' && yarn --cwd ./examples/napi build --cargo-flags='-Zbuild-std'",
|
||||
"build:test:aarch64": "yarn --cwd ./examples/napi-compat-mode build-aarch64 && yarn --cwd ./examples/napi build-aarch64",
|
||||
"build:test:android": "yarn --cwd ./examples/napi-compat-mode build --target aarch64-linux-android && yarn --cwd ./examples/napi build --target aarch64-linux-android",
|
||||
"build:test:android:armv7": "yarn --cwd ./examples/napi-compat-mode build --target armv7-linux-androideabi && yarn --cwd ./examples/napi build --target armv7-linux-androideabi",
|
||||
"build:test:armv7": "yarn --cwd ./examples/napi-compat-mode build-armv7 && yarn --cwd ./examples/napi build-armv7",
|
||||
"build:bench": "yarn workspace bench build",
|
||||
"build:memory": "yarn workspace memory-testing build",
|
||||
"build:test": "yarn workspace compat-mode-examples build && yarn workspace examples build",
|
||||
"build:test:asan": "yarn workspace compat-mode-examples build --cargo-flags='-Zbuild-std' && yarn workspace examples build --cargo-flags='-Zbuild-std'",
|
||||
"build:test:aarch64": "yarn workspace compat-mode-examples build-aarch64 && yarn workspace examples build-aarch64",
|
||||
"build:test:android": "yarn workspace compat-mode-examples build --target aarch64-linux-android && yarn workspace examples build --target aarch64-linux-android",
|
||||
"build:test:android:armv7": "yarn workspace compat-mode-examples build --target armv7-linux-androideabi && yarn workspace examples build --target armv7-linux-androideabi",
|
||||
"build:test:armv7": "yarn workspace compat-mode-examples build-armv7 && yarn workspace examples build-armv7",
|
||||
"bundle": "rollup -c rollup.config.js",
|
||||
"format": "run-p format:prettier format:rs",
|
||||
"format:prettier": "prettier . -w",
|
||||
|
@ -48,7 +49,10 @@
|
|||
"arrowParens": "always"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.@(js|json|md|yml|yaml)": [
|
||||
"*.@(js|ts)": [
|
||||
"eslint --fix"
|
||||
],
|
||||
"*.@(js||ts|json|md|yml|yaml)": [
|
||||
"prettier --write"
|
||||
]
|
||||
},
|
||||
|
@ -61,35 +65,36 @@
|
|||
"@rollup/plugin-alias": "^3.1.9",
|
||||
"@rollup/plugin-commonjs": "^21.0.1",
|
||||
"@rollup/plugin-json": "^4.1.0",
|
||||
"@rollup/plugin-node-resolve": "^13.1.2",
|
||||
"@rollup/plugin-node-resolve": "^13.1.3",
|
||||
"@rollup/plugin-replace": "^3.0.1",
|
||||
"@types/debug": "^4.1.7",
|
||||
"@types/lodash-es": "^4.17.5",
|
||||
"@types/node": "^17.0.7",
|
||||
"@types/sinon": "^10.0.6",
|
||||
"@typescript-eslint/eslint-plugin": "^5.9.0",
|
||||
"@typescript-eslint/parser": "^5.9.0",
|
||||
"ava": "^4.0.0",
|
||||
"@types/node": "^17.0.10",
|
||||
"@types/sinon": "^10.0.8",
|
||||
"@typescript-eslint/eslint-plugin": "^5.10.0",
|
||||
"@typescript-eslint/parser": "^5.10.0",
|
||||
"ava": "^4.0.1",
|
||||
"benny": "^3.7.1",
|
||||
"c8": "^7.11.0",
|
||||
"chalk": "4",
|
||||
"colorette": "^2.0.16",
|
||||
"cross-env": "^7.0.3",
|
||||
"esbuild": "^0.14.10",
|
||||
"eslint": "^8.6.0",
|
||||
"esbuild": "^0.14.13",
|
||||
"eslint": "^8.7.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-import": "^2.25.4",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"husky": "^7.0.4",
|
||||
"lerna": "^4.0.0",
|
||||
"lint-staged": "^12.1.5",
|
||||
"lint-staged": "^12.3.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^2.5.1",
|
||||
"rollup": "^2.62.0",
|
||||
"shx": "^0.3.3",
|
||||
"rollup": "^2.66.0",
|
||||
"shx": "^0.3.4",
|
||||
"sinon": "^12.0.1",
|
||||
"source-map-support": "^0.5.21",
|
||||
"ts-node": "^10.4.0",
|
||||
"tslib": "^2.3.1",
|
||||
"typescript": "^4.5.4"
|
||||
}
|
||||
"typescript": "^4.5.5"
|
||||
},
|
||||
"packageManager": "yarn@3.1.1"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue