@tscircuit/cli 0.1.729 → 0.1.731
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 +40 -10
- package/package.json +1 -1
- package/types/tscircuit.config.schema.json +4 -0
package/dist/main.js
CHANGED
|
@@ -73245,6 +73245,7 @@ var projectConfigSchema = z.object({
|
|
|
73245
73245
|
ignoredFiles: z.array(z.string()).optional(),
|
|
73246
73246
|
includeBoardFiles: z.array(z.string()).optional(),
|
|
73247
73247
|
snapshotsDir: z.string().optional(),
|
|
73248
|
+
prebuildCommand: z.string().optional(),
|
|
73248
73249
|
buildCommand: z.string().optional(),
|
|
73249
73250
|
build: z.object({
|
|
73250
73251
|
circuitJson: z.boolean().optional(),
|
|
@@ -74124,7 +74125,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
|
|
|
74124
74125
|
import { execSync as execSync2 } from "node:child_process";
|
|
74125
74126
|
var import_semver2 = __toESM2(require_semver2(), 1);
|
|
74126
74127
|
// package.json
|
|
74127
|
-
var version = "0.1.
|
|
74128
|
+
var version = "0.1.730";
|
|
74128
74129
|
var package_default = {
|
|
74129
74130
|
name: "@tscircuit/cli",
|
|
74130
74131
|
version,
|
|
@@ -79934,9 +79935,13 @@ Manual setup instructions:`));
|
|
|
79934
79935
|
console.log(`
|
|
79935
79936
|
2. Add the following line:`);
|
|
79936
79937
|
console.log(kleur_default.cyan(` //${REGISTRY_URL}/:_authToken=${sessionToken}`));
|
|
79938
|
+
console.log(`
|
|
79939
|
+
3. Ensure the following line is also present:`);
|
|
79940
|
+
console.log(kleur_default.cyan(` @tsci:registry=https://${REGISTRY_URL}/`));
|
|
79937
79941
|
}
|
|
79938
79942
|
function setupNpmrc(sessionToken) {
|
|
79939
79943
|
const authLine = `//${REGISTRY_URL}/:_authToken=${sessionToken}`;
|
|
79944
|
+
const registryLine = `@tsci:registry=https://${REGISTRY_URL}/`;
|
|
79940
79945
|
const npmrcPath = findGlobalNpmrc();
|
|
79941
79946
|
if (!npmrcPath) {
|
|
79942
79947
|
console.log(kleur_default.red("Could not find your global .npmrc file location."));
|
|
@@ -79947,13 +79952,33 @@ function setupNpmrc(sessionToken) {
|
|
|
79947
79952
|
let existingContent = "";
|
|
79948
79953
|
if (fs22.existsSync(npmrcPath)) {
|
|
79949
79954
|
existingContent = fs22.readFileSync(npmrcPath, "utf-8");
|
|
79950
|
-
|
|
79951
|
-
|
|
79952
|
-
|
|
79953
|
-
|
|
79954
|
-
|
|
79955
|
-
|
|
79955
|
+
}
|
|
79956
|
+
let registryAdded = false;
|
|
79957
|
+
const registryRegex = new RegExp(`^${registryLine.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`, "m");
|
|
79958
|
+
if (!registryRegex.test(existingContent)) {
|
|
79959
|
+
if (existingContent) {
|
|
79960
|
+
if (existingContent.endsWith(`
|
|
79961
|
+
`)) {
|
|
79962
|
+
existingContent += `${registryLine}
|
|
79963
|
+
`;
|
|
79964
|
+
} else {
|
|
79965
|
+
existingContent += `
|
|
79966
|
+
${registryLine}
|
|
79967
|
+
`;
|
|
79968
|
+
}
|
|
79969
|
+
} else {
|
|
79970
|
+
existingContent = `${registryLine}
|
|
79971
|
+
`;
|
|
79956
79972
|
}
|
|
79973
|
+
registryAdded = true;
|
|
79974
|
+
}
|
|
79975
|
+
const authLineRegex = new RegExp(`^//${REGISTRY_URL.replace(/\./g, "\\.")}/:_authToken=.+$`, "m");
|
|
79976
|
+
if (authLineRegex.test(existingContent)) {
|
|
79977
|
+
const updatedContent = existingContent.replace(authLineRegex, authLine);
|
|
79978
|
+
fs22.writeFileSync(npmrcPath, updatedContent, "utf-8");
|
|
79979
|
+
console.log(kleur_default.green(`Updated authentication token in ${npmrcPath}`) + (registryAdded ? `
|
|
79980
|
+
${kleur_default.green(`Added registry setting to ${npmrcPath}`)}` : ""));
|
|
79981
|
+
return true;
|
|
79957
79982
|
}
|
|
79958
79983
|
const newContent = existingContent ? existingContent.endsWith(`
|
|
79959
79984
|
`) ? `${existingContent}${authLine}
|
|
@@ -79962,7 +79987,11 @@ ${authLine}
|
|
|
79962
79987
|
` : `${authLine}
|
|
79963
79988
|
`;
|
|
79964
79989
|
fs22.writeFileSync(npmrcPath, newContent, "utf-8");
|
|
79965
|
-
|
|
79990
|
+
if (registryAdded) {
|
|
79991
|
+
console.log(kleur_default.green(`Added authentication token and registry setting to ${npmrcPath}`));
|
|
79992
|
+
} else {
|
|
79993
|
+
console.log(kleur_default.green(`Added authentication token to ${npmrcPath}`));
|
|
79994
|
+
}
|
|
79966
79995
|
return true;
|
|
79967
79996
|
} catch (error) {
|
|
79968
79997
|
console.log(kleur_default.red(`Could not modify .npmrc file: ${error instanceof Error ? error.message : String(error)}`));
|
|
@@ -84787,11 +84816,12 @@ var availableGlobalConfigKeys = [
|
|
|
84787
84816
|
var availableProjectConfigKeys = [
|
|
84788
84817
|
"mainEntrypoint",
|
|
84789
84818
|
"previewComponentPath",
|
|
84819
|
+
"prebuildCommand",
|
|
84790
84820
|
"buildCommand"
|
|
84791
84821
|
];
|
|
84792
84822
|
var registerConfigSet = (program3) => {
|
|
84793
84823
|
const configCommand = program3.commands.find((c) => c.name() === "config");
|
|
84794
|
-
configCommand.command("set").description("Set a configuration value (global or project-specific)").argument("<key>", "Configuration key (e.g., alwaysCloneWithAuthorName, mainEntrypoint, previewComponentPath, buildCommand)").argument("<value>", "Value to set").action((key, value) => {
|
|
84824
|
+
configCommand.command("set").description("Set a configuration value (global or project-specific)").argument("<key>", "Configuration key (e.g., alwaysCloneWithAuthorName, mainEntrypoint, previewComponentPath, prebuildCommand, buildCommand)").argument("<value>", "Value to set").action((key, value) => {
|
|
84795
84825
|
if (availableGlobalConfigKeys.some((k) => k === key)) {
|
|
84796
84826
|
if (key === "alwaysCloneWithAuthorName") {
|
|
84797
84827
|
const booleanValue = value.toLowerCase() === "true";
|
|
@@ -84800,7 +84830,7 @@ var registerConfigSet = (program3) => {
|
|
|
84800
84830
|
}
|
|
84801
84831
|
} else if (availableProjectConfigKeys.some((k) => k === key)) {
|
|
84802
84832
|
const projectDir = process.cwd();
|
|
84803
|
-
if (key === "mainEntrypoint" || key === "previewComponentPath" || key === "buildCommand") {
|
|
84833
|
+
if (key === "mainEntrypoint" || key === "previewComponentPath" || key === "prebuildCommand" || key === "buildCommand") {
|
|
84804
84834
|
const projectConfig = loadProjectConfig(projectDir) ?? {};
|
|
84805
84835
|
projectConfig[key] = value;
|
|
84806
84836
|
if (saveProjectConfig(projectConfig, projectDir)) {
|
package/package.json
CHANGED
|
@@ -36,6 +36,10 @@
|
|
|
36
36
|
"type": "string",
|
|
37
37
|
"description": "Directory path for storing snapshots."
|
|
38
38
|
},
|
|
39
|
+
"prebuildCommand": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"description": "Command to run before builds."
|
|
42
|
+
},
|
|
39
43
|
"buildCommand": {
|
|
40
44
|
"type": "string",
|
|
41
45
|
"description": "Override command used for cloud builds."
|