From f5bac2c47809ff90df8462f2b37f86219a2b7393 Mon Sep 17 00:00:00 2001 From: Simon Ihmig Date: Mon, 9 Dec 2024 19:14:44 +0100 Subject: [PATCH] Use addon-dev declarations plugin for d.ts output --- files/__addonLocation__/package.json | 14 ++++---------- files/__addonLocation__/rollup.config.mjs | 5 ++++- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/files/__addonLocation__/package.json b/files/__addonLocation__/package.json index fe8bb5c3..f3f21dc6 100644 --- a/files/__addonLocation__/package.json +++ b/files/__addonLocation__/package.json @@ -13,22 +13,16 @@ "declarations", "dist" ], - "scripts": {<% if (typescript) { %> - "build": "concurrently \"<%= packageManager %>:build:*\"", - "build:js": "rollup --config", - "build:types": "glint --declaration",<% } else { %> - "build": "rollup --config",<% } %> + "scripts": { + "build": "rollup --config", "lint": "concurrently \"<%= packageManager %>:lint:*(!fix)\" --names \"lint:\"", "lint:fix": "concurrently \"<%= packageManager %>:lint:*:fix\" --names \"fix:\"", "lint:hbs": "ember-template-lint . --no-error-on-unmatched-pattern", "lint:js": "eslint . --cache", "lint:hbs:fix": "ember-template-lint . --fix --no-error-on-unmatched-pattern", "lint:js:fix": "eslint . --fix",<% if (typescript) { %> - "lint:types": "glint", - "start": "concurrently \"<%= packageManager %>:start:*\"", - "start:js": "rollup --config --watch --no-watch.clearScreen", - "start:types": "glint --declaration --watch",<% } else { %> - "start": "rollup --config --watch",<% } %> + "lint:types": "glint",<% } %> + "start": "rollup --config --watch", "test": "echo 'A v2 addon does not have tests, run tests in test-app'", "prepack": <% if (typescript) { %>"concurrently '<%= packageManager %>:build:*'"<% } else { %>"rollup --config"<% } %> }, diff --git a/files/__addonLocation__/rollup.config.mjs b/files/__addonLocation__/rollup.config.mjs index 2a49ed1a..a1d00147 100644 --- a/files/__addonLocation__/rollup.config.mjs +++ b/files/__addonLocation__/rollup.config.mjs @@ -52,7 +52,10 @@ export default { addon.hbs(), // Ensure that .gjs files are properly integrated as Javascript - addon.gjs(), + addon.gjs(),<% if (typescript) { %> + + // Emit .d.ts declaration files + addon.declarations('declarations'),<% } %> // addons are allowed to contain imports of .css files, which we want rollup // to leave alone and keep in the published output.