Skip to content

Commit

Permalink
Ember | Upgrade to v5
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielCousin committed Oct 8, 2023
1 parent 1bd5702 commit 80430df
Show file tree
Hide file tree
Showing 40 changed files with 4,984 additions and 4,098 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ on:
pull_request: {}

concurrency:
group: ci-${{ github.head_ref || github.ref }}
cancel-in-progress: true
group: ci-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
test:
name: "Tests"
name: 'Tests'
runs-on: ubuntu-latest
timeout-minutes: 12

Expand All @@ -33,7 +33,7 @@ jobs:
run: yarn test

floating:
name: "Floating Dependencies"
name: 'Floating Dependencies'
runs-on: ubuntu-latest

steps:
Expand All @@ -57,10 +57,11 @@ jobs:
matrix:
try-scenario:
- ember-lts-3.28
- ember-lts-4.8
- ember-lts-4.12
- ember-release
- ember-beta
- ember-canary
- ember-classic
- embroider-safe
- embroider-optimized

Expand All @@ -74,7 +75,9 @@ jobs:
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Run Tests
run: ./node_modules/.bin/ember try:one ${{ matrix.try-scenario }}
# Using UV_USE_IO_URING to prevent embroider-safe and embroider-optimized tests from hanging
# https://github.com/embroider-build/embroider/issues/1532
run: UV_USE_IO_URING=0 ./node_modules/.bin/ember try:one ${{ matrix.try-scenario }}
working-directory: test-app

publish:
Expand All @@ -88,8 +91,7 @@ jobs:
with:
node-version: '${{ env.NODE_VERSION }}'
registry-url: 'https://registry.npmjs.org'
- run:
yarn install --frozen-lockfile
- run: yarn install --frozen-lockfile
yarn prepare
- run: npm publish
env:
Expand Down
1 change: 1 addition & 0 deletions .prettierrc.js → .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

module.exports = {
plugins: ['prettier-plugin-ember-template-tag'],
singleQuote: true,
};
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2022
Copyright (c) 2023

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
20 changes: 20 additions & 0 deletions config/ember-cli-update.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"schemaVersion": "1.0.0",
"packages": [
{
"name": "@embroider/addon-blueprint",
"version": "2.7.0",
"blueprints": [
{
"name": "@embroider/addon-blueprint",
"isBaseBlueprint": true,
"options": [
"--ci-provider=github",
"--typescript",
"--yarn"
]
}
]
}
]
}
2 changes: 2 additions & 0 deletions ember-config-cat/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
# compiled output
/dist/
/tmp/
/declarations/


# dependencies
/bower_components/
Expand Down
23 changes: 17 additions & 6 deletions ember-config-cat/.eslintrc.js → ember-config-cat/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,24 @@ module.exports = {
],
},
overrides: [
// ts files
{
files: ['**/*.ts', '**/*.gts'],
extends: [
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
],
rules: {
// Add any custom rules here
},
},
// node files
{
files: [
'./.eslintrc.js',
'./.prettierrc.js',
'./.template-lintrc.js',
'./addon-main.js',
'./.eslintrc.cjs',
'./.prettierrc.cjs',
'./.template-lintrc.cjs',
'./addon-main.cjs',
],
parserOptions: {
sourceType: 'script',
Expand All @@ -42,8 +53,8 @@ module.exports = {
browser: false,
node: true,
},
plugins: ['node'],
extends: ['plugin:node/recommended'],
plugins: ['n'],
extends: ['plugin:n/recommended'],
rules: {
'@typescript-eslint/no-var-requires': 'off',
},
Expand Down
12 changes: 12 additions & 0 deletions ember-config-cat/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# 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
File renamed without changes.
File renamed without changes.
10 changes: 7 additions & 3 deletions ember-config-cat/babel.config.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
{
"presets": ["@babel/preset-typescript"],
"plugins": [
["@babel/plugin-transform-typescript", { "allowDeclareFields": true }],
["@babel/plugin-transform-typescript", { "allExtensions": true, "onlyRemoveTypeImports": true, "allowDeclareFields": true }],
"@embroider/addon-dev/template-colocation-plugin",
["@babel/plugin-proposal-decorators", { "legacy": true }],
"@babel/plugin-transform-class-static-block",
["babel-plugin-ember-template-compilation", {
"targetFormat": "hbs",
"transforms": []
}],
["@babel/plugin-proposal-decorators", { "version": "legacy" }],
"@babel/plugin-proposal-class-properties"
]
}
92 changes: 63 additions & 29 deletions ember-config-cat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,54 +10,83 @@
"license": "MIT",
"author": "",
"files": [
"addon-main.js",
"addon-main.cjs",
"declarations",
"dist"
],
"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",
"build": "concurrently 'npm:build:*'",
"build:js": "rollup --config",
"build:types": "glint --declaration",
"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:hbs:fix": "ember-template-lint . --fix --no-error-on-unmatched-pattern",
"lint:js": "eslint . --cache",
"lint:js:fix": "eslint . --fix",
"start": "rollup --config --watch",
"test": "echo 'A v2 addon does not have tests, run tests in test-app'",
"prepare": "yarn build"
"lint:types": "glint",
"prepack": "rollup --config",
"start": "concurrently 'npm:start:*'",
"start:js": "rollup --config --watch --no-watch.clearScreen",
"start:types": "glint --declaration --watch",
"test": "echo 'A v2 addon does not have tests, run tests in test-app'"
},
"dependencies": {
"@ember/test-helpers": "^2.9.3",
"@embroider/addon-shim": "^1.8.4",
"configcat-common": "^6.0.0",
"configcat-js": "^6.0.0"
"configcat-js": "^6.0.0",
"ember-qunit": ">= 6"
},
"devDependencies": {
"@babel/core": "^7.20.7",
"@babel/eslint-parser": "^7.19.1",
"@babel/plugin-proposal-class-properties": "^7.16.7",
"@babel/plugin-proposal-decorators": "^7.20.7",
"@babel/plugin-syntax-decorators": "^7.17.0",
"@babel/preset-typescript": "^7.18.6",
"@embroider/addon-dev": "^3.0.0",
"@types/ember__component": "^4.0.11",
"@types/ember__debug": "^4.0.3",
"@types/ember__destroyable": "^4.0.1",
"@types/ember__engine": "^4.0.4",
"@types/ember__runloop": "^4.0.2",
"@types/ember__service": "^4.0.2",
"@babel/plugin-transform-class-static-block": "^7.20.0",
"@babel/plugin-transform-typescript": "^7.22.15",
"@babel/runtime": "^7.17.0",
"@embroider/addon-dev": "^4.1.0",
"@glint/core": "^1.2.0",
"@glint/environment-ember-loose": "^1.2.0",
"@glint/environment-ember-template-imports": "^1.2.0",
"@glint/template": "^1.2.0",
"@rollup/plugin-babel": "^6.0.3",
"@tsconfig/ember": "^2.0.0",
"@types/ember": "^4.0.4",
"@types/ember__application": "^4.0.6",
"@types/ember__array": "^4.0.4",
"@types/ember__component": "^4.0.14",
"@types/ember__controller": "^4.0.5",
"@types/ember__debug": "^4.0.4",
"@types/ember__engine": "^4.0.5",
"@types/ember__error": "^4.0.3",
"@types/ember__helper": "^4.0.3",
"@types/ember__modifier": "^4.0.6",
"@types/ember__object": "^4.0.6",
"@types/ember__owner": "^4.0.4",
"@types/ember__polyfills": "^4.0.2",
"@types/ember__routing": "^4.0.13",
"@types/ember__runloop": "^4.0.3",
"@types/ember__service": "^4.0.3",
"@types/ember__string": "^3.16.3",
"@types/ember__template": "^4.0.1",
"@types/ember__test": "^4.0.1",
"@types/ember__utils": "^4.0.2",
"@types/ember__template": "^4.0.2",
"@types/ember__test": "^4.0.2",
"@types/ember__utils": "^4.0.3",
"@types/qunit": "^2.19.6",
"babel-plugin-ember-template-compilation": "^2.2.0",
"concurrently": "^8.0.1",
"ember-cli-htmlbars": "^6.1.1",
"ember-template-lint": "^5.3.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-ember": "^11.3.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.0.0",
"npm-run-all": "^4.1.5",
"rollup": "2.79.1",
"rollup-plugin-ts": "^3.0.2"
"eslint-plugin-prettier": "^5.0.0",
"prettier-plugin-ember-template-tag": "^1.1.0",
"rollup": "^3.21.8",
"rollup-plugin-copy": "^3.4.0",
"typescript": "^5.0.4"
},
"publishConfig": {
"registry": "https://registry.npmjs.org"
Expand All @@ -68,7 +97,7 @@
"ember-addon": {
"version": 2,
"type": "addon",
"main": "addon-main.js",
"main": "addon-main.cjs",
"app-js": {
"./helpers/get-flag-value.js": "./dist/_app_/helpers/get-flag-value.js",
"./helpers/has-flag-value.js": "./dist/_app_/helpers/has-flag-value.js",
Expand All @@ -77,15 +106,20 @@
}
},
"exports": {
".": "./dist/index.js",
"./*": "./dist/*",
"./addon-main.js": "./addon-main.js",
"./test-support": "./dist/test-support.js"
".": {
"types": "./declarations/index.d.ts",
"default": "./dist/index.js"
},
"./*": {
"types": "./declarations/*.d.ts",
"default": "./dist/*.js"
},
"./addon-main.js": "./addon-main.cjs"
},
"typesVersions": {
"*": {
"*": [
"dist/*"
"declarations/*"
]
}
}
Expand Down
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 copy from 'rollup-plugin-copy';
import { Addon } from '@embroider/addon-dev/rollup';

const addon = new Addon({
Expand All @@ -19,36 +20,34 @@ export default {
'services/**/*.ts',
'index.ts',
'test-support.ts',
'template-registry.ts',
]),

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

typescript({
transpiler: 'babel',
browserslist: false,
transpileOnly: false,
tsconfig: {
fileName: 'tsconfig.json',
hook: (config) => ({
...config,
declaration: true,
declarationMap: true,
// See: https://devblogs.microsoft.com/typescript/announcing-typescript-4-5/#beta-delta
// Allows us to use `exports` to define types per export
// However, we can't use that feature until the minimum supported TS is 4.7+
declarationDir: './dist',
}),
},
}),
addon.appReexports([
'helpers/**/*.js',
'services/**/*.js',
'utils/**/*.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 collocation.
//
// By default, this will load the actual babel config from the file
// babel.config.json.
babel({
extensions: ['.js', '.gjs', '.ts', '.gts'],
babelHelpers: 'bundled',
}),

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

Expand All @@ -58,5 +57,13 @@ export default {

// 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: '.' },
],
}),
],
};
Loading

0 comments on commit 80430df

Please sign in to comment.