Skip to content

Commit

Permalink
fix: plugin-commands-deploy use path resolve on deploy target dir (#5026
Browse files Browse the repository at this point in the history
)

* fix: plugin-commands-deploy use path resolve on deploy target directory (#4980)

Previously the deploy target directory was specified as a relative path
to the workspace project root. This meant that absolute paths could not be used.
Now this uses the current working directory and allows absolute paths,
this is more in line with users expectations of unix command behaivour.

close #4980

* fix: allow both absolute and relative

* docs: update changesets

Co-authored-by: Zoltan Kochan <z@kochan.io>
  • Loading branch information
AWare and zkochan committed Jul 27, 2022
1 parent 1d1fc08 commit c7519ad
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .changeset/fair-foxes-know.md
@@ -0,0 +1,6 @@
---
"pnpm": "patch"
"@pnpm/plugin-commands-deploy": patch
---

**pnpm deploy**: accept absolute paths and use cwd instead of workspaceDir for deploy target directory [#4980](https://github.com/pnpm/pnpm/issues/4980).
3 changes: 2 additions & 1 deletion packages/plugin-commands-deploy/src/deploy.ts
Expand Up @@ -68,7 +68,8 @@ export async function handler (
throw new PnpmError('INVALID_DEPLOY_TARGET', 'This command requires one parameter')
}
const deployedDir = selectedDirs[0]
const deployDir = path.join(opts.workspaceDir, params[0])
const deployDirParam = params[0]
const deployDir = path.isAbsolute(deployDirParam) ? deployDirParam : path.join(opts.dir, deployDirParam)
await rimraf(deployDir)
await fs.promises.mkdir(deployDir, { recursive: true })
await copyProject(deployedDir, deployDir)
Expand Down

0 comments on commit c7519ad

Please sign in to comment.