@widgetic/dev-tools 0.3.6 → 0.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -337,7 +337,7 @@ From `dev-tools`, walk every package:
337
337
  npm run publish-all-to-npm
338
338
  ```
339
339
 
340
- The walk is `api-sdk`, `cache-layer`, `design-system`, `dev-tools`, `canvas`, `chat`, `editor`, `file-browser`, `widget-creator`, `embed-sdk` and `ui-sdk`. `site` is not in it.
340
+ The walk is `api-sdk`, `cache-layer`, `design-system`, `dev-tools`, `canvas`, `chat`, `editor`, `file-browser`, `widget-creator`, `embed-sdk` and `ui-sdk`. `site` is not in it. These are the npm packages. The API SDK for Python, Ruby, C#, Java, PHP and Go is published from `api-gateway-service` with `scripts/publish-public-sdks.sh`, not by this walk.
341
341
 
342
342
  ## Releasing
343
343
 
@@ -7,8 +7,10 @@
7
7
  * tests before the version changes. Every other package builds, or packages,
8
8
  * then publishes.
9
9
  *
10
- * The script does nothing when the latest commit is the one that wrote the
11
- * current package.json version. Otherwise it raises the patch, publishes,
10
+ * The script fetches origin first. When that branch has commits this checkout
11
+ * does not, it merges them. A conflict stops the publish. It does nothing when
12
+ * the latest commit is the one that wrote the current package.json version.
13
+ * Otherwise it raises the patch, publishes,
12
14
  * commits the version files, tags that commit v plus the version, and pushes
13
15
  * the commit and the tag.
14
16
  */
@@ -95,6 +97,53 @@ function publishToNpm() {
95
97
  run('npm', ['publish', '--ignore-scripts', '--access', access]);
96
98
  }
97
99
 
100
+ /**
101
+ * Bring in commits that landed on the upstream branch before this publish.
102
+ *
103
+ * A clean fast-forward or a merge without conflicts continues. A conflict is
104
+ * left unresolved on purpose: the script cannot tell which side of a content
105
+ * conflict should be the code that gets published, so it aborts the merge and
106
+ * stops.
107
+ */
108
+ function pullRemoteCommits() {
109
+ console.log(`[publish-package] ${packageName}: checking origin for commits this checkout does not have`);
110
+ run('git', ['fetch', 'origin']);
111
+ const upstreamResult = spawnSync('git', ['rev-parse', '--abbrev-ref', '--symbolic-full-name', '@{upstream}'], {
112
+ cwd: packageDir,
113
+ encoding: 'utf8'
114
+ });
115
+ const upstream = (upstreamResult.stdout || '').trim();
116
+ if (upstreamResult.status !== 0 || upstream === '') {
117
+ console.error(`[publish-package] ${packageName}: this branch does not track an upstream. Set it before publishing.`);
118
+ process.exit(1);
119
+ }
120
+ const behind = gitOutput(['rev-list', '--count', `HEAD..${upstream}`]);
121
+ if (behind === '0') return;
122
+
123
+ const dirty = gitOutput(['status', '--porcelain']);
124
+ if (dirty !== '') {
125
+ console.error(`[publish-package] ${packageName}: ${upstream} has ${behind} commit(s) to merge, and this checkout has uncommitted files. Commit or stash them first.`);
126
+ console.error(gitOutput(['log', '--oneline', `HEAD..${upstream}`]));
127
+ process.exit(1);
128
+ }
129
+
130
+ console.log(`[publish-package] ${packageName}: merging ${behind} commit(s) from ${upstream}`);
131
+ console.log(gitOutput(['log', '--oneline', `HEAD..${upstream}`]));
132
+ const merge = spawnSync('git', ['merge', '--no-edit', upstream], {
133
+ cwd: packageDir,
134
+ stdio: 'inherit'
135
+ });
136
+ if (merge.status === 0) return;
137
+
138
+ const conflicts = gitOutput(['diff', '--name-only', '--diff-filter=U']);
139
+ console.error(`[publish-package] ${packageName}: merge stopped on conflicts. The publish does not choose a side.`);
140
+ if (conflicts) console.error(conflicts);
141
+ spawnSync('git', ['merge', '--abort'], { cwd: packageDir, stdio: 'inherit' });
142
+ process.exit(merge.status ?? 1);
143
+ }
144
+
145
+ pullRemoteCommits();
146
+
98
147
  const currentVersion = readVersion();
99
148
  if (versionCommitIsHead(currentVersion)) {
100
149
  console.log(`[publish-package] ${packageName}: no commits since ${currentVersion}. Nothing to publish.`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widgetic/dev-tools",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "type": "module",
5
5
  "description": "Build-time checks and dev tooling shared by the published @widgetic packages, released once so the repositories that consume them cannot drift apart. Currently: check-runtime-deps (with the fixture suite that proves it fails), the Vite sibling-$lib remap, the canonical Frontend sibling layout that builds every consumer's dev-alias tables, and check-links — the link-doctor that fails when a sibling symlink dangles, a promised dist/ file is missing, or a dead checkout name lingers, and check-design-system-peers — which fails when the two design-system peers' lockfiles drift apart.",
6
6
  "repository": {