@getpara/cli 2.15.0
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 +97 -0
- package/dist/api/client.d.ts +49 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/client.js +247 -0
- package/dist/api/errors.d.ts +9 -0
- package/dist/api/errors.d.ts.map +1 -0
- package/dist/api/errors.js +29 -0
- package/dist/api/types.d.ts +155 -0
- package/dist/api/types.d.ts.map +1 -0
- package/dist/api/types.js +58 -0
- package/dist/auth/polling-flow.d.ts +7 -0
- package/dist/auth/polling-flow.d.ts.map +1 -0
- package/dist/auth/polling-flow.js +94 -0
- package/dist/auth/session-manager.d.ts +7 -0
- package/dist/auth/session-manager.d.ts.map +1 -0
- package/dist/auth/session-manager.js +42 -0
- package/dist/cli.d.ts +16 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +151 -0
- package/dist/commands/auth/index.d.ts +3 -0
- package/dist/commands/auth/index.d.ts.map +1 -0
- package/dist/commands/auth/index.js +18 -0
- package/dist/commands/auth/login.d.ts +3 -0
- package/dist/commands/auth/login.d.ts.map +1 -0
- package/dist/commands/auth/login.js +70 -0
- package/dist/commands/auth/logout.d.ts +3 -0
- package/dist/commands/auth/logout.d.ts.map +1 -0
- package/dist/commands/auth/logout.js +45 -0
- package/dist/commands/auth/status.d.ts +3 -0
- package/dist/commands/auth/status.d.ts.map +1 -0
- package/dist/commands/auth/status.js +54 -0
- package/dist/commands/config.d.ts +3 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +122 -0
- package/dist/commands/create.d.ts +3 -0
- package/dist/commands/create.d.ts.map +1 -0
- package/dist/commands/create.js +587 -0
- package/dist/commands/doctor.d.ts +3 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +67 -0
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +45 -0
- package/dist/commands/keys/archive.d.ts +3 -0
- package/dist/commands/keys/archive.d.ts.map +1 -0
- package/dist/commands/keys/archive.js +49 -0
- package/dist/commands/keys/config/branding.d.ts +23 -0
- package/dist/commands/keys/config/branding.d.ts.map +1 -0
- package/dist/commands/keys/config/branding.js +246 -0
- package/dist/commands/keys/config/categories.d.ts +15 -0
- package/dist/commands/keys/config/categories.d.ts.map +1 -0
- package/dist/commands/keys/config/categories.js +67 -0
- package/dist/commands/keys/config/index.d.ts +3 -0
- package/dist/commands/keys/config/index.d.ts.map +1 -0
- package/dist/commands/keys/config/index.js +56 -0
- package/dist/commands/keys/config/ramps.d.ts +18 -0
- package/dist/commands/keys/config/ramps.d.ts.map +1 -0
- package/dist/commands/keys/config/ramps.js +185 -0
- package/dist/commands/keys/config/security.d.ts +15 -0
- package/dist/commands/keys/config/security.d.ts.map +1 -0
- package/dist/commands/keys/config/security.js +212 -0
- package/dist/commands/keys/config/setup.d.ts +16 -0
- package/dist/commands/keys/config/setup.d.ts.map +1 -0
- package/dist/commands/keys/config/setup.js +235 -0
- package/dist/commands/keys/config/webhooks.d.ts +18 -0
- package/dist/commands/keys/config/webhooks.d.ts.map +1 -0
- package/dist/commands/keys/config/webhooks.js +279 -0
- package/dist/commands/keys/create.d.ts +3 -0
- package/dist/commands/keys/create.d.ts.map +1 -0
- package/dist/commands/keys/create.js +64 -0
- package/dist/commands/keys/get.d.ts +3 -0
- package/dist/commands/keys/get.d.ts.map +1 -0
- package/dist/commands/keys/get.js +91 -0
- package/dist/commands/keys/index.d.ts +3 -0
- package/dist/commands/keys/index.d.ts.map +1 -0
- package/dist/commands/keys/index.js +22 -0
- package/dist/commands/keys/list.d.ts +3 -0
- package/dist/commands/keys/list.d.ts.map +1 -0
- package/dist/commands/keys/list.js +66 -0
- package/dist/commands/keys/rotate.d.ts +3 -0
- package/dist/commands/keys/rotate.d.ts.map +1 -0
- package/dist/commands/keys/rotate.js +59 -0
- package/dist/commands/orgs/index.d.ts +3 -0
- package/dist/commands/orgs/index.d.ts.map +1 -0
- package/dist/commands/orgs/index.js +15 -0
- package/dist/commands/orgs/list.d.ts +3 -0
- package/dist/commands/orgs/list.d.ts.map +1 -0
- package/dist/commands/orgs/list.js +53 -0
- package/dist/commands/orgs/switch.d.ts +3 -0
- package/dist/commands/orgs/switch.d.ts.map +1 -0
- package/dist/commands/orgs/switch.js +61 -0
- package/dist/commands/projects/archive.d.ts +3 -0
- package/dist/commands/projects/archive.d.ts.map +1 -0
- package/dist/commands/projects/archive.js +51 -0
- package/dist/commands/projects/create.d.ts +3 -0
- package/dist/commands/projects/create.d.ts.map +1 -0
- package/dist/commands/projects/create.js +48 -0
- package/dist/commands/projects/index.d.ts +3 -0
- package/dist/commands/projects/index.d.ts.map +1 -0
- package/dist/commands/projects/index.js +25 -0
- package/dist/commands/projects/list.d.ts +3 -0
- package/dist/commands/projects/list.d.ts.map +1 -0
- package/dist/commands/projects/list.js +52 -0
- package/dist/commands/projects/restore.d.ts +3 -0
- package/dist/commands/projects/restore.d.ts.map +1 -0
- package/dist/commands/projects/restore.js +36 -0
- package/dist/commands/projects/switch.d.ts +3 -0
- package/dist/commands/projects/switch.d.ts.map +1 -0
- package/dist/commands/projects/switch.js +57 -0
- package/dist/commands/projects/update.d.ts +3 -0
- package/dist/commands/projects/update.d.ts.map +1 -0
- package/dist/commands/projects/update.js +67 -0
- package/dist/commands/whoami.d.ts +3 -0
- package/dist/commands/whoami.d.ts.map +1 -0
- package/dist/commands/whoami.js +61 -0
- package/dist/config/config-manager.d.ts +3 -0
- package/dist/config/config-manager.d.ts.map +1 -0
- package/dist/config/config-manager.js +32 -0
- package/dist/config/config-store.d.ts +10 -0
- package/dist/config/config-store.d.ts.map +1 -0
- package/dist/config/config-store.js +37 -0
- package/dist/config/credential-store.d.ts +12 -0
- package/dist/config/credential-store.d.ts.map +1 -0
- package/dist/config/credential-store.js +94 -0
- package/dist/config/paths.d.ts +5 -0
- package/dist/config/paths.d.ts.map +1 -0
- package/dist/config/paths.js +29 -0
- package/dist/config/project-config.d.ts +8 -0
- package/dist/config/project-config.d.ts.map +1 -0
- package/dist/config/project-config.js +41 -0
- package/dist/core/constants.d.ts +27 -0
- package/dist/core/constants.d.ts.map +1 -0
- package/dist/core/constants.js +60 -0
- package/dist/core/error-handler.d.ts +24 -0
- package/dist/core/error-handler.d.ts.map +1 -0
- package/dist/core/error-handler.js +83 -0
- package/dist/core/types.d.ts +21 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +0 -0
- package/dist/core/update-check.d.ts +6 -0
- package/dist/core/update-check.d.ts.map +1 -0
- package/dist/core/update-check.js +78 -0
- package/dist/diagnostics/checks/chain-dependencies.d.ts +2 -0
- package/dist/diagnostics/checks/chain-dependencies.d.ts.map +1 -0
- package/dist/diagnostics/checks/chain-dependencies.js +130 -0
- package/dist/diagnostics/checks/css-import.d.ts +2 -0
- package/dist/diagnostics/checks/css-import.d.ts.map +1 -0
- package/dist/diagnostics/checks/css-import.js +57 -0
- package/dist/diagnostics/checks/deprecated-packages.d.ts +2 -0
- package/dist/diagnostics/checks/deprecated-packages.d.ts.map +1 -0
- package/dist/diagnostics/checks/deprecated-packages.js +93 -0
- package/dist/diagnostics/checks/env-api-key.d.ts +2 -0
- package/dist/diagnostics/checks/env-api-key.d.ts.map +1 -0
- package/dist/diagnostics/checks/env-api-key.js +75 -0
- package/dist/diagnostics/checks/env-var-prefix.d.ts +2 -0
- package/dist/diagnostics/checks/env-var-prefix.d.ts.map +1 -0
- package/dist/diagnostics/checks/env-var-prefix.js +52 -0
- package/dist/diagnostics/checks/index.d.ts +13 -0
- package/dist/diagnostics/checks/index.d.ts.map +1 -0
- package/dist/diagnostics/checks/index.js +32 -0
- package/dist/diagnostics/checks/para-provider.d.ts +2 -0
- package/dist/diagnostics/checks/para-provider.d.ts.map +1 -0
- package/dist/diagnostics/checks/para-provider.js +42 -0
- package/dist/diagnostics/checks/query-client.d.ts +2 -0
- package/dist/diagnostics/checks/query-client.d.ts.map +1 -0
- package/dist/diagnostics/checks/query-client.js +58 -0
- package/dist/diagnostics/checks/use-client-directive.d.ts +2 -0
- package/dist/diagnostics/checks/use-client-directive.d.ts.map +1 -0
- package/dist/diagnostics/checks/use-client-directive.js +81 -0
- package/dist/diagnostics/checks/version-consistency.d.ts +2 -0
- package/dist/diagnostics/checks/version-consistency.d.ts.map +1 -0
- package/dist/diagnostics/checks/version-consistency.js +93 -0
- package/dist/diagnostics/context.d.ts +3 -0
- package/dist/diagnostics/context.d.ts.map +1 -0
- package/dist/diagnostics/context.js +56 -0
- package/dist/diagnostics/detectors/framework.d.ts +5 -0
- package/dist/diagnostics/detectors/framework.d.ts.map +1 -0
- package/dist/diagnostics/detectors/framework.js +73 -0
- package/dist/diagnostics/detectors/package-manager.d.ts +3 -0
- package/dist/diagnostics/detectors/package-manager.d.ts.map +1 -0
- package/dist/diagnostics/detectors/package-manager.js +17 -0
- package/dist/diagnostics/detectors/sdk.d.ts +7 -0
- package/dist/diagnostics/detectors/sdk.d.ts.map +1 -0
- package/dist/diagnostics/detectors/sdk.js +48 -0
- package/dist/diagnostics/runner.d.ts +3 -0
- package/dist/diagnostics/runner.d.ts.map +1 -0
- package/dist/diagnostics/runner.js +44 -0
- package/dist/diagnostics/types.d.ts +70 -0
- package/dist/diagnostics/types.d.ts.map +1 -0
- package/dist/diagnostics/types.js +14 -0
- package/dist/diagnostics/utils/code-search.d.ts +10 -0
- package/dist/diagnostics/utils/code-search.d.ts.map +1 -0
- package/dist/diagnostics/utils/code-search.js +98 -0
- package/dist/diagnostics/utils/file-system.d.ts +7 -0
- package/dist/diagnostics/utils/file-system.d.ts.map +1 -0
- package/dist/diagnostics/utils/file-system.js +72 -0
- package/dist/diagnostics/utils/package-json.d.ts +12 -0
- package/dist/diagnostics/utils/package-json.d.ts.map +1 -0
- package/dist/diagnostics/utils/package-json.js +51 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/output/formatter.d.ts +25 -0
- package/dist/output/formatter.d.ts.map +1 -0
- package/dist/output/formatter.js +76 -0
- package/dist/output/mask.d.ts +2 -0
- package/dist/output/mask.d.ts.map +1 -0
- package/dist/output/mask.js +15 -0
- package/dist/output/prompts.d.ts +25 -0
- package/dist/output/prompts.d.ts.map +1 -0
- package/dist/output/prompts.js +86 -0
- package/dist/output/spinner.d.ts +6 -0
- package/dist/output/spinner.d.ts.map +1 -0
- package/dist/output/spinner.js +7 -0
- package/dist/output/table.d.ts +9 -0
- package/dist/output/table.d.ts.map +1 -0
- package/dist/output/table.js +21 -0
- package/dist/scaffolding/scaffolder.d.ts +3 -0
- package/dist/scaffolding/scaffolder.d.ts.map +1 -0
- package/dist/scaffolding/scaffolder.js +78 -0
- package/dist/scaffolding/strategies/expo-template.d.ts +16 -0
- package/dist/scaffolding/strategies/expo-template.d.ts.map +1 -0
- package/dist/scaffolding/strategies/expo-template.js +160 -0
- package/dist/scaffolding/strategies/index.d.ts +5 -0
- package/dist/scaffolding/strategies/index.d.ts.map +1 -0
- package/dist/scaffolding/strategies/index.js +25 -0
- package/dist/scaffolding/strategies/nextjs-template.d.ts +12 -0
- package/dist/scaffolding/strategies/nextjs-template.d.ts.map +1 -0
- package/dist/scaffolding/strategies/nextjs-template.js +122 -0
- package/dist/scaffolding/template-renderer.d.ts +11 -0
- package/dist/scaffolding/template-renderer.d.ts.map +1 -0
- package/dist/scaffolding/template-renderer.js +99 -0
- package/dist/scaffolding/types.d.ts +69 -0
- package/dist/scaffolding/types.d.ts.map +1 -0
- package/dist/scaffolding/types.js +21 -0
- package/dist/scaffolding/utils/detect-package-manager.d.ts +23 -0
- package/dist/scaffolding/utils/detect-package-manager.d.ts.map +1 -0
- package/dist/scaffolding/utils/detect-package-manager.js +57 -0
- package/dist/scaffolding/utils/fs.d.ts +11 -0
- package/dist/scaffolding/utils/fs.d.ts.map +1 -0
- package/dist/scaffolding/utils/fs.js +45 -0
- package/dist/scaffolding/utils/resolve-para-version.d.ts +7 -0
- package/dist/scaffolding/utils/resolve-para-version.d.ts.map +1 -0
- package/dist/scaffolding/utils/resolve-para-version.js +21 -0
- package/dist/validation/auth-methods.d.ts +14 -0
- package/dist/validation/auth-methods.d.ts.map +1 -0
- package/dist/validation/auth-methods.js +23 -0
- package/dist/validation/cidr.d.ts +11 -0
- package/dist/validation/cidr.d.ts.map +1 -0
- package/dist/validation/cidr.js +35 -0
- package/dist/validation/hex-color.d.ts +7 -0
- package/dist/validation/hex-color.d.ts.map +1 -0
- package/dist/validation/hex-color.js +10 -0
- package/dist/validation/index.d.ts +9 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +49 -0
- package/dist/validation/native-passkey.d.ts +31 -0
- package/dist/validation/native-passkey.d.ts.map +1 -0
- package/dist/validation/native-passkey.js +45 -0
- package/dist/validation/session-length.d.ts +18 -0
- package/dist/validation/session-length.d.ts.map +1 -0
- package/dist/validation/session-length.js +30 -0
- package/dist/validation/url.d.ts +26 -0
- package/dist/validation/url.d.ts.map +1 -0
- package/dist/validation/url.js +50 -0
- package/dist/validation/wallet-types.d.ts +14 -0
- package/dist/validation/wallet-types.d.ts.map +1 -0
- package/dist/validation/wallet-types.js +22 -0
- package/dist/validation/webhook.d.ts +4 -0
- package/dist/validation/webhook.d.ts.map +1 -0
- package/dist/validation/webhook.js +33 -0
- package/package.json +60 -0
- package/templates/expo/_env.example +3 -0
- package/templates/expo/_gitignore +48 -0
- package/templates/expo/_yarnrc.yml +1 -0
- package/templates/expo/app/(auth)/_layout.tsx +12 -0
- package/templates/expo/app/(auth)/index.tsx.template +86 -0
- package/templates/expo/app/(tabs)/_layout.tsx +16 -0
- package/templates/expo/app/(tabs)/index.tsx +112 -0
- package/templates/expo/app/(tabs)/send.tsx +111 -0
- package/templates/expo/app/_layout.tsx +17 -0
- package/templates/expo/app/index.tsx +22 -0
- package/templates/expo/app.json.template +32 -0
- package/templates/expo/assets/adaptive-icon.png +0 -0
- package/templates/expo/assets/favicon.png +0 -0
- package/templates/expo/assets/icon.png +0 -0
- package/templates/expo/assets/splash.png +0 -0
- package/templates/expo/babel.config.cjs +12 -0
- package/templates/expo/components/features/AuthForm.tsx.template +138 -0
- package/templates/expo/components/features/OAuthButtons.tsx.template +27 -0
- package/templates/expo/components/features/index.ts.template +4 -0
- package/templates/expo/components/ui/Button.tsx +58 -0
- package/templates/expo/components/ui/Card.tsx +11 -0
- package/templates/expo/components/ui/Divider.tsx +19 -0
- package/templates/expo/components/ui/Input.tsx +23 -0
- package/templates/expo/components/ui/WalletCard.tsx +44 -0
- package/templates/expo/components/ui/index.ts +5 -0
- package/templates/expo/eslint.config.cjs +15 -0
- package/templates/expo/global.css +3 -0
- package/templates/expo/hooks/useOneClickLogin.ts.template +161 -0
- package/templates/expo/hooks/useViemClient.ts +118 -0
- package/templates/expo/hooks/useWallets.ts +52 -0
- package/templates/expo/index.js +2 -0
- package/templates/expo/lib/auth.ts +54 -0
- package/templates/expo/lib/constants.ts.template +2 -0
- package/templates/expo/lib/para.ts +14 -0
- package/templates/expo/metro.config.cjs +14 -0
- package/templates/expo/nativewind-env.d.ts +2 -0
- package/templates/expo/prettier.config.cjs +10 -0
- package/templates/expo/providers/ParaProvider.tsx +140 -0
- package/templates/expo/tailwind.config.cjs +23 -0
- package/templates/expo/tsconfig.json +11 -0
- package/templates/expo/types/index.ts +28 -0
- package/templates/nextjs/README.md +69 -0
- package/templates/nextjs/_env.example +8 -0
- package/templates/nextjs/_gitignore +36 -0
- package/templates/nextjs/_yarnrc.yml +1 -0
- package/templates/nextjs/eslint.config.mjs +10 -0
- package/templates/nextjs/next.config.ts +5 -0
- package/templates/nextjs/postcss.config.mjs +7 -0
- package/templates/nextjs/public/para.svg +3 -0
- package/templates/nextjs/src/app/layout.tsx +30 -0
- package/templates/nextjs/src/app/page.tsx +40 -0
- package/templates/nextjs/src/components/ParaProvider.tsx +116 -0
- package/templates/nextjs/src/components/layout/Header.tsx +44 -0
- package/templates/nextjs/src/components/ui/ConnectCard.tsx +24 -0
- package/templates/nextjs/src/components/ui/SignMessage.tsx +53 -0
- package/templates/nextjs/src/components/ui/WalletInfo.tsx +22 -0
- package/templates/nextjs/src/hooks/useSignHelloWorld.ts +23 -0
- package/templates/nextjs/src/styles/globals.css +1 -0
- package/templates/nextjs/tsconfig.json +27 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { defineCheck } from "../types.js";
|
|
2
|
+
import { hasDependency, getInstallCommand } from "../utils/package-json.js";
|
|
3
|
+
const EVM_DEPENDENCIES = ["viem", "wagmi"];
|
|
4
|
+
const SOLANA_DEPENDENCIES = ["@solana/web3.js", "@solana/wallet-adapter-react"];
|
|
5
|
+
const COSMOS_DEPENDENCIES = ["@cosmjs/stargate", "graz"];
|
|
6
|
+
const WALLET_CONNECTOR_PATTERNS = [
|
|
7
|
+
"@getpara/evm-wallet-connectors",
|
|
8
|
+
"@getpara/solana-wallet-connectors",
|
|
9
|
+
"@getpara/cosmos-wallet-connectors",
|
|
10
|
+
"@getpara/bitcoin-wallet-connectors",
|
|
11
|
+
"@getpara/graz-wallet-connectors",
|
|
12
|
+
"@getpara/rainbowkit-wallet-connectors"
|
|
13
|
+
];
|
|
14
|
+
const chainDependenciesCheck = defineCheck({
|
|
15
|
+
metadata: {
|
|
16
|
+
id: "chain-dependencies",
|
|
17
|
+
name: "Chain Dependencies",
|
|
18
|
+
description: "Checks if required chain dependencies are installed",
|
|
19
|
+
category: "dependencies",
|
|
20
|
+
severity: "error",
|
|
21
|
+
enabled: true
|
|
22
|
+
},
|
|
23
|
+
shouldRun(context) {
|
|
24
|
+
return context.sdkType !== "none" && context.packageJson !== null;
|
|
25
|
+
},
|
|
26
|
+
async run(context) {
|
|
27
|
+
if (!context.packageJson) {
|
|
28
|
+
return [];
|
|
29
|
+
}
|
|
30
|
+
const results = [];
|
|
31
|
+
if (context.sdkType === "@getpara/react-sdk") {
|
|
32
|
+
results.push(...checkReactSDKDependencies(context, this.metadata.id));
|
|
33
|
+
} else if (context.sdkType === "@getpara/react-sdk-lite") {
|
|
34
|
+
results.push(...checkReactSDKLiteDependencies(context, this.metadata.id));
|
|
35
|
+
}
|
|
36
|
+
return results;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
function checkReactSDKDependencies(context, checkId) {
|
|
40
|
+
const results = [];
|
|
41
|
+
const packageJson = context.packageJson;
|
|
42
|
+
const install = getInstallCommand(context.packageManager);
|
|
43
|
+
const hasEvm = EVM_DEPENDENCIES.some((dep) => hasDependency(packageJson, dep));
|
|
44
|
+
if (!hasEvm) {
|
|
45
|
+
results.push({
|
|
46
|
+
checkId,
|
|
47
|
+
passed: false,
|
|
48
|
+
severity: "warning",
|
|
49
|
+
message: "EVM chain dependencies not installed",
|
|
50
|
+
details: `Missing: ${EVM_DEPENDENCIES.join(", ")}`,
|
|
51
|
+
recommendation: `Install EVM dependencies: ${install} ${EVM_DEPENDENCIES.join(" ")}`
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
const hasSolana = SOLANA_DEPENDENCIES.some((dep) => hasDependency(packageJson, dep));
|
|
55
|
+
if (!hasSolana) {
|
|
56
|
+
results.push({
|
|
57
|
+
checkId,
|
|
58
|
+
passed: false,
|
|
59
|
+
severity: "warning",
|
|
60
|
+
message: "Solana chain dependencies not installed",
|
|
61
|
+
details: `Missing: ${SOLANA_DEPENDENCIES.join(", ")}`,
|
|
62
|
+
recommendation: `Install Solana dependencies: ${install} ${SOLANA_DEPENDENCIES.join(" ")}`
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
const hasCosmos = COSMOS_DEPENDENCIES.some((dep) => hasDependency(packageJson, dep));
|
|
66
|
+
if (!hasCosmos) {
|
|
67
|
+
results.push({
|
|
68
|
+
checkId,
|
|
69
|
+
passed: false,
|
|
70
|
+
severity: "warning",
|
|
71
|
+
message: "Cosmos chain dependencies not installed",
|
|
72
|
+
details: `Missing: ${COSMOS_DEPENDENCIES.join(", ")}`,
|
|
73
|
+
recommendation: `Install Cosmos dependencies: ${install} ${COSMOS_DEPENDENCIES.join(" ")}`
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
if (hasEvm && hasSolana && hasCosmos) {
|
|
77
|
+
results.push({
|
|
78
|
+
checkId,
|
|
79
|
+
passed: true,
|
|
80
|
+
severity: "error",
|
|
81
|
+
message: "All chain dependencies installed"
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return results;
|
|
85
|
+
}
|
|
86
|
+
function checkReactSDKLiteDependencies(context, checkId) {
|
|
87
|
+
const results = [];
|
|
88
|
+
const packageJson = context.packageJson;
|
|
89
|
+
const installedConnectors = WALLET_CONNECTOR_PATTERNS.filter((connector) => hasDependency(packageJson, connector));
|
|
90
|
+
if (installedConnectors.length === 0) {
|
|
91
|
+
results.push({
|
|
92
|
+
checkId,
|
|
93
|
+
passed: false,
|
|
94
|
+
severity: "error",
|
|
95
|
+
message: "No wallet connector packages installed",
|
|
96
|
+
details: `react-sdk-lite requires at least one @getpara/*-wallet-connectors package`,
|
|
97
|
+
recommendation: `Install a wallet connector, e.g.: npm install @getpara/evm-wallet-connectors`
|
|
98
|
+
});
|
|
99
|
+
} else {
|
|
100
|
+
results.push({
|
|
101
|
+
checkId,
|
|
102
|
+
passed: true,
|
|
103
|
+
severity: "error",
|
|
104
|
+
message: `Wallet connector(s) installed: ${installedConnectors.map((c) => c.replace("@getpara/", "")).join(", ")}`
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
const postinstallScript = packageJson.scripts?.postinstall || "";
|
|
108
|
+
const hasSetupPara = postinstallScript.includes("setup-para");
|
|
109
|
+
if (!hasSetupPara) {
|
|
110
|
+
results.push({
|
|
111
|
+
checkId,
|
|
112
|
+
passed: false,
|
|
113
|
+
severity: "error",
|
|
114
|
+
message: "Missing setup-para in postinstall script",
|
|
115
|
+
details: "react-sdk-lite requires setup-para to stub unused chain packages",
|
|
116
|
+
recommendation: 'Add to package.json scripts: "postinstall": "npx setup-para"'
|
|
117
|
+
});
|
|
118
|
+
} else {
|
|
119
|
+
results.push({
|
|
120
|
+
checkId,
|
|
121
|
+
passed: true,
|
|
122
|
+
severity: "error",
|
|
123
|
+
message: "setup-para configured in postinstall script"
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
return results;
|
|
127
|
+
}
|
|
128
|
+
export {
|
|
129
|
+
chainDependenciesCheck
|
|
130
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css-import.d.ts","sourceRoot":"","sources":["../../../src/diagnostics/checks/css-import.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,cAAc,6BAwDzB,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { defineCheck } from "../types.js";
|
|
2
|
+
import { getCSSImportPath } from "../detectors/sdk.js";
|
|
3
|
+
import { findImportInFiles } from "../utils/code-search.js";
|
|
4
|
+
const cssImportCheck = defineCheck({
|
|
5
|
+
metadata: {
|
|
6
|
+
id: "css-import",
|
|
7
|
+
name: "CSS Styles Import",
|
|
8
|
+
description: "Checks if Para SDK CSS styles are imported",
|
|
9
|
+
category: "setup",
|
|
10
|
+
severity: "error",
|
|
11
|
+
enabled: true
|
|
12
|
+
},
|
|
13
|
+
shouldRun(context) {
|
|
14
|
+
return context.sdkType === "@getpara/react-sdk" || context.sdkType === "@getpara/react-sdk-lite";
|
|
15
|
+
},
|
|
16
|
+
async run(context) {
|
|
17
|
+
const cssImportPath = getCSSImportPath(context.sdkType);
|
|
18
|
+
if (!cssImportPath) {
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
21
|
+
const found = await findImportInFiles(context.files, cssImportPath, context.shouldIgnoreFile);
|
|
22
|
+
if (found) {
|
|
23
|
+
return [
|
|
24
|
+
{
|
|
25
|
+
checkId: this.metadata.id,
|
|
26
|
+
passed: true,
|
|
27
|
+
severity: this.metadata.severity,
|
|
28
|
+
message: "Para SDK styles imported correctly",
|
|
29
|
+
location: found
|
|
30
|
+
}
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
const entryPointHints = [];
|
|
34
|
+
if (context.framework === "nextjs") {
|
|
35
|
+
entryPointHints.push("app/layout.tsx", "pages/_app.tsx");
|
|
36
|
+
} else if (context.framework === "vite" || context.framework === "create-react-app") {
|
|
37
|
+
entryPointHints.push("src/main.tsx", "src/index.tsx", "src/App.tsx");
|
|
38
|
+
} else if (context.framework === "vue") {
|
|
39
|
+
entryPointHints.push("src/main.ts", "src/App.vue");
|
|
40
|
+
} else if (context.framework === "svelte") {
|
|
41
|
+
entryPointHints.push("src/main.ts", "src/App.svelte");
|
|
42
|
+
}
|
|
43
|
+
return [
|
|
44
|
+
{
|
|
45
|
+
checkId: this.metadata.id,
|
|
46
|
+
passed: false,
|
|
47
|
+
severity: this.metadata.severity,
|
|
48
|
+
message: "Para SDK styles not imported",
|
|
49
|
+
details: `Missing import in entry point (${entryPointHints.join(" or ")})`,
|
|
50
|
+
recommendation: `Add: import "${cssImportPath}"`
|
|
51
|
+
}
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
export {
|
|
56
|
+
cssImportCheck
|
|
57
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deprecated-packages.d.ts","sourceRoot":"","sources":["../../../src/diagnostics/checks/deprecated-packages.ts"],"names":[],"mappings":"AAkCA,eAAO,MAAM,uBAAuB,6BAyElC,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { defineCheck } from "../types.js";
|
|
2
|
+
import { hasDependency, getAllDependencies, getInstallCommand, getRemoveCommand } from "../utils/package-json.js";
|
|
3
|
+
const DEPRECATED_PACKAGES = [
|
|
4
|
+
{
|
|
5
|
+
name: "@getpara/graz",
|
|
6
|
+
reason: "@getpara/graz is deprecated \u2014 the official graz package now has native Para support",
|
|
7
|
+
replacement: "graz"
|
|
8
|
+
}
|
|
9
|
+
];
|
|
10
|
+
const USECAPSULE_MIGRATION = {
|
|
11
|
+
"@usecapsule/react-sdk": "@getpara/react-sdk",
|
|
12
|
+
"@usecapsule/web-sdk": "@getpara/web-sdk",
|
|
13
|
+
"@usecapsule/core-sdk": "@getpara/core-sdk",
|
|
14
|
+
"@usecapsule/server-sdk": "@getpara/server-sdk",
|
|
15
|
+
"@usecapsule/react-sdk-lite": "@getpara/react-sdk-lite",
|
|
16
|
+
"@usecapsule/react-native-wallet": "@getpara/react-native-wallet",
|
|
17
|
+
"@usecapsule/evm-wallet-connectors": "@getpara/evm-wallet-connectors",
|
|
18
|
+
"@usecapsule/solana-wallet-connectors": "@getpara/solana-wallet-connectors",
|
|
19
|
+
"@usecapsule/cosmos-wallet-connectors": "@getpara/cosmos-wallet-connectors",
|
|
20
|
+
"@usecapsule/rainbowkit-wallet": "@getpara/rainbowkit-wallet",
|
|
21
|
+
"@usecapsule/wagmi-v2-integration": "@getpara/wagmi-v2-integration",
|
|
22
|
+
"@usecapsule/viem-v2-integration": "@getpara/viem-v2-integration",
|
|
23
|
+
"@usecapsule/ethers-v6-integration": "@getpara/ethers-v6-integration",
|
|
24
|
+
"@usecapsule/cosmjs-v0-integration": "@getpara/cosmjs-v0-integration"
|
|
25
|
+
};
|
|
26
|
+
const deprecatedPackagesCheck = defineCheck({
|
|
27
|
+
metadata: {
|
|
28
|
+
id: "deprecated-packages",
|
|
29
|
+
name: "Deprecated Packages",
|
|
30
|
+
description: "Checks for deprecated @getpara/* packages that should be removed",
|
|
31
|
+
category: "dependencies",
|
|
32
|
+
severity: "error",
|
|
33
|
+
enabled: true
|
|
34
|
+
},
|
|
35
|
+
shouldRun(context) {
|
|
36
|
+
return context.packageJson !== null;
|
|
37
|
+
},
|
|
38
|
+
async run(context) {
|
|
39
|
+
if (!context.packageJson) {
|
|
40
|
+
return [];
|
|
41
|
+
}
|
|
42
|
+
const results = [];
|
|
43
|
+
const install = getInstallCommand(context.packageManager);
|
|
44
|
+
const remove = getRemoveCommand(context.packageManager);
|
|
45
|
+
for (const deprecated of DEPRECATED_PACKAGES) {
|
|
46
|
+
if (hasDependency(context.packageJson, deprecated.name)) {
|
|
47
|
+
results.push({
|
|
48
|
+
checkId: this.metadata.id,
|
|
49
|
+
passed: false,
|
|
50
|
+
severity: this.metadata.severity,
|
|
51
|
+
message: `Deprecated package found: ${deprecated.name}`,
|
|
52
|
+
details: deprecated.reason,
|
|
53
|
+
recommendation: `Replace with: ${install} ${deprecated.replacement}`
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const allDeps = getAllDependencies(context.packageJson);
|
|
58
|
+
for (const depName of Object.keys(allDeps)) {
|
|
59
|
+
const replacement = USECAPSULE_MIGRATION[depName];
|
|
60
|
+
if (replacement) {
|
|
61
|
+
results.push({
|
|
62
|
+
checkId: this.metadata.id,
|
|
63
|
+
passed: false,
|
|
64
|
+
severity: this.metadata.severity,
|
|
65
|
+
message: `Legacy package found: ${depName}`,
|
|
66
|
+
details: "@usecapsule/* packages have been renamed to @getpara/*",
|
|
67
|
+
recommendation: `Migrate: ${install} ${replacement} && ${remove} ${depName}`
|
|
68
|
+
});
|
|
69
|
+
} else if (depName.startsWith("@usecapsule/")) {
|
|
70
|
+
results.push({
|
|
71
|
+
checkId: this.metadata.id,
|
|
72
|
+
passed: false,
|
|
73
|
+
severity: "warning",
|
|
74
|
+
message: `Legacy package found: ${depName}`,
|
|
75
|
+
details: "@usecapsule/* packages have been renamed to @getpara/*",
|
|
76
|
+
recommendation: `Check docs.getpara.com for the @getpara/* equivalent`
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (results.length === 0) {
|
|
81
|
+
results.push({
|
|
82
|
+
checkId: this.metadata.id,
|
|
83
|
+
passed: true,
|
|
84
|
+
severity: this.metadata.severity,
|
|
85
|
+
message: "No deprecated packages found"
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
return results;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
export {
|
|
92
|
+
deprecatedPackagesCheck
|
|
93
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-api-key.d.ts","sourceRoot":"","sources":["../../../src/diagnostics/checks/env-api-key.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc,6BA4EzB,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { defineCheck } from "../types.js";
|
|
3
|
+
import { getEnvVarPrefix } from "../detectors/framework.js";
|
|
4
|
+
import { readFile, findEnvFiles } from "../utils/file-system.js";
|
|
5
|
+
const envApiKeyCheck = defineCheck({
|
|
6
|
+
metadata: {
|
|
7
|
+
id: "env-api-key",
|
|
8
|
+
name: "API Key Configuration",
|
|
9
|
+
description: "Checks if Para API key is defined in environment files",
|
|
10
|
+
category: "configuration",
|
|
11
|
+
severity: "error",
|
|
12
|
+
enabled: true
|
|
13
|
+
},
|
|
14
|
+
shouldRun(context) {
|
|
15
|
+
return context.sdkType !== "none";
|
|
16
|
+
},
|
|
17
|
+
async run(context) {
|
|
18
|
+
const prefix = getEnvVarPrefix(context.framework);
|
|
19
|
+
const expectedVar = `${prefix}PARA_API_KEY`;
|
|
20
|
+
const envFiles = await findEnvFiles(context.projectRoot);
|
|
21
|
+
let foundIn = null;
|
|
22
|
+
let hasPlaceholder = false;
|
|
23
|
+
for (const file of envFiles) {
|
|
24
|
+
const content = await readFile(file);
|
|
25
|
+
if (!content) continue;
|
|
26
|
+
const lines = content.split("\n");
|
|
27
|
+
for (const line of lines) {
|
|
28
|
+
if (line.startsWith(expectedVar + "=")) {
|
|
29
|
+
foundIn = path.basename(file);
|
|
30
|
+
const value = line.substring(line.indexOf("=") + 1).trim();
|
|
31
|
+
if (value === "" || value === "your_api_key_here" || value === "your-api-key-here" || value === "YOUR_API_KEY") {
|
|
32
|
+
hasPlaceholder = true;
|
|
33
|
+
}
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (foundIn) break;
|
|
38
|
+
}
|
|
39
|
+
if (foundIn && !hasPlaceholder) {
|
|
40
|
+
return [
|
|
41
|
+
{
|
|
42
|
+
checkId: this.metadata.id,
|
|
43
|
+
passed: true,
|
|
44
|
+
severity: this.metadata.severity,
|
|
45
|
+
message: `API key ${expectedVar} found in ${foundIn}`
|
|
46
|
+
}
|
|
47
|
+
];
|
|
48
|
+
}
|
|
49
|
+
if (foundIn && hasPlaceholder) {
|
|
50
|
+
return [
|
|
51
|
+
{
|
|
52
|
+
checkId: this.metadata.id,
|
|
53
|
+
passed: false,
|
|
54
|
+
severity: "warning",
|
|
55
|
+
message: `API key ${expectedVar} found but has placeholder value`,
|
|
56
|
+
details: `Replace the placeholder in ${foundIn} with your actual Para API key`,
|
|
57
|
+
recommendation: "Get your API key from the Para dashboard and update the environment file"
|
|
58
|
+
}
|
|
59
|
+
];
|
|
60
|
+
}
|
|
61
|
+
return [
|
|
62
|
+
{
|
|
63
|
+
checkId: this.metadata.id,
|
|
64
|
+
passed: false,
|
|
65
|
+
severity: this.metadata.severity,
|
|
66
|
+
message: `API key ${expectedVar} not found in environment files`,
|
|
67
|
+
details: `Add ${expectedVar}=your_api_key to .env.local or similar`,
|
|
68
|
+
recommendation: `Create .env.local and add: ${expectedVar}=your_api_key_here`
|
|
69
|
+
}
|
|
70
|
+
];
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
export {
|
|
74
|
+
envApiKeyCheck
|
|
75
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-var-prefix.d.ts","sourceRoot":"","sources":["../../../src/diagnostics/checks/env-var-prefix.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,iBAAiB,6BAsD5B,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { defineCheck } from "../types.js";
|
|
2
|
+
import { getEnvVarPrefix, getEnvAccessPattern } from "../detectors/framework.js";
|
|
3
|
+
import { findPatternInFiles } from "../utils/code-search.js";
|
|
4
|
+
const envVarPrefixCheck = defineCheck({
|
|
5
|
+
metadata: {
|
|
6
|
+
id: "env-var-prefix",
|
|
7
|
+
name: "Environment Variable Prefix",
|
|
8
|
+
description: "Checks if environment variables use the correct prefix for the framework",
|
|
9
|
+
category: "configuration",
|
|
10
|
+
severity: "warning",
|
|
11
|
+
enabled: true
|
|
12
|
+
},
|
|
13
|
+
shouldRun(context) {
|
|
14
|
+
return context.sdkType !== "none" && context.framework !== "unknown";
|
|
15
|
+
},
|
|
16
|
+
async run(context) {
|
|
17
|
+
const correctPrefix = getEnvVarPrefix(context.framework);
|
|
18
|
+
const correctAccess = getEnvAccessPattern(context.framework);
|
|
19
|
+
const wrongPrefixes = ["NEXT_PUBLIC_", "VITE_", "REACT_APP_"].filter((p) => p !== correctPrefix);
|
|
20
|
+
const results = [];
|
|
21
|
+
for (const wrongPrefix of wrongPrefixes) {
|
|
22
|
+
const pattern = new RegExp(`${wrongPrefix}PARA_API_KEY`);
|
|
23
|
+
const locations = await findPatternInFiles(context.files, pattern, context.shouldIgnoreFile);
|
|
24
|
+
if (locations.length > 0) {
|
|
25
|
+
results.push({
|
|
26
|
+
checkId: this.metadata.id,
|
|
27
|
+
passed: false,
|
|
28
|
+
severity: this.metadata.severity,
|
|
29
|
+
message: `Found ${wrongPrefix}PARA_API_KEY but framework expects ${correctPrefix}PARA_API_KEY`,
|
|
30
|
+
location: locations[0],
|
|
31
|
+
recommendation: `Use ${correctAccess}.${correctPrefix}PARA_API_KEY for ${context.framework}`
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (results.length === 0) {
|
|
36
|
+
const correctPattern = new RegExp(`${correctPrefix}PARA_API_KEY`);
|
|
37
|
+
const locations = await findPatternInFiles(context.files, correctPattern, context.shouldIgnoreFile);
|
|
38
|
+
if (locations.length > 0) {
|
|
39
|
+
results.push({
|
|
40
|
+
checkId: this.metadata.id,
|
|
41
|
+
passed: true,
|
|
42
|
+
severity: this.metadata.severity,
|
|
43
|
+
message: `Environment variable prefix ${correctPrefix} is correct for ${context.framework}`
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return results;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
export {
|
|
51
|
+
envVarPrefixCheck
|
|
52
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Check } from '../types.js';
|
|
2
|
+
import { envApiKeyCheck } from './env-api-key.js';
|
|
3
|
+
import { cssImportCheck } from './css-import.js';
|
|
4
|
+
import { paraProviderCheck } from './para-provider.js';
|
|
5
|
+
import { queryClientCheck } from './query-client.js';
|
|
6
|
+
import { versionConsistencyCheck } from './version-consistency.js';
|
|
7
|
+
import { useClientDirectiveCheck } from './use-client-directive.js';
|
|
8
|
+
import { envVarPrefixCheck } from './env-var-prefix.js';
|
|
9
|
+
import { chainDependenciesCheck } from './chain-dependencies.js';
|
|
10
|
+
import { deprecatedPackagesCheck } from './deprecated-packages.js';
|
|
11
|
+
export declare const allChecks: Check[];
|
|
12
|
+
export { envApiKeyCheck, cssImportCheck, paraProviderCheck, queryClientCheck, versionConsistencyCheck, useClientDirectiveCheck, envVarPrefixCheck, chainDependenciesCheck, deprecatedPackagesCheck, };
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/diagnostics/checks/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAEnE,eAAO,MAAM,SAAS,EAAE,KAAK,EAU5B,CAAC;AAEF,OAAO,EACL,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,uBAAuB,EACvB,uBAAuB,EACvB,iBAAiB,EACjB,sBAAsB,EACtB,uBAAuB,GACxB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { envApiKeyCheck } from "./env-api-key.js";
|
|
2
|
+
import { cssImportCheck } from "./css-import.js";
|
|
3
|
+
import { paraProviderCheck } from "./para-provider.js";
|
|
4
|
+
import { queryClientCheck } from "./query-client.js";
|
|
5
|
+
import { versionConsistencyCheck } from "./version-consistency.js";
|
|
6
|
+
import { useClientDirectiveCheck } from "./use-client-directive.js";
|
|
7
|
+
import { envVarPrefixCheck } from "./env-var-prefix.js";
|
|
8
|
+
import { chainDependenciesCheck } from "./chain-dependencies.js";
|
|
9
|
+
import { deprecatedPackagesCheck } from "./deprecated-packages.js";
|
|
10
|
+
const allChecks = [
|
|
11
|
+
envApiKeyCheck,
|
|
12
|
+
cssImportCheck,
|
|
13
|
+
paraProviderCheck,
|
|
14
|
+
queryClientCheck,
|
|
15
|
+
versionConsistencyCheck,
|
|
16
|
+
useClientDirectiveCheck,
|
|
17
|
+
envVarPrefixCheck,
|
|
18
|
+
chainDependenciesCheck,
|
|
19
|
+
deprecatedPackagesCheck
|
|
20
|
+
];
|
|
21
|
+
export {
|
|
22
|
+
allChecks,
|
|
23
|
+
chainDependenciesCheck,
|
|
24
|
+
cssImportCheck,
|
|
25
|
+
deprecatedPackagesCheck,
|
|
26
|
+
envApiKeyCheck,
|
|
27
|
+
envVarPrefixCheck,
|
|
28
|
+
paraProviderCheck,
|
|
29
|
+
queryClientCheck,
|
|
30
|
+
useClientDirectiveCheck,
|
|
31
|
+
versionConsistencyCheck
|
|
32
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"para-provider.d.ts","sourceRoot":"","sources":["../../../src/diagnostics/checks/para-provider.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,iBAAiB,6BA6C5B,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { defineCheck } from "../types.js";
|
|
2
|
+
import { findPatternInFiles } from "../utils/code-search.js";
|
|
3
|
+
const paraProviderCheck = defineCheck({
|
|
4
|
+
metadata: {
|
|
5
|
+
id: "para-provider",
|
|
6
|
+
name: "ParaProvider Setup",
|
|
7
|
+
description: "Checks if ParaProvider is imported from Para SDK",
|
|
8
|
+
category: "setup",
|
|
9
|
+
severity: "error",
|
|
10
|
+
enabled: true
|
|
11
|
+
},
|
|
12
|
+
shouldRun(context) {
|
|
13
|
+
return context.sdkType === "@getpara/react-sdk" || context.sdkType === "@getpara/react-sdk-lite";
|
|
14
|
+
},
|
|
15
|
+
async run(context) {
|
|
16
|
+
const importPattern = /import\s*\{[\s\S]*?\bParaProvider\b[\s\S]*?\}\s*from\s*['"]@getpara\/(react-sdk|react-sdk-lite)['"]/;
|
|
17
|
+
const importLocations = await findPatternInFiles(context.files, importPattern, context.shouldIgnoreFile);
|
|
18
|
+
if (importLocations.length > 0) {
|
|
19
|
+
return [
|
|
20
|
+
{
|
|
21
|
+
checkId: this.metadata.id,
|
|
22
|
+
passed: true,
|
|
23
|
+
severity: this.metadata.severity,
|
|
24
|
+
message: "ParaProvider is imported",
|
|
25
|
+
location: importLocations[0]
|
|
26
|
+
}
|
|
27
|
+
];
|
|
28
|
+
}
|
|
29
|
+
return [
|
|
30
|
+
{
|
|
31
|
+
checkId: this.metadata.id,
|
|
32
|
+
passed: false,
|
|
33
|
+
severity: this.metadata.severity,
|
|
34
|
+
message: "ParaProvider not imported",
|
|
35
|
+
recommendation: `Import ParaProvider from ${context.sdkType} and wrap your app with it`
|
|
36
|
+
}
|
|
37
|
+
];
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
export {
|
|
41
|
+
paraProviderCheck
|
|
42
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-client.d.ts","sourceRoot":"","sources":["../../../src/diagnostics/checks/query-client.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB,6BA0D3B,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { defineCheck } from "../types.js";
|
|
2
|
+
import { findPatternInFiles } from "../utils/code-search.js";
|
|
3
|
+
import { hasDependency, getInstallCommand } from "../utils/package-json.js";
|
|
4
|
+
const queryClientCheck = defineCheck({
|
|
5
|
+
metadata: {
|
|
6
|
+
id: "query-client",
|
|
7
|
+
name: "QueryClientProvider Setup",
|
|
8
|
+
description: "Checks if QueryClientProvider wraps ParaProvider",
|
|
9
|
+
category: "setup",
|
|
10
|
+
severity: "error",
|
|
11
|
+
enabled: true
|
|
12
|
+
},
|
|
13
|
+
shouldRun(context) {
|
|
14
|
+
return context.sdkType === "@getpara/react-sdk" || context.sdkType === "@getpara/react-sdk-lite";
|
|
15
|
+
},
|
|
16
|
+
async run(context) {
|
|
17
|
+
if (!context.packageJson) {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
const hasReactQuery = hasDependency(context.packageJson, "@tanstack/react-query");
|
|
21
|
+
if (!hasReactQuery) {
|
|
22
|
+
return [
|
|
23
|
+
{
|
|
24
|
+
checkId: this.metadata.id,
|
|
25
|
+
passed: false,
|
|
26
|
+
severity: this.metadata.severity,
|
|
27
|
+
message: "@tanstack/react-query is not installed",
|
|
28
|
+
recommendation: `Install: ${getInstallCommand(context.packageManager)} @tanstack/react-query`
|
|
29
|
+
}
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
const queryClientPattern = /QueryClientProvider/;
|
|
33
|
+
const locations = await findPatternInFiles(context.files, queryClientPattern, context.shouldIgnoreFile);
|
|
34
|
+
if (locations.length > 0) {
|
|
35
|
+
return [
|
|
36
|
+
{
|
|
37
|
+
checkId: this.metadata.id,
|
|
38
|
+
passed: true,
|
|
39
|
+
severity: this.metadata.severity,
|
|
40
|
+
message: "QueryClientProvider is configured",
|
|
41
|
+
location: locations[0]
|
|
42
|
+
}
|
|
43
|
+
];
|
|
44
|
+
}
|
|
45
|
+
return [
|
|
46
|
+
{
|
|
47
|
+
checkId: this.metadata.id,
|
|
48
|
+
passed: false,
|
|
49
|
+
severity: this.metadata.severity,
|
|
50
|
+
message: "QueryClientProvider not found",
|
|
51
|
+
recommendation: "Wrap ParaProvider with QueryClientProvider from @tanstack/react-query"
|
|
52
|
+
}
|
|
53
|
+
];
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
export {
|
|
57
|
+
queryClientCheck
|
|
58
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-client-directive.d.ts","sourceRoot":"","sources":["../../../src/diagnostics/checks/use-client-directive.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,uBAAuB,6BAwElC,CAAC"}
|