Skip to content

Commit

Permalink
feat: initial v2 migration
Browse files Browse the repository at this point in the history
  • Loading branch information
aklkv committed Dec 24, 2024
1 parent a23d94b commit 4676b2e
Show file tree
Hide file tree
Showing 71 changed files with 3,356 additions and 697 deletions.
27 changes: 5 additions & 22 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,27 +1,10 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist/
/tmp/

# dependencies
/bower_components/
/node_modules/
node_modules/

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

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try
/yarn.lock.ember-try
.env*
.pnpm-debug.log
npm-debug.log*
yarn-error.log
39 changes: 0 additions & 39 deletions .npmignore

This file was deleted.

9 changes: 9 additions & 0 deletions addon/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# unconventional js
/blueprints/*/files/

# compiled output
/dist/
/declarations/

# misc
/coverage/
70 changes: 70 additions & 0 deletions addon/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
'use strict';

module.exports = {
root: true,
// Only use overrides
// https://github.com/ember-cli/eslint-plugin-ember?tab=readme-ov-file#gtsgjs
overrides: [
{
files: ['**/*.js'],
env: { browser: true },
parser: '@babel/eslint-parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
babelOptions: {
root: __dirname,
},
},
plugins: ['ember', 'import'],
extends: [
'eslint:recommended',
'plugin:ember/recommended',
'plugin:prettier/recommended',
],
rules: {
// require relative imports use full extensions
'import/extensions': ['error', 'always', { ignorePackages: true }],
// Add any custom rules here
},
},
{
files: ['**/*.gjs'],
parser: 'ember-eslint-parser',
plugins: ['ember', 'import'],
extends: [
'eslint:recommended',
'plugin:ember/recommended',
'plugin:ember/recommended-gjs',
'plugin:prettier/recommended',
],
rules: {
// require relative imports use full extensions
'import/extensions': ['error', 'always', { ignorePackages: true }],
// Add any custom rules here
},
},
// node files
{
files: [
'./.eslintrc.cjs',
'./.prettierrc.cjs',
'./.template-lintrc.cjs',
'./addon-main.cjs',
],
parserOptions: {
sourceType: 'script',
},
env: {
browser: false,
node: true,
},
plugins: ['n'],
extends: [
'eslint:recommended',
'plugin:n/recommended',
'plugin:prettier/recommended',
],
},
],
};
17 changes: 17 additions & 0 deletions addon/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# 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

# compiled output
dist/
declarations/

# npm/pnpm/yarn pack output
*.tgz

# deps & caches
node_modules/
.eslintcache
.prettiercache
9 changes: 9 additions & 0 deletions addon/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# unconventional js
/blueprints/*/files/

# compiled output
/dist/
/declarations/

# misc
/coverage/
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions addon/addon-main.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

const { addonV1Shim } = require('@embroider/addon-shim');

module.exports = addonV1Shim(__dirname);
20 changes: 20 additions & 0 deletions addon/babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"plugins": [
"@embroider/addon-dev/template-colocation-plugin",
[
"babel-plugin-ember-template-compilation",
{
"targetFormat": "hbs",
"transforms": []
}
],
[
"module:decorator-transforms",
{
"runtime": {
"import": "decorator-transforms/runtime"
}
}
]
]
}
1 change: 0 additions & 1 deletion addon/index.js

This file was deleted.

94 changes: 94 additions & 0 deletions addon/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
"name": "ember-a11y-refocus",
"version": "4.1.4",
"description": "accessibility addon to announce route change, reset focus, and provide a skip link",
"keywords": [
"ember-addon",
"accessibility",
"a11y",
"skiplink"
],
"repository": "https://github.com/ember-a11y/ember-a11y-refocus",
"license": "MIT",
"author": "Melanie Sumner <[email protected]>",
"directories": {
"doc": "doc",
"test": "tests"
},
"scripts": {
"build": "rollup --config",
"lint": "concurrently 'pnpm:lint:*(!fix)' --names 'lint:'",
"lint:fix": "concurrently 'pnpm:lint:*:fix' --names 'fix:'",
"lint:hbs": "ember-template-lint . --no-error-on-unmatched-pattern",
"lint:hbs:fix": "ember-template-lint . --fix --no-error-on-unmatched-pattern",
"lint:js": "eslint . --cache",
"lint:js:fix": "eslint . --fix",
"prepack": "rollup --config",
"start": "rollup --config --watch",
"test": "echo 'A v2 addon does not have tests, run tests in test-app'"
},
"dependencies": {
"@embroider/addon-shim": "^1.8.9",
"decorator-transforms": "^2.0.0"
},
"devDependencies": {
"@babel/core": "^7.25.2",
"@babel/eslint-parser": "^7.25.1",
"@babel/runtime": "^7.25.0",
"@embroider/addon-dev": "^5.0.0",
"@rollup/plugin-babel": "^6.0.4",
"babel-plugin-ember-template-compilation": "^2.2.5",
"concurrently": "^8.2.2",
"ember-template-lint": "^6.0.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-ember": "^12.1.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-n": "^17.10.2",
"eslint-plugin-prettier": "^5.2.1",
"prettier": "^3.3.3",
"rollup": "^4.20.0",
"rollup-plugin-copy": "^3.5.0"
},
"engines": {
"node": "16.* || >= 18.*"
},
"publishConfig": {
"registry": "https://registry.npmjs.org"
},
"ember": {
"edition": "octane"
},
"ember-addon": {
"app-js": {
"./components/navigation-narrator.js": "./dist/_app_/components/navigation-narrator.js"
},
"main": "addon-main.cjs",
"type": "addon",
"version": 2
},
"release-it": {
"plugins": {
"release-it-lerna-changelog": {
"infile": "CHANGELOG.md",
"launchEditor": false
}
},
"git": {
"tagName": "v${version}"
},
"github": {
"release": true,
"tokenRef": "GITHUB_AUTH"
}
},
"exports": {
".": "./dist/index.js",
"./*": "./dist/*.js",
"./addon-main.js": "./addon-main.cjs"
},
"files": [
"addon-main.cjs",
"dist"
]
}
72 changes: 72 additions & 0 deletions addon/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import { Addon } from '@embroider/addon-dev/rollup';
import { babel } from '@rollup/plugin-babel';
import copy from 'rollup-plugin-copy';

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.
// By default all your JavaScript modules (**/*.js) will be importable.
// But you are encouraged to tweak this to only cover the modules that make
// up your addon's public API. Also make sure your package.json#exports
// is aligned to the config here.
// See https://github.com/embroider-build/embroider/blob/main/docs/v2-faq.md#how-can-i-define-the-public-exports-of-my-addon
addon.publicEntrypoints(['**/*.js', '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([
'components/**/*.js',
'helpers/**/*.js',
'modifiers/**/*.js',
'services/**/*.js',
]),

// 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.
//
// By default, this will load the actual babel config from the file
// babel.config.json.
babel({
babelHelpers: 'bundled',
extensions: ['.js', '.gjs'],
}),

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

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

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

// Copy Readme and License into published package
copy({
targets: [
{ src: '../README.md', dest: '.' },
{ src: '../LICENSE.md', dest: '.' },
],
}),
],
};
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions addon/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { defaultValidator } from './utils/validators.js';
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion app/components/navigation-narrator.js

This file was deleted.

Loading

0 comments on commit 4676b2e

Please sign in to comment.