Skip to content

Commit

Permalink
cli: Don't copy changelog/ for jetpack generate from starter plug…
Browse files Browse the repository at this point in the history
…in (#37268)

When using `jetpack generate` to create a new plugin based on the
starter plugin, we need to make sure that the contents of the
`changelog/` directory are not copied. The new plugin should start with
an empty changelog directory.
  • Loading branch information
anomiex authored May 7, 2024
1 parent 108b4ea commit 84cc418
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tools/cli/commands/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,11 +377,18 @@ async function generatePluginFromStarter( projDir, answers ) {
} );
files = files.split( '\n' ).map( str => str.replace( 'projects/plugins/starter-plugin', '' ) );
files.forEach( file => {
if ( file ) {
if ( file && ! file.startsWith( 'changelog/' ) ) {
copyFile( path.join( projDir, file ), path.join( starterDir, file ) );
}
} );

// Initialize changelog dir.
mergeDirs(
fileURLToPath( new URL( '../skeletons/common/changelog', import.meta.url ) ),
path.join( projDir, 'changelog' ),
answers.name
);

// Replace strings.
await searchReplaceInFolder( projDir, 'jetpack-starter-plugin', normalizeSlug( answers.name ) );
await searchReplaceInFolder( projDir, 'starter-plugin', normalizeSlug( answers.name, false ) );
Expand Down

0 comments on commit 84cc418

Please sign in to comment.