@gkalpak/aliases 0.9.4 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/bin/aio/__a-builds-dir.js +5 -7
- package/bin/aio/aioall.js +5 -5
- package/bin/aio/aioatt.js +5 -5
- package/bin/aio/aiobd.js +5 -5
- package/bin/aio/aiord.js +5 -5
- package/bin/aio/aiorm.js +5 -5
- package/bin/config/cfgbash.js +3 -4
- package/bin/config/cfgbash.wsl.js +3 -4
- package/bin/config/cfggit.js +3 -4
- package/bin/config/cfggit.wsl.js +4 -5
- package/bin/config/cfgvim.js +5 -3
- package/bin/docker/dkrall.js +5 -5
- package/bin/docker/dkratt.js +5 -5
- package/bin/docker/dkrbd.js +5 -5
- package/bin/docker/dkrrd.js +5 -5
- package/bin/docker/dkrrm.js +5 -5
- package/bin/git/__g-pick-branch.js +5 -7
- package/bin/git/__g-pick-commit.js +5 -7
- package/bin/git/gaa.js +5 -5
- package/bin/git/gb.js +5 -5
- package/bin/git/gbc.js +5 -5
- package/bin/git/gbcm.js +5 -5
- package/bin/git/gbd.js +5 -5
- package/bin/git/gcl.js +5 -5
- package/bin/git/gcm.js +5 -5
- package/bin/git/gcma.js +5 -5
- package/bin/git/gcmane.js +5 -5
- package/bin/git/gcmf.js +5 -5
- package/bin/git/gcmfc.js +5 -5
- package/bin/git/gcmfs.js +5 -5
- package/bin/git/gcmi.js +5 -5
- package/bin/git/gcmia.js +5 -5
- package/bin/git/gcmiane.js +5 -5
- package/bin/git/gcmif.js +5 -5
- package/bin/git/gcmifc.js +5 -5
- package/bin/git/gcmifs.js +5 -5
- package/bin/git/gco.js +5 -5
- package/bin/git/gcoghpr-cleanup.js +5 -5
- package/bin/git/gcoghpr.js +5 -7
- package/bin/git/gcom.js +5 -5
- package/bin/git/gcopr.js +5 -5
- package/bin/git/gcp.js +5 -5
- package/bin/git/gcpa.js +5 -5
- package/bin/git/gcpc.js +5 -5
- package/bin/git/gcpx.js +5 -5
- package/bin/git/gcpxl.js +5 -5
- package/bin/git/gd.js +5 -5
- package/bin/git/gd1.js +5 -5
- package/bin/git/gdefb.js +5 -5
- package/bin/git/gdh.js +5 -5
- package/bin/git/gdn.js +5 -5
- package/bin/git/gdn1.js +5 -5
- package/bin/git/gdnh.js +5 -5
- package/bin/git/gl.js +5 -5
- package/bin/git/gl1.js +5 -5
- package/bin/git/gl1g.js +5 -5
- package/bin/git/gmt.js +5 -5
- package/bin/git/gngprh.js +5 -5
- package/bin/git/gngprm.js +5 -5
- package/bin/git/gp.js +5 -5
- package/bin/git/gp1.js +5 -5
- package/bin/git/gpf.js +5 -5
- package/bin/git/gpr.js +5 -5
- package/bin/git/gpro.js +5 -5
- package/bin/git/gprom.js +5 -5
- package/bin/git/gpru.js +5 -5
- package/bin/git/gprum.js +5 -5
- package/bin/git/grb.js +5 -5
- package/bin/git/grba.js +5 -5
- package/bin/git/grbc.js +5 -5
- package/bin/git/grbi.js +5 -5
- package/bin/git/grbia.js +5 -5
- package/bin/git/grbin.js +5 -5
- package/bin/git/grbm.js +5 -5
- package/bin/git/grs.js +5 -5
- package/bin/git/grs1.js +5 -5
- package/bin/git/gs.js +5 -5
- package/bin/git/gsh.js +5 -5
- package/bin/git/gshn.js +5 -5
- package/bin/git/gst.js +5 -5
- package/bin/git/gstk.js +5 -5
- package/bin/git/gstl.js +5 -5
- package/bin/git/gstp.js +5 -5
- package/bin/git/gsync.js +5 -5
- package/bin/misc/alv.js +1 -2
- package/bin/misc/halp.js +2 -2
- package/bin/misc/ll.darwin.js +5 -5
- package/bin/misc/ll.js +5 -5
- package/bin/misc/lla.darwin.js +5 -5
- package/bin/misc/lla.js +5 -5
- package/bin/misc/osv.darwin.js +5 -5
- package/bin/misc/osv.js +5 -5
- package/bin/misc/osv.win32.js +5 -5
- package/bin/misc/salfup.js +5 -5
- package/bin/node/nad.js +5 -5
- package/bin/node/naga.js +5 -5
- package/bin/node/nap.js +5 -5
- package/bin/node/niin.js +5 -5
- package/bin/node/nls.js +5 -5
- package/bin/node/nls1.js +5 -5
- package/bin/node/nlsg.js +5 -5
- package/bin/node/nlsg1.js +5 -5
- package/bin/node/nr.js +5 -5
- package/bin/node/nrd.js +5 -5
- package/bin/node/nrin.js +5 -5
- package/bin/node/nrp.js +5 -5
- package/bin/node/nrx.js +5 -5
- package/bin/node/ns.js +5 -5
- package/bin/node/nsin.js +5 -5
- package/bin/node/nsx.js +5 -5
- package/bin/node/nt.js +5 -5
- package/bin/node/ntin.js +5 -5
- package/bin/node/ntx.js +5 -5
- package/bin/node/nua.js +5 -5
- package/bin/node/nud.js +5 -5
- package/bin/node/nup.js +5 -5
- package/bin/node/nv.js +5 -5
- package/bin/node/nvls.js +5 -5
- package/bin/node/nvls.win32.js +5 -5
- package/bin/node/nvlsa.js +5 -5
- package/bin/node/nvlsa.win32.js +5 -5
- package/bin/node/nvmup.js +5 -5
- package/bin/node/nvmup.win32.js +5 -5
- package/bin/node/nvu.js +5 -7
- package/bin/node/srv.js +5 -5
- package/bin/node/srvw.js +5 -5
- package/bin/node/yad.js +5 -5
- package/bin/node/yaga.js +5 -5
- package/bin/node/yap.js +5 -5
- package/bin/node/yiin.js +5 -5
- package/bin/node/yls.js +5 -5
- package/bin/node/yls1.js +5 -5
- package/bin/node/ylsg.js +5 -5
- package/bin/node/ylsg1.js +5 -5
- package/bin/node/yr.js +5 -5
- package/bin/node/yrd.js +5 -5
- package/bin/node/yrin.js +5 -5
- package/bin/node/yrp.js +5 -5
- package/bin/node/yrx.js +5 -5
- package/bin/node/ys.js +5 -5
- package/bin/node/ysin.js +5 -5
- package/bin/node/ysx.js +5 -5
- package/bin/node/yt.js +5 -5
- package/bin/node/ytin.js +5 -5
- package/bin/node/ytx.js +5 -5
- package/bin/node/yua.js +5 -5
- package/bin/node/yud.js +5 -5
- package/bin/node/yup.js +5 -5
- package/lib/alias-scripts/a-builds-dir.js +65 -45
- package/lib/alias-scripts/g-pick-branch.js +44 -25
- package/lib/alias-scripts/g-pick-commit.js +44 -25
- package/lib/alias-scripts/gcoghpr.js +182 -195
- package/lib/alias-scripts/nvu.js +57 -49
- package/lib/alias.js +4 -5
- package/lib/constants.js +68 -47
- package/lib/helper.js +96 -88
- package/lib/utils.js +113 -58
- package/package.json +8 -6
- package/scripts/build.js +11 -10
- package/scripts/platformize-bin.js +7 -7
- package/scripts/test-pkg.js +14 -12
package/lib/utils.js
CHANGED
|
@@ -1,45 +1,65 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
1
|
// Imports
|
|
4
|
-
|
|
2
|
+
import {existsSync, readFileSync, realpathSync} from 'node:fs';
|
|
3
|
+
import {createRequire} from 'node:module';
|
|
4
|
+
import {fileURLToPath, pathToFileURL} from 'node:url';
|
|
5
|
+
|
|
6
|
+
import isWsl from 'is-wsl';
|
|
7
|
+
|
|
5
8
|
|
|
6
9
|
// Constants
|
|
7
10
|
const LINE_LIMIT = 75;
|
|
8
11
|
const INDENT_PER_LEVEL = 2;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
const PLATFORM = isWsl ? 'wsl' : process.platform;
|
|
13
|
+
const internal = {
|
|
14
|
+
_fsExistsSync,
|
|
15
|
+
_fsRealpathSync,
|
|
16
|
+
_getPlatform,
|
|
17
|
+
_import,
|
|
18
|
+
_onError,
|
|
19
|
+
_wrapLine,
|
|
20
|
+
};
|
|
12
21
|
|
|
13
22
|
// Exports
|
|
14
|
-
|
|
15
|
-
capitalize
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
export {
|
|
24
|
+
capitalize,
|
|
25
|
+
getPlatform,
|
|
26
|
+
hasOwnProperty,
|
|
27
|
+
importWithEnv,
|
|
28
|
+
isMain,
|
|
29
|
+
loadJson,
|
|
30
|
+
onError,
|
|
31
|
+
padRight,
|
|
32
|
+
stripIndentation,
|
|
33
|
+
wrapLine,
|
|
34
|
+
|
|
35
|
+
// Exposed for testing purposes only.
|
|
36
|
+
internal as _testing,
|
|
24
37
|
};
|
|
25
38
|
|
|
26
|
-
//
|
|
27
|
-
function
|
|
28
|
-
return
|
|
39
|
+
// Helpers
|
|
40
|
+
function _fsExistsSync(path) {
|
|
41
|
+
return existsSync(path);
|
|
29
42
|
}
|
|
30
43
|
|
|
31
|
-
function
|
|
32
|
-
return
|
|
33
|
-
val => Promise.resolve(callback()).then(() => val),
|
|
34
|
-
err => Promise.resolve(callback()).then(() => Promise.reject(err)));
|
|
44
|
+
function _fsRealpathSync(path) {
|
|
45
|
+
return realpathSync(path);
|
|
35
46
|
}
|
|
36
47
|
|
|
37
48
|
function _getPlatform() {
|
|
38
|
-
return
|
|
49
|
+
return PLATFORM;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function _import(filePath) {
|
|
53
|
+
return import(filePath);
|
|
39
54
|
}
|
|
40
55
|
|
|
41
|
-
function _onError(err) {
|
|
42
|
-
|
|
56
|
+
async function _onError(err) {
|
|
57
|
+
// NOTE:
|
|
58
|
+
// Avoid eagerly loading `chalk` at the top of the file to allow for it to be imported (directly
|
|
59
|
+
// or transitively) with `importWithEnv()`. This is, for example, useful for being able to force
|
|
60
|
+
// the use of colors.
|
|
61
|
+
const {default: chalk} = await import('chalk');
|
|
62
|
+
|
|
43
63
|
const isExitCode = err && (typeof err === 'number');
|
|
44
64
|
const errorMsg = (err instanceof Error) ? err.stack : `${isExitCode ? 'Exit code' : 'Error'}: ${err}`;
|
|
45
65
|
|
|
@@ -47,41 +67,89 @@ function _onError(err) {
|
|
|
47
67
|
process.exit(isExitCode ? err : 1);
|
|
48
68
|
}
|
|
49
69
|
|
|
50
|
-
function
|
|
51
|
-
|
|
52
|
-
|
|
70
|
+
function _wrapLine(line, indent) {
|
|
71
|
+
if (line.length <= LINE_LIMIT) {
|
|
72
|
+
return line;
|
|
73
|
+
}
|
|
53
74
|
|
|
54
|
-
|
|
75
|
+
const extraIndent = ' '.repeat(INDENT_PER_LEVEL);
|
|
76
|
+
const sep = Date.now() + Math.random();
|
|
77
|
+
const re = new RegExp(/\s&&/.test(line) ? '(\\s)(&&)' : `(.{${LINE_LIMIT},}?\\s)()`, 'g');
|
|
78
|
+
|
|
79
|
+
let lines = line.replace(re, `$1${sep}$2`).split(sep).filter(l => l.trim());
|
|
80
|
+
if (lines.length > 1) {
|
|
81
|
+
lines = lines.map(l => wrapLine(l, `${indent}${extraIndent}`));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return lines.join(`\n${indent}${extraIndent}`);
|
|
55
85
|
}
|
|
56
86
|
|
|
57
|
-
function
|
|
58
|
-
return
|
|
87
|
+
function capitalize(str) {
|
|
88
|
+
return `${str[0].toUpperCase()}${str.slice(1)}`;
|
|
59
89
|
}
|
|
60
90
|
|
|
61
|
-
function
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
91
|
+
function getPlatform() {
|
|
92
|
+
return internal._getPlatform();
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function hasOwnProperty(obj, prop) {
|
|
96
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
async function importWithEnv(targetImportPath, sourceImportMetaUrl, tempEnvVars) {
|
|
100
|
+
const {env} = process;
|
|
68
101
|
|
|
69
102
|
const tempEnvVarNames = Object.keys(tempEnvVars);
|
|
70
103
|
const originalValues = tempEnvVarNames.
|
|
71
|
-
filter(name =>
|
|
104
|
+
filter(name => hasOwnProperty(env, name)).
|
|
72
105
|
reduce((aggr, name) => Object.assign(aggr, {[name]: env[name]}), {});
|
|
73
106
|
|
|
107
|
+
const req = createRequire(sourceImportMetaUrl);
|
|
108
|
+
const resolvedImportPath = req.resolve(targetImportPath);
|
|
109
|
+
const resolvedImportUrl = ((resolvedImportPath === targetImportPath) && !/[\\/]/.test(resolvedImportPath)) ?
|
|
110
|
+
// It's a built-in module: Do not convert to file URL.
|
|
111
|
+
resolvedImportPath :
|
|
112
|
+
// It's a relative path: Convert to file URL.
|
|
113
|
+
pathToFileURL(resolvedImportPath).href;
|
|
114
|
+
|
|
74
115
|
try {
|
|
75
116
|
Object.assign(env, tempEnvVars);
|
|
76
|
-
return
|
|
117
|
+
return await internal._import(resolvedImportUrl);
|
|
77
118
|
} finally {
|
|
78
|
-
tempEnvVarNames.forEach(name =>
|
|
119
|
+
tempEnvVarNames.forEach(name => hasOwnProperty(originalValues, name) ?
|
|
79
120
|
env[name] = originalValues[name] :
|
|
80
121
|
delete env[name]);
|
|
81
122
|
}
|
|
82
123
|
}
|
|
83
124
|
|
|
84
|
-
function
|
|
125
|
+
function isMain(fileUrl) {
|
|
126
|
+
const mainExt = ['', '.js'].find(ext => internal._fsExistsSync(`${process.argv[1]}${ext}`)) ?? '';
|
|
127
|
+
const mainPath = internal._fsRealpathSync(`${process.argv[1]}${mainExt}`);
|
|
128
|
+
const filePath = fileURLToPath(fileUrl);
|
|
129
|
+
|
|
130
|
+
return filePath === mainPath;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function loadJson(filePath) {
|
|
134
|
+
try {
|
|
135
|
+
return JSON.parse(readFileSync(filePath, 'utf8'));
|
|
136
|
+
} catch (err) {
|
|
137
|
+
throw new Error(`Failed to load and parse JSON file '${filePath}': ${err?.message || err}`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function onError(err) {
|
|
142
|
+
return internal._onError(err);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function padRight(str, len) {
|
|
146
|
+
const padLen = Math.max(0, len - str.length);
|
|
147
|
+
const pad = ' '.repeat(padLen);
|
|
148
|
+
|
|
149
|
+
return `${str}${pad}`;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function stripIndentation(str) {
|
|
85
153
|
const lines = str.replace(/^ *\n/, '').replace(/\n *$/, '').split('\n');
|
|
86
154
|
const minIndentation = Math.min(...lines.
|
|
87
155
|
filter(l => !/^ *$/.test(l)).
|
|
@@ -91,19 +159,6 @@ function _stripIndentation(str) {
|
|
|
91
159
|
return lines.map(l => l.replace(re, '')).join('\n');
|
|
92
160
|
}
|
|
93
161
|
|
|
94
|
-
function
|
|
95
|
-
|
|
96
|
-
return line;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const extraIndent = ' '.repeat(INDENT_PER_LEVEL);
|
|
100
|
-
const sep = Date.now() + Math.random();
|
|
101
|
-
const re = new RegExp(/\s&&/.test(line) ? '(\\s)(&&)' : `(.{${LINE_LIMIT},}?\\s)()`, 'g');
|
|
102
|
-
|
|
103
|
-
let lines = line.replace(re, `$1${sep}$2`).split(sep).filter(l => l.trim());
|
|
104
|
-
if (lines.length > 1) {
|
|
105
|
-
lines = lines.map(l => _wrapLine(l, `${indent}${extraIndent}`));
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return lines.join(`\n${indent}${extraIndent}`);
|
|
162
|
+
function wrapLine(line, indent = '') {
|
|
163
|
+
return internal._wrapLine(line, indent);
|
|
109
164
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gkalpak/aliases",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "My global aliases.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Utility"
|
|
@@ -171,6 +171,7 @@
|
|
|
171
171
|
"yud": "./bin/node/yud.js",
|
|
172
172
|
"yup": "./bin/node/yup.js"
|
|
173
173
|
},
|
|
174
|
+
"type": "module",
|
|
174
175
|
"license": "Unlicense",
|
|
175
176
|
"author": "gkalpak <kalpakas.g@gmail.com>",
|
|
176
177
|
"homepage": "https://github.com/gkalpak/aliases#readme",
|
|
@@ -188,17 +189,18 @@
|
|
|
188
189
|
},
|
|
189
190
|
"dependencies": {
|
|
190
191
|
"@gkalpak/cli-utils": "^0.1.10",
|
|
191
|
-
"chalk": "^
|
|
192
|
-
"inquirer": "^
|
|
192
|
+
"chalk": "^5.2.0",
|
|
193
|
+
"inquirer": "^9.1.5",
|
|
193
194
|
"is-wsl": "^2.2.0"
|
|
194
195
|
},
|
|
195
196
|
"devDependencies": {
|
|
196
|
-
"eslint": "^8.
|
|
197
|
+
"eslint": "^8.36.0",
|
|
197
198
|
"eslint-plugin-jasmine": "^4.1.3",
|
|
198
|
-
"
|
|
199
|
+
"eslint-plugin-ordered-imports": "^0.6.0",
|
|
200
|
+
"jasmine": "^4.6.0",
|
|
199
201
|
"npm-run-all": "^4.1.5",
|
|
200
202
|
"shelljs": "^0.8.5",
|
|
201
|
-
"strip-ansi": "^
|
|
203
|
+
"strip-ansi": "^7.0.1",
|
|
202
204
|
"watch": "^1.0.2"
|
|
203
205
|
}
|
|
204
206
|
}
|
package/scripts/build.js
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env/ node
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
2
|
// Imports
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
import {mkdirSync, writeFileSync} from 'node:fs';
|
|
4
|
+
import {join} from 'node:path';
|
|
5
|
+
|
|
6
|
+
import sh from 'shelljs';
|
|
7
|
+
|
|
8
|
+
import {ALIASES, BIN_DIR} from '../lib/constants.js';
|
|
9
|
+
|
|
10
|
+
sh.set('-e');
|
|
11
|
+
|
|
9
12
|
|
|
10
13
|
// Run
|
|
11
14
|
_main();
|
|
12
15
|
|
|
13
|
-
//
|
|
16
|
+
// Helpers
|
|
14
17
|
function _main() {
|
|
15
|
-
set('-e');
|
|
16
|
-
|
|
17
18
|
// Clean up `bin/`.
|
|
18
|
-
rm('-rf', BIN_DIR);
|
|
19
|
+
sh.rm('-rf', BIN_DIR);
|
|
19
20
|
mkdirSync(BIN_DIR);
|
|
20
21
|
|
|
21
22
|
// For each alias category...
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env/ node
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
2
|
// Imports
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
import {chmodSync, copyFileSync, existsSync, readdirSync, renameSync, statSync} from 'node:fs';
|
|
4
|
+
import {join} from 'node:path';
|
|
5
|
+
|
|
6
|
+
import {BIN_DIR} from '../lib/constants.js';
|
|
7
|
+
import {getPlatform} from '../lib/utils.js';
|
|
8
|
+
|
|
9
9
|
|
|
10
10
|
// Run
|
|
11
11
|
_main();
|
|
12
12
|
|
|
13
|
-
//
|
|
13
|
+
// Helpers
|
|
14
14
|
function _main() {
|
|
15
15
|
// Nothing to do if `bin/` does not exist (e.g. first local `npm install`).
|
|
16
16
|
if (!existsSync(BIN_DIR)) return;
|
package/scripts/test-pkg.js
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
2
|
// Imports
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
import {existsSync} from 'node:fs';
|
|
4
|
+
import {resolve as pathResolve} from 'node:path';
|
|
5
|
+
|
|
6
|
+
import chalk from 'chalk';
|
|
7
|
+
|
|
8
|
+
import {ALIASES, ROOT_DIR} from '../lib/constants.js';
|
|
9
|
+
import {loadPackageJson} from '../test/test-utils.js';
|
|
10
|
+
|
|
10
11
|
|
|
11
12
|
// Constants
|
|
12
|
-
const CHECK_MARK = green('\u2714');
|
|
13
|
-
const X_MARK = red('\u2716');
|
|
13
|
+
const CHECK_MARK = chalk.green('\u2714');
|
|
14
|
+
const X_MARK = chalk.red('\u2716');
|
|
15
|
+
const {bin, main, types, typings} = loadPackageJson();
|
|
14
16
|
|
|
15
17
|
// Run
|
|
16
18
|
_main();
|
|
17
19
|
|
|
18
|
-
//
|
|
20
|
+
// Helpers
|
|
19
21
|
function _main() {
|
|
20
22
|
checkBin(bin || {}, ROOT_DIR, ALIASES);
|
|
21
23
|
checkFile('main', main || '', ROOT_DIR);
|
|
@@ -43,7 +45,7 @@ function checkBin(bin, rootDir, aliases) {
|
|
|
43
45
|
function checkFile(propName, filePath, rootDir) {
|
|
44
46
|
if (!filePath) return;
|
|
45
47
|
|
|
46
|
-
const missingFile = !existsSync(
|
|
48
|
+
const missingFile = !existsSync(pathResolve(rootDir, filePath));
|
|
47
49
|
|
|
48
50
|
reportResults(
|
|
49
51
|
`The file mentioned in \`package.json > ${propName}\` exists.`,
|
|
@@ -68,7 +70,7 @@ function compareToAliases(bin, aliases) {
|
|
|
68
70
|
|
|
69
71
|
function compareToBinDir(bin, rootDir) {
|
|
70
72
|
const missingScripts = Object.keys(bin).
|
|
71
|
-
map(key =>
|
|
73
|
+
map(key => pathResolve(rootDir, bin[key])).
|
|
72
74
|
filter(path => !existsSync(path));
|
|
73
75
|
|
|
74
76
|
reportResults(
|