Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…ostgator into develop

* 'develop' of https://github.com/newfold-labs/wp-plugin-hostgator:
  update workflow
  • Loading branch information
circlecube committed Sep 21, 2023
2 parents fc4c918 + 022ccc4 commit a6e8c40
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 35 deletions.
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v16
44 changes: 22 additions & 22 deletions .wp-env.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
{
"core": "WordPress/WordPress#tags/6.3.1",
"config": {
"WP_DEBUG": true,
"WP_DEBUG_LOG": true,
"WP_DEBUG_DISPLAY": false,
"FS_METHOD": "direct"
},
"phpVersion": "8.1",
"plugins": [
"."
],
"port": 8880,
"testsPort": 8881,
"env": {
"tests": {
"config": {
"WP_SITEURL": "localhost:8881",
"WP_TESTS_DOMAIN": "localhost:8881",
"WP_TESTS_TITLE": "HostGator WordPress Plugin",
"WP_TESTS_BINARY": "php"
}
}
"core": "WordPress/WordPress#tags/6.3.1",
"config": {
"WP_DEBUG": true,
"WP_DEBUG_LOG": true,
"WP_DEBUG_DISPLAY": false,
"FS_METHOD": "direct"
},
"phpVersion": "8.1",
"plugins": [
"."
],
"port": 8880,
"testsPort": 8881,
"env": {
"tests": {
"config": {
"WP_SITEURL": "localhost:8881",
"WP_TESTS_DOMAIN": "localhost:8881",
"WP_TESTS_TITLE": "HostGator WordPress Plugin",
"WP_TESTS_BINARY": "php"
}
}
}
}
29 changes: 16 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,32 +46,35 @@
"build": "wp-scripts build",
"check-engines": "wp-scripts check-engines",
"check-licenses": "wp-scripts check-licenses --production",
"create:dist": "rsync -r --include-from=.distinclude --exclude-from=.distignore . ./wp-plugin-hostgator",
"create:zip": "cd ./wp-plugin-hostgator && zip -r -9 ../wp-plugin-hostgator.zip . && ls -lh ../wp-plugin-hostgator.zip",
"cypress": "npm cypress open",
"cypress:record": "RECORD_ALL_CONTENT=1 RECORD_REPLAY_METADATA_FILE=$(mktemp) npx cypress run --browser 'Replay Chromium'",
"develop": "npm run start",
"develop:analyzer": "npm run start:analyzer",
"format": "wp-scripts format ./src",
"lint:css": "wp-scripts lint-style '**/*.css'",
"lint:js": "wp-scripts lint-js ./src",
"lint:js:fix": "wp-scripts lint-js ./src --fix",
"lint:pkg-json": "wp-scripts lint-pkg-json",
"lint:yml": "yamllint --ignore=node_modules/** --ignore=vendor/** **/*.yml",
"i18n": "wpi18n addtextdomain && composer run i18n",
"i18n-pot": "wpi18n make-pot . languages/wp-plugin-hostgator.pot --exclude=assets,storybook,tests,src,wp-plugin-hostgator",
"i18n-mo": "cd languages && for file in `find . -name \"*.po\"` ; do msgfmt -o ${file/.po/.mo} $file ; done",
"i18n-json": "wpi18n make-json languages/ --no-purge",
"i18n-json-rename": "cd languages && renamer '/wp-plugin-hostgator-[a-zA-Z_]+-[^\\.]*\\.json/' replace '/$1hostgator-script$2/'",
"lint:css": "wp-scripts lint-style '**/*.css'",
"lint:js": "wp-scripts lint-js ./src",
"lint:js:fix": "wp-scripts lint-js ./src --fix",
"lint:pkg-json": "wp-scripts lint-pkg-json",
"lint:yml": "yamllint --ignore=node_modules/** --ignore=vendor/** **/*.yml",
"log:watch": "wp-env run wordpress 'tail -f /var/www/html/wp-content/debug.log'",
"php-deps": "composer install --no-dev --optimize-autoloader",
"postprepare": "npm run set-wp-version",
"prebuild:cleanup": "rm -rf ./build ./wp-plugin-hostgator ./wp-plugin-hostgator.zip ./vendor",
"set-wp-version": "node ./set-latest-wp-version.js",
"srb": "npm run simulate-runner-build",
"simulate-runner-build": "npm run prebuild:cleanup && npm i && npm run php-deps && npm run build && npm run create:dist && npm run create:zip",
"start": "NODE_ENV=develop wp-scripts start",
"start:analyzer": "npm run start --webpack-bundle-analyzer",
"storybook:dev": "start-storybook -c ./storybook",
"storybook:build": "build-storybook -c ./storybook -o ./.docs",
"storybook:dev": "start-storybook -c ./storybook",
"test:e2e": "npx cypress run",
"test:unit": "wp-scripts test-unit-js",
"create:dist": "rsync -r --include-from=.distinclude --exclude-from=.distignore . ./wp-plugin-hostgator",
"php-deps": "composer install --no-dev --optimize-autoloader",
"create:zip": "cd ./wp-plugin-hostgator && zip -r -9 ../wp-plugin-hostgator.zip . && ls -lh ../wp-plugin-hostgator.zip",
"prebuild:cleanup": "rm -rf ./build ./wp-plugin-hostgator ./wp-plugin-hostgator.zip ./vendor",
"simulate-runner-build": "npm run prebuild:cleanup && npm i && npm run php-deps && npm run build && npm run create:dist && npm run create:zip",
"srb": "npm run simulate-runner-build"
"test:unit": "wp-scripts test-unit-js"
}
}
24 changes: 24 additions & 0 deletions set-latest-wp-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const fs = require('fs')
const fetch = require('node-fetch')
const wpEnv = require('./.wp-env.json')

fetch('https://api.wordpress.org/core/stable-check/1.0/')
.then(res => res.json())
.then(
json => {
const wpVersion = Object.keys(json)[Object.keys(json).length - 1]
wpEnv.core = `WordPress/WordPress#tags/${ wpVersion }`
fs.writeFile(
'./.wp-env.json',
JSON.stringify(wpEnv, null, 2),
'utf8',
(err) => {
if (err) {
console.log('An error occurred while writing latest WordPress version to .wp-env.json file.')
return console.log(err)
}
console.log(`The .wp-env.json file was updated with the latest WordPress version (${wpVersion}).`)
}
);
}
)

0 comments on commit a6e8c40

Please sign in to comment.