Skip to content

Commit

Permalink
Merge pull request #130 from ChainSafe/mkeil/migrate-rebuild-move-nap…
Browse files Browse the repository at this point in the history
…i-src-to-root

feat: move napi code, utils and config files out of rebuild to repo root
  • Loading branch information
matthewkeil committed Apr 5, 2024
2 parents f11f382 + cd71bae commit 0890ba5
Show file tree
Hide file tree
Showing 56 changed files with 396 additions and 4,107 deletions.
File renamed without changes.
23 changes: 21 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ module.exports = {
},
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 10,
ecmaVersion: "latest",
project: "./tsconfig.json",
sourceType: "script",
},
plugins: ["@typescript-eslint", "eslint-plugin-import", "eslint-plugin-node", "prettier"],
extends: [
Expand Down Expand Up @@ -82,11 +83,29 @@ module.exports = {
},
overrides: [
{
files: ["**/test/**/*.ts"],
files: ["lib/index.mjs"],
parserOptions: {
sourceType: "module"
},
rules: {
// The imports are all resolved via tsconfig.mjs.json but the root tsconfig that eslint uses
// shows them as unresolved.
"import/no-unresolved": "off",
},
},
{
files: ["test/**/*.ts"],
rules: {
"import/no-extraneous-dependencies": "off",
"@typescript-eslint/no-explicit-any": "off",
},
},
{
// Is a dev file and squacks about chokidar being a devDependency
files: ["scripts/watch.ts"],
rules: {
"import/no-extraneous-dependencies": "off"
},
},
],
};
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"configurations": [
{
"name": "Mac",
"name": "OSX - Napi Dependency Configuration",
"includePath": [
"${workspaceFolder}/**",
"/Users/matthewkeil/.node-gyp/**"
"${env:HOME}/.node-gyp/**",
"${env:HOME}/.nvm/versions/node/**"
],
"defines": [],
"macFrameworkPath": [
Expand Down
12 changes: 12 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@
"console": "integratedTerminal",
"protocol": "inspector",
"cwd": "${workspaceFolder}"
},
{
"type": "lldb",
"request": "launch",
"name": "Debug Native Addon",
"cwd": "${workspaceRoot}",
"preLaunchTask": "npm: build:debug",
"program": "node",
"args": [
"node_modules/.bin/mocha",
"test/unit/**/*.test.ts"
]
}
]
}
6 changes: 3 additions & 3 deletions rebuild/binding.gyp → binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
{
'target_name': 'blst_ts_addon',
'sources': [
'deps/blst/src/server.c',
'deps/blst/build/assembly.S',
'blst/src/server.c',
'blst/build/assembly.S',
'src/addon.cc',
'src/secret_key.cc',
'src/public_key.cc',
'src/signature.cc',
'src/functions.cc',
],
'include_dirs': [
'deps/blst/bindings',
'blst/bindings',
"<!@(node -p \"require('node-addon-api').include_dir\")",
],
'dependencies': [ "<!(node -p \"require('node-addon-api').gyp\")" ],
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 10 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@
"blst"
],
"scripts": {
"install": "node dist/scripts/install.js",
"lint": "eslint --color --ext .ts src/ test/",
"bootstrap": "yarn install --ignore-scripts && yarn build && yarn install",
"build": "tsc --project tsconfig.build.json",
"build:gyp": "node-gyp build",
"build:gyp:debug": "node-gyp build --debug",
"build:fuzz": "tsc --project tsconfig.fuzz.json",
"bootstrap": "yarn install --ignore-scripts && yarn build && yarn install",
"clean": "rm -rf prebuild/*.node dist blst/libblst.a blst/bindings/libblst.a blst/bindings/node.js/blst.node blst/bindings/node.js/blst_wrap.cpp",
"clean:gyp": "node-gyp clean && node-gyp configure",
"lint": "npm run lint:c && npm run lint:ts",
"lint:c": "clang-format -i ./src/*",
"lint:ts": "eslint --color --ext .js,.mjs,.cjs,.ts lib/ scripts/ test/ utils/",
"test": "yarn test:unit && yarn test:spec && yarn test:perf && yarn test:memory",
"test:fuzz": "ts-node test/fuzz/fuzz.test.ts",
"test:memory": "node -r ts-node/register --expose-gc test/memory/memory.test.ts",
Expand Down Expand Up @@ -59,7 +63,9 @@
"typescript": "^5.2.2"
},
"dependencies": {
"bindings": "^1.5.0",
"node-addon-api": "^6.1.0",
"node-fetch": "^2.6.1",
"node-gyp": "^8.4.0"
"node-gyp": "^10.0.1"
}
}
99 changes: 0 additions & 99 deletions rebuild/.eslintrc.js

This file was deleted.

15 changes: 0 additions & 15 deletions rebuild/.gitignore

This file was deleted.

6 changes: 0 additions & 6 deletions rebuild/.mocharc.cjs

This file was deleted.

9 changes: 0 additions & 9 deletions rebuild/.prettierrc.yml

This file was deleted.

15 changes: 0 additions & 15 deletions rebuild/.vscode/launch.json

This file was deleted.

Loading

0 comments on commit 0890ba5

Please sign in to comment.