Skip to content

Commit

Permalink
ember-cli 4.4.0, remove auto service injection (#383)
Browse files Browse the repository at this point in the history
* ember-cli 4.4.0

* Fix lint

* Use Object.assign

* Update object-test.js

* Update imports

* Update computed-test.js

* Update flash-messages.js

* Remove initializer

* Remove injectionFactories
  • Loading branch information
RobbieTheWagner committed Jun 16, 2022
1 parent bb78eb7 commit 0938667
Show file tree
Hide file tree
Showing 29 changed files with 2,468 additions and 1,160 deletions.
4 changes: 0 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

root = true


[*]
end_of_line = lf
charset = utf-8
Expand All @@ -16,8 +15,5 @@ indent_size = 2
[*.hbs]
insert_final_newline = false

[*.js]
quote_type = single

[*.{diff,md}]
trim_trailing_whitespace = false
8 changes: 7 additions & 1 deletion .ember-cli
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,11 @@

Setting `disableAnalytics` to true will prevent any data from being sent.
*/
"disableAnalytics": false
"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.
*/
"isTypeScriptProject": false
}
19 changes: 9 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ 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"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install Node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 12.x
cache: yarn
Expand All @@ -35,8 +35,8 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 12.x
cache: yarn
Expand All @@ -48,7 +48,7 @@ jobs:
try-scenarios:
name: ${{ matrix.try-scenario }}
runs-on: ubuntu-latest
needs: 'test'
needs: "test"

strategy:
fail-fast: false
Expand All @@ -60,14 +60,13 @@ jobs:
- ember-beta
- ember-canary
- ember-classic
- ember-default-with-jquery
- embroider-safe
- embroider-optimized

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install Node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 12.x
cache: yarn
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@
/package.json.ember-try
/package-lock.json.ember-try
/yarn.lock.ember-try

# broccoli-debug
/DEBUG/
27 changes: 6 additions & 21 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,25 @@
# How to contribute

## Goals
The goal and scope of the component is simple – handle flash messages in an `ember-cli` app.

## Where you can help
You can contribute code, design (maybe 'themes' for different kinds of flash messages?), write documentation, fix typos, raise issues and so on. There's more to open source contribution than just code! Any help is welcome, as long as the guidelines are followed.
# How To Contribute

## Installation

* `git clone https://github.com/poteto/ember-cli-flash.git`
* `git clone <repository-url>`
* `cd ember-cli-flash`
* `yarn install`

## Linting

* `yarn run lint:js`
* `yarn run lint:js:fix`
* `yarn run lint:hbs`
* `yarn run lint:hbs:fix`

or with a single command

* `yarn run lint:fix`
* `yarn lint`
* `yarn lint:fix`

## Running tests

* `ember test` – Runs the test suite on the current Ember version
* `ember test --server` – Runs the test suite in "watch mode"
* `yarn test` – Runs `ember try:each` to test your addon against multiple Ember versions
* `ember try:each` – Runs the test suite against multiple Ember versions

## Running the dummy application

* `ember serve`
* Visit the dummy application at [http://localhost:4200](http://localhost:4200).

For more information on using ember-cli, visit [https://ember-cli.com/](https://ember-cli.com/).

## Making changes
Feel free to submit a pull request for changes to this document.
For more information on using ember-cli, visit [https://cli.emberjs.com/release/](https://cli.emberjs.com/release/).
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# ember-cli-flash

![Download count all time](https://img.shields.io/npm/dt/ember-cli-flash.svg) [![npm version](https://badge.fury.io/js/ember-cli-flash.svg)](http://badge.fury.io/js/ember-cli-flash) [![CircleCI](https://circleci.com/gh/poteto/ember-cli-flash.svg?style=shield)](https://circleci.com/gh/poteto/ember-cli-flash) [![Ember Observer Score](http://emberobserver.com/badges/ember-cli-flash.svg)](http://emberobserver.com/addons/ember-cli-flash) [![Code Climate](https://codeclimate.com/github/poteto/ember-cli-flash/badges/gpa.svg)](https://codeclimate.com/github/poteto/ember-cli-flash)
![Download count all time](https://img.shields.io/npm/dt/ember-cli-flash.svg) [![npm version](https://badge.fury.io/js/ember-cli-flash.svg)](http://badge.fury.io/js/ember-cli-flash)
[![Ember Observer Score](http://emberobserver.com/badges/ember-cli-flash.svg)](http://emberobserver.com/addons/ember-cli-flash)
[![Code Climate](https://codeclimate.com/github/poteto/ember-cli-flash/badges/gpa.svg)](https://codeclimate.com/github/poteto/ember-cli-flash)

*Simple, highly configurable flash messages for ember.*

Expand Down Expand Up @@ -41,7 +43,7 @@ ember install ember-cli-flash
```

## Compatibility
This addon is tested against the Ember `release`, `beta` and `canary` channels, back to Ember `v3.16`.
This addon is tested against the Ember `release`, `beta` and `canary` channels, back to Ember `v3.24`.

## Usage
Usage is very simple. First, add one of the [template examples](#displaying-flash-messages) to your app. Then, inject the `flashMessages` service and use one of its convenience methods:
Expand Down
2 changes: 1 addition & 1 deletion addon/flash/object.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Evented from '@ember/object/evented';
import EmberObject, { set } from '@ember/object';
import { cancel, later } from '@ember/runloop';
import { guidFor } from '../utils/computed';
import { guidFor } from 'ember-cli-flash/utils/computed';

// Note:
// To avoid https://github.com/poteto/ember-cli-flash/issues/341 from happening, this class can't simply be called Object
Expand Down
17 changes: 6 additions & 11 deletions addon/services/flash-messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ import { typeOf, isNone } from '@ember/utils';
import { warn, assert } from '@ember/debug';
import { set, get, setProperties, computed } from '@ember/object';
import { classify } from '@ember/string';
import { assign } from '@ember/polyfills';
import { A as emberArray } from '@ember/array';
import FlashMessage from 'ember-cli-flash/flash/object';
import objectWithout from '../utils/object-without';
import objectWithout from 'ember-cli-flash/utils/object-without';
import { getOwner } from '@ember/application';
import flashMessageOptions from '../utils/flash-message-options';
import getWithDefault from '../utils/get-with-default';
import flashMessageOptions from 'ember-cli-flash/utils/flash-message-options';
import getWithDefault from 'ember-cli-flash/utils/get-with-default';

export default class FlashMessagesService extends Service {
@(equal('queue.length', 0).readOnly())
Expand Down Expand Up @@ -92,13 +91,9 @@ export default class FlashMessagesService extends Service {

const flashService = this;
const allDefaults = getWithDefault(this, 'flashMessageDefaults', {});
const defaults = objectWithout(allDefaults, [
'types',
'injectionFactories',
'preventDuplicates',
]);
const defaults = objectWithout(allDefaults, ['types', 'preventDuplicates']);

const flashMessageOptions = assign({}, defaults, { flashService });
const flashMessageOptions = Object.assign({}, defaults, { flashService });

for (let key in options) {
const value = get(options, key);
Expand Down Expand Up @@ -145,7 +140,7 @@ export default class FlashMessagesService extends Service {
assert('The flash type cannot be undefined', type);

this[type] = (message, options = {}) => {
const flashMessageOptions = assign({}, options);
const flashMessageOptions = Object.assign({}, options);
setProperties(flashMessageOptions, { message, type });

return this.add(flashMessageOptions);
Expand Down
6 changes: 1 addition & 5 deletions addon/utils/flash-message-options.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/* eslint-disable ember/new-module-imports */
import { assign } from '@ember/polyfills';

export default function (configOverrides) {
const addonDefaults = {
timeout: 3000,
Expand All @@ -10,8 +7,7 @@ export default function (configOverrides) {
showProgress: false,
type: 'info',
types: ['success', 'info', 'warning', 'danger', 'alert', 'secondary'],
injectionFactories: ['route', 'controller', 'view', 'component'],
preventDuplicates: false,
};
return assign(addonDefaults, configOverrides);
return Object.assign(addonDefaults, configOverrides);
}
35 changes: 0 additions & 35 deletions app/initializers/flash-messages.js

This file was deleted.

10 changes: 5 additions & 5 deletions blueprints/ember-cli-flash/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ var EOL = require('os').EOL;
module.exports = {
description: 'Generates ember-cli-flash test helper',

afterInstall: function () {
var TEST_HELPER_PATH = 'tests/test-helper.js';
var IMPORT_STATEMENT = EOL + "import './helpers/flash-message';";
var INSERT_AFTER = "import { start } from 'ember-qunit';";
afterInstall() {
const TEST_HELPER_PATH = 'tests/test-helper.js';
const IMPORT_STATEMENT = EOL + "import './helpers/flash-message';";
const INSERT_AFTER = "import { start } from 'ember-qunit';";

return this.insertIntoFile(TEST_HELPER_PATH, IMPORT_STATEMENT, {
after: INSERT_AFTER,
});
},

normalizeEntityName: function () {},
normalizeEntityName() {},
};
45 changes: 3 additions & 42 deletions config/ember-try.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,12 @@
'use strict';

const getChannelURL = require('ember-source-channel-url');
const { embroiderSafe, embroiderOptimized } = require('@embroider/test-setup');

module.exports = async function () {
return {
useYarn: true,
scenarios: [
{
name: 'ember-lts-3.12',
npm: {
devDependencies: {
'ember-source': '~3.12.0',
},
},
},
{
name: 'ember-lts-3.16',
npm: {
devDependencies: {
'ember-source': '~3.16.0',
},
},
},
{
name: 'ember-lts-3.24',
npm: {
Expand All @@ -48,7 +33,6 @@ module.exports = async function () {
},
{
name: 'ember-beta',
allowedToFail: true,
npm: {
devDependencies: {
'ember-source': await getChannelURL('beta'),
Expand All @@ -57,37 +41,12 @@ module.exports = async function () {
},
{
name: 'ember-canary',
allowedToFail: true,
npm: {
devDependencies: {
'ember-source': await getChannelURL('canary'),
},
},
},
// The default `.travis.yml` runs this scenario via `yarn test`,
// not via `ember try`. It's still included here so that running
// `ember try:each` manually or from a customized CI config will run it
// along with all the other scenarios.
{
name: 'ember-default',
npm: {
devDependencies: {},
},
},
{
name: 'ember-default-with-jquery',
env: {
EMBER_OPTIONAL_FEATURES: JSON.stringify({
'jquery-integration': true,
}),
},
npm: {
devDependencies: {
'@ember/jquery': '^1.1.0',
'ember-source': '~3.28.0',
},
},
},
{
name: 'ember-classic',
env: {
Expand All @@ -106,6 +65,8 @@ module.exports = async function () {
},
},
},
embroiderSafe(),
embroiderOptimized(),
],
};
};

0 comments on commit 0938667

Please sign in to comment.