From 8b0a490f753d1a0afa9475ec426074c21d1f8419 Mon Sep 17 00:00:00 2001 From: Nevo Golan <20494189+Nevoss@users.noreply.github.com> Date: Wed, 24 Jul 2024 08:50:05 +0300 Subject: [PATCH] wip --- .github/actions/setup-wp-env/action.yml | 4 +++- .github/workflows/test-actions.yml | 7 ++----- dist/setup-wp-env/create-wp-env-config.js | 15 +++++++-------- src/setup-wp-env/create-wp-env-config.ts | 15 +++++++-------- 4 files changed, 19 insertions(+), 22 deletions(-) diff --git a/.github/actions/setup-wp-env/action.yml b/.github/actions/setup-wp-env/action.yml index 738a24e..3503a72 100644 --- a/.github/actions/setup-wp-env/action.yml +++ b/.github/actions/setup-wp-env/action.yml @@ -41,6 +41,7 @@ runs: INPUT_ACTIVE_THEME: ${{ inputs.active-theme }} INPUT_MAPPINGS: ${{ inputs.mappings }} ACTION_PATH: ${{ github.action_path }} + INPUT_CONFIG: ${{ github.config }} run: | npx zx@8 $ACTION_PATH/../../../dist/setup-wp-env/create-wp-env-config.js \ --wp="$INPUT_WP" \ @@ -49,7 +50,8 @@ runs: --themes="$INPUT_THEMES" \ --active-theme="$INPUT_ACTIVE_THEME" \ --mappings="$INPUT_ACTIVE_THEME" \ - --config-dir="./.wp-env-tmp" + --config="$INPUT_CONFIG" \ + --dir="./.wp-env-tmp" shell: bash - name: Output wp-env config file diff --git a/.github/workflows/test-actions.yml b/.github/workflows/test-actions.yml index 8b3de1b..4bb6d9f 100644 --- a/.github/workflows/test-actions.yml +++ b/.github/workflows/test-actions.yml @@ -24,8 +24,5 @@ jobs: themes: 'https://downloads.wordpress.org/theme/hello-elementor.zip' active-theme: 'hello-elementor' config: | - elementor-templates:./tests/playwright/templates - elementor-config:./tests/wp-env/config - config2: |- - elementor-templates:./tests/playwright/templates - elementor-config:./tests/wp-env/config + ELEMENTOR_SHOW_HIDDEN_EXPERIMENTS:true + SOME_STRING:"THIS IS SOME STRING" diff --git a/dist/setup-wp-env/create-wp-env-config.js b/dist/setup-wp-env/create-wp-env-config.js index 3881b63..9a81f23 100644 --- a/dist/setup-wp-env/create-wp-env-config.js +++ b/dist/setup-wp-env/create-wp-env-config.js @@ -7,10 +7,9 @@ async function main() { plugins, themes, mappings, - "config-dir": configDir, + dir, "active-theme": activeTheme, - config1, - config2 + config } = getOptions({ wp: { type: "string", default: null }, php: { type: "string", default: null }, @@ -22,12 +21,12 @@ async function main() { validate: (value) => typeof value === "string" && /^[a-z0-9-]+$/.test(value) }, mappings: { type: "string", default: "" }, - "config-dir": { type: "string", default: "./" }, + dir: { type: "string", default: "./" }, config1: { type: "string", default: "" }, config2: { type: "string", default: "" } }); - console.log(config1, config2); - const config = { + console.log(config); + const content = { core: wp ? `WordPress/Wordpress#${wp}` : null, phpVersion: php ? php : null, themes: parseAsArray(themes), @@ -43,8 +42,8 @@ async function main() { ) } }; - await fs.ensureDir(configDir); - await fs.writeJSON(`${configDir}/.wp-env.json`, config, { spaces: 2 }); + await fs.ensureDir(dir); + await fs.writeJSON(`${dir}/.wp-env.json`, content, { spaces: 2 }); } function getOptions(args) { const entries = Object.entries(args); diff --git a/src/setup-wp-env/create-wp-env-config.ts b/src/setup-wp-env/create-wp-env-config.ts index b677682..ca64b1f 100644 --- a/src/setup-wp-env/create-wp-env-config.ts +++ b/src/setup-wp-env/create-wp-env-config.ts @@ -7,10 +7,9 @@ async function main() { plugins, themes, mappings, - 'config-dir': configDir, + dir, 'active-theme': activeTheme, - config1, - config2, + config, } = getOptions({ wp: { type: 'string', default: null }, php: { type: 'string', default: null }, @@ -23,14 +22,14 @@ async function main() { typeof value === 'string' && /^[a-z0-9-]+$/.test(value), }, mappings: { type: 'string', default: '' }, - 'config-dir': { type: 'string', default: './' }, + dir: { type: 'string', default: './' }, config1: { type: 'string', default: '' }, config2: { type: 'string', default: '' }, }); - console.log(config1, config2); + console.log(config); - const config = { + const content = { core: wp ? `WordPress/Wordpress#${wp}` : null, phpVersion: php ? php : null, themes: parseAsArray(themes), @@ -48,8 +47,8 @@ async function main() { }, }; - await fs.ensureDir(configDir); - await fs.writeJSON(`${configDir}/.wp-env.json`, config, { spaces: 2 }); + await fs.ensureDir(dir); + await fs.writeJSON(`${dir}/.wp-env.json`, content, { spaces: 2 }); } function getOptions(