@gkalpak/aliases 0.12.0 → 0.12.2

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.
@@ -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.0]
5
+ ### [Generated by: @gkalpak/aliases v0.12.2]
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.0]
5
+ ### [Generated by: @gkalpak/aliases v0.12.2]
6
6
  ### Copy the following into '~/.bashrc':
7
7
 
8
8
  # Set up prompt.
@@ -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.0]
4
+ ### [Generated by: @gkalpak/aliases v0.12.2]
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.0]
4
+ ### [Generated by: @gkalpak/aliases v0.12.2]
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.0]
4
+ ### [Generated by: @gkalpak/aliases v0.12.2]
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.0]
4
+ ### [Generated by: @gkalpak/aliases v0.12.2]
5
5
  ### Copy the following into '~/.gnupg/gpg-agent.conf':
6
6
 
7
7
  default-cache-ttl 86400
@@ -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.0]
4
+ ### [Generated by: @gkalpak/aliases v0.12.2]
5
5
  ### Copy the following into '~/.ssh/config':
6
6
 
7
7
  IdentityFile ~/.ssh/id-rsa-gkalpak.ppk
@@ -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.0]');
5
+ console.log('""" [Generated by: @gkalpak/aliases v0.12.2]');
6
6
  console.log('""" Copy the following into \'~/.vimrc\':\n');
7
7
  console.log(readFileSync(`${__dirname}/../../lib/assets/vimrc.txt`, 'utf8').trim() + '\n');
@@ -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.0]
4
+ ### [Generated by: @gkalpak/aliases v0.12.2]
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.0]
17
+ ### [Generated by: @gkalpak/aliases v0.12.2]
18
18
  ### Copy the following into a root-owned, 600-mode '/etc/wsl.conf' file:
19
19
 
20
20
  [network]
package/bin/git/gbcd.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {commandUtils} from '@gkalpak/cli-utils';
3
3
  import {isMain, onError} from '../../lib/utils.js';
4
4
  // eslint-disable-next-line max-len
5
- const cmd = 'git checkout ${0:::node --print "const rem = \'origin\'; const exec = cmd => child_process.execSync(cmd, {encoding: \'utf8\', stdio: \'pipe\'}); try { exec(\'git rev-parse --abbrev-ref \' + rem + \'/HEAD\').slice(rem.length + 1); } catch { exec([\'main\', \'master\'].map(b => \'(git show-ref --heads --quiet \' + b + \' && echo \' + b + \')\').join(\' || \') + \' || echo unknown-branch\'); }"} -b $1 && git config branch.$1.remote origin && git config branch.$1.merge refs/heads/$1';
5
+ const cmd = 'git checkout ${0:::gdefb --gkcu-returnOutput} -b $1 && git config branch.$1.remote origin && git config branch.$1.merge refs/heads/$1';
6
6
  export default cmd;
7
7
  if (isMain(import.meta.url)) {
8
8
  const {args, config} = commandUtils.preprocessArgs(process.argv.slice(2));
package/bin/git/gcod.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {commandUtils} from '@gkalpak/cli-utils';
3
3
  import {isMain, onError} from '../../lib/utils.js';
4
4
  // eslint-disable-next-line max-len
5
- const cmd = 'git checkout ${0:::node --print "const rem = \'origin\'; const exec = cmd => child_process.execSync(cmd, {encoding: \'utf8\', stdio: \'pipe\'}); try { exec(\'git rev-parse --abbrev-ref \' + rem + \'/HEAD\').slice(rem.length + 1); } catch { exec([\'main\', \'master\'].map(b => \'(git show-ref --heads --quiet \' + b + \' && echo \' + b + \')\').join(\' || \') + \' || echo unknown-branch\'); }"} $*';
5
+ const cmd = 'git checkout ${0:::gdefb --gkcu-returnOutput} $*';
6
6
  export default cmd;
7
7
  if (isMain(import.meta.url)) {
8
8
  const {args, config} = commandUtils.preprocessArgs(process.argv.slice(2));
package/bin/git/gdefb.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {commandUtils} from '@gkalpak/cli-utils';
3
3
  import {isMain, onError} from '../../lib/utils.js';
4
4
  // eslint-disable-next-line max-len
5
- const cmd = 'node --print "const rem = \'origin\'; const exec = cmd => child_process.execSync(cmd, {encoding: \'utf8\', stdio: \'pipe\'}); try { exec(\'git rev-parse --abbrev-ref \' + rem + \'/HEAD\').slice(rem.length + 1); } catch { exec([\'main\', \'master\'].map(b => \'(git show-ref --heads --quiet \' + b + \' && echo \' + b + \')\').join(\' || \') + \' || echo unknown-branch\'); }"';
5
+ const cmd = 'node --eval "const rem = \'origin\'; const exec = cmd => child_process.execSync(cmd, {encoding: \'utf8\', stdio: \'pipe\'}); const print = msg => process.stdout.write(msg); try { print(exec(\'git rev-parse --abbrev-ref \' + rem + \'/HEAD\').trim().slice(rem.length + 1)); } catch { print(exec([\'main\', \'master\'].map(b => \'(git show-ref --heads --quiet \' + b + \' && echo \' + b + \')\').join(\' || \') + \' || echo unknown-branch\').trim()); }"';
6
6
  export default cmd;
7
7
  if (isMain(import.meta.url)) {
8
8
  const {args, config} = commandUtils.preprocessArgs(process.argv.slice(2));
package/bin/git/gprod.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {commandUtils} from '@gkalpak/cli-utils';
3
3
  import {isMain, onError} from '../../lib/utils.js';
4
4
  // eslint-disable-next-line max-len
5
- const cmd = 'git pull --rebase origin ${0:::node --print "const rem = \'origin\'; const exec = cmd => child_process.execSync(cmd, {encoding: \'utf8\', stdio: \'pipe\'}); try { exec(\'git rev-parse --abbrev-ref \' + rem + \'/HEAD\').slice(rem.length + 1); } catch { exec([\'main\', \'master\'].map(b => \'(git show-ref --heads --quiet \' + b + \' && echo \' + b + \')\').join(\' || \') + \' || echo unknown-branch\'); }"} $*';
5
+ const cmd = 'git pull --rebase origin ${0:::gdefb --gkcu-returnOutput} $*';
6
6
  export default cmd;
7
7
  if (isMain(import.meta.url)) {
8
8
  const {args, config} = commandUtils.preprocessArgs(process.argv.slice(2));
package/bin/git/gprud.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {commandUtils} from '@gkalpak/cli-utils';
3
3
  import {isMain, onError} from '../../lib/utils.js';
4
4
  // eslint-disable-next-line max-len
5
- const cmd = 'git pull --rebase upstream ${0:::node --print "const rem = \'origin\'; const exec = cmd => child_process.execSync(cmd, {encoding: \'utf8\', stdio: \'pipe\'}); try { exec(\'git rev-parse --abbrev-ref \' + rem + \'/HEAD\').slice(rem.length + 1); } catch { exec([\'main\', \'master\'].map(b => \'(git show-ref --heads --quiet \' + b + \' && echo \' + b + \')\').join(\' || \') + \' || echo unknown-branch\'); }"} $*';
5
+ const cmd = 'git pull --rebase upstream ${0:::gdefb --gkcu-returnOutput} $*';
6
6
  export default cmd;
7
7
  if (isMain(import.meta.url)) {
8
8
  const {args, config} = commandUtils.preprocessArgs(process.argv.slice(2));
package/bin/git/grbd.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {commandUtils} from '@gkalpak/cli-utils';
3
3
  import {isMain, onError} from '../../lib/utils.js';
4
4
  // eslint-disable-next-line max-len
5
- const cmd = 'git rebase --ignore-date ${0:::node --print "const rem = \'origin\'; const exec = cmd => child_process.execSync(cmd, {encoding: \'utf8\', stdio: \'pipe\'}); try { exec(\'git rev-parse --abbrev-ref \' + rem + \'/HEAD\').slice(rem.length + 1); } catch { exec([\'main\', \'master\'].map(b => \'(git show-ref --heads --quiet \' + b + \' && echo \' + b + \')\').join(\' || \') + \' || echo unknown-branch\'); }"} $*';
5
+ const cmd = 'git rebase --ignore-date ${0:::gdefb --gkcu-returnOutput} $*';
6
6
  export default cmd;
7
7
  if (isMain(import.meta.url)) {
8
8
  const {args, config} = commandUtils.preprocessArgs(process.argv.slice(2));
package/bin/git/gsync.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {commandUtils} from '@gkalpak/cli-utils';
3
3
  import {isMain, onError} from '../../lib/utils.js';
4
4
  // eslint-disable-next-line max-len
5
- const cmd = 'git checkout ${1:::node --print "const rem = \'origin\'; const exec = cmd => child_process.execSync(cmd, {encoding: \'utf8\', stdio: \'pipe\'}); try { exec(\'git rev-parse --abbrev-ref \' + rem + \'/HEAD\').slice(rem.length + 1); } catch { exec([\'main\', \'master\'].map(b => \'(git show-ref --heads --quiet \' + b + \' && echo \' + b + \')\').join(\' || \') + \' || echo unknown-branch\'); }"} && git pull upstream ${1:::node --print "const rem = \'origin\'; const exec = cmd => child_process.execSync(cmd, {encoding: \'utf8\', stdio: \'pipe\'}); try { exec(\'git rev-parse --abbrev-ref \' + rem + \'/HEAD\').slice(rem.length + 1); } catch { exec([\'main\', \'master\'].map(b => \'(git show-ref --heads --quiet \' + b + \' && echo \' + b + \')\').join(\' || \') + \' || echo unknown-branch\'); }"} && git push origin ${1:::node --print "const rem = \'origin\'; const exec = cmd => child_process.execSync(cmd, {encoding: \'utf8\', stdio: \'pipe\'}); try { exec(\'git rev-parse --abbrev-ref \' + rem + \'/HEAD\').slice(rem.length + 1); } catch { exec([\'main\', \'master\'].map(b => \'(git show-ref --heads --quiet \' + b + \' && echo \' + b + \')\').join(\' || \') + \' || echo unknown-branch\'); }"}';
5
+ const cmd = 'git checkout ${1:::gdefb --gkcu-returnOutput} && git pull upstream ${1:::gdefb --gkcu-returnOutput} && git push origin ${1:::gdefb --gkcu-returnOutput}';
6
6
  export default cmd;
7
7
  if (isMain(import.meta.url)) {
8
8
  const {args, config} = commandUtils.preprocessArgs(process.argv.slice(2));
package/bin/misc/alv.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- console.log('@gkalpak/aliases v0.12.0');
2
+ console.log('@gkalpak/aliases v0.12.2');
package/lib/constants.js CHANGED
@@ -18,20 +18,6 @@ const PR_REMOTE_ALIAS_PREFIX = 'gcoghpr';
18
18
  const PR_LOCAL_BRANCH_PREFIX = 'gcoghpr';
19
19
 
20
20
  const SOURCE_NVM_CMD = '. $NVM_DIR/nvm.sh';
21
- const GIT_GET_DEFAULT_BRANCH_CMD =
22
- stripIndentation(`
23
- node --print "
24
- const rem = 'origin';
25
- const exec = cmd => child_process.execSync(cmd, {encoding: 'utf8', stdio: 'pipe'});
26
- try {
27
- exec('git rev-parse --abbrev-ref ' + rem + '/HEAD').slice(rem.length + 1);
28
- } catch {
29
- exec(['main', 'master'].
30
- map(b => '(git show-ref --heads --quiet ' + b + ' && echo ' + b + ')').
31
- join(' || ') +
32
- ' || echo unknown-branch');
33
- }"
34
- `).replace(/([;{+])(\n)/g, '$1 $2').replace(/\n\s*/g, '');
35
21
  const GLOBAL_NPM_PACKAGES = [
36
22
  '@angular/cli',
37
23
  '@gkalpak/aliases',
@@ -50,7 +36,7 @@ const GLOBAL_NPM_PACKAGES = [
50
36
 
51
37
  const DESC_REPLACEMENTS = {
52
38
  [AliasUnknown.DESCRIPTION]: '???',
53
- [`::${GIT_GET_DEFAULT_BRANCH_CMD}`]: '<default-branch>',
39
+ '::gdefb': '<default-branch>',
54
40
  '::__a-builds-dir': '(<.../angular/aio/aio-builds-setup>)',
55
41
  '::__g-pick-branch --gkcu-returnOutput=1': '(interactively pick a branch)',
56
42
  '::__g-pick-commit --gkcu-returnOutput=1': '(interactively pick a commit)',
@@ -253,7 +239,21 @@ const ALIASES = {
253
239
  git: {
254
240
  // STATUS
255
241
  gs: new AliasDefault('git status $*'),
256
- gdefb: new AliasDefault(GIT_GET_DEFAULT_BRANCH_CMD),
242
+ gdefb: new AliasDefault(
243
+ stripIndentation(`
244
+ node --eval "
245
+ const rem = 'origin';
246
+ const exec = cmd => child_process.execSync(cmd, {encoding: 'utf8', stdio: 'pipe'});
247
+ const print = msg => process.stdout.write(msg);
248
+ try {
249
+ print(exec('git rev-parse --abbrev-ref ' + rem + '/HEAD').trim().slice(rem.length + 1));
250
+ } catch {
251
+ print(exec(['main', 'master'].
252
+ map(b => '(git show-ref --heads --quiet ' + b + ' && echo ' + b + ')').
253
+ join(' || ') +
254
+ ' || echo unknown-branch').trim());
255
+ }"
256
+ `).replace(/([;{+])(\n)/g, '$1 $2').replace(/\n\s*/g, '')),
257
257
  gl: new AliasDefault('git log --decorate $* || true'),
258
258
  gl1: new AliasDefault('git log --decorate --oneline $* || true'),
259
259
  gl1g: new AliasDefault('git log --decorate --oneline | grep $*'),
@@ -275,7 +275,7 @@ const ALIASES = {
275
275
 
276
276
  // CHECKOUT
277
277
  gco: new AliasDefault('git checkout ${*:::__g-pick-branch --gkcu-returnOutput=1}'),
278
- gcod: new AliasDefault(`git checkout \${0:::${GIT_GET_DEFAULT_BRANCH_CMD}} $*`),
278
+ gcod: new AliasDefault('git checkout ${0:::gdefb --gkcu-returnOutput} $*'),
279
279
  gcopr: new AliasDefault('git fetch upstream pull/$1/head && git checkout FETCH_HEAD'),
280
280
  gcoghpr: SCRIPT_BACKED_ALIAS('gcoghpr', 'Check out a GitHub pull request as a local branch.'),
281
281
  'gcoghpr-cleanup': new AliasDefault(
@@ -311,29 +311,29 @@ const ALIASES = {
311
311
  // BRANCH
312
312
  gb: new AliasDefault('git branch $*'),
313
313
  gbc: new AliasDefault(GIT_CREATE_BRANCH_CMD('${2:HEAD}')),
314
- gbcd: new AliasDefault(GIT_CREATE_BRANCH_CMD(`\${0:::${GIT_GET_DEFAULT_BRANCH_CMD}}`)),
314
+ gbcd: new AliasDefault(GIT_CREATE_BRANCH_CMD('${0:::gdefb --gkcu-returnOutput}')),
315
315
  gbco: new AliasDefault(`git fetch origin $1 && ${GIT_CREATE_BRANCH_CMD('origin/$1')}`),
316
316
  gbd: new AliasDefault('git branch --delete --force ${*:::__g-pick-branch --gkcu-returnOutput=1}'),
317
317
 
318
318
  // PULL(-REBASE)
319
319
  gpr: new AliasDefault('git pull --rebase $*'),
320
320
  gpro: new AliasDefault('git pull --rebase origin ${*:::git rev-parse --abbrev-ref HEAD}'),
321
- gprod: new AliasDefault(`git pull --rebase origin \${0:::${GIT_GET_DEFAULT_BRANCH_CMD}} $*`),
321
+ gprod: new AliasDefault('git pull --rebase origin ${0:::gdefb --gkcu-returnOutput} $*'),
322
322
  gpru: new AliasDefault('git pull --rebase upstream ${*:::git rev-parse --abbrev-ref HEAD}'),
323
- gprud: new AliasDefault(`git pull --rebase upstream \${0:::${GIT_GET_DEFAULT_BRANCH_CMD}} $*`),
323
+ gprud: new AliasDefault('git pull --rebase upstream ${0:::gdefb --gkcu-returnOutput} $*'),
324
324
 
325
325
  // SYNC DEFAULT BRANCH
326
326
  gsync: new AliasDefault(
327
- `git checkout \${1:::${GIT_GET_DEFAULT_BRANCH_CMD}} && ` +
328
- `git pull upstream \${1:::${GIT_GET_DEFAULT_BRANCH_CMD}} && ` +
329
- `git push origin \${1:::${GIT_GET_DEFAULT_BRANCH_CMD}}`),
327
+ 'git checkout ${1:::gdefb --gkcu-returnOutput} && ' +
328
+ 'git pull upstream ${1:::gdefb --gkcu-returnOutput} && ' +
329
+ 'git push origin ${1:::gdefb --gkcu-returnOutput}'),
330
330
 
331
331
 
332
332
  // REBASE
333
333
  grb: new AliasDefault('git rebase ${*:::__g-pick-branch --gkcu-returnOutput=1}'),
334
334
  grba: new AliasDefault('git rebase --abort'),
335
335
  grbc: new AliasDefault('git rebase --continue'),
336
- grbd: new AliasDefault(`git rebase --ignore-date \${0:::${GIT_GET_DEFAULT_BRANCH_CMD}} $*`),
336
+ grbd: new AliasDefault('git rebase --ignore-date ${0:::gdefb --gkcu-returnOutput} $*'),
337
337
  grbi: new AliasDefault('git rebase --interactive HEAD~$1'),
338
338
  grbia: new AliasDefault('git rebase --autosquash --interactive HEAD~$1'),
339
339
  grbin: new AliasDefault('git rebase --no-autosquash --interactive HEAD~$1'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gkalpak/aliases",
3
- "version": "0.12.0",
3
+ "version": "0.12.2",
4
4
  "description": "My global aliases.",
5
5
  "keywords": [
6
6
  "Utility"