From f7adefb82191de6e7d4c36d60b5b7512eb990e4f Mon Sep 17 00:00:00 2001 From: Mykola Mokhnach Date: Sat, 27 Jan 2024 04:13:09 +0100 Subject: [PATCH] chore: Remove husky and commitlint (#722) --- .husky/commit-msg | 4 ---- .husky/pre-commit | 4 ---- commitlint.config.js | 11 ----------- package.json | 14 +------------- test/functional/adb-commands-e2e-specs.js | 17 +++++++++-------- 5 files changed, 10 insertions(+), 40 deletions(-) delete mode 100755 .husky/commit-msg delete mode 100755 .husky/pre-commit delete mode 100644 commitlint.config.js diff --git a/.husky/commit-msg b/.husky/commit-msg deleted file mode 100755 index 424f44d4..00000000 --- a/.husky/commit-msg +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env sh -. "$(dirname -- "$0")/_/husky.sh" - -npm run lint:commit -- --edit ${1} diff --git a/.husky/pre-commit b/.husky/pre-commit deleted file mode 100755 index 26e0c553..00000000 --- a/.husky/pre-commit +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env sh -. "$(dirname -- "$0")/_/husky.sh" - -npm run lint:staged diff --git a/commitlint.config.js b/commitlint.config.js deleted file mode 100644 index dd1f77d7..00000000 --- a/commitlint.config.js +++ /dev/null @@ -1,11 +0,0 @@ -module.exports = { - extends: ['@commitlint/config-conventional'], - rules: { - 'body-leading-blank': [0], - 'body-max-line-length': [0], - 'footer-max-line-length': [0], - 'header-max-length': [0], - 'subject-case': [0], - 'subject-full-stop': [0], - }, -}; diff --git a/package.json b/package.json index e5350089..ade1582d 100644 --- a/package.json +++ b/package.json @@ -9,10 +9,9 @@ "dev": "npm run build -- --watch", "lint": "eslint .", "lint:fix": "npm run lint -- --fix", - "lint:staged": "lint-staged", - "lint:commit": "commitlint", "prepare": "npm run rebuild", "rebuild": "npm run clean && npm run build", + "format": "prettier -w ./lib", "test": "mocha --exit --timeout 1m \"./test/unit/**/*-specs.js\"", "e2e-test": "mocha --exit --timeout 5m \"./test/functional/**/*-specs.js\"" }, @@ -33,12 +32,6 @@ "directories": { "lib": "lib" }, - "lint-staged": { - "*.(js|ts)": [ - "eslint --fix", - "prettier --write" - ] - }, "prettier": { "bracketSpacing": false, "printWidth": 100, @@ -70,8 +63,6 @@ "@appium/eslint-config-appium": "^6.0.0", "@appium/test-support": "^3.0.1", "@appium/types": "^0.x", - "@commitlint/cli": "^18.0.0", - "@commitlint/config-conventional": "^18.1.0", "@semantic-release/changelog": "^6.0.1", "@semantic-release/git": "^10.0.1", "@types/async-lock": "^1.4.0", @@ -94,14 +85,11 @@ "eslint-plugin-import": "^2.26.0", "eslint-plugin-mocha": "^9.0.0", "eslint-plugin-promise": "^6.0.0", - "husky": "^8.0.3", - "lint-staged": "^15.0.1", "mocha": "^10.0.0", "prettier": "^3.0.0", "rimraf": "^5.0.0", "semantic-release": "^23.0.0", "sinon": "^17.0.0", - "temp": "^0.x", "ts-node": "^10.9.1", "typescript": "~5.2.2" }, diff --git a/test/functional/adb-commands-e2e-specs.js b/test/functional/adb-commands-e2e-specs.js index f8d6f2d0..c05ce74c 100644 --- a/test/functional/adb-commands-e2e-specs.js +++ b/test/functional/adb-commands-e2e-specs.js @@ -4,8 +4,7 @@ import chaiAsPromised from 'chai-as-promised'; import {ADB} from '../../lib/adb'; import path from 'path'; import { apiLevel, platformVersion, MOCHA_TIMEOUT } from './setup'; -import { fs, mkdirp } from '@appium/support'; -import temp from 'temp'; +import { fs, tempDir } from '@appium/support'; import _ from 'lodash'; import { waitForCondition } from 'asyncbox'; @@ -195,18 +194,20 @@ describe('adb commands', function () { return `/data/local/tmp/test${Math.random()}`; } - let localFile = temp.path({prefix: 'appium', suffix: '.tmp'}); - let tempFile = temp.path({prefix: 'appium', suffix: '.tmp'}); + let localFile; + let tempFile; + let tempRoot; const stringData = `random string data ${Math.random()}`; before(async function () { - await mkdirp(path.dirname(localFile)); - await mkdirp(path.dirname(tempFile)); + tempRoot = await tempDir.openDir(); + localFile = path.join(tempRoot, 'local.tmp'); + tempFile = path.join(tempRoot, 'temp.tmp'); await fs.writeFile(localFile, stringData); }); after(async function () { - if (await fs.exists(localFile)) { - await fs.unlink(localFile); + if (tempRoot) { + await fs.rimraf(tempRoot); } }); afterEach(async function () {