Skip to content

Commit

Permalink
Merge pull request #111 from woocommerce/update/108-nodejs-v20-genera…
Browse files Browse the repository at this point in the history
…tor-grow

Upgrade JS package `generator-grow` to use Node.js v20
  • Loading branch information
eason9487 authored Apr 23, 2024
2 parents e89cb26 + b318e27 commit 4eace98
Show file tree
Hide file tree
Showing 6 changed files with 5,487 additions and 2,537 deletions.
16 changes: 10 additions & 6 deletions packages/js/generator-grow/generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* External dependencies
*/
import Generator from 'yeoman-generator';
import path from 'node:path';

/**
* Internal dependencies
Expand All @@ -13,15 +14,18 @@ export default class GrowGenerator extends Generator {
usage() {
return 'yo grow[:app] [options]';
}
initializing() {
const packageRoot = this.sourceRoot() + '/../';
this.composeWith( {

async initializing() {
const packageRoot = path.resolve( this.sourceRoot(), '../..' );

await this.composeWith( {
Generator: GitHubGenerator,
path: packageRoot + '../github/index.js',
path: path.resolve( packageRoot, 'github/index.js' ),
} );
this.composeWith( {

await this.composeWith( {
Generator: DotFilesGenerator,
path: packageRoot + '../dotfiles/index.js',
path: path.resolve( packageRoot, 'dotfiles/index.js' ),
} );
}
}
6 changes: 3 additions & 3 deletions packages/js/generator-grow/generators/github/github.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
* External dependencies
*/
import { default as path, dirname } from 'path';
import { fileURLToPath } from 'url';
import { default as path, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
import assert from 'yeoman-assert';
import helpers from 'yeoman-test';

Expand Down Expand Up @@ -39,7 +39,7 @@ describe( ':github', function () {
it( 'Should use (package.json).title as the project title in CONTRIBUTING.md', async function () {
await helpers
.run( githubPath )
.on( 'ready', function ( generator ) {
.onGenerator( function ( generator ) {
generator.fs.write(
'package.json',
'{ "title": "Package Title" }'
Expand Down
28 changes: 0 additions & 28 deletions packages/js/generator-grow/generators/github/package.json

This file was deleted.

2 changes: 1 addition & 1 deletion packages/js/generator-grow/generators/phpcs/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import path from 'path';
import path from 'node:path';
import Generator from 'yeoman-generator';

export default class PhpcsGenerator extends Generator {
Expand Down
Loading

0 comments on commit 4eace98

Please sign in to comment.