placementt-core 1.300.980 โ†’ 1.300.982

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 (208) hide show
  1. package/.github/workflows/main.yml +48 -0
  2. package/.github/workflows/publish.yaml +32 -0
  3. package/README.md +119 -0
  4. package/deploy-all.js +101 -68
  5. package/jest.config.js +16 -0
  6. package/lib/__tests__/useDataViewerPaginator.test.d.ts +1 -0
  7. package/lib/__tests__/useDataViewerPaginator.test.js +1232 -0
  8. package/lib/__tests__/useDataViewerPaginator.test.js.map +1 -0
  9. package/lib/benchmarkEvidenceRules.d.ts +113 -0
  10. package/lib/benchmarkEvidenceRules.js +201 -0
  11. package/lib/benchmarkEvidenceRules.js.map +1 -0
  12. package/lib/benchmarkEvidenceRules.test.d.ts +1 -0
  13. package/lib/benchmarkEvidenceRules.test.js +77 -0
  14. package/lib/benchmarkEvidenceRules.test.js.map +1 -0
  15. package/lib/callables/__tests__/registry.test.d.ts +1 -0
  16. package/lib/callables/__tests__/registry.test.js +33 -0
  17. package/lib/callables/__tests__/registry.test.js.map +1 -0
  18. package/lib/callables/aspirations.d.ts +32 -0
  19. package/lib/callables/aspirations.js +23 -0
  20. package/lib/callables/aspirations.js.map +1 -0
  21. package/lib/callables/events.d.ts +47 -0
  22. package/lib/callables/events.js +28 -0
  23. package/lib/callables/events.js.map +1 -0
  24. package/lib/callables/index.d.ts +5 -0
  25. package/lib/callables/index.js +22 -0
  26. package/lib/callables/index.js.map +1 -0
  27. package/lib/callables/placement.d.ts +26 -0
  28. package/lib/callables/placement.js +24 -0
  29. package/lib/callables/placement.js.map +1 -0
  30. package/lib/callables/registry.d.ts +204 -0
  31. package/lib/callables/registry.js +25 -0
  32. package/lib/callables/registry.js.map +1 -0
  33. package/lib/callables/types.d.ts +22 -0
  34. package/lib/{DatabaseDefinitions.js โ†’ callables/types.js} +1 -1
  35. package/lib/callables/types.js.map +1 -0
  36. package/lib/compassExport.d.ts +64 -0
  37. package/lib/compassExport.js +127 -0
  38. package/lib/compassExport.js.map +1 -0
  39. package/lib/config.d.ts +33 -18
  40. package/lib/config.js +4 -3
  41. package/lib/config.js.map +1 -1
  42. package/lib/constants.d.ts +151 -3
  43. package/lib/constants.js +730 -48
  44. package/lib/constants.js.map +1 -1
  45. package/lib/customerCareConfig.d.ts +116 -0
  46. package/lib/customerCareConfig.js +237 -0
  47. package/lib/customerCareConfig.js.map +1 -0
  48. package/lib/emailSections.d.ts +13 -0
  49. package/lib/emailSections.js +610 -0
  50. package/lib/emailSections.js.map +1 -0
  51. package/lib/exportTransformers.d.ts +3 -0
  52. package/lib/exportTransformers.js +26 -0
  53. package/lib/exportTransformers.js.map +1 -0
  54. package/lib/features/analytics/useAnalytics.js +2 -2
  55. package/lib/features/analytics/useAnalytics.js.map +1 -1
  56. package/lib/features/contacts/contactsSlice.d.ts +8 -44
  57. package/lib/features/contacts/useContacts.js +2 -2
  58. package/lib/features/contacts/useContacts.js.map +1 -1
  59. package/lib/features/dropdown/useDropdown.js +1 -1
  60. package/lib/features/dropdown/useDropdown.js.map +1 -1
  61. package/lib/features/global/downtime/useDowntime.js +1 -1
  62. package/lib/features/global/downtime/useDowntime.js.map +1 -1
  63. package/lib/features/global/users/useUserFunctions.js +3 -3
  64. package/lib/features/global/users/useUserFunctions.js.map +1 -1
  65. package/lib/features/jobs/jobsSlice.d.ts +9 -6
  66. package/lib/features/jobs/jobsSlice.js.map +1 -1
  67. package/lib/features/logs/logsSlice.d.ts +57 -0
  68. package/lib/features/logs/logsSlice.js +144 -0
  69. package/lib/features/logs/logsSlice.js.map +1 -0
  70. package/lib/features/placements/studentPlacements/activePlacement.d.ts +4 -13
  71. package/lib/features/placements/studentPlacements/activePlacement.js +1 -1
  72. package/lib/features/placements/studentPlacements/activePlacement.js.map +1 -1
  73. package/lib/features/placements/studentPlacements/completedStudentPlacementsSlice.d.ts +9 -27
  74. package/lib/features/placements/studentPlacements/upcomingStudentPlacementsSlice.d.ts +10 -28
  75. package/lib/features/placements/studentPlacements/useStudentPlacements.js +1 -1
  76. package/lib/features/placements/studentPlacements/useStudentPlacements.js.map +1 -1
  77. package/lib/features/referrals/useReferrals.js +2 -2
  78. package/lib/features/referrals/useReferrals.js.map +1 -1
  79. package/lib/features/updates/useUpdates.js +2 -3
  80. package/lib/features/updates/useUpdates.js.map +1 -1
  81. package/lib/firebase/callableJobContext.d.ts +12 -0
  82. package/lib/firebase/callableJobContext.js +122 -0
  83. package/lib/firebase/callableJobContext.js.map +1 -0
  84. package/lib/firebase/firebase.d.ts +12 -3
  85. package/lib/firebase/firebase.js +206 -12
  86. package/lib/firebase/firebase.js.map +1 -1
  87. package/lib/firebase/firebaseConfig.js +3 -2
  88. package/lib/firebase/firebaseConfig.js.map +1 -1
  89. package/lib/firebase/firebaseQuery.d.ts +10 -7
  90. package/lib/firebase/firebaseQuery.js +19 -0
  91. package/lib/firebase/firebaseQuery.js.map +1 -1
  92. package/lib/firebase/readDatabase.d.ts +10 -2
  93. package/lib/firebase/readDatabase.js +7 -7
  94. package/lib/firebase/readDatabase.js.map +1 -1
  95. package/lib/firebase/util.d.ts +24 -6
  96. package/lib/firebase/util.js +196 -45
  97. package/lib/firebase/util.js.map +1 -1
  98. package/lib/genericEmailDomains.d.ts +2 -0
  99. package/lib/genericEmailDomains.js +6110 -0
  100. package/lib/genericEmailDomains.js.map +1 -0
  101. package/lib/hooks.d.ts +158 -47
  102. package/lib/hooks.js +768 -312
  103. package/lib/hooks.js.map +1 -1
  104. package/lib/images/GatsbyBenchmarks.d.ts +2 -1
  105. package/lib/images/GatsbyBenchmarks.js +17 -7
  106. package/lib/images/GatsbyBenchmarks.js.map +1 -1
  107. package/lib/index.d.ts +11 -1
  108. package/lib/index.js +16 -1
  109. package/lib/index.js.map +1 -1
  110. package/lib/portfolioAggregate.d.ts +170 -0
  111. package/lib/portfolioAggregate.js +368 -0
  112. package/lib/portfolioAggregate.js.map +1 -0
  113. package/lib/reduxHooks.d.ts +62 -12
  114. package/lib/reduxHooks.js +169 -9
  115. package/lib/reduxHooks.js.map +1 -1
  116. package/lib/skillsResolver.d.ts +41 -0
  117. package/lib/skillsResolver.js +47 -0
  118. package/lib/skillsResolver.js.map +1 -0
  119. package/lib/tasksAndTips.d.ts +34 -12
  120. package/lib/tasksAndTips.js +566 -282
  121. package/lib/tasksAndTips.js.map +1 -1
  122. package/lib/typeDefinitions.d.ts +2366 -44
  123. package/lib/util.d.ts +158 -5
  124. package/lib/util.js +1270 -107
  125. package/lib/util.js.map +1 -1
  126. package/lib/util.test.d.ts +1 -0
  127. package/lib/util.test.js +169 -0
  128. package/lib/util.test.js.map +1 -0
  129. package/package.json +35 -14
  130. package/src/__tests__/useDataViewerPaginator.test.tsx +1510 -0
  131. package/src/benchmarkEvidenceRules.test.ts +98 -0
  132. package/src/benchmarkEvidenceRules.ts +247 -0
  133. package/src/callables/__tests__/registry.test.ts +34 -0
  134. package/src/callables/aspirations.ts +21 -0
  135. package/src/callables/events.ts +26 -0
  136. package/src/callables/index.ts +5 -0
  137. package/src/callables/placement.ts +22 -0
  138. package/src/callables/registry.ts +40 -0
  139. package/src/callables/types.ts +24 -0
  140. package/src/compassExport.ts +161 -0
  141. package/src/config.ts +6 -4
  142. package/src/constants.ts +768 -51
  143. package/src/customerCareConfig.ts +378 -0
  144. package/src/emailSections.ts +657 -0
  145. package/src/exportTransformers.ts +32 -0
  146. package/src/features/jobs/jobsSlice.ts +16 -13
  147. package/src/features/logs/logsSlice.ts +208 -0
  148. package/src/features/placements/studentPlacements/activePlacement.ts +1 -1
  149. package/src/firebase/callableJobContext.ts +132 -0
  150. package/src/firebase/firebase.tsx +231 -11
  151. package/src/firebase/firebaseConfig.tsx +3 -2
  152. package/src/firebase/firebaseQuery.tsx +24 -2
  153. package/src/firebase/readDatabase.tsx +6 -6
  154. package/src/firebase/util.tsx +235 -51
  155. package/src/generalEmailDomains.txt +6104 -0
  156. package/src/genericEmailDomains.ts +6108 -0
  157. package/src/hooks.tsx +1167 -263
  158. package/src/images/LogFuturePlacement.jsx +2 -2
  159. package/src/images/LogPreviousPlacement.jsx +4 -4
  160. package/src/images/log_future_placement.svg +2 -2
  161. package/src/images/log_previous_placement.svg +4 -4
  162. package/src/index.ts +12 -4
  163. package/src/portfolioAggregate.ts +540 -0
  164. package/src/reduxHooks.ts +218 -10
  165. package/src/skillsResolver.ts +73 -0
  166. package/src/tasksAndTips.ts +571 -255
  167. package/src/typeDefinitions.ts +2374 -66
  168. package/src/util.test.ts +193 -0
  169. package/src/util.ts +1541 -101
  170. package/test-local.js +80 -0
  171. package/tsconfig.json +1 -1
  172. package/watch-local.js +99 -0
  173. package/lib/DatabaseDefinitions.d.ts +0 -13
  174. package/lib/DatabaseDefinitions.js.map +0 -1
  175. package/lib/features/config.d.ts +0 -133
  176. package/lib/features/config.js +0 -36
  177. package/lib/features/config.js.map +0 -1
  178. package/lib/features/contacts/contacts.d.ts +0 -75
  179. package/lib/features/contacts/contacts.js +0 -106
  180. package/lib/features/contacts/contacts.js.map +0 -1
  181. package/lib/features/downtime/useDowntime.d.ts +0 -11
  182. package/lib/features/downtime/useDowntime.js +0 -23
  183. package/lib/features/downtime/useDowntime.js.map +0 -1
  184. package/lib/features/jobsSlice.d.ts +0 -40
  185. package/lib/features/jobsSlice.js +0 -35
  186. package/lib/features/jobsSlice.js.map +0 -1
  187. package/lib/features/placements/studentPlacements/studentPlacementsSlice.d.ts +0 -63
  188. package/lib/features/placements/studentPlacements/studentPlacementsSlice.js +0 -82
  189. package/lib/features/placements/studentPlacements/studentPlacementsSlice.js.map +0 -1
  190. package/lib/features/providerPlacements/providerPlacementsSlice.d.ts +0 -19
  191. package/lib/features/providerPlacements/providerPlacementsSlice.js +0 -25
  192. package/lib/features/providerPlacements/providerPlacementsSlice.js.map +0 -1
  193. package/lib/features/studentPlacements/studentPlacementsSlice.d.ts +0 -62
  194. package/lib/features/studentPlacements/studentPlacementsSlice.js +0 -88
  195. package/lib/features/studentPlacements/studentPlacementsSlice.js.map +0 -1
  196. package/lib/features/studentPlacements/useStudentPlacements.d.ts +0 -6
  197. package/lib/features/studentPlacements/useStudentPlacements.js +0 -19
  198. package/lib/features/studentPlacements/useStudentPlacements.js.map +0 -1
  199. package/lib/features/userSlice.d.ts +0 -26
  200. package/lib/features/userSlice.js +0 -24
  201. package/lib/features/userSlice.js.map +0 -1
  202. package/lib/features/users/useUserFunctions.d.ts +0 -25
  203. package/lib/features/users/useUserFunctions.js +0 -125
  204. package/lib/features/users/useUserFunctions.js.map +0 -1
  205. package/lib/features/users/userSlice.d.ts +0 -46
  206. package/lib/features/users/userSlice.js +0 -49
  207. package/lib/features/users/userSlice.js.map +0 -1
  208. package/src/DatabaseDefinitions.ts +0 -19
@@ -0,0 +1,48 @@
1
+ name: Sync PR status to ClickUp
2
+
3
+ on:
4
+ pull_request:
5
+ types: [opened, closed]
6
+
7
+ jobs:
8
+ sync-clickup:
9
+ runs-on: ubuntu-latest
10
+
11
+ steps:
12
+ - name: Extract ClickUp Task ID
13
+ id: extract
14
+ run: |
15
+ # Try branch name first (format: CU-{taskId}_title)
16
+ TASK_ID=$(echo "${{ github.head_ref }}" | grep -oE 'CU-[a-zA-Z0-9]+' | head -1 | sed 's/CU-//')
17
+ # Fall back to PR title (format: "CU-{taskId}" or "Cu {taskId}")
18
+ if [ -z "$TASK_ID" ]; then
19
+ TASK_ID=$(echo "${{ github.event.pull_request.title }}" | grep -oiE '(CU-[a-zA-Z0-9]+|Cu [a-zA-Z0-9]+)' | head -1 | sed 's/^[Cc][Uu][-\ ]*//')
20
+ fi
21
+ echo "TASK_ID=$TASK_ID" >> $GITHUB_ENV
22
+
23
+ # ๐Ÿ‘‰ When PR is opened โ†’ set to "In Review"
24
+ - name: Set status to In Review
25
+ if: github.event.action == 'opened' && env.TASK_ID != ''
26
+ run: |
27
+ curl -X PUT "https://api.clickup.com/api/v2/task/$TASK_ID" \
28
+ -H "Authorization: ${{ secrets.CLICKUP_API_KEY }}" \
29
+ -H "Content-Type: application/json" \
30
+ -d '{"status":"In review"}'
31
+
32
+ # ๐Ÿ‘‰ When PR is merged โ†’ set to "Done"
33
+ - name: Set status to Done
34
+ if: github.event.action == 'closed' && github.event.pull_request.merged == true && env.TASK_ID != ''
35
+ run: |
36
+ curl -X PUT "https://api.clickup.com/api/v2/task/$TASK_ID" \
37
+ -H "Authorization: ${{ secrets.CLICKUP_API_KEY }}" \
38
+ -H "Content-Type: application/json" \
39
+ -d '{"status":"complete"}'
40
+
41
+ # ๐Ÿ‘‰ When PR is merged โ†’ resolve linked errors in Firebase
42
+ - name: Resolve errors in Firebase
43
+ if: github.event.action == 'closed' && github.event.pull_request.merged == true && env.TASK_ID != ''
44
+ continue-on-error: true
45
+ run: |
46
+ curl -X POST "https://europe-west2-placementt-dev.cloudfunctions.net/errorLogging-resolveErrorsByClickupTask" \
47
+ -H "Content-Type: application/json" \
48
+ -d "{\"clickupTaskId\":\"$TASK_ID\"}"
@@ -0,0 +1,32 @@
1
+ name: Deploy
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ permissions:
8
+ contents: write # default for repo checkout
9
+ id-token: write # <-- required for npm provenance
10
+ jobs:
11
+ publish:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+
16
+ - name: Setup Node
17
+ uses: actions/setup-node@v4
18
+ with:
19
+ node-version: 22
20
+ registry-url: https://registry.npmjs.org
21
+
22
+ - name: Install NPM
23
+ run: npm install -g npm@latest
24
+
25
+ - name: Install dependencies
26
+ run: yarn install --frozen-lockfile
27
+
28
+ - name: Build
29
+ run: yarn tsc
30
+
31
+ - name: Deploy All
32
+ run: node deploy-all.js
package/README.md ADDED
@@ -0,0 +1,119 @@
1
+ # placementt-core
2
+
3
+ Shared code (types, Firebase helpers, utilities, shared UI) used by `placementt-web`, `placementt-backend`, and `placementt-app`.
4
+
5
+ ## Testing local changes before publishing
6
+
7
+ Normally, `placementt-web` and `placementt-backend` depend on published npm versions of this package (via the `dev`/`prod`/`emu` dist-tags). While you're working on a change here, you don't want to publish to npm just to test it โ€” instead, build it locally and link it into the consuming repo with [yalc](https://github.com/wclr/yalc).
8
+
9
+ There are two ways to do this: **watch mode**, which rebuilds and relinks automatically as you save (recommended for any real iteration), or a manual **one-off** build/link for a single quick check. Watch mode is documented first below; the one-off flow still works and is documented further down.
10
+
11
+ ## Live watch mode (recommended)
12
+
13
+ ### 1. Watch and publish from placementt-core
14
+
15
+ ```
16
+ yarn watch-local dev # or: yarn watch-local prod (or -d / -p)
17
+ ```
18
+
19
+ Keeps `tsc --watch` running against your current working tree (including uncommitted changes), swapping in dev/prod config for the whole session the same way `test-local` does. On every successful compile it runs `yalc push`, which republishes to the yalc store **and** pushes the update straight into any repo that's already linked this package โ€” no need to re-run anything on the consumer side after the first link.
20
+
21
+ Leave this running in its own terminal for as long as you're iterating. Stop it with Ctrl+C when you're done โ€” it restores `package.json`, `src/firebase/firebaseConfig.tsx`, and `src/hooks.tsx` to their committed state and resets `lib/` via `git checkout`, so your working tree is left clean automatically.
22
+
23
+ **Important:** whichever flavor (`dev`/`prod`) this is running as is what gets pushed to *every* linked consumer, regardless of which flavor they originally linked with โ€” yalc tracks link targets by package name only, not by version. Don't run this in `prod` if you're mid-session testing against dev data elsewhere.
24
+
25
+ ### 2. Run the matching watcher in the consuming repo
26
+
27
+ First time only, link the package (same command as the one-off flow below):
28
+
29
+ ```
30
+ yarn core dev # or -d / -p โ€” run in placementt-web or placementt-backend
31
+ ```
32
+
33
+ Then, instead of manually restarting after every change, use one of:
34
+
35
+ **placementt-web โ€” live reload, no restart (preferred)**
36
+ ```
37
+ yarn dev:core-live dev / yarn dev:core-live prod # or prod / -d / -p
38
+ ```
39
+ Runs the dev server through [craco](https://github.com/dilanx/craco) (`craco.config.js`) instead of plain `react-scripts`, which tells webpack to actually watch `node_modules/placementt-core` and force a rebuild via `compiler.watching.invalidate()` whenever it changes โ€” so changes show up through normal Fast Refresh with no server restart. It clears `node_modules/.cache` once, right before boot โ€” skip that and the very first boot can silently serve whatever was last cached by an ordinary `yarn start` (this is what caused the app to boot on the wrong Firebase project despite the `dev` flag).
40
+
41
+ Caveat: since there's no server restart, if `watch-local`'s flavor changes *while* `dev:core-live` is open in the browser, the page can end up in a mixed state โ€” the old Firebase Auth session from one project, new code pointing at the other. Do a hard refresh after switching flavors mid-session.
42
+
43
+ **placementt-web โ€” restart-based (fallback)**
44
+ ```
45
+ yarn dev:core dev # or prod / -d / -p
46
+ ```
47
+ Watches `node_modules/placementt-core` and, on every change, kills whatever's on port 3000, clears `node_modules/.cache`, and restarts `yarn start`. Slower (a full recompile every time, several seconds) but simple. The cache clear isn't optional โ€” webpack treats `node_modules` packages as version-pinned/immutable for caching purposes, and since the local yalc build always publishes under the same constant sentinel version, a restart alone does *not* pick up the change (confirmed โ€” a stale build kept getting served without it). Use this if `dev:core-live` ever misbehaves.
48
+
49
+ **placementt-backend**
50
+ ```
51
+ yarn dev:core dev # or prod / -d / -p โ€” from repo root or functions/
52
+ ```
53
+ Watches `node_modules/placementt-core` and, on change, rebuilds the functions bundle and restarts `firebase emulators:start --only functions`.
54
+
55
+ ### 3. Clean up when you're done
56
+
57
+ - Stop `watch-local` in core (Ctrl+C) โ€” it self-restores, nothing to clean up manually.
58
+ - Stop `dev:core` / `dev:core-live` in the consuming repo(s).
59
+ - Unlink and go back to the real published version:
60
+ ```
61
+ yalc remove placementt-core
62
+ yarn install
63
+ ```
64
+ This restores `package.json`'s `placementt-core` entry to the real npm version and reinstalls it properly. `.yalc/` and `yalc.lock` are gitignored in the consuming repos, so they won't show up as clutter even while linked.
65
+
66
+ ### Known issues
67
+
68
+ - **"Invalid hook call" / duplicate React instances in placementt-web:** this package declares `expo` as a hard dependency (unused in `src/`, likely leftover), which pins its own `react@18.x`. When linked locally, yarn can nest a private copy of React inside `node_modules/placementt-core/node_modules` if it can't hoist a single version โ€” placementt-web's `package.json` works around this with a `resolutions` override forcing `react`/`react-dom` to the app's version everywhere. If you see this error after linking, check for a nested `node_modules/placementt-core/node_modules/react` first.
69
+
70
+ ## One-off testing (no watch mode)
71
+
72
+ ### 1. Publish your local changes to the yalc store
73
+
74
+ From this repo, run:
75
+
76
+ ```
77
+ yarn test-local dev # or: yarn test-local d
78
+ yarn test-local prod # or: yarn test-local p
79
+ ```
80
+
81
+ This builds your current working tree (including uncommitted changes) with the chosen config flavor (dev swaps in dev Firebase config/credentials, prod leaves it as-is), then publishes it to your local yalc store under a fixed sentinel version (`0.0.0-local-dev` / `0.0.0-local-prod`). It restores all the swapped files afterward, so your working tree is left clean.
82
+
83
+ Re-run this command any time you make further changes you want to test โ€” it always re-publishes over the same sentinel version.
84
+
85
+ ### 2. Pull it into placementt-web or placementt-backend
86
+
87
+ From `placementt-web` or `placementt-backend`, run:
88
+
89
+ ```
90
+ yarn core dev # or: yarn core d
91
+ yarn core prod # or: yarn core p
92
+ ```
93
+
94
+ This checks whether a matching local yalc build exists (published in step 1). If it does, it links your local build in via `yalc add` instead of installing from npm. If it doesn't, it falls back to installing the real published `dev`/`prod` dist-tag from npm as normal.
95
+
96
+ Match the flavor to what you published in step 1 (`dev` โ†” `dev`, `prod` โ†” `prod`).
97
+
98
+ ### 3. Restart the dev server/emulator to pick it up
99
+
100
+ Neither CRA's dev server nor the Firebase emulator watches `node_modules` for changes, so you need to restart after linking. Add `--restart` (or `-r`) to the same command to do this in one step:
101
+
102
+ ```
103
+ yarn core dev --restart # or: yarn core d -r
104
+ ```
105
+
106
+ - **placementt-web**: kills whatever's running on port 3000, clears `node_modules/.cache`, and runs `yarn start`.
107
+ - **placementt-backend**: rebuilds the functions bundle (`npm run build`) and starts the functions emulator (`firebase emulators:start --only functions`).
108
+
109
+ ### Full loop
110
+
111
+ ```
112
+ # in placementt-core, after making changes
113
+ yarn test-local dev
114
+
115
+ # in placementt-web and/or placementt-backend
116
+ yarn core dev --restart
117
+ ```
118
+
119
+ Repeat step 1 + step 3 as you iterate. Once you're happy with the change, commit it here, bump the version, and publish for real (`yarn deploy` / `yarn deploy-all`) โ€” then re-run `yarn core dev` (or `prod`) in the consuming repos without `--restart` to drop back to the real published version instead of the local link.
package/deploy-all.js CHANGED
@@ -1,75 +1,108 @@
1
1
  const fs = require('fs');
2
- const readline = require('readline');
3
2
  const { execSync } = require('child_process');
4
3
 
5
- const rl = readline.createInterface({
6
- input: process.stdin,
7
- output: process.stdout
8
- });
9
-
10
- function askQuestion(query) {
11
- return new Promise(resolve => rl.question(query, resolve));
4
+ function run(cmd) {
5
+ execSync(cmd, { stdio: 'inherit' });
12
6
  }
13
7
 
14
- async function deploy() {
15
- console.log("๐Ÿ“ฆ Starting deploy-all process...");
16
-
17
- // Read package.json
18
- const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8'));
19
- const versionParts = packageJson.version.split('.');
20
- console.log(`๐Ÿ” Current version: ${packageJson.version} (third item: ${versionParts[2]})`);
21
-
22
- // Ask for version number
23
- const versionNumber = await askQuestion("Enter version number (x for 1.0.x & 1.300.x): ");
24
- rl.close();
25
-
26
- if (!/^[0-9]+$/.test(versionNumber)) {
27
- console.error("โŒ Invalid version number. Must be a single number.");
28
- process.exit(1);
29
- }
30
-
31
- // Function to update package.json version
32
- function updateVersion(version) {
33
- packageJson.version = version;
34
- fs.writeFileSync('package.json', JSON.stringify(packageJson, null, 2) + '\n');
35
- console.log(`โœ… Updated version to ${version}`);
36
- }
37
-
38
- // Publish 1.0.x
39
- const firstVersion = `1.0.${versionNumber}`;
40
- updateVersion(firstVersion);
41
- console.log("๐Ÿš€ Running TypeScript compiler...");
42
- execSync('tsc', { stdio: 'inherit' });
43
- console.log("๐Ÿ“ค Publishing version " + firstVersion);
44
- execSync('yarn publish --new-version '+firstVersion, { stdio: 'inherit' });
45
-
46
- // Modify firebaseConfig.tsx
47
- console.log("๐Ÿ›  Modifying firebaseConfig.tsx...");
48
- let firebaseConfig = fs.readFileSync('src/firebase/firebaseConfig.tsx', 'utf8');
49
- firebaseConfig = firebaseConfig.replace(/getFunctions}/g, 'connectFunctionsEmulator, getFunctions}'); // Modify as needed
50
- firebaseConfig = firebaseConfig.replace(/\/\/ con/g, 'con'); // Modify as needed
51
-
52
- fs.writeFileSync('src/firebase/firebaseConfig.tsx', firebaseConfig);
53
-
54
- // Publish 1.300.x
55
- const secondVersion = `1.300.${versionNumber}`;
56
- updateVersion(secondVersion);
57
- console.log("๐Ÿš€ Running TypeScript compiler again...");
58
- execSync('tsc', { stdio: 'inherit' });
59
- console.log("๐Ÿ“ค Publishing version " + secondVersion);
60
- execSync('yarn publish --new-version '+firstVersion, { stdio: 'inherit' });
61
-
62
-
63
- console.log("๐Ÿ›  Resetting firebaseConfig.tsx...");
64
- firebaseConfig = firebaseConfig.replace(/connectFunctionsEmulator, getFunctions}/g, 'getFunctions}'); // Modify as needed
65
- firebaseConfig = firebaseConfig.replace(/connectFunctionsEmulator\(/g, '//connectFunctionsEmulator('); // Modify as needed
66
-
67
- fs.writeFileSync('src/firebase/firebaseConfig.tsx', firebaseConfig);
68
-
69
- console.log("๐ŸŽ‰ Deployment complete!");
8
+ console.log("๐Ÿ“ฆ Starting automated deploy-all process...");
9
+
10
+ // ---- Read & bump version ----
11
+ const packageJsonPath = 'package.json';
12
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
13
+
14
+ const [major, minor, patch] = packageJson.version.split('.').map(Number);
15
+ const nextPatch = patch + 1;
16
+
17
+ console.log(`๐Ÿ” Current version: ${packageJson.version}`);
18
+ console.log(`๐Ÿ”ข Next patch version: ${nextPatch}`);
19
+
20
+ function updateVersion(version) {
21
+ packageJson.version = version;
22
+ fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n');
23
+ console.log(`โœ… Updated version to ${version}`);
70
24
  }
71
25
 
72
- deploy().catch(err => {
73
- console.error("โŒ Error: ", err);
74
- process.exit(1);
75
- });
26
+ // ---- Keep original file contents for reset ----
27
+ const firebaseConfigPath = 'src/firebase/firebaseConfig.tsx';
28
+ const hooksPath = 'src/hooks.tsx';
29
+
30
+ const originalFirebaseConfig = fs.readFileSync(firebaseConfigPath, 'utf8');
31
+ const originalHooks = fs.readFileSync(hooksPath, 'utf8');
32
+
33
+ // -------------------------------
34
+ // 1๏ธโƒฃ PROD VERSION
35
+ // -------------------------------
36
+ const prodVersion = `1.1.${nextPatch}`;
37
+ updateVersion(prodVersion);
38
+
39
+ console.log("๐Ÿš€ Building (prod)...");
40
+ run('yarn tsc');
41
+
42
+ console.log(`๐Ÿ“ค Publishing ${prodVersion}`);
43
+ run('npm publish --tag prod');
44
+
45
+ // -------------------------------
46
+ // 2๏ธโƒฃ DEV VERSION
47
+ // -------------------------------
48
+ console.log("๐Ÿ›  Switching to DEV config...");
49
+
50
+ let firebaseConfig = originalFirebaseConfig.replace(
51
+ /\(credentialsProd\)/g,
52
+ '(credentialsDev)'
53
+ );
54
+ fs.writeFileSync(firebaseConfigPath, firebaseConfig);
55
+
56
+ let hooks = originalHooks.replace(
57
+ /XMPXCMUUOJ/g,
58
+ 'A0ZB50I7VS'
59
+ );
60
+ fs.writeFileSync(hooksPath, hooks);
61
+
62
+ const devVersion = `1.400.${nextPatch}`;
63
+ updateVersion(devVersion);
64
+
65
+ console.log("๐Ÿš€ Building (dev)...");
66
+ run('yarn tsc');
67
+
68
+ console.log(`๐Ÿ“ค Publishing ${devVersion}`);
69
+ run('npm publish --tag dev');
70
+
71
+ // -------------------------------
72
+ // 3๏ธโƒฃ EMULATOR VERSION
73
+ // -------------------------------
74
+ console.log("๐Ÿ›  Switching to EMULATOR config...");
75
+
76
+ firebaseConfig = firebaseConfig
77
+ .replace(/getFunctions}/g, 'connectFunctionsEmulator, getFunctions}')
78
+ .replace(/\/\/ con/g, 'con');
79
+
80
+ fs.writeFileSync(firebaseConfigPath, firebaseConfig);
81
+
82
+ const emulatorVersion = `1.300.${nextPatch}`;
83
+ updateVersion(emulatorVersion);
84
+
85
+ console.log("๐Ÿš€ Building (emulator)...");
86
+ run('yarn tsc');
87
+
88
+ console.log(`๐Ÿ“ค Publishing ${emulatorVersion}`);
89
+ run('npm publish --tag emu');
90
+
91
+ // -------------------------------
92
+ // RESET FILES
93
+ // -------------------------------
94
+ console.log("๐Ÿงน Resetting source files...");
95
+ fs.writeFileSync(firebaseConfigPath, originalFirebaseConfig);
96
+ fs.writeFileSync(hooksPath, originalHooks);
97
+
98
+ console.log("๐ŸŽ‰ Deployment complete!");
99
+
100
+ updateVersion(prodVersion);
101
+ execSync('git config user.name "github-actions"', { stdio: 'inherit' });
102
+ execSync('git config user.email "github-actions@github.com"', { stdio: 'inherit' });
103
+
104
+ execSync('git add package.json', { stdio: 'inherit' });
105
+ execSync('git commit -m "chore: bump version"', { stdio: 'inherit' });
106
+ execSync('git push origin main', { stdio: 'inherit' });
107
+
108
+ console.log("๐ŸŽ‰ Deployment complete!");
package/jest.config.js ADDED
@@ -0,0 +1,16 @@
1
+ /** @type {import('ts-jest').JestConfigWithTsJest} */
2
+ module.exports = {
3
+ preset: 'ts-jest',
4
+ testEnvironment: 'jsdom',
5
+ globals: {
6
+ 'ts-jest': {
7
+ diagnostics: false,
8
+ tsconfig: {
9
+ noUnusedLocals: false,
10
+ noImplicitAny: false,
11
+ noImplicitReturns: false,
12
+ strict: false,
13
+ },
14
+ },
15
+ },
16
+ };
@@ -0,0 +1 @@
1
+ export {};