@bgord/ui 0.1.0 → 0.1.2

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.
Files changed (70) hide show
  1. package/dist/components/button.d.ts +1 -0
  2. package/dist/hooks/use-toggle.d.ts +32 -0
  3. package/dist/index.js +61 -0
  4. package/package.json +5 -6
  5. package/.gitmodules +0 -3
  6. package/bgord-scripts/ansible-decrypt-file.sh +0 -13
  7. package/bgord-scripts/ansible-encrypt-file.sh +0 -13
  8. package/bgord-scripts/ansible-view-file.sh +0 -13
  9. package/bgord-scripts/app-readme-generate.sh +0 -79
  10. package/bgord-scripts/base.sh +0 -209
  11. package/bgord-scripts/biome-check.sh +0 -14
  12. package/bgord-scripts/build-prechecks.sh +0 -14
  13. package/bgord-scripts/changelog-generate.sh +0 -17
  14. package/bgord-scripts/compare-configs.sh +0 -33
  15. package/bgord-scripts/compressor.ts +0 -103
  16. package/bgord-scripts/cspell.sh +0 -30
  17. package/bgord-scripts/css-purge.sh +0 -10
  18. package/bgord-scripts/database-sync-production-to-local.sh +0 -12
  19. package/bgord-scripts/drizzle-generate.sh +0 -10
  20. package/bgord-scripts/drizzle-migrate.sh +0 -10
  21. package/bgord-scripts/drizzle-open-studio.sh +0 -3
  22. package/bgord-scripts/drizzle-seed.sh +0 -12
  23. package/bgord-scripts/e2e-open.sh +0 -10
  24. package/bgord-scripts/e2e-run.sh +0 -19
  25. package/bgord-scripts/format-staged.sh +0 -14
  26. package/bgord-scripts/format.sh +0 -10
  27. package/bgord-scripts/frontend-build.sh +0 -15
  28. package/bgord-scripts/frontend-watch.sh +0 -12
  29. package/bgord-scripts/image-identify.sh +0 -14
  30. package/bgord-scripts/image-svg-optmise.sh +0 -14
  31. package/bgord-scripts/lint-commit-message.sh +0 -10
  32. package/bgord-scripts/list.sh +0 -20
  33. package/bgord-scripts/local-server-start.sh +0 -25
  34. package/bgord-scripts/npm-publish.sh +0 -77
  35. package/bgord-scripts/outdated-dependencies.sh +0 -24
  36. package/bgord-scripts/production-server-inspect.sh +0 -13
  37. package/bgord-scripts/production-sqlite-backup.sh +0 -20
  38. package/bgord-scripts/shellcheck.sh +0 -14
  39. package/bgord-scripts/templates/.commitlint-config.cjs +0 -11
  40. package/bgord-scripts/templates/biome.json +0 -66
  41. package/bgord-scripts/templates/cspell.json +0 -117
  42. package/bgord-scripts/templates/drizzle.config.ts +0 -8
  43. package/bgord-scripts/templates/index.html +0 -30
  44. package/bgord-scripts/templates/knip.json +0 -11
  45. package/bgord-scripts/templates/lefthook-target.yml +0 -2
  46. package/bgord-scripts/templates/lefthook.yml +0 -46
  47. package/bgord-scripts/templates/postcss.config.js +0 -10
  48. package/bgord-scripts/templates/server.tsconfig.json +0 -15
  49. package/bgord-scripts/test-coverage.sh +0 -11
  50. package/bgord-scripts/test-run.sh +0 -16
  51. package/bgord-scripts/test-watch.sh +0 -16
  52. package/bgord-scripts/typecheck-frontend-watch.sh +0 -20
  53. package/bgord-scripts/typecheck-frontend.sh +0 -22
  54. package/bgord-scripts/typecheck-prune.sh +0 -10
  55. package/bgord-scripts/typecheck-watch.sh +0 -8
  56. package/bgord-scripts/typecheck.sh +0 -10
  57. package/bgord-scripts/update.sh +0 -15
  58. package/bgord-scripts/workflows/codeql-analysis.yml +0 -35
  59. package/bgord-scripts/workflows/dependabot.yml +0 -7
  60. package/bgord-scripts/workflows/deploy-project.yml +0 -65
  61. package/bgord-scripts/workflows/deploy-server.yml +0 -71
  62. package/bgord-scripts/workflows/docs-app.yml +0 -47
  63. package/bun.lock +0 -29
  64. package/bunfig.toml +0 -6
  65. package/src/components/button.tsx +0 -3
  66. package/src/hooks/use-toggle.ts +0 -68
  67. package/tsconfig.json +0 -15
  68. /package/{src/components/index.ts → dist/components/index.d.ts} +0 -0
  69. /package/{src/hooks/index.ts → dist/hooks/index.d.ts} +0 -0
  70. /package/{src/index.ts → dist/index.d.ts} +0 -0
@@ -1,46 +0,0 @@
1
- assert_lefthook_installed: true
2
-
3
- pre-push:
4
- parallel: true
5
- commands:
6
- typecheck:
7
- run: ./bgord-scripts/typecheck.sh
8
- typecheck-prune:
9
- run: ./bgord-scripts/typecheck-prune.sh
10
- test-run:
11
- run: ./bgord-scripts/test-run.sh
12
- outdated-dependencies:
13
- run: ./bgord-scripts/outdated-dependencies.sh
14
- compare-configs:
15
- run: ./bgord-scripts/compare-configs.sh
16
- typecheck-frontend:
17
- run: ./bgord-scripts/typecheck-frontend.sh
18
-
19
- pre-commit:
20
- parallel: true
21
- commands:
22
- format-staged:
23
- run: ./bgord-scripts/format-staged.sh
24
- stage_fixed: true
25
- cspell:
26
- run: ./bgord-scripts/cspell.sh
27
- shellcheck:
28
- glob: "*.{sh}"
29
- run: ./bgord-scripts/shellcheck.sh
30
- biome-check:
31
- run: ./bgord-scripts/biome-check.sh
32
-
33
- commit-msg:
34
- commands:
35
- commit-lint:
36
- run: ./bgord-scripts/lint-commit-message.sh
37
-
38
- skip_output:
39
- - meta
40
- - summary
41
- - empty_summary
42
- - success
43
- - execution
44
- - execution_out
45
- - execution_info
46
- - skips
@@ -1,10 +0,0 @@
1
- const purgecss = require("@fullhuman/postcss-purgecss");
2
-
3
- module.exports = {
4
- plugins: [
5
- purgecss({
6
- content: ["**/*.tsx", "**/*.html", "**/*.hbs"],
7
- defaultExtractor: (content) => content.match(/[\w-/:%]+(?<!:)/g) || [],
8
- }),
9
- ],
10
- };
@@ -1,15 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "esModuleInterop": true,
4
- "incremental": true,
5
- "jsx": "react",
6
- "lib": ["ESNext", "DOM"],
7
- "noUncheckedIndexedAccess": true,
8
- "noUnusedLocals": true,
9
- "noUnusedParameters": true,
10
- "resolveJsonModule": true,
11
- "skipLibCheck": true,
12
- "strict": true
13
- },
14
- "exclude": ["bgord-scripts", "**/*.test.ts"]
15
- }
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- source bgord-scripts/base.sh
4
- setup_base_config
5
- set_node_timezone_to_utc
6
-
7
- info "Running test coverage..."
8
-
9
- bun test --coverage
10
-
11
- success "Tests passed!"
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- source bgord-scripts/base.sh
4
- setup_base_config
5
- set_node_timezone_to_utc
6
-
7
- export NODE_ENV="test"
8
-
9
- info "Running tests..."
10
-
11
- if test -f "tests/_setup.ts"
12
- then
13
- bun test --preload ./tests/_setup.ts
14
- else
15
- bun test
16
- fi
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- source bgord-scripts/base.sh
4
- setup_base_config
5
- set_node_timezone_to_utc
6
-
7
- export NODE_ENV="test"
8
-
9
- info "Running tests in watch mode..."
10
-
11
- if test -f "tests/_setup.ts"
12
- then
13
- bun test --watch --preload ./tests/_setup.ts
14
- else
15
- bun test --watch
16
- fi
@@ -1,20 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- source bgord-scripts/base.sh
4
- setup_base_config
5
-
6
- info "Typechecking frontend..."
7
-
8
- FRONTEND_DIRECTORY="frontend/"
9
-
10
- if test -d "$FRONTEND_DIRECTORY"
11
- then
12
- cd $FRONTEND_DIRECTORY
13
-
14
- bunx react-router typegen
15
-
16
- bunx tsc --watch --preserveWatchOutput --project tsconfig.json --noEmit
17
- else
18
- info "$FRONTEND_DIRECTORY directory doesn't exist!"
19
- exit 0
20
- fi
@@ -1,22 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- source bgord-scripts/base.sh
4
- setup_base_config
5
-
6
- info "Typechecking frontend..."
7
-
8
- FRONTEND_DIRECTORY="frontend/"
9
-
10
- if test -d "$FRONTEND_DIRECTORY"
11
- then
12
- cd $FRONTEND_DIRECTORY
13
-
14
- bunx react-router typegen
15
-
16
- bunx tsc --project tsconfig.json --noEmit
17
-
18
- success "Types are correct!"
19
- else
20
- info "$FRONTEND_DIRECTORY directory doesn't exist!"
21
- exit 0
22
- fi
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- source bgord-scripts/base.sh
4
- setup_base_config
5
-
6
- info "Detecting unused code..."
7
-
8
- bunx knip --strict --exclude unlisted,binaries,dependencies --config bgord-scripts/templates/knip.json
9
-
10
- success "No unused code detected!"
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- source bgord-scripts/base.sh
4
- setup_base_config
5
-
6
- info "Typechecking continuously..."
7
-
8
- bunx tsc --watch --preserveWatchOutput --project tsconfig.json --noEmit
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- source bgord-scripts/base.sh
4
- setup_base_config
5
-
6
- info "Typechecking..."
7
-
8
- bunx tsc --project tsconfig.json --noEmit
9
-
10
- success "Types are correct!"
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- source bgord-scripts/base.sh
4
- setup_base_config
5
-
6
- info "Performing an auto-update..."
7
-
8
- cd bgord-scripts/
9
- git pull origin master
10
-
11
- cd ../
12
- git add bgord-scripts/
13
- git commit -m "step: bump bgord/scripts" --no-verify
14
-
15
- success "Auto-update performed!"
@@ -1,35 +0,0 @@
1
- name: "CodeQL"
2
-
3
- on:
4
- schedule:
5
- - cron: "44 19 * * 2"
6
-
7
- jobs:
8
- analyze:
9
- name: Analyze
10
- runs-on: ubuntu-24.04
11
- permissions:
12
- actions: read
13
- contents: read
14
- security-events: write
15
-
16
- strategy:
17
- fail-fast: false
18
- matrix:
19
- language: ["typescript"]
20
-
21
- steps:
22
- - name: Checkout repository
23
- uses: actions/checkout@v4
24
-
25
- # Initializes the CodeQL tools for scanning.
26
- - name: Initialize CodeQL
27
- uses: github/codeql-action/init@v3
28
- with:
29
- languages: ${{ matrix.language }}
30
-
31
- - name: Autobuild
32
- uses: github/codeql-action/autobuild@v3
33
-
34
- - name: Perform CodeQL Analysis
35
- uses: github/codeql-action/analyze@v3
@@ -1,7 +0,0 @@
1
- version: 2
2
- updates:
3
- - package-ecosystem: "npm"
4
- directory: "/"
5
- schedule:
6
- interval: "weekly"
7
- open-pull-requests-limit: 10
@@ -1,65 +0,0 @@
1
- name: Deploy
2
- on:
3
- push:
4
- branches: [master]
5
- workflow_dispatch:
6
- concurrency:
7
- group: ci-deploy-${{ github.ref }}
8
- cancel-in-progress: true
9
- jobs:
10
- deploy:
11
- runs-on: ubuntu-20.04
12
- steps:
13
- - name: Clone repositories
14
- uses: actions/checkout@v4
15
- with:
16
- submodules: recursive
17
-
18
- - name: Setup Node.js environment
19
- uses: actions/setup-node@v4
20
- with:
21
- node-version: 22.6
22
- cache: "npm"
23
-
24
- - name: Get installed Playwright version
25
- shell: bash
26
- working-directory: ${{ inputs.WORKSPACE_ROOT }}
27
- id: playwright-version
28
- run: echo "PLAYWRIGHT_VERSION=$(jq '.devDependencies."@playwright/test"' package.json)" >> $GITHUB_ENV
29
-
30
- - name: Cache playwright binaries
31
- uses: actions/cache@v4
32
- id: playwright-cache
33
- with:
34
- path: |
35
- ~/.cache/ms-playwright
36
- key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
37
-
38
- - name: Install packages
39
- run: npm install
40
-
41
- - name: Run build prechecks
42
- run: ./bgord-scripts/build-prechecks.sh
43
-
44
- - name: Build the app
45
- run: ./scripts/production-project-build.sh
46
-
47
- - name: Configure SSH
48
- run: |
49
- mkdir -p ~/.ssh/
50
- echo "$SSH_KEY" > ~/.ssh/production.key
51
- chmod 600 ~/.ssh/production.key
52
- cat >>~/.ssh/config <<END
53
- Host production
54
- HostName $SSH_HOST
55
- User $SSH_USER
56
- IdentityFile ~/.ssh/production.key
57
- StrictHostKeyChecking no
58
- END
59
- env:
60
- SSH_USER: ${{ secrets.USER }}
61
- SSH_KEY: ${{ secrets.PRIVATE_KEY }}
62
- SSH_HOST: ${{ secrets.HOSTNAME }}
63
-
64
- - name: Sync source code
65
- run: rsync -azP build/ production:/var/www/${{ secrets.PROJECT_NAME }}
@@ -1,71 +0,0 @@
1
- name: Deploy
2
- on:
3
- push:
4
- branches: [master]
5
- workflow_dispatch:
6
- concurrency:
7
- group: ci-deploy-${{ github.ref }}
8
- cancel-in-progress: true
9
- jobs:
10
- deploy:
11
- runs-on: ubuntu-24.04
12
- steps:
13
- - name: Clone repositories
14
- uses: actions/checkout@v4
15
- with:
16
- submodules: recursive
17
-
18
- - name: Setup Bun environment
19
- uses: oven-sh/setup-bun@v2
20
- with:
21
- bun-version: 1.2.15
22
-
23
- - name: Bun install
24
- run: bun install --exact --frozen-lockfile --no-summary
25
-
26
- - name: Create .env.test file
27
- run: echo "${{ secrets.ENV_TEST }}" > .env.test
28
-
29
- - name: Create .env.production file
30
- run: echo "${{ secrets.ENV_PRODUCTION }}" > .env.production
31
-
32
- - name: Run build prechecks
33
- run: ./bgord-scripts/build-prechecks.sh
34
-
35
- - name: Build the app
36
- run: ./scripts/production-server-build.sh
37
-
38
- - name: Inspect the app size
39
- run: ./bgord-scripts/production-server-inspect.sh ${{ secrets.PROJECT_NAME }}
40
-
41
- - name: Configure SSH
42
- run: |
43
- mkdir -p ~/.ssh/
44
- echo "$SSH_KEY" > ~/.ssh/production.key
45
- chmod 600 ~/.ssh/production.key
46
- cat >>~/.ssh/config <<END
47
- Host production
48
- HostName $SSH_HOST
49
- User $SSH_USER
50
- IdentityFile ~/.ssh/production.key
51
- StrictHostKeyChecking no
52
- END
53
- env:
54
- SSH_USER: ${{ secrets.USER }}
55
- SSH_KEY: ${{ secrets.PRIVATE_KEY }}
56
- SSH_HOST: ${{ secrets.HOSTNAME }}
57
-
58
- - name: Sync source code
59
- run: rsync -azP build/ production:/var/www/${{ secrets.PROJECT_NAME }}
60
-
61
- - name: Remove package.json
62
- run: ssh production "cd /var/www/${{ secrets.PROJECT_NAME }} && rm -rf package.json"
63
-
64
- - name: Install sharp
65
- run: ssh production "cd /var/www/${{ secrets.PROJECT_NAME }} && /home/${{ secrets.USER }}/.bun/bin/bun install --platform=linux --arch=x64 sharp"
66
-
67
- - name: Sync package.json
68
- run: rsync -azP package.json production:/var/www/${{ secrets.PROJECT_NAME }}
69
-
70
- - name: Restart server
71
- run: ssh production sudo systemctl restart ${{ secrets.PROJECT_NAME }}.service
@@ -1,47 +0,0 @@
1
- name: Docs
2
- on:
3
- push:
4
- branches: [master]
5
- workflow_dispatch:
6
- concurrency:
7
- group: ci-docs-${{ github.ref }}
8
- cancel-in-progress: true
9
- jobs:
10
- generate:
11
- runs-on: ubuntu-24.04
12
-
13
- permissions:
14
- contents: write
15
-
16
- steps:
17
- - name: Check out repository
18
- uses: actions/checkout@v4
19
- with:
20
- submodules: recursive
21
- fetch-depth: 0
22
-
23
- - name: Generate a changelog
24
- run: bgord-scripts/changelog-generate.sh
25
-
26
- - name: Print changelog
27
- run: cat infra/CHANGELOG.md
28
-
29
- - name: Commit CHANGELOG.md
30
- uses: stefanzweifel/git-auto-commit-action@v5
31
- with:
32
- branch: master
33
- commit_message: "docs: generate CHANGELOG"
34
- file_pattern: infra/CHANGELOG.md
35
-
36
- - name: Generate a README
37
- run: bgord-scripts/app-readme-generate.sh "${{ github.event.repository.name }}"
38
-
39
- - name: Print README
40
- run: cat infra/CHANGELOG.md
41
-
42
- - name: Commit readme.md
43
- uses: stefanzweifel/git-auto-commit-action@v5
44
- with:
45
- branch: master
46
- commit_message: "docs: generate readme"
47
- file_pattern: readme.md
package/bun.lock DELETED
@@ -1,29 +0,0 @@
1
- {
2
- "lockfileVersion": 1,
3
- "workspaces": {
4
- "": {
5
- "name": "@bgord/ui",
6
- "devDependencies": {
7
- "@types/react": "19.1.8",
8
- "@types/react-dom": "19.1.6",
9
- },
10
- "peerDependencies": {
11
- "react": "19.1.0",
12
- "react-dom": "19.1.0",
13
- },
14
- },
15
- },
16
- "packages": {
17
- "@types/react": ["@types/react@19.1.8", "", { "dependencies": { "csstype": "^3.0.2" } }, "sha512-AwAfQ2Wa5bCx9WP8nZL2uMZWod7J7/JSplxbTmBQ5ms6QpqNYm672H0Vu9ZVKVngQ+ii4R/byguVEUZQyeg44g=="],
18
-
19
- "@types/react-dom": ["@types/react-dom@19.1.6", "", { "peerDependencies": { "@types/react": "^19.0.0" } }, "sha512-4hOiT/dwO8Ko0gV1m/TJZYk3y0KBnY9vzDh7W+DH17b2HFSOGgdj33dhihPeuy3l0q23+4e+hoXHV6hCC4dCXw=="],
20
-
21
- "csstype": ["csstype@3.1.3", "", {}, "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="],
22
-
23
- "react": ["react@19.1.0", "", {}, "sha512-FS+XFBNvn3GTAWq26joslQgWNoFu08F4kl0J4CgdNKADkdSGXQyTCnKteIAJy96Br6YbpEU1LSzV5dYtjMkMDg=="],
24
-
25
- "react-dom": ["react-dom@19.1.0", "", { "dependencies": { "scheduler": "^0.26.0" }, "peerDependencies": { "react": "^19.1.0" } }, "sha512-Xs1hdnE+DyKgeHJeJznQmYMIBG3TKIHJJT95Q58nHLSrElKlGQqDTR2HQ9fx5CN/Gk6Vh/kupBTDLU11/nDk/g=="],
26
-
27
- "scheduler": ["scheduler@0.26.0", "", {}, "sha512-NlHwttCI/l5gCPR3D1nNXtWABUmBwvZpEQiD4IXSbIDq8BzLIK/7Ir5gTFSGZDUu37K5cMNp0hFtzO38sC7gWA=="],
28
- }
29
- }
package/bunfig.toml DELETED
@@ -1,6 +0,0 @@
1
- [define]
2
- "process.env.NODE_ENV" = "\"production\""
3
-
4
- [target]
5
- format = ["esm", "cjs"] # two artefacts in one run
6
- external = ["react", "react-dom", "react-router-dom"]
@@ -1,3 +0,0 @@
1
- export function Button() {
2
- return <button>Click</button>;
3
- }
@@ -1,68 +0,0 @@
1
- import { useCallback, useMemo, useState } from "react";
2
-
3
- export type UseToggleValueType = boolean;
4
-
5
- export type UseToggleConfigType = {
6
- name: string;
7
- defaultValue?: UseToggleValueType;
8
- };
9
-
10
- type UseToggleProps = {
11
- controller: {
12
- "aria-expanded": "true" | "false";
13
- "aria-controls": string;
14
- role: "button";
15
- tabIndex: 0;
16
- };
17
- target: {
18
- id: string;
19
- role: "region";
20
- "aria-hidden": "true" | "false";
21
- };
22
- };
23
-
24
- export type UseToggleReturnType = {
25
- on: UseToggleValueType;
26
- off: UseToggleValueType;
27
- enable: () => void;
28
- disable: () => void;
29
- toggle: () => void;
30
- props: UseToggleProps;
31
- };
32
-
33
- export function useToggle({ name, defaultValue = false }: UseToggleConfigType): UseToggleReturnType {
34
- const [on, setIsOn] = useState<UseToggleValueType>(defaultValue);
35
-
36
- const enable = useCallback(() => setIsOn(true), []);
37
- const disable = useCallback(() => setIsOn(false), []);
38
- const toggle = useCallback(() => setIsOn((v) => !v), []);
39
-
40
- const off = useMemo(() => !on, [on]);
41
-
42
- const props = useMemo(
43
- () =>
44
- ({
45
- controller: {
46
- "aria-expanded": on ? "true" : "false",
47
- "aria-controls": name,
48
- role: "button" as const,
49
- tabIndex: 0,
50
- },
51
- target: { id: name, role: "region" as const, "aria-hidden": on ? "false" : "true" },
52
- }) as UseToggleProps,
53
- [on, name],
54
- );
55
-
56
- return { on, off, enable, disable, toggle, props };
57
- }
58
-
59
- export function extractUseToggle<X>(_props: UseToggleReturnType & X): {
60
- toggle: UseToggleReturnType;
61
- rest: X;
62
- } {
63
- const { on, off, enable, disable, toggle, props, ...rest } = _props;
64
- return {
65
- toggle: { on, off, enable, disable, toggle, props },
66
- rest: rest as X,
67
- };
68
- }
package/tsconfig.json DELETED
@@ -1,15 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "jsx": "react-jsx",
4
- "module": "esnext",
5
- "target": "esnext",
6
- "strict": true,
7
- "moduleResolution": "bundler",
8
- "declaration": true,
9
- "declarationDir": "./dist",
10
- "emitDeclarationOnly": true,
11
- "isolatedModules": true,
12
- "skipLibCheck": true
13
- },
14
- "include": ["src"]
15
- }
File without changes
File without changes