@mirta/cli 0.4.1 → 0.4.3

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/dist/deploy.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import chalk from 'chalk';
2
2
  import { isString, isNumber } from '@mirta/basics';
3
- import { D as DEFAULT_SSH_USERNAME, K as KNOWN_SSH_PORT, e as expandHomeDir, a as resolveSubpath, i as isExistsAsync, r as resolveConfigAsync } from './resolve.mjs';
3
+ import { D as DEFAULT_SSH_USERNAME, K as KNOWN_SSH_PORT, e as expandHomeDir, r as resolveConfigAsync } from './resolve.mjs';
4
4
  import { loadEnv as loadEnv$1 } from '@mirta/env-loader';
5
- import { l as logger, t, r as runCommandAsync, S as STDIO_INTERACTIVE, a as assertNoParseErrors, e as STDIO_CAPTURE_ERRORS } from './index.mjs';
5
+ import { l as logger, t, r as runCommandAsync, S as STDIO_INTERACTIVE, a as assertNoParseErrors, e as STDIO_CAPTURE_ERRORS, f as STDIO_CAPTURE_OUTPUT } from './index.mjs';
6
6
  import { resolveWorkspaceContextAsync } from '@mirta/workspace';
7
7
  import 'node:fs/promises';
8
8
  import 'node:os';
@@ -304,15 +304,6 @@ const DEFAULT_SSH_KEY_TTL = '15m';
304
304
  **/
305
305
  async function runRsyncAsync(options) {
306
306
  const { connection, mapping, toGroup, cwd, isDryRun, } = options;
307
- const from = resolveSubpath(cwd, mapping.from);
308
- if (!await isExistsAsync(from)) {
309
- logger.step(t('deploy.sourceNotExists', {
310
- source: from,
311
- }));
312
- // Файлы могут отсутствовать, это допустимо.
313
- return;
314
- }
315
- const to = `${connection.username}@${connection.hostname}:${mapping.to}/`;
316
307
  const args = [];
317
308
  const sshParts = [];
318
309
  if (connection.port && connection.port !== KNOWN_SSH_PORT)
@@ -327,7 +318,7 @@ async function runRsyncAsync(options) {
327
318
  // -O: не обновлять время на директориях
328
319
  args.push('-rtzgO');
329
320
  if (isDryRun)
330
- args.unshift('--dry-run', '--itemize-changes');
321
+ args.push('--dry-run', '--itemize-changes');
331
322
  if (mapping.cleanup)
332
323
  args.push('--delete');
333
324
  mapping.exclude?.forEach((pattern) => {
@@ -338,7 +329,8 @@ async function runRsyncAsync(options) {
338
329
  });
339
330
  if (toGroup)
340
331
  args.push('--groupmap', `*:${toGroup}`);
341
- args.push(from, to);
332
+ const to = `${connection.username}@${connection.hostname}:${mapping.to}`;
333
+ args.push(mapping.from, to);
342
334
  logger.step(t('deploy.transmitting', {
343
335
  from: mapping.from,
344
336
  to: mapping.to,
@@ -487,7 +479,7 @@ async function hasEntryAsync(fingerprint, context) {
487
479
  env: {
488
480
  SSH_AUTH_SOCK,
489
481
  },
490
- stdio: STDIO_CAPTURE_ERRORS,
482
+ stdio: STDIO_CAPTURE_OUTPUT,
491
483
  doneCodes: [0, 1], // 0 = есть ключи, 1 = нет ключей
492
484
  });
493
485
  if (response.code === 1)
@@ -554,7 +546,7 @@ async function hasTokenAsync(path, context) {
554
546
  async function addTokenAsync(path, context) {
555
547
  const args = ['-q'];
556
548
  if (context.ttl)
557
- args.push('-t', context.ttl.toString());
549
+ args.push('-t', context.ttl);
558
550
  args.push('-s', path);
559
551
  await context.runAsync('ssh-add', args, {
560
552
  env: {
package/dist/index.mjs CHANGED
@@ -100,7 +100,7 @@ const levelPriority = [
100
100
  * @since 0.4.0
101
101
  *
102
102
  **/
103
- let targetLevel = 0;
103
+ let targetLevel = 1;
104
104
  /**
105
105
  * Проверяет, должно ли сообщение быть залогировано, исходя из текущего уровня.
106
106
  *
@@ -738,6 +738,9 @@ const commonOptions = {
738
738
  type: 'boolean',
739
739
  short: 'h',
740
740
  },
741
+ debug: {
742
+ type: 'boolean',
743
+ },
741
744
  };
742
745
  async function run() {
743
746
  const args = createStagedArgs(process.argv.slice(2));
@@ -754,6 +757,8 @@ async function run() {
754
757
  console.log(getHelpMessage());
755
758
  return;
756
759
  }
760
+ if (argv.debug)
761
+ logger.setLevel('debug');
757
762
  const module = await resolveRunnerAsync(positionals[0]);
758
763
  await module.runAsync(runnerArgs);
759
764
  }
@@ -782,4 +787,4 @@ run().catch((e) => {
782
787
  process.exit(1);
783
788
  });
784
789
 
785
- export { STDIO_INTERACTIVE as S, assertNoParseErrors as a, assertIsSyncedWithRemoteAsync as b, assertWorkflowResultAsync as c, checkIsInWorkTreeAsync as d, STDIO_CAPTURE_ERRORS as e, getRepositoryDetails as g, logger as l, prompts as p, runCommandAsync as r, t };
790
+ export { STDIO_INTERACTIVE as S, assertNoParseErrors as a, assertIsSyncedWithRemoteAsync as b, assertWorkflowResultAsync as c, checkIsInWorkTreeAsync as d, STDIO_CAPTURE_ERRORS as e, STDIO_CAPTURE_OUTPUT as f, getRepositoryDetails as g, logger as l, prompts as p, runCommandAsync as r, t };
package/dist/resolve.mjs CHANGED
@@ -402,13 +402,13 @@ var defaultConfig = defineConfig({
402
402
  mappings: {
403
403
  'wb-rules-es5': [
404
404
  {
405
- from: 'dist/es5/wb-rules-modules',
406
- to: '/mnt/data/etc/wb-rules-modules',
405
+ from: 'dist/es5/wb-rules-modules/',
406
+ to: '/mnt/data/etc/wb-rules-modules/',
407
407
  cleanup: true,
408
408
  },
409
409
  {
410
- from: 'dist/es5/wb-rules',
411
- to: '/mnt/data/etc/wb-rules',
410
+ from: 'dist/es5/wb-rules/',
411
+ to: '/mnt/data/etc/wb-rules/',
412
412
  cleanup: true,
413
413
  protect: ['alarms.conf'],
414
414
  },
@@ -454,4 +454,4 @@ async function resolveConfigAsync(rootDir, path) {
454
454
  };
455
455
  }
456
456
 
457
- export { DEFAULT_SSH_USERNAME as D, KNOWN_SSH_PORT as K, resolveSubpath as a, expandHomeDir as e, isExistsAsync as i, resolveConfigAsync as r };
457
+ export { DEFAULT_SSH_USERNAME as D, KNOWN_SSH_PORT as K, expandHomeDir as e, resolveConfigAsync as r };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mirta/cli",
3
3
  "description": "🛠️ Mirta Framework - the CLI",
4
- "version": "0.4.1",
4
+ "version": "0.4.3",
5
5
  "license": "Unlicense",
6
6
  "keywords": [
7
7
  "cli",
@@ -48,12 +48,12 @@
48
48
  "prompts": "^2.4.2",
49
49
  "semver": "^7.7.3",
50
50
  "jsonc-parser": "^3.3.1",
51
- "@mirta/i18n": "0.4.1",
52
- "@mirta/basics": "0.4.1",
53
- "@mirta/env-loader": "0.4.1",
54
- "@mirta/staged-args": "0.4.1",
55
- "@mirta/package": "0.4.1",
56
- "@mirta/workspace": "0.4.1"
51
+ "@mirta/env-loader": "0.4.3",
52
+ "@mirta/basics": "0.4.3",
53
+ "@mirta/i18n": "0.4.3",
54
+ "@mirta/staged-args": "0.4.3",
55
+ "@mirta/package": "0.4.3",
56
+ "@mirta/workspace": "0.4.3"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@types/semver": "^7.7.1"