Skip to content

Commit 7692784

Browse files
committed
Squashed commit of the following:
commit 8b74e5a Author: Dustin Rue <[email protected]> Date: Wed Aug 21 14:36:32 2024 -0500 Feature/add more flexibility (#413) Co-authored-by: Taylor Lovett <[email protected]>
1 parent 2424022 commit 7692784

22 files changed

+548
-241
lines changed

.changeset/eight-pumpkins-provide.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"10up-toolkit": patch
3+
---
4+
5+
Simple enhancements to toolkit project command to align with devops needs.

packages/toolkit/PROJECTS.md

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -58,42 +58,34 @@ In this scenario, `deploy_from` would be set to `wp` and `deploy_to_subdir` woul
5858

5959
`deploy_type` currently supports `rsync`, `wpe` (WP Engine), and `pantheon`. It defaults to `rsync`. If WPE or Pantheon is choosen, `deploy_to` should contain a Git URL. More deploy types will be added in the future.
6060

61-
The following are additional optional variables that allow you to use custom scripts different than the ones provided by 10up Toolkit. You shouldn't need to use these unless you are doing something super custom. All these paths are relative from the root of your project.
62-
63-
```yaml
64-
deploy_script_path: "" # Custom deploy script
65-
build_script_path: "" # For using a build script in a different location
66-
create_payload_script_path: "" # Custom create payload script
67-
```
68-
6961
## Commands
7062

7163
The project subcommand provides a variety of utlities for creating, building, and deploying 10up-specific projects.
7264

7365
List of commands:
7466

7567
```bash
76-
10up-toolkit project init [<path>] [--template=<Git repository>] [--name=<Project Name>] [--confirm] [--skip-composer]
68+
10up-toolkit project init [--path=<path>] [--layout=<layout>] [--template=<Git repository>] [--name=<Project Name>] [--confirm] [--skip-composer] [--skip-ci]
7769
```
7870

79-
`init` creates a project. You can optionally provide it a number of parameters or answer the prompts. If no path is provided, it will initialize the project in the current directory. You will be prompted to choose a template e.g. [WP Scaffold](https://github.com/10up/wp-scaffold). Init will automatically search and replace prefixes using the project name you provide.
71+
`init` creates a project. You can optionally provide it a number of parameters or answer the prompts. If no path is provided, it will initialize the project in the current directory. If no layout is provided, it will default to `wpcontent` which means the project is rooted in `wp-content` (The other option is `wpparent` where the root of the project is one directory above WordPress). You will be prompted to choose a template e.g. [WP Scaffold](https://github.com/10up/wp-scaffold). Init will automatically search and replace prefixes using the project name you provide.
8072

8173
```bash
82-
10up-toolkit project build
74+
10up-toolkit project build [--type=<type>]
8375
```
8476

85-
`build` simply executes your `scripts/build.sh` file (or other path you specify). `build` will be executed before deploying files.
77+
`build` will build your project e.g. `composer install`, `npm install`, and `npm run build`. It will execute all the `.sh` files in your `scripts/` directory where you can add custom build logic for your particular project. `--type` defaults to local e.g. build for your local environment. In CI, type will be set to `full`.
8678

8779
```bash
88-
10up-toolkit project create-payload <branch>
80+
10up-toolkit project generate-ci [--confirm] [--path=<path>]
8981
```
9082

91-
This command creates a payload directory of the built project (including WordPress) for deployment. Engineers likely won't need to run this command themselves as GitLab does it automatically. You must provide a branch that corresponds to an environment in `.tenup.yml`.
83+
This command generates necessary CI files. For GitLab, this would be `.gitlab-ci.yml`. Right now this only supports GitLab but we will add support for GitHub in the future.
9284

9385
```bash
94-
10up-toolkit project generate-ci [--confirm] [--path=<path>]
86+
10up-toolkit project update-composer
9587
```
9688

97-
This command generates necessary CI files. For GitLab, this would be `.gitlab-ci.yml`. Right now this only supports GitLab but we will add support for GitHub in the future.
89+
Convenience function to update all dependencies in all found composer.json files. Also generates updated lock files.
9890

9991
**Note that generating CI files is currently in alpha and may require manual editing to fix issues.**
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
{
22
"project_name": "10up Project",
33
"php_version": "8.2",
4-
"build_script_path": "",
54
"wordpress_version": "",
6-
"deploy_script_path": "",
7-
"create_payload_script_path": "",
85
"environments": []
96
}

packages/toolkit/project/gitlab/.gitlab-ci.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ build_plugins_and_themes:
2525
stage: build
2626
script:
2727
- nvm install 18
28-
- npx 10up-toolkit project create-payload $CI_COMMIT_REF_NAME
28+
- npx 10up-toolkit project build --type=full
2929
artifacts:
3030
paths:
3131
- payload

packages/toolkit/project/gitlab/deploy-configs/pantheon-production.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ deploy_production:
77
MULTI_DEV_ENVIRONMENT: "{{branch}}"
88
WORDPRESS_VERSION: {{wordpress_version}}
99
GIT_URL: {{deploy_to}}
10-
EXCLUDES: {{deploy_file_excludes}}
10+
EXCLUDES: {{rsync_file_excludes}}
1111
allow_failure: false
1212
only:
1313
refs:

packages/toolkit/project/gitlab/deploy-configs/pantheon-staging.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ deploy_{{branch}}:
77
MULTI_DEV_ENVIRONMENT: "{{branch}}"
88
WORDPRESS_VERSION: {{wordpress_version}}
99
GIT_URL: {{deploy_to}}
10-
EXCLUDES: {{deploy_file_excludes}}
10+
EXCLUDES: {{rsync_file_excludes}}
1111
allow_failure: false
1212
only:
1313
refs:

packages/toolkit/project/gitlab/deploy-configs/rsync-production.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ deploy_production:
77
variables:
88
DESTINATION: {{deploy_to}}
99
SUBDIR: {{deploy_to_subdir}}
10-
EXCLUDES: {{deploy_file_excludes}}
10+
EXCLUDES: {{rsync_file_excludes}}
1111
only:
1212
refs:
1313
- {{branch}}

packages/toolkit/project/gitlab/deploy-configs/rsync-staging.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ deploy_{{branch}}:
77
variables:
88
DESTINATION: {{deploy_to}}
99
SUBDIR: {{deploy_to_subdir}}
10-
EXCLUDES: {{deploy_file_excludes}}
10+
EXCLUDES: {{rsync_file_excludes}}
1111
only:
1212
refs:
1313
- {{branch}}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
payload
2+
build/vendor
3+
build/composer.lock
4+
build/composer.json
5+
/vendor
6+
wordpress/.env
7+
wordpress/*php
8+
wordpress/wp-content/uploads
9+
wordpress/wp-includes
10+
wordpress/wp-admin
11+
wordpress/license.txt
12+
wordpress/readme.html
13+
!wordpress/wp-config.php
14+
docker-compose.override.yml
15+
.config.json
16+
wordpress/wp-content/advanced-cache.php
17+
wordpress/wp-content/mu-plugins/10up-experience.php
18+
wordpress/wp-content/mu-plugins/10up-experience/
19+
wordpress/wp-content/mu-plugins/batcache.php
20+
wordpress/wp-content/mu-plugins/batcache/
21+
wordpress/wp-content/mu-plugins/redis-cache.php
22+
wordpress/wp-content/mu-plugins/redis-cache/
23+
wordpress/wp-content/mu-plugins/s3-uploads.php
24+
wordpress/wp-content/mu-plugins/s3-uploads/
25+
wordpress/wp-content/object-cache.php
26+
.lock
Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
1-
# Add builds scripts here. This script will be run from the root of your project (same directory as .tenup.yml).
1+
#!/usr/bin/env bash -l
2+
# NOTE: you should keep the above line, at line 1. Only modify if you know what you are doing.
23

3-
nvm install
4-
node -v
5-
npm install
4+
# You should use npx 10up-toolkit build to build your project. When you do, there are a number of things
5+
# you get "for free" including nvm handling and the basics of building are handled automatically. You
6+
# only need to provide additional build routines if the default build system doesn't quite get things
7+
# right. Adding build scripts is easy. Create as many .sh files as you need in this scripts directory.
8+
9+
# Here is an example script you can use to get you started It assumes you are using a "modern" layout.
10+
11+
# change directories to your theme or plugin
12+
pushd .
13+
14+
# run your build commands
15+
echo "Hello World!"
16+
17+
# return to where we were so the next build script starts off from the same place
18+
popd

0 commit comments

Comments
 (0)