@tscircuit/cli 0.1.729 → 0.1.730
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/dist/main.js +36 -8
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -74124,7 +74124,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
|
|
|
74124
74124
|
import { execSync as execSync2 } from "node:child_process";
|
|
74125
74125
|
var import_semver2 = __toESM2(require_semver2(), 1);
|
|
74126
74126
|
// package.json
|
|
74127
|
-
var version = "0.1.
|
|
74127
|
+
var version = "0.1.729";
|
|
74128
74128
|
var package_default = {
|
|
74129
74129
|
name: "@tscircuit/cli",
|
|
74130
74130
|
version,
|
|
@@ -79934,9 +79934,13 @@ Manual setup instructions:`));
|
|
|
79934
79934
|
console.log(`
|
|
79935
79935
|
2. Add the following line:`);
|
|
79936
79936
|
console.log(kleur_default.cyan(` //${REGISTRY_URL}/:_authToken=${sessionToken}`));
|
|
79937
|
+
console.log(`
|
|
79938
|
+
3. Ensure the following line is also present:`);
|
|
79939
|
+
console.log(kleur_default.cyan(` @tsci:registry=https://${REGISTRY_URL}/`));
|
|
79937
79940
|
}
|
|
79938
79941
|
function setupNpmrc(sessionToken) {
|
|
79939
79942
|
const authLine = `//${REGISTRY_URL}/:_authToken=${sessionToken}`;
|
|
79943
|
+
const registryLine = `@tsci:registry=https://${REGISTRY_URL}/`;
|
|
79940
79944
|
const npmrcPath = findGlobalNpmrc();
|
|
79941
79945
|
if (!npmrcPath) {
|
|
79942
79946
|
console.log(kleur_default.red("Could not find your global .npmrc file location."));
|
|
@@ -79947,13 +79951,33 @@ function setupNpmrc(sessionToken) {
|
|
|
79947
79951
|
let existingContent = "";
|
|
79948
79952
|
if (fs22.existsSync(npmrcPath)) {
|
|
79949
79953
|
existingContent = fs22.readFileSync(npmrcPath, "utf-8");
|
|
79950
|
-
|
|
79951
|
-
|
|
79952
|
-
|
|
79953
|
-
|
|
79954
|
-
|
|
79955
|
-
|
|
79954
|
+
}
|
|
79955
|
+
let registryAdded = false;
|
|
79956
|
+
const registryRegex = new RegExp(`^${registryLine.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`, "m");
|
|
79957
|
+
if (!registryRegex.test(existingContent)) {
|
|
79958
|
+
if (existingContent) {
|
|
79959
|
+
if (existingContent.endsWith(`
|
|
79960
|
+
`)) {
|
|
79961
|
+
existingContent += `${registryLine}
|
|
79962
|
+
`;
|
|
79963
|
+
} else {
|
|
79964
|
+
existingContent += `
|
|
79965
|
+
${registryLine}
|
|
79966
|
+
`;
|
|
79967
|
+
}
|
|
79968
|
+
} else {
|
|
79969
|
+
existingContent = `${registryLine}
|
|
79970
|
+
`;
|
|
79956
79971
|
}
|
|
79972
|
+
registryAdded = true;
|
|
79973
|
+
}
|
|
79974
|
+
const authLineRegex = new RegExp(`^//${REGISTRY_URL.replace(/\./g, "\\.")}/:_authToken=.+$`, "m");
|
|
79975
|
+
if (authLineRegex.test(existingContent)) {
|
|
79976
|
+
const updatedContent = existingContent.replace(authLineRegex, authLine);
|
|
79977
|
+
fs22.writeFileSync(npmrcPath, updatedContent, "utf-8");
|
|
79978
|
+
console.log(kleur_default.green(`Updated authentication token in ${npmrcPath}`) + (registryAdded ? `
|
|
79979
|
+
${kleur_default.green(`Added registry setting to ${npmrcPath}`)}` : ""));
|
|
79980
|
+
return true;
|
|
79957
79981
|
}
|
|
79958
79982
|
const newContent = existingContent ? existingContent.endsWith(`
|
|
79959
79983
|
`) ? `${existingContent}${authLine}
|
|
@@ -79962,7 +79986,11 @@ ${authLine}
|
|
|
79962
79986
|
` : `${authLine}
|
|
79963
79987
|
`;
|
|
79964
79988
|
fs22.writeFileSync(npmrcPath, newContent, "utf-8");
|
|
79965
|
-
|
|
79989
|
+
if (registryAdded) {
|
|
79990
|
+
console.log(kleur_default.green(`Added authentication token and registry setting to ${npmrcPath}`));
|
|
79991
|
+
} else {
|
|
79992
|
+
console.log(kleur_default.green(`Added authentication token to ${npmrcPath}`));
|
|
79993
|
+
}
|
|
79966
79994
|
return true;
|
|
79967
79995
|
} catch (error) {
|
|
79968
79996
|
console.log(kleur_default.red(`Could not modify .npmrc file: ${error instanceof Error ? error.message : String(error)}`));
|