From 4c48d4d1ce8593f2e2c56081ded590082bdadcf5 Mon Sep 17 00:00:00 2001 From: Tomasz Bazelczuk Date: Thu, 24 Mar 2022 09:48:01 +0100 Subject: [PATCH] fix: windows pwd path (#60) --- .github/workflows/validate-code.yml | 22 +++++++++++++++++++ README.md | 2 +- base-manifest.js | 3 ++- examples/advanced/package-lock.json | 10 ++++----- examples/advanced/package.json | 4 ++-- examples/basic/package-lock.json | 21 +++++++++++------- examples/basic/package.json | 4 ++-- package-lock.json | 4 ++-- package.json | 4 ++-- src/env/kopytkorc-reader.js | 2 +- .../module/build-module-tree.js | 2 +- src/plugin-helpers/module/get-npm-list.js | 2 +- .../steps/build/build-step-config.js | 6 ++--- .../steps/deploy/deploy-step-config.js | 2 +- .../extract-archive-step-config.js | 4 ++-- .../generate-package-step-config.js | 2 +- .../rekey-device/rekey-device-step-config.js | 2 +- .../screenshot/screenshot-step-config.js | 2 +- 18 files changed, 63 insertions(+), 35 deletions(-) diff --git a/.github/workflows/validate-code.yml b/.github/workflows/validate-code.yml index 9b7aa4a..d81fc42 100644 --- a/.github/workflows/validate-code.yml +++ b/.github/workflows/validate-code.yml @@ -16,3 +16,25 @@ jobs: run: npm ci - name: Run linter run: npm run lint + + build: + runs-on: ${{ matrix.os }} + needs: validate-code + strategy: + matrix: + os: [macos-latest, windows-latest, ubuntu-latest] + node: [16] + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Install Dependencies + run: | + npm ci + npm ci --prefix=examples/basic + npm ci --prefix=examples/advanced + - name: Run build basic + run: npm run build --prefix=examples/basic + - name: Run build advanced + run: npm run build --prefix=examples/advanced + + diff --git a/README.md b/README.md index b9a12ae..9295c9a 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ The packager consists of the following features: ## Prerequisites - node version 16+ -- npm version 7 +- npm version 8+ ## Quick start 1. Install the Packager diff --git a/base-manifest.js b/base-manifest.js index aacfec6..ea541c3 100644 --- a/base-manifest.js +++ b/base-manifest.js @@ -1,4 +1,5 @@ -const packageJson = require(process.env.PWD + '/package.json'); +const path = require('path') +const packageJson = require(path.join(process.cwd(), 'package.json')); const versionParts = packageJson.version.split('.'); module.exports = { diff --git a/examples/advanced/package-lock.json b/examples/advanced/package-lock.json index b8c6345..dae3317 100644 --- a/examples/advanced/package-lock.json +++ b/examples/advanced/package-lock.json @@ -15,9 +15,9 @@ } }, "../..": { - "name": "@kopytko/packager", - "version": "1.4.0", - "license": "UNLICENSED", + "name": "@dazn/kopytko-packager", + "version": "1.2.1", + "license": "MIT", "dependencies": { "adm-zip": "^0.5.5", "dotenv": "^9.0.2", @@ -40,8 +40,8 @@ "eslint": "^7.26.0" }, "engines": { - "node": ">=14.0.0", - "npm": ">=7.0.0" + "node": ">=16.0.0", + "npm": ">=8.0.0" } }, "../module": { diff --git a/examples/advanced/package.json b/examples/advanced/package.json index b50e9f9..4b6261f 100644 --- a/examples/advanced/package.json +++ b/examples/advanced/package.json @@ -3,8 +3,8 @@ "version": "1.0.0", "description": "Advanced example kopytko-packager based app", "scripts": { - "build": "node node_modules/@kopytko/packager/scripts/build.js", - "start": "node node_modules/@kopytko/packager/scripts/start.js" + "build": "node ./node_modules/@kopytko/packager/scripts/build.js", + "start": "node ./node_modules/@kopytko/packager/scripts/start.js" }, "private": true, "devDependencies": { diff --git a/examples/basic/package-lock.json b/examples/basic/package-lock.json index 8b314b9..cb44525 100644 --- a/examples/basic/package-lock.json +++ b/examples/basic/package-lock.json @@ -12,31 +12,34 @@ } }, "../..": { - "version": "1.2.0", + "name": "@dazn/kopytko-packager", + "version": "1.2.1", "dev": true, - "license": "UNLICENSED", + "license": "MIT", "dependencies": { "adm-zip": "^0.5.5", "dotenv": "^9.0.2", "fs-extra": "^10.0.0", "glob-promise": "^4.1.0", + "latinize": "^0.5.0", + "lodash": "^4.17.21", "minimist": "^1.2.5", "ora": "^5.4.0", "request": "^2.88.2", "request-promise": "^4.2.6", "telnet-client": "^1.4.9", - "terminal-kit": "^2.1.0" + "terminal-kit": "^2.1.0", + "xml2js": "^0.4.23" }, "devDependencies": { "@babel/core": "^7.14.3", "@babel/eslint-parser": "^7.14.3", "@babel/preset-env": "^7.14.2", - "eslint": "^7.26.0", - "latinize": "^0.5.0" + "eslint": "^7.26.0" }, "engines": { - "node": ">=14.0.0", - "npm": ">=7.0.0" + "node": ">=16.0.0", + "npm": ">=8.0.0" } }, "node_modules/@kopytko/packager": { @@ -57,12 +60,14 @@ "fs-extra": "^10.0.0", "glob-promise": "^4.1.0", "latinize": "^0.5.0", + "lodash": "^4.17.21", "minimist": "^1.2.5", "ora": "^5.4.0", "request": "^2.88.2", "request-promise": "^4.2.6", "telnet-client": "^1.4.9", - "terminal-kit": "^2.1.0" + "terminal-kit": "^2.1.0", + "xml2js": "^0.4.23" } } } diff --git a/examples/basic/package.json b/examples/basic/package.json index 3dbc316..8e5c241 100644 --- a/examples/basic/package.json +++ b/examples/basic/package.json @@ -3,8 +3,8 @@ "version": "1.0.0", "description": "Basic example kopytko-packager based app", "scripts": { - "build": "node node_modules/@kopytko/packager/scripts/build.js", - "start": "node node_modules/@kopytko/packager/scripts/start.js" + "build": "node ./node_modules/@kopytko/packager/scripts/build.js", + "start": "node ./node_modules/@kopytko/packager/scripts/start.js" }, "private": true, "devDependencies": { diff --git a/package-lock.json b/package-lock.json index 48abed8..0fce039 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30,8 +30,8 @@ "eslint": "^7.26.0" }, "engines": { - "node": ">=14.0.0", - "npm": ">=7.0.0" + "node": ">=16.0.0", + "npm": ">=8.0.0" } }, "node_modules/@babel/code-frame": { diff --git a/package.json b/package.json index efc9169..3ed6ca6 100644 --- a/package.json +++ b/package.json @@ -19,8 +19,8 @@ "Tomasz Bazelczuk " ], "engines": { - "node": ">=14.0.0", - "npm": ">=7.0.0" + "node": ">=16.0.0", + "npm": ">=8.0.0" }, "license": "MIT", "repository": { diff --git a/src/env/kopytkorc-reader.js b/src/env/kopytkorc-reader.js index ba8eb87..0affa64 100644 --- a/src/env/kopytkorc-reader.js +++ b/src/env/kopytkorc-reader.js @@ -146,6 +146,6 @@ module.exports = class KopytkorcReader { } _getAbsolutePath(projectPath) { - return path.join(process.env.PWD, projectPath); + return path.join(process.cwd(), projectPath); } } diff --git a/src/plugin-helpers/module/build-module-tree.js b/src/plugin-helpers/module/build-module-tree.js index fb7096d..2762bc2 100644 --- a/src/plugin-helpers/module/build-module-tree.js +++ b/src/plugin-helpers/module/build-module-tree.js @@ -80,7 +80,7 @@ const findDir = (name, parentDir) => { } } - return getModuleDir(process.env.PWD, name); + return getModuleDir(process.cwd(), name); } const getModuleDir = (parentDir, name) => path.join(parentDir, 'node_modules/', name); diff --git a/src/plugin-helpers/module/get-npm-list.js b/src/plugin-helpers/module/get-npm-list.js index e662c7b..f128d15 100644 --- a/src/plugin-helpers/module/get-npm-list.js +++ b/src/plugin-helpers/module/get-npm-list.js @@ -1,7 +1,7 @@ const childProcess = require('child_process'); module.exports = function getNpmList({ - cwd = process.env.PWD, + cwd = process.cwd(), depth = null, prodOnly = true, } = {}) { diff --git a/src/step-runner/steps/build/build-step-config.js b/src/step-runner/steps/build/build-step-config.js index aac259b..8e57b11 100644 --- a/src/step-runner/steps/build/build-step-config.js +++ b/src/step-runner/steps/build/build-step-config.js @@ -4,9 +4,9 @@ const args = require('../../../env/args'); const kopytkoConfig = require('../../../env/kopytko-config'); module.exports = { - archivePath: path.join(process.env.PWD, kopytkoConfig.archivePath), + archivePath: path.join(process.cwd(), kopytkoConfig.archivePath), env: args.env, - rootDir: process.env.PWD, - sourceDir: path.join(process.env.PWD, kopytkoConfig.sourceDir), + rootDir: process.cwd(), + sourceDir: path.join(process.cwd(), kopytkoConfig.sourceDir), tempDir: kopytkoConfig.tempDir, } diff --git a/src/step-runner/steps/deploy/deploy-step-config.js b/src/step-runner/steps/deploy/deploy-step-config.js index 0e4394a..bf74667 100644 --- a/src/step-runner/steps/deploy/deploy-step-config.js +++ b/src/step-runner/steps/deploy/deploy-step-config.js @@ -4,7 +4,7 @@ const args = require('../../../env/args'); const kopytkoConfig = require('../../../env/kopytko-config'); module.exports = { - archivePath: path.join(process.env.PWD, kopytkoConfig.archivePath), + archivePath: path.join(process.cwd(), kopytkoConfig.archivePath), rokuIP: args.rokuIP, rokuDevPassword: args.rokuDevPassword, rokuDevUser: args.rokuDevUser, diff --git a/src/step-runner/steps/extract-archive/extract-archive-step-config.js b/src/step-runner/steps/extract-archive/extract-archive-step-config.js index c75eba4..ee77e3c 100644 --- a/src/step-runner/steps/extract-archive/extract-archive-step-config.js +++ b/src/step-runner/steps/extract-archive/extract-archive-step-config.js @@ -3,6 +3,6 @@ const path = require('path'); const kopytkoConfig = require('../../../env/kopytko-config'); module.exports = { - archivePath: path.join(process.env.PWD, kopytkoConfig.archivePath), - outputDir: path.join(process.env.PWD, '/out/debug/'), + archivePath: path.join(process.cwd(), kopytkoConfig.archivePath), + outputDir: path.join(process.cwd(), '/out/debug/'), } diff --git a/src/step-runner/steps/generate-package/generate-package-step-config.js b/src/step-runner/steps/generate-package/generate-package-step-config.js index c6f09b0..448a060 100644 --- a/src/step-runner/steps/generate-package/generate-package-step-config.js +++ b/src/step-runner/steps/generate-package/generate-package-step-config.js @@ -4,7 +4,7 @@ const args = require('../../../env/args'); const kopytkoConfig = require('../../../env/kopytko-config'); module.exports = { - generatedPackagePath: path.join(process.env.PWD, kopytkoConfig.generatedPackagePath), + generatedPackagePath: path.join(process.cwd(), kopytkoConfig.generatedPackagePath), rokuIP: args.rokuIP, rokuDevPassword: args.rokuDevPassword, rokuDevUser: args.rokuDevUser, diff --git a/src/step-runner/steps/rekey-device/rekey-device-step-config.js b/src/step-runner/steps/rekey-device/rekey-device-step-config.js index f71fa8a..0386ed5 100644 --- a/src/step-runner/steps/rekey-device/rekey-device-step-config.js +++ b/src/step-runner/steps/rekey-device/rekey-device-step-config.js @@ -3,7 +3,7 @@ const path = require('path'); const args = require('../../../env/args'); module.exports = { - signedPackagePath: path.join(process.env.PWD, args.signedPackagePath), + signedPackagePath: path.join(process.cwd(), args.signedPackagePath), rokuIP: args.rokuIP, rokuDevPassword: args.rokuDevPassword, rokuDevUser: args.rokuDevUser, diff --git a/src/step-runner/steps/screenshot/screenshot-step-config.js b/src/step-runner/steps/screenshot/screenshot-step-config.js index 5e50175..e33def7 100644 --- a/src/step-runner/steps/screenshot/screenshot-step-config.js +++ b/src/step-runner/steps/screenshot/screenshot-step-config.js @@ -7,5 +7,5 @@ module.exports = { rokuIP: args.rokuIP, rokuDevPassword: args.rokuDevPassword, rokuDevUser: args.rokuDevUser, - screenshotDir: path.join(process.env.PWD, kopytkoConfig.screenshotDir), + screenshotDir: path.join(process.cwd(), kopytkoConfig.screenshotDir), }