@0xsquid/react-hooks 8.0.1-para-beta.3 → 8.0.1-para-beta.5
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/package.json +4 -3
- package/scripts/setup-para.js +62 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xsquid/react-hooks",
|
|
3
|
-
"version": "8.0.1-para-beta.
|
|
3
|
+
"version": "8.0.1-para-beta.5",
|
|
4
4
|
"description": "Squid hooks monorepo",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
17
|
"dist",
|
|
18
|
-
"README.md"
|
|
18
|
+
"README.md",
|
|
19
|
+
"scripts/setup-para.js"
|
|
19
20
|
],
|
|
20
21
|
"repository": {
|
|
21
22
|
"type": "git",
|
|
@@ -32,7 +33,7 @@
|
|
|
32
33
|
"release:ci": "release-it --ci",
|
|
33
34
|
"release:dry": "release-it --dry-run",
|
|
34
35
|
"packlib": "rm -f squid-hooks-lib-*.tgz && yarn build && yarn pack --filename squid-hooks-lib-$(date +%s).tgz",
|
|
35
|
-
"postinstall": "
|
|
36
|
+
"postinstall": "node scripts/setup-para.js"
|
|
36
37
|
},
|
|
37
38
|
"dependencies": {
|
|
38
39
|
"@0xsquid/sdk": "2.9.2",
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import * as fs from "node:fs/promises";
|
|
3
|
+
import * as path from "node:path";
|
|
4
|
+
|
|
5
|
+
const PACKAGES_TO_STUB = [
|
|
6
|
+
"@getpara/evm-wallet-connectors",
|
|
7
|
+
"@getpara/cosmos-wallet-connectors",
|
|
8
|
+
"@getpara/solana-wallet-connectors",
|
|
9
|
+
"@farcaster/miniapp-sdk",
|
|
10
|
+
"@farcaster/miniapp-wagmi-connector",
|
|
11
|
+
"@farcaster/mini-app-solana",
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
const findRootNodeModules = () => {
|
|
15
|
+
return path.join(process.cwd(), "node_modules");
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const stubMissingPackages = async () => {
|
|
19
|
+
const nodeModulesPath = findRootNodeModules();
|
|
20
|
+
|
|
21
|
+
for (const packageName of PACKAGES_TO_STUB) {
|
|
22
|
+
try {
|
|
23
|
+
await import(packageName);
|
|
24
|
+
continue;
|
|
25
|
+
} catch (err) {
|
|
26
|
+
if (err.code !== "ERR_MODULE_NOT_FOUND") {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const pkgDir = path.join(nodeModulesPath, packageName);
|
|
31
|
+
const indexPath = path.join(pkgDir, "index.js");
|
|
32
|
+
const packageJsonPath = path.join(pkgDir, "package.json");
|
|
33
|
+
|
|
34
|
+
await fs.mkdir(pkgDir, { recursive: true });
|
|
35
|
+
|
|
36
|
+
const packageJsonContent = {
|
|
37
|
+
name: packageName,
|
|
38
|
+
main: "./index.js",
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
await fs.access(indexPath);
|
|
43
|
+
} catch {
|
|
44
|
+
await fs.writeFile(indexPath, "// STUB MODULE", "utf-8");
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
try {
|
|
48
|
+
await fs.access(packageJsonPath);
|
|
49
|
+
} catch {
|
|
50
|
+
await fs.writeFile(
|
|
51
|
+
packageJsonPath,
|
|
52
|
+
JSON.stringify(packageJsonContent, null, 2),
|
|
53
|
+
"utf-8"
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
console.log(`Stubbed ${packageName}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
await stubMissingPackages();
|