mushroom-cli 1.2.0-alpha.12 → 1.2.0-alpha.14

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.
@@ -10,10 +10,10 @@ function fetchFromGit() {
10
10
  '--single-branch',
11
11
  ]);
12
12
  git.stdout.on('data', (data) => {
13
- common.logInfo('GIT:', data);
13
+ common.logInfo('GIT:', data?.toString());
14
14
  });
15
15
  git.stderr.on('data', (data) => {
16
- common.logError('GIT:', data);
16
+ common.logError('GIT:', data?.toString());
17
17
  });
18
18
  git.on('close', (code) => {
19
19
  if (code) {
package/dist/mr.js CHANGED
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env node
2
+ import fs from 'fs';
3
+ import path from 'path';
4
+ import { fileURLToPath } from 'url';
2
5
  import * as common from './common.js';
3
6
  import init from './init.js';
4
7
  import config from './config.js';
@@ -6,11 +9,23 @@ import gen from './gen.js';
6
9
  import merge from './merge.js';
7
10
  import update from './update.js';
8
11
  import help from './help.js';
9
- import pkg from '../package.json' assert { type: 'json' };
10
12
  import checkUpdate from './check-update.js';
11
- const versionGroup = pkg.version.match(/([^-]+)(-(\w+).*)?/);
13
+ const __filename = fileURLToPath(import.meta.url);
14
+ const __dirname = path.dirname(__filename);
15
+ function getPackageVersion() {
16
+ try {
17
+ const content = fs.readFileSync(path.join(__dirname, '../package.json')).toString();
18
+ const pkg = JSON.parse(content);
19
+ return pkg.version;
20
+ }
21
+ catch {
22
+ return '<!unable to get package version>';
23
+ }
24
+ }
25
+ const packageVersion = getPackageVersion();
26
+ const versionGroup = packageVersion.match(/([^-]+)(-(\w+).*)?/);
12
27
  const currentDistTag = versionGroup?.[3] ? versionGroup[3] : 'latest';
13
- common.logInfo('Mushroom CLI version', pkg.version);
28
+ common.logInfo('Mushroom CLI version', packageVersion);
14
29
  async function run(args) {
15
30
  let debugMode = false;
16
31
  if (args.indexOf('--debug') !== -1) {
@@ -62,7 +77,9 @@ async function run(args) {
62
77
  if (checkUpdateTask !== null)
63
78
  try {
64
79
  const data = await checkUpdateTask;
65
- if (data['dist-tags'] && data['dist-tags'][currentDistTag] && data['dist-tags'][currentDistTag] !== pkg.version) {
80
+ if (data['dist-tags'] &&
81
+ data['dist-tags'][currentDistTag] &&
82
+ data['dist-tags'][currentDistTag] !== packageVersion) {
66
83
  common.logWarning(`YOUR mushroom-cli VERSION IS NOT LATEST (dist-tags: ${currentDistTag}). PLEASE RUN: npm i mushroom-cli@${data['dist-tags'][currentDistTag]} OR yarn add mushroom-cli@^${data['dist-tags'][currentDistTag]}`);
67
84
  }
68
85
  }
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "mushroom-cli",
3
- "version": "1.2.0-alpha.12",
3
+ "version": "1.2.0-alpha.14",
4
4
  "description": "Mushroom CLI",
5
5
  "main": "dist/mr.js",
6
6
  "type": "module",
7
7
  "scripts": {
8
- "build": "tsc",
8
+ "build": "tsc && copyfiles -u 2 ./src/docs/* ./dist/docs/",
9
9
  "format": "prettier --write \"**/*.{ts,js,json,md}\"",
10
10
  "lint": "eslint ./src",
11
- "release": "npm publish --access public --tag alpha",
11
+ "release": "npm run build && npm publish --access public --tag alpha",
12
12
  "prepare": "husky install"
13
13
  },
14
14
  "files": [
@@ -24,13 +24,12 @@
24
24
  },
25
25
  "author": "suco2007",
26
26
  "license": "ISC",
27
- "dependencies-comments": "node-fetch: 2.x; open: 8.x; minify: 7.x",
28
27
  "dependencies": {
29
- "jsdom": "^24.1.1",
28
+ "jsdom": "^25.0.0",
30
29
  "json5": "^2.2.3",
31
- "minify": "7.2.2",
32
- "node-fetch": "^2.7.0",
33
- "open": "^8.4.2",
30
+ "minify": "^11.4.0",
31
+ "node-fetch": "^3.3.2",
32
+ "open": "^10.1.0",
34
33
  "readline-sync": "^1.4.10",
35
34
  "targz": "^1.0.1"
36
35
  },
@@ -42,6 +41,7 @@
42
41
  "@types/node-fetch": "^2.6.11",
43
42
  "@types/readline-sync": "^1.4.8",
44
43
  "@types/targz": "^1.0.4",
44
+ "copyfiles": "^2.4.1",
45
45
  "eslint": "^9.9.1",
46
46
  "husky": "^8.0.3",
47
47
  "prettier": "^3.3.3",