Skip to content

Commit

Permalink
fix: 修复 h-uni命令行读取package.json路径错误,首页文档错误更改
Browse files Browse the repository at this point in the history
修复 h-uni命令行读取package.json路径错误,首页文档错误更改
  • Loading branch information
hewx815 committed Jun 10, 2023
1 parent 27ede40 commit 0d5786c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ aside: false

## 介绍

homepage: https://h-uni.hewxing.com
homepage: https://h-uni.hewxing.cn

github: https://github.com/hewx815/h-uni

Expand Down
8 changes: 7 additions & 1 deletion bin/argvs/version.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
/* eslint-disable no-console */

import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';

export default {
description: '查看当前版本',
fn: () => {
const packageJson = JSON.parse(fs.readFileSync('../../package.json', 'utf-8'));
const CurrentPath = path.dirname(fileURLToPath(import.meta.url));

const packageJsonPath = path.resolve(CurrentPath, '../../package.json');

const packageJson = JSON.parse(fs.readFileSync(packageJsonPath));

const nowVersion = packageJson.version;

Expand Down
7 changes: 6 additions & 1 deletion bin/h-uni.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// eslint-disable-next-line node/no-unpublished-bin
import columnify from 'columnify';
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
// eslint-disable-next-line import/extensions
import * as argvs from './argvs/index.js';

Expand All @@ -16,8 +18,11 @@ const help = () => {
}));

const content = columnify(columns, { minWidth: 30 });
const CurrentPath = path.dirname(fileURLToPath(import.meta.url));

const packageJson = JSON.parse(fs.readFileSync('../../package.json', 'utf-8'));
const packageJsonPath = path.resolve(CurrentPath, '../package.json');

const packageJson = JSON.parse(fs.readFileSync(packageJsonPath));

const homeUrl = packageJson.homepage;

Expand Down

0 comments on commit 0d5786c

Please sign in to comment.