@getpara/create-para-app 0.3.0 → 0.5.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/dist/bin/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import '../src/index';
|
|
2
|
+
import '../src/index.js';
|
package/dist/package.json
CHANGED
|
@@ -9,6 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import chalk from 'chalk';
|
|
11
11
|
import fs from 'fs-extra';
|
|
12
|
+
import ora from 'ora';
|
|
13
|
+
import { execa } from 'execa';
|
|
12
14
|
import { promptInteractive } from '../prompts/interactive.js';
|
|
13
15
|
import { scaffoldNextjs } from '../templates/nextjs.js';
|
|
14
16
|
import { scaffoldViteReact } from '../templates/vite-react.js';
|
|
@@ -45,7 +47,6 @@ export default function scaffold(positionalProjectName, options) {
|
|
|
45
47
|
try {
|
|
46
48
|
validateOptions(options);
|
|
47
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 || {};
|
|
48
|
-
// For rollback reference
|
|
49
50
|
const finalProjectName = cliProjectName || positionalProjectName;
|
|
50
51
|
let config = {
|
|
51
52
|
projectName: finalProjectName || '',
|
|
@@ -64,14 +65,12 @@ export default function scaffold(positionalProjectName, options) {
|
|
|
64
65
|
srcDir,
|
|
65
66
|
app,
|
|
66
67
|
};
|
|
67
|
-
// Populate networks if provided
|
|
68
68
|
if (networks) {
|
|
69
69
|
config.networks = networks.split(',').map(n => n.trim());
|
|
70
70
|
}
|
|
71
71
|
if (evmSigner) {
|
|
72
72
|
config.evmSigner = evmSigner;
|
|
73
73
|
}
|
|
74
|
-
// We'll decide if we must prompt
|
|
75
74
|
const needTemplate = !config.template;
|
|
76
75
|
const needProjectName = !config.projectName;
|
|
77
76
|
const needNetworks = !config.networks.length;
|
|
@@ -126,6 +125,27 @@ export default function scaffold(positionalProjectName, options) {
|
|
|
126
125
|
yield scaffoldNextjs(config);
|
|
127
126
|
}
|
|
128
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
|
+
}
|
|
129
149
|
logInfo(chalk.green('✅ Scaffolding complete!'));
|
|
130
150
|
}
|
|
131
151
|
catch (error) {
|
|
@@ -9,13 +9,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { execCommand } from '../utils/exec.js';
|
|
11
11
|
import { logInfo } from '../utils/logger.js';
|
|
12
|
+
import ora from 'ora';
|
|
12
13
|
export function scaffoldNextjs(config) {
|
|
13
14
|
return __awaiter(this, void 0, void 0, function* () {
|
|
14
15
|
logInfo(`🔧 Scaffolding Next.js app for project ${config.projectName}...`);
|
|
15
16
|
const versionTag = config.useLatest ? 'latest' : 'latest';
|
|
16
|
-
// Start with these flags for a default Next.js TS, ESLint, Tailwind, src, app setup
|
|
17
17
|
const baseFlags = new Set(['--typescript', '--eslint', '--tailwind', '--src-dir', '--app', '--no-turbopack', '--yes']);
|
|
18
|
-
// If user wants no typescript => remove --typescript, add --javascript
|
|
19
18
|
if (!config.typescript) {
|
|
20
19
|
baseFlags.delete('--typescript');
|
|
21
20
|
baseFlags.add('--javascript');
|
|
@@ -36,26 +35,34 @@ export function scaffoldNextjs(config) {
|
|
|
36
35
|
for (const f of baseFlags) {
|
|
37
36
|
cmd += ` ${f}`;
|
|
38
37
|
}
|
|
38
|
+
if (config.packageManager === 'yarn') {
|
|
39
|
+
cmd += ' --use-yarn';
|
|
40
|
+
}
|
|
41
|
+
else if (config.packageManager === 'npm') {
|
|
42
|
+
cmd += ' --use-npm';
|
|
43
|
+
}
|
|
44
|
+
else if (config.packageManager === 'pnpm') {
|
|
45
|
+
cmd += ' --use-pnpm';
|
|
46
|
+
}
|
|
47
|
+
else if (config.packageManager === 'bun') {
|
|
48
|
+
logInfo('Warning: create-next-app does not officially support "--use-bun". Using npm instead.');
|
|
49
|
+
cmd += ' --use-npm';
|
|
50
|
+
}
|
|
39
51
|
if (config.noGit) {
|
|
40
52
|
cmd += ' --no-git';
|
|
41
53
|
}
|
|
42
54
|
if (config.skipDeps) {
|
|
43
55
|
cmd += ' --skip-install';
|
|
44
56
|
}
|
|
45
|
-
|
|
46
|
-
if (config.packageManager === 'npm') {
|
|
47
|
-
cmd += ' --use-npm';
|
|
48
|
-
}
|
|
49
|
-
else if (config.packageManager === 'pnpm') {
|
|
50
|
-
cmd += ' --use-pnpm';
|
|
51
|
-
}
|
|
52
|
-
else if (config.packageManager === 'bun') {
|
|
53
|
-
// create-next-app doesn't have a built-in --use-bun, we might skip or log a warning
|
|
54
|
-
logInfo('Warning: create-next-app does not officially support "--use-bun". Using npm instead.');
|
|
55
|
-
cmd += ' --use-npm';
|
|
56
|
-
}
|
|
57
|
-
}
|
|
57
|
+
const spinner = ora('Scaffolding your Next.js project...').start();
|
|
58
58
|
logInfo(`💻 Executing command: ${cmd}`);
|
|
59
|
-
|
|
59
|
+
try {
|
|
60
|
+
yield execCommand(cmd, true);
|
|
61
|
+
spinner.succeed('Next.js scaffold complete.');
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
spinner.fail('Failed to scaffold Next.js app.');
|
|
65
|
+
throw error;
|
|
66
|
+
}
|
|
60
67
|
});
|
|
61
68
|
}
|
|
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { execCommand } from '../utils/exec.js';
|
|
11
11
|
import { logInfo } from '../utils/logger.js';
|
|
12
|
+
import ora from 'ora';
|
|
12
13
|
export function scaffoldViteReact(config) {
|
|
13
14
|
return __awaiter(this, void 0, void 0, function* () {
|
|
14
15
|
logInfo(`🔧 Scaffolding Vite React app for project ${config.projectName}...`);
|
|
@@ -37,7 +38,15 @@ export function scaffoldViteReact(config) {
|
|
|
37
38
|
if (config.skipDeps) {
|
|
38
39
|
cmd += ' --skip-install';
|
|
39
40
|
}
|
|
41
|
+
const spinner = ora('Scaffolding your Vite project...').start();
|
|
40
42
|
logInfo(`💻 Executing command: ${cmd}`);
|
|
41
|
-
|
|
43
|
+
try {
|
|
44
|
+
yield execCommand(cmd, true);
|
|
45
|
+
spinner.succeed('Vite scaffold complete.');
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
spinner.fail('Failed to scaffold Vite app.');
|
|
49
|
+
throw error;
|
|
50
|
+
}
|
|
42
51
|
});
|
|
43
52
|
}
|
package/dist/src/utils/exec.js
CHANGED
|
@@ -8,9 +8,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { execa } from 'execa';
|
|
11
|
-
export function execCommand(
|
|
12
|
-
return __awaiter(this,
|
|
11
|
+
export function execCommand(command_1) {
|
|
12
|
+
return __awaiter(this, arguments, void 0, function* (command, silent = false) {
|
|
13
13
|
const [cmd, ...args] = command.split(' ');
|
|
14
|
-
yield execa(cmd, args, { stdio: 'inherit' });
|
|
14
|
+
yield execa(cmd, args, { stdio: silent ? 'pipe' : 'inherit' });
|
|
15
15
|
});
|
|
16
16
|
}
|