@widget-js/cli 1.0.6 → 1.0.8
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/widget.js +9 -4
- package/lib/release/oss.js +2 -2
- package/lib/release/release.js +5 -5
- package/lib/release/update-zip.js +0 -1
- package/package.json +1 -1
package/bin/widget.js
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import {program} from 'commander';
|
|
2
|
-
|
|
3
|
-
import packageJson from '../package.json' assert {type: 'json'};
|
|
4
2
|
import createWidget from "../lib/createWidget.js";
|
|
5
3
|
import release from "../lib/release/release.js";
|
|
4
|
+
import fs from "fs";
|
|
5
|
+
import path from "path";
|
|
6
|
+
import { fileURLToPath } from 'url';
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = path.dirname(__filename);
|
|
9
|
+
|
|
10
|
+
const packageJsonPath = path.join(__dirname, '../package.json');
|
|
11
|
+
let cliPackage = JSON.parse(fs.readFileSync(packageJsonPath).toString());
|
|
6
12
|
|
|
7
13
|
program
|
|
8
|
-
.version(`@widget-js/cli ${
|
|
14
|
+
.version(`@widget-js/cli ${cliPackage.version}`)
|
|
9
15
|
.usage('<command> [options]')
|
|
10
16
|
program
|
|
11
17
|
.command('create')
|
|
@@ -22,7 +28,6 @@ program
|
|
|
22
28
|
|
|
23
29
|
//TODO init 初始化项目
|
|
24
30
|
//TODO publish 发布
|
|
25
|
-
//TODO delete 删除
|
|
26
31
|
program.parse(process.argv);
|
|
27
32
|
|
|
28
33
|
|
package/lib/release/oss.js
CHANGED
|
@@ -3,8 +3,8 @@ import {chalk} from "@vue/cli-shared-utils";
|
|
|
3
3
|
import fs from "fs";
|
|
4
4
|
|
|
5
5
|
let packageData = JSON.parse(fs.readFileSync("./package.json").toString());
|
|
6
|
-
export const AccessKeyID = packageData.oss
|
|
7
|
-
export const AccessKeySecret = packageData.oss
|
|
6
|
+
export const AccessKeyID = packageData.oss?.id ?? "default";
|
|
7
|
+
export const AccessKeySecret = packageData.oss?.secret ?? "default";
|
|
8
8
|
|
|
9
9
|
const headers = {
|
|
10
10
|
// 指定Object的存储类型。
|
package/lib/release/release.js
CHANGED
|
@@ -5,11 +5,6 @@ import promptChecker from "../promts/promptChecker.js";
|
|
|
5
5
|
import zipDirectory from "./update-zip.js";
|
|
6
6
|
import {copy, put} from "./oss.js";
|
|
7
7
|
|
|
8
|
-
const packageJSON = JSON.parse(fs.readFileSync('package.json', 'utf-8'))
|
|
9
|
-
const changelogJSON = JSON.parse(fs.readFileSync('changelog.json', 'utf-8'))
|
|
10
|
-
const version = packageJSON["version"]
|
|
11
|
-
const changelog = changelogJSON[version]
|
|
12
|
-
|
|
13
8
|
async function delay(time) {
|
|
14
9
|
return new Promise((resolve, reject) => {
|
|
15
10
|
setTimeout(() => {
|
|
@@ -19,6 +14,11 @@ async function delay(time) {
|
|
|
19
14
|
}
|
|
20
15
|
|
|
21
16
|
const release = async () => {
|
|
17
|
+
const packageJSON = JSON.parse(fs.readFileSync('package.json', 'utf-8'))
|
|
18
|
+
const changelogJSON = JSON.parse(fs.readFileSync('changelog.json', 'utf-8'))
|
|
19
|
+
const version = packageJSON["version"]
|
|
20
|
+
const changelog = changelogJSON[version]
|
|
21
|
+
|
|
22
22
|
let needUpdateElectron = await promptChecker({
|
|
23
23
|
type: "confirm",
|
|
24
24
|
name: 'electron',
|