Skip to content

Commit

Permalink
fix(yarn3): Update cwd for yarn 1 backwards compatibility in bins
Browse files Browse the repository at this point in the history
  • Loading branch information
dac09 committed Mar 3, 2022
1 parent 51e03ba commit 8e4c774
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 4 deletions.
6 changes: 5 additions & 1 deletion packages/api/src/bins/redwood.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@ const requireFromCli = createRequire(

const bins = requireFromCli('./package.json')['bin']

process.chdir('../')
// Ensure we run all commands from the base of the RW project
// even if you invoke from ./web or ./api
const rwProjectRoot = requireFromCli('./dist/lib/index.js').getPaths().base
process.chdir(rwProjectRoot)

requireFromCli(bins['redwood'])
6 changes: 5 additions & 1 deletion packages/api/src/bins/rwfw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@ const requireFromCli = createRequire(

const bins = requireFromCli('./package.json')['bin']

process.chdir('../')
// Ensure we run all commands from the base of the RW project
// even if you invoke from ./web or ./api
const rwProjectRoot = requireFromCli('./dist/lib/index.js').getPaths().base
process.chdir(rwProjectRoot)

requireFromCli(bins['rwfw'])
5 changes: 5 additions & 0 deletions packages/core/src/bins/redwood.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,9 @@ const requireFromCli = createRequire(

const bins = requireFromCli('./package.json')['bin']

// Ensure we run all commands from the base of the RW project
// even if you invoke from ./web or ./api
const rwProjectRoot = requireFromCli('./dist/lib/index.js').getPaths().base
process.chdir(rwProjectRoot)

requireFromCli(bins['redwood'])
5 changes: 5 additions & 0 deletions packages/core/src/bins/rwfw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,9 @@ const requireFromCli = createRequire(

const bins = requireFromCli('./package.json')['bin']

// Ensure we run all commands from the base of the RW project
// even if you invoke from ./web or ./api
const rwProjectRoot = requireFromCli('./dist/lib/index.js').getPaths().base
process.chdir(rwProjectRoot)

requireFromCli(bins['rwfw'])
6 changes: 5 additions & 1 deletion packages/web/src/bins/redwood.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@ const requireFromCli = createRequire(

const bins = requireFromCli('./package.json')['bin']

process.chdir('../')
// Ensure we run all commands from the base of the RW project
// even if you invoke from ./web or ./api
const rwProjectRoot = requireFromCli('./dist/lib/index.js').getPaths().base
process.chdir(rwProjectRoot)

requireFromCli(bins['redwood'])
6 changes: 5 additions & 1 deletion packages/web/src/bins/rwfw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@ const requireFromCli = createRequire(

const bins = requireFromCli('./package.json')['bin']

process.chdir('../')
// Ensure we run all commands from the base of the RW project
// even if you invoke from ./web or ./api
const rwProjectRoot = requireFromCli('./dist/lib/index.js').getPaths().base
process.chdir(rwProjectRoot)

requireFromCli(bins['rwfw'])

0 comments on commit 8e4c774

Please sign in to comment.