-
Notifications
You must be signed in to change notification settings - Fork 46
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
chore!: convert addon to v2 format #747
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
This is breaking change as it now requires the consuming addon or the add to have ember-auto-import >= v2
- Loading branch information
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,9 @@ | |
|
||
# compiled output | ||
/dist | ||
/tmp | ||
|
||
# dependencies | ||
/node_modules | ||
/bower_components | ||
|
||
# misc | ||
/.eslintcache | ||
|
@@ -19,6 +17,6 @@ yarn-error.log | |
testem.log | ||
.DS_Store | ||
|
||
# ember-try | ||
.node_modules.ember-try/ | ||
package.json.ember-try | ||
# .md copies from release | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. to make those files explorable on github, we keep them in the root folder. to make those files packed at publish time, we copy them to the addon folder. |
||
/CHANGELOG.md | ||
/README.md |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
const { addonV1Shim } = require('@embroider/addon-shim'); | ||
module.exports = addonV1Shim(__dirname); |
This file was deleted.
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" | ||
] | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,30 +5,51 @@ | |
"keywords": [ | ||
"ember-addon" | ||
], | ||
"repository": "https://github.com/simplabs/ember-cookies", | ||
"license": "MIT", | ||
"author": "", | ||
"exports": { | ||
".": "./dist/index.js", | ||
"./*": "./dist/*", | ||
"./test-support": "./dist/test-support/index.js", | ||
"./addon-main.js": "./addon-main.js" | ||
}, | ||
"directories": { | ||
"doc": "doc", | ||
"test": "tests" | ||
}, | ||
"repository": "https://github.com/simplabs/ember-cookies", | ||
"files": [ | ||
"addon-main.js", | ||
"dist" | ||
], | ||
"scripts": { | ||
"build": "rollup --config", | ||
"copyDoc": "cp ../../*.md .", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is where copy of the files happens. |
||
"lint": "yarn lint:js", | ||
"lint:js": "eslint . --cache", | ||
"lint:js:fix": "eslint . --fix" | ||
"lint:js:fix": "eslint . --fix", | ||
"prepublishOnly": "npm-run-all --aggregate-output --continue-on-error --parallel copyDoc build", | ||
"start": "rollup --config --watch", | ||
"test": "echo 'A v2 addon does not have tests, run tests in test-app'" | ||
}, | ||
"dependencies": { | ||
"ember-cli-babel": "^7.26.3", | ||
"@embroider/addon-shim": "^1.7.1", | ||
"ember-native-class-polyfill": "^1.0.6" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.18.2", | ||
"@babel/eslint-parser": "^7.17.0", | ||
"@babel/plugin-proposal-class-properties": "^7.17.12", | ||
"@babel/plugin-proposal-decorators": "^7.18.2", | ||
"@embroider/addon-dev": "^1.7.1", | ||
"@rollup/plugin-babel": "^5.3.1", | ||
"eslint": "^8.0.0", | ||
"eslint-config-prettier": "^8.1.0", | ||
"eslint-plugin-ember": "^10.3.0", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"prettier": "2.6.2" | ||
"prettier": "2.6.2", | ||
"rollup": "^2.74.1" | ||
}, | ||
"engines": { | ||
"node": ">= 14.*" | ||
|
@@ -37,8 +58,14 @@ | |
"edition": "octane" | ||
}, | ||
"ember-addon": { | ||
"main": "addon-main.js", | ||
"type": "addon", | ||
"version": 2, | ||
"versionCompatibility": { | ||
"ember": ">=3.4" | ||
}, | ||
"app-js": { | ||
"./services/cookies.js": "./dist/_app_/services/cookies.js" | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
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([ | ||
'services/**/*.js', | ||
'test-support/**/*.js', | ||
'utils/**/*.js', | ||
'clear-all-cookies.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(['services/cookies.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. | ||
// | ||
// By default, this will load the actual babel config from the file | ||
// babel.config.json. | ||
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(), | ||
], | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as clearAllCookies } from './clear-all-cookies'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is needed to build the addon as v2 addon needs to be prebuilt before consumption