Skip to content

Commit

Permalink
Prefer cwd
Browse files Browse the repository at this point in the history
  • Loading branch information
TheJaredWilcurt committed Dec 14, 2023
1 parent b18fa38 commit 4faff73
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const path = require('node:path');
let https;
try {
https = require('node:https');
} catch (err) {
} catch (error) {
console.error('https support is disabled!');
}

Expand Down Expand Up @@ -54,14 +54,14 @@ function getVersions () {

function getLocalNwManifestPath () {
return new Promise(async (resolve, reject) => {
const nwManifestRelativeToHere = path.resolve(__dirname, '..', 'nw', 'package.json');
const nwManifestRelativeToCwd = path.resolve(process.cwd(), 'node_modules', 'nw', 'package.json');
const hereExists = await fileExists(nwManifestRelativeToHere);
const nwManifestRelativeToHere = path.resolve(__dirname, '..', 'nw', 'package.json');
const cwdExists = await fileExists(nwManifestRelativeToCwd);
if (hereExists) {
resolve(nwManifestRelativeToHere);
} else if (cwdExists) {
const hereExists = await fileExists(nwManifestRelativeToHere);
if (cwdExists) {
resolve(nwManifestRelativeToCwd);
} else if (hereExists) {
resolve(nwManifestRelativeToHere);
} else {
reject(new Error('Could not locate nw node module manifest.'));
}
Expand Down Expand Up @@ -138,14 +138,14 @@ function determinOriginalEOL (data) {

function getManifestPath () {
return new Promise(async (resolve, reject) => {
const manifestRelativeToHere = path.resolve(__dirname, '..', '..', 'package.json');
const manifestRelativeToCwd = path.resolve(process.cwd(), 'package.json');
const hereExists = await fileExists(manifestRelativeToHere);
const manifestRelativeToHere = path.resolve(__dirname, '..', '..', 'package.json');
const cwdExists = await fileExists(manifestRelativeToCwd);
if (hereExists) {
resolve(manifestRelativeToHere);
} else if (cwdExists) {
const hereExists = await fileExists(manifestRelativeToHere);
if (cwdExists) {
resolve(manifestRelativeToCwd);
} else if (hereExists) {
resolve(manifestRelativeToHere);
} else {
reject(new Error('Could not locate your manifest.'));
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "base-volta-off-of-nwjs",
"version": "0.0.2",
"version": "0.0.3",
"main": "index.js",
"bin": "./index.js",
"license": "MIT",
Expand Down

0 comments on commit 4faff73

Please sign in to comment.