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.
@@ -4,6 +4,7 @@ interface ScaffoldAnswers {
4
4
  backend: string;
5
5
  database: string;
6
6
  packageManager: string;
7
+ useCurrentDir?: boolean;
7
8
  features?: string[];
8
9
  [key: string]: unknown;
9
10
  }
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 = path.join(process.cwd(), answers.projectName);
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wmx-os-generators",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
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 = path.join(process.cwd(), answers.projectName)
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