From 08ecd46f94c2f963fc40b41788f8a33fbe4d49e4 Mon Sep 17 00:00:00 2001 From: scriptPilot Date: Sat, 24 Feb 2024 00:41:52 +0100 Subject: [PATCH 1/2] prepend backend to dev closes #6 --- README.md | 2 +- src/index.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 671f002..cbc0efe 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Add [PHP](https://www.php.net/), [Composer](https://getcomposer.org/), [MySQL](h - `schema.sql` contains the database schema and updates to it - `testdata.sql` contains test data only for development - the package main script will **modify some files** in your project folder: - - add a `backend` script to the `package.json` file + - add a `backend` script to the `package.json` file and prepend it to `dev` - add a proxy server config for PHP files to the Vite config file - add `vendor/` and `credentials.php` to the `.gitignore` file diff --git a/src/index.js b/src/index.js index b0fe02a..ece1702 100755 --- a/src/index.js +++ b/src/index.js @@ -22,7 +22,7 @@ let viteConfigFile = null shell.exec(`cp -Rn "${templateFolder}/" "${appFolder}/"`) // Create package.json file if not exists -if (!fs.existsSync(packageFile)) fs.writeFileSync(packageFile, '{}') +if (!fs.existsSync(packageFile)) fs.writeFileSync(packageFile, '{ "scripts": { "dev": "vite" } }') // Search for vite config file viteConfigFile = @@ -52,6 +52,7 @@ const nextPackageFileJson = { ...packageFileJson, scripts: { ...packageFileJson.scripts, + dev: 'npm run backend' + (packageFileJson.scripts?.dev ? ' && ' + packageFileJson.scripts.dev : ''), 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', } } From b7d022a41e1b8fd01ab82f510894a7d5e290a3c5 Mon Sep 17 00:00:00 2001 From: scriptPilot Date: Sat, 24 Feb 2024 00:42:10 +0100 Subject: [PATCH 2/2] 1.7.0 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2fb98b6..99c69c0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "add-php-backend", - "version": "1.6.0", + "version": "1.7.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "add-php-backend", - "version": "1.6.0", + "version": "1.7.0", "license": "MIT", "dependencies": { "fs-extra": "^11.2.0", diff --git a/package.json b/package.json index ac5ea9d..6c8dd46 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "add-php-backend", - "version": "1.6.0", + "version": "1.7.0", "description": "", "main": "src/index.js", "bin": "src/index.js",