@skyroc/scripts 2.5.1 → 2.5.3
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/README.md +6 -3
- package/dist/cli.mjs +2 -2
- package/dist/{config-BKkdncJS.mjs → config-DWrHl2hS.mjs} +106 -5
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/templates/admin/README.md +1 -2
- package/templates/admin/package.json +9 -2
- package/templates/admin/src/App.tsx +2 -2
- package/templates/admin/src/assets/svg-icon/logo.svg +1 -1
- package/templates/admin/src/config.ts +1 -1
- package/templates/admin/src/main.tsx +1 -1
- package/templates/admin/uno.config.ts +1 -1
- package/templates/admin-root/.agents/skills/component-doc/SKILL.md +304 -0
- package/templates/admin-root/.agents/skills/component-refactoring/SKILL.md +483 -0
- package/templates/admin-root/.agents/skills/component-refactoring/references/complexity-patterns.md +493 -0
- package/templates/admin-root/.agents/skills/component-refactoring/references/component-splitting.md +477 -0
- package/templates/admin-root/.agents/skills/component-refactoring/references/hook-extraction.md +317 -0
- package/templates/admin-root/.agents/skills/doc-coauthoring/SKILL.md +375 -0
- package/templates/admin-root/.agents/skills/feature-dev/SKILL.md +78 -0
- package/templates/admin-root/.agents/skills/frontend-code-review/SKILL.md +73 -0
- package/templates/admin-root/.agents/skills/frontend-code-review/references/business-logic.md +15 -0
- package/templates/admin-root/.agents/skills/frontend-code-review/references/code-quality.md +44 -0
- package/templates/admin-root/.agents/skills/frontend-code-review/references/performance.md +45 -0
- package/templates/admin-root/.agents/skills/frontend-design/LICENSE.txt +177 -0
- package/templates/admin-root/.agents/skills/frontend-design/SKILL.md +42 -0
- package/templates/admin-root/.agents/skills/frontend-testing/SKILL.md +325 -0
- package/templates/admin-root/.agents/skills/frontend-testing/assets/component-test.template.tsx +293 -0
- package/templates/admin-root/.agents/skills/frontend-testing/assets/hook-test.template.ts +207 -0
- package/templates/admin-root/.agents/skills/frontend-testing/assets/utility-test.template.ts +154 -0
- package/templates/admin-root/.agents/skills/frontend-testing/references/async-testing.md +345 -0
- package/templates/admin-root/.agents/skills/frontend-testing/references/checklist.md +205 -0
- package/templates/admin-root/.agents/skills/frontend-testing/references/common-patterns.md +449 -0
- package/templates/admin-root/.agents/skills/frontend-testing/references/domain-components.md +523 -0
- package/templates/admin-root/.agents/skills/frontend-testing/references/mocking.md +512 -0
- package/templates/admin-root/.agents/skills/frontend-testing/references/workflow.md +269 -0
- package/templates/admin-root/.agents/skills/migrate-nativewind-to-uniwind/SKILL.md +734 -0
- package/templates/admin-root/.agents/skills/migrate-oxfmt/SKILL.md +202 -0
- package/templates/admin-root/.agents/skills/migrate-oxlint/SKILL.md +196 -0
- package/templates/admin-root/.agents/skills/native-component-doc/SKILL.md +245 -0
- package/templates/admin-root/.agents/skills/senior-frontend/SKILL.md +209 -0
- package/templates/admin-root/.agents/skills/senior-frontend/references/frontend_best_practices.md +103 -0
- package/templates/admin-root/.agents/skills/senior-frontend/references/nextjs_optimization_guide.md +103 -0
- package/templates/admin-root/.agents/skills/senior-frontend/references/react_patterns.md +103 -0
- package/templates/admin-root/.agents/skills/senior-frontend/scripts/bundle_analyzer.py +114 -0
- package/templates/admin-root/.agents/skills/senior-frontend/scripts/component_generator.py +114 -0
- package/templates/admin-root/.agents/skills/senior-frontend/scripts/frontend_scaffolder.py +114 -0
- package/templates/admin-root/.agents/skills/skill-creator/SKILL.md +355 -0
- package/templates/admin-root/.agents/skills/skill-creator/references/output-patterns.md +86 -0
- package/templates/admin-root/.agents/skills/skill-creator/references/workflows.md +28 -0
- package/templates/admin-root/.agents/skills/skill-creator/scripts/init_skill.py +300 -0
- package/templates/admin-root/.agents/skills/skill-creator/scripts/package_skill.py +110 -0
- package/templates/admin-root/.agents/skills/skill-creator/scripts/quick_validate.py +97 -0
- package/templates/admin-root/.agents/skills/skyroc-admin-prd-prototype/SKILL.md +163 -0
- package/templates/admin-root/.agents/skills/skyroc-admin-prd-prototype/references/acceptance-checklist.md +75 -0
- package/templates/admin-root/.agents/skills/skyroc-admin-prd-prototype/references/evidence-order.md +109 -0
- package/templates/admin-root/.agents/skills/skyroc-admin-prd-prototype/references/prd-rules.md +103 -0
- package/templates/admin-root/.agents/skills/skyroc-admin-prd-prototype/references/prototype-rules.md +85 -0
- package/templates/admin-root/.agents/skills/skyroc-admin-prd-prototype/scripts/verify-prototypes.mjs +144 -0
- package/templates/admin-root/.agents/skills/skyroc-admin-prd-prototype/templates/admin-page.html +771 -0
- package/templates/admin-root/.agents/skills/skyroc-admin-prd-prototype/templates/prd.md +182 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/SKILL.md +292 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/charts.csv +26 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/colors.csv +97 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/icons.csv +101 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/landing.csv +31 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/products.csv +97 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/astro.csv +54 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/styles.csv +68 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/typography.csv +58 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/scripts/core.py +253 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/scripts/design_system.py +1067 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/scripts/search.py +114 -0
- package/templates/admin-root/.agents/skills/uniwind/SKILL.md +64 -0
- package/templates/admin-root/.agents/skills/uniwind/references/component-bindings.md +338 -0
- package/templates/admin-root/.agents/skills/uniwind/references/css-and-utilities.md +325 -0
- package/templates/admin-root/.agents/skills/uniwind/references/integrations.md +75 -0
- package/templates/admin-root/.agents/skills/uniwind/references/pro.md +354 -0
- package/templates/admin-root/.agents/skills/uniwind/references/setup.md +144 -0
- package/templates/admin-root/.agents/skills/uniwind/references/styling-patterns.md +237 -0
- package/templates/admin-root/.agents/skills/uniwind/references/theming.md +309 -0
- package/templates/admin-root/.agents/skills/uniwind/references/troubleshooting.md +179 -0
- package/templates/admin-root/.agents/skills/uniwind/references/variants-and-selectors.md +224 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/AGENTS.md +2934 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/SKILL.md +136 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/advanced-event-handler-refs.md +55 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/advanced-init-once.md +42 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/advanced-use-latest.md +39 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/async-api-routes.md +38 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/async-defer-await.md +80 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/async-dependencies.md +51 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/async-parallel.md +28 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/async-suspense-boundaries.md +99 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/bundle-barrel-imports.md +59 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/bundle-conditional.md +31 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/bundle-defer-third-party.md +49 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/bundle-dynamic-imports.md +35 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/bundle-preload.md +50 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/client-event-listeners.md +74 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/client-localstorage-schema.md +71 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/client-passive-event-listeners.md +48 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/client-swr-dedup.md +56 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/js-batch-dom-css.md +107 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/js-cache-function-results.md +80 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/js-cache-property-access.md +28 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/js-cache-storage.md +70 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/js-combine-iterations.md +32 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/js-early-exit.md +50 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/js-hoist-regexp.md +45 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/js-index-maps.md +37 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/js-length-check-first.md +49 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/js-min-max-loop.md +82 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/js-set-map-lookups.md +24 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/js-tosorted-immutable.md +57 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rendering-activity.md +26 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rendering-conditional-render.md +40 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rendering-content-visibility.md +38 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rendering-hoist-jsx.md +46 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rendering-hydration-suppress-warning.md +30 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rendering-svg-precision.md +28 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rendering-usetransition-loading.md +75 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rerender-defer-reads.md +39 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rerender-dependencies.md +45 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rerender-derived-state-no-effect.md +40 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rerender-derived-state.md +29 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rerender-functional-setstate.md +74 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rerender-lazy-state-init.md +58 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rerender-memo-with-default-value.md +38 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rerender-memo.md +44 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rerender-move-effect-to-event.md +45 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rerender-simple-expression-in-memo.md +35 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rerender-transitions.md +40 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rerender-use-ref-transient-values.md +73 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/server-after-nonblocking.md +73 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/server-auth-actions.md +96 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/server-cache-lru.md +41 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/server-cache-react.md +76 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/server-dedup-props.md +65 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/server-parallel-fetching.md +83 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/server-serialization.md +38 -0
- package/templates/admin-root/.claude/settings.json +5 -0
- package/templates/admin-root/.claude/skills/component-doc/SKILL.md +304 -0
- package/templates/admin-root/.claude/skills/component-refactoring/SKILL.md +483 -0
- package/templates/admin-root/.claude/skills/component-refactoring/references/complexity-patterns.md +493 -0
- package/templates/admin-root/.claude/skills/component-refactoring/references/component-splitting.md +477 -0
- package/templates/admin-root/.claude/skills/component-refactoring/references/hook-extraction.md +317 -0
- package/templates/admin-root/.claude/skills/doc-coauthoring/SKILL.md +375 -0
- package/templates/admin-root/.claude/skills/feature-dev/SKILL.md +78 -0
- package/templates/admin-root/.claude/skills/frontend-code-review/SKILL.md +73 -0
- package/templates/admin-root/.claude/skills/frontend-code-review/references/business-logic.md +15 -0
- package/templates/admin-root/.claude/skills/frontend-code-review/references/code-quality.md +44 -0
- package/templates/admin-root/.claude/skills/frontend-code-review/references/performance.md +45 -0
- package/templates/admin-root/.claude/skills/frontend-design/LICENSE.txt +177 -0
- package/templates/admin-root/.claude/skills/frontend-design/SKILL.md +42 -0
- package/templates/admin-root/.claude/skills/frontend-testing/SKILL.md +325 -0
- package/templates/admin-root/.claude/skills/frontend-testing/assets/component-test.template.tsx +293 -0
- package/templates/admin-root/.claude/skills/frontend-testing/assets/hook-test.template.ts +207 -0
- package/templates/admin-root/.claude/skills/frontend-testing/assets/utility-test.template.ts +154 -0
- package/templates/admin-root/.claude/skills/frontend-testing/references/async-testing.md +345 -0
- package/templates/admin-root/.claude/skills/frontend-testing/references/checklist.md +205 -0
- package/templates/admin-root/.claude/skills/frontend-testing/references/common-patterns.md +449 -0
- package/templates/admin-root/.claude/skills/frontend-testing/references/domain-components.md +523 -0
- package/templates/admin-root/.claude/skills/frontend-testing/references/mocking.md +512 -0
- package/templates/admin-root/.claude/skills/frontend-testing/references/workflow.md +269 -0
- package/templates/admin-root/.claude/skills/migrate-nativewind-to-uniwind +1 -0
- package/templates/admin-root/.claude/skills/migrate-oxfmt +1 -0
- package/templates/admin-root/.claude/skills/migrate-oxlint +1 -0
- package/templates/admin-root/.claude/skills/native-component-doc/SKILL.md +245 -0
- package/templates/admin-root/.claude/skills/senior-frontend/SKILL.md +209 -0
- package/templates/admin-root/.claude/skills/senior-frontend/references/frontend_best_practices.md +103 -0
- package/templates/admin-root/.claude/skills/senior-frontend/references/nextjs_optimization_guide.md +103 -0
- package/templates/admin-root/.claude/skills/senior-frontend/references/react_patterns.md +103 -0
- package/templates/admin-root/.claude/skills/senior-frontend/scripts/bundle_analyzer.py +114 -0
- package/templates/admin-root/.claude/skills/senior-frontend/scripts/component_generator.py +114 -0
- package/templates/admin-root/.claude/skills/senior-frontend/scripts/frontend_scaffolder.py +114 -0
- package/templates/admin-root/.claude/skills/skill-creator/SKILL.md +355 -0
- package/templates/admin-root/.claude/skills/skill-creator/references/output-patterns.md +86 -0
- package/templates/admin-root/.claude/skills/skill-creator/references/workflows.md +28 -0
- package/templates/admin-root/.claude/skills/skill-creator/scripts/init_skill.py +300 -0
- package/templates/admin-root/.claude/skills/skill-creator/scripts/package_skill.py +110 -0
- package/templates/admin-root/.claude/skills/skill-creator/scripts/quick_validate.py +97 -0
- package/templates/admin-root/.claude/skills/ui-ux-pro-max/SKILL.md +386 -0
- package/templates/admin-root/.claude/skills/ui-ux-pro-max/data +1 -0
- package/templates/admin-root/.claude/skills/ui-ux-pro-max/scripts +1 -0
- package/templates/admin-root/.claude/skills/uniwind +1 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/AGENTS.md +2934 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/SKILL.md +136 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/advanced-event-handler-refs.md +55 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/advanced-init-once.md +42 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/advanced-use-latest.md +39 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/async-api-routes.md +38 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/async-defer-await.md +80 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/async-dependencies.md +51 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/async-parallel.md +28 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/async-suspense-boundaries.md +99 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/bundle-barrel-imports.md +59 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/bundle-conditional.md +31 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/bundle-defer-third-party.md +49 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/bundle-dynamic-imports.md +35 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/bundle-preload.md +50 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/client-event-listeners.md +74 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/client-localstorage-schema.md +71 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/client-passive-event-listeners.md +48 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/client-swr-dedup.md +56 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/js-batch-dom-css.md +107 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/js-cache-function-results.md +80 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/js-cache-property-access.md +28 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/js-cache-storage.md +70 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/js-combine-iterations.md +32 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/js-early-exit.md +50 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/js-hoist-regexp.md +45 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/js-index-maps.md +37 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/js-length-check-first.md +49 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/js-min-max-loop.md +82 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/js-set-map-lookups.md +24 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/js-tosorted-immutable.md +57 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rendering-activity.md +26 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rendering-conditional-render.md +40 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rendering-content-visibility.md +38 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rendering-hoist-jsx.md +46 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rendering-hydration-suppress-warning.md +30 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rendering-svg-precision.md +28 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rendering-usetransition-loading.md +75 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rerender-defer-reads.md +39 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rerender-dependencies.md +45 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rerender-derived-state-no-effect.md +40 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rerender-derived-state.md +29 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rerender-functional-setstate.md +74 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rerender-lazy-state-init.md +58 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rerender-memo-with-default-value.md +38 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rerender-memo.md +44 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rerender-move-effect-to-event.md +45 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rerender-simple-expression-in-memo.md +35 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rerender-transitions.md +40 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rerender-use-ref-transient-values.md +73 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/server-after-nonblocking.md +73 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/server-auth-actions.md +96 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/server-cache-lru.md +41 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/server-cache-react.md +76 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/server-dedup-props.md +65 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/server-parallel-fetching.md +83 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/server-serialization.md +38 -0
- package/templates/admin-root/.cursor/settings.json +10 -0
- package/templates/admin-root/.editorconfig +19 -0
- package/templates/admin-root/.gitattributes +16 -0
- package/templates/admin-root/.oxfmtrc.json +35 -0
- package/templates/admin-root/AGENTS.md +297 -0
- package/templates/admin-root/CLAUDE.md +1 -0
- package/templates/admin-root/skills-lock.json +27 -0
- package/templates/admin-root.manifest.json +1317 -0
- package/templates/admin-shell/devtools/AdminDevtools.css +27 -0
- package/templates/admin-shell/devtools/AdminDevtools.tsx +253 -0
- package/templates/admin-shell/devtools/index.ts +7 -0
- package/templates/admin-shell/devtools/jotai.ts +2 -0
- package/templates/admin.meta.json +14 -6
- package/LICENSE +0 -21
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
# Testing Workflow Guide
|
|
2
|
+
|
|
3
|
+
This guide defines the workflow for generating tests, especially for complex components or directories with multiple files.
|
|
4
|
+
|
|
5
|
+
## Scope Clarification
|
|
6
|
+
|
|
7
|
+
This guide addresses **multi-file workflow** (how to process multiple test files). For coverage requirements within a single test file, see `web/testing/testing.md` § Coverage Goals.
|
|
8
|
+
|
|
9
|
+
| Scope | Rule |
|
|
10
|
+
|-------|------|
|
|
11
|
+
| **Single file** | Complete coverage in one generation (100% function, >95% branch) |
|
|
12
|
+
| **Multi-file directory** | Process one file at a time, verify each before proceeding |
|
|
13
|
+
|
|
14
|
+
## ⚠️ Critical Rule: Incremental Approach for Multi-File Testing
|
|
15
|
+
|
|
16
|
+
When testing a **directory with multiple files**, **NEVER generate all test files at once.** Use an incremental, verify-as-you-go approach.
|
|
17
|
+
|
|
18
|
+
### Why Incremental?
|
|
19
|
+
|
|
20
|
+
| Batch Approach (❌) | Incremental Approach (✅) |
|
|
21
|
+
|---------------------|---------------------------|
|
|
22
|
+
| Generate 5+ tests at once | Generate 1 test at a time |
|
|
23
|
+
| Run tests only at the end | Run test immediately after each file |
|
|
24
|
+
| Multiple failures compound | Single point of failure, easy to debug |
|
|
25
|
+
| Hard to identify root cause | Clear cause-effect relationship |
|
|
26
|
+
| Mock issues affect many files | Mock issues caught early |
|
|
27
|
+
| Messy git history | Clean, atomic commits possible |
|
|
28
|
+
|
|
29
|
+
## Single File Workflow
|
|
30
|
+
|
|
31
|
+
When testing a **single component, hook, or utility**:
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
1. Read source code completely
|
|
35
|
+
2. Run `pnpm analyze-component <path>` (if available)
|
|
36
|
+
3. Check complexity score and features detected
|
|
37
|
+
4. Write the test file
|
|
38
|
+
5. Run test: `pnpm test <file>.spec.tsx`
|
|
39
|
+
6. Fix any failures
|
|
40
|
+
7. Verify coverage meets goals (100% function, >95% branch)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Directory/Multi-File Workflow (MUST FOLLOW)
|
|
44
|
+
|
|
45
|
+
When testing a **directory or multiple files**, follow this strict workflow:
|
|
46
|
+
|
|
47
|
+
### Step 1: Analyze and Plan
|
|
48
|
+
|
|
49
|
+
1. **List all files** that need tests in the directory
|
|
50
|
+
1. **Categorize by complexity**:
|
|
51
|
+
- 🟢 **Simple**: Utility functions, simple hooks, presentational components
|
|
52
|
+
- 🟡 **Medium**: Components with state, effects, or event handlers
|
|
53
|
+
- 🔴 **Complex**: Components with API calls, routing, or many dependencies
|
|
54
|
+
1. **Order by dependency**: Test dependencies before dependents
|
|
55
|
+
1. **Create a todo list** to track progress
|
|
56
|
+
|
|
57
|
+
### Step 2: Determine Processing Order
|
|
58
|
+
|
|
59
|
+
Process files in this recommended order:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
1. Utility functions (simplest, no React)
|
|
63
|
+
2. Custom hooks (isolated logic)
|
|
64
|
+
3. Simple presentational components (few/no props)
|
|
65
|
+
4. Medium complexity components (state, effects)
|
|
66
|
+
5. Complex components (API, routing, many deps)
|
|
67
|
+
6. Container/index components (integration tests - last)
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Rationale**:
|
|
71
|
+
|
|
72
|
+
- Simpler files help establish mock patterns
|
|
73
|
+
- Hooks used by components should be tested first
|
|
74
|
+
- Integration tests (index files) depend on child components working
|
|
75
|
+
|
|
76
|
+
### Step 3: Process Each File Incrementally
|
|
77
|
+
|
|
78
|
+
**For EACH file in the ordered list:**
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
┌─────────────────────────────────────────────┐
|
|
82
|
+
│ 1. Write test file │
|
|
83
|
+
│ 2. Run: pnpm test <file>.spec.tsx │
|
|
84
|
+
│ 3. If FAIL → Fix immediately, re-run │
|
|
85
|
+
│ 4. If PASS → Mark complete in todo list │
|
|
86
|
+
│ 5. ONLY THEN proceed to next file │
|
|
87
|
+
└─────────────────────────────────────────────┘
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**DO NOT proceed to the next file until the current one passes.**
|
|
91
|
+
|
|
92
|
+
### Step 4: Final Verification
|
|
93
|
+
|
|
94
|
+
After all individual tests pass:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# Run all tests in the directory together
|
|
98
|
+
pnpm test path/to/directory/
|
|
99
|
+
|
|
100
|
+
# Check coverage
|
|
101
|
+
pnpm test:coverage path/to/directory/
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Component Complexity Guidelines
|
|
105
|
+
|
|
106
|
+
Use `pnpm analyze-component <path>` to assess complexity before testing.
|
|
107
|
+
|
|
108
|
+
### 🔴 Very Complex Components (Complexity > 50)
|
|
109
|
+
|
|
110
|
+
**Consider refactoring BEFORE testing:**
|
|
111
|
+
|
|
112
|
+
- Break component into smaller, testable pieces
|
|
113
|
+
- Extract complex logic into custom hooks
|
|
114
|
+
- Separate container and presentational layers
|
|
115
|
+
|
|
116
|
+
**If testing as-is:**
|
|
117
|
+
|
|
118
|
+
- Use integration tests for complex workflows
|
|
119
|
+
- Use `test.each()` for data-driven testing
|
|
120
|
+
- Multiple `describe` blocks for organization
|
|
121
|
+
- Consider testing major sections separately
|
|
122
|
+
|
|
123
|
+
### 🟡 Medium Complexity (Complexity 30-50)
|
|
124
|
+
|
|
125
|
+
- Group related tests in `describe` blocks
|
|
126
|
+
- Test integration scenarios between internal parts
|
|
127
|
+
- Focus on state transitions and side effects
|
|
128
|
+
- Use helper functions to reduce test complexity
|
|
129
|
+
|
|
130
|
+
### 🟢 Simple Components (Complexity < 30)
|
|
131
|
+
|
|
132
|
+
- Standard test structure
|
|
133
|
+
- Focus on props, rendering, and edge cases
|
|
134
|
+
- Usually straightforward to test
|
|
135
|
+
|
|
136
|
+
### 📏 Large Files (500+ lines)
|
|
137
|
+
|
|
138
|
+
Regardless of complexity score:
|
|
139
|
+
|
|
140
|
+
- **Strongly consider refactoring** before testing
|
|
141
|
+
- If testing as-is, test major sections separately
|
|
142
|
+
- Create helper functions for test setup
|
|
143
|
+
- May need multiple test files
|
|
144
|
+
|
|
145
|
+
## Todo List Format
|
|
146
|
+
|
|
147
|
+
When testing multiple files, use a todo list like this:
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
Testing: path/to/directory/
|
|
151
|
+
|
|
152
|
+
Ordered by complexity (simple → complex):
|
|
153
|
+
|
|
154
|
+
☐ utils/helper.ts [utility, simple]
|
|
155
|
+
☐ hooks/use-custom-hook.ts [hook, simple]
|
|
156
|
+
☐ empty-state.tsx [component, simple]
|
|
157
|
+
☐ item-card.tsx [component, medium]
|
|
158
|
+
☐ list.tsx [component, complex]
|
|
159
|
+
☐ index.tsx [integration]
|
|
160
|
+
|
|
161
|
+
Progress: 0/6 complete
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Update status as you complete each:
|
|
165
|
+
|
|
166
|
+
- ☐ → ⏳ (in progress)
|
|
167
|
+
- ⏳ → ✅ (complete and verified)
|
|
168
|
+
- ⏳ → ❌ (blocked, needs attention)
|
|
169
|
+
|
|
170
|
+
## When to Stop and Verify
|
|
171
|
+
|
|
172
|
+
**Always run tests after:**
|
|
173
|
+
|
|
174
|
+
- Completing a test file
|
|
175
|
+
- Making changes to fix a failure
|
|
176
|
+
- Modifying shared mocks
|
|
177
|
+
- Updating test utilities or helpers
|
|
178
|
+
|
|
179
|
+
**Signs you should pause:**
|
|
180
|
+
|
|
181
|
+
- More than 2 consecutive test failures
|
|
182
|
+
- Mock-related errors appearing
|
|
183
|
+
- Unclear why a test is failing
|
|
184
|
+
- Test passing but coverage unexpectedly low
|
|
185
|
+
|
|
186
|
+
## Common Pitfalls to Avoid
|
|
187
|
+
|
|
188
|
+
### ❌ Don't: Generate Everything First
|
|
189
|
+
|
|
190
|
+
```
|
|
191
|
+
# BAD: Writing all files then testing
|
|
192
|
+
Write component-a.spec.tsx
|
|
193
|
+
Write component-b.spec.tsx
|
|
194
|
+
Write component-c.spec.tsx
|
|
195
|
+
Write component-d.spec.tsx
|
|
196
|
+
Run pnpm test ← Multiple failures, hard to debug
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### ✅ Do: Verify Each Step
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
# GOOD: Incremental with verification
|
|
203
|
+
Write component-a.spec.tsx
|
|
204
|
+
Run pnpm test component-a.spec.tsx ✅
|
|
205
|
+
Write component-b.spec.tsx
|
|
206
|
+
Run pnpm test component-b.spec.tsx ✅
|
|
207
|
+
...continue...
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### ❌ Don't: Skip Verification for "Simple" Components
|
|
211
|
+
|
|
212
|
+
Even simple components can have:
|
|
213
|
+
|
|
214
|
+
- Import errors
|
|
215
|
+
- Missing mock setup
|
|
216
|
+
- Incorrect assumptions about props
|
|
217
|
+
|
|
218
|
+
**Always verify, regardless of perceived simplicity.**
|
|
219
|
+
|
|
220
|
+
### ❌ Don't: Continue When Tests Fail
|
|
221
|
+
|
|
222
|
+
Failing tests compound:
|
|
223
|
+
|
|
224
|
+
- A mock issue in file A affects files B, C, D
|
|
225
|
+
- Fixing A later requires revisiting all dependent tests
|
|
226
|
+
- Time wasted on debugging cascading failures
|
|
227
|
+
|
|
228
|
+
**Fix failures immediately before proceeding.**
|
|
229
|
+
|
|
230
|
+
## Integration with Claude's Todo Feature
|
|
231
|
+
|
|
232
|
+
When using Claude for multi-file testing:
|
|
233
|
+
|
|
234
|
+
1. **Ask Claude to create a todo list** before starting
|
|
235
|
+
1. **Request one file at a time** or ensure Claude processes incrementally
|
|
236
|
+
1. **Verify each test passes** before asking for the next
|
|
237
|
+
1. **Mark todos complete** as you progress
|
|
238
|
+
|
|
239
|
+
Example prompt:
|
|
240
|
+
|
|
241
|
+
```
|
|
242
|
+
Test all components in `path/to/directory/`.
|
|
243
|
+
First, analyze the directory and create a todo list ordered by complexity.
|
|
244
|
+
Then, process ONE file at a time, waiting for my confirmation that tests pass
|
|
245
|
+
before proceeding to the next.
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## Summary Checklist
|
|
249
|
+
|
|
250
|
+
Before starting multi-file testing:
|
|
251
|
+
|
|
252
|
+
- [ ] Listed all files needing tests
|
|
253
|
+
- [ ] Ordered by complexity (simple → complex)
|
|
254
|
+
- [ ] Created todo list for tracking
|
|
255
|
+
- [ ] Understand dependencies between files
|
|
256
|
+
|
|
257
|
+
During testing:
|
|
258
|
+
|
|
259
|
+
- [ ] Processing ONE file at a time
|
|
260
|
+
- [ ] Running tests after EACH file
|
|
261
|
+
- [ ] Fixing failures BEFORE proceeding
|
|
262
|
+
- [ ] Updating todo list progress
|
|
263
|
+
|
|
264
|
+
After completion:
|
|
265
|
+
|
|
266
|
+
- [ ] All individual tests pass
|
|
267
|
+
- [ ] Full directory test run passes
|
|
268
|
+
- [ ] Coverage goals met
|
|
269
|
+
- [ ] Todo list shows all complete
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
../../.agents/skills/migrate-nativewind-to-uniwind
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
../../.agents/skills/migrate-oxfmt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
../../.agents/skills/migrate-oxlint
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: native-component-doc
|
|
3
|
+
description: 为 @skyroc/native-ui 组件编写文档。当用户说出 native 组件名(如 Button、Cell、ActionSheet)并要求写/补文档时触发。自动定位组件源码、playground demo、已有文档,按 native-ui-docs 的规范生成或更新 MDX。
|
|
4
|
+
argument-hint: 组件名,如 Button、Cell、ActionSheet
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Native UI 组件文档工作流
|
|
8
|
+
|
|
9
|
+
为 `@skyroc/native-ui`(React Native + Uniwind)编写文档的专用工作流。
|
|
10
|
+
|
|
11
|
+
> 这不是 web-ui 那套。native 的 `<Demo>` 会把 demo 源码整份渲染出来、右栏还有整页手机预览,
|
|
12
|
+
> 因此**不写内联代码块**、**demo 一律具名导出**、**每个 demo 都要在汇总页里串一遍**。
|
|
13
|
+
> 与 `component-doc`(web-ui 用)的差异见文末「与 web-ui 文档规范的差异」。
|
|
14
|
+
|
|
15
|
+
## 文件定位规则
|
|
16
|
+
|
|
17
|
+
给定组件名 `$COMPONENT`(如 `ActionSheet`),转 kebab-case `$slug`(如 `action-sheet`):
|
|
18
|
+
|
|
19
|
+
| 用途 | 路径 |
|
|
20
|
+
| ------------------- | -------------------------------------------------------------- |
|
|
21
|
+
| 组件源码 | `packages/native/ui/src/components/$slug/` |
|
|
22
|
+
| Playground 单点 demo | `apps/native-ui-playground/src/demos/$slug/*.tsx` |
|
|
23
|
+
| Playground 汇总页 | `apps/native-ui-playground/src/demos/$slug/index.tsx` |
|
|
24
|
+
| Playground 路由页 | `apps/native-ui-playground/app/components/$slug.tsx` |
|
|
25
|
+
| 文档 MDX | `docs/native-ui-docs/content/docs/components/($group)/$slug.mdx` |
|
|
26
|
+
|
|
27
|
+
**文档基础设施**(了解即可,不必每次都读):
|
|
28
|
+
|
|
29
|
+
| 文件 | 作用 |
|
|
30
|
+
| ----------------------------------------------- | -------------------------------------------------------------------- |
|
|
31
|
+
| `docs/native-ui-docs/components/mdx.tsx` | MDX 组件注册,只有 `Demo` / `PropsTable` / `TypeTable` / `UnionType` |
|
|
32
|
+
| `docs/native-ui-docs/components/demo/index.tsx` | `<Demo>`:读 demo 源码 + 渲染预览 + 「在 playground 打开」 |
|
|
33
|
+
| `docs/native-ui-docs/components/demo/demo-preview.tsx` | 动态 import demos 目录,**按模块名取具名导出** |
|
|
34
|
+
| `docs/native-ui-docs/components/props-table.tsx` | `<PropsTable>` API 属性表 |
|
|
35
|
+
| `docs/native-ui-docs/components/type-table.tsx` | `<TypeTable>` + `<UnionType>` 类型区 |
|
|
36
|
+
| `docs/native-ui-docs/components/type-anchor.tsx` | PascalCase 类型 → 锚点链接,`BUILTIN_TYPE_NAMES` 白名单 |
|
|
37
|
+
| `docs/native-ui-docs/components/type-registry.ts`| 跨页面类型链接注册表 |
|
|
38
|
+
| `docs/native-ui-docs/lib/playground-demo.ts` | 文档页 slug → playground 整页路由,决定是否分栏 |
|
|
39
|
+
|
|
40
|
+
## 侧边栏分组
|
|
41
|
+
|
|
42
|
+
`content/docs/components/` 下按 fumadocs 路由组分组,路由组不进 URL(`(general)/button.mdx` → `/docs/components/button`)。
|
|
43
|
+
写完文档后**必须**把 `$slug` 加进对应分组的 `meta.json` 的 `pages` 里(meta.json 已预置全部规划中的 slug,通常只需确认位置正确)。
|
|
44
|
+
|
|
45
|
+
| 目录 | 标题 | 组件 |
|
|
46
|
+
| ---------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
47
|
+
| `(general)` | 通用 | button, floating-button, text, text-ellipsis, divider, image |
|
|
48
|
+
| `(layout)` | 布局容器 | space, grid, cell, collapse |
|
|
49
|
+
| `(input)` | 输入 | form, field, input, password-input, search, checkbox, radio, switch, slider, stepper, rate, signature, picker, picker-group, date-picker, time-picker, calendar, number-keyboard, tree-select |
|
|
50
|
+
| `(data-display)` | 数据展示 | avatar, badge, tag, count-down, rolling-text, swipe-cell |
|
|
51
|
+
| `(navigation)` | 导航 | navbar, tabs, sidebar, anchor-nav, index-bar, back-top, pagination, dropdown-menu |
|
|
52
|
+
| `(overlay)` | 弹层覆盖 | popup, dialog, sheet, action-sheet, share-sheet |
|
|
53
|
+
| `(feedback)` | 反馈 | toast, notify |
|
|
54
|
+
|
|
55
|
+
`meta.json` 里列了但文件还不存在的 slug 会被 fumadocs 静默跳过(`resolveFolderItem` 找不到 node 直接 return),所以预置清单不会报错。
|
|
56
|
+
|
|
57
|
+
`meta.json` 里**不要写 `"collapsible": false`**。fumadocs-ui 16.14.4 的 `SidebarFolderTrigger`
|
|
58
|
+
在 `collapsible: false` 分支直接渲染成 `jsx("div", { ...props })`,而上层
|
|
59
|
+
(`layouts/docs/slots/sidebar.js:220`)传下来的 `className` 是个 `(state) => string` 函数 ——
|
|
60
|
+
函数原样落到 DOM 上,React 报
|
|
61
|
+
`Invalid value for prop \`className\` on <div> tag`,分组标题也因此丢掉全部样式类。
|
|
62
|
+
`collapsible` 走默认的 `true` 时,trigger 渲染成 Base UI 的 `Collapsible.Trigger`,函数 className
|
|
63
|
+
会被 `useRenderElement` 正常解析。`defaultOpen: true` 已经能让分组默认展开,不需要 `collapsible: false`。
|
|
64
|
+
|
|
65
|
+
## 执行流程
|
|
66
|
+
|
|
67
|
+
### Phase 1:读源码与 demo,做一致性校验
|
|
68
|
+
|
|
69
|
+
1. 读 `packages/native/ui/src/components/$slug/` 全部文件
|
|
70
|
+
- `index.ts`:实际导出了哪些组件、哪些类型
|
|
71
|
+
- `types.ts`:public props 与类型别名
|
|
72
|
+
- `*-variants.ts`:`slots` / `variants` / `compoundVariants` / `defaultVariants` —— **表格里的每一行数值都从这里抄,不要凭印象写**
|
|
73
|
+
- 主组件 `*.tsx`:props 实际怎么解构、默认值在哪、有没有 `hitSlop` / `accessibilityState` / `TextClassContext` / Portal 之类的 RN 特有行为
|
|
74
|
+
2. 读 `apps/native-ui-playground/src/demos/$slug/` 全部 demo + `index.tsx` 汇总页
|
|
75
|
+
- 汇总页的 `<Section title/description>` 就是**天然的章节大纲**,文档章节直接对齐它
|
|
76
|
+
3. 已有文档就读一遍,判断是补全还是重写
|
|
77
|
+
4. 参考范例:`docs/native-ui-docs/content/docs/components/(general)/button.mdx`(当前唯一的完整样板)
|
|
78
|
+
|
|
79
|
+
#### 实现一致性校验(必须执行)
|
|
80
|
+
|
|
81
|
+
文档不是 API 想象稿,从**源码 / 类型 / variants / demo** 四者交叉验证:
|
|
82
|
+
|
|
83
|
+
- `types.ts` 声明的 props,主组件是否真的解构并使用
|
|
84
|
+
- 默认值实际在哪里设置(`defaultVariants` vs 组件内 `= false`),两处不一致时以运行时为准
|
|
85
|
+
- `classNames` 的每个 slot 是否真的接到了对应节点上
|
|
86
|
+
- `index.ts` 是否真的导出了你要写进文档的类型
|
|
87
|
+
- RN 特有:`hitSlop`、`accessibilityRole` / `accessibilityState`、`Pressable` 透传、`TextClassContext` 继承范围、Portal / Modal 挂载点
|
|
88
|
+
|
|
89
|
+
发现类型/API 承诺与实现不一致时:先明确指出这是实现问题;能改就改实现或类型,不要在文档里绕过去;不能改就在最终说明里列为风险,并且**不在文档中承诺未实现的能力**。不允许靠降低文档表述来掩盖实现 bug。
|
|
90
|
+
|
|
91
|
+
### Phase 2:写文档
|
|
92
|
+
|
|
93
|
+
#### MDX 结构
|
|
94
|
+
|
|
95
|
+
```mdx
|
|
96
|
+
---
|
|
97
|
+
title: $COMPONENT
|
|
98
|
+
description: 一句话描述组件用途
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
概述段落:组件做什么、基于什么 RN 原语封装、有什么与众不同的行为。
|
|
102
|
+
|
|
103
|
+
\`\`\`tsx
|
|
104
|
+
import { $COMPONENT } from '@skyroc/native-ui';
|
|
105
|
+
\`\`\`
|
|
106
|
+
|
|
107
|
+
## 基础用法
|
|
108
|
+
|
|
109
|
+
<Demo src="@playground/$slug/$DemoBasic" />
|
|
110
|
+
|
|
111
|
+
## 何时使用
|
|
112
|
+
|
|
113
|
+
- 使用场景 / 移动端取舍
|
|
114
|
+
- 与相似组件的区分(如 Popup vs Sheet vs ActionSheet)
|
|
115
|
+
|
|
116
|
+
## 功能章节(variant / color / size / shape / ...)
|
|
117
|
+
|
|
118
|
+
说明文字 +(枚举类的)表格
|
|
119
|
+
|
|
120
|
+
<Demo src="@playground/$slug/$DemoName" />
|
|
121
|
+
|
|
122
|
+
补充说明:容易踩的坑、和 web 端行为不同的地方
|
|
123
|
+
|
|
124
|
+
## 无障碍
|
|
125
|
+
|
|
126
|
+
role / accessibilityState / 热区 等 RN 专属说明(有就写)
|
|
127
|
+
|
|
128
|
+
## API
|
|
129
|
+
|
|
130
|
+
### $COMPONENT
|
|
131
|
+
|
|
132
|
+
<PropsTable data={[...]} />
|
|
133
|
+
|
|
134
|
+
## 类型
|
|
135
|
+
|
|
136
|
+
\`\`\`ts
|
|
137
|
+
import type { ... } from '@skyroc/native-ui';
|
|
138
|
+
\`\`\`
|
|
139
|
+
|
|
140
|
+
<UnionType ... />
|
|
141
|
+
<TypeTable data={[...]} />
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
#### Demo 引用规则(native 专属)
|
|
145
|
+
|
|
146
|
+
- 格式:`<Demo src="@playground/$slug/$DemoName" />`,**没有 `modules/` 这一层**(那是 web-ui 的)
|
|
147
|
+
- **不要在 `<Demo>` 后面贴内联代码块**。`<Demo>` 已经把整份 demo 源码渲染在预览下方了,内联代码是重复噪音
|
|
148
|
+
- **覆盖率要求:`src/demos/$slug/index.tsx` 里串的每个子 demo,文档必须有且仅有一处 `<Demo>` 引用**。章节顺序也尽量对齐汇总页
|
|
149
|
+
- demo 缺失时**必须补 demo**,不能因为没 demo 就只写文字
|
|
150
|
+
|
|
151
|
+
写完用这条命令核对覆盖率(无输出即一一对应):
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
slug=button; group='(general)'
|
|
155
|
+
diff \
|
|
156
|
+
<(ls apps/native-ui-playground/src/demos/$slug | grep -v '^index' | sed 's/\.tsx$//' | sort) \
|
|
157
|
+
<(grep -o "@playground/$slug/[A-Za-z0-9]*" "docs/native-ui-docs/content/docs/components/$group/$slug.mdx" | sed 's|.*/||' | sort -u)
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
#### 新建 Playground Demo 的规范
|
|
161
|
+
|
|
162
|
+
1. 路径:`apps/native-ui-playground/src/demos/$slug/$DemoName.tsx`,`$DemoName` 以组件名开头(`ButtonLoading`、`CellSize`)
|
|
163
|
+
2. **必须具名导出,且导出名 === 文件名** —— `demo-preview.tsx` 是按模块名去取 `mod[exportName]` 的,写成 `export default` 或改名都会拿不到组件
|
|
164
|
+
3. 模板:
|
|
165
|
+
|
|
166
|
+
```tsx
|
|
167
|
+
import { Button } from '@skyroc/native-ui';
|
|
168
|
+
import { View } from 'react-native';
|
|
169
|
+
|
|
170
|
+
const ButtonLoading = () => {
|
|
171
|
+
return (
|
|
172
|
+
<View className="gap-3 bg-background p-4">
|
|
173
|
+
{/* ... */}
|
|
174
|
+
</View>
|
|
175
|
+
);
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
export { ButtonLoading };
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
4. 约束:
|
|
182
|
+
- 不写 `'use client'`(RN,不是 Next 客户端组件)
|
|
183
|
+
- 从 `@skyroc/native-ui` 导入组件,不从内部路径导入
|
|
184
|
+
- 容器统一 `View` + uniwind 类名,带上 `bg-background p-4`,保证在文档预览的手机框里边距一致
|
|
185
|
+
- 每个 demo 只聚焦一个功能点,自包含,不依赖同目录 `shared.tsx`
|
|
186
|
+
- 需要文字就用 `@skyroc/native-ui` 的 `Text`,才能继承 `TextClassContext`
|
|
187
|
+
5. **同步汇总页**:在 `src/demos/$slug/index.tsx` 里 import 并加一个 `<Section title description>`。汇总页只负责串场,不要把示例代码写回去
|
|
188
|
+
6. **确认整页路由存在**:`apps/native-ui-playground/app/components/$slug.tsx`。它是文档右栏分栏预览的来源(`resolvePlaygroundPage` 按最后一段 slug 找同名文件),缺了文档就退回单栏
|
|
189
|
+
|
|
190
|
+
#### PropsTable 书写规则
|
|
191
|
+
|
|
192
|
+
- 短字面量联合**直接内联**到 `type` 字段,不要另起 PascalCase 类型名,也不要写 `<UnionType>`
|
|
193
|
+
- 例:`"'solid' | 'tonal' | 'outline' | 'ghost'"`、`"'sm' | 'md' | 'lg' | 'icon'"`、`"'horizontal' | 'vertical'"`
|
|
194
|
+
- 对象类型、slot 配置、子组件 Props、外部大型类型才用 PascalCase 引用
|
|
195
|
+
- `default` 用字符串写:`"'md'"`、`'false'`
|
|
196
|
+
- `required: true` 仅必填时加
|
|
197
|
+
- 表格开头或结尾说明透传关系:如「除下表外,`Button` 透传 `Pressable` 的全部属性」
|
|
198
|
+
- `ref` 也写进表里(RN 的 ref 常用于 `measure` / 滚动定位)
|
|
199
|
+
|
|
200
|
+
#### 类型完整性规则(严格遵循)
|
|
201
|
+
|
|
202
|
+
**PropsTable / TypeTable 中出现的每一个非内置 PascalCase 类型名,都必须在当前页 `## 类型` 区域有定义,或在 `type-registry.ts` 注册跨页链接。**
|
|
203
|
+
|
|
204
|
+
写完逐项核对:
|
|
205
|
+
|
|
206
|
+
1. 收集所有 `<PropsTable>` 的 `type`、所有 `<TypeTable>` 的 `fields[].type` 里的 PascalCase 词
|
|
207
|
+
2. 排除 `type-anchor.tsx` 的 `BUILTIN_TYPE_NAMES`(含 RN 原语:`PressableProps` / `ViewStyle` / `TextStyle` / `StyleProp` / `GestureResponderEvent` / `AccessibilityRole` / `View` / `Ref` 等)
|
|
208
|
+
3. 剩下的每一个都要满足:当前页 `<TypeTable name>` 定义 ∨ 当前页 `<UnionType name>` 定义 ∨ `type-registry.ts` 注册
|
|
209
|
+
4. 遗漏的如果只是短联合 → 改成内联,不补 `<UnionType>`
|
|
210
|
+
5. 用到了 PascalCase 但它是 React / RN / TS 内置或三方类型 → 加进 `BUILTIN_TYPE_NAMES`,否则会生成错误的本页锚点
|
|
211
|
+
6. 跨页引用格式:`TypeName: '/docs/components/target-slug#anchor'`(注意 `docsRoute = '/docs'`,别漏 `/docs` 前缀)
|
|
212
|
+
|
|
213
|
+
#### 类型区写法
|
|
214
|
+
|
|
215
|
+
- 先给一段 `import type { ... } from '@skyroc/native-ui'` 代码块,列出本组件对外导出的类型
|
|
216
|
+
- `<UnionType>`:联合类型(由 variants 推导出来的 `XxxVariant` / `XxxSize` / `XxxSlots` 等),一句话说明它控制什么
|
|
217
|
+
- `<TypeTable>`:对象类型(`SlotClassNames`、子组件 Props、Option / ItemData 之类)
|
|
218
|
+
- 顺序建议:`<UnionType>` 在前(跟 Props 表顺序对应),`<TypeTable>` 在后
|
|
219
|
+
|
|
220
|
+
### Phase 3:收尾核对
|
|
221
|
+
|
|
222
|
+
1. 覆盖率命令跑一遍,`<Demo>` 与 demos 目录一一对应
|
|
223
|
+
2. 分组 `meta.json` 的 `pages` 含 `$slug`
|
|
224
|
+
3. 类型完整性清单逐条过
|
|
225
|
+
4. 表格里的数值(高度、字号、间距、圆角)与 `*-variants.ts` 逐条对得上
|
|
226
|
+
5. 最终回复里区分:本次改了哪些文件、发现但未处理的实现问题、未验证的部分及原因
|
|
227
|
+
|
|
228
|
+
## 工作区边界
|
|
229
|
+
|
|
230
|
+
- 默认只动:目标 `$slug.mdx`、缺失的 playground demo 及其汇总页、分组 `meta.json`
|
|
231
|
+
- 不回滚、不格式化、不整理与本组件无关的用户改动
|
|
232
|
+
- 组件源码有未提交改动时,基于当前工作区实现写文档
|
|
233
|
+
- 只有实现问题导致文档无法正确描述组件时,才改组件源码或类型,且改之前先说明问题
|
|
234
|
+
|
|
235
|
+
## 与 web-ui 文档规范的差异
|
|
236
|
+
|
|
237
|
+
| 维度 | web-ui (`component-doc`) | native-ui(本 skill) |
|
|
238
|
+
| ------------ | -------------------------------------------- | -------------------------------------------------- |
|
|
239
|
+
| Demo 路径 | `@playground/$slug/modules/Name` | `@playground/$slug/Name`(无 `modules`) |
|
|
240
|
+
| Demo 导出 | `export default` | **具名导出,名字 === 文件名** |
|
|
241
|
+
| 内联代码块 | 推荐,跟在 `<Demo>` 后 | **不写**,`<Demo>` 已渲染完整源码 |
|
|
242
|
+
| Demo 运行时 | react-live 沙箱 + `scope.ts` | Turbopack 动态 import 真实 RN 组件,`ssr: false` |
|
|
243
|
+
| 整页预览 | 无 | 右栏手机框渲染 `app/components/$slug.tsx` 整页 |
|
|
244
|
+
| `'use client'` | 需要 | 不需要 |
|
|
245
|
+
| 内置类型白名单 | DOM / React 为主 | 额外含 RN 原语(`PressableProps` / `ViewStyle` 等) |
|