rman 0.37.0 → 0.37.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.
package/bin/rman.mjs CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import { runCli } from '../esm/cli.js';
2
+ import { runCli } from '../cli.js';
3
3
 
4
4
  runCli().catch(() => 0);
package/cli.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import colors from 'ansi-colors';
2
+ import { getDirname } from 'cross-dirname';
2
3
  import fs from 'fs/promises';
3
4
  import logger from 'npmlog';
4
5
  import path from 'path';
@@ -14,7 +15,6 @@ import { RunCommand } from './commands/run-command.js';
14
15
  import { VersionCommand } from './commands/version-command.js';
15
16
  import { Command } from './core/command.js';
16
17
  import { Repository } from './core/repository.js';
17
- import { getDirname } from './utils/get-dirname.js';
18
18
  export async function runCli(options) {
19
19
  try {
20
20
  const s = path.resolve(getDirname(), '../package.json');
@@ -3,7 +3,6 @@ import fs from 'fs';
3
3
  import * as yaml from 'js-yaml';
4
4
  import path from 'path';
5
5
  import merge from 'putil-merge';
6
- import { getPackageJson } from '../utils/get-dirname.js';
7
6
  import { Package } from './package.js';
8
7
  export class Repository extends Package {
9
8
  dirname;
@@ -118,7 +117,11 @@ export class Repository extends Package {
118
117
  }
119
118
  static _readConfig(dirname) {
120
119
  const result = {};
121
- const pkgJson = getPackageJson(dirname);
120
+ const f = path.resolve(dirname, 'package.json');
121
+ let pkgJson;
122
+ if (fs.existsSync(f)) {
123
+ pkgJson = JSON.parse(fs.readFileSync(f, 'utf-8'));
124
+ }
122
125
  if (pkgJson && typeof pkgJson.rman === 'object')
123
126
  merge(result, pkgJson.rman, { deep: true });
124
127
  let filename = path.resolve(dirname, '.rman.yml');
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "rman",
3
3
  "description": "Repository manager",
4
- "version": "0.37.0",
4
+ "version": "0.37.2",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
7
7
  "dependencies": {
8
8
  "@netlify/parse-npm-script": "^0.1.2",
9
9
  "ansi-colors": "^4.1.3",
10
10
  "easy-table": "^1.2.0",
11
+ "cross-dirname": "^0.1.0",
11
12
  "envinfo": "^7.21.0",
12
13
  "fast-glob": "^3.3.3",
13
14
  "ini": "^6.0.0",
@@ -1,2 +0,0 @@
1
- export declare function getDirname(): string;
2
- export declare function getPackageJson(dirname: string): any;
@@ -1,26 +0,0 @@
1
- import fs from 'fs';
2
- import path from 'path';
3
- export function getDirname() {
4
- const pst = Error.prepareStackTrace;
5
- Error.prepareStackTrace = function (_, stack) {
6
- Error.prepareStackTrace = pst;
7
- return stack;
8
- };
9
- const e = new Error();
10
- if (!e.stack)
11
- throw Error('Can not parse stack');
12
- const stack = e.stack.slice(1);
13
- while (stack.length) {
14
- const frame = stack.shift();
15
- const filename = frame && frame.getFileName();
16
- if (filename)
17
- return path.dirname(filename).replace('file://', '');
18
- }
19
- throw Error('Can not parse stack');
20
- }
21
- export function getPackageJson(dirname) {
22
- const f = path.resolve(dirname, 'package.json');
23
- if (!fs.existsSync(f))
24
- return;
25
- return JSON.parse(fs.readFileSync(f, 'utf-8'));
26
- }