From 5bcc2018a462b7340d371205b25c70b42fb849f6 Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Thu, 13 Jun 2024 10:16:31 -0400 Subject: [PATCH] Provide TS workarounds for both TS and Glint issues --- files/__addonLocation__/package.json | 9 +++--- files/__addonLocation__/rollup.config.mjs | 34 ++++++++++++++++++++++- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/files/__addonLocation__/package.json b/files/__addonLocation__/package.json index 762892f9..450cdf70 100644 --- a/files/__addonLocation__/package.json +++ b/files/__addonLocation__/package.json @@ -13,11 +13,8 @@ "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", @@ -84,6 +81,8 @@ "prettier-plugin-ember-template-tag": "^2.0.2", "rollup": "^4.16.4"<% if (!isExistingMonorepo) { %>, "rollup-plugin-copy": "^3.5.0"<% } %><% if (typescript) { %>, + "execa": "9.2.0", + "fix-bad-declaration-output": "1.1.4", "typescript": "^5.4.5"<% } %> }, "publishConfig": { diff --git a/files/__addonLocation__/rollup.config.mjs b/files/__addonLocation__/rollup.config.mjs index 2a49ed1a..8163db9b 100644 --- a/files/__addonLocation__/rollup.config.mjs +++ b/files/__addonLocation__/rollup.config.mjs @@ -1,6 +1,10 @@ import { babel } from '@rollup/plugin-babel'; <% if (!isExistingMonorepo) { %>import copy from 'rollup-plugin-copy'; <% } %>import { Addon } from '@embroider/addon-dev/rollup'; +<% if (typescript) { %> +import { $ } from "execa"; +import { fixBadDeclarationOutput } from "fix-bad-declaration-output"; +<% } %> const addon = new Addon({ srcDir: 'src', @@ -67,5 +71,33 @@ export default { <% filesToCopyFromRootToAddon.forEach((file) => { %> { src: '<%= pathFromAddonToRoot %>/<%= file %>', dest: '.' }, <% }); %> ], }), -<% } %> ], +<% } %> + +<% if (typescript) { %> + { + name: "Build Declarations", + closeBundle: async () => { + /** + * Generate the types (these include /// + ], };