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

Add a Grunt action to set GP_SCRIPT_DEBUG to false when we deploy to wporg #1697

Merged
merged 10 commits into from
Sep 26, 2023

Conversation

amieiro
Copy link
Member

@amieiro amieiro commented Sep 22, 2023

Problem

When we deploy a new version to wporg, we need to minify the CSS and the JavaScript tiles.

But we need to change the GP_SCRIPT_DEBUG constant to false before we deploy to wporg, so the wporg release will use the minified files (except the end user will use the SCRIPT_DEBUG set to true). This PR address this problem.

Fixes #1587.

Solution

This PR adds:

  • A Grunt action to change the define( 'GP_SCRIPT_DEBUG', true ); to define( 'GP_SCRIPT_DEBUG', false ); in the glotpress.php file. Gruntfile.js file.
  • A npm action to run the Grunt action. package.json file.
  • This npm action into the wporg workflow. .github/workflows/deploy-wporg-plugin.yml file.

Testing Instructions

To test this PR:

  • You can execute the Grunt action with the grunt replace:updateGPScriptDebugConst command.
  • You can execute the npm action with the npm run updateGPScriptDebugConst command.

In both situations, you can check that the GP_SCRIPT_DEBUG value in the glotpress.php file has changed from true to false.

@amieiro amieiro requested review from akirk and trymebytes September 22, 2023 16:02
Copy link
Member

@akirk akirk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about this?

.github/workflows/deploy-wporg-plugin.yml Outdated Show resolved Hide resolved
Gruntfile.js Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
amieiro and others added 5 commits September 25, 2023 23:23
Co-authored-by: Alex Kirk <[email protected]>
Co-authored-by: Alex Kirk <[email protected]>
The dash introduced with the new name causes problems executing the
Grunt task, so we need to add these single quotation marks
@amieiro
Copy link
Member Author

amieiro commented Sep 25, 2023

What about this?

With the dash in the Grunt action name, I have problems running the task in my local machine, so I have added single quotation marks to this action name.

npm run prepare-release

> [email protected] prepare-release
> grunt replace:prepare-release

Loading "Gruntfile.js" tasks...ERROR
>> SyntaxError: Unexpected token '-'
Warning: Task "replace:prepare-release" not found. Use --force to continue.

Aborted due to warnings.

@amieiro amieiro requested a review from akirk September 25, 2023 21:45
@amieiro amieiro changed the title Add a Grunt action no set GP_SCRIPT_DEBUG to false when we deploy to wporg Add a Grunt action to set GP_SCRIPT_DEBUG to false when we deploy to wporg Sep 25, 2023
Copy link
Member

@akirk akirk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@amieiro amieiro merged commit 03870b9 into GlotPress:develop Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Minification: Improve workflow for Pull Requests that contain changes to JavaScript files
2 participants