@towns-protocol/generated 0.0.385 → 0.0.387

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 (2) hide show
  1. package/package.json +3 -3
  2. package/scripts/prepare.js +17 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@towns-protocol/generated",
3
- "version": "0.0.385",
3
+ "version": "0.0.387",
4
4
  "packageManager": "yarn@3.8.0",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -13,7 +13,7 @@
13
13
  "ethers": "^5.8.0"
14
14
  },
15
15
  "devDependencies": {
16
- "@towns-protocol/contracts": "^0.0.385"
16
+ "@towns-protocol/contracts": "^0.0.387"
17
17
  },
18
18
  "files": [
19
19
  "config/**/*",
@@ -32,5 +32,5 @@
32
32
  "publishConfig": {
33
33
  "access": "public"
34
34
  },
35
- "gitHead": "2b60b355cb85529d292b3702a695750f5c884ab7"
35
+ "gitHead": "809348c6bfa94d97e516fdd38ed540c6ee0a34d2"
36
36
  }
@@ -63,11 +63,19 @@ function getContractsHash() {
63
63
  // Check if contracts have changed by comparing hashes
64
64
  function contractsChanged() {
65
65
  const currentHash = getContractsHash();
66
-
67
- if (!currentHash) return false; // No contracts source, use existing generated files
68
-
66
+
67
+ if (!currentHash) {
68
+ // Check if we're in Docker with source but no git (git rev-parse failed)
69
+ if (existsSync(resolve(contractsDir, 'src'))) {
70
+ console.log('Contract source exists but git unavailable - regenerating to ensure freshness');
71
+ return true; // Force regeneration in Docker
72
+ }
73
+ // No source = npm package scenario, use existing generated files
74
+ return false;
75
+ }
76
+
69
77
  if (!existsSync(hashFile)) return true; // No stored hash, need to generate
70
-
78
+
71
79
  const storedHash = readFileSync(hashFile, 'utf8').trim();
72
80
  return currentHash !== storedHash;
73
81
  }
@@ -184,7 +192,11 @@ async function main() {
184
192
 
185
193
  if (!generatedFilesExist()) {
186
194
  console.log('No artifacts found, trying npm download first...');
187
- await downloadArtifactsFromNpm();
195
+ if (!(await downloadArtifactsFromNpm())) {
196
+ console.log('NPM download failed, attempting local generation...');
197
+ generateArtifacts();
198
+ return;
199
+ }
188
200
  }
189
201
 
190
202
  if (skipRequested) {