Skip to content

Commit 3f1fb4b

Browse files
committed
Improving local dev setup - Playwright, Prettier, wp-now, third-party plugins; Add GitHub release workflow
1 parent dc61354 commit 3f1fb4b

File tree

11 files changed

+152
-162
lines changed

11 files changed

+152
-162
lines changed

.github/workflows/release.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Release
2+
permissions:
3+
contents: write
4+
on: push
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v4
11+
with:
12+
fetch-depth: 0
13+
- name: Setup Bun
14+
uses: oven-sh/setup-bun@v2
15+
- name: Install dependencies
16+
run: bun install
17+
- name: Create archive
18+
run: bun run archive -y
19+
- name: Install pipeline
20+
run: mkdir -p publish && cd publish && git clone https://github.com/tangibleinc/pipeline
21+
- name: Add latest tag as needed
22+
uses: EndBug/latest-tag@latest
23+
if: ${{ ! startsWith(github.ref, 'refs/tags/') }}
24+
- name: Before release script
25+
run: bun run publish/pipeline/before-release.ts
26+
- name: Release tag
27+
uses: softprops/action-gh-release@v2
28+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
29+
with:
30+
body_path: publish/release.md
31+
files: publish/*.zip
32+
- name: Release preview at latest commit
33+
uses: softprops/action-gh-release@v2
34+
if: ${{ ! startsWith(github.ref, 'refs/tags/') }}
35+
with:
36+
body_path: publish/release.md
37+
files: publish/*.zip
38+
tag_name: latest
39+
make_latest: true
40+
- name: After release script
41+
run: bun run publish/pipeline/after-release.ts

.prettierrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"semi": false,
3+
"singleQuote": true,
4+
"tabWidth": 2,
5+
"useTabs": false
6+
}

.wp-env.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22
"core": "WordPress/WordPress",
33
"phpVersion": "8.2",
44
"plugins": [
5+
"."
56
],
6-
"themes": [
7-
"./tests/empty-block-theme"
8-
],
9-
"mappings": {
10-
"wp-content/plugins/tangible-loops-and-logic": "."
11-
},
12-
"port": 4660,
13-
"testsPort": 4661,
147
"config": {
8+
"WP_DEBUG": true,
159
"WP_DEBUG_LOG": true
10+
},
11+
"mappings": {
12+
"wp-content/plugins/advanced-custom-fields": "./vendor/tangible-dev/advanced-custom-fields",
13+
"wp-content/plugins/beaver-builder-lite-version": "./vendor/tangible-dev/beaver-builder-lite-version",
14+
"wp-content/plugins/elementor": "./vendor/tangible-dev/elementor",
15+
"wp-content/plugins/tangible-e2e-plugin": "./vendor/tangible/template-system/framework/env/e2e-plugin",
16+
"wp-content/themes/empty-block-theme": "./vendor/tangible/template-system/framework/empty-block-theme"
1617
}
1718
}

bitbucket-pipelines.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

blueprint.dev.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"landingPage": "/wp-admin/edit.php?post_type=tangible_template",
3+
"steps": [
4+
{
5+
"step": "defineWpConfigConsts",
6+
"consts": {
7+
"WP_DEBUG": true
8+
},
9+
"method": "rewrite-wp-config"
10+
},
11+
{
12+
"step": "login",
13+
"username": "admin",
14+
"password": "password"
15+
},
16+
{
17+
"step": "activatePlugin",
18+
"pluginPath": "/var/www/html/wp-content/plugins/tangible-e2e-plugin"
19+
}
20+
]
21+
}

package.json

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
"type": "module",
44
"private": true,
55
"scripts": {
6-
"start": "wp-now start --open",
6+
"start": "wp-now start --blueprint=blueprint.dev.json",
77
"dev": "roll dev",
88
"build": "roll build",
99
"format": "roll format",
10-
"deps": "roll install",
10+
"postinstall": "roll install",
11+
"install:dev": "roll install --dev",
12+
"update:dev": "roll update --dev",
1113
"archive": "roll archive && rm -rf publish/tangible-loops-and-logic && unzip publish/tangible-loops-and-logic.zip -d publish/ && npm run test:archive",
1214
"// Test": "",
1315
"test": "roll run tests/index.ts",
@@ -23,11 +25,11 @@
2325
},
2426
"dependencies": {},
2527
"devDependencies": {
26-
"@playwright/test": "^1.44.1",
27-
"@tangible/now": "^1.0.8",
28-
"@tangible/roller": "^2.0.4",
29-
"@wordpress/e2e-test-utils-playwright": "^1.0.0",
28+
"@playwright/test": "^1.49.0",
29+
"@tangible/now": "^1.1.3",
30+
"@tangible/roller": "^2.1.4",
31+
"@wordpress/e2e-test-utils-playwright": "^1.12.0",
3032
"chokidar-cli": "^3.0.0",
31-
"testra": "^2.1.3"
33+
"testra": "^2.1.4"
3234
}
3335
}

playwright.config.js

Lines changed: 0 additions & 107 deletions
This file was deleted.

tangible.config.js

Lines changed: 54 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
1-
import templateSystemConfig from './vendor/tangible/template-system/tangible.config.js'
2-
3-
const relativeToTemplateSystem = pattern => `./vendor/tangible/template-system/${
4-
pattern.replace('^\/', '')
5-
}`
6-
71
export default {
82
build: [
9-
103
// Frontend - See includes/enqueue.php
114

125
// {
@@ -22,31 +15,69 @@ export default {
2215

2316
{
2417
src: 'assets/src/admin.scss',
25-
dest: 'assets/build/admin.min.css'
18+
dest: 'assets/build/admin.min.css',
2619
},
2720
],
28-
install: [
29-
{
30-
git: 'git@github.com:tangibleinc/template-system',
31-
branch: 'main'
32-
}
33-
],
34-
format: [
35-
'**/*.{php,js,json,scss}',
36-
'!assets/build'
37-
],
21+
format: ['**/*.{php,js,json,scss}', '!assets/build'],
3822
archive: {
23+
dest: 'publish/tangible-loops-and-logic.zip',
24+
root: 'tangible-loops-and-logic',
3925
src: [
4026
'*.php',
4127
'readme.txt',
4228
'assets/**',
4329
'includes/**',
44-
...templateSystemConfig.archive.src.map(relativeToTemplateSystem),
4530
],
46-
dest: 'publish/tangible-loops-and-logic.zip',
4731
exclude: [
48-
...templateSystemConfig.archive.exclude.map(relativeToTemplateSystem),
4932
],
50-
rootFolder: 'tangible-loops-and-logic'
51-
}
33+
configs: [
34+
'./vendor/tangible/template-system/tangible.config.js'
35+
]
36+
},
37+
/**
38+
* Dependencies for production are installed in `vendor/tangible`,
39+
* included in the zip package to publish. Those for development are
40+
* in `tangible-dev`, excluded from the archive.
41+
*
42+
* In `.wp-env.json`, these folders are mounted to the virtual file
43+
* system for local development and testing.
44+
*/
45+
install: [
46+
// Modules
47+
// {
48+
// git: 'git@github.com:tangibleinc/fields',
49+
// dest: 'vendor/tangible/fields',
50+
// branch: 'main',
51+
// },
52+
// {
53+
// git: 'git@github.com:tangibleinc/framework',
54+
// dest: 'vendor/tangible/framework',
55+
// branch: 'main',
56+
// },
57+
{
58+
git: 'git@github.com:tangibleinc/template-system',
59+
dest: 'vendor/tangible/template-system',
60+
branch: 'main',
61+
},
62+
// {
63+
// git: 'git@github.com:tangibleinc/updater',
64+
// dest: 'vendor/tangible/updater',
65+
// branch: 'main',
66+
// },
67+
],
68+
installDev: [
69+
// Third-party plugins
70+
{
71+
zip: 'https://downloads.wordpress.org/plugin/advanced-custom-fields.latest-stable.zip',
72+
dest: 'vendor/tangible-dev/advanced-custom-fields',
73+
},
74+
{
75+
zip: 'https://downloads.wordpress.org/plugin/beaver-builder-lite-version.latest-stable.zip',
76+
dest: 'vendor/tangible-dev/beaver-builder-lite-version',
77+
},
78+
{
79+
zip: 'https://downloads.wordpress.org/plugin/elementor.latest-stable.zip',
80+
dest: 'vendor/tangible-dev/elementor',
81+
},
82+
]
5283
}

tests/.wp-env.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
22
"mappings": {
3+
"wp-content/plugins/advanced-custom-fields": "../vendor/tangible-dev/advanced-custom-fields",
4+
"wp-content/plugins/beaver-builder-lite-version": "../vendor/tangible-dev/beaver-builder-lite-version",
5+
"wp-content/plugins/elementor": "../vendor/tangible-dev/elementor",
36
"wp-content/plugins/e2e-plugin": "../vendor/tangible/template-system/framework/env/e2e-plugin",
47
"wp-content/plugins/tangible-loops-and-logic": "..",
58
"wp-content/themes/empty-block-theme": "../vendor/tangible/template-system/framework/empty-block-theme"

tests/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,17 @@ export default run(async () => {
5151

5252
let result: any;
5353

54+
test('Plugin - Activate', async () => {
55+
let result = await ensurePlugin({ wpx });
56+
is(true, result, "activate plugin");
57+
})
58+
5459
// Framework
5560
await import("../vendor/tangible/template-system/framework/tests/index.ts");
5661

5762
test("Template system - Basic", async () => {
5863
// console.log(await wpx/* php */`return scandir(ABSPATH . 'wp-content/plugins');`)
5964

60-
result = await ensurePlugin({ wpx });
61-
is(true, result, "activate plugin");
62-
6365
result = await wpx`return function_exists('tangible_template_system');`;
6466
is(true, result, "tangible_template_system() exists");
6567

0 commit comments

Comments
 (0)