@jasonshimmy/vite-plugin-cer-app 0.1.0

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 (299) hide show
  1. package/.github/copilot-instructions.md +130 -0
  2. package/.github/workflows/publish.yml +206 -0
  3. package/.nvmrc +1 -0
  4. package/CHANGELOG.md +10 -0
  5. package/IMPLEMENTATION_PLAN.md +391 -0
  6. package/README.md +231 -0
  7. package/VITE_PLUGIN_FRAMEWORK_PLAN.md +594 -0
  8. package/commits.txt +3 -0
  9. package/dist/__tests__/plugin/path-utils.test.d.ts +2 -0
  10. package/dist/__tests__/plugin/path-utils.test.d.ts.map +1 -0
  11. package/dist/__tests__/plugin/path-utils.test.js +305 -0
  12. package/dist/__tests__/plugin/path-utils.test.js.map +1 -0
  13. package/dist/__tests__/plugin/scanner.test.d.ts +2 -0
  14. package/dist/__tests__/plugin/scanner.test.d.ts.map +1 -0
  15. package/dist/__tests__/plugin/scanner.test.js +143 -0
  16. package/dist/__tests__/plugin/scanner.test.js.map +1 -0
  17. package/dist/__tests__/plugin/transforms/auto-import.test.d.ts +2 -0
  18. package/dist/__tests__/plugin/transforms/auto-import.test.d.ts.map +1 -0
  19. package/dist/__tests__/plugin/transforms/auto-import.test.js +151 -0
  20. package/dist/__tests__/plugin/transforms/auto-import.test.js.map +1 -0
  21. package/dist/__tests__/plugin/transforms/head-inject.test.d.ts +2 -0
  22. package/dist/__tests__/plugin/transforms/head-inject.test.d.ts.map +1 -0
  23. package/dist/__tests__/plugin/transforms/head-inject.test.js +151 -0
  24. package/dist/__tests__/plugin/transforms/head-inject.test.js.map +1 -0
  25. package/dist/__tests__/plugin/virtual/components.test.d.ts +2 -0
  26. package/dist/__tests__/plugin/virtual/components.test.d.ts.map +1 -0
  27. package/dist/__tests__/plugin/virtual/components.test.js +47 -0
  28. package/dist/__tests__/plugin/virtual/components.test.js.map +1 -0
  29. package/dist/__tests__/plugin/virtual/composables.test.d.ts +2 -0
  30. package/dist/__tests__/plugin/virtual/composables.test.d.ts.map +1 -0
  31. package/dist/__tests__/plugin/virtual/composables.test.js +48 -0
  32. package/dist/__tests__/plugin/virtual/composables.test.js.map +1 -0
  33. package/dist/__tests__/plugin/virtual/layouts.test.d.ts +2 -0
  34. package/dist/__tests__/plugin/virtual/layouts.test.d.ts.map +1 -0
  35. package/dist/__tests__/plugin/virtual/layouts.test.js +59 -0
  36. package/dist/__tests__/plugin/virtual/layouts.test.js.map +1 -0
  37. package/dist/__tests__/plugin/virtual/middleware.test.d.ts +2 -0
  38. package/dist/__tests__/plugin/virtual/middleware.test.d.ts.map +1 -0
  39. package/dist/__tests__/plugin/virtual/middleware.test.js +58 -0
  40. package/dist/__tests__/plugin/virtual/middleware.test.js.map +1 -0
  41. package/dist/__tests__/plugin/virtual/plugins.test.d.ts +2 -0
  42. package/dist/__tests__/plugin/virtual/plugins.test.d.ts.map +1 -0
  43. package/dist/__tests__/plugin/virtual/plugins.test.js +73 -0
  44. package/dist/__tests__/plugin/virtual/plugins.test.js.map +1 -0
  45. package/dist/__tests__/plugin/virtual/routes.test.d.ts +2 -0
  46. package/dist/__tests__/plugin/virtual/routes.test.d.ts.map +1 -0
  47. package/dist/__tests__/plugin/virtual/routes.test.js +167 -0
  48. package/dist/__tests__/plugin/virtual/routes.test.js.map +1 -0
  49. package/dist/__tests__/plugin/virtual/server-api.test.d.ts +2 -0
  50. package/dist/__tests__/plugin/virtual/server-api.test.d.ts.map +1 -0
  51. package/dist/__tests__/plugin/virtual/server-api.test.js +72 -0
  52. package/dist/__tests__/plugin/virtual/server-api.test.js.map +1 -0
  53. package/dist/__tests__/runtime/use-head.test.d.ts +2 -0
  54. package/dist/__tests__/runtime/use-head.test.d.ts.map +1 -0
  55. package/dist/__tests__/runtime/use-head.test.js +202 -0
  56. package/dist/__tests__/runtime/use-head.test.js.map +1 -0
  57. package/dist/__tests__/runtime/use-page-data.test.d.ts +2 -0
  58. package/dist/__tests__/runtime/use-page-data.test.d.ts.map +1 -0
  59. package/dist/__tests__/runtime/use-page-data.test.js +41 -0
  60. package/dist/__tests__/runtime/use-page-data.test.js.map +1 -0
  61. package/dist/cli/commands/build.d.ts +3 -0
  62. package/dist/cli/commands/build.d.ts.map +1 -0
  63. package/dist/cli/commands/build.js +103 -0
  64. package/dist/cli/commands/build.js.map +1 -0
  65. package/dist/cli/commands/dev.d.ts +3 -0
  66. package/dist/cli/commands/dev.d.ts.map +1 -0
  67. package/dist/cli/commands/dev.js +92 -0
  68. package/dist/cli/commands/dev.js.map +1 -0
  69. package/dist/cli/commands/generate.d.ts +7 -0
  70. package/dist/cli/commands/generate.d.ts.map +1 -0
  71. package/dist/cli/commands/generate.js +72 -0
  72. package/dist/cli/commands/generate.js.map +1 -0
  73. package/dist/cli/commands/preview.d.ts +3 -0
  74. package/dist/cli/commands/preview.d.ts.map +1 -0
  75. package/dist/cli/commands/preview.js +191 -0
  76. package/dist/cli/commands/preview.js.map +1 -0
  77. package/dist/cli/create/index.d.ts +3 -0
  78. package/dist/cli/create/index.d.ts.map +1 -0
  79. package/dist/cli/create/index.js +184 -0
  80. package/dist/cli/create/index.js.map +1 -0
  81. package/dist/cli/index.d.ts +3 -0
  82. package/dist/cli/index.d.ts.map +1 -0
  83. package/dist/cli/index.js +17 -0
  84. package/dist/cli/index.js.map +1 -0
  85. package/dist/index.d.ts +9 -0
  86. package/dist/index.d.ts.map +1 -0
  87. package/dist/index.js +4 -0
  88. package/dist/index.js.map +1 -0
  89. package/dist/plugin/build-ssg.d.ts +12 -0
  90. package/dist/plugin/build-ssg.d.ts.map +1 -0
  91. package/dist/plugin/build-ssg.js +212 -0
  92. package/dist/plugin/build-ssg.js.map +1 -0
  93. package/dist/plugin/build-ssr.d.ts +10 -0
  94. package/dist/plugin/build-ssr.d.ts.map +1 -0
  95. package/dist/plugin/build-ssr.js +139 -0
  96. package/dist/plugin/build-ssr.js.map +1 -0
  97. package/dist/plugin/dev-server.d.ts +46 -0
  98. package/dist/plugin/dev-server.d.ts.map +1 -0
  99. package/dist/plugin/dev-server.js +194 -0
  100. package/dist/plugin/dev-server.js.map +1 -0
  101. package/dist/plugin/dts-generator.d.ts +27 -0
  102. package/dist/plugin/dts-generator.d.ts.map +1 -0
  103. package/dist/plugin/dts-generator.js +180 -0
  104. package/dist/plugin/dts-generator.js.map +1 -0
  105. package/dist/plugin/index.d.ts +13 -0
  106. package/dist/plugin/index.d.ts.map +1 -0
  107. package/dist/plugin/index.js +298 -0
  108. package/dist/plugin/index.js.map +1 -0
  109. package/dist/plugin/path-utils.d.ts +57 -0
  110. package/dist/plugin/path-utils.d.ts.map +1 -0
  111. package/dist/plugin/path-utils.js +160 -0
  112. package/dist/plugin/path-utils.js.map +1 -0
  113. package/dist/plugin/scanner.d.ts +17 -0
  114. package/dist/plugin/scanner.d.ts.map +1 -0
  115. package/dist/plugin/scanner.js +54 -0
  116. package/dist/plugin/scanner.js.map +1 -0
  117. package/dist/plugin/transforms/auto-import.d.ts +14 -0
  118. package/dist/plugin/transforms/auto-import.d.ts.map +1 -0
  119. package/dist/plugin/transforms/auto-import.js +154 -0
  120. package/dist/plugin/transforms/auto-import.js.map +1 -0
  121. package/dist/plugin/transforms/head-inject.d.ts +29 -0
  122. package/dist/plugin/transforms/head-inject.d.ts.map +1 -0
  123. package/dist/plugin/transforms/head-inject.js +127 -0
  124. package/dist/plugin/transforms/head-inject.js.map +1 -0
  125. package/dist/plugin/virtual/components.d.ts +6 -0
  126. package/dist/plugin/virtual/components.d.ts.map +1 -0
  127. package/dist/plugin/virtual/components.js +22 -0
  128. package/dist/plugin/virtual/components.js.map +1 -0
  129. package/dist/plugin/virtual/composables.d.ts +6 -0
  130. package/dist/plugin/virtual/composables.d.ts.map +1 -0
  131. package/dist/plugin/virtual/composables.js +22 -0
  132. package/dist/plugin/virtual/composables.js.map +1 -0
  133. package/dist/plugin/virtual/error.d.ts +13 -0
  134. package/dist/plugin/virtual/error.d.ts.map +1 -0
  135. package/dist/plugin/virtual/error.js +32 -0
  136. package/dist/plugin/virtual/error.js.map +1 -0
  137. package/dist/plugin/virtual/layouts.d.ts +6 -0
  138. package/dist/plugin/virtual/layouts.d.ts.map +1 -0
  139. package/dist/plugin/virtual/layouts.js +33 -0
  140. package/dist/plugin/virtual/layouts.js.map +1 -0
  141. package/dist/plugin/virtual/loading.d.ts +11 -0
  142. package/dist/plugin/virtual/loading.d.ts.map +1 -0
  143. package/dist/plugin/virtual/loading.js +30 -0
  144. package/dist/plugin/virtual/loading.js.map +1 -0
  145. package/dist/plugin/virtual/middleware.d.ts +6 -0
  146. package/dist/plugin/virtual/middleware.d.ts.map +1 -0
  147. package/dist/plugin/virtual/middleware.js +36 -0
  148. package/dist/plugin/virtual/middleware.js.map +1 -0
  149. package/dist/plugin/virtual/plugins.d.ts +6 -0
  150. package/dist/plugin/virtual/plugins.d.ts.map +1 -0
  151. package/dist/plugin/virtual/plugins.js +30 -0
  152. package/dist/plugin/virtual/plugins.js.map +1 -0
  153. package/dist/plugin/virtual/routes.d.ts +16 -0
  154. package/dist/plugin/virtual/routes.d.ts.map +1 -0
  155. package/dist/plugin/virtual/routes.js +131 -0
  156. package/dist/plugin/virtual/routes.js.map +1 -0
  157. package/dist/plugin/virtual/server-api.d.ts +6 -0
  158. package/dist/plugin/virtual/server-api.d.ts.map +1 -0
  159. package/dist/plugin/virtual/server-api.js +41 -0
  160. package/dist/plugin/virtual/server-api.js.map +1 -0
  161. package/dist/plugin/virtual/server-middleware.d.ts +6 -0
  162. package/dist/plugin/virtual/server-middleware.d.ts.map +1 -0
  163. package/dist/plugin/virtual/server-middleware.js +36 -0
  164. package/dist/plugin/virtual/server-middleware.js.map +1 -0
  165. package/dist/runtime/app-template.d.ts +10 -0
  166. package/dist/runtime/app-template.d.ts.map +1 -0
  167. package/dist/runtime/app-template.js +143 -0
  168. package/dist/runtime/app-template.js.map +1 -0
  169. package/dist/runtime/composables/index.d.ts +4 -0
  170. package/dist/runtime/composables/index.d.ts.map +1 -0
  171. package/dist/runtime/composables/index.js +3 -0
  172. package/dist/runtime/composables/index.js.map +1 -0
  173. package/dist/runtime/composables/use-head.d.ts +30 -0
  174. package/dist/runtime/composables/use-head.d.ts.map +1 -0
  175. package/dist/runtime/composables/use-head.js +182 -0
  176. package/dist/runtime/composables/use-head.js.map +1 -0
  177. package/dist/runtime/composables/use-page-data.d.ts +32 -0
  178. package/dist/runtime/composables/use-page-data.d.ts.map +1 -0
  179. package/dist/runtime/composables/use-page-data.js +41 -0
  180. package/dist/runtime/composables/use-page-data.js.map +1 -0
  181. package/dist/runtime/entry-client-template.d.ts +8 -0
  182. package/dist/runtime/entry-client-template.d.ts.map +1 -0
  183. package/dist/runtime/entry-client-template.js +18 -0
  184. package/dist/runtime/entry-client-template.js.map +1 -0
  185. package/dist/runtime/entry-server-template.d.ts +9 -0
  186. package/dist/runtime/entry-server-template.d.ts.map +1 -0
  187. package/dist/runtime/entry-server-template.js +72 -0
  188. package/dist/runtime/entry-server-template.js.map +1 -0
  189. package/dist/types/api.d.ts +16 -0
  190. package/dist/types/api.d.ts.map +1 -0
  191. package/dist/types/api.js +2 -0
  192. package/dist/types/api.js.map +1 -0
  193. package/dist/types/config.d.ts +32 -0
  194. package/dist/types/config.d.ts.map +1 -0
  195. package/dist/types/config.js +4 -0
  196. package/dist/types/config.js.map +1 -0
  197. package/dist/types/index.d.ts +7 -0
  198. package/dist/types/index.d.ts.map +1 -0
  199. package/dist/types/index.js +2 -0
  200. package/dist/types/index.js.map +1 -0
  201. package/dist/types/middleware.d.ts +6 -0
  202. package/dist/types/middleware.d.ts.map +1 -0
  203. package/dist/types/middleware.js +2 -0
  204. package/dist/types/middleware.js.map +1 -0
  205. package/dist/types/page.d.ts +21 -0
  206. package/dist/types/page.d.ts.map +1 -0
  207. package/dist/types/page.js +2 -0
  208. package/dist/types/page.js.map +1 -0
  209. package/dist/types/plugin.d.ts +12 -0
  210. package/dist/types/plugin.d.ts.map +1 -0
  211. package/dist/types/plugin.js +2 -0
  212. package/dist/types/plugin.js.map +1 -0
  213. package/docs/cli.md +233 -0
  214. package/docs/components.md +114 -0
  215. package/docs/composables.md +99 -0
  216. package/docs/configuration.md +270 -0
  217. package/docs/data-loading.md +165 -0
  218. package/docs/getting-started.md +235 -0
  219. package/docs/head-management.md +206 -0
  220. package/docs/layouts.md +112 -0
  221. package/docs/middleware.md +140 -0
  222. package/docs/plugins.md +138 -0
  223. package/docs/rendering-modes.md +251 -0
  224. package/docs/routing.md +180 -0
  225. package/docs/server-api.md +172 -0
  226. package/docs/testing.md +462 -0
  227. package/package.json +75 -0
  228. package/src/__tests__/plugin/path-utils.test.ts +399 -0
  229. package/src/__tests__/plugin/scanner.test.ts +172 -0
  230. package/src/__tests__/plugin/transforms/auto-import.test.ts +229 -0
  231. package/src/__tests__/plugin/transforms/head-inject.test.ts +178 -0
  232. package/src/__tests__/plugin/virtual/components.test.ts +56 -0
  233. package/src/__tests__/plugin/virtual/composables.test.ts +57 -0
  234. package/src/__tests__/plugin/virtual/layouts.test.ts +70 -0
  235. package/src/__tests__/plugin/virtual/middleware.test.ts +68 -0
  236. package/src/__tests__/plugin/virtual/plugins.test.ts +84 -0
  237. package/src/__tests__/plugin/virtual/routes.test.ts +202 -0
  238. package/src/__tests__/plugin/virtual/server-api.test.ts +85 -0
  239. package/src/__tests__/runtime/use-head.test.ts +243 -0
  240. package/src/__tests__/runtime/use-page-data.test.ts +45 -0
  241. package/src/cli/commands/build.ts +114 -0
  242. package/src/cli/commands/dev.ts +101 -0
  243. package/src/cli/commands/generate.ts +81 -0
  244. package/src/cli/commands/preview.ts +218 -0
  245. package/src/cli/create/index.ts +250 -0
  246. package/src/cli/create/templates/spa/app/app.ts.tpl +74 -0
  247. package/src/cli/create/templates/spa/app/layouts/default.ts.tpl +15 -0
  248. package/src/cli/create/templates/spa/app/pages/index.ts.tpl +8 -0
  249. package/src/cli/create/templates/spa/cer.config.ts.tpl +6 -0
  250. package/src/cli/create/templates/spa/index.html.tpl +12 -0
  251. package/src/cli/create/templates/spa/package.json.tpl +18 -0
  252. package/src/cli/create/templates/ssg/app/app.ts.tpl +74 -0
  253. package/src/cli/create/templates/ssg/app/layouts/default.ts.tpl +15 -0
  254. package/src/cli/create/templates/ssg/app/pages/index.ts.tpl +17 -0
  255. package/src/cli/create/templates/ssg/cer.config.ts.tpl +13 -0
  256. package/src/cli/create/templates/ssg/index.html.tpl +12 -0
  257. package/src/cli/create/templates/ssg/package.json.tpl +19 -0
  258. package/src/cli/create/templates/ssr/app/app.ts.tpl +74 -0
  259. package/src/cli/create/templates/ssr/app/layouts/default.ts.tpl +15 -0
  260. package/src/cli/create/templates/ssr/app/pages/index.ts.tpl +8 -0
  261. package/src/cli/create/templates/ssr/cer.config.ts.tpl +10 -0
  262. package/src/cli/create/templates/ssr/index.html.tpl +12 -0
  263. package/src/cli/create/templates/ssr/package.json.tpl +18 -0
  264. package/src/cli/index.ts +20 -0
  265. package/src/index.ts +13 -0
  266. package/src/plugin/build-ssg.ts +259 -0
  267. package/src/plugin/build-ssr.ts +147 -0
  268. package/src/plugin/dev-server.ts +266 -0
  269. package/src/plugin/dts-generator.ts +214 -0
  270. package/src/plugin/index.ts +330 -0
  271. package/src/plugin/path-utils.ts +186 -0
  272. package/src/plugin/scanner.ts +65 -0
  273. package/src/plugin/transforms/auto-import.ts +190 -0
  274. package/src/plugin/transforms/head-inject.ts +161 -0
  275. package/src/plugin/virtual/components.ts +28 -0
  276. package/src/plugin/virtual/composables.ts +28 -0
  277. package/src/plugin/virtual/error.ts +34 -0
  278. package/src/plugin/virtual/layouts.ts +41 -0
  279. package/src/plugin/virtual/loading.ts +33 -0
  280. package/src/plugin/virtual/middleware.ts +45 -0
  281. package/src/plugin/virtual/plugins.ts +36 -0
  282. package/src/plugin/virtual/routes.ts +147 -0
  283. package/src/plugin/virtual/server-api.ts +52 -0
  284. package/src/plugin/virtual/server-middleware.ts +44 -0
  285. package/src/runtime/app-template.ts +142 -0
  286. package/src/runtime/composables/index.ts +3 -0
  287. package/src/runtime/composables/use-head.ts +204 -0
  288. package/src/runtime/composables/use-page-data.ts +39 -0
  289. package/src/runtime/entry-client-template.ts +17 -0
  290. package/src/runtime/entry-server-template.ts +71 -0
  291. package/src/types/api.ts +19 -0
  292. package/src/types/config.ts +39 -0
  293. package/src/types/index.ts +6 -0
  294. package/src/types/middleware.ts +16 -0
  295. package/src/types/page.ts +29 -0
  296. package/src/types/plugin.ts +13 -0
  297. package/tsconfig.build.json +10 -0
  298. package/tsconfig.json +19 -0
  299. package/vitest.config.ts +29 -0
@@ -0,0 +1,130 @@
1
+ ---
2
+ applyTo: '**'
3
+ ---
4
+
5
+ You are an expert in TypeScript, JavaScript, HTML, CSS. Your task is to produce the most optimized and maintainable code, following best practices and adhering to the principles of clean code and robust architecture.
6
+
7
+ ## Objective
8
+
9
+ - Create a Web Component Runtime solution that is not only functional but also adheres to the best practices in performance, security, and maintainability.
10
+ - When implementing features, prioritize simplicity and clarity in the codebase.
11
+ - When communicating with the user, you don't need to ask for permission before making cleanups or optimizations. Instead, focus on delivering a solution that is efficient and easy to understand.
12
+
13
+ ## Commands to Know
14
+
15
+ - `npm run build`: Builds the project for production.
16
+ - `npm run dev`: Starts the development server with hot-reloading.
17
+ - `npm test`: Runs the test suite using Vitest.
18
+ - `npm test:watch`: Runs the test suite using Vitest in development watch mode.
19
+ - `npm run test:coverage`: Generates a code coverage report.
20
+
21
+ ## Code Style and Structure
22
+
23
+ - ALL CODE MUST BE: lightweight, developer friendly, strongly typed, performant, and scalable.
24
+ - Write concise, technical TypeScript code with accurate examples.
25
+ - Use functional and declarative programming patterns; avoid classes.
26
+ - Prefer iteration and modularization over code duplication.
27
+ - Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
28
+ - Structure files: exported component, subcomponents, helpers, static content, types.
29
+ - Use lowercase with dashes for directory names (e.g., `components/auth-wizard`).
30
+ - Use kebab-case for file names (e.g., `auth-wizard.ts`).
31
+ - Avoid using "this" keyword in functional components.
32
+ - Prefer pure functions and avoid side effects.
33
+ - Use immutable data structures where possible.
34
+ - Use JSDoc comments for functions and components to improve IDE intellisense.
35
+
36
+ ## Markdown Documentation
37
+
38
+ All documentation written in the docs directory should be:
39
+
40
+ - In Markdown format
41
+ - Structured with clear headings and subheadings
42
+ - Include code examples where applicable
43
+ - Use consistent terminology and phrasing
44
+ - Be 100% accurate with the actual code implementation
45
+ - Be easy to read and understand
46
+ - Be concise and to the point
47
+ - Use emojis for titles
48
+
49
+ ## Naming Conventions
50
+
51
+ - Use lowercase with dashes for directories (e.g., components/auth-wizard).
52
+ - Favor named exports for components.
53
+
54
+ ## TypeScript Usage
55
+
56
+ - Use strict TypeScript for all code; prefer interfaces over types.
57
+ - Avoid enums; use maps instead.
58
+ - Use functional components with TypeScript interfaces.
59
+ - Never use "any" type; always prefer strongly typed definitions.
60
+
61
+ ## Syntax and Formatting
62
+
63
+ - Use the "function" keyword for pure functions.
64
+ - Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.
65
+
66
+ ## UI and Styling
67
+
68
+ - Generate Custom Elements using our lib/index.ts for components and styling.
69
+ - Implement responsive design; use a mobile-first approach.
70
+
71
+ ## Performance Optimization
72
+
73
+ - Use TypeScript and JavaScript best practices to ensure high performance.
74
+ - Always favor tree-shaking and code splitting.
75
+ - Optimize images: use WebP format, include size data, implement lazy loading.
76
+
77
+ ## Security and Performance
78
+
79
+ - Implement proper error handling, user input validation, and secure coding practices.
80
+ - Follow performance optimization techniques, such as reducing load times and improving rendering efficiency.
81
+
82
+ ## Testing and Documentation
83
+
84
+ - Write unit tests for components using Vitest.
85
+ - Provide clear and concise comments for complex logic.
86
+ - Use JSDoc comments for functions and components to improve IDE intellisense.
87
+
88
+ ## Error Handling and Validation
89
+
90
+ - Prioritize error handling and edge cases:
91
+ - Use early returns for error conditions.
92
+ - Implement guard clauses to handle preconditions and invalid states early.
93
+ - Use custom error types for consistent error handling.
94
+
95
+ ## Key Conventions
96
+
97
+ - NEVER GUESS OR ASSUME! Always make informed decisions based on available data in a project.
98
+ - Always use strongly typed TypeScript.
99
+ - Keep code lightweight and modular.
100
+ - Do not use external dependencies.
101
+ - Keep code performant.
102
+ - Keep code secure.
103
+ - Keep code developer friendly and easy to use.
104
+ - Keep code easy to read and understand.
105
+ - Keep code maintainable and scalable.
106
+ - Always write tests for your code.
107
+ - Always follow best practices in coding, security, and performance.
108
+ - A change can only be considered complete when it meets all the above criteria and has been thoroughly tested and reviewed. THIS IS NON-NEGOTIABLE.
109
+
110
+ ## Methodology
111
+
112
+ 1. **System 2 Thinking**: Approach the problem with analytical rigor. Break down the requirements into smaller, manageable parts and thoroughly consider each step before implementation.
113
+ 2. **Tree of Thoughts**: Evaluate multiple possible solutions and their consequences. Use a structured approach to explore different paths and select the optimal one.
114
+ 3. **Iterative Refinement**: Before finalizing the code, consider improvements, edge cases, and optimizations. Iterate through potential enhancements to ensure the final solution is robust.
115
+
116
+ ## Process:
117
+
118
+ 1. **Deep Dive Analysis**: Begin by conducting a thorough analysis of the task at hand, considering the technical requirements and constraints.
119
+ 2. **Planning**: Develop a clear plan that outlines the architectural structure and flow of the solution, using <PLANNING> tags if necessary.
120
+ 3. **Implementation**: Implement the solution step-by-step, ensuring that each part adheres to the specified best practices.
121
+ 4. **Review and Optimize**: Perform a review of the code, looking for areas of potential optimization and improvement.
122
+ 5. **Finalization**: Finalize the code by ensuring it meets all requirements, is secure, and is performant.
123
+
124
+ ### Coding Environment
125
+
126
+ The user asks questions about the following coding languages:
127
+
128
+ - TypeScript
129
+ - HTML
130
+ - CSS
@@ -0,0 +1,206 @@
1
+ name: Publish to npm
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - develop
8
+
9
+ permissions:
10
+ contents: write
11
+
12
+ concurrency:
13
+ group: release-${{ github.ref_name }}
14
+ cancel-in-progress: false
15
+
16
+ env:
17
+ FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'
18
+
19
+ jobs:
20
+ release:
21
+ runs-on: ubuntu-latest
22
+ timeout-minutes: 15
23
+
24
+ steps:
25
+ - name: Checkout code
26
+ uses: actions/checkout@v4
27
+ with:
28
+ fetch-depth: 0 # Fetch all history and tags
29
+
30
+ # Resolve the latest tag once so all subsequent steps share the same baseline.
31
+ - name: Resolve baseline tag
32
+ id: base
33
+ run: |
34
+ LATEST_TAG=$(git tag --sort=-version:refname | head -n1)
35
+ if [ -z "$LATEST_TAG" ]; then
36
+ COMMIT_RANGE="HEAD"
37
+ else
38
+ COMMIT_RANGE="${LATEST_TAG}..HEAD"
39
+ fi
40
+ echo "latest_tag=$LATEST_TAG" >> $GITHUB_OUTPUT
41
+ echo "commit_range=$COMMIT_RANGE" >> $GITHUB_OUTPUT
42
+ echo "Baseline tag: ${LATEST_TAG:-'(none - first release)'}"
43
+ echo "Commit range: $COMMIT_RANGE"
44
+
45
+ # Skip release if every commit since the last tag is chore: or docs:
46
+ # Breaking variants (chore!: / docs!:) are intentionally not excluded.
47
+ - name: Check if release is needed
48
+ id: should_release
49
+ run: |
50
+ COMMIT_RANGE="${{ steps.base.outputs.commit_range }}"
51
+ RELEASE_COMMITS=$(git log "$COMMIT_RANGE" --pretty=format:"%s" --no-merges \
52
+ | grep -vE "^(chore|docs)(\([^)]+\))?:" || true)
53
+ if [ -z "$RELEASE_COMMITS" ]; then
54
+ echo "value=false" >> $GITHUB_OUTPUT
55
+ echo "## Release skipped" >> $GITHUB_STEP_SUMMARY
56
+ echo "All commits since the last release use \`chore:\` or \`docs:\` prefixes — nothing to publish." >> $GITHUB_STEP_SUMMARY
57
+ else
58
+ echo "value=true" >> $GITHUB_OUTPUT
59
+ fi
60
+
61
+ - name: Use Node.js version from .nvmrc
62
+ if: steps.should_release.outputs.value == 'true'
63
+ uses: actions/setup-node@v4
64
+ with:
65
+ node-version-file: .nvmrc
66
+ registry-url: 'https://registry.npmjs.org/'
67
+
68
+ - name: Cache node modules
69
+ if: steps.should_release.outputs.value == 'true'
70
+ uses: actions/cache@v4
71
+ with:
72
+ path: node_modules
73
+ key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
74
+ restore-keys: |
75
+ ${{ runner.os }}-node-
76
+
77
+ - name: Install dependencies
78
+ if: steps.should_release.outputs.value == 'true'
79
+ run: npm ci
80
+
81
+ - name: Run tests
82
+ if: steps.should_release.outputs.value == 'true'
83
+ run: npm test
84
+
85
+ - name: Build library
86
+ if: steps.should_release.outputs.value == 'true'
87
+ run: npm run build
88
+
89
+ - name: Configure Git
90
+ if: steps.should_release.outputs.value == 'true'
91
+ run: |
92
+ git config user.name "GitHub Actions"
93
+ git config user.email "actions@github.com"
94
+ git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
95
+
96
+ # Scan ALL commits since the last tag (not just HEAD) and handle the full
97
+ # conventional-commits spec: type(scope)!: and BREAKING CHANGE: in body.
98
+ - name: Determine version bump
99
+ id: bump
100
+ if: steps.should_release.outputs.value == 'true'
101
+ run: |
102
+ COMMIT_RANGE="${{ steps.base.outputs.commit_range }}"
103
+
104
+ SUBJECTS=$(git log "$COMMIT_RANGE" --pretty=format:"%s" --no-merges)
105
+ FULL_LOG=$(git log "$COMMIT_RANGE" --pretty=format:"%s%n%b" --no-merges)
106
+
107
+ BUMP="patch"
108
+
109
+ # Major: explicit BREAKING CHANGE footer OR ! after type/scope (e.g. feat!: / feat(scope)!:)
110
+ if echo "$FULL_LOG" | grep -qE "^BREAKING CHANGE:" || \
111
+ echo "$SUBJECTS" | grep -qE "^[a-z]+(\([^)]+\))?!:"; then
112
+ BUMP="major"
113
+ # Minor: feat: or feat(scope):
114
+ elif echo "$SUBJECTS" | grep -qE "^feat(\([^)]+\))?:"; then
115
+ BUMP="minor"
116
+ fi
117
+
118
+ echo "Bump type: $BUMP"
119
+ echo "bump=$BUMP" >> $GITHUB_OUTPUT
120
+
121
+ - name: Generate release notes
122
+ if: steps.should_release.outputs.value == 'true'
123
+ run: |
124
+ COMMIT_RANGE="${{ steps.base.outputs.commit_range }}"
125
+
126
+ COMMITS=$(git log "$COMMIT_RANGE" --pretty=format:"- %s (%h)" --no-merges \
127
+ | grep -vE "^- (release:|chore: update changelog)" || true)
128
+
129
+ if [ -z "$COMMITS" ]; then
130
+ COMMITS="- No changes since last release"
131
+ fi
132
+
133
+ echo "$COMMITS" > commits.txt
134
+
135
+ - name: Bump version
136
+ id: version
137
+ if: steps.should_release.outputs.value == 'true'
138
+ run: |
139
+ BUMP="${{ steps.bump.outputs.bump }}"
140
+ if [[ "${{ github.ref_name }}" == "develop" ]]; then
141
+ NEW_VERSION=$(npm version prerelease --preid=beta -m "release: %s [skip ci]")
142
+ else
143
+ NEW_VERSION=$(npm version "$BUMP" -m "release: %s [skip ci]")
144
+ fi
145
+ echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
146
+ git push --follow-tags
147
+
148
+ - name: Create release and update changelog
149
+ if: steps.should_release.outputs.value == 'true'
150
+ run: |
151
+ VERSION="${{ steps.version.outputs.version }}"
152
+ PREV_TAG="${{ steps.base.outputs.latest_tag }}"
153
+ COMMITS=$(cat commits.txt)
154
+ DATE=$(date +"%Y-%m-%d")
155
+
156
+ if [ -n "$PREV_TAG" ]; then
157
+ CHANGELOG_LINK="**Full Changelog**: https://github.com/${{ github.repository }}/compare/${PREV_TAG}...${VERSION}"
158
+ else
159
+ CHANGELOG_LINK="**Full Changelog**: https://github.com/${{ github.repository }}/commits/${VERSION}"
160
+ fi
161
+
162
+ RELEASE_NOTES=$(printf '## Release %s\n\n### Changes\n%s\n\n%s' \
163
+ "$VERSION" "$COMMITS" "$CHANGELOG_LINK")
164
+
165
+ # Update or create CHANGELOG.md
166
+ if [ ! -f CHANGELOG.md ]; then
167
+ printf "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\n" > CHANGELOG.md
168
+ fi
169
+
170
+ {
171
+ head -3 CHANGELOG.md
172
+ printf "## [%s] - %s\n\n%s\n\n" "$VERSION" "$DATE" "$COMMITS"
173
+ tail -n +4 CHANGELOG.md
174
+ } > CHANGELOG.tmp && mv CHANGELOG.tmp CHANGELOG.md
175
+
176
+ git add CHANGELOG.md
177
+ git commit -m "chore: update changelog for ${VERSION} [skip ci]" || true
178
+ git push
179
+
180
+ # Use python3 for safe multi-line JSON encoding (avoids sed escaping pitfalls)
181
+ ESCAPED_BODY=$(printf '%s' "$RELEASE_NOTES" | python3 -c "import sys,json; print(json.dumps(sys.stdin.read()))")
182
+
183
+ if [[ "${{ github.ref_name }}" == "develop" ]]; then
184
+ PRERELEASE="true"
185
+ RELEASE_NAME="${VERSION} (Beta)"
186
+ else
187
+ PRERELEASE="false"
188
+ RELEASE_NAME="${VERSION}"
189
+ fi
190
+
191
+ curl -fsSL -X POST \
192
+ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
193
+ -H "Accept: application/vnd.github.v3+json" \
194
+ https://api.github.com/repos/${{ github.repository }}/releases \
195
+ -d "{\"tag_name\":\"${VERSION}\",\"name\":\"${RELEASE_NAME}\",\"body\":${ESCAPED_BODY},\"prerelease\":${PRERELEASE}}"
196
+
197
+ - name: Publish to npm
198
+ if: steps.should_release.outputs.value == 'true'
199
+ run: |
200
+ if [[ "${{ github.ref_name }}" == "develop" ]]; then
201
+ npm publish --tag beta
202
+ else
203
+ npm publish
204
+ fi
205
+ env:
206
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ v22.18.0
package/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ ## [v0.1.0] - 2026-03-18
5
+
6
+ - fix: add nvmrc (7065201)
7
+ - feat: add publishing capability (812152b)
8
+ - initial commit (43a8365)
9
+
10
+