Skip to content

Commit

Permalink
feat: add glint to ember-prismic-dom
Browse files Browse the repository at this point in the history
  • Loading branch information
vscav committed Nov 6, 2023
1 parent 4cc02da commit d2493bc
Show file tree
Hide file tree
Showing 8 changed files with 171 additions and 39 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# compiled output
dist/
.pnpm-store/
declarations/

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

# compiled output
/dist/
/declarations/

# misc
/coverage/
1 change: 1 addition & 0 deletions ember-prismic-dom/.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
26 changes: 23 additions & 3 deletions ember-prismic-dom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"author": "",
"files": [
"addon-main.cjs",
"declarations",
"dist"
],
"scripts": {
Expand All @@ -18,9 +19,12 @@
"lint:fix": "concurrently 'pnpm:lint:*:fix' --names 'fix:'",
"lint:hbs": "ember-template-lint . --no-error-on-unmatched-pattern",
"lint:js": "eslint . --cache",
"lint:types": "glint",
"lint:hbs:fix": "ember-template-lint . --fix --no-error-on-unmatched-pattern",
"lint:js:fix": "eslint . --fix",
"start": "rollup --config --watch",
"start": "concurrently 'pnpm:start:*'",
"start:js": "rollup --config --watch --no-watch.clearScreen",
"start:types": "glint -d --watch",
"test": "echo 'A v2 addon does not have tests, run tests in test-app'",
"prepack": "rollup --config",
"prepare": "rollup --config"
Expand All @@ -38,6 +42,9 @@
"@babel/plugin-syntax-decorators": "^7.22.10",
"@babel/runtime": "^7.23.2",
"@embroider/addon-dev": "^3.0.0",
"@glint/core": "^1.2.1",
"@glint/environment-ember-loose": "^1.2.1",
"@glint/template": "^1.2.1",
"@qonto/eslint-config-typescript": "1.0.0-rc.0",
"@rollup/plugin-babel": "^6.0.4",
"@tsconfig/ember": "^3.0.1",
Expand Down Expand Up @@ -73,10 +80,23 @@
}
},
"exports": {
".": "./dist/index.js",
"./*": "./dist/*.js",
".": {
"types": "./declarations/index.d.ts",
"default": "./dist/index.js"
},
"./*": {
"types": "./declarations/*.d.ts",
"default": "./dist/*.js"
},
"./addon-main.js": "./addon-main.cjs"
},
"typesVersions": {
"*": {
"*": [
"declarations/*"
]
}
},
"peerDependencies": {
"ember-source": "^3.28.0 || ^4.0.0"
}
Expand Down
22 changes: 11 additions & 11 deletions ember-prismic-dom/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { babel } from "@rollup/plugin-babel";
import copy from "rollup-plugin-copy";
import { Addon } from "@embroider/addon-dev/rollup";
import { babel } from '@rollup/plugin-babel';
import copy from 'rollup-plugin-copy';
import { Addon } from '@embroider/addon-dev/rollup';

const addon = new Addon({
srcDir: "src",
destDir: "dist",
srcDir: 'src',
destDir: 'dist',
});

export default {
Expand All @@ -15,12 +15,12 @@ export default {
plugins: [
// These are the modules that users should be able to import from your
// addon. Anything not listed here may get optimized away.
addon.publicEntrypoints(["index.js", "**/*.js"]),
addon.publicEntrypoints(['index.js', '**/*.js']),

// These are the modules that should get reexported into the traditional
// "app" tree. Things in here should also be in publicEntrypoints above, but
// not everything in publicEntrypoints necessarily needs to go here.
addon.appReexports(["components/**/*.js", "helpers/**/*.js"]),
addon.appReexports(['components/**/*.js', 'helpers/**/*.js']),

// Follow the V2 Addon rules about dependencies. Your code can import from
// `dependencies` and `peerDependencies` as well as standard Ember-provided
Expand All @@ -34,24 +34,24 @@ export default {
// By default, this will load the actual babel config from the file
// babel.config.json.
babel({
babelHelpers: "bundled",
babelHelpers: 'bundled',
}),

// Ensure that standalone .hbs files are properly integrated as Javascript.
addon.hbs(),

// addons are allowed to contain imports of .css files, which we want rollup
// to leave alone and keep in the published output.
addon.keepAssets(["**/*.css"]),
addon.keepAssets(['**/*.css']),

// Remove leftover build artifacts when starting a new build.
addon.clean(),

// Copy Readme and License into published package
copy({
targets: [
{ src: "../README.md", dest: "." },
{ src: "../LICENSE.md", dest: "." },
{ src: '../README.md', dest: '.' },
{ src: '../LICENSE.md', dest: '.' },
],
}),
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
import '@glint/environment-ember-loose';
import 'ember-source/types';
import 'ember-source/types/preview';

declare module '@glint/environment-ember-loose/registry' {
export default interface Registry {
// Add any registry entries from other addons here that your addon itself uses (in non-strict mode templates)
// See https://typed-ember.gitbook.io/glint/using-glint/ember/using-addons
}
}
3 changes: 3 additions & 0 deletions ember-prismic-dom/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"extends": "@tsconfig/ember/tsconfig.json",
"include": ["src/**/*", "unpublished-development-types/**/*"],
"glint": {
"environment": "ember-loose"
},
"compilerOptions": {
"allowJs": true,
"declarationDir": "declarations",
Expand Down
Loading

0 comments on commit d2493bc

Please sign in to comment.