@garyr/pt-cli 0.25.1 → 0.25.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.
@@ -1,7 +1,7 @@
1
1
  import fs from 'fs';
2
2
  import path from 'path';
3
3
  import inquirer from 'inquirer';
4
- import { loadConfig } from '../config.js';
4
+ import { loadConfig, sanitizePath } from '../config.js';
5
5
  import chalk from 'chalk';
6
6
  import { processCopyFiles } from '../substitute.js';
7
7
  import { execSync } from 'child_process';
@@ -128,7 +128,7 @@ export async function init(targetName, destPath, options = {}) {
128
128
  console.log(chalk.cyan("Processing post_copy..."));
129
129
  for (const file of template.post_copy) {
130
130
  const srcPath = path.join(template.templateRoot, file.src);
131
- const destPath = path.join(resolvedDest, file.dest || file.src);
131
+ const destPath = path.join(resolvedDest, sanitizePath(file.dest || file.src));
132
132
  if (fs.existsSync(srcPath)) {
133
133
  if (options.dryRun) {
134
134
  console.log(chalk.gray(` [DRY RUN] Would copy ${file.src} → ${file.dest || file.src}`));
@@ -269,7 +269,7 @@ export async function init(targetName, destPath, options = {}) {
269
269
  }
270
270
  function createStructure(dirPath, folders, dryRun = false) {
271
271
  for (const folder of folders) {
272
- const fullDirPath = path.join(dirPath, folder.name);
272
+ const fullDirPath = path.join(dirPath, sanitizePath(folder.name));
273
273
  if (dryRun) {
274
274
  console.log(chalk.gray(` [DRY RUN] Would create directory: ${fullDirPath}`));
275
275
  }
package/dist/index.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@garyr/pt-cli",
3
- "version": "0.25.1",
3
+ "version": "0.25.2",
4
4
  "description": "Project Template CLI - Learn structures and initialize projects",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -1,7 +1,7 @@
1
1
  import fs from 'fs';
2
2
  import path from 'path';
3
3
  import inquirer from 'inquirer';
4
- import { loadConfig, FolderNode } from '../config.js';
4
+ import { loadConfig, FolderNode, sanitizePath } from '../config.js';
5
5
  import chalk from 'chalk';
6
6
  import { processCopyFiles } from '../substitute.js';
7
7
  import { execSync } from 'child_process';
@@ -145,7 +145,7 @@ export async function init(targetName: string | undefined, destPath: string | un
145
145
 
146
146
  for (const file of template.post_copy) {
147
147
  const srcPath = path.join(template.templateRoot!, file.src);
148
- const destPath = path.join(resolvedDest, file.dest || file.src);
148
+ const destPath = path.join(resolvedDest, sanitizePath(file.dest || file.src));
149
149
 
150
150
  if (fs.existsSync(srcPath)) {
151
151
  if (options.dryRun) {
@@ -285,7 +285,7 @@ export async function init(targetName: string | undefined, destPath: string | un
285
285
 
286
286
  function createStructure(dirPath: string, folders: FolderNode[], dryRun: boolean = false) {
287
287
  for (const folder of folders) {
288
- const fullDirPath = path.join(dirPath, folder.name);
288
+ const fullDirPath = path.join(dirPath, sanitizePath(folder.name));
289
289
 
290
290
  if (dryRun) {
291
291
  console.log(chalk.gray(` [DRY RUN] Would create directory: ${fullDirPath}`));