From 0eaf37c65a4f6f0c014a3c72b8b984ec064dffd2 Mon Sep 17 00:00:00 2001 From: Thorsten Hans Date: Wed, 15 Jan 2025 21:49:18 +0100 Subject: [PATCH 1/4] feat: add support for yarn Signed-off-by: Thorsten Hans --- templates/http-js/content/package.json | 2 +- templates/http-js/content/spin.toml | 4 +++- templates/http-ts/content/spin.toml | 3 ++- templates/redis-js/content/spin.toml | 1 + templates/redis-ts/content/spin.toml | 1 + 5 files changed, 8 insertions(+), 3 deletions(-) diff --git a/templates/http-js/content/package.json b/templates/http-js/content/package.json index d17c3727..e82b09cf 100644 --- a/templates/http-js/content/package.json +++ b/templates/http-js/content/package.json @@ -20,4 +20,4 @@ "@fermyon/spin-sdk": "^3.0.0", "itty-router": "^5.0.18" } -} \ No newline at end of file +} diff --git a/templates/http-js/content/spin.toml b/templates/http-js/content/spin.toml index 038370f3..b5252527 100644 --- a/templates/http-js/content/spin.toml +++ b/templates/http-js/content/spin.toml @@ -13,6 +13,8 @@ component = "{{project-name | kebab_case}}" [component.{{project-name | kebab_case}}] source = "dist/{{project-name | kebab_case}}.wasm" exclude_files = ["**/node_modules"] +allowed_outbound_hosts = [] + [component.{{project-name | kebab_case}}.build] command = ["npm install", "npm run build"] -watch = ["src/**/*.js"] \ No newline at end of file +watch = ["src/**/*.js"] diff --git a/templates/http-ts/content/spin.toml b/templates/http-ts/content/spin.toml index 82c26af2..c367363b 100644 --- a/templates/http-ts/content/spin.toml +++ b/templates/http-ts/content/spin.toml @@ -13,6 +13,7 @@ component = "{{project-name | kebab_case}}" [component.{{project-name | kebab_case}}] source = "dist/{{project-name | kebab_case}}.wasm" exclude_files = ["**/node_modules"] + [component.{{project-name | kebab_case}}.build] command = ["npm install", "npm run build"] -watch = ["src/**/*.ts"] \ No newline at end of file +watch = ["src/**/*.ts"] diff --git a/templates/redis-js/content/spin.toml b/templates/redis-js/content/spin.toml index 83514a3a..8fb94723 100644 --- a/templates/redis-js/content/spin.toml +++ b/templates/redis-js/content/spin.toml @@ -16,6 +16,7 @@ component = "{{project-name | kebab_case}}" [component.{{project-name | kebab_case}}] source = "dist/{{project-name | kebab_case}}.wasm" exclude_files = ["**/node_modules"] + [component.{{project-name | kebab_case}}.build] command = "npm install && npm run build" watch = ["src/**/*.ts", "package.json"] diff --git a/templates/redis-ts/content/spin.toml b/templates/redis-ts/content/spin.toml index 83514a3a..8fb94723 100644 --- a/templates/redis-ts/content/spin.toml +++ b/templates/redis-ts/content/spin.toml @@ -16,6 +16,7 @@ component = "{{project-name | kebab_case}}" [component.{{project-name | kebab_case}}] source = "dist/{{project-name | kebab_case}}.wasm" exclude_files = ["**/node_modules"] + [component.{{project-name | kebab_case}}.build] command = "npm install && npm run build" watch = ["src/**/*.ts", "package.json"] From 75e2f55736c3eb568e710376ca5472b5b2cee82f Mon Sep 17 00:00:00 2001 From: Thorsten Hans Date: Tue, 11 Feb 2025 10:33:48 +0100 Subject: [PATCH 2/4] feat: Add support for yarn package manager Signed-off-by: Thorsten Hans --- templates/http-js/content/package.json | 42 ++++++++++--------- templates/http-js/content/spin.toml | 2 +- .../http-js/metadata/snippets/component.txt | 2 +- templates/http-js/metadata/spin-template.toml | 1 + templates/http-ts/content/package.json | 4 ++ templates/http-ts/content/spin.toml | 3 +- .../http-ts/metadata/snippets/component.txt | 2 +- templates/http-ts/metadata/spin-template.toml | 1 + templates/redis-js/content/package.json | 4 ++ templates/redis-js/content/spin.toml | 3 +- .../redis-js/metadata/snippets/component.txt | 2 +- .../redis-js/metadata/spin-template.toml | 1 + templates/redis-ts/content/package.json | 4 ++ templates/redis-ts/content/spin.toml | 3 +- .../redis-ts/metadata/snippets/component.txt | 2 +- .../redis-ts/metadata/spin-template.toml | 1 + 16 files changed, 50 insertions(+), 27 deletions(-) diff --git a/templates/http-js/content/package.json b/templates/http-js/content/package.json index e82b09cf..f05e16b1 100644 --- a/templates/http-js/content/package.json +++ b/templates/http-js/content/package.json @@ -1,23 +1,27 @@ { - "name": "{{project-name | kebab_case}}", - "version": "1.0.0", - "description": "{{project-description}}", - "main": "index.js", - "scripts": { + "name": "{{project-name | kebab_case}}", + "version": "1.0.0", + "description": "{{project-description}}", + "main": "index.js", + "scripts": { + {%- if package-manager == "npm" -%} "build": "knitwit --out-dir build/wit/knitwit --out-world combined && npx webpack --mode=production && npx mkdirp dist && npx j2w -i build/bundle.js -d build/wit/knitwit -n combined -o dist/{{project-name | kebab_case}}.wasm", + {%- else -%} + "build": "knitwit --out-dir build/wit/knitwit --out-world combined && yarn exec webpack -- --mode=production && yarn exec mkdirp -- dist && yarn exec j2w -- -i build/bundle.js -d build/wit/knitwit -n combined -o dist/{{project-name | kebab_case}}.wasm", + {%- endif -%} "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC", - "devDependencies": { - "mkdirp": "^3.0.1", - "webpack": "^5.74.0", - "webpack-cli": "^4.10.0", - "@fermyon/knitwit": "0.3.0" - }, - "dependencies": { - "@fermyon/spin-sdk": "^3.0.0", - "itty-router": "^5.0.18" - } + }, + "keywords": [], + "author": "", + "license": "ISC", + "devDependencies": { + "mkdirp": "^3.0.1", + "webpack": "^5.74.0", + "webpack-cli": "^4.10.0", + "@fermyon/knitwit": "0.3.0" + }, + "dependencies": { + "@fermyon/spin-sdk": "^3.0.0", + "itty-router": "^5.0.18" + } } diff --git a/templates/http-js/content/spin.toml b/templates/http-js/content/spin.toml index b5252527..265b0870 100644 --- a/templates/http-js/content/spin.toml +++ b/templates/http-js/content/spin.toml @@ -16,5 +16,5 @@ exclude_files = ["**/node_modules"] allowed_outbound_hosts = [] [component.{{project-name | kebab_case}}.build] -command = ["npm install", "npm run build"] +command = ["{{package-manager}} install", "{{package-manager}} run build"] watch = ["src/**/*.js"] diff --git a/templates/http-js/metadata/snippets/component.txt b/templates/http-js/metadata/snippets/component.txt index 1e5388ae..9ca20243 100644 --- a/templates/http-js/metadata/snippets/component.txt +++ b/templates/http-js/metadata/snippets/component.txt @@ -7,5 +7,5 @@ source = "{{ output-path }}/dist/{{project-name | kebab_case}}.wasm" allowed_outbound_hosts = [] [component.{{project-name | kebab_case}}.build] -command = "npm install && npm run build" +command = ["{{package-manager}} install", "{{package-manager}} run build"] workdir = "{{ output-path }}" diff --git a/templates/http-js/metadata/spin-template.toml b/templates/http-js/metadata/spin-template.toml index a138db92..a85fe2f2 100644 --- a/templates/http-js/metadata/spin-template.toml +++ b/templates/http-js/metadata/spin-template.toml @@ -10,3 +10,4 @@ component = "component.txt" [parameters] project-description = { type = "string", prompt = "Description", default = "" } http-path = { type = "string", prompt = "HTTP path", default = "/...", pattern = "^/\\S*$" } +package-manager = { type = "string", prompt = "Which package manager would you like to use (npm|yarn)", default = "npm", pattern = "^(npm|yarn)$" } diff --git a/templates/http-ts/content/package.json b/templates/http-ts/content/package.json index 812ad4a8..5d66975a 100644 --- a/templates/http-ts/content/package.json +++ b/templates/http-ts/content/package.json @@ -4,7 +4,11 @@ "description": "{{project-description}}", "main": "index.js", "scripts": { + {%- if package-manager == "npm" -%} "build": "knitwit --out-dir build/wit/knitwit --out-world combined && npx webpack --mode=production && npx mkdirp dist && npx j2w -i build/bundle.js -d build/wit/knitwit -n combined -o dist/{{ project-name | kebab_case }}.wasm", + {%- else -%} + "build": "knitwit --out-dir build/wit/knitwit --out-world combined && yarn exec webpack -- --mode=production && yarn exec mkdirp -- dist && yarn exec j2w -- -i build/bundle.js -d build/wit/knitwit -n combined -o dist/{{ project-name | kebab_case }}.wasm", + {%- endif -%} "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [], diff --git a/templates/http-ts/content/spin.toml b/templates/http-ts/content/spin.toml index c367363b..4e26353f 100644 --- a/templates/http-ts/content/spin.toml +++ b/templates/http-ts/content/spin.toml @@ -13,7 +13,8 @@ component = "{{project-name | kebab_case}}" [component.{{project-name | kebab_case}}] source = "dist/{{project-name | kebab_case}}.wasm" exclude_files = ["**/node_modules"] +allowed_outbound_hosts = [] [component.{{project-name | kebab_case}}.build] -command = ["npm install", "npm run build"] +command = ["{{package-manager}} install", "{{package-manager}} run build"] watch = ["src/**/*.ts"] diff --git a/templates/http-ts/metadata/snippets/component.txt b/templates/http-ts/metadata/snippets/component.txt index b8184acb..172577df 100644 --- a/templates/http-ts/metadata/snippets/component.txt +++ b/templates/http-ts/metadata/snippets/component.txt @@ -7,5 +7,5 @@ source = "{{ output-path }}/dist/{{project-name | kebab_case}}.wasm" allowed_outbound_hosts = [] [component.{{project-name | kebab_case}}.build] -command = "npm install && npm run build" +command = ["{{package-manager}} install", "{{package-manager}} run build"] workdir = "{{ output-path }}" \ No newline at end of file diff --git a/templates/http-ts/metadata/spin-template.toml b/templates/http-ts/metadata/spin-template.toml index c468b052..2d036d8c 100644 --- a/templates/http-ts/metadata/spin-template.toml +++ b/templates/http-ts/metadata/spin-template.toml @@ -10,3 +10,4 @@ component = "component.txt" [parameters] project-description = { type = "string", prompt = "Description", default = "" } http-path = { type = "string", prompt = "HTTP path", default = "/...", pattern = "^/\\S*$" } +package-manager = { type = "string", prompt = "Which package manager would you like to use (npm|yarn)", default = "npm", pattern = "^(npm|yarn)$" } diff --git a/templates/redis-js/content/package.json b/templates/redis-js/content/package.json index 6a10fd51..379c877b 100644 --- a/templates/redis-js/content/package.json +++ b/templates/redis-js/content/package.json @@ -4,7 +4,11 @@ "description": "{{project-description}}", "main": "index.js", "scripts": { + {%- if package-manager == "npm" -%} "build": "npx webpack --mode=production && npx mkdirp dist && npx j2w -i build/bundle.js -d build/wit/knitwit -n combined -o dist/{{project-name | kebab_case}}.wasm", + {%- else -%} + "build": "yarn exec webpack -- --mode=production && yarn exec mkdirp -- dist && yarn exec j2w -- -i build/bundle.js -d build/wit/knitwit -n combined -o dist/{{project-name | kebab_case}}.wasm", + {%- endif -%} "test": "echo \"Error: no test specified\" && exit 1", "postinstall": "knitwit --out-dir build/wit/knitwit --out-world combined" }, diff --git a/templates/redis-js/content/spin.toml b/templates/redis-js/content/spin.toml index 8fb94723..8ddfc6f3 100644 --- a/templates/redis-js/content/spin.toml +++ b/templates/redis-js/content/spin.toml @@ -16,7 +16,8 @@ component = "{{project-name | kebab_case}}" [component.{{project-name | kebab_case}}] source = "dist/{{project-name | kebab_case}}.wasm" exclude_files = ["**/node_modules"] +allowed_outbound_hosts = [] [component.{{project-name | kebab_case}}.build] -command = "npm install && npm run build" +command = ["{{package-manager}} install", "{{package-manager}} run build"] watch = ["src/**/*.ts", "package.json"] diff --git a/templates/redis-js/metadata/snippets/component.txt b/templates/redis-js/metadata/snippets/component.txt index 7cfe976c..5e354e44 100644 --- a/templates/redis-js/metadata/snippets/component.txt +++ b/templates/redis-js/metadata/snippets/component.txt @@ -6,5 +6,5 @@ component = "{{project-name | kebab_case}}" source = "{{ output-path }}/dist/{{project-name | kebab_case}}.wasm" allowed_outbound_hosts = [] [component.{{project-name | kebab_case}}.build] -command = "npm install && npm run build" +command = ["{{package-manager}} install", "{{package-manager}} run build"] workdir = "{{ output-path }}" \ No newline at end of file diff --git a/templates/redis-js/metadata/spin-template.toml b/templates/redis-js/metadata/spin-template.toml index 232ef7d0..ac061c73 100644 --- a/templates/redis-js/metadata/spin-template.toml +++ b/templates/redis-js/metadata/spin-template.toml @@ -17,3 +17,4 @@ skip_snippets = ["application_trigger"] project-description = { type = "string", prompt = "Description", default = "" } redis-address = { type = "string", prompt = "Redis address", default = "redis://localhost:6379" } redis-channel = { type = "string", prompt = "Redis channel" } +package-manager = { type = "string", prompt = "Which package manager would you like to use (npm|yarn)", default = "npm", pattern = "^(npm|yarn)$" } diff --git a/templates/redis-ts/content/package.json b/templates/redis-ts/content/package.json index 29dc8477..0200ead7 100644 --- a/templates/redis-ts/content/package.json +++ b/templates/redis-ts/content/package.json @@ -4,7 +4,11 @@ "description": "{{project-description}}", "main": "index.js", "scripts": { + {%- if package-manager == "npm" -%} "build": "npx webpack --mode=production && npx mkdirp dist && npx j2w -i build/bundle.js -d build/wit/knitwit -n combined -o dist/{{project-name | kebab_case}}.wasm", + {%- else -%} + "build": "yarn exec webpack -- --mode=production && yarn exec mkdirp -- dist && yarn exec j2w -- -i build/bundle.js -d build/wit/knitwit -n combined -o dist/{{project-name | kebab_case}}.wasm", + {%- endif -%} "test": "echo \"Error: no test specified\" && exit 1", "postinstall": "knitwit --out-dir build/wit/knitwit --out-world combined" }, diff --git a/templates/redis-ts/content/spin.toml b/templates/redis-ts/content/spin.toml index 8fb94723..8ddfc6f3 100644 --- a/templates/redis-ts/content/spin.toml +++ b/templates/redis-ts/content/spin.toml @@ -16,7 +16,8 @@ component = "{{project-name | kebab_case}}" [component.{{project-name | kebab_case}}] source = "dist/{{project-name | kebab_case}}.wasm" exclude_files = ["**/node_modules"] +allowed_outbound_hosts = [] [component.{{project-name | kebab_case}}.build] -command = "npm install && npm run build" +command = ["{{package-manager}} install", "{{package-manager}} run build"] watch = ["src/**/*.ts", "package.json"] diff --git a/templates/redis-ts/metadata/snippets/component.txt b/templates/redis-ts/metadata/snippets/component.txt index 7cfe976c..5e354e44 100644 --- a/templates/redis-ts/metadata/snippets/component.txt +++ b/templates/redis-ts/metadata/snippets/component.txt @@ -6,5 +6,5 @@ component = "{{project-name | kebab_case}}" source = "{{ output-path }}/dist/{{project-name | kebab_case}}.wasm" allowed_outbound_hosts = [] [component.{{project-name | kebab_case}}.build] -command = "npm install && npm run build" +command = ["{{package-manager}} install", "{{package-manager}} run build"] workdir = "{{ output-path }}" \ No newline at end of file diff --git a/templates/redis-ts/metadata/spin-template.toml b/templates/redis-ts/metadata/spin-template.toml index 710c69e4..0774af86 100644 --- a/templates/redis-ts/metadata/spin-template.toml +++ b/templates/redis-ts/metadata/spin-template.toml @@ -17,3 +17,4 @@ skip_snippets = ["application_trigger"] project-description = { type = "string", prompt = "Description", default = "" } redis-address = { type = "string", prompt = "Redis address", default = "redis://localhost:6379" } redis-channel = { type = "string", prompt = "Redis channel" } +package-manager = { type = "string", prompt = "Which package manager would you like to use (npm|yarn)", default = "npm", pattern = "^(npm|yarn)$" } From 326d6c624ed985baccea7e8f1c8668c663357c5a Mon Sep 17 00:00:00 2001 From: karthik2804 Date: Tue, 11 Feb 2025 10:46:31 +0100 Subject: [PATCH 3/4] update action to test yarn templates Signed-off-by: karthik2804 --- .github/workflows/test.yaml | 15 +++++++++------ templates/http-ts/content/package.json | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index e6502266..51851885 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -43,14 +43,19 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] + package-manager: [npm, yarn] steps: - uses: actions/checkout@v3 - - name: Use Node.js 20 + - name: Use Node.js 22 uses: actions/setup-node@v3 with: - node-version: 20 + node-version: 22 + + - name: Install Yarn (if needed) + if: matrix.package-manager == 'yarn' + run: npm install -g yarn - name: Setup `spin` uses: fermyon/actions/spin/setup@v1 @@ -61,19 +66,17 @@ jobs: run: spin templates install --dir . - name: Create new project - run: spin new -t http-ts test-project -a + run: spin new -t http-ts test-project -v package-manager=${{ matrix.package-manager }} -a - name: Install dependencies of the test project run: | cd test-project - npm install - name: Add new component to project run: | cd test-project - spin add -t http-ts new-component -a + spin add -t http-ts new-component -v package-manager=${{ matrix.package-manager }} -a cd new-component - npm install - name: Build the application run: | diff --git a/templates/http-ts/content/package.json b/templates/http-ts/content/package.json index 5d66975a..b1ddc569 100644 --- a/templates/http-ts/content/package.json +++ b/templates/http-ts/content/package.json @@ -7,7 +7,7 @@ {%- if package-manager == "npm" -%} "build": "knitwit --out-dir build/wit/knitwit --out-world combined && npx webpack --mode=production && npx mkdirp dist && npx j2w -i build/bundle.js -d build/wit/knitwit -n combined -o dist/{{ project-name | kebab_case }}.wasm", {%- else -%} - "build": "knitwit --out-dir build/wit/knitwit --out-world combined && yarn exec webpack -- --mode=production && yarn exec mkdirp -- dist && yarn exec j2w -- -i build/bundle.js -d build/wit/knitwit -n combined -o dist/{{ project-name | kebab_case }}.wasm", + "build": "knitwit --out-dir build/wit/knitwit --out-world combined && webpack --mode=production && mkdirp -- dist && j2w -i build/bundle.js -d build/wit/knitwit -n combined -o dist/{{ project-name | kebab_case }}.wasm", {%- endif -%} "test": "echo \"Error: no test specified\" && exit 1" }, From 9eb6c4b3b3b664e1482f4eb3690ea0c421820796 Mon Sep 17 00:00:00 2001 From: karthik2804 Date: Tue, 11 Feb 2025 11:06:51 +0100 Subject: [PATCH 4/4] clean up templates Signed-off-by: karthik2804 --- templates/http-js/content/package.json | 10 +++------- templates/http-ts/content/package.json | 6 +----- templates/redis-js/content/package.json | 9 ++------- templates/redis-ts/content/package.json | 9 ++------- 4 files changed, 8 insertions(+), 26 deletions(-) diff --git a/templates/http-js/content/package.json b/templates/http-js/content/package.json index f05e16b1..e421ba8e 100644 --- a/templates/http-js/content/package.json +++ b/templates/http-js/content/package.json @@ -4,12 +4,8 @@ "description": "{{project-description}}", "main": "index.js", "scripts": { - {%- if package-manager == "npm" -%} - "build": "knitwit --out-dir build/wit/knitwit --out-world combined && npx webpack --mode=production && npx mkdirp dist && npx j2w -i build/bundle.js -d build/wit/knitwit -n combined -o dist/{{project-name | kebab_case}}.wasm", - {%- else -%} - "build": "knitwit --out-dir build/wit/knitwit --out-world combined && yarn exec webpack -- --mode=production && yarn exec mkdirp -- dist && yarn exec j2w -- -i build/bundle.js -d build/wit/knitwit -n combined -o dist/{{project-name | kebab_case}}.wasm", - {%- endif -%} - "test": "echo \"Error: no test specified\" && exit 1" + "build": "knitwit --out-dir build/wit/knitwit --out-world combined && webpack --mode=production && mkdirp dist && j2w -i build/bundle.js -d build/wit/knitwit -n combined -o dist/{{project-name | kebab_case}}.wasm", + "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [], "author": "", @@ -24,4 +20,4 @@ "@fermyon/spin-sdk": "^3.0.0", "itty-router": "^5.0.18" } -} +} \ No newline at end of file diff --git a/templates/http-ts/content/package.json b/templates/http-ts/content/package.json index b1ddc569..5e4f50b3 100644 --- a/templates/http-ts/content/package.json +++ b/templates/http-ts/content/package.json @@ -4,11 +4,7 @@ "description": "{{project-description}}", "main": "index.js", "scripts": { - {%- if package-manager == "npm" -%} - "build": "knitwit --out-dir build/wit/knitwit --out-world combined && npx webpack --mode=production && npx mkdirp dist && npx j2w -i build/bundle.js -d build/wit/knitwit -n combined -o dist/{{ project-name | kebab_case }}.wasm", - {%- else -%} - "build": "knitwit --out-dir build/wit/knitwit --out-world combined && webpack --mode=production && mkdirp -- dist && j2w -i build/bundle.js -d build/wit/knitwit -n combined -o dist/{{ project-name | kebab_case }}.wasm", - {%- endif -%} + "build": "knitwit --out-dir build/wit/knitwit --out-world combined && webpack --mode=production && mkdirp dist && j2w -i build/bundle.js -d build/wit/knitwit -n combined -o dist/{{ project-name | kebab_case }}.wasm", "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [], diff --git a/templates/redis-js/content/package.json b/templates/redis-js/content/package.json index 379c877b..2495b54d 100644 --- a/templates/redis-js/content/package.json +++ b/templates/redis-js/content/package.json @@ -4,13 +4,8 @@ "description": "{{project-description}}", "main": "index.js", "scripts": { - {%- if package-manager == "npm" -%} - "build": "npx webpack --mode=production && npx mkdirp dist && npx j2w -i build/bundle.js -d build/wit/knitwit -n combined -o dist/{{project-name | kebab_case}}.wasm", - {%- else -%} - "build": "yarn exec webpack -- --mode=production && yarn exec mkdirp -- dist && yarn exec j2w -- -i build/bundle.js -d build/wit/knitwit -n combined -o dist/{{project-name | kebab_case}}.wasm", - {%- endif -%} - "test": "echo \"Error: no test specified\" && exit 1", - "postinstall": "knitwit --out-dir build/wit/knitwit --out-world combined" + "build": "knitwit --out-dir build/wit/knitwit --out-world combined && webpack --mode=production && mkdirp dist && j2w -i build/bundle.js -d build/wit/knitwit -n combined -o dist/{{project-name | kebab_case}}.wasm", + "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [], "author": "", diff --git a/templates/redis-ts/content/package.json b/templates/redis-ts/content/package.json index 0200ead7..4a6c80ee 100644 --- a/templates/redis-ts/content/package.json +++ b/templates/redis-ts/content/package.json @@ -4,13 +4,8 @@ "description": "{{project-description}}", "main": "index.js", "scripts": { - {%- if package-manager == "npm" -%} - "build": "npx webpack --mode=production && npx mkdirp dist && npx j2w -i build/bundle.js -d build/wit/knitwit -n combined -o dist/{{project-name | kebab_case}}.wasm", - {%- else -%} - "build": "yarn exec webpack -- --mode=production && yarn exec mkdirp -- dist && yarn exec j2w -- -i build/bundle.js -d build/wit/knitwit -n combined -o dist/{{project-name | kebab_case}}.wasm", - {%- endif -%} - "test": "echo \"Error: no test specified\" && exit 1", - "postinstall": "knitwit --out-dir build/wit/knitwit --out-world combined" + "build": "knitwit --out-dir build/wit/knitwit --out-world combined && webpack --mode=production && mkdirp dist && j2w -i build/bundle.js -d build/wit/knitwit -n combined -o dist/{{project-name | kebab_case}}.wasm", + "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [], "author": "",