Skip to content
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

Upgrade api to ember 4.12 #1833

Merged
merged 7 commits into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions addons/api/.ember-cli
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"disableAnalytics": false,

/**
Setting `isTypeScriptProject` to true will force the blueprint generators to generate TypeScript
rather than JavaScript by default, when a TypeScript version of a given blueprint is available.
Setting `isTypeScriptProject` to true will force the blueprint generators to generate TypeScript
rather than JavaScript by default, when a TypeScript version of a given blueprint is available.
*/
"isTypeScriptProject": false
}
10 changes: 6 additions & 4 deletions addons/api/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ module.exports = {
root: true,
parser: '@babel/eslint-parser',
parserOptions: {
ecmaVersion: 2018,
ecmaVersion: 'latest',
sourceType: 'module',
// This is specific babel-config. If grows consider creating a babel config file
requireConfigFile: false,
babelOptions: {
plugins: [['@babel/plugin-proposal-decorators', { legacy: true }]],
plugins: [
['@babel/plugin-proposal-decorators', { decoratorsBeforeExport: true }],
],
},
// end of babel-config
},
Expand All @@ -36,6 +38,7 @@ module.exports = {
files: [
'./.eslintrc.js',
'./.prettierrc.js',
'./.stylelintrc.js',
'./.template-lintrc.js',
'./ember-cli-build.js',
'./index.js',
Expand All @@ -51,8 +54,7 @@ module.exports = {
browser: false,
node: true,
},
plugins: ['node'],
extends: ['plugin:node/recommended'],
extends: ['plugin:n/recommended'],
},
{
// Test files:
Expand Down
Empty file.
1 change: 0 additions & 1 deletion addons/api/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
/.travis.yml
/.watchmanconfig
/bower.json
/config/ember-try.js
/CONTRIBUTING.md
/ember-cli-build.js
/testem.js
Expand Down
9 changes: 8 additions & 1 deletion addons/api/.prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,12 @@
*/

module.exports = {
singleQuote: true,
overrides: [
{
files: '*.{js,ts}',
options: {
singleQuote: true,
},
},
],
};
6 changes: 3 additions & 3 deletions addons/api/addon/serializers/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ export default class ApplicationSerializer extends RESTSerializer {
* @return {object}
*/
normalizeMissingArrays(store, primaryModelClass, payload) {
const attrDefs = store._attributesDefinitionFor(
primaryModelClass.modelName
);
const attrDefs = store
.getSchemaDefinitionService()
.attributesDefinitionFor({ type: primaryModelClass.modelName });
if (attrDefs) {
Object.keys(attrDefs).forEach((key) => {
if (!payload[key] && attrDefs[key]?.options?.emptyArrayIfMissing) {
Expand Down
2 changes: 1 addition & 1 deletion addons/api/ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const EmberAddon = require('ember-cli/lib/broccoli/ember-addon');
const { maybeEmbroider } = require('@embroider/test-setup');

module.exports = function (defaults) {
let app = new EmberAddon(defaults, {
const app = new EmberAddon(defaults, {
// Add options here
});

Expand Down
55 changes: 29 additions & 26 deletions addons/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,67 +10,70 @@
"scripts": {
"build:development": "ember build",
"build": "ember build --environment=production",
"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": "concurrently \"npm:lint:*(!fix)\" --names \"lint:\"",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None blocking comment: I guess ember-cli deprecated npm-run-all and installed concurrently? or we did so?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this was all ember-cli 😆

"lint:fix": "concurrently \"npm:lint:*:fix\" --names \"fix:\"",
"lint:js": "eslint .",
"lint:js:fix": "eslint . --fix",
"format": "yarn run format:js",
"format:js": "prettier --write '{addon,app,config,stories,tests,mirage}/**/*.js' *.js",
"start": "ember serve",
"test": "ember exam --test-port 0 --split=4 --parallel=1 --random",
"test": "concurrently \"npm:lint\" \"npm:test:*\" --names \"lint,test:\"",
"test:ember-compatibility": "ember try:each",
"precommit": "yarn lint && yarn format && yarn test",
"doc:toc": "doctoc README.md"
},
"dependencies": {
"ember-can": "^4.2.0",
"ember-cli-babel": "^7.26.10",
"ember-cli-htmlbars": "^6.1.0",
"ember-cli-htmlbars": "^6.2.0",
"ember-cli-mirage": "^2.4.0",
"ember-data": "~4.4.0",
"ember-data": "~4.12.0",
"ember-fetch": "^8.1.1"
},
"devDependencies": {
"@babel/eslint-parser": "^7.18.2",
"@babel/plugin-proposal-decorators": "^7.18.6",
"@babel/core": "^7.18.5",
"@babel/eslint-parser": "^7.21.3",
"@babel/plugin-proposal-decorators": "^7.21.0",
"@ember/optional-features": "^2.0.0",
"@ember/test-helpers": "^2.8.1",
"@ember/string": "^3.0.1",
"@ember/test-helpers": "^2.9.3",
"@embroider/test-setup": "^2.1.1",
"@glimmer/component": "^1.1.2",
"@glimmer/tracking": "^1.1.2",
"broccoli-asset-rev": "^3.0.0",
"concurrently": "^8.0.1",
"doctoc": "^2.2.0",
"ember-auto-import": "^2.4.3",
"ember-cli": "^4.4.1",
"ember-auto-import": "^2.6.3",
"ember-cli": "^4.12.1",
"ember-cli-dependency-checker": "^3.3.1",
"ember-cli-inject-live-reload": "^2.1.0",
"ember-cli-sri": "^2.1.1",
"ember-cli-terser": "^4.0.2",
"ember-disable-prototype-extensions": "^1.1.3",
"ember-exam": "^8.0.0",
"ember-export-application-global": "^2.0.1",
"ember-load-initializers": "^2.1.2",
"ember-page-title": "^7.0.0",
"ember-qunit": "^6.0.0",
"ember-resolver": "^8.0.3",
"ember-source": "~4.4.0",
"ember-qunit": "^6.2.0",
"ember-resolver": "^10.0.0",
"ember-source": "~4.12.0",
"ember-source-channel-url": "^3.0.0",
"ember-template-lint": "^4.14.0",
"eslint": "^8.18.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-ember": "^10.6.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-qunit": "^7.3.0",
"ember-template-lint": "^5.7.2",
"eslint": "^8.37.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-ember": "^11.5.0",
"eslint-plugin-n": "^15.7.0",
"eslint-plugin-qunit": "^7.3.4",
"js-bexpr": "hashicorp/js-bexpr#9b4a4b54d85eba67fdfc0990133d1518d890b1e1",
"loader.js": "^4.7.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.6.2",
"qunit": "^2.19.1",
"prettier": "^2.8.7",
"qunit": "^2.19.4",
"qunit-dom": "^2.0.0",
"webpack": "^5.76.0"
"webpack": "^5.78.0"
},
"peerDependencies": {
"ember-source": "^4.0.0"
},
"engines": {
"node": "12.* || 14.* || 16.*"
"node": "14.* || 16.* || >= 18"
},
"ember": {
"edition": "octane"
Expand Down
2 changes: 1 addition & 1 deletion addons/api/tests/dummy/config/ember-cli-update.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"packages": [
{
"name": "ember-cli",
"version": "4.4.1",
"version": "4.12.1",
"blueprints": [
{
"name": "addon",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,18 @@ module.exports = async function () {
return {
scenarios: [
{
name: 'ember-lts-3.28',
name: 'ember-lts-4.4',
npm: {
devDependencies: {
'ember-source': '~4.4.0',
},
},
},
{
name: 'ember-lts-4.8',
npm: {
devDependencies: {
'ember-source': '~3.28.0',
'ember-source': '~4.8.0',
},
},
},
Expand Down
7 changes: 2 additions & 5 deletions addons/api/tests/dummy/config/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,17 @@
'use strict';

module.exports = function (environment) {
let ENV = {
const ENV = {
modulePrefix: 'dummy',
environment,
rootURL: '/',
locationType: 'history',
EmberENV: {
EXTEND_PROTOTYPES: false,
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. EMBER_NATIVE_DECORATOR_SUPPORT: true
},
EXTEND_PROTOTYPES: {
// Prevent Ember Data from overriding Date.parse.
Date: false,
},
},

APP: {
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"test:addons-rose": "yarn --cwd addons/rose test",
"test:ui-admin": "yarn --cwd ui/admin test",
"test:ui-desktop": "yarn --cwd ui/desktop test",
"compliance:licenses": "license-checker --onlyAllow 'Apache*;Apache License, Version 2.0;Apache-2.0;Apache 2.0;Artistic-2.0;BSD;BSD-3-Clause;CC-BY-3.0;CC-BY-4.0;CC0-1.0;ISC;MIT;MPL-2.0;Public Domain;Python-2.0;Unicode-TOU;Unlicense;WTFPL' --excludePackages 'boundary-ui;[email protected];[email protected];[email protected];[email protected];[email protected];[email protected];@hashicorp/[email protected]'",
"compliance:licenses": "license-checker --onlyAllow 'Apache*;Apache License, Version 2.0;Apache-2.0;Apache 2.0;Artistic-2.0;BSD;BSD-3-Clause;CC-BY-3.0;CC-BY-4.0;CC0-1.0;ISC;MIT;MPL-2.0;Public Domain;Python-2.0;Unicode-TOU;Unlicense;WTFPL' --excludePackages 'boundary-ui;[email protected];[email protected];[email protected];[email protected];[email protected];[email protected];@hashicorp/[email protected];[email protected]'",
"doc:toc": "doctoc README.md",
"prepare": "husky install"
},
Expand Down Expand Up @@ -82,7 +82,8 @@
"**/@storybook/**/ansi-regex": "^5.0.1",
"**/jsprim/json-schema": "^0.4.0",
"**/@storybook/**/yuidocjs/markdown-it": "^12.3.2",
"**/ember-cli/markdown-it-terminal/markdown-it": "^12.3.2"
"**/ember-cli/markdown-it-terminal/markdown-it": "^12.3.2",
"**/ember-cli-mirage/@embroider/macros": "^1.0.0"
Copy link
Collaborator Author

@ZedLi ZedLi Aug 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This resolution is needed because there's a current issue when building with multiple versions of @embroider/macros. See this issue and this one for more info. Until ember-cli-mirage releases the next version that uses a version that's >1.0.0, we'll need to force it.

},
"config": {
"commitizen": {
Expand Down
Loading