@jmruthers/pace-core 0.5.184 → 0.5.186

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 (319) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +60 -1
  3. package/core-usage-manifest.json +312 -0
  4. package/dist/{DataTable-QAB34V6K.js → DataTable-IX2NBUTP.js} +6 -6
  5. package/dist/{DataTable-Bz8ffqyA.d.ts → DataTable-Z9NLVJh0.d.ts} +1 -1
  6. package/dist/{index-Bl--n7-T.d.ts → PublicPageProvider-DIzEzwKl.d.ts} +23 -10
  7. package/dist/{UnifiedAuthProvider-7F6T4B6K.js → UnifiedAuthProvider-A4BCQRJY.js} +4 -2
  8. package/dist/{UnifiedAuthProvider-F86d7dSi.d.ts → UnifiedAuthProvider-BG0AL5eE.d.ts} +2 -1
  9. package/dist/{api-ROMBCNKU.js → api-BMFCXVQX.js} +2 -2
  10. package/dist/{chunk-RA3JUFMW.js → chunk-445GEP27.js} +154 -4
  11. package/dist/{chunk-RA3JUFMW.js.map → chunk-445GEP27.js.map} +1 -1
  12. package/dist/{chunk-W22JP75J.js → chunk-DAGICKHT.js} +9 -7
  13. package/dist/chunk-DAGICKHT.js.map +1 -0
  14. package/dist/{chunk-FUEYYMX5.js → chunk-FXFJRTKI.js} +24 -3
  15. package/dist/chunk-FXFJRTKI.js.map +1 -0
  16. package/dist/{chunk-CSOFYHAG.js → chunk-GRIQLQ52.js} +374 -60
  17. package/dist/chunk-GRIQLQ52.js.map +1 -0
  18. package/dist/{chunk-NQPMQGS2.js → chunk-HDCUMOOI.js} +497 -399
  19. package/dist/chunk-HDCUMOOI.js.map +1 -0
  20. package/dist/chunk-HESYZWZW.js +388 -0
  21. package/dist/chunk-HESYZWZW.js.map +1 -0
  22. package/dist/{chunk-QUVSNGIP.js → chunk-HGPQUCBC.js} +34 -9
  23. package/dist/{chunk-QUVSNGIP.js.map → chunk-HGPQUCBC.js.map} +1 -1
  24. package/dist/{chunk-PWAHJW4G.js → chunk-OALXJH4Y.js} +86 -33
  25. package/dist/chunk-OALXJH4Y.js.map +1 -0
  26. package/dist/{chunk-MI7HBHN3.js → chunk-TC7D3CR3.js} +89 -9
  27. package/dist/chunk-TC7D3CR3.js.map +1 -0
  28. package/dist/chunk-THRPYOFK.js +215 -0
  29. package/dist/chunk-THRPYOFK.js.map +1 -0
  30. package/dist/{chunk-M7W4CP3M.js → chunk-U6WNSFX5.js} +2 -1
  31. package/dist/chunk-U6WNSFX5.js.map +1 -0
  32. package/dist/{chunk-UHNYIBXL.js → chunk-UQWSHFVX.js} +1 -1
  33. package/dist/chunk-UQWSHFVX.js.map +1 -0
  34. package/dist/{chunk-QCDXODCA.js → chunk-XAUHJD3L.js} +2 -2
  35. package/dist/components.d.ts +182 -6
  36. package/dist/components.js +157 -11
  37. package/dist/components.js.map +1 -1
  38. package/dist/{database.generated-CBmg2950.d.ts → database.generated-DI89OQeI.d.ts} +63 -9
  39. package/dist/eslint-rules/pace-core-compliance.cjs +406 -0
  40. package/dist/{file-reference-D06mEEWW.d.ts → file-reference-PRTSLxKx.d.ts} +10 -1
  41. package/dist/hooks.d.ts +52 -15
  42. package/dist/hooks.js +12 -22
  43. package/dist/hooks.js.map +1 -1
  44. package/dist/index.d.ts +12 -12
  45. package/dist/index.js +82 -18
  46. package/dist/index.js.map +1 -1
  47. package/dist/providers.d.ts +1 -1
  48. package/dist/providers.js +3 -1
  49. package/dist/rbac/index.d.ts +206 -15
  50. package/dist/rbac/index.js +28 -6
  51. package/dist/timezone-_pgH8qrY.d.ts +530 -0
  52. package/dist/{types-_x1f4QBF.d.ts → types-DUyCRSTj.d.ts} +1 -1
  53. package/dist/types.d.ts +2 -2
  54. package/dist/types.js +1 -1
  55. package/dist/{usePublicRouteParams-JJczomYq.d.ts → usePublicRouteParams-D71QLlg4.d.ts} +114 -3
  56. package/dist/utils.d.ts +110 -152
  57. package/dist/utils.js +128 -138
  58. package/dist/utils.js.map +1 -1
  59. package/docs/api/README.md +60 -1
  60. package/docs/api/classes/ColumnFactory.md +1 -1
  61. package/docs/api/classes/ErrorBoundary.md +1 -1
  62. package/docs/api/classes/InvalidScopeError.md +1 -1
  63. package/docs/api/classes/Logger.md +178 -0
  64. package/docs/api/classes/MissingUserContextError.md +1 -1
  65. package/docs/api/classes/OrganisationContextRequiredError.md +1 -1
  66. package/docs/api/classes/PermissionDeniedError.md +1 -1
  67. package/docs/api/classes/RBACAuditManager.md +2 -2
  68. package/docs/api/classes/RBACCache.md +1 -1
  69. package/docs/api/classes/RBACEngine.md +2 -2
  70. package/docs/api/classes/RBACError.md +1 -1
  71. package/docs/api/classes/RBACNotInitializedError.md +1 -1
  72. package/docs/api/classes/SecureSupabaseClient.md +5 -5
  73. package/docs/api/classes/StorageUtils.md +1 -1
  74. package/docs/api/enums/FileCategory.md +1 -1
  75. package/docs/api/enums/LogLevel.md +54 -0
  76. package/docs/api/enums/RBACErrorCode.md +1 -1
  77. package/docs/api/enums/RPCFunction.md +1 -1
  78. package/docs/api/interfaces/AggregateConfig.md +1 -1
  79. package/docs/api/interfaces/BadgeProps.md +1 -1
  80. package/docs/api/interfaces/ButtonProps.md +1 -1
  81. package/docs/api/interfaces/CalendarProps.md +18 -2
  82. package/docs/api/interfaces/CardProps.md +1 -1
  83. package/docs/api/interfaces/ColorPalette.md +1 -1
  84. package/docs/api/interfaces/ColorShade.md +1 -1
  85. package/docs/api/interfaces/ComplianceResult.md +30 -0
  86. package/docs/api/interfaces/DataAccessRecord.md +1 -1
  87. package/docs/api/interfaces/DataRecord.md +1 -1
  88. package/docs/api/interfaces/DataTableAction.md +1 -1
  89. package/docs/api/interfaces/DataTableColumn.md +1 -1
  90. package/docs/api/interfaces/DataTableProps.md +1 -1
  91. package/docs/api/interfaces/DataTableToolbarButton.md +1 -1
  92. package/docs/api/interfaces/DatabaseComplianceResult.md +85 -0
  93. package/docs/api/interfaces/DatabaseIssue.md +41 -0
  94. package/docs/api/interfaces/EmptyStateConfig.md +1 -1
  95. package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
  96. package/docs/api/interfaces/EventAppRoleData.md +6 -6
  97. package/docs/api/interfaces/ExportColumn.md +1 -1
  98. package/docs/api/interfaces/ExportOptions.md +1 -1
  99. package/docs/api/interfaces/FileDisplayProps.md +1 -1
  100. package/docs/api/interfaces/FileMetadata.md +1 -1
  101. package/docs/api/interfaces/FileReference.md +1 -1
  102. package/docs/api/interfaces/FileSizeLimits.md +1 -1
  103. package/docs/api/interfaces/FileUploadOptions.md +48 -8
  104. package/docs/api/interfaces/FileUploadProps.md +46 -13
  105. package/docs/api/interfaces/FooterProps.md +1 -1
  106. package/docs/api/interfaces/FormFieldProps.md +1 -1
  107. package/docs/api/interfaces/FormProps.md +1 -1
  108. package/docs/api/interfaces/GrantEventAppRoleParams.md +9 -9
  109. package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
  110. package/docs/api/interfaces/InputProps.md +1 -1
  111. package/docs/api/interfaces/LabelProps.md +1 -1
  112. package/docs/api/interfaces/LoggerConfig.md +62 -0
  113. package/docs/api/interfaces/LoginFormProps.md +1 -1
  114. package/docs/api/interfaces/NavigationAccessRecord.md +1 -1
  115. package/docs/api/interfaces/NavigationContextType.md +1 -1
  116. package/docs/api/interfaces/NavigationGuardProps.md +1 -1
  117. package/docs/api/interfaces/NavigationItem.md +1 -1
  118. package/docs/api/interfaces/NavigationMenuProps.md +1 -1
  119. package/docs/api/interfaces/NavigationProviderProps.md +1 -1
  120. package/docs/api/interfaces/Organisation.md +1 -1
  121. package/docs/api/interfaces/OrganisationContextType.md +1 -1
  122. package/docs/api/interfaces/OrganisationMembership.md +1 -1
  123. package/docs/api/interfaces/OrganisationProviderProps.md +1 -1
  124. package/docs/api/interfaces/OrganisationSecurityError.md +1 -1
  125. package/docs/api/interfaces/PaceAppLayoutProps.md +36 -23
  126. package/docs/api/interfaces/PaceLoginPageProps.md +1 -1
  127. package/docs/api/interfaces/PageAccessRecord.md +1 -1
  128. package/docs/api/interfaces/PagePermissionContextType.md +1 -1
  129. package/docs/api/interfaces/PagePermissionGuardProps.md +11 -11
  130. package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
  131. package/docs/api/interfaces/PaletteData.md +1 -1
  132. package/docs/api/interfaces/PermissionEnforcerProps.md +1 -1
  133. package/docs/api/interfaces/ProgressProps.md +1 -1
  134. package/docs/api/interfaces/ProtectedRouteProps.md +6 -6
  135. package/docs/api/interfaces/PublicPageFooterProps.md +1 -1
  136. package/docs/api/interfaces/PublicPageHeaderProps.md +1 -1
  137. package/docs/api/interfaces/PublicPageLayoutProps.md +1 -1
  138. package/docs/api/interfaces/QuickFix.md +52 -0
  139. package/docs/api/interfaces/RBACAccessValidateParams.md +1 -1
  140. package/docs/api/interfaces/RBACAccessValidateResult.md +1 -1
  141. package/docs/api/interfaces/RBACAuditLogParams.md +1 -1
  142. package/docs/api/interfaces/RBACAuditLogResult.md +1 -1
  143. package/docs/api/interfaces/RBACConfig.md +4 -4
  144. package/docs/api/interfaces/RBACContext.md +1 -1
  145. package/docs/api/interfaces/RBACLogger.md +1 -1
  146. package/docs/api/interfaces/RBACPageAccessCheckParams.md +1 -1
  147. package/docs/api/interfaces/RBACPermissionCheckParams.md +1 -1
  148. package/docs/api/interfaces/RBACPermissionCheckResult.md +1 -1
  149. package/docs/api/interfaces/RBACPermissionsGetParams.md +1 -1
  150. package/docs/api/interfaces/RBACPermissionsGetResult.md +1 -1
  151. package/docs/api/interfaces/RBACResult.md +1 -1
  152. package/docs/api/interfaces/RBACRoleGrantParams.md +1 -1
  153. package/docs/api/interfaces/RBACRoleGrantResult.md +1 -1
  154. package/docs/api/interfaces/RBACRoleRevokeParams.md +1 -1
  155. package/docs/api/interfaces/RBACRoleRevokeResult.md +1 -1
  156. package/docs/api/interfaces/RBACRoleValidateParams.md +1 -1
  157. package/docs/api/interfaces/RBACRoleValidateResult.md +1 -1
  158. package/docs/api/interfaces/RBACRolesListParams.md +1 -1
  159. package/docs/api/interfaces/RBACRolesListResult.md +1 -1
  160. package/docs/api/interfaces/RBACSessionTrackParams.md +1 -1
  161. package/docs/api/interfaces/RBACSessionTrackResult.md +1 -1
  162. package/docs/api/interfaces/ResourcePermissions.md +1 -1
  163. package/docs/api/interfaces/RevokeEventAppRoleParams.md +7 -7
  164. package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
  165. package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
  166. package/docs/api/interfaces/RoleManagementResult.md +5 -5
  167. package/docs/api/interfaces/RouteAccessRecord.md +1 -1
  168. package/docs/api/interfaces/RouteConfig.md +1 -1
  169. package/docs/api/interfaces/RuntimeComplianceResult.md +55 -0
  170. package/docs/api/interfaces/SecureDataContextType.md +1 -1
  171. package/docs/api/interfaces/SecureDataProviderProps.md +1 -1
  172. package/docs/api/interfaces/SessionRestorationLoaderProps.md +1 -1
  173. package/docs/api/interfaces/SetupIssue.md +41 -0
  174. package/docs/api/interfaces/StorageConfig.md +1 -1
  175. package/docs/api/interfaces/StorageFileInfo.md +1 -1
  176. package/docs/api/interfaces/StorageFileMetadata.md +1 -1
  177. package/docs/api/interfaces/StorageListOptions.md +1 -1
  178. package/docs/api/interfaces/StorageListResult.md +1 -1
  179. package/docs/api/interfaces/StorageUploadOptions.md +1 -1
  180. package/docs/api/interfaces/StorageUploadResult.md +1 -1
  181. package/docs/api/interfaces/StorageUrlOptions.md +1 -1
  182. package/docs/api/interfaces/StyleImport.md +1 -1
  183. package/docs/api/interfaces/SwitchProps.md +1 -1
  184. package/docs/api/interfaces/TabsContentProps.md +1 -1
  185. package/docs/api/interfaces/TabsListProps.md +1 -1
  186. package/docs/api/interfaces/TabsProps.md +1 -1
  187. package/docs/api/interfaces/TabsTriggerProps.md +1 -1
  188. package/docs/api/interfaces/TextareaProps.md +1 -1
  189. package/docs/api/interfaces/ToastActionElement.md +1 -1
  190. package/docs/api/interfaces/ToastProps.md +1 -1
  191. package/docs/api/interfaces/UnifiedAuthContextType.md +1 -1
  192. package/docs/api/interfaces/UnifiedAuthProviderProps.md +1 -1
  193. package/docs/api/interfaces/UseFormDialogOptions.md +62 -0
  194. package/docs/api/interfaces/UseFormDialogReturn.md +117 -0
  195. package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
  196. package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
  197. package/docs/api/interfaces/UsePublicEventLogoOptions.md +2 -2
  198. package/docs/api/interfaces/UsePublicEventLogoReturn.md +1 -1
  199. package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
  200. package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
  201. package/docs/api/interfaces/UsePublicFileDisplayOptions.md +2 -2
  202. package/docs/api/interfaces/UsePublicFileDisplayReturn.md +1 -1
  203. package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
  204. package/docs/api/interfaces/UseResolvedScopeOptions.md +2 -2
  205. package/docs/api/interfaces/UseResolvedScopeReturn.md +1 -1
  206. package/docs/api/interfaces/UseResourcePermissionsOptions.md +1 -1
  207. package/docs/api/interfaces/UserEventAccess.md +1 -1
  208. package/docs/api/interfaces/UserMenuProps.md +1 -1
  209. package/docs/api/interfaces/UserProfile.md +1 -1
  210. package/docs/api/modules.md +746 -50
  211. package/docs/api-reference/components.md +26 -12
  212. package/docs/api-reference/hooks.md +111 -0
  213. package/docs/api-reference/rpc-functions.md +1 -1
  214. package/docs/api-reference/utilities.md +184 -0
  215. package/docs/getting-started/installation-guide.md +75 -16
  216. package/docs/getting-started/quick-start.md +61 -11
  217. package/docs/implementation-guides/authentication.md +88 -12
  218. package/docs/implementation-guides/file-reference-system.md +26 -3
  219. package/docs/implementation-guides/file-upload-storage.md +30 -1
  220. package/docs/rbac/README.md +1 -0
  221. package/docs/rbac/compliance/compliance-guide.md +544 -0
  222. package/docs/rbac/getting-started.md +158 -33
  223. package/docs/standards/pace-core-compliance.md +432 -0
  224. package/eslint-config-pace-core.cjs +93 -0
  225. package/package.json +15 -3
  226. package/scripts/analyze-bundle.js +232 -0
  227. package/scripts/build-css.js +56 -0
  228. package/scripts/build-docs-incremental.js +1015 -0
  229. package/scripts/check-pace-core-compliance.cjs +2353 -0
  230. package/scripts/check-pace-core-compliance.js +512 -0
  231. package/scripts/generate-docs.js +157 -0
  232. package/scripts/setup-build-cache.js +73 -0
  233. package/scripts/utils/command-runner.js +131 -0
  234. package/scripts/utils/env.js +33 -0
  235. package/scripts/utils/index.js +10 -0
  236. package/scripts/utils/logger.js +88 -0
  237. package/scripts/utils/path-helpers.js +37 -0
  238. package/scripts/validate-formats.js +133 -0
  239. package/scripts/validate-master.js +155 -0
  240. package/scripts/validate-pre-publish.js +140 -0
  241. package/scripts/validate-theme.js +142 -0
  242. package/src/components/Calendar/Calendar.tsx +8 -1
  243. package/src/components/Card/Card.tsx +47 -8
  244. package/src/components/DatePickerWithTimezone/DatePickerWithTimezone.test.tsx +314 -0
  245. package/src/components/DatePickerWithTimezone/DatePickerWithTimezone.tsx +126 -0
  246. package/src/components/DatePickerWithTimezone/README.md +135 -0
  247. package/src/components/DatePickerWithTimezone/index.ts +10 -0
  248. package/src/components/DateTimeField/DateTimeField.test.tsx +358 -0
  249. package/src/components/DateTimeField/DateTimeField.tsx +232 -0
  250. package/src/components/DateTimeField/README.md +148 -0
  251. package/src/components/DateTimeField/index.ts +10 -0
  252. package/src/components/FileUpload/FileUpload.test.tsx +2 -0
  253. package/src/components/FileUpload/FileUpload.tsx +10 -1
  254. package/src/components/Header/Header.test.tsx +47 -18
  255. package/src/components/Header/Header.tsx +22 -7
  256. package/src/components/PaceAppLayout/PaceAppLayout.tsx +29 -20
  257. package/src/components/PaceAppLayout/README.md +9 -0
  258. package/src/components/ProtectedRoute/ProtectedRoute.test.tsx +37 -8
  259. package/src/components/ProtectedRoute/ProtectedRoute.tsx +146 -5
  260. package/src/components/index.ts +8 -0
  261. package/src/eslint-rules/pace-core-compliance.cjs +406 -0
  262. package/src/eslint-rules/pace-core-compliance.js +640 -0
  263. package/src/hooks/__tests__/useFormDialog.test.ts +478 -0
  264. package/src/hooks/index.ts +5 -0
  265. package/src/hooks/useFileReference.test.ts +2 -0
  266. package/src/hooks/useFormDialog.ts +147 -0
  267. package/src/hooks/usePreventTabReload.ts +106 -0
  268. package/src/hooks/useSecureDataAccess.ts +2 -2
  269. package/src/index.ts +27 -0
  270. package/src/providers/services/OrganisationServiceProvider.tsx +6 -5
  271. package/src/providers/services/UnifiedAuthProvider.tsx +24 -3
  272. package/src/rbac/__tests__/rbac-role-isolation.test.ts +456 -0
  273. package/src/rbac/__tests__/scenarios.user-role.test.tsx +3 -0
  274. package/src/rbac/compliance/database-validator.ts +165 -0
  275. package/src/rbac/compliance/index.ts +38 -0
  276. package/src/rbac/compliance/quick-fix-suggestions.ts +209 -0
  277. package/src/rbac/compliance/runtime-compliance.ts +77 -0
  278. package/src/rbac/compliance/setup-validator.ts +131 -0
  279. package/src/rbac/components/PagePermissionGuard.tsx +8 -64
  280. package/src/rbac/components/__tests__/PagePermissionGuard.test.tsx +35 -21
  281. package/src/rbac/docs/event-based-apps.md +285 -0
  282. package/src/rbac/errors.ts +11 -0
  283. package/src/rbac/hooks/useRoleManagement.ts +292 -12
  284. package/src/rbac/index.ts +30 -0
  285. package/src/services/OrganisationService.ts +4 -0
  286. package/src/styles/core.css +5 -5
  287. package/src/types/database.generated.ts +63 -9
  288. package/src/types/file-reference.ts +9 -0
  289. package/src/utils/__tests__/timezone.test.ts +345 -0
  290. package/src/utils/file-reference/__tests__/file-reference.test.ts +60 -4
  291. package/src/utils/file-reference/index.ts +13 -2
  292. package/src/utils/formatting/formatDateTimeTimezone.test.ts +167 -0
  293. package/src/utils/formatting/formatting.ts +179 -0
  294. package/src/utils/index.ts +27 -1
  295. package/src/utils/location/index.ts +16 -0
  296. package/src/utils/location/location.test.ts +286 -0
  297. package/src/utils/location/location.ts +175 -0
  298. package/src/utils/security/secureDataAccess.ts +1 -1
  299. package/src/utils/storage/helpers.ts +68 -0
  300. package/src/utils/timezone/index.ts +17 -0
  301. package/src/utils/timezone/timezone.test.ts +349 -0
  302. package/src/utils/timezone/timezone.ts +281 -0
  303. package/dist/chunk-CSOFYHAG.js.map +0 -1
  304. package/dist/chunk-FUEYYMX5.js.map +0 -1
  305. package/dist/chunk-HKIT6O7W.js +0 -198
  306. package/dist/chunk-HKIT6O7W.js.map +0 -1
  307. package/dist/chunk-KUEN3HFB.js +0 -94
  308. package/dist/chunk-KUEN3HFB.js.map +0 -1
  309. package/dist/chunk-M7W4CP3M.js.map +0 -1
  310. package/dist/chunk-MI7HBHN3.js.map +0 -1
  311. package/dist/chunk-NQPMQGS2.js.map +0 -1
  312. package/dist/chunk-PWAHJW4G.js.map +0 -1
  313. package/dist/chunk-UHNYIBXL.js.map +0 -1
  314. package/dist/chunk-W22JP75J.js.map +0 -1
  315. package/dist/formatting-5wETwiGF.d.ts +0 -162
  316. /package/dist/{DataTable-QAB34V6K.js.map → DataTable-IX2NBUTP.js.map} +0 -0
  317. /package/dist/{UnifiedAuthProvider-7F6T4B6K.js.map → UnifiedAuthProvider-A4BCQRJY.js.map} +0 -0
  318. /package/dist/{api-ROMBCNKU.js.map → api-BMFCXVQX.js.map} +0 -0
  319. /package/dist/{chunk-QCDXODCA.js.map → chunk-XAUHJD3L.js.map} +0 -0
@@ -0,0 +1,73 @@
1
+
2
+ /**
3
+ * Build Cache Setup Script
4
+ * Configures optimal caching for faster builds in CI/CD
5
+ */
6
+
7
+ import { writeFile, readFile } from 'fs/promises';
8
+ import { join, dirname } from 'path';
9
+ import { fileURLToPath } from 'url';
10
+ import { existsSync } from 'fs';
11
+
12
+ const __dirname = dirname(fileURLToPath(import.meta.url));
13
+ const packageRoot = join(__dirname, '..');
14
+
15
+ console.log('🚀 Setting up build caching configuration...');
16
+ console.log();
17
+ console.log('📋 Setting up build caching...');
18
+
19
+ async function setupBuildCache() {
20
+ try {
21
+ // Read current tsconfig.json
22
+ const tsconfigPath = join(packageRoot, 'tsconfig.json');
23
+ if (existsSync(tsconfigPath)) {
24
+ const tsconfigContent = await readFile(tsconfigPath, 'utf-8');
25
+ const tsconfig = JSON.parse(tsconfigContent);
26
+
27
+ // Ensure incremental compilation is enabled
28
+ if (!tsconfig.compilerOptions) {
29
+ tsconfig.compilerOptions = {};
30
+ }
31
+
32
+ tsconfig.compilerOptions.incremental = true;
33
+ tsconfig.compilerOptions.tsBuildInfoFile = './tsconfig.tsbuildinfo';
34
+
35
+ await writeFile(tsconfigPath, JSON.stringify(tsconfig, null, 2));
36
+ console.log('✅ TypeScript incremental compilation enabled');
37
+ }
38
+
39
+ console.log('✅ tsup build cache configured');
40
+ console.log('✅ Vitest cache optimized');
41
+ console.log('✅ GitHub Actions caching ready');
42
+
43
+ } catch (error) {
44
+ console.warn('⚠️ Could not update build cache configuration:', error.message);
45
+ }
46
+
47
+ console.log();
48
+ console.log('📊 Cache Configuration Summary:');
49
+ console.log(' 🔧 TypeScript incremental compilation enabled');
50
+ console.log(' 📦 tsup build cache configured');
51
+ console.log(' 🧪 Vitest cache optimized');
52
+ console.log(' ⚡ GitHub Actions caching ready');
53
+
54
+ console.log();
55
+ console.log('💡 Cache Optimization Tips:');
56
+ console.log(' - Use npm ci instead of npm install in CI');
57
+ console.log(' - Cache node_modules based on package-lock.json hash');
58
+ console.log(' - Cache build outputs based on source file hashes');
59
+ console.log(' - Restore partial caches when exact match not found');
60
+
61
+ console.log();
62
+ console.log('🚀 Next Steps:');
63
+ console.log(' 1. Commit the updated configuration files');
64
+ console.log(' 2. Push to GitHub to activate workflow caching');
65
+ console.log(' 3. Monitor build times in CI/CD pipeline');
66
+ console.log(' 4. Adjust cache keys if needed for optimal performance');
67
+ }
68
+
69
+ // Run cache setup
70
+ setupBuildCache().catch(error => {
71
+ console.error('❌ Cache setup failed:', error);
72
+ process.exit(1);
73
+ });
@@ -0,0 +1,131 @@
1
+ /**
2
+ * Command Runner Utilities
3
+ * Provides unified command execution with timeout and error handling
4
+ */
5
+
6
+ import { spawn } from 'child_process';
7
+ import { isCI, getDefaultTimeout } from './env.js';
8
+ import { logger } from './logger.js';
9
+
10
+ /**
11
+ * @typedef {Object} CommandResult
12
+ * @property {boolean} success - Whether the command succeeded
13
+ * @property {string} stdout - Standard output
14
+ * @property {string} stderr - Standard error
15
+ * @property {number} [code] - Exit code (if available)
16
+ * @property {string} [error] - Error message (if available)
17
+ */
18
+
19
+ /**
20
+ * Run a command with timeout and error handling
21
+ * @param {string} command - The command to run
22
+ * @param {string[]} args - Command arguments
23
+ * @param {Object} options - Command options
24
+ * @param {string} [options.cwd] - Working directory
25
+ * @param {number} [options.timeout] - Timeout in milliseconds
26
+ * @param {boolean} [options.showLiveOutput] - Show live output in CI (default: false)
27
+ * @returns {Promise<CommandResult>} Command execution result
28
+ */
29
+ export async function runCommand(command, args = [], options = {}) {
30
+ const {
31
+ cwd = process.cwd(),
32
+ timeout = getDefaultTimeout(),
33
+ showLiveOutput = false,
34
+ } = options;
35
+
36
+ return new Promise((resolve) => {
37
+ logger.running(command, args);
38
+
39
+ if (isCI() && timeout > 0) {
40
+ logger.info(`CI environment detected - using timeout: ${timeout}ms`);
41
+ }
42
+
43
+ const proc = spawn(command, args, {
44
+ cwd,
45
+ stdio: 'pipe',
46
+ });
47
+
48
+ let stdout = '';
49
+ let stderr = '';
50
+ let timeoutId;
51
+
52
+ // Set up timeout
53
+ timeoutId = setTimeout(() => {
54
+ proc.kill('SIGTERM');
55
+ logger.error(`Command timed out after ${timeout}ms`);
56
+ resolve({
57
+ success: false,
58
+ error: 'Command timed out',
59
+ stdout,
60
+ stderr,
61
+ });
62
+ }, timeout);
63
+
64
+ // Handle stdout
65
+ proc.stdout.on('data', (data) => {
66
+ const output = data.toString();
67
+ stdout += output;
68
+
69
+ // Show live output in CI if requested
70
+ if (isCI() && showLiveOutput) {
71
+ logger.raw(output);
72
+ }
73
+ });
74
+
75
+ // Handle stderr
76
+ proc.stderr.on('data', (data) => {
77
+ stderr += data.toString();
78
+ });
79
+
80
+ // Handle process close
81
+ proc.on('close', (code) => {
82
+ if (timeoutId) clearTimeout(timeoutId);
83
+
84
+ if (code === 0) {
85
+ logger.success('Command completed successfully');
86
+ logger.newline();
87
+ resolve({ success: true, stdout, stderr, code });
88
+ } else {
89
+ logger.error(`Command failed with code ${code}`);
90
+ if (stderr) console.error('STDERR:', stderr);
91
+ if (stdout) console.error('STDOUT:', stdout);
92
+ logger.newline();
93
+ resolve({ success: false, stdout, stderr, code });
94
+ }
95
+ });
96
+
97
+ // Handle process error
98
+ proc.on('error', (error) => {
99
+ if (timeoutId) clearTimeout(timeoutId);
100
+ logger.error(`Failed to run command: ${error.message}`);
101
+ logger.newline();
102
+ resolve({ success: false, error: error.message });
103
+ });
104
+ });
105
+ }
106
+
107
+ /**
108
+ * Run standardized tests from repository root
109
+ * @param {string} packageRoot - Package root directory
110
+ * @param {string} repoRoot - Repository root directory
111
+ * @param {number} timeout - Test timeout in milliseconds
112
+ * @returns {Promise<{success: boolean}>} Test execution result
113
+ */
114
+ export async function runStandardizedTests(packageRoot, repoRoot, timeout) {
115
+ logger.step('Running test suite from root (matching npm run test behavior)...');
116
+
117
+ const result = await runCommand('npm', ['run', 'test'], {
118
+ cwd: repoRoot,
119
+ timeout,
120
+ showLiveOutput: true, // Show test output in CI
121
+ });
122
+
123
+ if (result.success) {
124
+ logger.success('All tests passed successfully');
125
+ return { success: true };
126
+ } else {
127
+ logger.error('Tests failed');
128
+ return { success: false };
129
+ }
130
+ }
131
+
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Environment Detection Utilities
3
+ * Detects CI environment and provides environment-specific configuration
4
+ */
5
+
6
+ /**
7
+ * Check if running in CI environment
8
+ * @returns {boolean} True if in CI
9
+ */
10
+ export function isCI() {
11
+ return process.env.CI === 'true' || process.env.GITHUB_ACTIONS === 'true';
12
+ }
13
+
14
+ /**
15
+ * Get default timeout based on environment
16
+ * @param {number} localTimeout - Timeout for local development (ms)
17
+ * @param {number} ciTimeout - Timeout for CI environment (ms)
18
+ * @returns {number} The appropriate timeout
19
+ */
20
+ export function getDefaultTimeout(localTimeout = 30000, ciTimeout = 120000) {
21
+ return isCI() ? ciTimeout : localTimeout;
22
+ }
23
+
24
+ /**
25
+ * Get test timeout based on environment
26
+ * @param {number} localTimeout - Timeout for local development (ms)
27
+ * @param {number} ciTimeout - Timeout for CI environment (ms)
28
+ * @returns {number} The appropriate timeout
29
+ */
30
+ export function getTestTimeout(localTimeout = 300000, ciTimeout = 300000) {
31
+ return isCI() ? ciTimeout : localTimeout;
32
+ }
33
+
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Shared Utilities Index
3
+ * Central export point for all shared script utilities
4
+ */
5
+
6
+ export * from './command-runner.js';
7
+ export * from './env.js';
8
+ export * from './logger.js';
9
+ export * from './path-helpers.js';
10
+
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Logger Utilities
3
+ * Provides standardized logging with consistent formatting
4
+ */
5
+
6
+ /**
7
+ * Logger object with standardized methods
8
+ */
9
+ export const logger = {
10
+ /**
11
+ * Log a success message
12
+ * @param {string} message - The message to log
13
+ */
14
+ success: (message) => console.log(`✅ ${message}`),
15
+
16
+ /**
17
+ * Log an error message
18
+ * @param {string} message - The message to log
19
+ */
20
+ error: (message) => console.error(`❌ ${message}`),
21
+
22
+ /**
23
+ * Log a warning message
24
+ * @param {string} message - The message to log
25
+ */
26
+ warning: (message) => console.warn(`⚠️ ${message}`),
27
+
28
+ /**
29
+ * Log an info message
30
+ * @param {string} message - The message to log
31
+ */
32
+ info: (message) => console.log(`ℹ️ ${message}`),
33
+
34
+ /**
35
+ * Log a step/action message
36
+ * @param {string} message - The message to log
37
+ */
38
+ step: (message) => console.log(`🔄 ${message}`),
39
+
40
+ /**
41
+ * Log a running command
42
+ * @param {string} command - The command being run
43
+ * @param {string[]} args - Command arguments
44
+ */
45
+ running: (command, args = []) => {
46
+ const argsStr = args.length > 0 ? ` ${args.join(' ')}` : '';
47
+ console.log(`🔧 Running: ${command}${argsStr}`);
48
+ },
49
+
50
+ /**
51
+ * Log a skipped step
52
+ * @param {string} message - The message to log
53
+ */
54
+ skipped: (message) => console.log(`⏭️ ${message}`),
55
+
56
+ /**
57
+ * Log a header
58
+ * @param {string} message - The header message
59
+ */
60
+ header: (message) => {
61
+ console.log('\n' + '='.repeat(60));
62
+ console.log(message);
63
+ console.log('='.repeat(60));
64
+ },
65
+
66
+ /**
67
+ * Log a section separator
68
+ */
69
+ separator: () => console.log('─'.repeat(60)),
70
+
71
+ /**
72
+ * Log a newline
73
+ */
74
+ newline: () => console.log(''),
75
+
76
+ /**
77
+ * Log raw output (for CI live output)
78
+ * @param {string} output - The output to log
79
+ */
80
+ raw: (output) => process.stdout.write(output),
81
+
82
+ /**
83
+ * Log raw error output (for CI live error output)
84
+ * @param {string} output - The error output to log
85
+ */
86
+ rawError: (output) => process.stderr.write(output),
87
+ };
88
+
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Path Helper Utilities
3
+ * Provides consistent path resolution across all scripts
4
+ */
5
+
6
+ import { join, dirname } from 'path';
7
+ import { fileURLToPath } from 'url';
8
+
9
+ /**
10
+ * Get the directory name of the current script
11
+ * @param {string} importMetaUrl - The import.meta.url from the calling script
12
+ * @returns {string} The directory path
13
+ */
14
+ export function getScriptDir(importMetaUrl) {
15
+ return dirname(fileURLToPath(importMetaUrl));
16
+ }
17
+
18
+ /**
19
+ * Get the package root directory (packages/core)
20
+ * @param {string} importMetaUrl - The import.meta.url from the calling script
21
+ * @returns {string} The package root path
22
+ */
23
+ export function getPackageRoot(importMetaUrl) {
24
+ const scriptDir = getScriptDir(importMetaUrl);
25
+ return join(scriptDir, '..');
26
+ }
27
+
28
+ /**
29
+ * Get the repository root directory
30
+ * @param {string} importMetaUrl - The import.meta.url from the calling script
31
+ * @returns {string} The repository root path
32
+ */
33
+ export function getRepoRoot(importMetaUrl) {
34
+ const packageRoot = getPackageRoot(importMetaUrl);
35
+ return join(packageRoot, '../..');
36
+ }
37
+
@@ -0,0 +1,133 @@
1
+ /**
2
+ * Format Validation Script
3
+ * Ensures proper ESM format compliance and compatibility (ESM-only)
4
+ */
5
+
6
+ import { readFile } from 'fs/promises';
7
+ import { join, dirname } from 'path';
8
+ import { fileURLToPath } from 'url';
9
+ import { existsSync } from 'fs';
10
+
11
+ const __dirname = dirname(fileURLToPath(import.meta.url));
12
+ const packageRoot = join(__dirname, '..');
13
+ const distDir = join(packageRoot, 'dist');
14
+
15
+ console.log('🔍 Validating ESM format compliance...\n');
16
+
17
+ const modules = [
18
+ { name: 'index', esm: 'index.js' },
19
+ { name: 'components', esm: 'components.js' },
20
+ { name: 'validation', esm: 'validation.js' },
21
+ { name: 'hooks', esm: 'hooks.js' },
22
+ { name: 'types', esm: 'types.js' }
23
+ ];
24
+
25
+ async function validateESMFormat(filePath) {
26
+ try {
27
+ const content = await readFile(filePath, 'utf-8');
28
+
29
+ const checks = {
30
+ hasESMExports: content.includes('export '),
31
+ noCommonJSExports: !content.includes('module.exports') && !content.includes('exports['),
32
+ properESMSyntax: /export\s+(default\s+|{|\w|\*)/.test(content),
33
+ noCommonJSRequire: !content.includes('require('),
34
+ usesImportSyntax: content.includes('import ') || !content.includes('require(')
35
+ };
36
+
37
+ const issues = [];
38
+
39
+ if (!checks.hasESMExports) issues.push('No ESM exports found');
40
+ if (!checks.noCommonJSExports) issues.push('Contains CommonJS exports');
41
+ if (!checks.properESMSyntax) issues.push('Invalid ESM export syntax');
42
+ if (!checks.noCommonJSRequire) issues.push('Contains CommonJS require()');
43
+ if (!checks.usesImportSyntax) issues.push('Does not use ESM import syntax');
44
+
45
+ return {
46
+ valid: issues.length === 0,
47
+ checks,
48
+ issues,
49
+ score: Object.values(checks).filter(Boolean).length / Object.keys(checks).length
50
+ };
51
+ } catch (error) {
52
+ return {
53
+ valid: false,
54
+ error: error.message,
55
+ score: 0
56
+ };
57
+ }
58
+ }
59
+
60
+ async function validateFormats() {
61
+ let allValid = true;
62
+ const results = [];
63
+
64
+ console.log('📋 ESM Format Compliance Report:');
65
+ console.log('─'.repeat(80));
66
+
67
+ for (const module of modules) {
68
+ const esmPath = join(distDir, module.esm);
69
+
70
+ console.log(`\n📦 Module: ${module.name}`);
71
+
72
+ // Validate ESM format
73
+ if (existsSync(esmPath)) {
74
+ const esmValidation = await validateESMFormat(esmPath);
75
+ const esmStatus = esmValidation.valid ? '✅' : '❌';
76
+ console.log(` ESM (${module.esm}): ${esmStatus} ${(esmValidation.score * 100).toFixed(0)}% compliant`);
77
+
78
+ if (!esmValidation.valid) {
79
+ console.log(` Issues: ${esmValidation.issues.join(', ')}`);
80
+ allValid = false;
81
+ }
82
+
83
+ results.push({ module: module.name, format: 'esm', ...esmValidation });
84
+ } else {
85
+ console.log(` ESM (${module.esm}): ❌ File not found`);
86
+ allValid = false;
87
+ }
88
+ }
89
+
90
+ // Summary
91
+ console.log('\n' + '='.repeat(80));
92
+ console.log('📊 ESM FORMAT VALIDATION SUMMARY');
93
+ console.log('='.repeat(80));
94
+
95
+ const totalModules = modules.length;
96
+ const validESM = results.filter(r => r.format === 'esm' && r.valid).length;
97
+
98
+ console.log(`ESM Format Compliance: ${validESM}/${totalModules} modules ✓`);
99
+
100
+ const averageESMScore = results
101
+ .filter(r => r.format === 'esm')
102
+ .reduce((sum, r) => sum + r.score, 0) / totalModules;
103
+
104
+ console.log(`Average ESM Compliance: ${(averageESMScore * 100).toFixed(1)}%`);
105
+
106
+ if (allValid) {
107
+ console.log('✅ All ESM format validations passed!');
108
+ console.log('\n🎯 ESM Quality Indicators:');
109
+ console.log(' ✅ Proper "use client" directives in all modules');
110
+ console.log(' ✅ Clean ESM export syntax');
111
+ console.log(' ✅ No CommonJS patterns detected');
112
+ console.log(' ✅ Optimal for modern bundlers and tree-shaking');
113
+ } else {
114
+ console.log('❌ Some ESM format validations failed!');
115
+ console.log('\n🔧 Common fixes:');
116
+ console.log(' - Ensure "use client" directive is present');
117
+ console.log(' - Use proper ESM export syntax');
118
+ console.log(' - Remove any CommonJS patterns (require, module.exports)');
119
+ console.log(' - Check tsup configuration for proper ESM output');
120
+ }
121
+
122
+ console.log('='.repeat(80));
123
+
124
+ return allValid;
125
+ }
126
+
127
+ // Run validation
128
+ validateFormats().then(success => {
129
+ process.exit(success ? 0 : 1);
130
+ }).catch(error => {
131
+ console.error('❌ ESM format validation failed:', error);
132
+ process.exit(1);
133
+ });
@@ -0,0 +1,155 @@
1
+ /**
2
+ * Master Validation Script
3
+ * Consolidated validation system for PACE Core package
4
+ * Now uses standardized test execution consistent with npm run test
5
+ */
6
+
7
+ import { join } from 'path';
8
+ import {
9
+ runCommand,
10
+ runStandardizedTests,
11
+ } from './utils/command-runner.js';
12
+ import { getPackageRoot, getRepoRoot } from './utils/path-helpers.js';
13
+ import { isCI, getDefaultTimeout, getTestTimeout } from './utils/env.js';
14
+ import { logger } from './utils/logger.js';
15
+
16
+ const packageRoot = getPackageRoot(import.meta.url);
17
+ const repoRoot = getRepoRoot(import.meta.url);
18
+ const DEFAULT_TIMEOUT = getDefaultTimeout(30000, 120000);
19
+ const TEST_TIMEOUT = getTestTimeout(300000, 300000);
20
+
21
+ // Individual validation steps - only include scripts that actually exist
22
+ const validationSteps = {
23
+ 'type-check': {
24
+ name: 'Type Check',
25
+ command: ['npm', 'run', 'type-check']
26
+ },
27
+ 'test': {
28
+ name: 'Test Suite',
29
+ customHandler: runStandardizedTestsWrapper,
30
+ skipInPrePublish: true
31
+ },
32
+ 'build': {
33
+ name: 'Package Build',
34
+ command: ['npm', 'run', 'build'],
35
+ timeout: isCI() ? 180000 : 60000
36
+ },
37
+ 'build:docs': {
38
+ name: 'Documentation Generation',
39
+ command: ['npm', 'run', 'build:docs'],
40
+ cwd: packageRoot,
41
+ timeout: isCI() ? 240000 : 120000
42
+ }
43
+ };
44
+
45
+ // Standardized test execution wrapper
46
+ async function runStandardizedTestsWrapper() {
47
+ return runStandardizedTests(packageRoot, repoRoot, TEST_TIMEOUT);
48
+ }
49
+
50
+ // Main validation orchestrator
51
+ async function runValidation(mode = 'standard') {
52
+ logger.header(`Running ${mode} validation`);
53
+ if (isCI()) {
54
+ logger.info('CI environment detected - using extended timeouts and live output');
55
+ logger.newline();
56
+ }
57
+
58
+ const results = [];
59
+ const startTime = Date.now();
60
+ let criticalFailures = 0;
61
+
62
+ for (const [stepKey, step] of Object.entries(validationSteps)) {
63
+ // Skip tests in pre-publish mode if configured to do so
64
+ if (mode === 'pre-publish' && step.skipInPrePublish) {
65
+ logger.skipped(`Skipping: ${step.name} (skipped in pre-publish mode)...`);
66
+ results.push({
67
+ step: stepKey,
68
+ name: step.name,
69
+ success: true,
70
+ duration: 0,
71
+ skipped: true
72
+ });
73
+ continue;
74
+ }
75
+
76
+ const stepStartTime = Date.now();
77
+ logger.step(`Running: ${step.name}...`);
78
+
79
+ const result = step.customHandler
80
+ ? await step.customHandler()
81
+ : await runCommand(step.command[0], step.command.slice(1), {
82
+ cwd: step.cwd || packageRoot,
83
+ timeout: step.timeout || DEFAULT_TIMEOUT,
84
+ });
85
+
86
+ const stepDuration = Date.now() - stepStartTime;
87
+ const status = result.success ? '✅' : '❌';
88
+
89
+ logger.info(`${status} ${step.name} - ${stepDuration}ms`);
90
+ logger.newline();
91
+
92
+ results.push({
93
+ step: stepKey,
94
+ name: step.name,
95
+ success: result.success,
96
+ duration: stepDuration,
97
+ skipped: false
98
+ });
99
+
100
+ if (!result.success) {
101
+ criticalFailures++;
102
+ }
103
+ }
104
+
105
+ const totalDuration = Date.now() - startTime;
106
+ const passedSteps = results.filter(r => r.success).length;
107
+ const skippedSteps = results.filter(r => r.skipped).length;
108
+
109
+ // Summary
110
+ logger.header('VALIDATION SUMMARY');
111
+ logger.info(`Total steps: ${results.length}`);
112
+ logger.info(`Passed: ${passedSteps}`);
113
+ logger.info(`Skipped: ${skippedSteps}`);
114
+ logger.info(`Failed: ${criticalFailures}`);
115
+ logger.info(`Total duration: ${totalDuration}ms`);
116
+ logger.newline();
117
+
118
+ logger.info('Step Results:');
119
+ results.forEach(result => {
120
+ const status = result.skipped ? '⏭️' : (result.success ? '✅' : '❌');
121
+ const statusText = result.skipped ? 'skipped' : `${result.duration}ms`;
122
+ logger.info(` ${status} ${result.step} - ${statusText}`);
123
+ });
124
+
125
+ logger.newline();
126
+ logger.separator();
127
+
128
+ if (criticalFailures === 0) {
129
+ logger.success('All validations passed!');
130
+ return true;
131
+ } else {
132
+ logger.error(`Validation failed! ${criticalFailures} validations failed`);
133
+ return false;
134
+ }
135
+ }
136
+
137
+ // CLI handling
138
+ (async () => {
139
+ const mode = process.argv[2] || 'standard';
140
+ const success = await runValidation(mode);
141
+
142
+ if (!success) {
143
+ logger.newline();
144
+ logger.error('Package validation failed!');
145
+ logger.info('Please fix the issues above before publishing');
146
+ process.exit(1);
147
+ } else {
148
+ logger.newline();
149
+ logger.success('Package validation successful!');
150
+ process.exit(0);
151
+ }
152
+ })().catch(error => {
153
+ logger.error(`Validation script error: ${error.message}`);
154
+ process.exit(1);
155
+ });