diff --git a/.changeset/poor-birds-rhyme.md b/.changeset/poor-birds-rhyme.md new file mode 100644 index 00000000..1161255d --- /dev/null +++ b/.changeset/poor-birds-rhyme.md @@ -0,0 +1,5 @@ +--- +"10up-toolkit": patch +--- + +Fix init command diff --git a/packages/toolkit/PROJECTS.md b/packages/toolkit/PROJECTS.md index a14d71c7..6b1f8ca2 100644 --- a/packages/toolkit/PROJECTS.md +++ b/packages/toolkit/PROJECTS.md @@ -64,7 +64,6 @@ The following are additional optional variables that allow you to use custom scr deploy_script_path: "" # Custom deploy script build_script_path: "" # For using a build script in a different location create_payload_script_path: "" # Custom create payload script -deploy_file_excludes: "" # Custom deploy file exclusions ``` ## Commands diff --git a/packages/toolkit/project/default-variables.json b/packages/toolkit/project/default-variables.json index 7c0c1351..b1b1a4a7 100644 --- a/packages/toolkit/project/default-variables.json +++ b/packages/toolkit/project/default-variables.json @@ -4,7 +4,6 @@ "build_script_path": "", "wordpress_version": "", "deploy_script_path": "", - "deploy_file_excludes": "", "create_payload_script_path": "", "environments": [] } diff --git a/packages/toolkit/project/gitlab/.gitlab-ci.tmpl b/packages/toolkit/project/gitlab/.gitlab-ci.tmpl index 235d7e86..18f6ff5d 100644 --- a/packages/toolkit/project/gitlab/.gitlab-ci.tmpl +++ b/packages/toolkit/project/gitlab/.gitlab-ci.tmpl @@ -7,21 +7,6 @@ include: ref: trunk file: /main.yml -setup_10up_toolkit: - stage: .pre - script: | - if [ ! -d "toolkit" ] ; then - git clone --verbose -b project-command https://github.com/10up/10up-toolkit.git toolkit - fi - rm -rf 10up-toolkit - ln -s toolkit/packages/toolkit/bin/10up-toolkit.js 10up-toolkit - cd toolkit - npm install - artifacts: - paths: - - toolkit - - 10up-toolkit - test_syntax: stage: test script: @@ -39,7 +24,8 @@ test_virusscan: build_plugins_and_themes: stage: build script: - - ./10up-toolkit project create-payload $CI_COMMIT_REF_NAME + - nvm install 18 + - npx 10up-toolkit@next project create-payload $CI_COMMIT_REF_NAME artifacts: paths: - payload diff --git a/packages/toolkit/project/deploy-file-excludes.txt b/packages/toolkit/project/local/scripts/deploy-excludes.txt similarity index 100% rename from packages/toolkit/project/deploy-file-excludes.txt rename to packages/toolkit/project/local/scripts/deploy-excludes.txt diff --git a/packages/toolkit/scripts/project/bash/build-setup.sh b/packages/toolkit/scripts/project/bash/build-setup.sh index 642fa0b6..a6c5eb7b 100644 --- a/packages/toolkit/scripts/project/bash/build-setup.sh +++ b/packages/toolkit/scripts/project/bash/build-setup.sh @@ -1,3 +1,5 @@ +#!/bin/bash + maybe_init_nvm() { if [ $(find . -name .nvmrc | wc -l) -gt 0 ] && [ ! -f $NVM_DIR/nvm.sh ]; then diff --git a/packages/toolkit/scripts/project/bash/create-payload.sh b/packages/toolkit/scripts/project/bash/create-payload.sh index bab0e5bb..91309781 100644 --- a/packages/toolkit/scripts/project/bash/create-payload.sh +++ b/packages/toolkit/scripts/project/bash/create-payload.sh @@ -1,3 +1,5 @@ +#!/bin/bash + download() { if [ `which curl` ]; then curl -s "$1" > "$2"; @@ -15,6 +17,4 @@ download https://wordpress.org/wordpress-${WORDPRESS_VERSION}.tar.gz wordpress.t tar --strip-components=1 -zxmf wordpress.tar.gz -C . rm wordpress.tar.gz -echo "rsync -avz --exclude-from=$deploy_file_excludes $project_root/$deploy_from $deploy_to_subdir" - -rsync -avz --exclude-from=$deploy_file_excludes $project_root/$deploy_from $deploy_to_subdir +rsync -avz --exclude-from=$deploy_file_excludes_absolute $project_root/$deploy_from $deploy_to_subdir diff --git a/packages/toolkit/scripts/project/bash/init.sh b/packages/toolkit/scripts/project/bash/init.sh index 4a54316d..25014c0f 100644 --- a/packages/toolkit/scripts/project/bash/init.sh +++ b/packages/toolkit/scripts/project/bash/init.sh @@ -1,3 +1,5 @@ +#!/bin/bash + # Create dir if it does not exist if [ ! -d "$init_path" ]; then mkdir -p "$init_path" @@ -20,7 +22,7 @@ fi LANG=C if [ "$(uname)" = "Darwin" ]; then - sediopt=( -i '') + sediopt=( -i '' ) else sediopt=( -i ) fi diff --git a/packages/toolkit/scripts/project/create-payload.js b/packages/toolkit/scripts/project/create-payload.js index ddd840fd..81134707 100644 --- a/packages/toolkit/scripts/project/create-payload.js +++ b/packages/toolkit/scripts/project/create-payload.js @@ -53,7 +53,7 @@ const run = async () => { await require('./build').run(); if (fs.existsSync(variables.create_payload_script_path)) { - execSync(`sh ${variables.create_payload_script_path}`, { stdio: 'inherit' }); + execSync(`bash ${variables.create_payload_script_path}`, { stdio: 'inherit' }); } log(chalk.green('Payload created.')); diff --git a/packages/toolkit/scripts/project/init.js b/packages/toolkit/scripts/project/init.js index 054f6504..b5be9b96 100644 --- a/packages/toolkit/scripts/project/init.js +++ b/packages/toolkit/scripts/project/init.js @@ -126,7 +126,7 @@ const run = async () => { const initScript = `${__dirname}/bash/init.sh`; - execSync(`sh ${initScript}`, { stdio: 'inherit' }); + execSync(`bash ${initScript}`, { stdio: 'inherit' }); // Load the contents of the .tenup.yml file into a string let configFile = fs.readFileSync(`${path}/.tenup.yml`, 'utf8'); diff --git a/packages/toolkit/utils/project.js b/packages/toolkit/utils/project.js index 4bbf5603..762eb5a1 100644 --- a/packages/toolkit/utils/project.js +++ b/packages/toolkit/utils/project.js @@ -136,9 +136,8 @@ const getProjectVariables = (path = '.') => { data.build_script_path = `${projectRoot}/scripts/build.sh`; } - if (!data.deploy_file_excludes) { - data.deploy_file_excludes = `./toolkit/packages/toolkit/project/deploy-file-excludes.txt`; - } + data.deploy_file_excludes = `./scripts/deploy-excludes.txt`; + data.deploy_file_excludes_absolute = `${projectRoot}/scripts/deploy-excludes.txt`; data.toolkit_path = resolve(`${__dirname}/../`);