@pageai/ralph-loop 1.15.0 → 1.16.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/bin/cli.js +4 -4
- package/bin/lib/git.js +7 -3
- package/bin/lib/playwright.js +6 -4
- package/bin/lib/shadcn.js +9 -8
- package/bin/lib/vitest.js +6 -4
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -353,12 +353,12 @@ async function main() {
|
|
|
353
353
|
|
|
354
354
|
// Playwright setup
|
|
355
355
|
if (installPlaywright) {
|
|
356
|
-
setupPlaywright(clack, TARGET_DIR, appDir);
|
|
356
|
+
await setupPlaywright(clack, TARGET_DIR, appDir);
|
|
357
357
|
}
|
|
358
358
|
|
|
359
359
|
// Vitest setup
|
|
360
360
|
if (installVitest) {
|
|
361
|
-
setupVitest(clack, TARGET_DIR, appDir);
|
|
361
|
+
await setupVitest(clack, TARGET_DIR, appDir);
|
|
362
362
|
}
|
|
363
363
|
|
|
364
364
|
// Final setup steps (git init, shadcn install)
|
|
@@ -372,7 +372,7 @@ async function main() {
|
|
|
372
372
|
|
|
373
373
|
if (needsGit) {
|
|
374
374
|
try {
|
|
375
|
-
initGitRepo(TARGET_DIR);
|
|
375
|
+
await initGitRepo(TARGET_DIR);
|
|
376
376
|
} catch {
|
|
377
377
|
// Non-critical — continue setup even if git init fails
|
|
378
378
|
}
|
|
@@ -380,7 +380,7 @@ async function main() {
|
|
|
380
380
|
|
|
381
381
|
if (needsShadcn) {
|
|
382
382
|
try {
|
|
383
|
-
installAllComponents(appDirPath);
|
|
383
|
+
await installAllComponents(appDirPath);
|
|
384
384
|
} catch {
|
|
385
385
|
// Non-critical — continue setup even if shadcn install fails
|
|
386
386
|
}
|
package/bin/lib/git.js
CHANGED
|
@@ -4,9 +4,12 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
const path = require('path');
|
|
7
|
-
const {
|
|
7
|
+
const { exec } = require('child_process');
|
|
8
|
+
const { promisify } = require('util');
|
|
8
9
|
const { exists } = require('./copy');
|
|
9
10
|
|
|
11
|
+
const execAsync = promisify(exec);
|
|
12
|
+
|
|
10
13
|
/**
|
|
11
14
|
* Checks if a directory is inside a git repository
|
|
12
15
|
* @param {string} dir - Directory path to check
|
|
@@ -19,9 +22,10 @@ function isGitRepo(dir) {
|
|
|
19
22
|
/**
|
|
20
23
|
* Initializes a new git repository in the given directory
|
|
21
24
|
* @param {string} dir - Directory path to initialize
|
|
25
|
+
* @returns {Promise<void>}
|
|
22
26
|
*/
|
|
23
|
-
function initGitRepo(dir) {
|
|
24
|
-
|
|
27
|
+
async function initGitRepo(dir) {
|
|
28
|
+
await execAsync('git init', { cwd: dir });
|
|
25
29
|
}
|
|
26
30
|
|
|
27
31
|
module.exports = {
|
package/bin/lib/playwright.js
CHANGED
|
@@ -4,17 +4,20 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
const path = require('path');
|
|
7
|
-
const {
|
|
7
|
+
const { exec } = require('child_process');
|
|
8
|
+
const { promisify } = require('util');
|
|
8
9
|
const { copyFile, exists } = require('./copy');
|
|
9
10
|
const display = require('./display');
|
|
10
11
|
|
|
12
|
+
const execAsync = promisify(exec);
|
|
13
|
+
|
|
11
14
|
/**
|
|
12
15
|
* Copies playwright.config.ts into the app directory and installs Chromium.
|
|
13
16
|
* @param {object} clack - @clack/prompts module (passed in because it's ESM)
|
|
14
17
|
* @param {string} targetDir - Project root (TARGET_DIR)
|
|
15
18
|
* @param {string} appDir - Relative app source directory
|
|
16
19
|
*/
|
|
17
|
-
function setupPlaywright(clack, targetDir, appDir) {
|
|
20
|
+
async function setupPlaywright(clack, targetDir, appDir) {
|
|
18
21
|
console.log();
|
|
19
22
|
display.printStep('🎭', 'Playwright setup');
|
|
20
23
|
|
|
@@ -31,9 +34,8 @@ function setupPlaywright(clack, targetDir, appDir) {
|
|
|
31
34
|
const s = clack.spinner();
|
|
32
35
|
s.start('Installing Playwright browsers (chromium)...');
|
|
33
36
|
try {
|
|
34
|
-
|
|
37
|
+
await execAsync('npx playwright install --with-deps chromium', {
|
|
35
38
|
cwd: path.join(targetDir, appDir),
|
|
36
|
-
stdio: 'pipe',
|
|
37
39
|
});
|
|
38
40
|
s.stop('Playwright browsers installed');
|
|
39
41
|
} catch (err) {
|
package/bin/lib/shadcn.js
CHANGED
|
@@ -5,9 +5,12 @@
|
|
|
5
5
|
|
|
6
6
|
const fs = require('fs');
|
|
7
7
|
const path = require('path');
|
|
8
|
-
const {
|
|
8
|
+
const { exec } = require('child_process');
|
|
9
|
+
const { promisify } = require('util');
|
|
9
10
|
const { exists } = require('./copy');
|
|
10
11
|
|
|
12
|
+
const execAsync = promisify(exec);
|
|
13
|
+
|
|
11
14
|
const SHADCN_SCHEMA = 'https://ui.shadcn.com/schema.json';
|
|
12
15
|
|
|
13
16
|
/**
|
|
@@ -61,10 +64,9 @@ function isShadcnProject(dir) {
|
|
|
61
64
|
* then strips the "#/" alias prefix from components.json.
|
|
62
65
|
* @param {string} dir - Directory path to run the init in
|
|
63
66
|
*/
|
|
64
|
-
function initShadcn(dir) {
|
|
65
|
-
|
|
67
|
+
async function initShadcn(dir) {
|
|
68
|
+
await execAsync('npx shadcn@latest init -y -d 2>&1', {
|
|
66
69
|
cwd: dir,
|
|
67
|
-
stdio: 'pipe',
|
|
68
70
|
});
|
|
69
71
|
|
|
70
72
|
stripAliasPrefix(dir);
|
|
@@ -97,14 +99,13 @@ function stripAliasPrefix(dir) {
|
|
|
97
99
|
* Runs init first if no components.json exists.
|
|
98
100
|
* @param {string} dir - Directory path to run the install in
|
|
99
101
|
*/
|
|
100
|
-
function installAllComponents(dir) {
|
|
102
|
+
async function installAllComponents(dir) {
|
|
101
103
|
if (!hasShadcnConfig(dir)) {
|
|
102
|
-
initShadcn(dir);
|
|
104
|
+
await initShadcn(dir);
|
|
103
105
|
}
|
|
104
106
|
|
|
105
|
-
|
|
107
|
+
await execAsync('npx shadcn@latest add --all --yes --overwrite 2>&1', {
|
|
106
108
|
cwd: dir,
|
|
107
|
-
stdio: 'pipe',
|
|
108
109
|
});
|
|
109
110
|
}
|
|
110
111
|
|
package/bin/lib/vitest.js
CHANGED
|
@@ -5,11 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
const fs = require('fs');
|
|
7
7
|
const path = require('path');
|
|
8
|
-
const {
|
|
8
|
+
const { exec } = require('child_process');
|
|
9
|
+
const { promisify } = require('util');
|
|
9
10
|
const { copyFile, exists } = require('./copy');
|
|
10
11
|
const display = require('./display');
|
|
11
12
|
const { DEFAULT_APP_DIR } = require('./consts');
|
|
12
13
|
|
|
14
|
+
const execAsync = promisify(exec);
|
|
15
|
+
|
|
13
16
|
/**
|
|
14
17
|
* Copies vitest.config.ts into the app directory, patches the include
|
|
15
18
|
* paths to match appDir, and installs vitest + react plugin.
|
|
@@ -17,7 +20,7 @@ const { DEFAULT_APP_DIR } = require('./consts');
|
|
|
17
20
|
* @param {string} targetDir - Project root (TARGET_DIR)
|
|
18
21
|
* @param {string} appDir - Relative app source directory
|
|
19
22
|
*/
|
|
20
|
-
function setupVitest(clack, targetDir, appDir) {
|
|
23
|
+
async function setupVitest(clack, targetDir, appDir) {
|
|
21
24
|
console.log();
|
|
22
25
|
display.printStep('⚡', 'Vitest setup');
|
|
23
26
|
|
|
@@ -42,9 +45,8 @@ function setupVitest(clack, targetDir, appDir) {
|
|
|
42
45
|
const s = clack.spinner();
|
|
43
46
|
s.start('Installing Vitest dependencies...');
|
|
44
47
|
try {
|
|
45
|
-
|
|
48
|
+
await execAsync('npm install --save-dev vitest @vitejs/plugin-react', {
|
|
46
49
|
cwd: path.join(targetDir, appDir),
|
|
47
|
-
stdio: 'pipe',
|
|
48
50
|
});
|
|
49
51
|
s.stop('Vitest dependencies installed');
|
|
50
52
|
} catch (err) {
|