Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Block: Adds --target-dir flag to allow the tool to target where to scaffold #53781

Merged
merged 12 commits into from
Oct 28, 2024
Merged
Prev Previous commit
Next Next commit
Not using the targetDir when in --no-plugin mode
  • Loading branch information
ryanwelcher committed Oct 24, 2024
commit 1e61305b2a42b6220d1a0beb374bf9d983571fd6
10 changes: 2 additions & 8 deletions packages/create-block/lib/init-block.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ async function initBlockJSON( {

const outputFile = plugin
? join( process.cwd(), targetDir, slug, folderName, 'block.json' )
: join( process.cwd(), targetDir, folderName, slug, 'block.json' );
: join( process.cwd(), folderName, slug, 'block.json' );

await makeDir( dirname( outputFile ) );
await writeFile(
Expand Down Expand Up @@ -83,13 +83,7 @@ module.exports = async function ( outputTemplates, view ) {
Object.keys( outputTemplates ).map( async ( outputFile ) => {
const pathName = view.plugin
? join( view.folderName, outputFile )
: join(
process.cwd(),
view.targetDir,
view.folderName,
view.slug,
outputFile
);
: join( process.cwd(), view.folderName, view.slug, outputFile );
await writeOutputTemplate(
outputTemplates[ outputFile ],
pathName,
Expand Down