@tscircuit/cli 0.0.104 → 0.0.105

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.
@@ -15,6 +15,8 @@ import ignore from "ignore"
15
15
  export const getAllPackageFiles = async (
16
16
  ctx: AppContext
17
17
  ): Promise<Array<string>> => {
18
+ await ensureNodeModulesIgnored();
19
+
18
20
  const gitignore = await fs
19
21
  .readFile("./.gitignore")
20
22
  .then((b) => b.toString().split("\n").filter(Boolean))
@@ -33,3 +35,23 @@ export const getAllPackageFiles = async (
33
35
 
34
36
  return Glob.globSync("**/*.{ts,tsx,md}", {}).filter((fp) => !ig.ignores(fp))
35
37
  }
38
+
39
+ /**
40
+ * Ensure 'node_modules/' is in .gitignore
41
+ */
42
+ const ensureNodeModulesIgnored = async () => {
43
+ const gitignorePath = './.gitignore';
44
+
45
+ try {
46
+ const gitignore = await fs.readFile(gitignorePath, 'utf8');
47
+ if (!gitignore.includes('node_modules/')) {
48
+ await fs.appendFile(gitignorePath, '\nnode_modules/\n');
49
+ }
50
+ } catch (err) {
51
+ if (err.code === 'ENOENT') {
52
+ await fs.writeFile(gitignorePath, 'node_modules/\n');
53
+ } else {
54
+ console.error('Error while updating .gitignore:', err);
55
+ }
56
+ }
57
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.0.104",
3
+ "version": "0.0.105",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Command line tool for developing, publishing and installing tscircuit circuits",