diff --git a/lib/cli/commands/reset.js b/lib/cli/commands/reset.js index dc11e59..fe54f51 100644 --- a/lib/cli/commands/reset.js +++ b/lib/cli/commands/reset.js @@ -6,6 +6,7 @@ const { wpcli, cli } = require('../../modules/exec'); const run = require('../../modules/run'); const copyVolumes = require('../../modules/copyVolumes'); const getWPInstallType = require('../../modules/getWPInstallType'); +const getEnv = require('../../modules/getEnv'); /** * Restore WP to its initial state. @@ -25,16 +26,32 @@ const reset = async (packageDir, logFile, options) => { await cli(`bash update.sh ${version} true`, logFile); - if (!options.volumes) { + const workingDir = getEnv('WORKING_DIR'); + const noDockerMode = getEnv('NO_DOCKER_MODE'); + + if (!options.volumes || noDockerMode === 'true') { await copyVolumes(config.volumes, config.wpContent, logFile); } + await run( + async () => + cli(`composer install -d ${workingDir}/html/wp-content/plugins/wp-cypress`, logFile), + 'Installing wp-cypress dependencies', + 'Dependencies installed', + logFile, + ); + const locale = get(config, ['locale'], 'en_US'); + const dbHost = getEnv('DB_HOST'); + const dbName = getEnv('DB_NAME'); + const dbUser = getEnv('DB_USER'); + const dbPass = getEnv('DB_PASS'); + await run( async () => wpcli( - `core config --dbhost=db --dbname=wordpress --dbuser=root --dbpass="" --locale=${locale} --extra-php`, + `core config --dbhost=${dbHost} --dbname=${dbName} --dbuser=${dbUser} --dbpass="${dbPass}" --locale=${locale} --extra-php`, logFile, ` @@ -138,6 +155,22 @@ if( file_exists ( ABSPATH . '.userid' ) ) { ); } + if (config.pluginsActivatedAfterTheme.length > 0) { + await run( + async () => + wpcli( + `plugin activate wp-cypress ${config.pluginsActivatedAfterTheme.join(' ')} ${ + config.multisite ? '--network' : '' + }`, + logFile, + ), + 'Activating theme-dependent plugins', + 'Activated theme-dependent plugins', + logFile, + false, + ); + } + await run( async () => wpcli('seed DefaultUsers', logFile), 'Creating default users', diff --git a/lib/cli/commands/start.js b/lib/cli/commands/start.js index 07addfb..28e7dad 100644 --- a/lib/cli/commands/start.js +++ b/lib/cli/commands/start.js @@ -2,10 +2,10 @@ const shell = require('shelljs'); const retryCommand = require('../../modules/retryCommand'); const createConfig = require('../../modules/createConfig'); -const { exec, cli } = require('../../modules/exec'); +const { exec, cli, wpcli } = require('../../modules/exec'); const run = require('../../modules/run'); const reset = require('./reset'); - +const getEnv = require('../../modules/getEnv'); /** * Start the docker the test container and wait for the database to be connected. * @@ -17,37 +17,74 @@ const reset = require('./reset'); */ const start = async (packageDir, options, logFile) => { const config = await createConfig(packageDir, options.volumes); + const workingDir = getEnv('WORKING_DIR'); - await run( - async () => exec('docker ps -q', logFile), - 'Checking for Docker', - 'Docker found', - logFile, - ); + if (getEnv('NO_DOCKER_MODE') !== 'true') { + await run( + async () => exec('docker ps -q', logFile), + 'Checking for Docker', + 'Docker found', + logFile, + ); - if (config.wpContent) { - shell.rm('-rf', `${config.wpContent.path}/plugins/wp-cypress`); - } + shell.cd(packageDir); - shell.cd(packageDir); + await run( + async () => + exec( + 'docker-compose down --volumes && docker-compose build && docker-compose up -d', + logFile, + ), + 'Creating test container', + 'Test container created', + logFile, + ); - await run( - async () => - exec( - 'docker-compose down --volumes && docker-compose build && docker-compose up -d', + await run( + async () => retryCommand(() => cli('mysqladmin ping -h"db"', logFile), 2000, 30), + 'Waiting for database connection', + 'Database connected', + logFile, + ); + } else { + shell.mkdir('-p', `${workingDir}/html`); + shell.cp(`${packageDir}/update.sh`, `${workingDir}/html`); + shell.cp(`${packageDir}/config/${config.htaccessFile}`, `${workingDir}/html/.htaccess`); + + const coreDownloads = config.version.map(async (version) => + run( + async () => + wpcli( + `core download --version="${version}" --path="${workingDir}/${version}" --force`, + logFile, + ), + `Downloading WordPress ${version}`, + `Downloaded WordPress ${version}`, logFile, ), - 'Creating test container', - 'Test container created', - logFile, - ); - - await run( - async () => retryCommand(() => cli('mysqladmin ping -h"db"', logFile), 2000, 30), - 'Waiting for database connection', - 'Database connected', - logFile, - ); + ); + + await Promise.all(coreDownloads); + + if (config.wpContent) { + config.version.forEach((version) => { + shell.rm('-rf', `${workingDir}/${version}/wp-content`); + }); + } + + if (config.vip) { + await run( + async () => + exec( + `curl https://github.com/Automattic/vip-go-mu-plugins-built/archive/master.zip -L -o /usr/src/vip-mu-plugins.zip && unzip /usr/src/vip-mu-plugins.zip -d ${workingDir}/html/wp-content && cd ${workingDir}/html/wp-content && mv vip-go-mu-plugins-built-master mu-plugins`, + logFile, + ), + 'Downloading VIP MU Plugins', + 'Downloaded VIP MU Plugins', + logFile, + ); + } + } await reset(packageDir, logFile, options); }; diff --git a/lib/cli/index.js b/lib/cli/index.js index 897a229..9b60e37 100644 --- a/lib/cli/index.js +++ b/lib/cli/index.js @@ -1,14 +1,19 @@ -const fs = require('fs'); +const fs = require('fs-extra'); const { program } = require('commander'); +const applyEnvDefaults = require('../modules/applyEnvDefaults'); +const getConfigFile = require('../utils/get-config-file'); require('pretty-error').start(); const { version, name } = require('../../package.json'); const packageDir = `${process.cwd()}/node_modules/${name}`; -const logFile = fs.createWriteStream(`${packageDir}/debug.log`, { - flags: 'a', -}); +const config = getConfigFile(); + +// Set ENV variables +applyEnvDefaults(config); + +const logFile = fs.createWriteStream(`${packageDir}/debug.log`); const start = require('./commands/start'); const stop = require('./commands/stop'); diff --git a/lib/modules/applyEnvDefaults.js b/lib/modules/applyEnvDefaults.js new file mode 100644 index 0000000..1dfe958 --- /dev/null +++ b/lib/modules/applyEnvDefaults.js @@ -0,0 +1,47 @@ +const applyEnvDefaults = (config) => { + // All env vars will be prefixed with `WP_CYPRESS_` + const defaults = [ + { + name: 'WORKING_DIR', + config: config.wp.workingDir, + default: '/var/www', + }, + { + name: 'NO_DOCKER_MODE', + config: config.wp.noDocker, + default: 'false', + }, + { + name: 'DB_NAME', + config: config.wp.dbName, + default: 'wordpress', + }, + { + name: 'DB_USER', + config: config.wp.dbUser, + default: 'root', + }, + { + name: 'DB_PASS', + config: config.wp.dbPass, + default: '', + }, + { + name: 'DB_HOST', + config: config.wp.dbHost, + default: 'db', + }, + ]; + + defaults.forEach((env) => { + if (!process.env[`WP_CYPRESS_${env.name}`]) { + if (env.config) { + process.env[`WP_CYPRESS_${env.name}`] = env.config; + } else { + process.env[`WP_CYPRESS_${env.name}`] = env.default; + } + } + }); +}; + +module.exports = applyEnvDefaults; diff --git a/lib/modules/copyVolumes.js b/lib/modules/copyVolumes.js index 5528c51..7afe001 100644 --- a/lib/modules/copyVolumes.js +++ b/lib/modules/copyVolumes.js @@ -1,6 +1,7 @@ const path = require('path'); const { exec, cli } = require('./exec'); const run = require('./run'); +const getEnv = require('./getEnv'); /** * Copy a file|folder on the host to the container. @@ -28,6 +29,26 @@ const copyToContainer = async (location, destination, logFile) => { } }; +/** + * Copy a file|folder on the host to the working directory. + * @param {string} location + * @param {location} destination + * @param {*} logFile + */ +const copyToWorkingDir = async (location, destination, logFile) => { + if (destination) { + const name = path.basename(destination); + // eslint-disable-next-line no-await-in-loop + await run( + async () => + exec(`mkdir -p $(dirname ${destination}) && cp -R ${location} ${destination}`, logFile), + `Copying ${name}`, + `Copied ${name}`, + logFile, + ); + } +}; + /** * Copy volumes instead of mounting. * @@ -38,15 +59,23 @@ const copyToContainer = async (location, destination, logFile) => { * @return {Promise} */ const copyVolumes = async (volumes, isWpContent, logFile) => { + const workingDir = getEnv('WORKING_DIR'); + const noDockerMode = getEnv('NO_DOCKER_MODE'); // eslint-disable-next-line no-restricted-syntax for (const [i, volume] of volumes.entries()) { const [location, destination] = volume.split(':'); - // eslint-disable-next-line no-await-in-loop - await copyToContainer(location, destination, logFile); - if (isWpContent && i === 0) { + if (noDockerMode === 'true') { // eslint-disable-next-line no-await-in-loop - await cli('mkdir -p /var/www/html/wp-content/plugins'); + await copyToWorkingDir(location, destination, logFile); + } else { + // eslint-disable-next-line no-await-in-loop + await copyToContainer(location, destination, logFile); + + if (isWpContent && i === 0) { + // eslint-disable-next-line no-await-in-loop + await cli(`mkdir -p ${workingDir}/html/wp-content/plugins`); + } } } }; diff --git a/lib/modules/createConfig.js b/lib/modules/createConfig.js index 3c6ea83..8a5339c 100644 --- a/lib/modules/createConfig.js +++ b/lib/modules/createConfig.js @@ -4,12 +4,13 @@ const path = require('path'); const glob = require('glob'); const { get, defaults } = require('lodash'); const Ajv = require('ajv'); -const semver = require('semver'); const createDefaultSeeds = require('./createDefaultSeeds'); const getThemeAndPluginData = require('./getThemeAndPluginData'); const renderTemplate = require('./renderTemplate'); const getValidVersions = require('./getValidVersions'); +const getEnv = require('./getEnv'); +const getConfigFile = require('../utils/get-config-file'); // Initialize the validation object. const validation = new Ajv({ allErrors: true, jsonPointers: true }); @@ -30,19 +31,12 @@ const WP_CONTENT_EXCLUDE_PATHS = ['uploads', 'upgrade', 'node_modules', 'cypress const createConfig = async (packageDir, hasVolumeSupport = true) => { const CWD = process.cwd(); - // eslint-disable-next-line import/no-unresolved - const { version: cypressVersion } = require('../../../../cypress/package.json'); - - let configFile; - - if (semver.gt(cypressVersion, '10.0.0')) { - configFile = await require(`${CWD}/cypress.config.js`); - } else { - configFile = await fs.readJSON(`${CWD}/cypress.json`); - } + const configFile = getConfigFile(); const { wp = {}, integrationFolder } = configFile; + const workingDir = getEnv('WORKING_DIR'); + const config = defaults(wp, { seedsPath: 'cypress/seeds', wpContent: false, @@ -70,6 +64,7 @@ const createConfig = async (packageDir, hasVolumeSupport = true) => { let volumes = []; let activePlugins = []; let activeTheme = false; + let pluginsActivatedAfterTheme = []; if (config.wpContent) { const pathToWPContent = path.resolve(config.wpContent.path); @@ -86,7 +81,7 @@ const createConfig = async (packageDir, hasVolumeSupport = true) => { glob.sync(`${pathToWPContent}/*`, { ignore }).forEach((location) => { const destination = path.relative(pathToWPContent, location); - volumes.push(`${location}:/var/www/html/wp-content/${destination}`); + volumes.push(`${location}:${workingDir}/html/wp-content/${destination}`); }); if (config.wpContent.activePlugins) { @@ -96,6 +91,10 @@ const createConfig = async (packageDir, hasVolumeSupport = true) => { if (config.wpContent.activeTheme) { activeTheme = config.wpContent.activeTheme; } + + if (config.wpContent.pluginsActivatedAfterTheme) { + pluginsActivatedAfterTheme = config.wpContent.pluginsActivatedAfterTheme; + } } else { const { plugins, themes } = getThemeAndPluginData(config.plugins, config.themes); @@ -115,12 +114,12 @@ const createConfig = async (packageDir, hasVolumeSupport = true) => { createDefaultSeeds(seedsDir, packageDir); volumes.push( - `${seedsDir}:/var/www/html/seeds`, - `${packageDir}/plugin:/var/www/html/wp-content/plugins/wp-cypress`, + `${seedsDir}:${workingDir}/html/seeds`, + `${packageDir}/plugin:${workingDir}/html/wp-content/plugins/wp-cypress`, ); if (config.configFile) { - volumes.push(`${path.resolve(config.configFile)}:/var/www/html/wp-cypress-config.php`); + volumes.push(`${path.resolve(config.configFile)}:${workingDir}/html/wp-cypress-config.php`); } if (config.customDatabase) { @@ -130,7 +129,7 @@ const createConfig = async (packageDir, hasVolumeSupport = true) => { if (config.muPlugins && config.muPlugins.path) { const muPluginsLocation = path.resolve(config.muPlugins.path); const muPluginsDestination = config.muPlugins.vip ? 'client-mu-plugins' : 'mu-plugins'; - volumes.push(`${muPluginsLocation}:/var/www/html/wp-content/${muPluginsDestination}`); + volumes.push(`${muPluginsLocation}:${workingDir}/html/wp-content/${muPluginsDestination}`); } const version = Array.isArray(config.version) ? config.version : [config.version]; @@ -161,6 +160,7 @@ const createConfig = async (packageDir, hasVolumeSupport = true) => { phpVersion: config.phpVersion || 7.4, phpMemoryLimit: config.phpMemoryLimit || '128M', htaccessFile, + workingDir, }); const wpCypressConfig = { @@ -170,10 +170,12 @@ const createConfig = async (packageDir, hasVolumeSupport = true) => { volumes, activePlugins, activeTheme, + pluginsActivatedAfterTheme, // We need to store the user integration folder because we replace cypress's // configuration path to the integration folder with a path to the // temp integration folder, but we still need to be aware of the original. userIntegrationFolder: integrationFolder || `${CWD}/cypress/integration`, + htaccessFile, }; fs.writeJSONSync(`${packageDir}/config.json`, wpCypressConfig); diff --git a/lib/modules/exec.js b/lib/modules/exec.js index 4294e0d..2e8f9ac 100644 --- a/lib/modules/exec.js +++ b/lib/modules/exec.js @@ -1,4 +1,5 @@ const shell = require('shelljs'); +const getEnv = require('./getEnv'); /** * Execute a command. @@ -56,9 +57,28 @@ const exec = (cmd, logFile, stdin) => }); }); +const cli = (command, logFile, stdin) => { + const workingDir = getEnv('WORKING_DIR'); + + if (getEnv('NO_DOCKER_MODE') === 'true') { + return exec(`cd ${workingDir}/html && ${command}`, logFile, stdin); + } + + return exec(`docker-compose exec -T wp ${command}`, logFile, stdin); +}; + +const wpcli = (command, logFile, stdin) => { + const workingDir = getEnv('WORKING_DIR'); + + if (getEnv('NO_DOCKER_MODE') === 'true') { + return exec(`cd ${workingDir}/html && wp --allow-root ${command}`, logFile, stdin); + } + + return exec(`docker-compose exec -T wp wp --allow-root ${command}`, logFile, stdin); +}; + module.exports = { exec, - cli: (command, logFile, stdin) => exec(`docker-compose exec -T wp ${command}`, logFile, stdin), - wpcli: (command, logFile, stdin) => - exec(`docker-compose exec -T wp wp --allow-root ${command}`, logFile, stdin), + cli, + wpcli, }; diff --git a/lib/modules/getEnv.js b/lib/modules/getEnv.js new file mode 100644 index 0000000..3c21a0a --- /dev/null +++ b/lib/modules/getEnv.js @@ -0,0 +1,4 @@ +const getEnv = (name) => + // All env vars will be prefixed with `WP_CYPRESS_` + process.env[`WP_CYPRESS_${name}`]; +module.exports = getEnv; diff --git a/lib/modules/getThemeAndPluginData.js b/lib/modules/getThemeAndPluginData.js index 18f4e67..f1ca70b 100644 --- a/lib/modules/getThemeAndPluginData.js +++ b/lib/modules/getThemeAndPluginData.js @@ -1,5 +1,6 @@ const path = require('path'); const glob = require('glob'); +const getEnv = require('./getEnv'); /** * Retrieve the required plug or theme data from config. @@ -13,6 +14,7 @@ const glob = require('glob'); * }} */ const getThemeAndPluginData = (pluginGlobs = [], themeGlobs = []) => { + const workingDir = getEnv('WORKING_DIR'); const plugins = []; const themes = []; @@ -24,7 +26,7 @@ const getThemeAndPluginData = (pluginGlobs = [], themeGlobs = []) => { const item = { name, path: file, - volume: `${file}:/var/www/html/wp-content/plugins/${name}`, + volume: `${file}:${workingDir}/html/wp-content/plugins/${name}`, }; if (!plugins.some((y) => y.path === item.path)) { @@ -41,7 +43,7 @@ const getThemeAndPluginData = (pluginGlobs = [], themeGlobs = []) => { const item = { name, path: file, - volume: `${file}:/var/www/html/wp-content/themes/${name}`, + volume: `${file}:${workingDir}/html/wp-content/themes/${name}`, }; if (!themes.some((y) => y.path === item.path)) { diff --git a/lib/schemas/config-validation.json b/lib/schemas/config-validation.json index d13cd03..8113a71 100644 --- a/lib/schemas/config-validation.json +++ b/lib/schemas/config-validation.json @@ -20,6 +20,10 @@ "type": "string", "errorMessage": "wp.seedsPath is not a string" }, + "noDocker": { + "type": "boolean", + "errorMessage": "wp.noDocker is not true or false" + }, "adminUsername": { "type": "string", "errorMessage": "wp.adminUsername is not a string" @@ -121,6 +125,13 @@ "type": "string" }, "errorMessage": "wp.wpContent.activePlugins is not an array of strings" + }, + "pluginsActivatedAfterTheme": { + "type": "array", + "items": { + "type": "string" + }, + "errorMessage": "wp.wpContent.pluginsActivatedAfterTheme is not an array of strings" } }, "required": [ diff --git a/lib/templates/dockerfile.ejs b/lib/templates/dockerfile.ejs index 58c5007..418aeab 100644 --- a/lib/templates/dockerfile.ejs +++ b/lib/templates/dockerfile.ejs @@ -6,13 +6,13 @@ RUN apt-get update && apt-get install -y wget libpng-dev libjpeg-dev gnupg defau RUN a2enmod rewrite -COPY update.sh /var/www/html +COPY update.sh <%= workingDir %>/html ENV PHP_MEMORY_LIMIT=<%= phpMemoryLimit %> COPY config/php.ini /usr/local/etc/php -COPY config/<%= htaccessFile %> /var/www/html/.htaccess +COPY config/<%= htaccessFile %> <%= workingDir %>/html/.htaccess RUN curl -o /bin/wp https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \ && chmod +x /bin/wp \ @@ -24,17 +24,17 @@ RUN curl -sS https://getcomposer.org/installer --output composer-setup.php \ <% versions.forEach((version) => { %> RUN curl https://wordpress.org/wordpress-<%= version %>.tar.gz > wordpress-<%= version %>.tar.gz && \ - mkdir -p /var/www/<%= version %> && \ - tar -xzf wordpress-<%= version %>.tar.gz -C /var/www/<%= version %> && \ - mv /var/www/<%= version %>/wordpress/* /var/www/<%= version %> && \ - rm -rf /var/www/<%= version %>/wordpress && \ - chown -R www-data:www-data /var/www/<%= version %><% if (isWpContent) { %> && \<% } else { %>;<% } %> - <% if (isWpContent) { %>rm -rf /var/www/<%= version %>/wp-content;<% } %> + mkdir -p <%= workingDir %>/<%= version %> && \ + tar -xzf wordpress-<%= version %>.tar.gz -C <%= workingDir %>/<%= version %> && \ + mv <%= workingDir %>/<%= version %>/wordpress/* <%= workingDir %>/<%= version %> && \ + rm -rf <%= workingDir %>/<%= version %>/wordpress && \ + chown -R www-data:www-data <%= workingDir %>/<%= version %><% if (isWpContent) { %> && \<% } else { %>;<% } %> + <% if (isWpContent) { %>rm -rf <%= workingDir %>/<%= version %>/wp-content;<% } %> <% }); %> <% if (vip) { %> RUN curl https://github.com/Automattic/vip-go-mu-plugins-built/archive/master.zip -L -o /usr/src/vip-mu-plugins.zip && \ - unzip /usr/src/vip-mu-plugins.zip -d /var/www/html/wp-content && cd /var/www/html/wp-content && mv vip-go-mu-plugins-built-master mu-plugins + unzip /usr/src/vip-mu-plugins.zip -d <%= workingDir %>/html/wp-content && cd <%= workingDir %>/html/wp-content && mv vip-go-mu-plugins-built-master mu-plugins <% } %> EXPOSE 80 diff --git a/lib/utils/get-config-file.js b/lib/utils/get-config-file.js new file mode 100644 index 0000000..316d9c1 --- /dev/null +++ b/lib/utils/get-config-file.js @@ -0,0 +1,22 @@ +const semver = require('semver'); +const fs = require('fs-extra'); + +const getConfigFile = () => { + const CWD = process.cwd(); + + // eslint-disable-next-line import/no-dynamic-require,global-require + const { version: cypressVersion } = require(`${CWD}/node_modules/cypress/package.json`); + + let configFile; + + if (semver.gt(cypressVersion, '10.0.0')) { + // eslint-disable-next-line import/no-dynamic-require,global-require + configFile = require(`${CWD}/cypress.config.js`); + } else { + configFile = fs.readJSON(`${CWD}/cypress.json`); + } + + return configFile; +}; + +module.exports = getConfigFile; diff --git a/package-lock.json b/package-lock.json index 3e02ad4..5003abf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@bigbite/wp-cypress", - "version": "0.13.2", + "version": "1.0.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -43,9 +43,9 @@ }, "dependencies": { "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true }, "source-map": { @@ -68,9 +68,9 @@ }, "dependencies": { "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true } } @@ -107,9 +107,9 @@ }, "dependencies": { "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true } } @@ -1507,9 +1507,9 @@ }, "dependencies": { "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true } } @@ -3228,9 +3228,9 @@ }, "dependencies": { "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true } } @@ -4125,9 +4125,9 @@ }, "dependencies": { "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true } } @@ -4849,9 +4849,9 @@ } }, "semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "requires": { "lru-cache": "^6.0.0" } diff --git a/package.json b/package.json index 22c8b79..21a2d6e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bigbite/wp-cypress", - "version": "0.13.2", + "version": "1.0.0", "description": "WordPress end to end testing with Cypress.io", "repository": "https://github.com/bigbite/wp-cypress", "author": { @@ -58,7 +58,7 @@ "ora": "^4.0.3", "prettier": "^2.5.1", "pretty-error": "^4.0.0", - "semver": "^7.3.7", + "semver": "^7.5.4", "shelljs": "^0.8.5" } } diff --git a/plugin/plugin.php b/plugin/plugin.php index 29b4c64..5095b80 100755 --- a/plugin/plugin.php +++ b/plugin/plugin.php @@ -5,7 +5,7 @@ * Description: Modifications for a test environment with Cypress. * Author: Big Bite * Author URI: https://bigbite.net - * Version: 1.0.0 + * Version: 1.0.0-rc.5 */ if ( ! defined( 'WP_CYPRESS_PLUGIN' ) ) { diff --git a/update.sh b/update.sh index 11b9e64..88c12d0 100644 --- a/update.sh +++ b/update.sh @@ -5,7 +5,7 @@ shopt -s extglob rm -rf !(wp-config.php|wp-cypress-config.php|seeds|wp-content|update.sh|.htaccess) # Ensure uploads work -if ${HARD_RESET}; then rm -rf /var/www/html/wp-content/uploads && mkdir -p /var/www/html/wp-content/uploads && chmod -R 777 /var/www/html/wp-content/uploads; fi +if ${HARD_RESET}; then rm -rf wp-content/uploads && mkdir -p wp-content/uploads && chmod -R 777 wp-content/uploads; fi if ${HARD_RESET}; then rm wp-config.php; fi