Skip to content

Commit

Permalink
Merge pull request #8 from wp-media/develop
Browse files Browse the repository at this point in the history
Releasing v1.0.2
  • Loading branch information
Khadreal authored Aug 7, 2024
2 parents 8b7a5d2 + 0137c76 commit 40956aa
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 17 deletions.
45 changes: 34 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

Here we have main script sources to be used in WP Rocket plugin repository.

## Building

`dist` directory contains the final build files.

## Scripts/Commands
Developments for the scripts are done in the `src` folder. To update the outputs in the dist folder

```
npm run build:unmin
Expand All @@ -24,27 +26,48 @@ npm run build

This is to build both minified and not minified versions.

## How to test a change in WP Rocket plugin
# Updating WP Rocket

## How to import changes from rocket-scripts

1. Create a branch and PR for your change in this repository.
2. Edit `package.json` inside WP Rocket plugin repository to have the following line:
The following steps must be followed when you need to test a new version of the scripts within WP Rocket plugin, or to submit a new version into WP Rocket through a PR.

1. Create a branch and PR for your changes in this repository.
2. Check out wp rocket plugin on branch develop (or a dedicated branch for the issue to test if needed)
3. Edit `package.json` inside WP Rocket plugin repository to change the targeted version of wp-rocket-scripts:
```
"wp-rocket-scripts": "github:wp-media/rocket-scripts#branch-name",
```
3. Remove `node_modules` directory and `package-lock.json` file.
4. Run the command

This syntax allows to target a specific branch as dependency. For instance:

```
"wp-rocket-scripts": "github:wp-media/rocket-scripts#enhancement/6741-adjust-beacon-timeout",
```

4. Remove `node_modules` directory and `package-lock.json` file.
5. Run the command
```
npm install
```
5. Use the gulp task there to generate the beacon script:

You should see the targeted version of the beacon in your working directory `/node_modules/wp-rocket-scripts/dist`.

6. Use the gulp task there to generate the beacon script:
```
npm run gulp build:js:beacon
```
6. This will update the beacon script with the corresponding branch changes.

## How to release
1. Update the version in `package.json`
You should see the new beacon files in `assets/js`.

7. Compile the plugin zip as usual.

## How to release a new version

When a new WP Rocket release occurs with a new version of rocket-scripts, or when new developments are available on rocket-scripts develop without breaking compatibility with WP Rocket, a new rocket-scripts version must be created. To do so:

1. Update the version in `package.json`.
2. Make sure everything is merged into `trunk` branch.
3. Create a release from `trunk`
3. Create a release from `trunk`.
4. Github Workflow will run to release into npm.
5. In WP Rocket or any other code that uses this package can update the version in their `package.json` and run `npm install` again.
2 changes: 1 addition & 1 deletion dist/lcp-beacon.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
this.config = config;
this.performanceImages = [];
this.errorCode = "";
this.scriptTimer = /* @__PURE__ */ new Date();
this.infiniteLoopId = null;
}
async init() {
this.scriptTimer = /* @__PURE__ */ new Date();
if (!await this._isValidPreconditions()) {
this._finalize();
return;
Expand Down
2 changes: 1 addition & 1 deletion dist/lcp-beacon.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 40956aa

Please sign in to comment.