create-ripple 0.1.1 → 0.1.2
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/package.json +1 -1
- package/src/lib/templates.js +9 -2
package/package.json
CHANGED
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
|
}
|