@getpara/create-para-app 0.6.0 → 2.7.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.
Files changed (142) hide show
  1. package/README.md +71 -0
  2. package/dist/cli.d.ts +2 -0
  3. package/dist/cli.d.ts.map +1 -0
  4. package/dist/cli.js +306 -0
  5. package/dist/cli.js.map +1 -0
  6. package/dist/index.d.ts +3 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +7 -48
  9. package/dist/index.js.map +1 -0
  10. package/dist/package-builder.d.ts +13 -0
  11. package/dist/package-builder.d.ts.map +1 -0
  12. package/dist/package-builder.js +89 -0
  13. package/dist/package-builder.js.map +1 -0
  14. package/dist/post-scaffold.d.ts +3 -0
  15. package/dist/post-scaffold.d.ts.map +1 -0
  16. package/dist/post-scaffold.js +64 -0
  17. package/dist/post-scaffold.js.map +1 -0
  18. package/dist/prompt-orchestrator.d.ts +3 -0
  19. package/dist/prompt-orchestrator.d.ts.map +1 -0
  20. package/dist/prompt-orchestrator.js +198 -0
  21. package/dist/prompt-orchestrator.js.map +1 -0
  22. package/dist/scaffolder.d.ts +3 -0
  23. package/dist/scaffolder.d.ts.map +1 -0
  24. package/dist/scaffolder.js +82 -0
  25. package/dist/scaffolder.js.map +1 -0
  26. package/dist/template-registry.d.ts +12 -0
  27. package/dist/template-registry.d.ts.map +1 -0
  28. package/dist/template-registry.js +29 -0
  29. package/dist/template-registry.js.map +1 -0
  30. package/dist/template-renderer.d.ts +11 -0
  31. package/dist/template-renderer.d.ts.map +1 -0
  32. package/dist/template-renderer.js +133 -0
  33. package/dist/template-renderer.js.map +1 -0
  34. package/dist/template-strategies/expo-template.d.ts +18 -0
  35. package/dist/template-strategies/expo-template.d.ts.map +1 -0
  36. package/dist/template-strategies/expo-template.js +173 -0
  37. package/dist/template-strategies/expo-template.js.map +1 -0
  38. package/dist/template-strategies/index.d.ts +4 -0
  39. package/dist/template-strategies/index.d.ts.map +1 -0
  40. package/dist/template-strategies/index.js +3 -0
  41. package/dist/template-strategies/index.js.map +1 -0
  42. package/dist/template-strategies/nextjs-template.d.ts +12 -0
  43. package/dist/template-strategies/nextjs-template.d.ts.map +1 -0
  44. package/dist/template-strategies/nextjs-template.js +123 -0
  45. package/dist/template-strategies/nextjs-template.js.map +1 -0
  46. package/dist/types.d.ts +67 -0
  47. package/dist/types.d.ts.map +1 -0
  48. package/dist/types.js +16 -0
  49. package/dist/types.js.map +1 -0
  50. package/dist/utils/fs.d.ts +11 -0
  51. package/dist/utils/fs.d.ts.map +1 -0
  52. package/dist/utils/fs.js +38 -0
  53. package/dist/utils/fs.js.map +1 -0
  54. package/dist/utils/logger.d.ts +10 -0
  55. package/dist/utils/logger.d.ts.map +1 -0
  56. package/dist/utils/logger.js +25 -19
  57. package/dist/utils/logger.js.map +1 -0
  58. package/package.json +35 -30
  59. package/templates/expo/_env.example +3 -0
  60. package/templates/expo/_gitignore +48 -0
  61. package/templates/expo/_yarnrc.yml +1 -0
  62. package/templates/expo/app/(auth)/_layout.tsx +12 -0
  63. package/templates/expo/app/(auth)/index.tsx.template +86 -0
  64. package/templates/expo/app/(tabs)/_layout.tsx +16 -0
  65. package/templates/expo/app/(tabs)/index.tsx +112 -0
  66. package/templates/expo/app/(tabs)/send.tsx +111 -0
  67. package/templates/expo/app/_layout.tsx +17 -0
  68. package/templates/expo/app/index.tsx +22 -0
  69. package/templates/expo/app.json.template +32 -0
  70. package/templates/expo/assets/adaptive-icon.png +0 -0
  71. package/templates/expo/assets/favicon.png +0 -0
  72. package/templates/expo/assets/icon.png +0 -0
  73. package/templates/expo/assets/splash.png +0 -0
  74. package/templates/expo/babel.config.cjs +12 -0
  75. package/templates/expo/components/features/AuthForm.tsx.template +138 -0
  76. package/templates/expo/components/features/OAuthButtons.tsx.template +27 -0
  77. package/templates/expo/components/features/index.ts.template +4 -0
  78. package/templates/expo/components/ui/Button.tsx +58 -0
  79. package/templates/expo/components/ui/Card.tsx +11 -0
  80. package/templates/expo/components/ui/Divider.tsx +19 -0
  81. package/templates/expo/components/ui/Input.tsx +23 -0
  82. package/templates/expo/components/ui/WalletCard.tsx +44 -0
  83. package/templates/expo/components/ui/index.ts +5 -0
  84. package/templates/expo/eslint.config.cjs +15 -0
  85. package/templates/expo/global.css +3 -0
  86. package/templates/expo/hooks/useOneClickLogin.ts.template +161 -0
  87. package/templates/expo/hooks/useViemClient.ts +118 -0
  88. package/templates/expo/hooks/useWallets.ts +52 -0
  89. package/templates/expo/index.js +2 -0
  90. package/templates/expo/lib/auth.ts +54 -0
  91. package/templates/expo/lib/constants.ts.template +2 -0
  92. package/templates/expo/lib/para.ts +13 -0
  93. package/templates/expo/metro.config.cjs +14 -0
  94. package/templates/expo/nativewind-env.d.ts +2 -0
  95. package/templates/expo/prettier.config.cjs +10 -0
  96. package/templates/expo/providers/ParaProvider.tsx +140 -0
  97. package/templates/expo/tailwind.config.cjs +23 -0
  98. package/templates/expo/tsconfig.json +11 -0
  99. package/templates/expo/types/index.ts +28 -0
  100. package/templates/nextjs/README.md +69 -0
  101. package/templates/nextjs/_env.example +8 -0
  102. package/templates/nextjs/_gitignore +36 -0
  103. package/templates/nextjs/_yarnrc.yml +1 -0
  104. package/templates/nextjs/next.config.ts +5 -0
  105. package/templates/nextjs/postcss.config.mjs +7 -0
  106. package/templates/nextjs/public/para.svg +3 -0
  107. package/templates/nextjs/src/app/layout.tsx +30 -0
  108. package/templates/nextjs/src/app/page.tsx +40 -0
  109. package/templates/nextjs/src/components/ParaProvider.tsx +116 -0
  110. package/templates/nextjs/src/components/layout/Header.tsx +44 -0
  111. package/templates/nextjs/src/components/ui/ConnectCard.tsx +24 -0
  112. package/templates/nextjs/src/components/ui/SignMessage.tsx +53 -0
  113. package/templates/nextjs/src/components/ui/WalletInfo.tsx +22 -0
  114. package/templates/nextjs/src/hooks/useSignHelloWorld.ts +23 -0
  115. package/templates/nextjs/src/styles/globals.css +1 -0
  116. package/templates/nextjs/tsconfig.json +27 -0
  117. package/dist/bin/index.js +0 -2
  118. package/dist/commands/scaffold.js +0 -137
  119. package/dist/integrations/codeGenerators.js +0 -637
  120. package/dist/integrations/packageJsonHelpers.js +0 -77
  121. package/dist/integrations/sdkSetup.js +0 -24
  122. package/dist/integrations/sdkSetupNextjs.js +0 -111
  123. package/dist/integrations/sdkSetupVite.js +0 -82
  124. package/dist/package.json +0 -44
  125. package/dist/prompts/interactive.js +0 -98
  126. package/dist/src/commands/scaffold.js +0 -157
  127. package/dist/src/index.js +0 -48
  128. package/dist/src/integrations/codeGenerators.js +0 -633
  129. package/dist/src/integrations/packageJsonHelpers.js +0 -77
  130. package/dist/src/integrations/sdkSetup.js +0 -24
  131. package/dist/src/integrations/sdkSetupNextjs.js +0 -111
  132. package/dist/src/integrations/sdkSetupVite.js +0 -82
  133. package/dist/src/prompts/interactive.js +0 -98
  134. package/dist/src/templates/nextjs.js +0 -68
  135. package/dist/src/templates/vite-react.js +0 -52
  136. package/dist/src/utils/exec.js +0 -16
  137. package/dist/src/utils/formatting.js +0 -31
  138. package/dist/src/utils/logger.js +0 -19
  139. package/dist/templates/nextjs.js +0 -61
  140. package/dist/templates/vite-react.js +0 -43
  141. package/dist/utils/exec.js +0 -16
  142. package/dist/utils/formatting.js +0 -31
@@ -1,77 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import fs from 'fs-extra';
11
- import path from 'path';
12
- const EVM_DEPS = ['@getpara/evm-wallet-connectors', '@tanstack/react-query', 'wagmi', '@getpara/react-sdk'];
13
- const SOLANA_DEPS = [
14
- '@getpara/react-sdk',
15
- '@getpara/solana-wallet-connectors',
16
- '@solana-mobile/wallet-adapter-mobile',
17
- '@solana/wallet-adapter-base',
18
- '@solana/wallet-adapter-react',
19
- '@solana/wallet-adapter-walletconnect',
20
- '@solana/web3.js',
21
- '@tanstack/react-query',
22
- ];
23
- const COSMOS_DEPS = [
24
- '@getpara/core-sdk',
25
- '@getpara/cosmos-wallet-connectors',
26
- '@getpara/graz',
27
- '@getpara/react-sdk',
28
- '@getpara/user-management-client',
29
- '@cosmjs/cosmwasm-stargate',
30
- '@cosmjs/launchpad',
31
- '@cosmjs/proto-signing',
32
- '@cosmjs/stargate',
33
- '@cosmjs/tendermint-rpc',
34
- '@leapwallet/cosmos-social-login-capsule-provider',
35
- 'long',
36
- 'starknet',
37
- ];
38
- const BASE_DEPS = ['@getpara/react-sdk'];
39
- export function updatePackageJsonDependencies(projectName, networks, externalWalletSupport) {
40
- return __awaiter(this, void 0, void 0, function* () {
41
- const pkgPath = path.join(projectName, 'package.json');
42
- const exists = yield fs.pathExists(pkgPath);
43
- if (!exists) {
44
- return;
45
- }
46
- const pkgData = yield fs.readJSON(pkgPath);
47
- pkgData.dependencies = pkgData.dependencies || {};
48
- if (!externalWalletSupport) {
49
- BASE_DEPS.forEach(dep => {
50
- pkgData.dependencies[dep] = pkgData.dependencies[dep] || 'latest';
51
- });
52
- }
53
- else {
54
- if (networks.includes('evm')) {
55
- EVM_DEPS.forEach(dep => {
56
- pkgData.dependencies[dep] = pkgData.dependencies[dep] || 'latest';
57
- });
58
- }
59
- if (networks.includes('solana')) {
60
- SOLANA_DEPS.forEach(dep => {
61
- pkgData.dependencies[dep] = pkgData.dependencies[dep] || 'latest';
62
- });
63
- }
64
- if (networks.includes('cosmos')) {
65
- COSMOS_DEPS.forEach(dep => {
66
- pkgData.dependencies[dep] = pkgData.dependencies[dep] || 'latest';
67
- });
68
- }
69
- if (!networks.includes('evm') && !networks.includes('solana') && !networks.includes('cosmos')) {
70
- BASE_DEPS.forEach(dep => {
71
- pkgData.dependencies[dep] = pkgData.dependencies[dep] || 'latest';
72
- });
73
- }
74
- }
75
- yield fs.writeJSON(pkgPath, pkgData, { spaces: 2 });
76
- });
77
- }
@@ -1,24 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { logInfo } from '../utils/logger.js';
11
- import { sdkSetupNextjs } from './sdkSetupNextjs.js';
12
- import { sdkSetupVite } from './sdkSetupVite.js';
13
- export function runSDKSetup(config) {
14
- return __awaiter(this, void 0, void 0, function* () {
15
- const { projectName, template } = config;
16
- logInfo(`🔌 Integrating Para SDK into project ${projectName}...`);
17
- if (template === 'vite-react') {
18
- yield sdkSetupVite(config);
19
- }
20
- else {
21
- yield sdkSetupNextjs(config);
22
- }
23
- });
24
- }
@@ -1,111 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import fs from 'fs-extra';
11
- import path from 'path';
12
- import { logHeader, logSection, logSubsection, logStep } from '../utils/logger.js';
13
- import { formatWithPrettier } from '../utils/formatting.js';
14
- import { updatePackageJsonDependencies } from './packageJsonHelpers.js';
15
- import { getEnvFileContent, getParaClientCode, getWalletProviderCodeNextjs, getHelloParaFile, getHomeFile, getStylesNonTailwind, } from './codeGenerators.js';
16
- export function sdkSetupNextjs(config) {
17
- return __awaiter(this, void 0, void 0, function* () {
18
- const { projectName, networks, evmSigner, apiKey, noTypescript, noAppRouter, noSrcDir, externalWalletSupport, tailwind, app, } = config;
19
- const envContent = getEnvFileContent(apiKey, true);
20
- const envPath = path.join(projectName, '.env');
21
- yield fs.outputFile(envPath, envContent);
22
- const clientDir = path.join(projectName, 'src', 'client');
23
- yield fs.ensureDir(clientDir);
24
- const paraClient = getParaClientCode(true, !noTypescript);
25
- {
26
- const filePath = path.join(clientDir, `para.${noTypescript ? 'js' : 'ts'}`);
27
- const formatted = yield formatWithPrettier(paraClient, filePath);
28
- yield fs.outputFile(filePath, formatted);
29
- }
30
- if (externalWalletSupport) {
31
- const compDir = path.join(projectName, 'src', 'components');
32
- yield fs.ensureDir(compDir);
33
- const results = getWalletProviderCodeNextjs(networks, noAppRouter);
34
- for (const r of results) {
35
- const fileExt = noTypescript ? 'jsx' : 'tsx';
36
- const filePath = path.join(compDir, `${r.fileName}.${fileExt}`);
37
- const formatted = yield formatWithPrettier(r.code, filePath);
38
- yield fs.outputFile(filePath, formatted);
39
- }
40
- }
41
- const componentsDir = path.join(projectName, 'src', 'components');
42
- yield fs.ensureDir(componentsDir);
43
- const helloParaCode = getHelloParaFile(!!tailwind, !noTypescript, true);
44
- {
45
- const filePath = path.join(componentsDir, `HelloPara.${noTypescript ? 'jsx' : 'tsx'}`);
46
- const formatted = yield formatWithPrettier(helloParaCode, filePath);
47
- yield fs.outputFile(filePath, formatted);
48
- }
49
- const homeCode = getHomeFile(!!tailwind, !noTypescript, !!externalWalletSupport);
50
- let mainPath = '';
51
- if (noAppRouter) {
52
- if (noSrcDir) {
53
- mainPath = path.join(projectName, 'pages', `index.${noTypescript ? 'jsx' : 'tsx'}`);
54
- }
55
- else {
56
- mainPath = path.join(projectName, 'src', 'pages', `index.${noTypescript ? 'jsx' : 'tsx'}`);
57
- }
58
- }
59
- else {
60
- if (noSrcDir) {
61
- mainPath = path.join(projectName, 'app', `page.${noTypescript ? 'jsx' : 'tsx'}`);
62
- }
63
- else {
64
- mainPath = path.join(projectName, 'src', 'app', `page.${noTypescript ? 'jsx' : 'tsx'}`);
65
- }
66
- }
67
- const formattedHome = yield formatWithPrettier(homeCode, mainPath);
68
- yield fs.writeFile(mainPath, formattedHome);
69
- let cssFilePath = '';
70
- if (tailwind) {
71
- if (app) {
72
- cssFilePath = path.join(projectName, 'src', 'app', 'globals.css');
73
- }
74
- else {
75
- cssFilePath = path.join(projectName, 'styles', 'globals.css');
76
- }
77
- if (!(yield fs.pathExists(cssFilePath))) {
78
- yield fs.outputFile(cssFilePath, '');
79
- }
80
- }
81
- else {
82
- if (app) {
83
- cssFilePath = path.join(projectName, 'src', 'app', 'globals.css');
84
- }
85
- else {
86
- cssFilePath = path.join(projectName, 'src', 'global.css');
87
- }
88
- if (!(yield fs.pathExists(cssFilePath))) {
89
- yield fs.outputFile(cssFilePath, '');
90
- }
91
- const stylesContent = getStylesNonTailwind();
92
- const existing = yield fs.readFile(cssFilePath, 'utf-8');
93
- const appended = `${existing.trim()}\n\n${stylesContent}`;
94
- const formattedStyles = yield formatWithPrettier(appended, cssFilePath);
95
- yield fs.writeFile(cssFilePath, formattedStyles);
96
- }
97
- yield updatePackageJsonDependencies(projectName, networks, externalWalletSupport);
98
- logSection('🛠 Configuration Details:');
99
- logSubsection('Project Type', 'nextjs');
100
- logSubsection('Supported Networks', networks.join(', ') || 'None');
101
- if (networks.includes('evm')) {
102
- logSubsection('EVM Signer', evmSigner);
103
- }
104
- logSubsection('API Key', apiKey);
105
- logSection('➡️ Next Steps:');
106
- logStep(`1. cd ${projectName}`);
107
- logStep(`2. Install dependencies if skipped (e.g., "yarn install" or "npm install")`);
108
- logStep(`3. Refer to https://docs.getpara.com/integration-guides/create-para-app for further instructions.`);
109
- logHeader('✅ SDK integration complete with ParaModal usage.');
110
- });
111
- }
@@ -1,82 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import fs from 'fs-extra';
11
- import path from 'path';
12
- import { logHeader, logSection, logSubsection, logStep, logInfo } from '../utils/logger.js';
13
- import { formatWithPrettier } from '../utils/formatting.js';
14
- import { updatePackageJsonDependencies } from './packageJsonHelpers.js';
15
- import { getEnvFileContent, getParaClientCode, getWalletProviderCodeVite, getHelloParaFile, getHomeFile, getStylesNonTailwind, } from './codeGenerators.js';
16
- export function sdkSetupVite(config) {
17
- return __awaiter(this, void 0, void 0, function* () {
18
- const { projectName, networks, evmSigner, apiKey, noTypescript, noSrcDir, externalWalletSupport, tailwind } = config;
19
- const envContent = getEnvFileContent(apiKey, false);
20
- const envPath = path.join(projectName, '.env');
21
- yield fs.outputFile(envPath, envContent);
22
- const clientDir = path.join(projectName, 'src', 'client');
23
- yield fs.ensureDir(clientDir);
24
- const paraClient = getParaClientCode(false, !noTypescript);
25
- {
26
- const filePath = path.join(clientDir, `para.${noTypescript ? 'js' : 'ts'}`);
27
- const formatted = yield formatWithPrettier(paraClient, filePath);
28
- yield fs.outputFile(filePath, formatted);
29
- }
30
- if (externalWalletSupport) {
31
- const compDir = path.join(projectName, 'src', 'components');
32
- yield fs.ensureDir(compDir);
33
- const providerCode = getWalletProviderCodeVite(networks);
34
- const filePath = path.join(compDir, `ParaWalletsProvider.${noTypescript ? 'jsx' : 'tsx'}`);
35
- const formatted = yield formatWithPrettier(providerCode, filePath);
36
- yield fs.outputFile(filePath, formatted);
37
- }
38
- const compDir = path.join(projectName, 'src', 'components');
39
- yield fs.ensureDir(compDir);
40
- const helloParaCode = getHelloParaFile(!!tailwind, !noTypescript, false);
41
- {
42
- const filePath = path.join(compDir, `HelloPara.${noTypescript ? 'jsx' : 'tsx'}`);
43
- const formatted = yield formatWithPrettier(helloParaCode, filePath);
44
- yield fs.outputFile(filePath, formatted);
45
- }
46
- const homeCode = getHomeFile(!!tailwind, !noTypescript, !!externalWalletSupport);
47
- const mainFileDir = noSrcDir ? projectName : path.join(projectName, 'src');
48
- const mainFilePath = path.join(mainFileDir, `App.${noTypescript ? 'jsx' : 'tsx'}`);
49
- const exists = yield fs.pathExists(mainFilePath);
50
- if (!exists) {
51
- logInfo(`Could not find ${mainFilePath} to replace.`);
52
- }
53
- else {
54
- const formatted = yield formatWithPrettier(homeCode, mainFilePath);
55
- yield fs.writeFile(mainFilePath, formatted);
56
- }
57
- if (!tailwind) {
58
- const indexCssPath = path.join(projectName, 'src', 'index.css');
59
- const existsCss = yield fs.pathExists(indexCssPath);
60
- if (!existsCss) {
61
- yield fs.outputFile(indexCssPath, '');
62
- }
63
- const existing = yield fs.readFile(indexCssPath, 'utf-8');
64
- const newStyles = `${existing.trim()}\n\n${getStylesNonTailwind()}`;
65
- const formattedStyles = yield formatWithPrettier(newStyles, indexCssPath);
66
- yield fs.writeFile(indexCssPath, formattedStyles);
67
- }
68
- yield updatePackageJsonDependencies(projectName, networks, externalWalletSupport);
69
- logSection('🛠 Configuration Details:');
70
- logSubsection('Project Type', 'vite-react');
71
- logSubsection('Supported Networks', networks.join(', ') || 'None');
72
- if (networks.includes('evm')) {
73
- logSubsection('EVM Signer', evmSigner);
74
- }
75
- logSubsection('API Key', apiKey);
76
- logSection('➡️ Next Steps:');
77
- logStep(`1. cd ${projectName}`);
78
- logStep(`2. Install dependencies if skipped (e.g., "yarn install" or "npm install")`);
79
- logStep(`3. Refer to https://docs.getpara.com/integration-guides/create-para-app for further instructions.`);
80
- logHeader('✅ SDK integration complete with ParaModal usage.');
81
- });
82
- }
package/dist/package.json DELETED
@@ -1,44 +0,0 @@
1
- {
2
- "name": "@getpara/create-para-app",
3
- "version": "0.6.0",
4
- "main": "dist/src/index.js",
5
- "type": "module",
6
- "bin": {
7
- "create-para-app": "dist/bin/index.js"
8
- },
9
- "files": [
10
- "dist"
11
- ],
12
- "engines": {
13
- "node": ">=14.0.0"
14
- },
15
- "license": "MIT",
16
- "scripts": {
17
- "build": "tsc",
18
- "start": "node --no-warnings dist/bin/index.js",
19
- "dev": "node --no-warnings --loader ts-node/esm src/index.ts"
20
- },
21
- "dependencies": {
22
- "chalk": "5.4.1",
23
- "commander": "13.1.0",
24
- "execa": "9.5.2",
25
- "fs-extra": "11.3.0",
26
- "inquirer": "12.4.1",
27
- "ora": "8.2.0",
28
- "prettier": "3.5.0",
29
- "update-notifier": "7.3.1"
30
- },
31
- "devDependencies": {
32
- "@types/chalk": "^2.2.4",
33
- "@types/commander": "^2.12.5",
34
- "@types/inquirer": "^9.0.7",
35
- "@types/jest": "^29.5.14",
36
- "@types/node": "^22.13.1",
37
- "@types/update-notifier": "6.0.8",
38
- "@types/fs-extra": "11.0.4",
39
- "jest": "^29.7.0",
40
- "ts-jest": "^29.2.5",
41
- "ts-node": "^10.9.2",
42
- "typescript": "^5.7.3"
43
- }
44
- }
@@ -1,98 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import inquirer from 'inquirer';
11
- export function promptInteractive(config) {
12
- return __awaiter(this, void 0, void 0, function* () {
13
- var _a, _b;
14
- const template = config.template || 'nextjs';
15
- const defaultName = config.projectName || `para-${template}-template`;
16
- const questions = [];
17
- if (!config.template) {
18
- questions.push({
19
- type: 'list',
20
- name: 'template',
21
- message: 'Select a project type:',
22
- choices: ['nextjs', 'vite-react'],
23
- default: 'nextjs',
24
- });
25
- }
26
- if (!config.projectName) {
27
- questions.push({
28
- type: 'input',
29
- name: 'projectName',
30
- message: 'Enter your project name:',
31
- default: answers => {
32
- const selectedTemplate = answers.template || config.template || 'nextjs';
33
- return `para-${selectedTemplate}-template`;
34
- },
35
- });
36
- }
37
- if (!config.networks || !config.networks.length) {
38
- questions.push({
39
- type: 'checkbox',
40
- name: 'networks',
41
- message: 'Select supported networks:',
42
- choices: [
43
- { name: 'EVM', value: 'evm' },
44
- { name: 'Cosmos', value: 'cosmos' },
45
- { name: 'Solana', value: 'solana' },
46
- ],
47
- });
48
- }
49
- if (config.networks && config.networks.includes('evm') && !config.evmSigner) {
50
- questions.push({
51
- type: 'list',
52
- name: 'evmSigner',
53
- message: 'Select signer for EVM:',
54
- choices: ['ethers', 'viem'],
55
- default: 'ethers',
56
- });
57
- }
58
- if (config.externalWalletSupport === undefined) {
59
- questions.push({
60
- type: 'confirm',
61
- name: 'externalWalletSupport',
62
- message: 'Enable external wallet support?',
63
- default: false,
64
- when: answers => {
65
- const nets = answers.networks || config.networks;
66
- return Array.isArray(nets) && nets.length > 0;
67
- },
68
- });
69
- }
70
- if (!config.apiKey) {
71
- questions.push({
72
- type: 'input',
73
- name: 'apiKey',
74
- message: 'Enter your API key:',
75
- validate: input => (input ? true : 'API key cannot be empty'),
76
- });
77
- }
78
- if (!questions.length) {
79
- return {
80
- projectName: config.projectName || defaultName,
81
- template,
82
- networks: config.networks || [],
83
- evmSigner: config.evmSigner,
84
- externalWalletSupport: !!config.externalWalletSupport,
85
- apiKey: config.apiKey || '',
86
- };
87
- }
88
- const answers = yield inquirer.prompt(questions);
89
- return {
90
- template: answers.template || template,
91
- projectName: answers.projectName || config.projectName || defaultName,
92
- networks: answers.networks || config.networks || [],
93
- evmSigner: answers.evmSigner || config.evmSigner,
94
- externalWalletSupport: (_b = (_a = answers.externalWalletSupport) !== null && _a !== void 0 ? _a : config.externalWalletSupport) !== null && _b !== void 0 ? _b : false,
95
- apiKey: answers.apiKey || config.apiKey || '',
96
- };
97
- });
98
- }
@@ -1,157 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import chalk from 'chalk';
11
- import fs from 'fs-extra';
12
- import ora from 'ora';
13
- import { execa } from 'execa';
14
- import { promptInteractive } from '../prompts/interactive.js';
15
- import { scaffoldNextjs } from '../templates/nextjs.js';
16
- import { scaffoldViteReact } from '../templates/vite-react.js';
17
- import { runSDKSetup } from '../integrations/sdkSetup.js';
18
- import { logInfo, logError, logHeader, logSection, logSubsection } from '../utils/logger.js';
19
- function validateOptions(options) {
20
- if ((options === null || options === void 0 ? void 0 : options.template) && !['nextjs', 'vite-react'].includes(options.template)) {
21
- throw new Error(`Invalid template '${options.template}'. Valid templates: nextjs, vite-react.`);
22
- }
23
- if ((options === null || options === void 0 ? void 0 : options.evmSigner) && !['ethers', 'viem'].includes(options.evmSigner)) {
24
- throw new Error(`Invalid EVM signer '${options.evmSigner}'. Valid signers: ethers, viem.`);
25
- }
26
- if (options === null || options === void 0 ? void 0 : options.networks) {
27
- const nets = options.networks.split(',').map(n => n.trim());
28
- for (const network of nets) {
29
- if (!['evm', 'cosmos', 'solana'].includes(network)) {
30
- throw new Error(`Invalid network '${network}'. Valid options: evm, cosmos, solana.`);
31
- }
32
- }
33
- }
34
- }
35
- function cleanupProjectDirectory(projectName) {
36
- if (!projectName)
37
- return;
38
- try {
39
- if (fs.existsSync(projectName)) {
40
- fs.removeSync(projectName);
41
- }
42
- }
43
- catch (_a) { }
44
- }
45
- export default function scaffold(positionalProjectName, options) {
46
- return __awaiter(this, void 0, void 0, function* () {
47
- try {
48
- validateOptions(options);
49
- const { projectName: cliProjectName, template: cliTemplate, useLatest, noPrompt, noGit, packageManager, skipDeps, typescript = true, eslint = true, tailwind = true, srcDir = true, app = true, networks, evmSigner, externalWallet, apiKey, } = options || {};
50
- const finalProjectName = cliProjectName || positionalProjectName;
51
- let config = {
52
- projectName: finalProjectName || '',
53
- template: cliTemplate || '',
54
- networks: [],
55
- evmSigner: '',
56
- apiKey: apiKey || '',
57
- externalWalletSupport: externalWallet,
58
- useLatest: !!useLatest,
59
- noGit: !!noGit,
60
- packageManager: packageManager || 'yarn',
61
- skipDeps: !!skipDeps,
62
- typescript,
63
- eslint,
64
- tailwind,
65
- srcDir,
66
- app,
67
- };
68
- if (networks) {
69
- config.networks = networks.split(',').map(n => n.trim());
70
- }
71
- if (evmSigner) {
72
- config.evmSigner = evmSigner;
73
- }
74
- const needTemplate = !config.template;
75
- const needProjectName = !config.projectName;
76
- const needNetworks = !config.networks.length;
77
- const needEvmSigner = config.networks.includes('evm') && !config.evmSigner;
78
- const needApiKey = !config.apiKey;
79
- const shouldPrompt = !noPrompt && (needTemplate || needProjectName || needNetworks || needEvmSigner || needApiKey);
80
- if (shouldPrompt) {
81
- const answers = yield promptInteractive(config);
82
- config.projectName = answers.projectName || `para-${answers.template}-template`;
83
- config.template = answers.template;
84
- config.networks = answers.networks;
85
- config.evmSigner = answers.evmSigner || (answers.networks.includes('evm') ? 'ethers' : '');
86
- config.apiKey = answers.apiKey;
87
- config.externalWalletSupport = answers.externalWalletSupport;
88
- }
89
- else {
90
- if (!config.projectName) {
91
- const t = cliTemplate || 'nextjs';
92
- config.projectName = `para-${t}-template`;
93
- }
94
- if (!config.template) {
95
- config.template = 'nextjs';
96
- }
97
- if (!config.networks.length) {
98
- config.networks = [];
99
- }
100
- if (!config.evmSigner && config.networks.includes('evm')) {
101
- config.evmSigner = 'ethers';
102
- }
103
- }
104
- if (fs.existsSync(config.projectName)) {
105
- throw new Error(`Project folder '${config.projectName}' already exists. Please remove or choose a different name.`);
106
- }
107
- logHeader(`🚀 Creating a new project named: ${config.projectName}`);
108
- logSection('🔧 Project Configuration:');
109
- logSubsection('Project Type', config.template);
110
- logSubsection('Supported Networks', config.networks.length > 0 ? config.networks.join(', ') : 'None');
111
- if (config.networks.includes('evm')) {
112
- logSubsection('EVM Signer', config.evmSigner);
113
- }
114
- logSubsection('API Key', config.apiKey);
115
- logSubsection('External Wallet Support', config.externalWalletSupport ? 'Enabled' : 'Disabled');
116
- logSubsection('TypeScript', config.typescript ? 'Enabled' : 'Disabled');
117
- logSubsection('ESLint', config.eslint ? 'Enabled' : 'Disabled');
118
- logSubsection('Tailwind', config.tailwind ? 'Enabled' : 'Disabled');
119
- logSubsection('src/ directory', config.srcDir ? 'Enabled' : 'Disabled');
120
- logSubsection('App Router', config.app ? 'Enabled' : 'Disabled');
121
- if (config.template === 'vite-react') {
122
- yield scaffoldViteReact(config);
123
- }
124
- else {
125
- yield scaffoldNextjs(config);
126
- }
127
- yield runSDKSetup(config);
128
- if (!config.skipDeps) {
129
- const spinner = ora('Installing updated dependencies...').start();
130
- try {
131
- if (config.packageManager === 'yarn') {
132
- yield execa('yarn', { cwd: config.projectName, stdio: 'pipe' });
133
- }
134
- else if (config.packageManager === 'pnpm') {
135
- yield execa('pnpm', ['install'], { cwd: config.projectName, stdio: 'pipe' });
136
- }
137
- else if (config.packageManager === 'bun') {
138
- yield execa('bun', ['install'], { cwd: config.projectName, stdio: 'pipe' });
139
- }
140
- else {
141
- yield execa('npm', ['install'], { cwd: config.projectName, stdio: 'pipe' });
142
- }
143
- spinner.succeed('Dependencies re-installed successfully.');
144
- }
145
- catch (err) {
146
- spinner.fail('Failed to re-install dependencies. You might try manually running the install command.');
147
- }
148
- }
149
- logInfo(chalk.green('✅ Scaffolding complete!'));
150
- }
151
- catch (error) {
152
- logError(`Error: ${error.message || error}`);
153
- cleanupProjectDirectory((options === null || options === void 0 ? void 0 : options.projectName) || positionalProjectName || '');
154
- process.exit(1);
155
- }
156
- });
157
- }
package/dist/src/index.js DELETED
@@ -1,48 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { program } from 'commander';
11
- import updateNotifier from 'update-notifier';
12
- import pkg from '../package.json' assert { type: 'json' };
13
- import scaffold from './commands/scaffold.js';
14
- updateNotifier({ pkg }).notify();
15
- program
16
- .name('create-para-app')
17
- .description('CLI tool for scaffolding new apps with Para SDKs')
18
- .version(pkg.version)
19
- .usage('[projectName] [options]')
20
- .helpOption('--help', 'Display help for command');
21
- program
22
- .argument('[projectName]')
23
- .description('Scaffold a new app with specified template and features')
24
- .option('--template <template>', 'Specify the template: nextjs or vite-react')
25
- .option('--use-latest', 'Use the latest version of the underlying framework')
26
- .option('--no-prompt', 'Skip interactive prompts')
27
- .option('--no-git', 'Disable git initialization')
28
- .option('--package-manager <pm>', 'Specify package manager: npm, yarn, bun, pnpm', 'yarn')
29
- .option('--skip-deps', 'Skip dependency installation')
30
- .option('--typescript', 'Enable TypeScript (default: enabled)', true)
31
- .option('--no-typescript', 'Disable TypeScript')
32
- .option('--eslint', 'Enable ESLint (default: enabled)', true)
33
- .option('--no-eslint', 'Disable ESLint')
34
- .option('--tailwind', 'Enable Tailwind CSS (default: enabled)', true)
35
- .option('--no-tailwind', 'Disable Tailwind CSS')
36
- .option('--src-dir', 'Use src/ directory (default: enabled)', true)
37
- .option('--no-src-dir', 'Disable src/ directory')
38
- .option('--app', 'Use the App Router (default: enabled)', true)
39
- .option('--no-app', 'Disable App Router')
40
- .option('--networks <list>', 'Comma separated networks: "evm,cosmos,solana"')
41
- .option('--evm-signer <signer>', 'Specify EVM signer: "ethers" or "viem"')
42
- .option('--external-wallet', 'Enable external wallet support (default: false)')
43
- .option('--api-key <key>', 'Provide your API key to skip prompt')
44
- .option('--project-name <name>', 'Explicitly set project name to skip name prompt')
45
- .action((projectName, options) => __awaiter(void 0, void 0, void 0, function* () {
46
- yield scaffold(projectName, options);
47
- }));
48
- program.parse(process.argv);