@model-go/cli 0.1.1 → 0.1.2-rc.1
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/checksums.txt +6 -6
- package/package.json +1 -1
- package/scripts/install-wizard.js +12 -15
package/checksums.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
915ed381929af9346da75a8cd05cc2e07e2dffad87a2611273e62950888d3a13 modelgo-cli-0.1.2-rc.1-darwin-amd64.tar.gz
|
|
2
|
+
db43edac818eba5d1275c47e7a8cf6bce87d46565a54fc9db276bce92b861051 modelgo-cli-0.1.2-rc.1-darwin-arm64.tar.gz
|
|
3
|
+
fbc7e92c959f5d62ced3940481afbd444655f91129acbb7bc6ff5f8d9a200729 modelgo-cli-0.1.2-rc.1-linux-amd64.tar.gz
|
|
4
|
+
d9fb3ccf896bb4b493b3af2a095d9406c54809d01b97734929135ae6347c07ec modelgo-cli-0.1.2-rc.1-linux-arm64.tar.gz
|
|
5
|
+
0cc9d8681d4be1718641ae1dfb609c4e967aa741150cff9a5b598c7a962931e2 modelgo-cli-0.1.2-rc.1-windows-amd64.zip
|
|
6
|
+
608930e7904701a794f3350ca594fbc992b35eaee619c25e6c082172c05c69ac modelgo-cli-0.1.2-rc.1-windows-arm64.zip
|
package/package.json
CHANGED
|
@@ -7,6 +7,11 @@ const p = require("@clack/prompts");
|
|
|
7
7
|
const { semverLessThan } = require("./install.js");
|
|
8
8
|
|
|
9
9
|
const PKG = "@model-go/cli";
|
|
10
|
+
// PKG_VERSION is the version of the wizard CURRENTLY EXECUTING. The wizard
|
|
11
|
+
// pins step1's `npm install -g` to this exact version so that
|
|
12
|
+
// `npx @model-go/cli@rc install` installs the rc version globally,
|
|
13
|
+
// not whatever the @latest dist-tag happens to resolve to.
|
|
14
|
+
const PKG_VERSION = require("../package.json").version;
|
|
10
15
|
const SKILLS_REPO = "modelgo/modelgo-cli";
|
|
11
16
|
const isWindows = process.platform === "win32";
|
|
12
17
|
|
|
@@ -78,16 +83,6 @@ function fmt(template, ...values) {
|
|
|
78
83
|
return template.replace(/%s/g, () => values[i++] ?? "");
|
|
79
84
|
}
|
|
80
85
|
|
|
81
|
-
function getLatestVersion() {
|
|
82
|
-
try {
|
|
83
|
-
const out = runSilent("npm", ["view", PKG, "version"], { timeout: 15000 });
|
|
84
|
-
const ver = out.toString().trim();
|
|
85
|
-
return /^\d+\.\d+\.\d+/.test(ver) ? ver : null;
|
|
86
|
-
} catch (_) {
|
|
87
|
-
return null;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
86
|
function getGloballyInstalledVersion() {
|
|
92
87
|
try {
|
|
93
88
|
const out = runSilent("npm", ["list", "-g", PKG], { timeout: 15000 });
|
|
@@ -162,8 +157,7 @@ function reportFail(isInteractive, spinner, message, err) {
|
|
|
162
157
|
|
|
163
158
|
async function stepInstallGlobally(msg, isInteractive) {
|
|
164
159
|
const installedVer = getGloballyInstalledVersion();
|
|
165
|
-
const
|
|
166
|
-
const needsUpgrade = installedVer && latestVer && semverLessThan(installedVer, latestVer);
|
|
160
|
+
const needsUpgrade = installedVer && semverLessThan(installedVer, PKG_VERSION);
|
|
167
161
|
|
|
168
162
|
if (installedVer && !needsUpgrade) {
|
|
169
163
|
const skipMsg = fmt(msg.step1Skip, installedVer);
|
|
@@ -173,13 +167,16 @@ async function stepInstallGlobally(msg, isInteractive) {
|
|
|
173
167
|
}
|
|
174
168
|
|
|
175
169
|
const startMsg = needsUpgrade
|
|
176
|
-
? fmt(msg.step1Upgrade, PKG, installedVer,
|
|
170
|
+
? fmt(msg.step1Upgrade, PKG, installedVer, PKG_VERSION)
|
|
177
171
|
: fmt(msg.step1, PKG);
|
|
178
|
-
const doneMsg = needsUpgrade ? fmt(msg.step1Upgraded,
|
|
172
|
+
const doneMsg = needsUpgrade ? fmt(msg.step1Upgraded, PKG_VERSION) : msg.step1Done;
|
|
179
173
|
|
|
180
174
|
const s = reportStart(isInteractive, startMsg);
|
|
181
175
|
try {
|
|
182
|
-
|
|
176
|
+
// Pin to PKG_VERSION (the wizard's own version) so that
|
|
177
|
+
// `npx @model-go/cli@rc install` installs the rc version globally,
|
|
178
|
+
// not whatever the @latest dist-tag currently resolves to.
|
|
179
|
+
await runSilentAsync("npm", ["install", "-g", `${PKG}@${PKG_VERSION}`], { timeout: 120000 });
|
|
183
180
|
reportStop(isInteractive, s, doneMsg);
|
|
184
181
|
} catch (err) {
|
|
185
182
|
reportFail(isInteractive, s, fmt(msg.step1Fail, PKG), err);
|