Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
Removed external dependencies on rimraf and uuid packages, replacing
them with built-in functionality within Node.

Node 18 is now the minimum required version.

Signed-off-by: Mark S. Lewis <[email protected]>
  • Loading branch information
bestbeforetoday committed Oct 31, 2024
1 parent 85c5497 commit 71967d8
Show file tree
Hide file tree
Showing 21 changed files with 160 additions and 206 deletions.
22 changes: 22 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
root = true

[*]
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = lf
max_line_length = 120
indent_style = space
indent_size = 4

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

[*.html]
indent_size = 2

[*.md]
indent_size = 2

[*.{mj,cj,j,t}s]
quote_type = double
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

98 changes: 0 additions & 98 deletions .eslintrc.js

This file was deleted.

29 changes: 15 additions & 14 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,27 @@ name: Node.js CI

on:
push:
branches: [ "main" ]
branches:
- main
pull_request:
branches: [ "main" ]
branches:
- main

jobs:
build:

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
node-version: [12.x, 14.x, 16.x]

node-version:
- 18
- 22
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run build --if-present
- run: npm test
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run build --if-present
- run: npm test
33 changes: 33 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const jest = require("eslint-plugin-jest");
const js = require("@eslint/js");
const prettier = require("eslint-config-prettier");
const tseslint = require("typescript-eslint");

module.exports = tseslint.config(
{
ignores: ["*", "!src/", "!test/"],
},
js.configs.recommended,
...tseslint.configs.strictTypeChecked,
prettier,
jest.configs["flat/recommended"],
{
languageOptions: {
ecmaVersion: 2022,
sourceType: "module",
parserOptions: {
project: "tsconfig.json",
tsconfigRootDir: __dirname,
},
},
rules: {
complexity: ["error", 10],
"@typescript-eslint/explicit-function-return-type": [
"error",
{
allowExpressions: true,
},
],
},
},
);
5 changes: 1 addition & 4 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,5 @@ module.exports = {
testEnvironment: "node",
collectCoverage: true,
coverageProvider: "v8",
testPathIgnorePatterns: [
"/node_modules/",
"/scenario/"
]
testPathIgnorePatterns: ["/node_modules/", "/scenario/"],
};
39 changes: 19 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
{
"name": "fabric-wallet-migration",
"version": "0.2.0",
"version": "0.3.0",
"description": "Migration from Hyperledger Fabric 1.4 to 2.0 wallets",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"engines": {
"node": ">=12.22.0"
"node": ">=18.18.0"
},
"scripts": {
"build": "npm-run-all clean compile copy-non-ts-source",
"clean": "rimraf dist *.tgz scenario/package-lock.json scenario/node_modules",
"clean": "rm -rf dist *.tgz scenario/package-lock.json scenario/node_modules",
"compile": "tsc --build tsconfig.build.json",
"copy-non-ts-source": "rsync -rv --prune-empty-dirs --include='*.d.ts' --exclude='*.ts' src/ dist",
"lint": "eslint .",
"format": "prettier '**/*.{ts,js}' --check",
"format:fix": "prettier '**/*.{ts,js}' --write",
"lint": "eslint",
"scenario": "./runScenario.sh",
"test": "npm-run-all lint unitTest scenario",
"test": "npm-run-all lint format unitTest build scenario",
"unitTest": "jest"
},
"repository": {
Expand All @@ -31,22 +33,19 @@
},
"homepage": "https://github.com/bestbeforetoday/fabric-wallet-migration#readme",
"devDependencies": {
"@tsconfig/node12": "^1.0.11",
"@types/jest": "^28.1.6",
"@types/rimraf": "^3.0.0",
"@types/uuid": "^8.3.0",
"@typescript-eslint/eslint-plugin": "^5.33.0",
"@typescript-eslint/parser": "^5.33.0",
"eslint": "^8.21.0",
"eslint-plugin-jest": "^26.8.2",
"@eslint/js": "^9.13.0",
"@tsconfig/node18": "^18.2.4",
"@types/jest": "^29.5.14",
"@types/node": "^18.19.62",
"eslint": "^9.13.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jest": "^28.8.3",
"fabric-network": "^1.4.13",
"jest": "^28.1.3",
"jest": "^29.7.0",
"npm-run-all": "^4.1.5",
"ts-jest": "^28.0.7",
"typescript": "~4.7.4"
},
"dependencies": {
"rimraf": "^3.0.2",
"uuid": "^8.3.1"
"prettier": "^3.3.3",
"ts-jest": "^29.2.5",
"typescript": "~5.6.0",
"typescript-eslint": "^8.12.2"
}
}
6 changes: 4 additions & 2 deletions runScenario.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
#!/bin/bash

set -eu -o pipefail
shopt -s extglob

DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )

createPackFile() {
local packFile targetFile
packFile=$( npm pack )
targetFile=$( echo "${packFile}" | sed -e 's/[^-]*\.tgz$/dev.tgz/' )
packFile="$( npm pack )"
targetFile="${packFile/%*([^-]).tgz/dev.tgz}"
mv "${packFile}" "${targetFile}"
}

scenarioTest() {
rm -rf package-lock.json node_modules
npm install
npm run lint
npm run format
npm test
}

Expand Down
2 changes: 0 additions & 2 deletions scenario/.eslintignore

This file was deleted.

8 changes: 0 additions & 8 deletions scenario/.eslintrc.js

This file was deleted.

16 changes: 16 additions & 0 deletions scenario/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const base = require("../eslint.config");
const tseslint = require("typescript-eslint");

module.exports = tseslint.config(
{
files: ["test/"],
},
...base,
{
languageOptions: {
parserOptions: {
tsconfigRootDir: __dirname,
},
},
},
);
2 changes: 1 addition & 1 deletion scenario/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
preset: "ts-jest",
testEnvironment: "node",
rootDir: "./test"
rootDir: "./test",
};
25 changes: 16 additions & 9 deletions scenario/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,27 @@
"description": "",
"main": "index.js",
"scripts": {
"lint": "eslint .",
"format": "prettier '**/*.{ts,js}' --check",
"format:fix": "prettier '**/*.{ts,js}' --write",
"lint": "eslint",
"test": "jest"
},
"author": "",
"license": "Apache-2.0",
"devDependencies": {
"@tsconfig/node12": "^1.0.11",
"@types/jest": "^28.1.6",
"@typescript-eslint/eslint-plugin": "^5.33.0",
"@typescript-eslint/parser": "^5.33.0",
"eslint": "^8.21.0",
"fabric-network": "^2.2.3",
"@eslint/js": "^9.13.0",
"@tsconfig/node18": "^18.2.4",
"@types/jest": "^29.5.14",
"@types/node": "^18.19.62",
"eslint": "^9.13.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jest": "^28.8.3",
"fabric-network": "^2.2.20",
"fabric-wallet-migration": "file:../fabric-wallet-migration-dev.tgz",
"jest": "^28.1.3",
"ts-jest": "^28.0.7"
"jest": "^29.7.0",
"prettier": "^3.3.3",
"ts-jest": "^29.2.5",
"typescript": "~5.6.0",
"typescript-eslint": "^8.12.2"
}
}
7 changes: 2 additions & 5 deletions scenario/test/Migrate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@
import * as WalletMigration from "fabric-wallet-migration";
import { Wallet, Wallets, Identity, X509Identity } from "fabric-network";

import * as fs from "fs";
import * as fs from "fs";
import * as os from "os";
import * as path from "path";
import * as util from "util";
import _rimraf from "rimraf";
const rimraf = util.promisify(_rimraf);

const oldWalletPath = path.resolve(__dirname, "..", "wallet");

Expand Down Expand Up @@ -63,7 +60,7 @@ describe("Wallet migration", () => {
});

afterAll(async () => {
await rimraf(walletPath);
await fs.promises.rm(walletPath, { recursive: true, force: true });
});

it("has expected labels", async () => {
Expand Down
Loading

0 comments on commit 71967d8

Please sign in to comment.