placementt-core 1.400.1171 โ†’ 1.400.1172

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.
@@ -4,7 +4,12 @@ on:
4
4
  push:
5
5
  branches:
6
6
  - main
7
- permissions:
7
+ # Every publish rewrites the same npm package document, so two runs publishing at
8
+ # once clobber each other's versions and dist-tags. Queue runs instead.
9
+ concurrency:
10
+ group: npm-publish
11
+ cancel-in-progress: false
12
+ permissions:
8
13
  contents: write # default for repo checkout
9
14
  id-token: write # <-- required for npm provenance
10
15
  jobs:
@@ -12,6 +17,10 @@ jobs:
12
17
  runs-on: ubuntu-latest
13
18
  steps:
14
19
  - uses: actions/checkout@v4
20
+ with:
21
+ # A queued run must build the tip of main (including the previous run's
22
+ # version bump), not the commit that originally triggered it.
23
+ ref: main
15
24
 
16
25
  - name: Setup Node
17
26
  uses: actions/setup-node@v4
package/deploy-all.js CHANGED
@@ -11,7 +11,11 @@ console.log("๐Ÿ“ฆ Starting automated deploy-all process...");
11
11
  const packageJsonPath = 'package.json';
12
12
  const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
13
13
 
14
- const [major, minor, patch] = packageJson.version.split('.').map(Number);
14
+ // package.json can lag the registry (a bump commit that failed to push, or a
15
+ // manual edit), so take the highest patch from either source.
16
+ const publishedTags = JSON.parse(execSync('npm view placementt-core dist-tags --json', { encoding: 'utf8' }));
17
+ const patchOf = (version) => Number(version.split('.')[2]);
18
+ const patch = Math.max(patchOf(packageJson.version), ...['prod', 'dev', 'emu'].filter((tag) => publishedTags[tag]).map((tag) => patchOf(publishedTags[tag])));
15
19
  const nextPatch = patch + 1;
16
20
 
17
21
  console.log(`๐Ÿ” Current version: ${packageJson.version}`);
@@ -23,6 +27,25 @@ function updateVersion(version) {
23
27
  console.log(`โœ… Updated version to ${version}`);
24
28
  }
25
29
 
30
+ // npm processes publishes asynchronously, and a publish that lands while the
31
+ // previous one is still being processed can overwrite that one's dist-tag (the
32
+ // version itself survives). Wait for each publish to settle before the next.
33
+ function publishAndWait(version, tag) {
34
+ run(`npm publish --tag ${tag}`);
35
+
36
+ for (let attempt = 0; attempt < 60; attempt++) {
37
+ const tags = JSON.parse(execSync('npm view placementt-core dist-tags --json --prefer-online', { encoding: 'utf8' }));
38
+ if (tags[tag] === version) {
39
+ console.log(`โœ… ${tag} โ†’ ${version}`);
40
+ return;
41
+ }
42
+ execSync('sleep 5');
43
+ }
44
+
45
+ console.error(`โŒ ${tag} still not pointing at ${version} after 5 minutes. Fix with: npm dist-tag add placementt-core@${version} ${tag}`);
46
+ process.exit(1);
47
+ }
48
+
26
49
  // ---- Keep original file contents for reset ----
27
50
  const firebaseConfigPath = 'src/firebase/firebaseConfig.tsx';
28
51
  // Every Algolia client reads the app id from this one module, so swapping it
@@ -45,20 +68,10 @@ function toDevAlgoliaConfig(source) {
45
68
  return swapped;
46
69
  }
47
70
 
48
- // -------------------------------
49
- // 1๏ธโƒฃ PROD VERSION
50
- // -------------------------------
51
71
  const prodVersion = `1.1.${nextPatch}`;
52
- updateVersion(prodVersion);
53
-
54
- console.log("๐Ÿš€ Building (prod)...");
55
- run('yarn tsc');
56
-
57
- console.log(`๐Ÿ“ค Publishing ${prodVersion}`);
58
- run('npm publish --tag prod');
59
72
 
60
73
  // -------------------------------
61
- // 2๏ธโƒฃ DEV VERSION
74
+ // 1๏ธโƒฃ DEV VERSION
62
75
  // -------------------------------
63
76
  console.log("๐Ÿ›  Switching to DEV config...");
64
77
 
@@ -77,10 +90,10 @@ console.log("๐Ÿš€ Building (dev)...");
77
90
  run('yarn tsc');
78
91
 
79
92
  console.log(`๐Ÿ“ค Publishing ${devVersion}`);
80
- run('npm publish --tag dev');
93
+ publishAndWait(devVersion, 'dev');
81
94
 
82
95
  // -------------------------------
83
- // 3๏ธโƒฃ EMULATOR VERSION
96
+ // 2๏ธโƒฃ EMULATOR VERSION
84
97
  // -------------------------------
85
98
  console.log("๐Ÿ›  Switching to EMULATOR config...");
86
99
 
@@ -97,7 +110,7 @@ console.log("๐Ÿš€ Building (emulator)...");
97
110
  run('yarn tsc');
98
111
 
99
112
  console.log(`๐Ÿ“ค Publishing ${emulatorVersion}`);
100
- run('npm publish --tag emu');
113
+ publishAndWait(emulatorVersion, 'emu');
101
114
 
102
115
  // -------------------------------
103
116
  // RESET FILES
@@ -106,6 +119,17 @@ console.log("๐Ÿงน Resetting source files...");
106
119
  fs.writeFileSync(firebaseConfigPath, originalFirebaseConfig);
107
120
  fs.writeFileSync(algoliaConfigPath, originalAlgoliaConfig);
108
121
 
122
+ // -------------------------------
123
+ // PROD VERSION (last, so nothing publishes after it and clobbers its tag)
124
+ // -------------------------------
125
+ updateVersion(prodVersion);
126
+
127
+ console.log("๐Ÿš€ Building (prod)...");
128
+ run('yarn tsc');
129
+
130
+ console.log(`๐Ÿ“ค Publishing ${prodVersion}`);
131
+ publishAndWait(prodVersion, 'prod');
132
+
109
133
  console.log("๐ŸŽ‰ Deployment complete!");
110
134
 
111
135
  updateVersion(prodVersion);
@@ -114,6 +138,8 @@ execSync('git config user.email "github-actions@github.com"', { stdio: 'inherit'
114
138
 
115
139
  execSync('git add package.json', { stdio: 'inherit' });
116
140
  execSync('git commit -m "chore: bump version"', { stdio: 'inherit' });
141
+ // main may have moved while this run was building; rebase so the bump still lands.
142
+ execSync('git pull --rebase origin main', { stdio: 'inherit' });
117
143
  execSync('git push origin main', { stdio: 'inherit' });
118
144
 
119
145
  console.log("๐ŸŽ‰ Deployment complete!");
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "private": false,
3
3
  "name": "placementt-core",
4
4
  "author": "Placementt",
5
- "version": "1.400.1171",
5
+ "version": "1.400.1172",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
8
8
  "scripts": {