@gkalpak/aliases 0.12.2 → 0.12.4
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/bin/config/cfgbash.js +1 -1
- package/bin/config/cfgbash.wsl.js +1 -1
- package/bin/config/cfggit.js +1 -1
- package/bin/config/cfggit.win32.js +1 -1
- package/bin/config/cfggit.wsl.js +1 -1
- package/bin/config/cfggpg.js +1 -1
- package/bin/config/cfgssh.js +1 -1
- package/bin/config/cfgvim.js +1 -1
- package/bin/config/cfgwsl.wsl.js +2 -2
- package/bin/misc/alv.js +1 -1
- package/lib/alias-scripts/a-builds-dir.js +2 -1
- package/lib/alias-scripts/g-pick-branch.js +3 -2
- package/lib/alias-scripts/g-pick-commit.js +3 -2
- package/lib/utils.js +3 -17
- package/package.json +3 -3
package/bin/config/cfgbash.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {stripIndentation} from '../../lib/utils.js';
|
|
3
3
|
/* eslint-disable max-len */
|
|
4
4
|
console.log(stripIndentation(`
|
|
5
|
-
### [Generated by: @gkalpak/aliases v0.12.
|
|
5
|
+
### [Generated by: @gkalpak/aliases v0.12.4]
|
|
6
6
|
### Copy the following into '~/.bashrc':
|
|
7
7
|
|
|
8
8
|
# Set up prompt.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {stripIndentation} from '../../lib/utils.js';
|
|
3
3
|
/* eslint-disable max-len */
|
|
4
4
|
console.log(stripIndentation(`
|
|
5
|
-
### [Generated by: @gkalpak/aliases v0.12.
|
|
5
|
+
### [Generated by: @gkalpak/aliases v0.12.4]
|
|
6
6
|
### Copy the following into '~/.bashrc':
|
|
7
7
|
|
|
8
8
|
# Set up prompt.
|
package/bin/config/cfggit.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {stripIndentation} from '../../lib/utils.js';
|
|
3
3
|
console.log(stripIndentation(`
|
|
4
|
-
### [Generated by: @gkalpak/aliases v0.12.
|
|
4
|
+
### [Generated by: @gkalpak/aliases v0.12.4]
|
|
5
5
|
### Run the following commands:
|
|
6
6
|
|
|
7
7
|
git config --global commit.gpgSign true
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {stripIndentation} from '../../lib/utils.js';
|
|
3
3
|
console.log(stripIndentation(`
|
|
4
|
-
### [Generated by: @gkalpak/aliases v0.12.
|
|
4
|
+
### [Generated by: @gkalpak/aliases v0.12.4]
|
|
5
5
|
### Run the following commands:
|
|
6
6
|
|
|
7
7
|
git config --global commit.gpgSign true
|
package/bin/config/cfggit.wsl.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {stripIndentation} from '../../lib/utils.js';
|
|
3
3
|
console.log(stripIndentation(`
|
|
4
|
-
### [Generated by: @gkalpak/aliases v0.12.
|
|
4
|
+
### [Generated by: @gkalpak/aliases v0.12.4]
|
|
5
5
|
### Run the following commands:
|
|
6
6
|
|
|
7
7
|
git config --global commit.gpgSign true
|
package/bin/config/cfggpg.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {stripIndentation} from '../../lib/utils.js';
|
|
3
3
|
console.log(stripIndentation(`
|
|
4
|
-
### [Generated by: @gkalpak/aliases v0.12.
|
|
4
|
+
### [Generated by: @gkalpak/aliases v0.12.4]
|
|
5
5
|
### Copy the following into '~/.gnupg/gpg-agent.conf':
|
|
6
6
|
|
|
7
7
|
default-cache-ttl 86400
|
package/bin/config/cfgssh.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {stripIndentation} from '../../lib/utils.js';
|
|
3
3
|
console.log(stripIndentation(`
|
|
4
|
-
### [Generated by: @gkalpak/aliases v0.12.
|
|
4
|
+
### [Generated by: @gkalpak/aliases v0.12.4]
|
|
5
5
|
### Copy the following into '~/.ssh/config':
|
|
6
6
|
|
|
7
7
|
IdentityFile ~/.ssh/id-rsa-gkalpak.ppk
|
package/bin/config/cfgvim.js
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
import {readFileSync} from 'node:fs';
|
|
3
3
|
import {fileURLToPath} from 'node:url';
|
|
4
4
|
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
|
5
|
-
console.log('""" [Generated by: @gkalpak/aliases v0.12.
|
|
5
|
+
console.log('""" [Generated by: @gkalpak/aliases v0.12.4]');
|
|
6
6
|
console.log('""" Copy the following into \'~/.vimrc\':\n');
|
|
7
7
|
console.log(readFileSync(`${__dirname}/../../lib/assets/vimrc.txt`, 'utf8').trim() + '\n');
|
package/bin/config/cfgwsl.wsl.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {stripIndentation} from '../../lib/utils.js';
|
|
3
3
|
console.log(stripIndentation(`
|
|
4
|
-
### [Generated by: @gkalpak/aliases v0.12.
|
|
4
|
+
### [Generated by: @gkalpak/aliases v0.12.4]
|
|
5
5
|
### Copy the following into a root-owned, 600-mode '/etc/resolv.conf' file:
|
|
6
6
|
|
|
7
7
|
# Cloudflare
|
|
@@ -14,7 +14,7 @@ console.log(stripIndentation(`
|
|
|
14
14
|
|
|
15
15
|
-----
|
|
16
16
|
|
|
17
|
-
### [Generated by: @gkalpak/aliases v0.12.
|
|
17
|
+
### [Generated by: @gkalpak/aliases v0.12.4]
|
|
18
18
|
### Copy the following into a root-owned, 600-mode '/etc/wsl.conf' file:
|
|
19
19
|
|
|
20
20
|
[network]
|
package/bin/misc/alv.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
console.log('@gkalpak/aliases v0.12.
|
|
2
|
+
console.log('@gkalpak/aliases v0.12.4');
|
|
@@ -47,7 +47,8 @@ async function _aBuildsDir(config) {
|
|
|
47
47
|
return buildsDirPath;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
// Log on a new line to ensure nothing is already written on the line (e.g. escape sequences).
|
|
51
|
+
console.log(`\n${buildsDirPath}`);
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
function _fsStat(filePath) {
|
|
@@ -46,7 +46,8 @@ async function _gPickBranch(config) {
|
|
|
46
46
|
return branch;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
// Log on a new line to ensure nothing is already written on the line (e.g. escape sequences).
|
|
50
|
+
console.log(`\n${branch}`);
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
function gPickBranch(config) {
|
|
@@ -59,7 +60,7 @@ function main(_runtimeArgs, config) {
|
|
|
59
60
|
|
|
60
61
|
async function pickBranch(branchesStr) {
|
|
61
62
|
// Ensure colors are always used (even when running with `returnOutput: <number>`).
|
|
62
|
-
const {default: inquirer} = await importWithEnv('inquirer',
|
|
63
|
+
const {default: inquirer} = await importWithEnv(() => import('inquirer'), {FORCE_COLOR: '1'});
|
|
63
64
|
|
|
64
65
|
let currentBranchIdx = 0;
|
|
65
66
|
const branches = branchesStr.
|
|
@@ -46,7 +46,8 @@ async function _gPickCommit(config) {
|
|
|
46
46
|
return commit;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
// Log on a new line to ensure nothing is already written on the line (e.g. escape sequences).
|
|
50
|
+
console.log(`\n${commit}`);
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
function gPickCommit(config) {
|
|
@@ -59,7 +60,7 @@ function main(_runtimeArgs, config) {
|
|
|
59
60
|
|
|
60
61
|
async function pickCommit(commitsStr) {
|
|
61
62
|
// Ensure colors are always used (even when running with `returnOutput: <number>`).
|
|
62
|
-
const {default: inquirer} = await importWithEnv('inquirer',
|
|
63
|
+
const {default: inquirer} = await importWithEnv(() => import('inquirer'), {FORCE_COLOR: '1'});
|
|
63
64
|
|
|
64
65
|
const commits = commitsStr.
|
|
65
66
|
split('\n').
|
package/lib/utils.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Imports
|
|
2
2
|
import {existsSync, readFileSync, realpathSync} from 'node:fs';
|
|
3
|
-
import {
|
|
4
|
-
import {fileURLToPath, pathToFileURL} from 'node:url';
|
|
3
|
+
import {fileURLToPath} from 'node:url';
|
|
5
4
|
|
|
6
5
|
import isWsl from 'is-wsl';
|
|
7
6
|
|
|
@@ -14,7 +13,6 @@ const internal = {
|
|
|
14
13
|
_fsExistsSync,
|
|
15
14
|
_fsRealpathSync,
|
|
16
15
|
_getPlatform,
|
|
17
|
-
_import,
|
|
18
16
|
_onError,
|
|
19
17
|
_wrapLine,
|
|
20
18
|
};
|
|
@@ -49,10 +47,6 @@ function _getPlatform() {
|
|
|
49
47
|
return PLATFORM;
|
|
50
48
|
}
|
|
51
49
|
|
|
52
|
-
function _import(filePath) {
|
|
53
|
-
return import(filePath);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
50
|
async function _onError(err) {
|
|
57
51
|
// NOTE:
|
|
58
52
|
// Avoid eagerly loading `chalk` at the top of the file to allow for it to be imported (directly
|
|
@@ -96,7 +90,7 @@ function hasOwnProperty(obj, prop) {
|
|
|
96
90
|
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
97
91
|
}
|
|
98
92
|
|
|
99
|
-
async function importWithEnv(
|
|
93
|
+
async function importWithEnv(importFn, tempEnvVars) {
|
|
100
94
|
const {env} = process;
|
|
101
95
|
|
|
102
96
|
const tempEnvVarNames = Object.keys(tempEnvVars);
|
|
@@ -104,17 +98,9 @@ async function importWithEnv(targetImportPath, sourceImportMetaUrl, tempEnvVars)
|
|
|
104
98
|
filter(name => hasOwnProperty(env, name)).
|
|
105
99
|
reduce((aggr, name) => Object.assign(aggr, {[name]: env[name]}), {});
|
|
106
100
|
|
|
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
|
-
|
|
115
101
|
try {
|
|
116
102
|
Object.assign(env, tempEnvVars);
|
|
117
|
-
return await
|
|
103
|
+
return await importFn();
|
|
118
104
|
} finally {
|
|
119
105
|
tempEnvVarNames.forEach(name => hasOwnProperty(originalValues, name) ?
|
|
120
106
|
env[name] = originalValues[name] :
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gkalpak/aliases",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.4",
|
|
4
4
|
"description": "My global aliases.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Utility"
|
|
@@ -195,13 +195,13 @@
|
|
|
195
195
|
"dependencies": {
|
|
196
196
|
"@gkalpak/cli-utils": "^0.1.10",
|
|
197
197
|
"chalk": "^5.3.0",
|
|
198
|
-
"inquirer": "^9.
|
|
198
|
+
"inquirer": "^9.3.4",
|
|
199
199
|
"is-wsl": "^3.1.0"
|
|
200
200
|
},
|
|
201
201
|
"devDependencies": {
|
|
202
202
|
"eslint": "^8.57.0",
|
|
203
203
|
"eslint-plugin-import": "^2.29.1",
|
|
204
|
-
"eslint-plugin-jasmine": "^4.
|
|
204
|
+
"eslint-plugin-jasmine": "^4.2.0",
|
|
205
205
|
"jasmine": "^5.1.0",
|
|
206
206
|
"npm-run-all": "^4.1.5",
|
|
207
207
|
"shelljs": "^0.8.5",
|