Skip to content

Commit

Permalink
Merge pull request #229 from ember-cli/convert-to-v2
Browse files Browse the repository at this point in the history
convert to v2 addon
  • Loading branch information
ef4 authored Feb 2, 2022
2 parents 729c36a + 82d68a4 commit 06254a4
Show file tree
Hide file tree
Showing 20 changed files with 223 additions and 74 deletions.
2 changes: 1 addition & 1 deletion addon/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = {
'./.eslintrc.js',
'./.prettierrc.js',
'./.template-lintrc.js',
'./index.js',
'./addon-main.js',
'./blueprints/*/index.js',
'./config/**/*.js',
],
Expand Down
2 changes: 2 additions & 0 deletions addon/addon-main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const { addonV1Shim } = require('@embroider/addon-shim');
module.exports = addonV1Shim(__dirname);
Empty file removed addon/addon/.gitkeep
Empty file.
Empty file removed addon/app/.gitkeep
Empty file.
3 changes: 0 additions & 3 deletions addon/app/helpers/page-title.js

This file was deleted.

1 change: 0 additions & 1 deletion addon/app/services/page-title-list.js

This file was deleted.

1 change: 0 additions & 1 deletion addon/app/services/page-title.js

This file was deleted.

7 changes: 7 additions & 0 deletions addon/babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"plugins": [
"@embroider/addon-dev/template-colocation-plugin",
["@babel/plugin-proposal-decorators", { "legacy": true }],
"@babel/plugin-proposal-class-properties"
]
}
41 changes: 0 additions & 41 deletions addon/blueprints/ember-page-title/index.js

This file was deleted.

5 changes: 0 additions & 5 deletions addon/config/environment.js

This file was deleted.

5 changes: 0 additions & 5 deletions addon/index.js

This file was deleted.

42 changes: 31 additions & 11 deletions addon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,61 @@
],
"license": "MIT",
"author": "Tim Evans <tim.c.evans@me.com>",
"directories": {
"doc": "doc",
"test": "tests"
"exports": {
".": "./dist/index.js",
"./*": "./dist/*",
"./test-support": "./dist/test-support/index.js",
"./addon-main.js": "./addon-main.js"
},
"files": [
"addon-main.js",
"dist"
],
"repository": "https://github.com/ember-cli/ember-page-title",
"scripts": {
"build": "rollup --config",
"lint": "npm-run-all --aggregate-output --continue-on-error --parallel \"lint:!(fix)\"",
"lint:fix": "npm-run-all --aggregate-output --continue-on-error --parallel lint:*:fix",
"lint:hbs": "ember-template-lint .",
"lint:hbs:fix": "ember-template-lint . --fix",
"lint:js": "eslint . --cache",
"lint:js:fix": "eslint . --fix"
"lint:js:fix": "eslint . --fix",
"start": "rollup --config --watch",
"prepublishOnly": "rollup --config"
},
"dependencies": {
"ember-cli-babel": "^7.26.6"
"@embroider/addon-shim": "^1.0.0"
},
"devDependencies": {
"@babel/core": "^7.16.12",
"@babel/plugin-proposal-class-properties": "^7.16.7",
"@babel/plugin-proposal-decorators": "^7.16.7",
"@embroider/addon-dev": "^1.0.0",
"@rollup/plugin-babel": "^5.3.0",
"babel-eslint": "^10.1.0",
"ember-template-lint": "^3.6.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-ember": "^10.5.4",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.4.1",
"ember-template-lint": "^3.6.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.3.2"
"prettier": "^2.3.2",
"rollup": "^2.67.0"
},
"engines": {
"node": "12.* || 14.* || >= 16"
},
"ember": {
"edition": "octane"
},
"ember-addon": {
"demoURL": "https://ember-cli.github.io/ember-page-title"
"demoURL": "https://ember-cli.github.io/ember-page-title",
"main": "addon-main.js",
"type": "addon",
"version": 2,
"app-js": {
"./helpers/page-title.js": "./dist/_app_/helpers/page-title.js",
"./services/page-title-list.js": "./dist/_app_/services/page-title-list.js",
"./services/page-title.js": "./dist/_app_/services/page-title.js"
}
},
"homepage": "https://ember-cli.github.io/ember-page-title",
"volta": {
Expand Down
50 changes: 50 additions & 0 deletions addon/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import babel from '@rollup/plugin-babel';
import { Addon } from '@embroider/addon-dev/rollup';

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

export default {
// This provides defaults that work well alongside `publicEntrypoints` below.
// You can augment this if you need to.
output: addon.output(),

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([
'helpers/**/*.js',
'services/**/*.js',
'test-support/index.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(['helpers/**/*.js', 'services/**/*.js']),

// 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.
babel({
babelHelpers: 'bundled',
}),

// 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(),

// 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']),

// Remove leftover build artifacts when starting a new build.
addon.clean(),
],
};
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"docs",
"test-app"
],
"scripts": {
"prepare": "cd addon && yarn build"
},
"volta": {
"node": "12.22.10",
"yarn": "1.22.17"
Expand Down
Loading

0 comments on commit 06254a4

Please sign in to comment.