Skip to content

Commit

Permalink
Fixes initializer output path
Browse files Browse the repository at this point in the history
  • Loading branch information
danieldelcore committed Dec 4, 2021
1 parent 307fc53 commit 2decf6a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/perfect-wombats-leave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@codeshift/initializer': patch
---

Fix output dir path
6 changes: 3 additions & 3 deletions packages/initializer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export function initDirectory(
packageName: string,
transform: string,
type: 'version' | 'preset',
path: string = './',
targetPath: string = './',
isReduced: boolean = false,
) {
if (type === 'version' && !semver.valid(transform)) {
Expand All @@ -109,7 +109,7 @@ export function initDirectory(
);
}

const basePath = `${path}/${packageName.replace('/', '__')}`;
const basePath = `${targetPath}/${packageName.replace('/', '__')}`;
const transformPath = `${basePath}${!isReduced ? '/src/' : ''}/${transform}`;
const configPath = `${basePath}${
!isReduced ? '/src' : ''
Expand All @@ -121,7 +121,7 @@ export function initDirectory(

fs.copySync(`${__dirname}/../template${isReduced ? '/src' : ''}`, basePath);
fs.renameSync(
`${basePath}${!isReduced ? '/src/' : ''}/codemod`,
`${basePath}${!isReduced ? '/src' : ''}/codemod`,
transformPath,
);

Expand Down

0 comments on commit 2decf6a

Please sign in to comment.