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

Feat/upgrade env #33

Merged
merged 3 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
39 changes: 39 additions & 0 deletions .config/bump/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
const { execSync } = require('child_process')
const { readFileSync, writeFileSync } = require('fs')
const { join } = require('path')

const searchDir = join(__dirname, '../../')

console.log(`Searching for entries in ${searchDir}`)

const rawEntries = execSync(`find ${searchDir} -name style.css -not -path "${searchDir}themes/yootheme/*" `)
const entries = Buffer.from(rawEntries).toString('utf-8').split('\n').filter(Boolean)

const bumpVersion = (version) => {
const [major, minor, patch] = version.split('.').map(Number)

if (patch === 10) {
return [major, minor + 1, 0].join('.')
}

if (minor === 10) {
return [major + 1, 0, 0].join('.')
}

return [major, minor, patch + 1].join('.')
}

console.log(`Found ${entries.length} entries`)

for (const entry of entries) {
const content = Buffer.from(readFileSync(entry)).toString('utf-8')
const manifest = new Map(content.replaceAll('/*', '').replaceAll('*/','').split('\n').filter(Boolean).map(str => str.trim().split(':').map(s => s.trim())))
const version = manifest.get('Version')

console.log(`Bumping ${entry} from ${version} to ${bumpVersion(version)}`)

const newContent = content.replace(version, bumpVersion(version))
writeFileSync(entry, newContent)
}

console.log('Done')
36 changes: 36 additions & 0 deletions .github/workflows/bump.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Bump

on:
pull_request:
types: [closed]
branches:
- master
workflow_dispatch:


jobs:
run:
name: Run
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18.13'

- name: Bump versions
run: node ./.config/bump/script.js

- name: Commit changes
uses: EndBug/add-and-commit@v7
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
with:
author_name: github-actions
author_email: 41898282+github-actions[bot]@users.noreply.github.com
message: 'chore(common): versions'
branch: master
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
.idea
*.iml
*.tfstate
.terraform
yootheme
/themes/*/vendor
10 changes: 10 additions & 0 deletions .idea/.gitignore

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

10 changes: 10 additions & 0 deletions .idea/misc.xml

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

8 changes: 8 additions & 0 deletions .idea/modules.xml

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

6 changes: 6 additions & 0 deletions .idea/php.xml

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

6 changes: 6 additions & 0 deletions .idea/vcs.xml

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

1 change: 1 addition & 0 deletions plugins/wp-autorefresh-pause-master/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php // Here be dragons...
114 changes: 114 additions & 0 deletions plugins/wp-autorefresh-pause-master/js/hcs-customizer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/**
* Disables the customizer preview refresh.
* @type {Boolean}
*/
var hcsRefreshDisabled = false;

/**
* Check to see the preview window is ready before proceeding.
* @type {Boolean}
*/
var hcsPreviewReady = false;

/**
* Stores the customizer's refresh function so we can restore it later.
* @type {function}
*/
var hcsRefresh;

/**
* Checks to see if the preview iframe is ready before proceeding.
*
* @returns
*/
function hcsCheckPreviewReady() {

// Customizer takes a while to be ready, just keep checking
if (wp.customize.previewer.targetWindow() !== null) {
hcsOnReady();
return;
}
window.setTimeout(hcsCheckPreviewReady, 2000);

}

/**
* Called when the preview iframe is ready.
*/
function hcsOnReady() {

// Preview is ready, can now manually refresh
if (hcsRefreshDisabled) {
wp.customize.previewer.refresh = function () { }
jQuery(".customize-controls-refresh").show();
}
hcsPreviewReady = true;

}

/**
* Toggles the customizer preview refresh.
*/
function hcsToggleRefresh() {

if (hcsRefreshDisabled) hcsEnableRefresh();
else hcsDisableRefresh();

}

/**
* Enables the customizer preview refresh.
*/
function hcsEnableRefresh() {
hcsRefreshDisabled = false;
wp.customize.previewer.refresh = hcsRefresh;
wp.customize.previewer.refresh();
jQuery(".customize-controls-refresh").hide();
}

/**
* Disables the customizer preview refresh.
*/
function hcsDisableRefresh() {
hcsRefreshDisabled = true;
wp.customize.previewer.refresh = function () { }
jQuery(".customize-controls-refresh").show();
}

/**
* Checks to see if the preview iframe is ready before proceeding.
*
* @returns
*/
function hcsUpdatePreview() {
wp.customize.previewer.refresh = hcsRefresh;
wp.customize.previewer.refresh();
wp.customize.previewer.refresh = function () { }
}

/**
* Wait for page to load before running code
*/
jQuery(document).ready(function ($) {

// For restoring the preview iframe window.
hcsRefresh = wp.customize.previewer.refresh;

// Add refresh button
$(`<style>.customize-controls-refresh { display: none; } .customize-controls-refresh:before {content: "\\f531";}</style>
<a href="http://wordpress.test/" style="left: 48px;" onclick="event.preventDefault(); jQuery(this).blur(); hcsUpdatePreview();" class="customize-controls-close customize-controls-refresh">
<span class="screen-reader-text">Refresh</span>
</a>
`).insertAfter('.customize-controls-close');

// Check preview is ready
hcsCheckPreviewReady();

// Toggle refresh
hcsRefreshDisabled = wp.customize.control('custom_hcs_refresh_toggle').setting();
jQuery('#_customize-input-custom_hcs_refresh_toggle').change(function () {
if (hcsRefreshDisabled) hcsEnableRefresh();
else hcsDisableRefresh();
});

});
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"folders": [
{
"path": "."
},
{
"path": "..\\..\\.."
}
],
"settings": {
"files.exclude": {
"**/index.php": true
}
},
"launch": {
"version": "0.2.0",
"configurations": [
{
"name": "WordPress PHP Debug",
"type": "php",
"request": "launch",
"port": 9003
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 0,
"runtimeArgs": [
"-dxdebug.start_with_request=yes"
],
"env": {
"XDEBUG_MODE": "debug,develop",
"XDEBUG_CONFIG": "client_port=${port}"
}
},
{
"name": "Launch Built-in web server",
"type": "php",
"request": "launch",
"runtimeArgs": [
"-dxdebug.mode=debug",
"-dxdebug.start_with_request=yes",
"-S",
"localhost:0"
],
"program": "",
"cwd": "${workspaceRoot}",
"port": 9003,
"serverReadyAction": {
"pattern": "Development Server \\(http://localhost:([0-9]+)\\) started",
"uriFormat": "http://localhost:%s",
"action": "openExternally"
}
},
{
"name": "WordPress Javascript Debug",
"type": "firefox",
"request": "launch",
"url": "http://wordpress.test",
"webRoot": "C:\\laragon\\www\\wordpress",
}
]
}
}
Loading
Loading