wmx-os-generators 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/dist/scaffold.d.ts +1 -0
- package/dist/scaffold.js +4 -2
- package/package.json +1 -1
- package/src/scaffold.ts +5 -2
package/dist/scaffold.d.ts
CHANGED
package/dist/scaffold.js
CHANGED
|
@@ -9,11 +9,13 @@ export class ScaffoldGenerator {
|
|
|
9
9
|
const templateName = ScaffoldGenerator.resolveTemplate(answers);
|
|
10
10
|
const templatesDir = path.join(__dirname, '..', 'templates');
|
|
11
11
|
const templatePath = path.join(templatesDir, templateName);
|
|
12
|
-
const targetPath =
|
|
12
|
+
const targetPath = answers.useCurrentDir
|
|
13
|
+
? process.cwd()
|
|
14
|
+
: path.join(process.cwd(), answers.projectName);
|
|
13
15
|
if (!(await fs.pathExists(templatePath))) {
|
|
14
16
|
throw new Error(`Template not found: ${templateName} (looked in ${templatePath})`);
|
|
15
17
|
}
|
|
16
|
-
if (await fs.pathExists(targetPath)) {
|
|
18
|
+
if (!answers.useCurrentDir && await fs.pathExists(targetPath)) {
|
|
17
19
|
throw new Error(`Directory already exists: ${targetPath}`);
|
|
18
20
|
}
|
|
19
21
|
console.log(`\nScaffolding "${answers.projectName}" from template "${templateName}"...`);
|
package/package.json
CHANGED
package/src/scaffold.ts
CHANGED
|
@@ -12,6 +12,7 @@ interface ScaffoldAnswers {
|
|
|
12
12
|
backend: string
|
|
13
13
|
database: string
|
|
14
14
|
packageManager: string
|
|
15
|
+
useCurrentDir?: boolean
|
|
15
16
|
features?: string[]
|
|
16
17
|
[key: string]: unknown
|
|
17
18
|
}
|
|
@@ -21,13 +22,15 @@ export class ScaffoldGenerator {
|
|
|
21
22
|
const templateName = ScaffoldGenerator.resolveTemplate(answers)
|
|
22
23
|
const templatesDir = path.join(__dirname, '..', 'templates')
|
|
23
24
|
const templatePath = path.join(templatesDir, templateName)
|
|
24
|
-
const targetPath =
|
|
25
|
+
const targetPath = answers.useCurrentDir
|
|
26
|
+
? process.cwd()
|
|
27
|
+
: path.join(process.cwd(), answers.projectName)
|
|
25
28
|
|
|
26
29
|
if (!(await fs.pathExists(templatePath))) {
|
|
27
30
|
throw new Error(`Template not found: ${templateName} (looked in ${templatePath})`)
|
|
28
31
|
}
|
|
29
32
|
|
|
30
|
-
if (await fs.pathExists(targetPath)) {
|
|
33
|
+
if (!answers.useCurrentDir && await fs.pathExists(targetPath)) {
|
|
31
34
|
throw new Error(`Directory already exists: ${targetPath}`)
|
|
32
35
|
}
|
|
33
36
|
|