From 38fd09bd9a85b9ed64c5c4d5ad2c75b6fdbed1c5 Mon Sep 17 00:00:00 2001 From: Snider Date: Wed, 24 Nov 2021 10:34:29 +0000 Subject: [PATCH] Adding workspace to npm which better integrates wails and frontend npm. Running `npm install` will now run on the top level of a generated project and additionally the "frontend" workspace (we can add plugins for wails like this, auto update, package, sign, etc, etc) Other commands that use workspaces (including pre/post hooks mostly) and might be helpful to Wails are `docs`, `install`, `rebuild`, `publish`, `pkg`, `pack`, `ci` For example, during wails build, you could ask for data from the frontend/package.json to get version, title, etc with. `npm pkg get name version --workspace=frontend` Signed-off-by: Snider --- .../commands/generate/template/base/package.json | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/v2/cmd/wails/internal/commands/generate/template/base/package.json b/v2/cmd/wails/internal/commands/generate/template/base/package.json index 3df52deb..0d7a5c74 100644 --- a/v2/cmd/wails/internal/commands/generate/template/base/package.json +++ b/v2/cmd/wails/internal/commands/generate/template/base/package.json @@ -1,12 +1,14 @@ { "private": true, "scripts": { - "postinstall": "npm run setup && cd frontend && npm install", + "install": "go install github.com/wailsapp/wails/v2/cmd/wails@latest", "build": "wails build --clean", "build:macos": "npm run build -- --platform darwin/universal", "build:macos-arm": "npm run build -- --platform darwin/arm64", "build:macos-intel": "npm run build -- --platform darwin", - "build:windows": "npm run build -- --platform windows/amd64", - "setup": "go install github.com/wailsapp/wails/v2/cmd/wails@latest" - } + "build:windows": "npm run build -- --platform windows/amd64" + }, + "workspaces": [ + "frontend" + ] } \ No newline at end of file