Skip to content

Commit d70fcee

Browse files
[#1] BluePrint UI Part one of two (#10)
* [#1] adding an outline to the readme * [#1] Trying to update the DDEV vite server * [#1] Setting up basic npm install * [#1] Adding color to theme.json * [#1] Adding font sizes * [#1] Updating file name * [#1] Adjusting the btn styles * [#1] Cleaning up files
1 parent e708d8b commit d70fcee

32 files changed

+8921
-72
lines changed

.ddev/.env

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# start vite
2+
VITE_PROJECT_DIR=wp-content/themes/wp-starter
3+
VITE_PRIMARY_PORT=5173
4+
VITE_SECONDARY_PORT=5273
5+
VITE_JS_PACKAGE_MGR=npm
6+
# end vite

.ddev/commands/web/vite-serve

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
#! /usr/bin/env bash
2+
#ddev-generated
3+
4+
CMD=$1
5+
VITE_DIR=${VITE_PROJECT_DIR:-frontend}
6+
VITE_PRIMARY_PORT=${VITE_PRIMARY_PORT:-5173}
7+
VITE_SECONDARY_PORT=${VITE_SECONDARY_PORT:-5273}
8+
9+
pmMenu() {
10+
PMS="npm yarn pnpm"
11+
12+
PS3="Choose the package manager to use: "
13+
select pkgdefault in $PMS; do
14+
if [ -n "$pkgdefault" ]; then
15+
echo "$pkgdefault"
16+
break
17+
else
18+
echo "'$REPLY' is not a legal entry"
19+
fi
20+
done
21+
}
22+
23+
defaultPM() {
24+
25+
if [ -n "$VITE_JS_PACKAGE_MGR" ]; then
26+
echo $VITE_JS_PACKAGE_MGR
27+
return
28+
fi
29+
30+
if [ -f $VITE_DIR/package-lock.json ]; then
31+
echo npm
32+
elif [ -f $VITE_DIR/yarn.lock ]; then
33+
echo yarn
34+
elif [ -f $VITE_DIR/pnpm-lock.yaml ]; then
35+
echo pnpm
36+
else
37+
pmMenu
38+
fi
39+
40+
}
41+
42+
CMD=${CMD:=start}
43+
44+
if [ $CMD = start ]; then
45+
46+
# Make sure the project directory is actually there
47+
if [ ! -d $VITE_DIR ]; then
48+
echo "ERROR: js project directory $VITE_DIR was expected, not found"
49+
exit 1
50+
fi
51+
52+
VITE_JS_PACKAGE_MGR=$(defaultPM)
53+
echo "'$VITE_JS_PACKAGE_MGR'"
54+
55+
if ! command -v $VITE_JS_PACKAGE_MGR >/dev/null; then
56+
echo "ERROR: could not find package manager $VITE_JS_PACKAGE_MGR"
57+
exit 1
58+
fi
59+
60+
echo "Using package manager $VITE_JS_PACKAGE_MGR"
61+
62+
# make sure node_modules has linux and not mac code:
63+
cd $VITE_DIR
64+
$VITE_JS_PACKAGE_MGR install
65+
66+
# Is js project a Vite project?
67+
if [ ! -d node_modules/vite ]; then
68+
echo "ERROR: project in $VITE_DIR does not appear to be Vite-enabled"
69+
exit 1
70+
fi
71+
72+
# create a background tmux session and tell it to run
73+
# our vite script
74+
tmux kill-session -t vite-sess 2>/dev/null
75+
tmux new -s vite-sess -d
76+
tmux send "node node_modules/vite/bin/vite.js --port $VITE_PRIMARY_PORT --host" C-m
77+
echo "Vite now serving $VITE_DIR"
78+
79+
# stopping
80+
elif [ $CMD = stop ]; then
81+
echo "stopping vite"
82+
# kill the vite session
83+
tmux kill-session -t vite-sess
84+
85+
# show settings
86+
elif [ $CMD = status ]; then
87+
echo "ViteServe Status"
88+
echo "================"
89+
echo "Project: $VITE_PROJECT_DIR"
90+
echo "Vite Primary Port: $VITE_PRIMARY_PORT"
91+
echo "Vite Secondary Port: $VITE_SECONDARY_PORT"
92+
93+
# usage
94+
else
95+
echo "$0 start|stop|status"
96+
fi

.ddev/config.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,26 @@ type: wordpress
33
docroot: ""
44
php_version: "8.2"
55
webserver_type: nginx-fpm
6+
router_http_port: "80"
7+
router_https_port: "443"
68
xdebug_enabled: false
79
additional_hostnames: []
810
additional_fqdns: []
911
database:
10-
type: mariadb
11-
version: "10.4"
12+
type: mariadb
13+
version: "10.4"
14+
nfs_mount_enabled: false
15+
mutagen_enabled: false
1216
use_dns_when_possible: true
1317
composer_version: "2"
18+
nodejs_version: "18"
19+
# TODO figure this out - turned off for now
20+
# hooks:
21+
# post-start:
22+
# - exec: .ddev/commands/web/vite-serve
1423
web_environment: []
1524

25+
1626
# Key features of DDEV's config.yaml:
1727

1828
# name: <projectname> # Name of the project, automatically provides

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
### Composer ###
55
composer.phar
6-
/vendor/
6+
vendor
77

88
# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
99
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
@@ -18,6 +18,9 @@ composer.phar
1818
# Icon must end with two \r
1919
Icon
2020

21+
# NPM and Vite
22+
node_modules
23+
dist
2124

2225
# Thumbnails
2326
._*

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,27 @@
11
# WordPress Site Starter
2+
To use this, clone the WordPress Site Starter into the new project repo. Update this to have info about things to note how to be successful using the starter.
3+
4+
## Requirements
5+
* [DDEV](https://ddev.readthedocs.io/en/stable/) - [Installation](https://ddev.readthedocs.io/en/stable/users/install/ddev-installation/)
6+
* [Docker](https://docs.docker.com/desktop/install/mac-install/) (or compatible container alternative)
7+
* For ACF Pro, create an `auth.json` file in `wp-content/mu-plugins/viget-base/` from the [ACF Website](https://www.advancedcustomfields.com/my-account/view-licenses/). (Credentials are in 1Password)
8+
9+
## Setup and Running
10+
11+
Download and install WordPress core files
12+
`ddev wp core download`
13+
14+
Start local server
15+
`ddev start`
16+
17+
TODO add more info here once we have the full setup completed.
18+
19+
*We may want to use our Viget plugin to have this be in the CLI*
20+
1. Open a browser and navigate to [local site](https://wpstarter.ddev.site).
21+
2. Select English as the language.
22+
3. Fill out the site information.
23+
4. Then click "Install WordPress"
24+
5. Once WordPress has been set up login with your user information.
25+
26+
27+
## Block Documentation
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
module.exports = {
2+
arrowParens: 'always',
3+
bracketSameLine: false,
4+
bracketSpacing: true,
5+
htmlWhitespaceSensitivity: 'css',
6+
printWidth: 80,
7+
proseWrap: 'preserve',
8+
semi: true,
9+
singleQuote: true,
10+
tabWidth: 4,
11+
useTabs: true,
12+
trailingComma: 'all',
13+
overrides: [
14+
{
15+
files: ['*.yml', '*.json'],
16+
options: {
17+
useTabs: false,
18+
tabWidth: 2,
19+
},
20+
},
21+
],
22+
plugins: ['prettier-plugin-tailwindcss'],
23+
tailwindFunctions: ['clsx'],
24+
};
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"require": {
3+
"idleberg/wordpress-vite-assets": "^1.0"
4+
}
5+
}

0 commit comments

Comments
 (0)