@tscircuit/cli 0.0.143 → 0.0.145
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/.github/workflows/formatbot.yml +41 -0
- package/biome.json +44 -0
- package/bun.lockb +0 -0
- package/dev-server-api/bun.lockb +0 -0
- package/dev-server-api/routes/api/db/download.ts +2 -2
- package/dev-server-api/routes/api/dev_package_examples/get.ts +1 -1
- package/dev-server-api/routes/api/dev_package_examples/list.ts +2 -2
- package/dev-server-api/routes/api/dev_package_examples/update.ts +1 -1
- package/dev-server-api/routes/api/export_requests/get.ts +2 -2
- package/dev-server-api/routes/index.ts +1 -1
- package/dev-server-api/server.ts +1 -1
- package/dev-server-api/src/db/create-schema.ts +4 -4
- package/dev-server-api/src/db/generic-json-level.ts +2 -2
- package/dev-server-api/src/db/zod-level-db.ts +9 -9
- package/dev-server-api/src/middlewares/with-debug-request-logging.ts +1 -1
- package/dev-server-api/src/middlewares/with-error-response.ts +2 -2
- package/dev-server-api/tests/fixtures/start-server.ts +1 -1
- package/dev-server-api/tests/routes/dev_package_examples/create.test.ts +1 -1
- package/dev-server-api/tests/routes/dev_package_examples/get.test.ts +1 -1
- package/dev-server-api/tests/routes/dev_package_examples/list.test.ts +1 -1
- package/dev-server-api/tests/routes/dev_package_examples/update.test.ts +2 -2
- package/dev-server-api/tests/routes/export_files/download.test.ts +2 -2
- package/dev-server-api/tests/routes/export_requests/create.test.ts +1 -1
- package/dev-server-api/tests/routes/export_requests/get.test.ts +1 -1
- package/dev-server-frontend/.eslintrc.cjs +10 -10
- package/dev-server-frontend/components.json +1 -1
- package/dev-server-frontend/src/ExampleContentView.tsx +2 -2
- package/dev-server-frontend/src/HeaderMenu.tsx +2 -7
- package/dev-server-frontend/src/components/command-k.tsx +1 -1
- package/dev-server-frontend/src/components/dialogs/generic-export-dialog.tsx +3 -3
- package/dev-server-frontend/src/components/dialogs/gerber-export-dialog.tsx +3 -3
- package/dev-server-frontend/src/components/select-example-search.tsx +1 -1
- package/dev-server-frontend/src/components/ui/alert-dialog.tsx +5 -5
- package/dev-server-frontend/src/components/ui/alert.tsx +1 -1
- package/dev-server-frontend/src/components/ui/breadcrumb.tsx +1 -1
- package/dev-server-frontend/src/components/ui/button.tsx +2 -2
- package/dev-server-frontend/src/components/ui/card.tsx +1 -1
- package/dev-server-frontend/src/components/ui/command.tsx +5 -5
- package/dev-server-frontend/src/components/ui/context-menu.tsx +8 -8
- package/dev-server-frontend/src/components/ui/dialog.tsx +5 -5
- package/dev-server-frontend/src/components/ui/menubar.tsx +12 -12
- package/dev-server-frontend/src/components/ui/navigation-menu.tsx +6 -6
- package/dev-server-frontend/src/components/ui/popover.tsx +1 -1
- package/dev-server-frontend/src/components/ui/select.tsx +6 -6
- package/dev-server-frontend/src/components/ui/tabs.tsx +3 -3
- package/dev-server-frontend/src/components/ui/toggle-group.tsx +1 -1
- package/dev-server-frontend/src/components/ui/toggle.tsx +1 -1
- package/dev-server-frontend/src/components/ui/tooltip.tsx +1 -1
- package/dev-server-frontend/src/hooks/use-active-dev-package-example-lite.ts +2 -2
- package/dev-server-frontend/src/main.tsx +1 -1
- package/dev-server-frontend/tailwind.config.js +5 -5
- package/dev-server-frontend/tsconfig.json +1 -1
- package/dist/cli.js +25 -10
- package/example-project/src/manual-edits.ts +34 -34
- package/lib/cmd-fns/add.ts +1 -1
- package/lib/cmd-fns/auth-login.ts +2 -2
- package/lib/cmd-fns/dev/check-if-initialized.ts +1 -1
- package/lib/cmd-fns/dev/derive-selector-from-pcb-component-id.ts +1 -1
- package/lib/cmd-fns/dev/dev-server-request-handler.ts +3 -3
- package/lib/cmd-fns/dev/find-available-port.ts +7 -5
- package/lib/cmd-fns/dev/fulfill-export-requests.ts +14 -14
- package/lib/cmd-fns/dev/get-dev-server-axios.ts +3 -3
- package/lib/cmd-fns/dev/index.ts +3 -3
- package/lib/cmd-fns/dev/infer-export-name-from-source.ts +2 -2
- package/lib/cmd-fns/dev/soupify-and-upload-example-file.ts +4 -4
- package/lib/cmd-fns/dev/start-edit-event-watcher.ts +37 -38
- package/lib/cmd-fns/dev/start-export-request-watcher.ts +2 -3
- package/lib/cmd-fns/dev/start-fs-watcher.ts +1 -1
- package/lib/cmd-fns/dev/upload-examples-from-directory.ts +2 -2
- package/lib/cmd-fns/dev-server-fulfill-export-requests.ts +3 -3
- package/lib/cmd-fns/dev-server-upload.ts +3 -3
- package/lib/cmd-fns/export-gerbers.ts +1 -1
- package/lib/cmd-fns/init/create-or-modify-npmrc.ts +1 -1
- package/lib/cmd-fns/init/index.ts +12 -8
- package/lib/cmd-fns/lint.ts +15 -9
- package/lib/cmd-fns/package-examples-create.ts +1 -1
- package/lib/cmd-fns/package-files-create.ts +1 -1
- package/lib/cmd-fns/package-files-upload-directory.ts +1 -1
- package/lib/cmd-fns/package-releases-create.ts +1 -1
- package/lib/cmd-fns/package-releases-list.ts +1 -1
- package/lib/cmd-fns/publish/index.ts +33 -33
- package/lib/cmd-fns/remove.ts +1 -1
- package/lib/cmd-fns/soupify.ts +1 -1
- package/lib/cmd-fns/version.ts +1 -1
- package/lib/create-config-manager.ts +1 -1
- package/lib/export-fns/export-bom-csv.ts +2 -2
- package/lib/export-fns/export-gerbers.ts +5 -5
- package/lib/export-fns/export-pnp-csv.ts +2 -2
- package/lib/get-program.ts +17 -17
- package/lib/param-handlers/interact-for-package-release-id.ts +2 -3
- package/lib/param-handlers/interact-for-runtime.ts +1 -1
- package/lib/posthog.ts +6 -7
- package/lib/soupify.ts +4 -4
- package/lib/util/create-context-and-run-program.ts +10 -6
- package/lib/util/get-all-package-files.ts +30 -21
- package/lib/util/lint-project.ts +79 -54
- package/package.json +4 -2
- package/renovate.json +2 -4
- package/tests/init.test.ts +1 -1
- package/tsconfig.json +13 -13
- package/tsup.config.ts +3 -3
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: Format PR
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types: [opened, synchronize, reopened, ready_for_review]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
format:
|
|
9
|
+
name: Format code
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
if: github.event.pull_request.draft == false
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout code
|
|
15
|
+
uses: actions/checkout@v3
|
|
16
|
+
with:
|
|
17
|
+
token: ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }}
|
|
18
|
+
|
|
19
|
+
- name: Setup Node.js
|
|
20
|
+
uses: actions/setup-node@v3
|
|
21
|
+
with:
|
|
22
|
+
node-version: '20'
|
|
23
|
+
|
|
24
|
+
- name: Get @biomejs/biome version
|
|
25
|
+
id: get-biome-version
|
|
26
|
+
run: echo "BIOME_VERSION=$(node -p "require('./package.json').devDependencies['@biomejs/biome']")" >> $GITHUB_OUTPUT
|
|
27
|
+
|
|
28
|
+
- name: Install @biomejs/biome
|
|
29
|
+
run: npm install @biomejs/biome@${{ steps.get-biome-version.outputs.BIOME_VERSION }}
|
|
30
|
+
|
|
31
|
+
- name: Run formatter
|
|
32
|
+
run: npx @biomejs/biome format .
|
|
33
|
+
|
|
34
|
+
- name: Commit changes
|
|
35
|
+
uses: stefanzweifel/git-auto-commit-action@v4
|
|
36
|
+
with:
|
|
37
|
+
commit_message: "formatbot: Automatically format code"
|
|
38
|
+
branch: ${{ github.head_ref }}
|
|
39
|
+
commit_user_name: tscircuitbot
|
|
40
|
+
commit_user_email: tscircuitbot@users.noreply.github.com
|
|
41
|
+
commit_author: tscircuitbot <tscircuitbot@users.noreply.github.com>
|
package/biome.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/1.7.3/schema.json",
|
|
3
|
+
"organizeImports": {
|
|
4
|
+
"enabled": true
|
|
5
|
+
},
|
|
6
|
+
"formatter": {
|
|
7
|
+
"enabled": true,
|
|
8
|
+
"indentStyle": "space"
|
|
9
|
+
},
|
|
10
|
+
"files": {
|
|
11
|
+
"ignore": ["cosmos-export", "dist", "package.json"]
|
|
12
|
+
},
|
|
13
|
+
"javascript": {
|
|
14
|
+
"formatter": {
|
|
15
|
+
"jsxQuoteStyle": "double",
|
|
16
|
+
"quoteProperties": "asNeeded",
|
|
17
|
+
"trailingCommas": "all",
|
|
18
|
+
"semicolons": "asNeeded",
|
|
19
|
+
"arrowParentheses": "always",
|
|
20
|
+
"bracketSpacing": true,
|
|
21
|
+
"bracketSameLine": false
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"linter": {
|
|
25
|
+
"enabled": true,
|
|
26
|
+
"rules": {
|
|
27
|
+
"recommended": true,
|
|
28
|
+
"suspicious": {
|
|
29
|
+
"noExplicitAny": "off"
|
|
30
|
+
},
|
|
31
|
+
"style": {
|
|
32
|
+
"noNonNullAssertion": "off",
|
|
33
|
+
"useFilenamingConvention": {
|
|
34
|
+
"level": "error",
|
|
35
|
+
"options": {
|
|
36
|
+
"strictCase": true,
|
|
37
|
+
"requireAscii": true,
|
|
38
|
+
"filenameCases": ["kebab-case", "export"]
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
package/bun.lockb
CHANGED
|
Binary file
|
package/dev-server-api/bun.lockb
CHANGED
|
Binary file
|
|
@@ -33,7 +33,7 @@ export default withWinterSpec({
|
|
|
33
33
|
})(async (req, ctx) => {
|
|
34
34
|
const dev_package_example = await ctx.db.get(
|
|
35
35
|
"dev_package_example",
|
|
36
|
-
req.commonParams.dev_package_example_id
|
|
36
|
+
req.commonParams.dev_package_example_id,
|
|
37
37
|
)
|
|
38
38
|
|
|
39
39
|
if (!dev_package_example) {
|
|
@@ -13,7 +13,7 @@ export default withWinterSpec({
|
|
|
13
13
|
edit_events_last_updated_at: z.string().datetime().nullable(),
|
|
14
14
|
soup_last_updated_at: z.string().datetime().nullable(),
|
|
15
15
|
last_updated_at: z.string().datetime().nullable(),
|
|
16
|
-
})
|
|
16
|
+
}),
|
|
17
17
|
),
|
|
18
18
|
}),
|
|
19
19
|
auth: "none",
|
|
@@ -27,7 +27,7 @@ export default withWinterSpec({
|
|
|
27
27
|
edit_events_last_updated_at: dpe.edit_events_last_updated_at,
|
|
28
28
|
soup_last_updated_at: dpe.soup_last_updated_at,
|
|
29
29
|
last_updated_at: dpe.last_updated_at,
|
|
30
|
-
})
|
|
30
|
+
}),
|
|
31
31
|
)
|
|
32
32
|
|
|
33
33
|
return ctx.json({
|
|
@@ -14,7 +14,7 @@ export default withWinterSpec({
|
|
|
14
14
|
jsonResponse: z.object({
|
|
15
15
|
export_request: ExportRequestSchema.extend({
|
|
16
16
|
file_summary: z.array(
|
|
17
|
-
z.object({ file_name: z.string(), export_file_id: z.coerce.number() })
|
|
17
|
+
z.object({ file_name: z.string(), export_file_id: z.coerce.number() }),
|
|
18
18
|
),
|
|
19
19
|
}),
|
|
20
20
|
}),
|
|
@@ -33,7 +33,7 @@ export default withWinterSpec({
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
const export_files = (await ctx.db.list("export_file")).filter(
|
|
36
|
-
(ef) => ef.export_request_id === export_request_id
|
|
36
|
+
(ef) => ef.export_request_id === export_request_id,
|
|
37
37
|
)
|
|
38
38
|
ext_export_request.file_summary = export_files.map((ef) => ({
|
|
39
39
|
file_name: ef.file_name!,
|
package/dev-server-api/server.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Request as EdgeRuntimeRequest } from "@edge-runtime/primitives"
|
|
|
3
3
|
import { join } from "node:path"
|
|
4
4
|
|
|
5
5
|
const serverFetch = await createFetchHandlerFromDir(
|
|
6
|
-
join(import.meta.dir, "./routes")
|
|
6
|
+
join(import.meta.dir, "./routes"),
|
|
7
7
|
)
|
|
8
8
|
|
|
9
9
|
console.log("starting dev-server-api on http://127.0.0.1:3021")
|
|
@@ -10,7 +10,7 @@ export const createSchema = async (db: DbClient) => {
|
|
|
10
10
|
await db.schema
|
|
11
11
|
.createTable("dev_package_example")
|
|
12
12
|
.addColumn("dev_package_example_id", "integer", (col) =>
|
|
13
|
-
col.primaryKey().autoIncrement()
|
|
13
|
+
col.primaryKey().autoIncrement(),
|
|
14
14
|
)
|
|
15
15
|
.addColumn("file_path", "text", (col) => col.unique())
|
|
16
16
|
.addColumn("export_name", "text")
|
|
@@ -27,7 +27,7 @@ export const createSchema = async (db: DbClient) => {
|
|
|
27
27
|
await db.schema
|
|
28
28
|
.createTable("export_request")
|
|
29
29
|
.addColumn("export_request_id", "integer", (col) =>
|
|
30
|
-
col.primaryKey().autoIncrement()
|
|
30
|
+
col.primaryKey().autoIncrement(),
|
|
31
31
|
)
|
|
32
32
|
.addColumn("example_file_path", "text")
|
|
33
33
|
.addColumn("export_parameters", "json")
|
|
@@ -41,13 +41,13 @@ export const createSchema = async (db: DbClient) => {
|
|
|
41
41
|
await db.schema
|
|
42
42
|
.createTable("export_file")
|
|
43
43
|
.addColumn("export_file_id", "integer", (col) =>
|
|
44
|
-
col.primaryKey().autoIncrement()
|
|
44
|
+
col.primaryKey().autoIncrement(),
|
|
45
45
|
)
|
|
46
46
|
.addColumn("file_name", "text")
|
|
47
47
|
.addColumn("file_content", "blob")
|
|
48
48
|
.addColumn("is_complete", "boolean", (col) => col.defaultTo(0).notNull())
|
|
49
49
|
.addColumn("export_request_id", "integer", (col) =>
|
|
50
|
-
col.references("export_request.export_request_id")
|
|
50
|
+
col.references("export_request.export_request_id"),
|
|
51
51
|
)
|
|
52
52
|
.addColumn("created_at", "text")
|
|
53
53
|
.execute()
|
|
@@ -57,7 +57,7 @@ class GenericJsonLevel extends AbstractLevel<string, any> {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
async _batch(
|
|
60
|
-
operations: Array<{ type: "put" | "del"; key: string; value?: any }
|
|
60
|
+
operations: Array<{ type: "put" | "del"; key: string; value?: any }>,
|
|
61
61
|
): Promise<void> {
|
|
62
62
|
for (const op of operations) {
|
|
63
63
|
if (op.type === "put") {
|
|
@@ -99,7 +99,7 @@ class GenericJsonLevel extends AbstractLevel<string, any> {
|
|
|
99
99
|
async next() {
|
|
100
100
|
if (files.length === 0) {
|
|
101
101
|
files = (await fs.readdir(this.db.location)).filter((file) =>
|
|
102
|
-
file.endsWith(".json")
|
|
102
|
+
file.endsWith(".json"),
|
|
103
103
|
)
|
|
104
104
|
}
|
|
105
105
|
|
|
@@ -22,7 +22,7 @@ export class ZodLevelDatabase {
|
|
|
22
22
|
|
|
23
23
|
async get<K extends keyof DBSchemaType>(
|
|
24
24
|
collection: K,
|
|
25
|
-
id: string | number
|
|
25
|
+
id: string | number,
|
|
26
26
|
): Promise<DBSchemaType[K] | null> {
|
|
27
27
|
const key = `${collection}:${id}`
|
|
28
28
|
const data = await this.db.get(key).catch((e) => null)
|
|
@@ -32,7 +32,7 @@ export class ZodLevelDatabase {
|
|
|
32
32
|
|
|
33
33
|
async put<K extends keyof DBSchemaType>(
|
|
34
34
|
collection: K,
|
|
35
|
-
value: DBInputSchemaType[K]
|
|
35
|
+
value: DBInputSchemaType[K],
|
|
36
36
|
): Promise<DBSchemaType[K]> {
|
|
37
37
|
const idkey = `${collection}_id`
|
|
38
38
|
const valueLoose: any = value
|
|
@@ -51,7 +51,7 @@ export class ZodLevelDatabase {
|
|
|
51
51
|
|
|
52
52
|
async del<K extends keyof DBSchemaType>(
|
|
53
53
|
collection: K,
|
|
54
|
-
id: string
|
|
54
|
+
id: string,
|
|
55
55
|
): Promise<void> {
|
|
56
56
|
const key = `${collection}:${id}`
|
|
57
57
|
await this.db.del(key)
|
|
@@ -59,7 +59,7 @@ export class ZodLevelDatabase {
|
|
|
59
59
|
|
|
60
60
|
async find<K extends keyof DBSchemaType>(
|
|
61
61
|
collection: K,
|
|
62
|
-
partialObject: Partial<DBSchemaType[K]
|
|
62
|
+
partialObject: Partial<DBSchemaType[K]>,
|
|
63
63
|
): Promise<DBSchemaType[K] | null> {
|
|
64
64
|
const schema = DBSchema.shape[collection]
|
|
65
65
|
|
|
@@ -82,14 +82,14 @@ export class ZodLevelDatabase {
|
|
|
82
82
|
|
|
83
83
|
async findOrThrow<K extends keyof DBSchemaType>(
|
|
84
84
|
collection: K,
|
|
85
|
-
partialObject: Partial<DBSchemaType[K]
|
|
85
|
+
partialObject: Partial<DBSchemaType[K]>,
|
|
86
86
|
): Promise<DBSchemaType[K]> {
|
|
87
87
|
const result = await this.find(collection, partialObject)
|
|
88
88
|
if (!result) {
|
|
89
89
|
throw new Error(
|
|
90
90
|
`No record in "${collection}" matches query ${JSON.stringify(
|
|
91
|
-
partialObject
|
|
92
|
-
)}
|
|
91
|
+
partialObject,
|
|
92
|
+
)}`,
|
|
93
93
|
)
|
|
94
94
|
}
|
|
95
95
|
return result
|
|
@@ -97,7 +97,7 @@ export class ZodLevelDatabase {
|
|
|
97
97
|
|
|
98
98
|
private matchesPartialObject<T>(
|
|
99
99
|
fullObject: T,
|
|
100
|
-
partialObject: Partial<T
|
|
100
|
+
partialObject: Partial<T>,
|
|
101
101
|
): boolean {
|
|
102
102
|
for (const [key, value] of Object.entries(partialObject)) {
|
|
103
103
|
if (fullObject[key as keyof T] !== value) {
|
|
@@ -121,7 +121,7 @@ export class ZodLevelDatabase {
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
async list<K extends keyof DBSchemaType>(
|
|
124
|
-
collection: K
|
|
124
|
+
collection: K,
|
|
125
125
|
): Promise<DBSchemaType[K][]> {
|
|
126
126
|
const schema = DBSchema.shape[collection]
|
|
127
127
|
const results: DBSchemaType[K][] = []
|
|
@@ -18,7 +18,7 @@ export const withErrorResponse: Middleware<{}, {}> = async (req, ctx, next) => {
|
|
|
18
18
|
error_code: "not_found",
|
|
19
19
|
},
|
|
20
20
|
},
|
|
21
|
-
{ status: error?.status || 404 }
|
|
21
|
+
{ status: error?.status || 404 },
|
|
22
22
|
)
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -31,7 +31,7 @@ export const withErrorResponse: Middleware<{}, {}> = async (req, ctx, next) => {
|
|
|
31
31
|
error_code: error?.error_code ?? "internal_server_error",
|
|
32
32
|
},
|
|
33
33
|
},
|
|
34
|
-
{ status: error?.status || 500 }
|
|
34
|
+
{ status: error?.status || 500 },
|
|
35
35
|
)
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -3,7 +3,7 @@ import { Request as EdgeRuntimeRequest } from "@edge-runtime/primitives"
|
|
|
3
3
|
import { join } from "node:path"
|
|
4
4
|
|
|
5
5
|
const serverFetch = await createFetchHandlerFromDir(
|
|
6
|
-
join(import.meta.dir, "../../routes")
|
|
6
|
+
join(import.meta.dir, "../../routes"),
|
|
7
7
|
)
|
|
8
8
|
|
|
9
9
|
export const startServer = ({ port }: { port: number }) =>
|
|
@@ -22,7 +22,7 @@ it("GET /api/dev_package_examples/list", async () => {
|
|
|
22
22
|
expect(res.dev_package_examples.length).toBeGreaterThan(0)
|
|
23
23
|
|
|
24
24
|
const example = res.dev_package_examples.find(
|
|
25
|
-
(e: any) => e.file_path === "examples/test-example.tsx"
|
|
25
|
+
(e: any) => e.file_path === "examples/test-example.tsx",
|
|
26
26
|
)
|
|
27
27
|
expect(example).toBeDefined()
|
|
28
28
|
expect(example.export_name).toBe("default")
|
|
@@ -23,7 +23,7 @@ it("POST /api/dev_package_examples/update", async () => {
|
|
|
23
23
|
|
|
24
24
|
expect(res.dev_package_example.completed_edit_events).toEqual([])
|
|
25
25
|
expect(res.dev_package_example.edit_events_last_applied_at).toEqual(
|
|
26
|
-
"2023-01-01T00:00:00.000Z"
|
|
26
|
+
"2023-01-01T00:00:00.000Z",
|
|
27
27
|
)
|
|
28
28
|
|
|
29
29
|
const getRes = await axios.post("/api/dev_package_examples/get", {
|
|
@@ -33,6 +33,6 @@ it("POST /api/dev_package_examples/update", async () => {
|
|
|
33
33
|
expect(getRes.status).toBe(200)
|
|
34
34
|
expect(getRes.data.dev_package_example.completed_edit_events).toEqual([])
|
|
35
35
|
expect(getRes.data.dev_package_example.edit_events_last_applied_at).toEqual(
|
|
36
|
-
"2023-01-01T00:00:00.000Z"
|
|
36
|
+
"2023-01-01T00:00:00.000Z",
|
|
37
37
|
)
|
|
38
38
|
})
|
|
@@ -16,13 +16,13 @@ it("GET /api/export_files/download", async () => {
|
|
|
16
16
|
|
|
17
17
|
const downloadRes = await axios
|
|
18
18
|
.get(
|
|
19
|
-
`/api/export_files/download?export_file_id=${res.export_file.export_file_id}
|
|
19
|
+
`/api/export_files/download?export_file_id=${res.export_file.export_file_id}`,
|
|
20
20
|
)
|
|
21
21
|
.then((r) => r.data)
|
|
22
22
|
|
|
23
23
|
// Convert downloadRes to base64 string
|
|
24
24
|
const downloadResBase64 = Buffer.from(downloadRes, "binary").toString(
|
|
25
|
-
"base64"
|
|
25
|
+
"base64",
|
|
26
26
|
)
|
|
27
27
|
|
|
28
28
|
expect(downloadResBase64).toEqual(exampleBase64)
|
|
@@ -13,7 +13,7 @@ it("POST /api/export_requests/create", async () => {
|
|
|
13
13
|
expect(res.status).toBe(200)
|
|
14
14
|
expect(res.data.export_request).toBeDefined()
|
|
15
15
|
expect(res.data.export_request.example_file_path).toBe(
|
|
16
|
-
"examples/test-example.tsx"
|
|
16
|
+
"examples/test-example.tsx",
|
|
17
17
|
)
|
|
18
18
|
expect(res.data.export_request.export_name).toBe("default")
|
|
19
19
|
expect(res.data.export_request.export_parameters).toMatchObject({
|
|
@@ -22,7 +22,7 @@ it("GET /api/export_requests/get", async () => {
|
|
|
22
22
|
expect(getRes.data.export_request).toBeDefined()
|
|
23
23
|
expect(getRes.data.export_request.export_request_id).toBe(exportRequestId)
|
|
24
24
|
expect(getRes.data.export_request.example_file_path).toBe(
|
|
25
|
-
"examples/test-example.tsx"
|
|
25
|
+
"examples/test-example.tsx",
|
|
26
26
|
)
|
|
27
27
|
expect(getRes.data.export_request.export_name).toBe("default")
|
|
28
28
|
expect(getRes.data.export_request.export_parameters).toMatchObject({
|
|
@@ -2,19 +2,19 @@ module.exports = {
|
|
|
2
2
|
root: true,
|
|
3
3
|
env: { browser: true, es2020: true },
|
|
4
4
|
extends: [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
"eslint:recommended",
|
|
6
|
+
"plugin:@typescript-eslint/recommended",
|
|
7
|
+
"plugin:react-hooks/recommended",
|
|
8
8
|
],
|
|
9
|
-
ignorePatterns: [
|
|
10
|
-
parser:
|
|
11
|
-
plugins: [
|
|
9
|
+
ignorePatterns: ["dist", ".eslintrc.cjs"],
|
|
10
|
+
parser: "@typescript-eslint/parser",
|
|
11
|
+
plugins: ["react-refresh"],
|
|
12
12
|
rules: {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
"react-refresh/only-export-components": [
|
|
14
|
+
"warn",
|
|
15
15
|
{ allowConstantExport: true },
|
|
16
16
|
],
|
|
17
|
-
|
|
18
|
-
"@typescript-eslint/no-explicit-any": "off"
|
|
17
|
+
"@typescript-eslint/no-unused-vars": "off",
|
|
18
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
19
19
|
},
|
|
20
20
|
}
|
|
@@ -64,8 +64,8 @@ export const ExampleContentView = () => {
|
|
|
64
64
|
"relative",
|
|
65
65
|
`h-[${editorHeight}px]`,
|
|
66
66
|
viewMode === "split" &&
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
splitMode === "horizontal" &&
|
|
68
|
+
"grid grid-cols-2",
|
|
69
69
|
viewMode === "split" && splitMode === "vertical" && "grid grid-rows-2",
|
|
70
70
|
)}
|
|
71
71
|
>
|
|
@@ -32,14 +32,9 @@ export const HeaderMenu = () => {
|
|
|
32
32
|
s.setSplitMode,
|
|
33
33
|
])
|
|
34
34
|
|
|
35
|
-
const {
|
|
36
|
-
data,
|
|
37
|
-
isLoading,
|
|
38
|
-
} = useQuery(
|
|
35
|
+
const { data, isLoading } = useQuery(
|
|
39
36
|
["package_info"],
|
|
40
|
-
async () =>
|
|
41
|
-
axios
|
|
42
|
-
.get(`/api/package_info/get`),
|
|
37
|
+
async () => axios.get(`/api/package_info/get`),
|
|
43
38
|
{
|
|
44
39
|
refetchOnWindowFocus: true,
|
|
45
40
|
retry: false,
|
|
@@ -91,7 +91,7 @@ export const useGenericExportDialog = ({
|
|
|
91
91
|
} catch (e: any) {
|
|
92
92
|
console.error(e)
|
|
93
93
|
setExportError(
|
|
94
|
-
`${e.toString()}\n\n${e.response?.data?.error?.message}
|
|
94
|
+
`${e.toString()}\n\n${e.response?.data?.error?.message}`,
|
|
95
95
|
)
|
|
96
96
|
setIsExporting(false)
|
|
97
97
|
return
|
|
@@ -106,13 +106,13 @@ export const useGenericExportDialog = ({
|
|
|
106
106
|
export_request.file_summary[0].export_file_id
|
|
107
107
|
window.open(
|
|
108
108
|
`/api/export_files/download?export_file_id=${export_file_id}`,
|
|
109
|
-
"_blank"
|
|
109
|
+
"_blank",
|
|
110
110
|
)
|
|
111
111
|
setIsExporting(false)
|
|
112
112
|
} catch (e: any) {
|
|
113
113
|
console.error(e)
|
|
114
114
|
setExportError(
|
|
115
|
-
`${e.toString()}\n\n${e.response?.data?.error?.message}
|
|
115
|
+
`${e.toString()}\n\n${e.response?.data?.error?.message}`,
|
|
116
116
|
)
|
|
117
117
|
setIsExporting(false)
|
|
118
118
|
}
|
|
@@ -67,7 +67,7 @@ export const useGerberExportDialog = () => {
|
|
|
67
67
|
} catch (e: any) {
|
|
68
68
|
console.error(e)
|
|
69
69
|
setExportError(
|
|
70
|
-
`${e.toString()}\n\n${e.response?.data?.error?.message}
|
|
70
|
+
`${e.toString()}\n\n${e.response?.data?.error?.message}`,
|
|
71
71
|
)
|
|
72
72
|
setIsExporting(false)
|
|
73
73
|
return
|
|
@@ -86,14 +86,14 @@ export const useGerberExportDialog = () => {
|
|
|
86
86
|
|
|
87
87
|
window.open(
|
|
88
88
|
`/api/export_files/download?export_file_id=${export_file_id}`,
|
|
89
|
-
"_blank"
|
|
89
|
+
"_blank",
|
|
90
90
|
)
|
|
91
91
|
|
|
92
92
|
setIsExporting(false)
|
|
93
93
|
} catch (e: any) {
|
|
94
94
|
console.error(e)
|
|
95
95
|
setExportError(
|
|
96
|
-
`${e.toString()}\n\n${e.response?.data?.error?.message}
|
|
96
|
+
`${e.toString()}\n\n${e.response?.data?.error?.message}`,
|
|
97
97
|
)
|
|
98
98
|
setIsExporting(false)
|
|
99
99
|
}
|
|
@@ -17,7 +17,7 @@ const AlertDialogOverlay = React.forwardRef<
|
|
|
17
17
|
<AlertDialogPrimitive.Overlay
|
|
18
18
|
className={cn(
|
|
19
19
|
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
20
|
-
className
|
|
20
|
+
className,
|
|
21
21
|
)}
|
|
22
22
|
{...props}
|
|
23
23
|
ref={ref}
|
|
@@ -35,7 +35,7 @@ const AlertDialogContent = React.forwardRef<
|
|
|
35
35
|
ref={ref}
|
|
36
36
|
className={cn(
|
|
37
37
|
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
|
|
38
|
-
className
|
|
38
|
+
className,
|
|
39
39
|
)}
|
|
40
40
|
{...props}
|
|
41
41
|
/>
|
|
@@ -50,7 +50,7 @@ const AlertDialogHeader = ({
|
|
|
50
50
|
<div
|
|
51
51
|
className={cn(
|
|
52
52
|
"flex flex-col space-y-2 text-center sm:text-left",
|
|
53
|
-
className
|
|
53
|
+
className,
|
|
54
54
|
)}
|
|
55
55
|
{...props}
|
|
56
56
|
/>
|
|
@@ -64,7 +64,7 @@ const AlertDialogFooter = ({
|
|
|
64
64
|
<div
|
|
65
65
|
className={cn(
|
|
66
66
|
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
|
67
|
-
className
|
|
67
|
+
className,
|
|
68
68
|
)}
|
|
69
69
|
{...props}
|
|
70
70
|
/>
|
|
@@ -117,7 +117,7 @@ const AlertDialogCancel = React.forwardRef<
|
|
|
117
117
|
className={cn(
|
|
118
118
|
buttonVariants({ variant: "outline" }),
|
|
119
119
|
"mt-2 sm:mt-0",
|
|
120
|
-
className
|
|
120
|
+
className,
|
|
121
121
|
)}
|
|
122
122
|
{...props}
|
|
123
123
|
/>
|
|
@@ -31,7 +31,7 @@ const buttonVariants = cva(
|
|
|
31
31
|
variant: "default",
|
|
32
32
|
size: "default",
|
|
33
33
|
},
|
|
34
|
-
}
|
|
34
|
+
},
|
|
35
35
|
)
|
|
36
36
|
|
|
37
37
|
export interface ButtonProps
|
|
@@ -50,7 +50,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
50
50
|
{...props}
|
|
51
51
|
/>
|
|
52
52
|
)
|
|
53
|
-
}
|
|
53
|
+
},
|
|
54
54
|
)
|
|
55
55
|
Button.displayName = "Button"
|
|
56
56
|
|