@tscircuit/fake-snippets 0.0.78 → 0.0.80
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 +63 -0
- package/bun-tests/fake-snippets-api/routes/accounts/get.test.ts +11 -0
- package/bun-tests/fake-snippets-api/routes/package_releases/create.test.ts +25 -0
- package/dist/bundle.js +15 -3
- package/fake-snippets-api/lib/db/autoload-packages.json +0 -28
- package/fake-snippets-api/routes/api/accounts/get.ts +2 -1
- package/fake-snippets-api/routes/api/package_releases/create.ts +14 -1
- package/package.json +1 -1
- package/src/components/PackageBuildsPage/package-build-header.tsx +1 -9
- package/src/components/ViewPackagePage/components/mobile-sidebar.tsx +1 -0
- package/src/components/ViewPackagePage/components/sidebar-about-section.tsx +1 -0
- package/src/components/dialogs/edit-package-details-dialog.tsx +45 -11
- package/src/hooks/use-create-package-release-mutation.ts +63 -13
- package/src/hooks/use-package-details-form.ts +9 -1
- package/src/lib/templates/blank-package-template.ts +4 -5
- package/src/pages/quickstart.tsx +2 -2
- package/src/pages/user-profile.tsx +50 -15
|
@@ -0,0 +1,63 @@
|
|
|
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: Determine if fork
|
|
15
|
+
id: check_fork
|
|
16
|
+
run: |
|
|
17
|
+
if [ "${{ github.event.pull_request.head.repo.full_name }}" = "${{ github.repository }}" ]; then
|
|
18
|
+
echo "is_fork=false" >> $GITHUB_OUTPUT
|
|
19
|
+
else
|
|
20
|
+
echo "is_fork=true" >> $GITHUB_OUTPUT
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
- name: Checkout code
|
|
24
|
+
uses: actions/checkout@v4
|
|
25
|
+
with:
|
|
26
|
+
token: ${{ steps.check_fork.outputs.is_fork == 'true' && secrets.GITHUB_TOKEN || secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }}
|
|
27
|
+
|
|
28
|
+
- name: Setup bun
|
|
29
|
+
uses: oven-sh/setup-bun@v2
|
|
30
|
+
with:
|
|
31
|
+
bun-version: latest
|
|
32
|
+
|
|
33
|
+
- name: Get @biomejs/biome version
|
|
34
|
+
id: get-biome-version
|
|
35
|
+
run: echo "BIOME_VERSION=$(node -p "require('./package.json').devDependencies['@biomejs/biome']")" >> $GITHUB_OUTPUT
|
|
36
|
+
|
|
37
|
+
- name: Install @biomejs/biome
|
|
38
|
+
run: bun install @biomejs/biome@${{ steps.get-biome-version.outputs.BIOME_VERSION }}
|
|
39
|
+
|
|
40
|
+
- name: Run Formatter and autofix
|
|
41
|
+
if: steps.check_fork.outputs.is_fork == 'false'
|
|
42
|
+
run: npx @biomejs/biome format . --write
|
|
43
|
+
|
|
44
|
+
- name: Format Check (cannot autofix against forks)
|
|
45
|
+
if: steps.check_fork.outputs.is_fork == 'true'
|
|
46
|
+
run: npx @biomejs/biome format .
|
|
47
|
+
|
|
48
|
+
- name: Restore lock files
|
|
49
|
+
if: steps.check_fork.outputs.is_fork == 'false'
|
|
50
|
+
run: |
|
|
51
|
+
git checkout -- *lock.json || true
|
|
52
|
+
git checkout -- *.lock || true
|
|
53
|
+
git checkout -- *.lockb || true
|
|
54
|
+
|
|
55
|
+
- name: Commit changes
|
|
56
|
+
if: steps.check_fork.outputs.is_fork == 'false'
|
|
57
|
+
uses: stefanzweifel/git-auto-commit-action@v4
|
|
58
|
+
with:
|
|
59
|
+
commit_message: "formatbot: Automatically format code"
|
|
60
|
+
branch: ${{ github.head_ref }}
|
|
61
|
+
commit_user_name: tscircuitbot
|
|
62
|
+
commit_user_email: tscircuitbot@users.noreply.github.com
|
|
63
|
+
commit_author: tscircuitbot <tscircuitbot@users.noreply.github.com>
|
|
@@ -51,3 +51,14 @@ test("POST /api/accounts/get - should return 404 if account not found", async ()
|
|
|
51
51
|
expect(error.data.error.message).toBe("Account not found")
|
|
52
52
|
}
|
|
53
53
|
})
|
|
54
|
+
|
|
55
|
+
test("POST /api/accounts/get - should be case insensitive", async () => {
|
|
56
|
+
const { axios } = await getTestServer()
|
|
57
|
+
|
|
58
|
+
const response = await axios.post("/api/accounts/get", {
|
|
59
|
+
github_username: "TestUser",
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
expect(response.status).toBe(200)
|
|
63
|
+
expect(response.data.account.github_username).toBe("testuser")
|
|
64
|
+
})
|
|
@@ -56,6 +56,31 @@ test("create package release using package_name_with_version", async () => {
|
|
|
56
56
|
expect(releaseResponse.data.package_release.is_latest).toBe(true)
|
|
57
57
|
})
|
|
58
58
|
|
|
59
|
+
test("create package release using package_name and version", async () => {
|
|
60
|
+
const { axios } = await getTestServer()
|
|
61
|
+
|
|
62
|
+
const packageResponse = await axios.post("/api/packages/create", {
|
|
63
|
+
name: "testuser/test-package-name-version",
|
|
64
|
+
description: "Test Description",
|
|
65
|
+
})
|
|
66
|
+
expect(packageResponse.status).toBe(200)
|
|
67
|
+
const createdPackage = packageResponse.data.package
|
|
68
|
+
|
|
69
|
+
const releaseResponse = await axios.post("/api/package_releases/create", {
|
|
70
|
+
package_name: createdPackage.name,
|
|
71
|
+
version: "3.0.0",
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
expect(releaseResponse.status).toBe(200)
|
|
75
|
+
expect(releaseResponse.data.ok).toBe(true)
|
|
76
|
+
expect(releaseResponse.data.package_release).toBeDefined()
|
|
77
|
+
expect(releaseResponse.data.package_release.package_id).toBe(
|
|
78
|
+
createdPackage.package_id,
|
|
79
|
+
)
|
|
80
|
+
expect(releaseResponse.data.package_release.version).toBe("3.0.0")
|
|
81
|
+
expect(releaseResponse.data.package_release.is_latest).toBe(true)
|
|
82
|
+
})
|
|
83
|
+
|
|
59
84
|
test("create package release - version already exists", async () => {
|
|
60
85
|
const { axios } = await getTestServer()
|
|
61
86
|
|