@tscircuit/cli 0.1.22 → 0.1.23
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/bun.lock +2260 -0
- package/cli/init/register.ts +80 -3
- package/dist/main.js +61 -6
- package/example-dir/snippet2-large-led-matrix.tsx +1 -1
- package/example-dir/tsconfig.json +17 -0
- package/example-dir/types.d.ts +20 -0
- package/package.json +3 -3
- package/tests/cli/init/init.test.ts +34 -0
- package/bun.lockb +0 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { getCliTestFixture } from "../../fixtures/get-cli-test-fixture"
|
|
2
|
+
import { test, expect } from "bun:test"
|
|
3
|
+
import { join } from "node:path"
|
|
4
|
+
import { execSync } from "node:child_process"
|
|
5
|
+
|
|
6
|
+
test("init command installs @types/react and passes type-checking", async () => {
|
|
7
|
+
const { tmpDir, runCommand } = await getCliTestFixture()
|
|
8
|
+
|
|
9
|
+
const { stdout } = await runCommand("tsci init")
|
|
10
|
+
console.log(stdout)
|
|
11
|
+
|
|
12
|
+
const pkgJsonPath = join(tmpDir, "package.json")
|
|
13
|
+
const pkgJson = JSON.parse(await Bun.file(pkgJsonPath).text())
|
|
14
|
+
expect(pkgJson.devDependencies["@types/react"]).toBeDefined()
|
|
15
|
+
expect(pkgJson.devDependencies["@tscircuit/core"]).toBeDefined()
|
|
16
|
+
|
|
17
|
+
const npmrcPath = join(tmpDir, ".npmrc")
|
|
18
|
+
const npmrcContent = await Bun.file(npmrcPath).text()
|
|
19
|
+
expect(npmrcContent).toContain("@tsci:registry=https://npm.tscircuit.com")
|
|
20
|
+
|
|
21
|
+
const tsconfigPath = join(tmpDir, "tsconfig.json")
|
|
22
|
+
const tsconfigExists = await Bun.file(tsconfigPath).exists()
|
|
23
|
+
expect(tsconfigExists).toBeTrue()
|
|
24
|
+
|
|
25
|
+
try {
|
|
26
|
+
const typeCheckResult = execSync("npx tsc --noEmit", {
|
|
27
|
+
cwd: tmpDir,
|
|
28
|
+
stdio: "pipe",
|
|
29
|
+
})
|
|
30
|
+
console.log(typeCheckResult.toString())
|
|
31
|
+
} catch (error) {
|
|
32
|
+
throw new Error("Type-checking failed")
|
|
33
|
+
}
|
|
34
|
+
})
|
package/bun.lockb
DELETED
|
Binary file
|