create-ripple 0.1.1 → 0.1.3
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
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# create-ripple
|
|
1
|
+
# create-ripple
|
|
2
2
|
|
|
3
3
|
Interactive CLI tool for creating new Ripple applications.
|
|
4
4
|
|
|
@@ -7,21 +7,21 @@ Interactive CLI tool for creating new Ripple applications.
|
|
|
7
7
|
### Interactive Mode
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
npm create ripple
|
|
10
|
+
npm create ripple
|
|
11
11
|
# or
|
|
12
|
-
npx create-ripple
|
|
12
|
+
npx create-ripple
|
|
13
13
|
# or
|
|
14
|
-
yarn create ripple
|
|
14
|
+
yarn create ripple
|
|
15
15
|
# or
|
|
16
|
-
pnpm create ripple
|
|
16
|
+
pnpm create ripple
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
### With Arguments
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
|
-
npm create ripple
|
|
22
|
+
npm create ripple my-app
|
|
23
23
|
# or
|
|
24
|
-
npx create-ripple
|
|
24
|
+
npx create-ripple my-app
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
## Features
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -14,7 +14,7 @@ const packageJson = JSON.parse(readFileSync(join(__dirname, '../package.json'),
|
|
|
14
14
|
const program = new Command();
|
|
15
15
|
|
|
16
16
|
program
|
|
17
|
-
.name('create-ripple
|
|
17
|
+
.name('create-ripple')
|
|
18
18
|
.description('Interactive CLI tool for creating Ripple applications')
|
|
19
19
|
.version(packageJson.version)
|
|
20
20
|
.helpOption('-h, --help', 'Display help for command');
|
|
@@ -110,8 +110,9 @@ export async function createProject({
|
|
|
110
110
|
const spinner5 = ora('Initializing Git repository...').start();
|
|
111
111
|
try {
|
|
112
112
|
execSync('git init', { cwd: projectPath, stdio: 'ignore' });
|
|
113
|
-
|
|
114
|
-
execSync('git
|
|
113
|
+
// We should not automatically commit without asking user, so I have currently commented the code:
|
|
114
|
+
// execSync('git add .', { cwd: projectPath, stdio: 'ignore' });
|
|
115
|
+
// execSync('git commit -m "Initial commit"', { cwd: projectPath, stdio: 'ignore' });
|
|
115
116
|
spinner5.succeed('Git repository initialized');
|
|
116
117
|
} catch (error) {
|
|
117
118
|
spinner5.warn('Git initialization failed (optional)');
|
|
@@ -156,7 +157,7 @@ function updatePackageJson(projectPath, projectName, packageManager, typescript)
|
|
|
156
157
|
}
|
|
157
158
|
|
|
158
159
|
// Update description
|
|
159
|
-
packageJson.description = `A Ripple application created with create-ripple
|
|
160
|
+
packageJson.description = `A Ripple application created with create-ripple`;
|
|
160
161
|
|
|
161
162
|
// Add package manager field if not npm
|
|
162
163
|
if (packageManager !== 'npm') {
|
package/src/lib/templates.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
2
|
import { existsSync, mkdirSync } from 'node:fs';
|
|
3
3
|
import { tmpdir } from 'node:os';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { dirname } from 'node:path';
|
|
4
6
|
import degit from 'degit';
|
|
5
7
|
import { GITHUB_REPO, GITHUB_TEMPLATES_DIRECTORY, TEMPLATES } from '../constants.js';
|
|
6
8
|
|
|
9
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
+
const __dirname = dirname(__filename);
|
|
11
|
+
|
|
7
12
|
/**
|
|
8
13
|
* Get template by name
|
|
9
14
|
* @param {string} templateName - The template name
|
|
@@ -81,7 +86,8 @@ export async function downloadTemplate(templateName) {
|
|
|
81
86
|
*/
|
|
82
87
|
export function getLocalTemplatePath(templateName) {
|
|
83
88
|
// This is used for local development in the monorepo
|
|
84
|
-
|
|
89
|
+
// Navigate from packages/create-ripple/src/lib/ to templates/
|
|
90
|
+
const repoRoot = join(__dirname, '../../../../');
|
|
85
91
|
return join(repoRoot, 'templates', templateName);
|
|
86
92
|
}
|
|
87
93
|
|
|
@@ -91,7 +97,8 @@ export function getLocalTemplatePath(templateName) {
|
|
|
91
97
|
*/
|
|
92
98
|
export function isLocalDevelopment() {
|
|
93
99
|
// Check if we're in the monorepo by looking for the templates directory
|
|
94
|
-
|
|
100
|
+
// Navigate from packages/create-ripple/src/lib/ to templates/
|
|
101
|
+
const repoRoot = join(__dirname, '../../../../');
|
|
95
102
|
const templatesDir = join(repoRoot, 'templates');
|
|
96
103
|
return existsSync(templatesDir);
|
|
97
104
|
}
|
|
@@ -67,7 +67,7 @@ describe('CLI Integration Tests', () => {
|
|
|
67
67
|
|
|
68
68
|
expect(result.code).toBe(0);
|
|
69
69
|
expect(result.stdout).toContain('Interactive CLI tool for creating Ripple applications');
|
|
70
|
-
expect(result.stdout).toContain('Usage: create-ripple
|
|
70
|
+
expect(result.stdout).toContain('Usage: create-ripple');
|
|
71
71
|
expect(result.stdout).toContain('Arguments:');
|
|
72
72
|
expect(result.stdout).toContain('Options:');
|
|
73
73
|
expect(result.stdout).toContain('--template');
|
|
@@ -116,7 +116,7 @@ describe('createProject integration tests', () => {
|
|
|
116
116
|
// Verify package.json was updated
|
|
117
117
|
const packageJson = JSON.parse(readFileSync(join(projectPath, 'package.json'), 'utf-8'));
|
|
118
118
|
expect(packageJson.name).toBe('test-project');
|
|
119
|
-
expect(packageJson.description).toBe('A Ripple application created with create-ripple
|
|
119
|
+
expect(packageJson.description).toBe('A Ripple application created with create-ripple');
|
|
120
120
|
expect(packageJson.version).toBe('1.0.0');
|
|
121
121
|
});
|
|
122
122
|
|