@node-cli/npmrc 1.2.2 → 1.2.3

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.
@@ -2,16 +2,13 @@ import kleur from "kleur";
2
2
  export const GET_REGISTRY_CMD = 'npm config list -l -g -json | grep registry\\"';
3
3
  export const formatRegistries = (registries)=>{
4
4
  /**
5
- * We receive this kind of output:
6
- * [
5
+ * We receive this kind of output: [
7
6
  * ' "@node-cli:registry": "https://other-registry.npmjs.org/"',
8
7
  * ' "registry": "https://registry.npmjs.org/"',
9
- * ]
10
- * And we need convert that to a JSON object that looks like that:
11
- * [
8
+ * ] And we need convert that to a JSON object that looks like that: [
12
9
  * { "@node-cli:registry": "https://other-registry.npmjs.org/" },
13
10
  * { "registry": "https://registry.npmjs.org/" },
14
- * ]
11
+ * ].
15
12
  */ const messages = [];
16
13
  const stdoutLines = registries.split("\n");
17
14
  const jsonObjects = stdoutLines.map((line)=>{
@@ -22,7 +19,7 @@ export const formatRegistries = (registries)=>{
22
19
  const jsonObject = JSON.parse(`{${jsonLine}}`);
23
20
  return jsonObject;
24
21
  /* v8 ignore start */ } catch {
25
- // nothing to declare officer
22
+ // nothing to declare officer.
26
23
  }
27
24
  }
28
25
  // eslint-disable-next-line unicorn/no-null
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utilities/common.ts"],"sourcesContent":["import kleur from \"kleur\";\n\nexport const GET_REGISTRY_CMD =\n\t'npm config list -l -g -json | grep registry\\\\\"';\n\nexport const formatRegistries = (registries: string) => {\n\t/**\n\t * We receive this kind of output:\n\t * [\n\t * ' \"@node-cli:registry\": \"https://other-registry.npmjs.org/\"',\n\t * ' \"registry\": \"https://registry.npmjs.org/\"',\n\t * ]\n\t * And we need convert that to a JSON object that looks like that:\n\t * [\n\t * { \"@node-cli:registry\": \"https://other-registry.npmjs.org/\" },\n\t * { \"registry\": \"https://registry.npmjs.org/\" },\n\t * ]\n\t */\n\tconst messages = [];\n\tconst stdoutLines = registries.split(\"\\n\");\n\tconst jsonObjects = stdoutLines\n\t\t.map((line) => {\n\t\t\tconst trimmedLine = line.trim();\n\t\t\tif (trimmedLine.startsWith('\"') && trimmedLine.endsWith(\",\")) {\n\t\t\t\tconst jsonLine = trimmedLine.slice(0, -1); // remove trailing comma\n\t\t\t\ttry {\n\t\t\t\t\tconst jsonObject = JSON.parse(`{${jsonLine}}`);\n\t\t\t\t\treturn jsonObject;\n\t\t\t\t\t/* v8 ignore start */\n\t\t\t\t} catch {\n\t\t\t\t\t// nothing to declare officer\n\t\t\t\t}\n\t\t\t}\n\t\t\t// eslint-disable-next-line unicorn/no-null\n\t\t\treturn null;\n\t\t\t/* v8 ignore stop */\n\t\t})\n\t\t.filter(Boolean); // remove undefined values\n\n\tfor (const jsonObject of jsonObjects) {\n\t\tmessages.push(\n\t\t\t` • ${Object.keys(jsonObject)}:`,\n\t\t\t` ${kleur.underline().grey(`${Object.values(jsonObject)}`)}`,\n\t\t);\n\t}\n\treturn messages;\n};\n"],"names":["kleur","GET_REGISTRY_CMD","formatRegistries","registries","messages","stdoutLines","split","jsonObjects","map","line","trimmedLine","trim","startsWith","endsWith","jsonLine","slice","jsonObject","JSON","parse","filter","Boolean","push","Object","keys","underline","grey","values"],"mappings":"AAAA,OAAOA,WAAW,QAAQ;AAE1B,OAAO,MAAMC,mBACZ,iDAAiD;AAElD,OAAO,MAAMC,mBAAmB,CAACC;IAChC;;;;;;;;;;;EAWC,GACD,MAAMC,WAAW,EAAE;IACnB,MAAMC,cAAcF,WAAWG,KAAK,CAAC;IACrC,MAAMC,cAAcF,YAClBG,GAAG,CAAC,CAACC;QACL,MAAMC,cAAcD,KAAKE,IAAI;QAC7B,IAAID,YAAYE,UAAU,CAAC,QAAQF,YAAYG,QAAQ,CAAC,MAAM;YAC7D,MAAMC,WAAWJ,YAAYK,KAAK,CAAC,GAAG,CAAC,IAAI,wBAAwB;YACnE,IAAI;gBACH,MAAMC,aAAaC,KAAKC,KAAK,CAAC,CAAC,CAAC,EAAEJ,SAAS,CAAC,CAAC;gBAC7C,OAAOE;YACP,mBAAmB,GACpB,EAAE,OAAM;YACP,6BAA6B;YAC9B;QACD;QACA,2CAA2C;QAC3C,OAAO;IACP,kBAAkB,GACnB,GACCG,MAAM,CAACC,UAAU,0BAA0B;IAE7C,KAAK,MAAMJ,cAAcT,YAAa;QACrCH,SAASiB,IAAI,CACZ,CAAC,GAAG,EAAEC,OAAOC,IAAI,CAACP,YAAY,CAAC,CAAC,EAChC,CAAC,IAAI,EAAEhB,MAAMwB,SAAS,GAAGC,IAAI,CAAC,GAAGH,OAAOI,MAAM,CAACV,aAAa,GAAG;IAEjE;IACA,OAAOZ;AACR,EAAE"}
1
+ {"version":3,"sources":["../../src/utilities/common.ts"],"sourcesContent":["import kleur from \"kleur\";\n\nexport const GET_REGISTRY_CMD =\n\t'npm config list -l -g -json | grep registry\\\\\"';\n\nexport const formatRegistries = (registries: string) => {\n\t/**\n\t * We receive this kind of output: [\n\t * ' \"@node-cli:registry\": \"https://other-registry.npmjs.org/\"',\n\t * ' \"registry\": \"https://registry.npmjs.org/\"',\n\t * ] And we need convert that to a JSON object that looks like that: [\n\t * { \"@node-cli:registry\": \"https://other-registry.npmjs.org/\" },\n\t * { \"registry\": \"https://registry.npmjs.org/\" },\n\t * ].\n\t */\n\tconst messages = [];\n\tconst stdoutLines = registries.split(\"\\n\");\n\tconst jsonObjects = stdoutLines\n\t\t.map((line) => {\n\t\t\tconst trimmedLine = line.trim();\n\t\t\tif (trimmedLine.startsWith('\"') && trimmedLine.endsWith(\",\")) {\n\t\t\t\tconst jsonLine = trimmedLine.slice(0, -1); // remove trailing comma\n\t\t\t\ttry {\n\t\t\t\t\tconst jsonObject = JSON.parse(`{${jsonLine}}`);\n\t\t\t\t\treturn jsonObject;\n\t\t\t\t\t/* v8 ignore start */\n\t\t\t\t} catch {\n\t\t\t\t\t// nothing to declare officer.\n\t\t\t\t}\n\t\t\t}\n\t\t\t// eslint-disable-next-line unicorn/no-null\n\t\t\treturn null;\n\t\t\t/* v8 ignore stop */\n\t\t})\n\t\t.filter(Boolean); // remove undefined values\n\n\tfor (const jsonObject of jsonObjects) {\n\t\tmessages.push(\n\t\t\t` • ${Object.keys(jsonObject)}:`,\n\t\t\t` ${kleur.underline().grey(`${Object.values(jsonObject)}`)}`,\n\t\t);\n\t}\n\treturn messages;\n};\n"],"names":["kleur","GET_REGISTRY_CMD","formatRegistries","registries","messages","stdoutLines","split","jsonObjects","map","line","trimmedLine","trim","startsWith","endsWith","jsonLine","slice","jsonObject","JSON","parse","filter","Boolean","push","Object","keys","underline","grey","values"],"mappings":"AAAA,OAAOA,WAAW,QAAQ;AAE1B,OAAO,MAAMC,mBACZ,iDAAiD;AAElD,OAAO,MAAMC,mBAAmB,CAACC;IAChC;;;;;;;;EAQC,GACD,MAAMC,WAAW,EAAE;IACnB,MAAMC,cAAcF,WAAWG,KAAK,CAAC;IACrC,MAAMC,cAAcF,YAClBG,GAAG,CAAC,CAACC;QACL,MAAMC,cAAcD,KAAKE,IAAI;QAC7B,IAAID,YAAYE,UAAU,CAAC,QAAQF,YAAYG,QAAQ,CAAC,MAAM;YAC7D,MAAMC,WAAWJ,YAAYK,KAAK,CAAC,GAAG,CAAC,IAAI,wBAAwB;YACnE,IAAI;gBACH,MAAMC,aAAaC,KAAKC,KAAK,CAAC,CAAC,CAAC,EAAEJ,SAAS,CAAC,CAAC;gBAC7C,OAAOE;YACP,mBAAmB,GACpB,EAAE,OAAM;YACP,8BAA8B;YAC/B;QACD;QACA,2CAA2C;QAC3C,OAAO;IACP,kBAAkB,GACnB,GACCG,MAAM,CAACC,UAAU,0BAA0B;IAE7C,KAAK,MAAMJ,cAAcT,YAAa;QACrCH,SAASiB,IAAI,CACZ,CAAC,GAAG,EAAEC,OAAOC,IAAI,CAACP,YAAY,CAAC,CAAC,EAChC,CAAC,IAAI,EAAEhB,MAAMwB,SAAS,GAAGC,IAAI,CAAC,GAAGH,OAAOI,MAAM,CAACV,aAAa,GAAG;IAEjE;IACA,OAAOZ;AACR,EAAE"}
@@ -10,21 +10,20 @@ export const createProfile = async ({ flags, storeConfig, storeLocation, profile
10
10
  };
11
11
  await fs.ensureFile(storeConfig);
12
12
  try {
13
- // if the profile already exists, do nothing
13
+ // if the profile already exists, do nothing.
14
14
  profiles = await fs.readJson(storeConfig);
15
15
  if (profiles.available.includes(profileName)) {
16
16
  logger.warn(`Profile '${profileName}' already exists...`);
17
17
  return 0;
18
18
  }
19
19
  } catch {
20
- // ignoring error since we are going to create the file
20
+ // ignoring error since we are going to create the file.
21
21
  }
22
22
  /**
23
- * If the profile does not exist, create a folder named as
24
- * the profile under the storeLocation folder, with the
25
- * existing npmrc / yarnrc files.
23
+ * If the profile does not exist, create a folder named as the profile under
24
+ * the storeLocation folder, with the existing npmrc / yarnrc files.
26
25
  */ await fs.ensureDir(`${storeLocation}/${profileName}`);
27
- // copy the existing npmrc / yarnrc files to the new folder
26
+ // copy the existing npmrc / yarnrc files to the new folder.
28
27
  const NPMRC = `${homeLocation}/.npmrc`;
29
28
  const YARNRC = `${homeLocation}/.yarnrc`;
30
29
  if (await fs.pathExists(YARNRC)) {
@@ -33,7 +32,7 @@ export const createProfile = async ({ flags, storeConfig, storeLocation, profile
33
32
  if (await fs.pathExists(NPMRC)) {
34
33
  await fs.copy(NPMRC, `${storeLocation}/${profileName}/npmrc`);
35
34
  }
36
- // then add the profile to the configuration file
35
+ // then add the profile to the configuration file.
37
36
  const newProfiles = {
38
37
  available: [
39
38
  ...profiles.available,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utilities/createProfile.ts"],"sourcesContent":["import { Logger } from \"@node-cli/logger\";\nimport fs from \"fs-extra\";\n\nexport const createProfile = async ({\n\tflags,\n\tstoreConfig,\n\tstoreLocation,\n\tprofileName,\n\thomeLocation,\n}) => {\n\tconst logger = new Logger({\n\t\tboring: process.env.NODE_ENV === \"test\" || flags.boring,\n\t});\n\n\tlet profiles = { available: [], enabled: undefined };\n\tawait fs.ensureFile(storeConfig);\n\ttry {\n\t\t// if the profile already exists, do nothing\n\t\tprofiles = await fs.readJson(storeConfig);\n\t\tif (profiles.available.includes(profileName)) {\n\t\t\tlogger.warn(`Profile '${profileName}' already exists...`);\n\t\t\treturn 0;\n\t\t}\n\t} catch {\n\t\t// ignoring error since we are going to create the file\n\t}\n\n\t/**\n\t * If the profile does not exist, create a folder named as\n\t * the profile under the storeLocation folder, with the\n\t * existing npmrc / yarnrc files.\n\t */\n\tawait fs.ensureDir(`${storeLocation}/${profileName}`);\n\t// copy the existing npmrc / yarnrc files to the new folder\n\tconst NPMRC = `${homeLocation}/.npmrc`;\n\tconst YARNRC = `${homeLocation}/.yarnrc`;\n\tif (await fs.pathExists(YARNRC)) {\n\t\tawait fs.copy(YARNRC, `${storeLocation}/${profileName}/yarnrc`);\n\t}\n\tif (await fs.pathExists(NPMRC)) {\n\t\tawait fs.copy(NPMRC, `${storeLocation}/${profileName}/npmrc`);\n\t}\n\t// then add the profile to the configuration file\n\tconst newProfiles = {\n\t\tavailable: [...profiles.available, profileName],\n\t\tenabled: profiles.enabled ?? profileName,\n\t};\n\tawait fs.writeJson(storeConfig, newProfiles, { spaces: 2 });\n\tlogger.printBox(`Profile '${profileName}' created`, {\n\t\ttextAlignment: \"left\",\n\t\ttitle: \"Profiles\",\n\t\tborderColor: \"blue\",\n\t});\n\treturn 0;\n};\n"],"names":["Logger","fs","createProfile","flags","storeConfig","storeLocation","profileName","homeLocation","logger","boring","process","env","NODE_ENV","profiles","available","enabled","undefined","ensureFile","readJson","includes","warn","ensureDir","NPMRC","YARNRC","pathExists","copy","newProfiles","writeJson","spaces","printBox","textAlignment","title","borderColor"],"mappings":"AAAA,SAASA,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,QAAQ,WAAW;AAE1B,OAAO,MAAMC,gBAAgB,OAAO,EACnCC,KAAK,EACLC,WAAW,EACXC,aAAa,EACbC,WAAW,EACXC,YAAY,EACZ;IACA,MAAMC,SAAS,IAAI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../src/utilities/createProfile.ts"],"sourcesContent":["import { Logger } from \"@node-cli/logger\";\nimport fs from \"fs-extra\";\n\nexport const createProfile = async ({\n\tflags,\n\tstoreConfig,\n\tstoreLocation,\n\tprofileName,\n\thomeLocation,\n}) => {\n\tconst logger = new Logger({\n\t\tboring: process.env.NODE_ENV === \"test\" || flags.boring,\n\t});\n\n\tlet profiles = { available: [], enabled: undefined };\n\tawait fs.ensureFile(storeConfig);\n\ttry {\n\t\t// if the profile already exists, do nothing.\n\t\tprofiles = await fs.readJson(storeConfig);\n\t\tif (profiles.available.includes(profileName)) {\n\t\t\tlogger.warn(`Profile '${profileName}' already exists...`);\n\t\t\treturn 0;\n\t\t}\n\t} catch {\n\t\t// ignoring error since we are going to create the file.\n\t}\n\n\t/**\n\t * If the profile does not exist, create a folder named as the profile under\n\t * the storeLocation folder, with the existing npmrc / yarnrc files.\n\t */\n\tawait fs.ensureDir(`${storeLocation}/${profileName}`);\n\t// copy the existing npmrc / yarnrc files to the new folder.\n\tconst NPMRC = `${homeLocation}/.npmrc`;\n\tconst YARNRC = `${homeLocation}/.yarnrc`;\n\tif (await fs.pathExists(YARNRC)) {\n\t\tawait fs.copy(YARNRC, `${storeLocation}/${profileName}/yarnrc`);\n\t}\n\tif (await fs.pathExists(NPMRC)) {\n\t\tawait fs.copy(NPMRC, `${storeLocation}/${profileName}/npmrc`);\n\t}\n\t// then add the profile to the configuration file.\n\tconst newProfiles = {\n\t\tavailable: [...profiles.available, profileName],\n\t\tenabled: profiles.enabled ?? profileName,\n\t};\n\tawait fs.writeJson(storeConfig, newProfiles, { spaces: 2 });\n\tlogger.printBox(`Profile '${profileName}' created`, {\n\t\ttextAlignment: \"left\",\n\t\ttitle: \"Profiles\",\n\t\tborderColor: \"blue\",\n\t});\n\treturn 0;\n};\n"],"names":["Logger","fs","createProfile","flags","storeConfig","storeLocation","profileName","homeLocation","logger","boring","process","env","NODE_ENV","profiles","available","enabled","undefined","ensureFile","readJson","includes","warn","ensureDir","NPMRC","YARNRC","pathExists","copy","newProfiles","writeJson","spaces","printBox","textAlignment","title","borderColor"],"mappings":"AAAA,SAASA,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,QAAQ,WAAW;AAE1B,OAAO,MAAMC,gBAAgB,OAAO,EACnCC,KAAK,EACLC,WAAW,EACXC,aAAa,EACbC,WAAW,EACXC,YAAY,EACZ;IACA,MAAMC,SAAS,IAAIR,OAAO;QACzBS,QAAQC,QAAQC,GAAG,CAACC,QAAQ,KAAK,UAAUT,MAAMM,MAAM;IACxD;IAEA,IAAII,WAAW;QAAEC,WAAW,EAAE;QAAEC,SAASC;IAAU;IACnD,MAAMf,GAAGgB,UAAU,CAACb;IACpB,IAAI;QACH,6CAA6C;QAC7CS,WAAW,MAAMZ,GAAGiB,QAAQ,CAACd;QAC7B,IAAIS,SAASC,SAAS,CAACK,QAAQ,CAACb,cAAc;YAC7CE,OAAOY,IAAI,CAAC,CAAC,SAAS,EAAEd,YAAY,mBAAmB,CAAC;YACxD,OAAO;QACR;IACD,EAAE,OAAM;IACP,wDAAwD;IACzD;IAEA;;;EAGC,GACD,MAAML,GAAGoB,SAAS,CAAC,GAAGhB,cAAc,CAAC,EAAEC,aAAa;IACpD,4DAA4D;IAC5D,MAAMgB,QAAQ,GAAGf,aAAa,OAAO,CAAC;IACtC,MAAMgB,SAAS,GAAGhB,aAAa,QAAQ,CAAC;IACxC,IAAI,MAAMN,GAAGuB,UAAU,CAACD,SAAS;QAChC,MAAMtB,GAAGwB,IAAI,CAACF,QAAQ,GAAGlB,cAAc,CAAC,EAAEC,YAAY,OAAO,CAAC;IAC/D;IACA,IAAI,MAAML,GAAGuB,UAAU,CAACF,QAAQ;QAC/B,MAAMrB,GAAGwB,IAAI,CAACH,OAAO,GAAGjB,cAAc,CAAC,EAAEC,YAAY,MAAM,CAAC;IAC7D;IACA,kDAAkD;IAClD,MAAMoB,cAAc;QACnBZ,WAAW;eAAID,SAASC,SAAS;YAAER;SAAY;QAC/CS,SAASF,SAASE,OAAO,IAAIT;IAC9B;IACA,MAAML,GAAG0B,SAAS,CAACvB,aAAasB,aAAa;QAAEE,QAAQ;IAAE;IACzDpB,OAAOqB,QAAQ,CAAC,CAAC,SAAS,EAAEvB,YAAY,SAAS,CAAC,EAAE;QACnDwB,eAAe;QACfC,OAAO;QACPC,aAAa;IACd;IACA,OAAO;AACR,EAAE"}
@@ -10,14 +10,14 @@ export const deleteProfile = async ({ flags, profileName, storeConfig, storeLoca
10
10
  logger.error(`Profile '${profileName}' does not exist`);
11
11
  return 1;
12
12
  }
13
- // if the profile is enabled, do nothing
13
+ // if the profile is enabled, do nothing.
14
14
  if (profiles.enabled === profileName) {
15
15
  logger.error(`Profile '${profileName}' is currently active`);
16
16
  return 1;
17
17
  }
18
- // if profile exists, delete it by removing the profile folder
18
+ // if profile exists, delete it by removing the profile folder.
19
19
  await fs.remove(`${storeLocation}/${profileName}`);
20
- // then remove the profile from the configuration file
20
+ // then remove the profile from the configuration file.
21
21
  const newProfiles = {
22
22
  available: profiles.available.filter((profile)=>profile !== profileName),
23
23
  enabled: profiles.enabled
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utilities/deleteProfile.ts"],"sourcesContent":["import { Logger } from \"@node-cli/logger\";\nimport fs from \"fs-extra\";\n\nexport const deleteProfile = async ({\n\tflags,\n\tprofileName,\n\tstoreConfig,\n\tstoreLocation,\n}) => {\n\tconst logger = new Logger({\n\t\tboring: process.env.NODE_ENV === \"test\" || flags.boring,\n\t});\n\n\ttry {\n\t\tconst profiles = await fs.readJson(storeConfig);\n\t\tif (!profiles.available.includes(profileName)) {\n\t\t\tlogger.error(`Profile '${profileName}' does not exist`);\n\t\t\treturn 1;\n\t\t}\n\t\t// if the profile is enabled, do nothing\n\t\tif (profiles.enabled === profileName) {\n\t\t\tlogger.error(`Profile '${profileName}' is currently active`);\n\t\t\treturn 1;\n\t\t}\n\t\t// if profile exists, delete it by removing the profile folder\n\t\tawait fs.remove(`${storeLocation}/${profileName}`);\n\t\t// then remove the profile from the configuration file\n\t\tconst newProfiles = {\n\t\t\tavailable: profiles.available.filter(\n\t\t\t\t(profile: any) => profile !== profileName,\n\t\t\t),\n\t\t\tenabled: profiles.enabled,\n\t\t};\n\t\tawait fs.writeJson(storeConfig, newProfiles, { spaces: 2 });\n\t\tlogger.printBox(`Profile '${profileName}' deleted`, {\n\t\t\ttextAlignment: \"left\",\n\t\t\ttitle: \"Profiles\",\n\t\t\tborderColor: \"blue\",\n\t\t});\n\t\treturn 0;\n\t} catch (error) {\n\t\tif (flags.verbose) {\n\t\t\tlogger.log(error);\n\t\t}\n\t\tlogger.error(\"Could not delete profile\");\n\t\treturn 1;\n\t}\n};\n"],"names":["Logger","fs","deleteProfile","flags","profileName","storeConfig","storeLocation","logger","boring","process","env","NODE_ENV","profiles","readJson","available","includes","error","enabled","remove","newProfiles","filter","profile","writeJson","spaces","printBox","textAlignment","title","borderColor","verbose","log"],"mappings":"AAAA,SAASA,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,QAAQ,WAAW;AAE1B,OAAO,MAAMC,gBAAgB,OAAO,EACnCC,KAAK,EACLC,WAAW,EACXC,WAAW,EACXC,aAAa,EACb;IACA,MAAMC,SAAS,IAAIP,OAAO;QACzBQ,QAAQC,QAAQC,GAAG,CAACC,QAAQ,KAAK,UAAUR,MAAMK,MAAM;IACxD;IAEA,IAAI;QACH,MAAMI,WAAW,MAAMX,GAAGY,QAAQ,CAACR;QACnC,IAAI,CAACO,SAASE,SAAS,CAACC,QAAQ,CAACX,cAAc;YAC9CG,OAAOS,KAAK,CAAC,CAAC,SAAS,EAAEZ,YAAY,gBAAgB,CAAC;YACtD,OAAO;QACR;QACA,wCAAwC;QACxC,IAAIQ,SAASK,OAAO,KAAKb,aAAa;YACrCG,OAAOS,KAAK,CAAC,CAAC,SAAS,EAAEZ,YAAY,qBAAqB,CAAC;YAC3D,OAAO;QACR;QACA,8DAA8D;QAC9D,MAAMH,GAAGiB,MAAM,CAAC,GAAGZ,cAAc,CAAC,EAAEF,aAAa;QACjD,sDAAsD;QACtD,MAAMe,cAAc;YACnBL,WAAWF,SAASE,SAAS,CAACM,MAAM,CACnC,CAACC,UAAiBA,YAAYjB;YAE/Ba,SAASL,SAASK,OAAO;QAC1B;QACA,MAAMhB,GAAGqB,SAAS,CAACjB,aAAac,aAAa;YAAEI,QAAQ;QAAE;QACzDhB,OAAOiB,QAAQ,CAAC,CAAC,SAAS,EAAEpB,YAAY,SAAS,CAAC,EAAE;YACnDqB,eAAe;YACfC,OAAO;YACPC,aAAa;QACd;QACA,OAAO;IACR,EAAE,OAAOX,OAAO;QACf,IAAIb,MAAMyB,OAAO,EAAE;YAClBrB,OAAOsB,GAAG,CAACb;QACZ;QACAT,OAAOS,KAAK,CAAC;QACb,OAAO;IACR;AACD,EAAE"}
1
+ {"version":3,"sources":["../../src/utilities/deleteProfile.ts"],"sourcesContent":["import { Logger } from \"@node-cli/logger\";\nimport fs from \"fs-extra\";\n\nexport const deleteProfile = async ({\n\tflags,\n\tprofileName,\n\tstoreConfig,\n\tstoreLocation,\n}) => {\n\tconst logger = new Logger({\n\t\tboring: process.env.NODE_ENV === \"test\" || flags.boring,\n\t});\n\n\ttry {\n\t\tconst profiles = await fs.readJson(storeConfig);\n\t\tif (!profiles.available.includes(profileName)) {\n\t\t\tlogger.error(`Profile '${profileName}' does not exist`);\n\t\t\treturn 1;\n\t\t}\n\t\t// if the profile is enabled, do nothing.\n\t\tif (profiles.enabled === profileName) {\n\t\t\tlogger.error(`Profile '${profileName}' is currently active`);\n\t\t\treturn 1;\n\t\t}\n\t\t// if profile exists, delete it by removing the profile folder.\n\t\tawait fs.remove(`${storeLocation}/${profileName}`);\n\t\t// then remove the profile from the configuration file.\n\t\tconst newProfiles = {\n\t\t\tavailable: profiles.available.filter(\n\t\t\t\t(profile: any) => profile !== profileName,\n\t\t\t),\n\t\t\tenabled: profiles.enabled,\n\t\t};\n\t\tawait fs.writeJson(storeConfig, newProfiles, { spaces: 2 });\n\t\tlogger.printBox(`Profile '${profileName}' deleted`, {\n\t\t\ttextAlignment: \"left\",\n\t\t\ttitle: \"Profiles\",\n\t\t\tborderColor: \"blue\",\n\t\t});\n\t\treturn 0;\n\t} catch (error) {\n\t\tif (flags.verbose) {\n\t\t\tlogger.log(error);\n\t\t}\n\t\tlogger.error(\"Could not delete profile\");\n\t\treturn 1;\n\t}\n};\n"],"names":["Logger","fs","deleteProfile","flags","profileName","storeConfig","storeLocation","logger","boring","process","env","NODE_ENV","profiles","readJson","available","includes","error","enabled","remove","newProfiles","filter","profile","writeJson","spaces","printBox","textAlignment","title","borderColor","verbose","log"],"mappings":"AAAA,SAASA,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,QAAQ,WAAW;AAE1B,OAAO,MAAMC,gBAAgB,OAAO,EACnCC,KAAK,EACLC,WAAW,EACXC,WAAW,EACXC,aAAa,EACb;IACA,MAAMC,SAAS,IAAIP,OAAO;QACzBQ,QAAQC,QAAQC,GAAG,CAACC,QAAQ,KAAK,UAAUR,MAAMK,MAAM;IACxD;IAEA,IAAI;QACH,MAAMI,WAAW,MAAMX,GAAGY,QAAQ,CAACR;QACnC,IAAI,CAACO,SAASE,SAAS,CAACC,QAAQ,CAACX,cAAc;YAC9CG,OAAOS,KAAK,CAAC,CAAC,SAAS,EAAEZ,YAAY,gBAAgB,CAAC;YACtD,OAAO;QACR;QACA,yCAAyC;QACzC,IAAIQ,SAASK,OAAO,KAAKb,aAAa;YACrCG,OAAOS,KAAK,CAAC,CAAC,SAAS,EAAEZ,YAAY,qBAAqB,CAAC;YAC3D,OAAO;QACR;QACA,+DAA+D;QAC/D,MAAMH,GAAGiB,MAAM,CAAC,GAAGZ,cAAc,CAAC,EAAEF,aAAa;QACjD,uDAAuD;QACvD,MAAMe,cAAc;YACnBL,WAAWF,SAASE,SAAS,CAACM,MAAM,CACnC,CAACC,UAAiBA,YAAYjB;YAE/Ba,SAASL,SAASK,OAAO;QAC1B;QACA,MAAMhB,GAAGqB,SAAS,CAACjB,aAAac,aAAa;YAAEI,QAAQ;QAAE;QACzDhB,OAAOiB,QAAQ,CAAC,CAAC,SAAS,EAAEpB,YAAY,SAAS,CAAC,EAAE;YACnDqB,eAAe;YACfC,OAAO;YACPC,aAAa;QACd;QACA,OAAO;IACR,EAAE,OAAOX,OAAO;QACf,IAAIb,MAAMyB,OAAO,EAAE;YAClBrB,OAAOsB,GAAG,CAACb;QACZ;QACAT,OAAOS,KAAK,CAAC;QACb,OAAO;IACR;AACD,EAAE"}
@@ -1,8 +1,8 @@
1
- import { GET_REGISTRY_CMD, formatRegistries } from "./common.js";
2
1
  import { Logger } from "@node-cli/logger";
3
2
  import { run } from "@node-cli/run";
4
3
  import fs from "fs-extra";
5
4
  import kleur from "kleur";
5
+ import { formatRegistries, GET_REGISTRY_CMD } from "./common.js";
6
6
  export const listProfiles = async ({ flags, storeConfig })=>{
7
7
  const logger = new Logger({
8
8
  boring: process.env.NODE_ENV === "test" || flags.boring
@@ -15,8 +15,8 @@ export const listProfiles = async ({ flags, storeConfig })=>{
15
15
  kleur.green(`★ ${activeProfile} (active)`)
16
16
  ];
17
17
  /**
18
- * Since there is an active profile, we can check the
19
- * global registries and list them, alongside the active profile.
18
+ * Since there is an active profile, we can check the global registries and
19
+ * list them, alongside the active profile.
20
20
  */ if (activeProfile) {
21
21
  const { stdout, stderr } = await run(GET_REGISTRY_CMD, {
22
22
  ignoreError: true
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utilities/listProfiles.ts"],"sourcesContent":["import { GET_REGISTRY_CMD, formatRegistries } from \"./common.js\";\n\nimport { Logger } from \"@node-cli/logger\";\nimport { run } from \"@node-cli/run\";\nimport fs from \"fs-extra\";\nimport kleur from \"kleur\";\n\nexport const listProfiles = async ({ flags, storeConfig }) => {\n\tconst logger = new Logger({\n\t\tboring: process.env.NODE_ENV === \"test\" || flags.boring,\n\t});\n\n\ttry {\n\t\tconst profiles = await fs.readJson(storeConfig);\n\n\t\tif (profiles?.available?.length > 0) {\n\t\t\tconst activeProfile = profiles.enabled;\n\t\t\tconst messages =\n\t\t\t\tactiveProfile === undefined\n\t\t\t\t\t? []\n\t\t\t\t\t: [kleur.green(`★ ${activeProfile} (active)`)];\n\n\t\t\t/**\n\t\t\t * Since there is an active profile, we can check the\n\t\t\t * global registries and list them, alongside the active profile.\n\t\t\t */\n\t\t\tif (activeProfile) {\n\t\t\t\tconst { stdout, stderr } = await run(GET_REGISTRY_CMD, {\n\t\t\t\t\tignoreError: true,\n\t\t\t\t});\n\n\t\t\t\tif (!stderr) {\n\t\t\t\t\tmessages.push(...formatRegistries(stdout as string));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const profile of profiles.available) {\n\t\t\t\tif (profile !== activeProfile) {\n\t\t\t\t\tmessages.push(`${profile}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlogger.printBox(messages.join(\"\\n\"), {\n\t\t\t\ttextAlignment: \"left\",\n\t\t\t\ttitle: \"Profiles\",\n\t\t\t\tborderColor: \"blue\",\n\t\t\t});\n\t\t} else {\n\t\t\tlogger.warn(\"No profiles found\");\n\t\t}\n\t\treturn 0;\n\t} catch (error) {\n\t\tif (flags.verbose) {\n\t\t\tlogger.log(error);\n\t\t}\n\t\tlogger.error(\"Unable to read the profile configuration file\");\n\t\treturn 1;\n\t}\n};\n"],"names":["GET_REGISTRY_CMD","formatRegistries","Logger","run","fs","kleur","listProfiles","flags","storeConfig","logger","boring","process","env","NODE_ENV","profiles","readJson","available","length","activeProfile","enabled","messages","undefined","green","stdout","stderr","ignoreError","push","profile","printBox","join","textAlignment","title","borderColor","warn","error","verbose","log"],"mappings":"AAAA,SAASA,gBAAgB,EAAEC,gBAAgB,QAAQ,cAAc;AAEjE,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,GAAG,QAAQ,gBAAgB;AACpC,OAAOC,QAAQ,WAAW;AAC1B,OAAOC,WAAW,QAAQ;AAE1B,OAAO,MAAMC,eAAe,OAAO,EAAEC,KAAK,EAAEC,WAAW,EAAE;IACxD,MAAMC,SAAS,IAAIP,OAAO;QACzBQ,QAAQC,QAAQC,GAAG,CAACC,QAAQ,KAAK,UAAUN,MAAMG,MAAM;IACxD;IAEA,IAAI;QACH,MAAMI,WAAW,MAAMV,GAAGW,QAAQ,CAACP;QAEnC,IAAIM,UAAUE,WAAWC,SAAS,GAAG;YACpC,MAAMC,gBAAgBJ,SAASK,OAAO;YACtC,MAAMC,WACLF,kBAAkBG,YACf,EAAE,GACF;gBAAChB,MAAMiB,KAAK,CAAC,CAAC,EAAE,EAAEJ,cAAc,SAAS,CAAC;aAAE;YAEhD;;;IAGC,GACD,IAAIA,eAAe;gBAClB,MAAM,EAAEK,MAAM,EAAEC,MAAM,EAAE,GAAG,MAAMrB,IAAIH,kBAAkB;oBACtDyB,aAAa;gBACd;gBAEA,IAAI,CAACD,QAAQ;oBACZJ,SAASM,IAAI,IAAIzB,iBAAiBsB;gBACnC;YACD;YAEA,KAAK,MAAMI,WAAWb,SAASE,SAAS,CAAE;gBACzC,IAAIW,YAAYT,eAAe;oBAC9BE,SAASM,IAAI,CAAC,GAAGC,SAAS;gBAC3B;YACD;YAEAlB,OAAOmB,QAAQ,CAACR,SAASS,IAAI,CAAC,OAAO;gBACpCC,eAAe;gBACfC,OAAO;gBACPC,aAAa;YACd;QACD,OAAO;YACNvB,OAAOwB,IAAI,CAAC;QACb;QACA,OAAO;IACR,EAAE,OAAOC,OAAO;QACf,IAAI3B,MAAM4B,OAAO,EAAE;YAClB1B,OAAO2B,GAAG,CAACF;QACZ;QACAzB,OAAOyB,KAAK,CAAC;QACb,OAAO;IACR;AACD,EAAE"}
1
+ {"version":3,"sources":["../../src/utilities/listProfiles.ts"],"sourcesContent":["import { Logger } from \"@node-cli/logger\";\nimport { run } from \"@node-cli/run\";\nimport fs from \"fs-extra\";\nimport kleur from \"kleur\";\nimport { formatRegistries, GET_REGISTRY_CMD } from \"./common.js\";\n\nexport const listProfiles = async ({ flags, storeConfig }) => {\n\tconst logger = new Logger({\n\t\tboring: process.env.NODE_ENV === \"test\" || flags.boring,\n\t});\n\n\ttry {\n\t\tconst profiles = await fs.readJson(storeConfig);\n\n\t\tif (profiles?.available?.length > 0) {\n\t\t\tconst activeProfile = profiles.enabled;\n\t\t\tconst messages =\n\t\t\t\tactiveProfile === undefined\n\t\t\t\t\t? []\n\t\t\t\t\t: [kleur.green(`★ ${activeProfile} (active)`)];\n\n\t\t\t/**\n\t\t\t * Since there is an active profile, we can check the global registries and\n\t\t\t * list them, alongside the active profile.\n\t\t\t */\n\t\t\tif (activeProfile) {\n\t\t\t\tconst { stdout, stderr } = await run(GET_REGISTRY_CMD, {\n\t\t\t\t\tignoreError: true,\n\t\t\t\t});\n\n\t\t\t\tif (!stderr) {\n\t\t\t\t\tmessages.push(...formatRegistries(stdout as string));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const profile of profiles.available) {\n\t\t\t\tif (profile !== activeProfile) {\n\t\t\t\t\tmessages.push(`${profile}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlogger.printBox(messages.join(\"\\n\"), {\n\t\t\t\ttextAlignment: \"left\",\n\t\t\t\ttitle: \"Profiles\",\n\t\t\t\tborderColor: \"blue\",\n\t\t\t});\n\t\t} else {\n\t\t\tlogger.warn(\"No profiles found\");\n\t\t}\n\t\treturn 0;\n\t} catch (error) {\n\t\tif (flags.verbose) {\n\t\t\tlogger.log(error);\n\t\t}\n\t\tlogger.error(\"Unable to read the profile configuration file\");\n\t\treturn 1;\n\t}\n};\n"],"names":["Logger","run","fs","kleur","formatRegistries","GET_REGISTRY_CMD","listProfiles","flags","storeConfig","logger","boring","process","env","NODE_ENV","profiles","readJson","available","length","activeProfile","enabled","messages","undefined","green","stdout","stderr","ignoreError","push","profile","printBox","join","textAlignment","title","borderColor","warn","error","verbose","log"],"mappings":"AAAA,SAASA,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,GAAG,QAAQ,gBAAgB;AACpC,OAAOC,QAAQ,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
3
2
  import { run } from "@node-cli/run";
4
3
  import fs from "fs-extra";
5
4
  import kleur from "kleur";
5
+ import { formatRegistries, GET_REGISTRY_CMD } from "./common.js";
6
6
  export const switchProfile = async ({ flags, storeConfig, storeLocation, profileName, homeLocation })=>{
7
7
  const logger = new Logger({
8
8
  boring: process.env.NODE_ENV === "test" || flags.boring
@@ -13,14 +13,15 @@ export const switchProfile = async ({ flags, storeConfig, storeLocation, profile
13
13
  logger.error(`Profile '${profileName}' does not exist`);
14
14
  return 1;
15
15
  }
16
- // if profile is already enabled, do nothing
16
+ // if profile is already enabled, do nothing.
17
17
  if (profiles.enabled === profileName) {
18
18
  logger.warn(`Profile '${profileName}' is already active`);
19
19
  return 0;
20
20
  }
21
- // if profile exists and is not enabled, switch to it by copying
22
- // the npmrc and yarnrc files from the profile folder to the home folder
23
- const NPMRC = `${homeLocation}/.npmrc`;
21
+ /**
22
+ * if profile exists and is not enabled, switch to it by copying the npmrc and
23
+ * yarnrc files from the profile folder to the home folder.
24
+ */ const NPMRC = `${homeLocation}/.npmrc`;
24
25
  const PROFILE_NPMRC = `${storeLocation}/${profileName}/npmrc`;
25
26
  const YARNRC = `${homeLocation}/.yarnrc`;
26
27
  const PROFILE_YARNRC = `${storeLocation}/${profileName}/yarnrc`;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utilities/switchProfile.ts"],"sourcesContent":["import { GET_REGISTRY_CMD, formatRegistries } from \"./common.js\";\n\nimport { Logger } from \"@node-cli/logger\";\nimport { run } from \"@node-cli/run\";\nimport fs from \"fs-extra\";\nimport kleur from \"kleur\";\n\nexport const switchProfile = async ({\n\tflags,\n\tstoreConfig,\n\tstoreLocation,\n\tprofileName,\n\thomeLocation,\n}) => {\n\tconst logger = new Logger({\n\t\tboring: process.env.NODE_ENV === \"test\" || flags.boring,\n\t});\n\n\ttry {\n\t\tconst profiles = await fs.readJson(storeConfig);\n\t\tif (!profiles.available.includes(profileName)) {\n\t\t\tlogger.error(`Profile '${profileName}' does not exist`);\n\t\t\treturn 1;\n\t\t}\n\t\t// if profile is already enabled, do nothing\n\t\tif (profiles.enabled === profileName) {\n\t\t\tlogger.warn(`Profile '${profileName}' is already active`);\n\t\t\treturn 0;\n\t\t}\n\t\t// if profile exists and is not enabled, switch to it by copying\n\t\t// the npmrc and yarnrc files from the profile folder to the home folder\n\t\tconst NPMRC = `${homeLocation}/.npmrc`;\n\t\tconst PROFILE_NPMRC = `${storeLocation}/${profileName}/npmrc`;\n\t\tconst YARNRC = `${homeLocation}/.yarnrc`;\n\t\tconst PROFILE_YARNRC = `${storeLocation}/${profileName}/yarnrc`;\n\n\t\tif (await fs.pathExists(PROFILE_NPMRC)) {\n\t\t\tawait fs.copy(PROFILE_NPMRC, NPMRC, {\n\t\t\t\toverwrite: true,\n\t\t\t});\n\t\t} else {\n\t\t\tlogger.warn(`No npmrc file found for profile '${profileName}'`);\n\t\t}\n\t\tif (await fs.pathExists(PROFILE_YARNRC)) {\n\t\t\tawait fs.copy(PROFILE_YARNRC, YARNRC, {\n\t\t\t\toverwrite: true,\n\t\t\t});\n\t\t} else {\n\t\t\tlogger.warn(`No yarnrc file found for profile '${profileName}'`);\n\t\t}\n\n\t\tconst newProfiles = {\n\t\t\tavailable: profiles.available,\n\t\t\tenabled: profileName,\n\t\t};\n\t\tawait fs.writeJson(storeConfig, newProfiles, { spaces: 2 });\n\t\tconst messages = [kleur.green(`Profile switched to '${profileName}'`)];\n\t\tconst { stdout, stderr } = await run(GET_REGISTRY_CMD, {\n\t\t\tignoreError: true,\n\t\t});\n\t\tif (!stderr) {\n\t\t\tmessages.push(...formatRegistries(stdout as string));\n\t\t}\n\t\tlogger.printBox(messages.join(\"\\n\"), {\n\t\t\ttextAlignment: \"left\",\n\t\t\ttitle: \"Profiles\",\n\t\t\tborderColor: \"blue\",\n\t\t});\n\t\treturn 0;\n\t} catch (error) {\n\t\tif (flags.verbose) {\n\t\t\tlogger.log(error);\n\t\t}\n\t\tlogger.error(\"Could not switch profile\");\n\t\treturn 1;\n\t}\n};\n"],"names":["GET_REGISTRY_CMD","formatRegistries","Logger","run","fs","kleur","switchProfile","flags","storeConfig","storeLocation","profileName","homeLocation","logger","boring","process","env","NODE_ENV","profiles","readJson","available","includes","error","enabled","warn","NPMRC","PROFILE_NPMRC","YARNRC","PROFILE_YARNRC","pathExists","copy","overwrite","newProfiles","writeJson","spaces","messages","green","stdout","stderr","ignoreError","push","printBox","join","textAlignment","title","borderColor","verbose","log"],"mappings":"AAAA,SAASA,gBAAgB,EAAEC,gBAAgB,QAAQ,cAAc;AAEjE,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,GAAG,QAAQ,gBAAgB;AACpC,OAAOC,QAAQ,WAAW;AAC1B,OAAOC,WAAW,QAAQ;AAE1B,OAAO,MAAMC,gBAAgB,OAAO,EACnCC,KAAK,EACLC,WAAW,EACXC,aAAa,EACbC,WAAW,EACXC,YAAY,EACZ;IACA,MAAMC,SAAS,IAAIV,OAAO;QACzBW,QAAQC,QAAQC,GAAG,CAACC,QAAQ,KAAK,UAAUT,MAAMM,MAAM;IACxD;IAEA,IAAI;QACH,MAAMI,WAAW,MAAMb,GAAGc,QAAQ,CAACV;QACnC,IAAI,CAACS,SAASE,SAAS,CAACC,QAAQ,CAACV,cAAc;YAC9CE,OAAOS,KAAK,CAAC,CAAC,SAAS,EAAEX,YAAY,gBAAgB,CAAC;YACtD,OAAO;QACR;QACA,4CAA4C;QAC5C,IAAIO,SAASK,OAAO,KAAKZ,aAAa;YACrCE,OAAOW,IAAI,CAAC,CAAC,SAAS,EAAEb,YAAY,mBAAmB,CAAC;YACxD,OAAO;QACR;QACA,gEAAgE;QAChE,wEAAwE;QACxE,MAAMc,QAAQ,GAAGb,aAAa,OAAO,CAAC;QACtC,MAAMc,gBAAgB,GAAGhB,cAAc,CAAC,EAAEC,YAAY,MAAM,CAAC;QAC7D,MAAMgB,SAAS,GAAGf,aAAa,QAAQ,CAAC;QACxC,MAAMgB,iBAAiB,GAAGlB,cAAc,CAAC,EAAEC,YAAY,OAAO,CAAC;QAE/D,IAAI,MAAMN,GAAGwB,UAAU,CAACH,gBAAgB;YACvC,MAAMrB,GAAGyB,IAAI,CAACJ,eAAeD,OAAO;gBACnCM,WAAW;YACZ;QACD,OAAO;YACNlB,OAAOW,IAAI,CAAC,CAAC,iCAAiC,EAAEb,YAAY,CAAC,CAAC;QAC/D;QACA,IAAI,MAAMN,GAAGwB,UAAU,CAACD,iBAAiB;YACxC,MAAMvB,GAAGyB,IAAI,CAACF,gBAAgBD,QAAQ;gBACrCI,WAAW;YACZ;QACD,OAAO;YACNlB,OAAOW,IAAI,CAAC,CAAC,kCAAkC,EAAEb,YAAY,CAAC,CAAC;QAChE;QAEA,MAAMqB,cAAc;YACnBZ,WAAWF,SAASE,SAAS;YAC7BG,SAASZ;QACV;QACA,MAAMN,GAAG4B,SAAS,CAACxB,aAAauB,aAAa;YAAEE,QAAQ;QAAE;QACzD,MAAMC,WAAW;YAAC7B,MAAM8B,KAAK,CAAC,CAAC,qBAAqB,EAAEzB,YAAY,CAAC,CAAC;SAAE;QACtE,MAAM,EAAE0B,MAAM,EAAEC,MAAM,EAAE,GAAG,MAAMlC,IAAIH,kBAAkB;YACtDsC,aAAa;QACd;QACA,IAAI,CAACD,QAAQ;YACZH,SAASK,IAAI,IAAItC,iBAAiBmC;QACnC;QACAxB,OAAO4B,QAAQ,CAACN,SAASO,IAAI,CAAC,OAAO;YACpCC,eAAe;YACfC,OAAO;YACPC,aAAa;QACd;QACA,OAAO;IACR,EAAE,OAAOvB,OAAO;QACf,IAAId,MAAMsC,OAAO,EAAE;YAClBjC,OAAOkC,GAAG,CAACzB;QACZ;QACAT,OAAOS,KAAK,CAAC;QACb,OAAO;IACR;AACD,EAAE"}
1
+ {"version":3,"sources":["../../src/utilities/switchProfile.ts"],"sourcesContent":["import { Logger } from \"@node-cli/logger\";\nimport { run } from \"@node-cli/run\";\nimport fs from \"fs-extra\";\nimport kleur from \"kleur\";\nimport { formatRegistries, GET_REGISTRY_CMD } from \"./common.js\";\n\nexport const switchProfile = async ({\n\tflags,\n\tstoreConfig,\n\tstoreLocation,\n\tprofileName,\n\thomeLocation,\n}) => {\n\tconst logger = new Logger({\n\t\tboring: process.env.NODE_ENV === \"test\" || flags.boring,\n\t});\n\n\ttry {\n\t\tconst profiles = await fs.readJson(storeConfig);\n\t\tif (!profiles.available.includes(profileName)) {\n\t\t\tlogger.error(`Profile '${profileName}' does not exist`);\n\t\t\treturn 1;\n\t\t}\n\t\t// if profile is already enabled, do nothing.\n\t\tif (profiles.enabled === profileName) {\n\t\t\tlogger.warn(`Profile '${profileName}' is already active`);\n\t\t\treturn 0;\n\t\t}\n\t\t/**\n\t\t * if profile exists and is not enabled, switch to it by copying the npmrc and\n\t\t * yarnrc files from the profile folder to the home folder.\n\t\t */\n\t\tconst NPMRC = `${homeLocation}/.npmrc`;\n\t\tconst PROFILE_NPMRC = `${storeLocation}/${profileName}/npmrc`;\n\t\tconst YARNRC = `${homeLocation}/.yarnrc`;\n\t\tconst PROFILE_YARNRC = `${storeLocation}/${profileName}/yarnrc`;\n\n\t\tif (await fs.pathExists(PROFILE_NPMRC)) {\n\t\t\tawait fs.copy(PROFILE_NPMRC, NPMRC, {\n\t\t\t\toverwrite: true,\n\t\t\t});\n\t\t} else {\n\t\t\tlogger.warn(`No npmrc file found for profile '${profileName}'`);\n\t\t}\n\t\tif (await fs.pathExists(PROFILE_YARNRC)) {\n\t\t\tawait fs.copy(PROFILE_YARNRC, YARNRC, {\n\t\t\t\toverwrite: true,\n\t\t\t});\n\t\t} else {\n\t\t\tlogger.warn(`No yarnrc file found for profile '${profileName}'`);\n\t\t}\n\n\t\tconst newProfiles = {\n\t\t\tavailable: profiles.available,\n\t\t\tenabled: profileName,\n\t\t};\n\t\tawait fs.writeJson(storeConfig, newProfiles, { spaces: 2 });\n\t\tconst messages = [kleur.green(`Profile switched to '${profileName}'`)];\n\t\tconst { stdout, stderr } = await run(GET_REGISTRY_CMD, {\n\t\t\tignoreError: true,\n\t\t});\n\t\tif (!stderr) {\n\t\t\tmessages.push(...formatRegistries(stdout as string));\n\t\t}\n\t\tlogger.printBox(messages.join(\"\\n\"), {\n\t\t\ttextAlignment: \"left\",\n\t\t\ttitle: \"Profiles\",\n\t\t\tborderColor: \"blue\",\n\t\t});\n\t\treturn 0;\n\t} catch (error) {\n\t\tif (flags.verbose) {\n\t\t\tlogger.log(error);\n\t\t}\n\t\tlogger.error(\"Could not switch profile\");\n\t\treturn 1;\n\t}\n};\n"],"names":["Logger","run","fs","kleur","formatRegistries","GET_REGISTRY_CMD","switchProfile","flags","storeConfig","storeLocation","profileName","homeLocation","logger","boring","process","env","NODE_ENV","profiles","readJson","available","includes","error","enabled","warn","NPMRC","PROFILE_NPMRC","YARNRC","PROFILE_YARNRC","pathExists","copy","overwrite","newProfiles","writeJson","spaces","messages","green","stdout","stderr","ignoreError","push","printBox","join","textAlignment","title","borderColor","verbose","log"],"mappings":"AAAA,SAASA,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,GAAG,QAAQ,gBAAgB;AACpC,OAAOC,QAAQ,WAAW;AAC1B,OAAOC,WAAW,QAAQ;AAC1B,SAASC,gBAAgB,EAAEC,gBAAgB,QAAQ,cAAc;AAEjE,OAAO,MAAMC,gBAAgB,OAAO,EACnCC,KAAK,EACLC,WAAW,EACXC,aAAa,EACbC,WAAW,EACXC,YAAY,EACZ;IACA,MAAMC,SAAS,IAAIZ,OAAO;QACzBa,QAAQC,QAAQC,GAAG,CAACC,QAAQ,KAAK,UAAUT,MAAMM,MAAM;IACxD;IAEA,IAAI;QACH,MAAMI,WAAW,MAAMf,GAAGgB,QAAQ,CAACV;QACnC,IAAI,CAACS,SAASE,SAAS,CAACC,QAAQ,CAACV,cAAc;YAC9CE,OAAOS,KAAK,CAAC,CAAC,SAAS,EAAEX,YAAY,gBAAgB,CAAC;YACtD,OAAO;QACR;QACA,6CAA6C;QAC7C,IAAIO,SAASK,OAAO,KAAKZ,aAAa;YACr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E,OAAOvB,OAAO;QACf,IAAId,MAAMsC,OAAO,EAAE;YAClBjC,OAAOkC,GAAG,CAACzB;QACZ;QACAT,OAAOS,KAAK,CAAC;QACb,OAAO;IACR;AACD,EAAE"}
@@ -1,18 +1,18 @@
1
- import { GET_REGISTRY_CMD, formatRegistries } from "./common.js";
2
1
  import { Logger } from "@node-cli/logger";
3
2
  import { run } from "@node-cli/run";
4
3
  import fs from "fs-extra";
5
4
  import kleur from "kleur";
5
+ import { formatRegistries, GET_REGISTRY_CMD } from "./common.js";
6
6
  export const updateProfile = async ({ flags, storeConfig, storeLocation, homeLocation })=>{
7
7
  const logger = new Logger({
8
8
  boring: process.env.NODE_ENV === "test" || flags.boring
9
9
  });
10
10
  let profiles;
11
- // Step 1: check if there is an active profile
11
+ // Step 1: check if there is an active profile.
12
12
  try {
13
13
  profiles = await fs.readJson(storeConfig);
14
14
  } catch {
15
- // ignoring error since we are going to create the file
15
+ // ignoring error since we are going to create the file.
16
16
  }
17
17
  if (profiles?.available?.length > 0) {
18
18
  const profileName = profiles.enabled;
@@ -21,17 +21,17 @@ export const updateProfile = async ({ flags, storeConfig, storeLocation, homeLoc
21
21
  kleur.green(`Profile '${profileName}' updated`)
22
22
  ];
23
23
  /**
24
- * Step2: since there is an active profile, we can check the
25
- * global registries and list them, alongside the updated profile.
24
+ * Step2: since there is an active profile, we can check the global
25
+ * registries and list them, alongside the updated profile.
26
26
  */ const { stdout, stderr } = await run(GET_REGISTRY_CMD, {
27
27
  ignoreError: true
28
28
  });
29
29
  if (!stderr) {
30
30
  messages.push(...formatRegistries(stdout));
31
31
  }
32
- // Step 3: update the active profile
32
+ // Step 3: update the active profile.
33
33
  await fs.ensureDir(`${storeLocation}/${profileName}`);
34
- // copy the existing npmrc / yarnrc files to the storage folder
34
+ // copy the existing npmrc / yarnrc files to the storage folder.
35
35
  const NPMRC = `${homeLocation}/.npmrc`;
36
36
  const YARNRC = `${homeLocation}/.yarnrc`;
37
37
  if (await fs.pathExists(YARNRC)) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utilities/updateProfile.ts"],"sourcesContent":["import { GET_REGISTRY_CMD, formatRegistries } from \"./common.js\";\n\nimport { Logger } from \"@node-cli/logger\";\nimport { run } from \"@node-cli/run\";\nimport fs from \"fs-extra\";\nimport kleur from \"kleur\";\n\nexport const updateProfile = async ({\n\tflags,\n\tstoreConfig,\n\tstoreLocation,\n\thomeLocation,\n}) => {\n\tconst logger = new Logger({\n\t\tboring: process.env.NODE_ENV === \"test\" || flags.boring,\n\t});\n\n\tlet profiles: { available: string | any[]; enabled: any };\n\n\t// Step 1: check if there is an active profile\n\ttry {\n\t\tprofiles = await fs.readJson(storeConfig);\n\t} catch {\n\t\t// ignoring error since we are going to create the file\n\t}\n\n\tif (profiles?.available?.length > 0) {\n\t\tconst profileName = profiles.enabled;\n\t\tif (profileName) {\n\t\t\tconst messages = [kleur.green(`Profile '${profileName}' updated`)];\n\t\t\t/**\n\t\t\t * Step2: since there is an active profile, we can check the\n\t\t\t * global registries and list them, alongside the updated profile.\n\t\t\t */\n\t\t\tconst { stdout, stderr } = await run(GET_REGISTRY_CMD, {\n\t\t\t\tignoreError: true,\n\t\t\t});\n\t\t\tif (!stderr) {\n\t\t\t\tmessages.push(...formatRegistries(stdout as string));\n\t\t\t}\n\n\t\t\t// Step 3: update the active profile\n\t\t\tawait fs.ensureDir(`${storeLocation}/${profileName}`);\n\t\t\t// copy the existing npmrc / yarnrc files to the storage folder\n\t\t\tconst NPMRC = `${homeLocation}/.npmrc`;\n\t\t\tconst YARNRC = `${homeLocation}/.yarnrc`;\n\t\t\tif (await fs.pathExists(YARNRC)) {\n\t\t\t\tawait fs.copy(YARNRC, `${storeLocation}/${profileName}/yarnrc`);\n\t\t\t}\n\t\t\tif (await fs.pathExists(NPMRC)) {\n\t\t\t\tawait fs.copy(NPMRC, `${storeLocation}/${profileName}/npmrc`);\n\t\t\t}\n\t\t\tlogger.printBox(messages.join(\"\\n\"), {\n\t\t\t\ttextAlignment: \"left\",\n\t\t\t\ttitle: \"Profiles\",\n\t\t\t\tborderColor: \"blue\",\n\t\t\t});\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\tlogger.warn(\n\t\t\"Only active profiles can be updated. Please switch to the profile you want to update.\",\n\t);\n\treturn 0;\n};\n"],"names":["GET_REGISTRY_CMD","formatRegistries","Logger","run","fs","kleur","updateProfile","flags","storeConfig","storeLocation","homeLocation","logger","boring","process","env","NODE_ENV","profiles","readJson","available","length","profileName","enabled","messages","green","stdout","stderr","ignoreError","push","ensureDir","NPMRC","YARNRC","pathExists","copy","printBox","join","textAlignment","title","borderColor","warn"],"mappings":"AAAA,SAASA,gBAAgB,EAAEC,gBAAgB,QAAQ,cAAc;AAEjE,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,GAAG,QAAQ,gBAAgB;AACpC,OAAOC,QAAQ,WAAW;AAC1B,OAAOC,WAAW,QAAQ;AAE1B,OAAO,MAAMC,gBAAgB,OAAO,EACnCC,KAAK,EACLC,WAAW,EACXC,aAAa,EACbC,YAAY,EACZ;IACA,MAAMC,SAAS,IAAIT,OAAO;QACzBU,QAAQC,QAAQC,GAAG,CAACC,QAAQ,KAAK,UAAUR,MAAMK,MAAM;IACxD;IAEA,IAAII;IAEJ,8CAA8C;IAC9C,IAAI;QACHA,WAAW,MAAMZ,GAAGa,QAAQ,CAACT;IAC9B,EAAE,OAAM;IACP,uDAAuD;IACxD;IAEA,IAAIQ,UAAUE,WAAWC,SAAS,GAAG;QACpC,MAAMC,cAAcJ,SAASK,OAAO;QACpC,IAAID,aAAa;YAChB,MAAME,WAAW;gBAACjB,MAAMkB,KAAK,CAAC,CAAC,SAAS,EAAEH,YAAY,SAAS,CAAC;aAAE;YAClE;;;IAGC,GACD,MAAM,EAAEI,MAAM,EAAEC,MAAM,EAAE,GAAG,MAAMtB,IAAIH,kBAAkB;gBACtD0B,aAAa;YACd;YACA,IAAI,CAACD,QAAQ;gBACZH,SAASK,IAAI,IAAI1B,iBAAiBuB;YACnC;YAEA,oCAAoC;YACpC,MAAMpB,GAAGwB,SAAS,CAAC,GAAGnB,cAAc,CAAC,EAAEW,aAAa;YACpD,+DAA+D;YAC/D,MAAMS,QAAQ,GAAGnB,aAAa,OAAO,CAAC;YACtC,MAAMoB,SAAS,GAAGpB,aAAa,QAAQ,CAAC;YACxC,IAAI,MAAMN,GAAG2B,UAAU,CAACD,SAAS;gBAChC,MAAM1B,GAAG4B,IAAI,CAACF,QAAQ,GAAGrB,cAAc,CAAC,EAAEW,YAAY,OAAO,CAAC;YAC/D;YACA,IAAI,MAAMhB,GAAG2B,UAAU,CAACF,QAAQ;gBAC/B,MAAMzB,GAAG4B,IAAI,CAACH,OAAO,GAAGpB,cAAc,CAAC,EAAEW,YAAY,MAAM,CAAC;YAC7D;YACAT,OAAOsB,QAAQ,CAACX,SAASY,IAAI,CAAC,OAAO;gBACpCC,eAAe;gBACfC,OAAO;gBACPC,aAAa;YACd;YACA,OAAO;QACR;IACD;IAEA1B,OAAO2B,IAAI,CACV;IAED,OAAO;AACR,EAAE"}
1
+ {"version":3,"sources":["../../src/utilities/updateProfile.ts"],"sourcesContent":["import { Logger } from \"@node-cli/logger\";\nimport { run } from \"@node-cli/run\";\nimport fs from \"fs-extra\";\nimport kleur from \"kleur\";\nimport { formatRegistries, GET_REGISTRY_CMD } from \"./common.js\";\n\nexport const updateProfile = async ({\n\tflags,\n\tstoreConfig,\n\tstoreLocation,\n\thomeLocation,\n}) => {\n\tconst logger = new Logger({\n\t\tboring: process.env.NODE_ENV === \"test\" || flags.boring,\n\t});\n\n\tlet profiles: { available: string | any[]; enabled: any };\n\n\t// Step 1: check if there is an active profile.\n\ttry {\n\t\tprofiles = await fs.readJson(storeConfig);\n\t} catch {\n\t\t// ignoring error since we are going to create the file.\n\t}\n\n\tif (profiles?.available?.length > 0) {\n\t\tconst profileName = profiles.enabled;\n\t\tif (profileName) {\n\t\t\tconst messages = [kleur.green(`Profile '${profileName}' updated`)];\n\t\t\t/**\n\t\t\t * Step2: since there is an active profile, we can check the global\n\t\t\t * registries and list them, alongside the updated profile.\n\t\t\t */\n\t\t\tconst { stdout, stderr } = await run(GET_REGISTRY_CMD, {\n\t\t\t\tignoreError: true,\n\t\t\t});\n\t\t\tif (!stderr) {\n\t\t\t\tmessages.push(...formatRegistries(stdout as string));\n\t\t\t}\n\n\t\t\t// Step 3: update the active profile.\n\t\t\tawait fs.ensureDir(`${storeLocation}/${profileName}`);\n\t\t\t// copy the existing npmrc / yarnrc files to the storage folder.\n\t\t\tconst NPMRC = `${homeLocation}/.npmrc`;\n\t\t\tconst YARNRC = `${homeLocation}/.yarnrc`;\n\t\t\tif (await fs.pathExists(YARNRC)) {\n\t\t\t\tawait fs.copy(YARNRC, `${storeLocation}/${profileName}/yarnrc`);\n\t\t\t}\n\t\t\tif (await fs.pathExists(NPMRC)) {\n\t\t\t\tawait fs.copy(NPMRC, `${storeLocation}/${profileName}/npmrc`);\n\t\t\t}\n\t\t\tlogger.printBox(messages.join(\"\\n\"), {\n\t\t\t\ttextAlignment: \"left\",\n\t\t\t\ttitle: \"Profiles\",\n\t\t\t\tborderColor: \"blue\",\n\t\t\t});\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\tlogger.warn(\n\t\t\"Only active profiles can be updated. Please switch to the profile you want to update.\",\n\t);\n\treturn 0;\n};\n"],"names":["Logger","run","fs","kleur","formatRegistries","GET_REGISTRY_CMD","updateProfile","flags","storeConfig","storeLocation","homeLocation","logger","boring","process","env","NODE_ENV","profiles","readJson","available","length","profileName","enabled","messages","green","stdout","stderr","ignoreError","push","ensureDir","NPMRC","YARNRC","pathExists","copy","printBox","join","textAlignment","title","borderColor","warn"],"mappings":"AAAA,SAASA,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,GAAG,QAAQ,gBAAgB;AACpC,OAAOC,QAAQ,WAAW;AAC1B,OAAOC,WAAW,QAAQ;AAC1B,SAASC,gBAAgB,EAAEC,gBAAgB,QAAQ,cAAc;AAE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,aAAa;YACd;YACA,OAAO;QACR;IACD;IAEA1B,OAAO2B,IAAI,CACV;IAED,OAAO;AACR,EAAE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-cli/npmrc",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "license": "MIT",
5
5
  "author": "Arno Versini",
6
6
  "description": "Toggle different npmrc configuration files on the fly",
@@ -9,7 +9,8 @@
9
9
  "exports": "./dist/npmrc.js",
10
10
  "bin": "dist/npmrc.js",
11
11
  "files": [
12
- "dist"
12
+ "dist",
13
+ "README.md"
13
14
  ],
14
15
  "node": ">=18",
15
16
  "scripts": {
@@ -18,25 +19,28 @@
18
19
  "build:js": "swc --strip-leading-paths --source-maps --out-dir dist src",
19
20
  "build:types": "tsc",
20
21
  "clean": "rimraf dist types coverage",
22
+ "comments:fix": "comments --merge-line-comments 'src/**/*.ts'",
21
23
  "lint": "biome lint src",
24
+ "lint:fix": "biome check src --write --no-errors-on-unmatched",
22
25
  "test": "vitest run --globals",
23
26
  "test:coverage": "vitest run --coverage --globals",
24
27
  "test:watch": "vitest --globals",
25
28
  "watch": "swc --strip-leading-paths --watch --out-dir dist src"
26
29
  },
27
30
  "dependencies": {
28
- "@node-cli/logger": "1.3.1",
29
- "@node-cli/parser": "2.4.1",
30
- "@node-cli/run": "1.1.3",
31
- "fs-extra": "11.3.0",
31
+ "@node-cli/logger": "../logger",
32
+ "@node-cli/parser": "../parser",
33
+ "@node-cli/run": "../run",
34
+ "fs-extra": "11.3.1",
32
35
  "kleur": "4.1.5"
33
36
  },
34
37
  "publishConfig": {
35
38
  "access": "public"
36
39
  },
37
40
  "devDependencies": {
41
+ "@node-cli/comments": "0.2.0",
38
42
  "@vitest/coverage-v8": "3.2.4",
39
43
  "vitest": "3.2.4"
40
44
  },
41
- "gitHead": "2cef8f88aa5316a1789caad2bd7327ca908ccb9f"
45
+ "gitHead": "d90392dcb766dd605bc3eeabc7c7a7ab0c8e6da6"
42
46
  }