@moneko/core 3.50.0 → 3.50.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.
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { spawn, type SpawnOptions } from 'node:child_process';
|
|
2
2
|
import { dirname, join } from 'node:path';
|
|
3
3
|
import { execPath, platform, versions } from 'node:process';
|
|
4
|
-
import { ink, loadFile, println, saveFile } from '@moneko/utils';
|
|
4
|
+
import { ink, loadFile, loadFileSync, println, saveFile } from '@moneko/utils';
|
|
5
5
|
import log from './log.mjs';
|
|
6
|
-
import require from './require.mjs';
|
|
7
6
|
declare const packageJsonPath: string;
|
|
8
|
-
|
|
7
|
+
declare const packageJson: typeof import('package.json');
|
|
9
8
|
declare const shim: string;
|
|
10
9
|
declare const spawnOptions: SpawnOptions;
|
|
11
10
|
declare function getManagerVersion(): string;
|
package/lib/commom/corepack.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{spawn as e}from"node:child_process";import{dirname as
|
|
1
|
+
import{spawn as e}from"node:child_process";import{dirname as r,join as n}from"node:path";import{execPath as o,platform as a,versions as p}from"node:process";import{ink as c,loadFile as t,loadFileSync as i,println as m,saveFile as s}from"@moneko/utils";import l from"./log.mjs";let g=`${process.cwd()}/package.json`,d=JSON.parse(i(g)),f=c("corepack","magenta"),k={stdio:"ignore",shell:!0};export function corepack(i){new Promise(p=>{if(d.packageManager){let c=e("corepack",["-v"],k);c.on("error",e=>{l(e),p(!1)}),c.on("exit",e=>{0!==e&&p(!1);let c=d.packageManager.split("@")[0],i="win32"===a?`${c}.cmd`:c;t(n(r(o),i)).then(e=>{p(e.includes("corepack"))}).catch(e=>{l(e),p(!1)})})}else p(!1)}).then(r=>{if(i){if(d.packageManager||(d.packageManager=function(){let e=Number(p.node.split(".")[0]);return e<16?"pnpm@7.33.7":e<18?"pnpm@8.15.9":"pnpm@10.14.0"}(),s(g,JSON.stringify(d,null,2))),r)return;e("corepack",["enable"],k);return}r?m(`${f} is ${c("enabled","green")} ${c(`(${d.name})`,"245")}`):m(`${f} is ${c("disabled","yellow")} ${c(`(${d.name})`,"245")}`)}).catch(e=>{l(e)})}
|