Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop rollup-plugin-ts, use updated addon blueprint #655

Merged
merged 9 commits into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

# compiled output
/dist/
/declarations/
/tmp/

# dependencies
Expand Down
1 change: 1 addition & 0 deletions ember-stargate/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

# compiled output
/dist/
/declarations/

# misc
/coverage/
35 changes: 10 additions & 25 deletions ember-stargate/.gitignore
Original file line number Diff line number Diff line change
@@ -1,25 +1,10 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
dist/

# dependencies
node_modules/

# misc
/.env*
/.pnp*
/.pnpm-debug.log
/.sass-cache
.eslintcache
/connect.lock
/coverage/
/libpeerconnection.log
/npm-debug.log*
/testem.log
/yarn-error.log

# ember-try
/.node_modules.ember-try/
/package.json.ember-try
/yarn.lock.ember-try
# The authoritative copies of these live in the monorepo root (because they're
# more useful on github that way), but the build copies them into here so they
# will also appear in published NPM packages.
/README.md
/LICENSE.md
# Build output
/dist/
/declarations/
# npm/pnpm/yarn pack output
*.tgz
8 changes: 7 additions & 1 deletion ember-stargate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,13 @@ you need to import the addon's Glint template registry entries as described in t
```ts
// e.g. types/glint.d.ts
import '@glint/environment-ember-loose';
import 'ember-stargate/glint';
import type StargateRegistry from 'ember-stargate/template-registry';

declare module '@glint/environment-ember-loose/registry' {
export default interface Registry extends StargateRegistry, /* other addon registries */ {
// local entries
}
}
```

> Note that Glint itself is still under active development, and as such breaking changes might occur. Therefore, Glint support by this addon is also considered experimental, and not covered by our SemVer contract!
Expand Down
54 changes: 30 additions & 24 deletions ember-stargate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,23 @@
},
"files": [
"addon-main.js",
"dist"
"dist",
"declarations"
],
"scripts": {
"build": "rollup --config",
"build": "concurrently 'npm:build:*'",
"build:js": "rollup --config",
"build:types": "glint -d",
"lint": "concurrently 'npm:lint:*(!fix)' --names 'lint:'",
"lint:fix": "concurrently 'npm: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",
"lint:types": "glint",
"start": "rollup --config --watch",
"start": "concurrently 'npm:start:*'",
"start:js": "rollup --config --watch --no-watch.clearScreen",
"start:types": "glint --watch",
"test": "echo 'A v2 addon does not have tests, run tests in test-app'",
"prepack": "rollup --config"
},
Expand All @@ -46,29 +51,31 @@
"@glint/environment-ember-loose": "1.0.2",
"@glint/template": "1.0.2",
"@tsconfig/ember": "2.0.0",
"@types/ember": "4.0.3",
"@types/ember__destroyable": "4.0.1",
"@types/ember__object": "4.0.5",
"@types/ember__service": "4.0.2",
"@types/ember__controller": "4.0.4",
"@types/ember": "4.0.4",
"@types/ember__destroyable": "4.0.2",
"@types/ember__object": "4.0.6",
"@types/ember__service": "4.0.3",
"@types/ember__controller": "4.0.5",
"@types/ember__string": "3.16.3",
"@types/ember__template": "4.0.1",
"@types/ember__polyfills": "4.0.1",
"@types/ember__utils": "4.0.2",
"@types/ember__runloop": "4.0.2",
"@types/ember__debug": "4.0.3",
"@types/ember__engine": "4.0.4",
"@types/ember__application": "4.0.5",
"@types/ember__test": "4.0.1",
"@types/ember__array": "4.0.3",
"@types/ember__error": "4.0.2",
"@types/ember__component": "4.0.13",
"@types/ember__routing": "4.0.12",
"@types/ember__template": "4.0.2",
"@types/ember__polyfills": "4.0.2",
"@types/ember__utils": "4.0.3",
"@types/ember__runloop": "4.0.3",
"@types/ember__debug": "4.0.4",
"@types/ember__engine": "4.0.5",
"@types/ember__application": "4.0.6",
"@types/ember__test": "4.0.2",
"@types/ember__array": "4.0.4",
"@types/ember__error": "4.0.3",
"@types/ember__component": "4.0.14",
"@types/ember__routing": "4.0.13",
"@typescript-eslint/eslint-plugin": "5.59.7",
"@typescript-eslint/parser": "5.59.7",
"@rollup/plugin-babel": "6.0.3",
"@rollup/plugin-node-resolve": "15.1.0",
"concurrently": "8.0.1",
"ember-modifier": "4.1.0",
"ember-template-lint": "5.10.0",
"ember-template-lint": "5.11.0",
"eslint": "7.32.0",
"eslint-config-prettier": "8.8.0",
"eslint-plugin-ember": "11.7.2",
Expand All @@ -77,7 +84,6 @@
"prettier": "2.8.8",
"rollup": "3.23.0",
"rollup-plugin-copy": "3.4.0",
"rollup-plugin-ts": "3.2.0",
"typescript": "5.0.4"
},
"publishConfig": {
Expand All @@ -99,15 +105,15 @@
"exports": {
".": "./dist/index.js",
"./*": {
"types": "./dist/*.d.ts",
"types": "./declarations/*.d.js",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering if the *.d.js is a typo.

In my addons, I wrote the following for "." and "./*":

"exports": {
  ".": {
    "types": "./declarations/index.d.ts",
    "default": "./dist/index.js"
  },
  "./*": {
    "types": "./declarations/*.d.ts",
    "default": "./dist/*.js"
  },
  "./addon-main.js": "./addon-main.cjs"
},

"default": "./dist/*.js"
},
"./addon-main.js": "./addon-main.js"
},
"typesVersions": {
"*": {
"*": [
"dist/*"
"declarations/*"
]
}
}
Expand Down
23 changes: 15 additions & 8 deletions ember-stargate/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import typescript from 'rollup-plugin-ts';
import { babel } from '@rollup/plugin-babel';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import copy from 'rollup-plugin-copy';
import { Addon } from '@embroider/addon-dev/rollup';

Expand All @@ -7,6 +8,9 @@ const addon = new Addon({
destDir: 'dist',
});

// Add extensions here, such as ts, gjs, etc that you may import
const extensions = ['.js', '.ts', '.hbs'];

export default {
// This provides defaults that work well alongside `publicEntrypoints` below.
// You can augment this if you need to.
Expand All @@ -26,18 +30,21 @@ export default {
// not everything in publicEntrypoints necessarily needs to go here.
addon.appReexports(['components/**/*.js', 'services/**/*.js']),

// compile TypeScript
typescript({
transpiler: 'babel',
browserslist: false,
transpileOnly: false,
}),
// Follow the V2 Addon rules about dependencies. Your code can import from
// `dependencies` and `peerDependencies` as well as standard Ember-provided
// package names.
addon.dependencies(),

// This babel config should *not* apply presets or compile away ES modules.
// It exists only to provide development niceties for you, like automatic
// template colocation.
// See `babel.config.json` for the actual Babel configuration!
// babel({ babelHelpers: 'bundled' }),
babel({
extensions,
babelHelpers: 'bundled',
}),
// Allows rollup to resolve imports of files with the specified extensions
nodeResolve({ extensions }),

// Ensure that standalone .hbs files are properly integrated as Javascript.
addon.hbs(),
Expand Down
3 changes: 3 additions & 0 deletions ember-stargate/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
"include": ["src/**/*", "unpublished-development-types/**/*"],
"glint": {
"environment": "ember-loose"
},
"compilerOptions": {
"declarationDir": "declarations"
}
}
38 changes: 20 additions & 18 deletions test-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,30 @@
"@ember/optional-features": "2.0.0",
"@ember/string": "3.1.1",
"@ember/test-helpers": "2.9.3",
"@embroider/test-setup": "3.0.1",
"@embroider/test-setup": "2.1.1",
"@glimmer/component": "1.1.2",
"@glimmer/tracking": "1.1.2",
"@glint/core": "1.0.2",
"@glint/environment-ember-loose": "1.0.2",
"@glint/template": "1.0.2",
"@types/ember__application": "4.0.5",
"@types/ember__array": "4.0.3",
"@types/ember__component": "4.0.13",
"@types/ember__controller": "4.0.4",
"@types/ember__debug": "4.0.3",
"@types/ember__engine": "4.0.4",
"@types/ember__error": "4.0.2",
"@types/ember__object": "4.0.5",
"@types/ember__polyfills": "4.0.1",
"@types/ember__routing": "4.0.12",
"@types/ember__runloop": "4.0.2",
"@types/ember__service": "4.0.2",
"@types/ember__string": "3.0.10",
"@types/ember__template": "4.0.1",
"@types/ember__test": "4.0.1",
"@types/ember__utils": "4.0.2",
"@types/ember": "4.0.4",
"@types/ember__destroyable": "4.0.2",
"@types/ember__object": "4.0.6",
"@types/ember__service": "4.0.3",
"@types/ember__controller": "4.0.5",
"@types/ember__string": "3.16.3",
"@types/ember__template": "4.0.2",
"@types/ember__polyfills": "4.0.2",
"@types/ember__utils": "4.0.3",
"@types/ember__runloop": "4.0.3",
"@types/ember__debug": "4.0.4",
"@types/ember__engine": "4.0.5",
"@types/ember__application": "4.0.6",
"@types/ember__test": "4.0.2",
"@types/ember__array": "4.0.4",
"@types/ember__error": "4.0.3",
"@types/ember__component": "4.0.14",
"@types/ember__routing": "4.0.13",
"@types/htmlbars-inline-precompile": "3.0.0",
"@types/qunit": "2.19.5",
"@types/rsvp": "4.0.4",
Expand Down Expand Up @@ -76,7 +78,7 @@
"ember-source": "3.28.12",
"ember-source-channel-url": "3.0.0",
"ember-stargate": "0.4.3",
"ember-template-lint": "5.10.0",
"ember-template-lint": "5.11.0",
"ember-try": "2.0.0",
"eslint": "7.32.0",
"eslint-config-prettier": "8.8.0",
Expand Down
Loading