Skip to content

Commit 08ecd46

Browse files
committed
prepend backend to dev
closes #6
1 parent e99b646 commit 08ecd46

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Add [PHP](https://www.php.net/), [Composer](https://getcomposer.org/), [MySQL](h
4040
- `schema.sql` contains the database schema and updates to it
4141
- `testdata.sql` contains test data only for development
4242
- the package main script will **modify some files** in your project folder:
43-
- add a `backend` script to the `package.json` file
43+
- add a `backend` script to the `package.json` file and prepend it to `dev`
4444
- add a proxy server config for PHP files to the Vite config file
4545
- add `vendor/` and `credentials.php` to the `.gitignore` file
4646

src/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ let viteConfigFile = null
2222
shell.exec(`cp -Rn "${templateFolder}/" "${appFolder}/"`)
2323

2424
// Create package.json file if not exists
25-
if (!fs.existsSync(packageFile)) fs.writeFileSync(packageFile, '{}')
25+
if (!fs.existsSync(packageFile)) fs.writeFileSync(packageFile, '{ "scripts": { "dev": "vite" } }')
2626

2727
// Search for vite config file
2828
viteConfigFile =
@@ -52,6 +52,7 @@ const nextPackageFileJson = {
5252
...packageFileJson,
5353
scripts: {
5454
...packageFileJson.scripts,
55+
dev: 'npm run backend' + (packageFileJson.scripts?.dev ? ' && ' + packageFileJson.scripts.dev : ''),
5556
backend: '(docker stop $(docker ps -a -q) || true) && (docker rm -f $(docker ps -a -q) || true) && (docker volume rm $(docker volume ls -q) || true) && docker compose up -d --build',
5657
}
5758
}

0 commit comments

Comments
 (0)