ripencli 0.1.3 → 0.1.5
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/README.md +3 -3
- package/dist/cli.js +19 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
## Install
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
|
-
npm install -g ripencli
|
|
20
|
+
npm install -g ripencli@latest
|
|
21
21
|
# or
|
|
22
|
-
pnpm add -g ripencli
|
|
22
|
+
pnpm add -g ripencli@latest
|
|
23
23
|
# or
|
|
24
|
-
yarn global add ripencli
|
|
24
|
+
yarn global add ripencli@latest
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
## Usage
|
package/dist/cli.js
CHANGED
|
@@ -17,6 +17,16 @@ function detectPackageManager(cwd) {
|
|
|
17
17
|
if (existsSync(join(cwd, "package-lock.json"))) return "npm";
|
|
18
18
|
return "npm";
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Detect which package manager installed ripen globally
|
|
22
|
+
* by checking the path of the running script.
|
|
23
|
+
*/
|
|
24
|
+
function detectGlobalInstallManager() {
|
|
25
|
+
const scriptPath = (process.argv[1] ?? "").replace(/\\/g, "/").toLowerCase();
|
|
26
|
+
if (scriptPath.includes("/pnpm/") || scriptPath.includes("/pnpm-global/")) return "pnpm";
|
|
27
|
+
if (scriptPath.includes("/yarn/")) return "yarn";
|
|
28
|
+
return "npm";
|
|
29
|
+
}
|
|
20
30
|
function hasPackageJson(cwd) {
|
|
21
31
|
return existsSync(join(cwd, "package.json"));
|
|
22
32
|
}
|
|
@@ -1708,7 +1718,7 @@ function SelfUpdatePrompt({ currentVersion, latestVersion, updating, error, onUp
|
|
|
1708
1718
|
}
|
|
1709
1719
|
//#endregion
|
|
1710
1720
|
//#region src/ui/App.tsx
|
|
1711
|
-
function App({ project, global, version }) {
|
|
1721
|
+
function App({ project, global, version, installManager }) {
|
|
1712
1722
|
const { exit } = useApp();
|
|
1713
1723
|
const [screen, setScreen] = useState("self-update-check");
|
|
1714
1724
|
const [latestVersion, setLatestVersion] = useState(null);
|
|
@@ -1805,8 +1815,12 @@ function App({ project, global, version }) {
|
|
|
1805
1815
|
const handleSelfUpdate = async () => {
|
|
1806
1816
|
setSelfUpdating(true);
|
|
1807
1817
|
try {
|
|
1808
|
-
await execa("
|
|
1809
|
-
"
|
|
1818
|
+
await execa(installManager, installManager === "yarn" ? [
|
|
1819
|
+
"global",
|
|
1820
|
+
"add",
|
|
1821
|
+
`ripencli@${latestVersion}`
|
|
1822
|
+
] : [
|
|
1823
|
+
"add",
|
|
1810
1824
|
"--global",
|
|
1811
1825
|
`ripencli@${latestVersion}`
|
|
1812
1826
|
]);
|
|
@@ -2083,7 +2097,8 @@ if (!isGlobal && !hasPackageJson(cwd)) {
|
|
|
2083
2097
|
const { waitUntilExit } = render(/* @__PURE__ */ jsx(App, {
|
|
2084
2098
|
project: getProjectInfo(cwd),
|
|
2085
2099
|
global: isGlobal,
|
|
2086
|
-
version: VERSION
|
|
2100
|
+
version: VERSION,
|
|
2101
|
+
installManager: detectGlobalInstallManager()
|
|
2087
2102
|
}));
|
|
2088
2103
|
await waitUntilExit();
|
|
2089
2104
|
//#endregion
|