Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
122 changes: 115 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Default values
defaults: &defaults
docker:
- image: circleci/node:6-browsers
- image: circleci/node:10-browsers
working_directory: ~/ember-simple-react

version: 2
Expand Down Expand Up @@ -126,14 +126,14 @@ jobs:
name: Run Tests
command: ./node_modules/.bin/ember try:one ember-3.2 --skip-cleanup=true

test_3_4:
test_lts_3_4:
<<: *defaults
steps:
- attach_workspace:
at: .
- run:
name: Run Tests
command: ./node_modules/.bin/ember try:one ember-3.4 --skip-cleanup=true
command: ./node_modules/.bin/ember try:one ember-lts-3.4 --skip-cleanup=true

test_3_6:
<<: *defaults
Expand All @@ -144,6 +144,87 @@ jobs:
name: Run Tests
command: ./node_modules/.bin/ember try:one ember-3.6 --skip-cleanup=true

test_lts_3_8:
<<: *defaults
steps:
- attach_workspace:
at: .
- run:
name: Run Tests
command: ./node_modules/.bin/ember try:one ember-lts-3.8 --skip-cleanup=true

test_lts_3_12:
<<: *defaults
steps:
- attach_workspace:
at: .
- run:
name: Run Tests
command: ./node_modules/.bin/ember try:one ember-lts-3.12 --skip-cleanup=true

test_3_13:
<<: *defaults
steps:
- attach_workspace:
at: .
- run:
name: Run Tests
command: ./node_modules/.bin/ember try:one ember-3.13 --skip-cleanup=true

test_3_14:
<<: *defaults
steps:
- attach_workspace:
at: .
- run:
name: Run Tests
command: ./node_modules/.bin/ember try:one ember-3.14 --skip-cleanup=true

test_3_15:
<<: *defaults
steps:
- attach_workspace:
at: .
- run:
name: Run Tests
command: ./node_modules/.bin/ember try:one ember-3.15 --skip-cleanup=true

test_lts_3_16:
<<: *defaults
steps:
- attach_workspace:
at: .
- run:
name: Run Tests
command: ./node_modules/.bin/ember try:one ember-lts-3.16 --skip-cleanup=true

test_lts_3_20:
<<: *defaults
steps:
- attach_workspace:
at: .
- run:
name: Run Tests
command: ./node_modules/.bin/ember try:one ember-lts-3.20 --skip-cleanup=true

test_lts_3_24:
<<: *defaults
steps:
- attach_workspace:
at: .
- run:
name: Run Tests
command: ./node_modules/.bin/ember try:one ember-lts-3.24 --skip-cleanup=true

test_lts_3_28:
<<: *defaults
steps:
- attach_workspace:
at: .
- run:
name: Run Tests
command: ./node_modules/.bin/ember try:one ember-lts-3.28 --skip-cleanup=true

test_release:
<<: *defaults
steps:
Expand Down Expand Up @@ -206,18 +287,45 @@ workflows:
- test_3_2:
requires:
- setup_environment
- test_3_4:
- test_lts_3_4:
requires:
- setup_environment
- test_3_6:
requires:
- setup_environment
- test_release:
- test_lts_3_8:
requires:
- setup_environment
- test_lts_3_12:
requires:
- setup_environment
- test_3_13:
requires:
- setup_environment
- test_3_14:
requires:
- setup_environment
- test_beta:
- test_3_15:
requires:
- setup_environment
- test_canary:
- test_lts_3_16:
requires:
- setup_environment
- test_lts_3_20:
requires:
- setup_environment
- test_lts_3_24:
requires:
- setup_environment
- test_lts_3_28:
requires:
- setup_environment
- test_release:
requires:
- setup_environment
# - test_beta:
# requires:
# - setup_environment
# - test_canary:
# requires:
# - setup_environment
34 changes: 32 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
module.exports = {
root: true,
parserOptions: {
ecmaVersion: 8,
ecmaFeatures: {
jsx: true,
},
sourceType: 'module',
},
extends: ['eslint:recommended', 'prettier'],
plugins: ['react', 'prettier'],
plugins: ['ember', 'react', 'prettier'],
extends: ['eslint:recommended', 'plugin:ember/recommended', 'prettier'],
env: {
es6: true,
node: true,
Expand All @@ -21,4 +22,33 @@ module.exports = {

'react/jsx-uses-vars': 'error',
},
overrides: [
// node files
{
files: [
'index.js',
'testem.js',
'ember-cli-build.js',
'config/**/*.js',
'tests/dummy/config/**/*.js',
],
excludedFiles: ['app/**', 'addon/**', 'tests/dummy/app/**'],
parserOptions: {
sourceType: 'script',
ecmaVersion: 2015,
},
env: {
browser: false,
node: true,
},
plugins: ['node'],
rules: Object.assign(
{},
require('eslint-plugin-node').configs.recommended.rules,
{
// add your custom rules and overrides for node files here
}
),
},
],
};
7 changes: 6 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@
.bowerrc
.editorconfig
.ember-cli
.gitignore
.eslintrc.js
.gitignore
.watchmanconfig
.travis.yml
bower.json
ember-cli-build.js
testem.js

# ember-try
.node_modules.ember-try/
bower.json.ember-try
package.json.ember-try
14 changes: 7 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@

## [1.0.3] - 2019-12-10

- Support Ember 3.6 [#48](https://github.com/pswai/ember-simple-react/pull/48)
- Support Ember 3.6 [#48](https://github.com/AltSchool/ember-cli-react/pull/48)

## [1.0.2] - 2018-10-08

- Support React v16 as peer dependency [#41](https://github.com/pswai/ember-simple-react/pull/41)
- Support React v16 as peer dependency [#41](https://github.com/AltSchool/ember-cli-react/pull/41)

## [1.0.1] - 2018-10-04

- Add `ember-auto-import` to support import of other react ecosystem libraries [#38](https://github.com/pswai/ember-simple-react/pull/38)
- Add `ember-auto-import` to support import of other react ecosystem libraries [#38](https://github.com/AltSchool/ember-cli-react/pull/38)

## [1.0.0] - 2018-07-17

- Show component name in React dev tools [#24](https://github.com/pswai/ember-simple-react/pull/24)
- Do not pass `children` to react component when not in block form [#26](https://github.com/pswai/ember-simple-react/pull/26)
- **Breaking change:** replace `ember-browserify` with `ember-auto-import` [#27](https://github.com/pswai/ember-simple-react/pull/27)
- Support PascalCase file naming convention for React components [#32](https://github.com/pswai/ember-simple-react/pull/32)
- Show component name in React dev tools [#24](https://github.com/AltSchool/ember-cli-react/pull/24)
- Do not pass `children` to react component when not in block form [#26](https://github.com/AltSchool/ember-cli-react/pull/26)
- **Breaking change:** replace `ember-browserify` with `ember-auto-import` [#27](https://github.com/AltSchool/ember-cli-react/pull/27)
- Support PascalCase file naming convention for React components [#32](https://github.com/AltSchool/ember-cli-react/pull/32)

## [0.3.1] - 2018-05-16

Expand Down
16 changes: 9 additions & 7 deletions addon/components/react-component.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import Ember from 'ember';
import { classify } from '@ember/string';
import { typeOf } from '@ember/utils';
import { reads } from '@ember/object/computed';
import Component from '@ember/component';
import { get } from '@ember/object';
import React from 'react';
import ReactDOM from 'react-dom';
import YieldWrapper from './react-component/yield-wrapper';
Expand All @@ -7,17 +11,15 @@ import getMutableAttributes from 'ember-simple-react/utils/get-mutable-attribute
import hasBlock from 'ember-simple-react/utils/has-block';
import lookupFactory from 'ember-simple-react/utils/lookup-factory';

const { get } = Ember;

const ReactComponent = Ember.Component.extend({
const ReactComponent = Component.extend({
/**
The React component that this Ember component should wrap.

@property reactComponent
@type React.Component | Function | String
@default null
*/
reactComponent: Ember.computed.reads('_reactComponent'),
reactComponent: reads('_reactComponent'),

didRender: function() {
this.renderReactComponent();
Expand All @@ -27,14 +29,14 @@ const ReactComponent = Ember.Component.extend({
const componentClassOrName = get(this, 'reactComponent');
let componentClass;

if (Ember.typeOf(componentClassOrName) === 'string') {
if (typeOf(componentClassOrName) === 'string') {
componentClass = lookupFactory(
this,
`react-component:${componentClassOrName}`
);

// Set `displayName` so that it is visible in React devtools
componentClass.displayName = Ember.String.classify(componentClassOrName);
componentClass.displayName = classify(componentClassOrName);
} else {
componentClass = componentClassOrName;
}
Expand Down
7 changes: 3 additions & 4 deletions addon/resolver.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import Ember from 'ember';
import { classify } from '@ember/string';
import { get } from '@ember/object';
import Resolver from 'ember-resolver';

import ReactComponent from 'ember-simple-react/components/react-component';

const { get } = Ember;

export default Resolver.extend({
// `resolveComponent` is triggered when rendering a component in template.
// For example, having `{{foo-bar}}` in a template will trigger `resolveComponent`
Expand Down Expand Up @@ -51,7 +50,7 @@ export default Resolver.extend({

// Convert the compnent name while preserving namespaces
const parts = originalName.split('/');
parts[parts.length - 1] = Ember.String.classify(parts[parts.length - 1]);
parts[parts.length - 1] = classify(parts[parts.length - 1]);
const newName = parts.join('/');

const parsedNameWithPascalCase = Object.assign({}, parsedName, {
Expand Down
7 changes: 4 additions & 3 deletions addon/utils/get-mutable-attributes.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import { VERSION } from '@ember/version';
import Ember from 'ember';
import semver from 'semver';

// Glimmer starts from v2.10
const isGlimmer = semver.gte(Ember.VERSION, '2.10.0');
const isGlimmer = semver.gte(VERSION, '2.10.0');

let getMutValue;

if (isGlimmer) {
// The module location before v3.2
let libPath = 'ember-views/compat/attrs';

if (semver.gte(Ember.VERSION, '3.6.0')) {
if (semver.gte(VERSION, '3.6.0')) {
libPath = '@ember/-internals/views/lib/compat/attrs';
} else if (semver.gte(Ember.VERSION, '3.2.0')) {
} else if (semver.gte(VERSION, '3.2.0')) {
libPath = 'ember-views/lib/compat/attrs';
}

Expand Down
8 changes: 5 additions & 3 deletions addon/utils/has-block.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { get } from '@ember/object';
import { VERSION } from '@ember/version';
import Ember from 'ember';
import semver from 'semver';

// Glimmer starts from v2.10
const isGlimmer = semver.gte(Ember.VERSION, '2.10.0');
const isGlimmer = semver.gte(VERSION, '2.10.0');

let hasBlockSymbol;

try {
if (semver.gte(Ember.VERSION, '3.1.0')) {
if (semver.gte(VERSION, '3.1.0')) {
// Ember-glimmer moved to TypeScript since v3.1
// Do nothing since the symbol is not exported
} else if (isGlimmer) {
Expand All @@ -34,5 +36,5 @@ export default function hasBlock(emberComponent) {
);
}

return Ember.get(emberComponent, hasBlockSymbol);
return get(emberComponent, hasBlockSymbol);
}
4 changes: 1 addition & 3 deletions addon/utils/lookup-factory.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import Ember from 'ember';

const { getOwner } = Ember;
import { getOwner } from '@ember/application';

// See http://emberjs.com/deprecations/v2.x/#toc_injected-container-access
export default function lookupFactory(object, name) {
Expand Down
Loading