Initial boiler plate project
This commit is contained in:
49
node_modules/next/dist/esm/lib/helpers/get-cache-directory.js
generated
vendored
Normal file
49
node_modules/next/dist/esm/lib/helpers/get-cache-directory.js
generated
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
import os from "os";
|
||||
import path from "path";
|
||||
import fs from "fs";
|
||||
// get platform specific cache directory adapted from playwright's handling
|
||||
// https://github.com/microsoft/playwright/blob/7d924470d397975a74a19184c136b3573a974e13/packages/playwright-core/src/utils/registry.ts#L141
|
||||
export function getCacheDirectory(fileDirectory, envPath) {
|
||||
let result;
|
||||
if (envPath) {
|
||||
result = envPath;
|
||||
} else {
|
||||
let systemCacheDirectory;
|
||||
if (process.platform === "linux") {
|
||||
systemCacheDirectory = process.env.XDG_CACHE_HOME || path.join(os.homedir(), ".cache");
|
||||
} else if (process.platform === "darwin") {
|
||||
systemCacheDirectory = path.join(os.homedir(), "Library", "Caches");
|
||||
} else if (process.platform === "win32") {
|
||||
systemCacheDirectory = process.env.LOCALAPPDATA || path.join(os.homedir(), "AppData", "Local");
|
||||
} else {
|
||||
/// Attempt to use generic tmp location for un-handled platform
|
||||
if (!systemCacheDirectory) {
|
||||
for (const dir of [
|
||||
path.join(os.homedir(), ".cache"),
|
||||
path.join(os.tmpdir())
|
||||
]){
|
||||
if (fs.existsSync(dir)) {
|
||||
systemCacheDirectory = dir;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!systemCacheDirectory) {
|
||||
console.error(new Error("Unsupported platform: " + process.platform));
|
||||
process.exit(0);
|
||||
}
|
||||
}
|
||||
result = path.join(systemCacheDirectory, fileDirectory);
|
||||
}
|
||||
if (!path.isAbsolute(result)) {
|
||||
// It is important to resolve to the absolute path:
|
||||
// - for unzipping to work correctly;
|
||||
// - so that registry directory matches between installation and execution.
|
||||
// INIT_CWD points to the root of `npm/yarn install` and is probably what
|
||||
// the user meant when typing the relative path.
|
||||
result = path.resolve(process.env["INIT_CWD"] || process.cwd(), result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=get-cache-directory.js.map
|
||||
1
node_modules/next/dist/esm/lib/helpers/get-cache-directory.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/lib/helpers/get-cache-directory.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/lib/helpers/get-cache-directory.ts"],"names":["os","path","fs","getCacheDirectory","fileDirectory","envPath","result","systemCacheDirectory","process","platform","env","XDG_CACHE_HOME","join","homedir","LOCALAPPDATA","dir","tmpdir","existsSync","console","error","Error","exit","isAbsolute","resolve","cwd"],"mappings":"AAAA,OAAOA,QAAQ,KAAI;AACnB,OAAOC,UAAU,OAAM;AACvB,OAAOC,QAAQ,KAAI;AAEnB,2EAA2E;AAC3E,4IAA4I;AAC5I,OAAO,SAASC,kBAAkBC,aAAqB,EAAEC,OAAgB;IACvE,IAAIC;IAEJ,IAAID,SAAS;QACXC,SAASD;IACX,OAAO;QACL,IAAIE;QACJ,IAAIC,QAAQC,QAAQ,KAAK,SAAS;YAChCF,uBACEC,QAAQE,GAAG,CAACC,cAAc,IAAIV,KAAKW,IAAI,CAACZ,GAAGa,OAAO,IAAI;QAC1D,OAAO,IAAIL,QAAQC,QAAQ,KAAK,UAAU;YACxCF,uBAAuBN,KAAKW,IAAI,CAACZ,GAAGa,OAAO,IAAI,WAAW;QAC5D,OAAO,IAAIL,QAAQC,QAAQ,KAAK,SAAS;YACvCF,uBACEC,QAAQE,GAAG,CAACI,YAAY,IAAIb,KAAKW,IAAI,CAACZ,GAAGa,OAAO,IAAI,WAAW;QACnE,OAAO;YACL,+DAA+D;YAC/D,IAAI,CAACN,sBAAsB;gBACzB,KAAK,MAAMQ,OAAO;oBAChBd,KAAKW,IAAI,CAACZ,GAAGa,OAAO,IAAI;oBACxBZ,KAAKW,IAAI,CAACZ,GAAGgB,MAAM;iBACpB,CAAE;oBACD,IAAId,GAAGe,UAAU,CAACF,MAAM;wBACtBR,uBAAuBQ;wBACvB;oBACF;gBACF;YACF;YAEA,IAAI,CAACR,sBAAsB;gBACzBW,QAAQC,KAAK,CAAC,IAAIC,MAAM,2BAA2BZ,QAAQC,QAAQ;gBACnED,QAAQa,IAAI,CAAC;YACf;QACF;QACAf,SAASL,KAAKW,IAAI,CAACL,sBAAsBH;IAC3C;IAEA,IAAI,CAACH,KAAKqB,UAAU,CAAChB,SAAS;QAC5B,mDAAmD;QACnD,uCAAuC;QACvC,6EAA6E;QAC7E,yEAAyE;QACzE,gDAAgD;QAChDA,SAASL,KAAKsB,OAAO,CAACf,QAAQE,GAAG,CAAC,WAAW,IAAIF,QAAQgB,GAAG,IAAIlB;IAClE;IACA,OAAOA;AACT"}
|
||||
19
node_modules/next/dist/esm/lib/helpers/get-npx-command.js
generated
vendored
Normal file
19
node_modules/next/dist/esm/lib/helpers/get-npx-command.js
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
import { execSync } from "child_process";
|
||||
import { getPkgManager } from "./get-pkg-manager";
|
||||
export function getNpxCommand(baseDir) {
|
||||
const pkgManager = getPkgManager(baseDir);
|
||||
let command = "npx";
|
||||
if (pkgManager === "pnpm") {
|
||||
command = "pnpm dlx";
|
||||
} else if (pkgManager === "yarn") {
|
||||
try {
|
||||
execSync("yarn dlx --help", {
|
||||
stdio: "ignore"
|
||||
});
|
||||
command = "yarn dlx";
|
||||
} catch {}
|
||||
}
|
||||
return command;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=get-npx-command.js.map
|
||||
1
node_modules/next/dist/esm/lib/helpers/get-npx-command.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/lib/helpers/get-npx-command.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/lib/helpers/get-npx-command.ts"],"names":["execSync","getPkgManager","getNpxCommand","baseDir","pkgManager","command","stdio"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,gBAAe;AACxC,SAASC,aAAa,QAAQ,oBAAmB;AAEjD,OAAO,SAASC,cAAcC,OAAe;IAC3C,MAAMC,aAAaH,cAAcE;IACjC,IAAIE,UAAU;IACd,IAAID,eAAe,QAAQ;QACzBC,UAAU;IACZ,OAAO,IAAID,eAAe,QAAQ;QAChC,IAAI;YACFJ,SAAS,mBAAmB;gBAAEM,OAAO;YAAS;YAC9CD,UAAU;QACZ,EAAE,OAAM,CAAC;IACX;IAEA,OAAOA;AACT"}
|
||||
35
node_modules/next/dist/esm/lib/helpers/get-online.js
generated
vendored
Normal file
35
node_modules/next/dist/esm/lib/helpers/get-online.js
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
import { execSync } from "child_process";
|
||||
import dns from "dns/promises";
|
||||
function getProxy() {
|
||||
if (process.env.https_proxy) {
|
||||
return process.env.https_proxy;
|
||||
}
|
||||
try {
|
||||
const httpsProxy = execSync("npm config get https-proxy", {
|
||||
encoding: "utf8"
|
||||
}).trim();
|
||||
return httpsProxy !== "null" ? httpsProxy : undefined;
|
||||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
export async function getOnline() {
|
||||
try {
|
||||
await dns.lookup("registry.yarnpkg.com");
|
||||
return true;
|
||||
} catch {
|
||||
const proxy = getProxy();
|
||||
if (!proxy) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
const { hostname } = new URL(proxy);
|
||||
await dns.lookup(hostname);
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=get-online.js.map
|
||||
1
node_modules/next/dist/esm/lib/helpers/get-online.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/lib/helpers/get-online.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/lib/helpers/get-online.ts"],"names":["execSync","dns","getProxy","process","env","https_proxy","httpsProxy","encoding","trim","undefined","e","getOnline","lookup","proxy","hostname","URL"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,gBAAe;AACxC,OAAOC,SAAS,eAAc;AAE9B,SAASC;IACP,IAAIC,QAAQC,GAAG,CAACC,WAAW,EAAE;QAC3B,OAAOF,QAAQC,GAAG,CAACC,WAAW;IAChC;IAEA,IAAI;QACF,MAAMC,aAAaN,SAAS,8BAA8B;YACxDO,UAAU;QACZ,GAAGC,IAAI;QACP,OAAOF,eAAe,SAASA,aAAaG;IAC9C,EAAE,OAAOC,GAAG;QACV;IACF;AACF;AAEA,OAAO,eAAeC;IACpB,IAAI;QACF,MAAMV,IAAIW,MAAM,CAAC;QACjB,OAAO;IACT,EAAE,OAAM;QACN,MAAMC,QAAQX;QACd,IAAI,CAACW,OAAO;YACV,OAAO;QACT;QAEA,IAAI;YACF,MAAM,EAAEC,QAAQ,EAAE,GAAG,IAAIC,IAAIF;YAC7B,MAAMZ,IAAIW,MAAM,CAACE;YACjB,OAAO;QACT,EAAE,OAAM;YACN,OAAO;QACT;IACF;AACF"}
|
||||
48
node_modules/next/dist/esm/lib/helpers/get-pkg-manager.js
generated
vendored
Normal file
48
node_modules/next/dist/esm/lib/helpers/get-pkg-manager.js
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import { execSync } from "child_process";
|
||||
export function getPkgManager(baseDir) {
|
||||
try {
|
||||
for (const { lockFile, packageManager } of [
|
||||
{
|
||||
lockFile: "yarn.lock",
|
||||
packageManager: "yarn"
|
||||
},
|
||||
{
|
||||
lockFile: "pnpm-lock.yaml",
|
||||
packageManager: "pnpm"
|
||||
},
|
||||
{
|
||||
lockFile: "package-lock.json",
|
||||
packageManager: "npm"
|
||||
}
|
||||
]){
|
||||
if (fs.existsSync(path.join(baseDir, lockFile))) {
|
||||
return packageManager;
|
||||
}
|
||||
}
|
||||
const userAgent = process.env.npm_config_user_agent;
|
||||
if (userAgent) {
|
||||
if (userAgent.startsWith("yarn")) {
|
||||
return "yarn";
|
||||
} else if (userAgent.startsWith("pnpm")) {
|
||||
return "pnpm";
|
||||
}
|
||||
}
|
||||
try {
|
||||
execSync("yarn --version", {
|
||||
stdio: "ignore"
|
||||
});
|
||||
return "yarn";
|
||||
} catch {
|
||||
execSync("pnpm --version", {
|
||||
stdio: "ignore"
|
||||
});
|
||||
return "pnpm";
|
||||
}
|
||||
} catch {
|
||||
return "npm";
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=get-pkg-manager.js.map
|
||||
1
node_modules/next/dist/esm/lib/helpers/get-pkg-manager.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/lib/helpers/get-pkg-manager.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/lib/helpers/get-pkg-manager.ts"],"names":["fs","path","execSync","getPkgManager","baseDir","lockFile","packageManager","existsSync","join","userAgent","process","env","npm_config_user_agent","startsWith","stdio"],"mappings":"AAAA,OAAOA,QAAQ,KAAI;AACnB,OAAOC,UAAU,OAAM;AACvB,SAASC,QAAQ,QAAQ,gBAAe;AAIxC,OAAO,SAASC,cAAcC,OAAe;IAC3C,IAAI;QACF,KAAK,MAAM,EAAEC,QAAQ,EAAEC,cAAc,EAAE,IAAI;YACzC;gBAAED,UAAU;gBAAaC,gBAAgB;YAAO;YAChD;gBAAED,UAAU;gBAAkBC,gBAAgB;YAAO;YACrD;gBAAED,UAAU;gBAAqBC,gBAAgB;YAAM;SACxD,CAAE;YACD,IAAIN,GAAGO,UAAU,CAACN,KAAKO,IAAI,CAACJ,SAASC,YAAY;gBAC/C,OAAOC;YACT;QACF;QACA,MAAMG,YAAYC,QAAQC,GAAG,CAACC,qBAAqB;QACnD,IAAIH,WAAW;YACb,IAAIA,UAAUI,UAAU,CAAC,SAAS;gBAChC,OAAO;YACT,OAAO,IAAIJ,UAAUI,UAAU,CAAC,SAAS;gBACvC,OAAO;YACT;QACF;QACA,IAAI;YACFX,SAAS,kBAAkB;gBAAEY,OAAO;YAAS;YAC7C,OAAO;QACT,EAAE,OAAM;YACNZ,SAAS,kBAAkB;gBAAEY,OAAO;YAAS;YAC7C,OAAO;QACT;IACF,EAAE,OAAM;QACN,OAAO;IACT;AACF"}
|
||||
26
node_modules/next/dist/esm/lib/helpers/get-registry.js
generated
vendored
Normal file
26
node_modules/next/dist/esm/lib/helpers/get-registry.js
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
import { execSync } from "child_process";
|
||||
import { getPkgManager } from "./get-pkg-manager";
|
||||
import { getNodeOptionsWithoutInspect } from "../../server/lib/utils";
|
||||
/**
|
||||
* Returns the package registry using the user's package manager.
|
||||
* The URL will have a trailing slash.
|
||||
* @default https://registry.npmjs.org/
|
||||
*/ export function getRegistry(baseDir = process.cwd()) {
|
||||
let registry = `https://registry.npmjs.org/`;
|
||||
try {
|
||||
const pkgManager = getPkgManager(baseDir);
|
||||
const output = execSync(`${pkgManager} config get registry`, {
|
||||
env: {
|
||||
...process.env,
|
||||
NODE_OPTIONS: getNodeOptionsWithoutInspect()
|
||||
}
|
||||
}).toString().trim();
|
||||
if (output.startsWith("http")) {
|
||||
registry = output.endsWith("/") ? output : `${output}/`;
|
||||
}
|
||||
} finally{
|
||||
return registry;
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=get-registry.js.map
|
||||
1
node_modules/next/dist/esm/lib/helpers/get-registry.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/lib/helpers/get-registry.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/lib/helpers/get-registry.ts"],"names":["execSync","getPkgManager","getNodeOptionsWithoutInspect","getRegistry","baseDir","process","cwd","registry","pkgManager","output","env","NODE_OPTIONS","toString","trim","startsWith","endsWith"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,gBAAe;AACxC,SAASC,aAAa,QAAQ,oBAAmB;AACjD,SAASC,4BAA4B,QAAQ,yBAAwB;AAErE;;;;CAIC,GACD,OAAO,SAASC,YAAYC,UAAkBC,QAAQC,GAAG,EAAE;IACzD,IAAIC,WAAW,CAAC,2BAA2B,CAAC;IAC5C,IAAI;QACF,MAAMC,aAAaP,cAAcG;QACjC,MAAMK,SAAST,SAAS,CAAC,EAAEQ,WAAW,oBAAoB,CAAC,EAAE;YAC3DE,KAAK;gBACH,GAAGL,QAAQK,GAAG;gBACdC,cAAcT;YAChB;QACF,GACGU,QAAQ,GACRC,IAAI;QAEP,IAAIJ,OAAOK,UAAU,CAAC,SAAS;YAC7BP,WAAWE,OAAOM,QAAQ,CAAC,OAAON,SAAS,CAAC,EAAEA,OAAO,CAAC,CAAC;QACzD;IACF,SAAU;QACR,OAAOF;IACT;AACF"}
|
||||
90
node_modules/next/dist/esm/lib/helpers/get-reserved-port.js
generated
vendored
Normal file
90
node_modules/next/dist/esm/lib/helpers/get-reserved-port.js
generated
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
/** https://fetch.spec.whatwg.org/#port-blocking */ export const KNOWN_RESERVED_PORTS = {
|
||||
1: "tcpmux",
|
||||
7: "echo",
|
||||
9: "discard",
|
||||
11: "systat",
|
||||
13: "daytime",
|
||||
15: "netstat",
|
||||
17: "qotd",
|
||||
19: "chargen",
|
||||
20: "ftp-data",
|
||||
21: "ftp",
|
||||
22: "ssh",
|
||||
23: "telnet",
|
||||
25: "smtp",
|
||||
37: "time",
|
||||
42: "name",
|
||||
43: "nicname",
|
||||
53: "domain",
|
||||
69: "tftp",
|
||||
77: "rje",
|
||||
79: "finger",
|
||||
87: "link",
|
||||
95: "supdup",
|
||||
101: "hostname",
|
||||
102: "iso-tsap",
|
||||
103: "gppitnp",
|
||||
104: "acr-nema",
|
||||
109: "pop2",
|
||||
110: "pop3",
|
||||
111: "sunrpc",
|
||||
113: "auth",
|
||||
115: "sftp",
|
||||
117: "uucp-path",
|
||||
119: "nntp",
|
||||
123: "ntp",
|
||||
135: "epmap",
|
||||
137: "netbios-ns",
|
||||
139: "netbios-ssn",
|
||||
143: "imap",
|
||||
161: "snmp",
|
||||
179: "bgp",
|
||||
389: "ldap",
|
||||
427: "svrloc",
|
||||
465: "submissions",
|
||||
512: "exec",
|
||||
513: "login",
|
||||
514: "shell",
|
||||
515: "printer",
|
||||
526: "tempo",
|
||||
530: "courier",
|
||||
531: "chat",
|
||||
532: "netnews",
|
||||
540: "uucp",
|
||||
548: "afp",
|
||||
554: "rtsp",
|
||||
556: "remotefs",
|
||||
563: "nntps",
|
||||
587: "submission",
|
||||
601: "syslog-conn",
|
||||
636: "ldaps",
|
||||
989: "ftps-data",
|
||||
990: "ftps",
|
||||
993: "imaps",
|
||||
995: "pop3s",
|
||||
1719: "h323gatestat",
|
||||
1720: "h323hostcall",
|
||||
1723: "pptp",
|
||||
2049: "nfs",
|
||||
3659: "apple-sasl",
|
||||
4045: "npp",
|
||||
5060: "sip",
|
||||
5061: "sips",
|
||||
6000: "x11",
|
||||
6566: "sane-port",
|
||||
6665: "ircu",
|
||||
6666: "ircu",
|
||||
6667: "ircu",
|
||||
6668: "ircu",
|
||||
6669: "ircu",
|
||||
6697: "ircs-u",
|
||||
10080: "amanda"
|
||||
};
|
||||
export function isPortIsReserved(port) {
|
||||
return port in KNOWN_RESERVED_PORTS;
|
||||
}
|
||||
export function getReservedPortExplanation(port) {
|
||||
return `Bad port: "${port}" is reserved for ${KNOWN_RESERVED_PORTS[port]}\n` + "Read more: https://nextjs.org/docs/messages/reserved-port";
|
||||
}
|
||||
|
||||
//# sourceMappingURL=get-reserved-port.js.map
|
||||
1
node_modules/next/dist/esm/lib/helpers/get-reserved-port.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/lib/helpers/get-reserved-port.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/lib/helpers/get-reserved-port.ts"],"names":["KNOWN_RESERVED_PORTS","isPortIsReserved","port","getReservedPortExplanation"],"mappings":"AAAA,iDAAiD,GACjD,OAAO,MAAMA,uBAAuB;IAClC,GAAG;IACH,GAAG;IACH,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,OAAO;AACT,EAAU;AAIV,OAAO,SAASC,iBAAiBC,IAAY;IAC3C,OAAOA,QAAQF;AACjB;AAEA,OAAO,SAASG,2BAA2BD,IAAkB;IAC3D,OACE,CAAC,WAAW,EAAEA,KAAK,kBAAkB,EAAEF,oBAAoB,CAACE,KAAK,CAAC,EAAE,CAAC,GACrE;AAEJ"}
|
||||
94
node_modules/next/dist/esm/lib/helpers/install.js
generated
vendored
Normal file
94
node_modules/next/dist/esm/lib/helpers/install.js
generated
vendored
Normal file
@ -0,0 +1,94 @@
|
||||
import { yellow } from "../picocolors";
|
||||
import spawn from "next/dist/compiled/cross-spawn";
|
||||
/**
|
||||
* Spawn a package manager installation with either Yarn or NPM.
|
||||
*
|
||||
* @returns A Promise that resolves once the installation is finished.
|
||||
*/ export function install(root, dependencies, { packageManager, isOnline, devDependencies }) {
|
||||
/**
|
||||
* (p)npm-specific command-line flags.
|
||||
*/ const npmFlags = [];
|
||||
/**
|
||||
* Yarn-specific command-line flags.
|
||||
*/ const yarnFlags = [];
|
||||
/**
|
||||
* Return a Promise that resolves once the installation is finished.
|
||||
*/ return new Promise((resolve, reject)=>{
|
||||
let args;
|
||||
let command = packageManager;
|
||||
const useYarn = packageManager === "yarn";
|
||||
if (dependencies && dependencies.length) {
|
||||
/**
|
||||
* If there are dependencies, run a variation of `{packageManager} add`.
|
||||
*/ if (useYarn) {
|
||||
/**
|
||||
* Call `yarn add --exact (--offline)? (-D)? ...`.
|
||||
*/ args = [
|
||||
"add",
|
||||
"--exact"
|
||||
];
|
||||
if (!isOnline) args.push("--offline");
|
||||
args.push("--cwd", root);
|
||||
if (devDependencies) args.push("--dev");
|
||||
args.push(...dependencies);
|
||||
} else {
|
||||
/**
|
||||
* Call `(p)npm install [--save|--save-dev] ...`.
|
||||
*/ args = [
|
||||
"install",
|
||||
"--save-exact"
|
||||
];
|
||||
args.push(devDependencies ? "--save-dev" : "--save");
|
||||
args.push(...dependencies);
|
||||
}
|
||||
} else {
|
||||
/**
|
||||
* If there are no dependencies, run a variation of `{packageManager}
|
||||
* install`.
|
||||
*/ args = [
|
||||
"install"
|
||||
];
|
||||
if (!isOnline) {
|
||||
console.log(yellow("You appear to be offline."));
|
||||
if (useYarn) {
|
||||
console.log(yellow("Falling back to the local Yarn cache."));
|
||||
console.log();
|
||||
args.push("--offline");
|
||||
} else {
|
||||
console.log();
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Add any package manager-specific flags.
|
||||
*/ if (useYarn) {
|
||||
args.push(...yarnFlags);
|
||||
} else {
|
||||
args.push(...npmFlags);
|
||||
}
|
||||
/**
|
||||
* Spawn the installation process.
|
||||
*/ const child = spawn(command, args, {
|
||||
stdio: "inherit",
|
||||
env: {
|
||||
...process.env,
|
||||
ADBLOCK: "1",
|
||||
// we set NODE_ENV to development as pnpm skips dev
|
||||
// dependencies when production
|
||||
NODE_ENV: "development",
|
||||
DISABLE_OPENCOLLECTIVE: "1"
|
||||
}
|
||||
});
|
||||
child.on("close", (code)=>{
|
||||
if (code !== 0) {
|
||||
reject({
|
||||
command: `${command} ${args.join(" ")}`
|
||||
});
|
||||
return;
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=install.js.map
|
||||
1
node_modules/next/dist/esm/lib/helpers/install.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/lib/helpers/install.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/lib/helpers/install.ts"],"names":["yellow","spawn","install","root","dependencies","packageManager","isOnline","devDependencies","npmFlags","yarnFlags","Promise","resolve","reject","args","command","useYarn","length","push","console","log","child","stdio","env","process","ADBLOCK","NODE_ENV","DISABLE_OPENCOLLECTIVE","on","code","join"],"mappings":"AAAA,SAASA,MAAM,QAAQ,gBAAe;AACtC,OAAOC,WAAW,iCAAgC;AAmBlD;;;;CAIC,GACD,OAAO,SAASC,QACdC,IAAY,EACZC,YAA6B,EAC7B,EAAEC,cAAc,EAAEC,QAAQ,EAAEC,eAAe,EAAe;IAE1D;;GAEC,GACD,MAAMC,WAAqB,EAAE;IAC7B;;GAEC,GACD,MAAMC,YAAsB,EAAE;IAC9B;;GAEC,GACD,OAAO,IAAIC,QAAQ,CAACC,SAASC;QAC3B,IAAIC;QACJ,IAAIC,UAAUT;QACd,MAAMU,UAAUV,mBAAmB;QAEnC,IAAID,gBAAgBA,aAAaY,MAAM,EAAE;YACvC;;OAEC,GACD,IAAID,SAAS;gBACX;;SAEC,GACDF,OAAO;oBAAC;oBAAO;iBAAU;gBACzB,IAAI,CAACP,UAAUO,KAAKI,IAAI,CAAC;gBACzBJ,KAAKI,IAAI,CAAC,SAASd;gBACnB,IAAII,iBAAiBM,KAAKI,IAAI,CAAC;gBAC/BJ,KAAKI,IAAI,IAAIb;YACf,OAAO;gBACL;;SAEC,GACDS,OAAO;oBAAC;oBAAW;iBAAe;gBAClCA,KAAKI,IAAI,CAACV,kBAAkB,eAAe;gBAC3CM,KAAKI,IAAI,IAAIb;YACf;QACF,OAAO;YACL;;;OAGC,GACDS,OAAO;gBAAC;aAAU;YAClB,IAAI,CAACP,UAAU;gBACbY,QAAQC,GAAG,CAACnB,OAAO;gBACnB,IAAIe,SAAS;oBACXG,QAAQC,GAAG,CAACnB,OAAO;oBACnBkB,QAAQC,GAAG;oBACXN,KAAKI,IAAI,CAAC;gBACZ,OAAO;oBACLC,QAAQC,GAAG;gBACb;YACF;QACF;QACA;;KAEC,GACD,IAAIJ,SAAS;YACXF,KAAKI,IAAI,IAAIR;QACf,OAAO;YACLI,KAAKI,IAAI,IAAIT;QACf;QACA;;KAEC,GACD,MAAMY,QAAQnB,MAAMa,SAASD,MAAM;YACjCQ,OAAO;YACPC,KAAK;gBACH,GAAGC,QAAQD,GAAG;gBACdE,SAAS;gBACT,mDAAmD;gBACnD,+BAA+B;gBAC/BC,UAAU;gBACVC,wBAAwB;YAC1B;QACF;QACAN,MAAMO,EAAE,CAAC,SAAS,CAACC;YACjB,IAAIA,SAAS,GAAG;gBACdhB,OAAO;oBAAEE,SAAS,CAAC,EAAEA,QAAQ,CAAC,EAAED,KAAKgB,IAAI,CAAC,KAAK,CAAC;gBAAC;gBACjD;YACF;YACAlB;QACF;IACF;AACF"}
|
||||
Reference in New Issue
Block a user