Skip to content

Commit

Permalink
Merge pull request #1 from pzuraq/initial-implementation
Browse files Browse the repository at this point in the history
Initial implementation
  • Loading branch information
pzuraq authored Apr 5, 2019
2 parents b6b8a11 + 361a436 commit 9eddd07
Show file tree
Hide file tree
Showing 15 changed files with 2,249 additions and 34 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 2017,
sourceType: 'module'
Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ branches:
jobs:
fail_fast: true
allow_failures:
- env: EMBER_TRY_SCENARIO=ember-beta
- env: EMBER_TRY_SCENARIO=ember-canary

include:
Expand Down
75 changes: 54 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,70 @@
ember-decorators-polyfill
==============================================================================
# ember-decorators-polyfill

[Short description of the addon.]
Polyfills Ember's built-in decorators

## Compatibility

Compatibility
------------------------------------------------------------------------------
- Ember.js v2.18 or above
- Ember CLI v2.13 or above

* Ember.js v2.18 or above
* Ember CLI v2.13 or above
This addon is not needed in Ember 3.10+


Installation
------------------------------------------------------------------------------
## Installation

```
ember install ember-decorators-polyfill
```

## Usage

Polyfills Ember's built-in decorators API:

```js
import { action, computed } from '@ember/object';

import { inject as service } from '@ember/service';
import { inject as controller } from '@ember/controller';

import {
alias,
and,
bool,
collect,
deprecatingAlias,
empty,
equal,
filter,
filterBy,
gt,
gte,
intersect,
lt,
lte,
map,
mapBy,
match,
max,
min,
none,
not,
notEmpty,
oneWay,
or,
reads,
readOnly,
setDiff,
sort,
sum,
union,
uniq,
uniqBy,
} from '@ember/object/computed';
```

Usage
------------------------------------------------------------------------------

[Longer description of how to use the addon in apps.]


Contributing
------------------------------------------------------------------------------
## Contributing

See the [Contributing](CONTRIBUTING.md) guide for details.


License
------------------------------------------------------------------------------
## License

This project is licensed under the [MIT License](LICENSE.md).
Empty file removed addon/.gitkeep
Empty file.
42 changes: 41 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,45 @@
'use strict';
const VersionChecker = require('ember-cli-version-checker');

module.exports = {
name: require('./package').name
name: require('./package').name,

init() {
this._super.init && this._super.init.apply(this, arguments);

let checker = new VersionChecker(this.project);
let emberVersion = checker.forEmber();

this.shouldPolyfill = emberVersion.lt('3.10.0-alpha.1');
},

included() {
this._super.included.apply(this, arguments);

if (!this.shouldPolyfill) {
return;
}

this.import('vendor/ember-decorators-polyfill/index.js');
},

treeForVendor(rawVendorTree) {
if (!this.shouldPolyfill) {
return;
}

let babelAddon = this.addons.find(
addon => addon.name === 'ember-cli-babel'
);

let transpiledVendorTree = babelAddon.transpileTree(rawVendorTree, {
babel: this.options.babel,

'ember-cli-babel': {
compileModules: false,
},
});

return transpiledVendorTree;
},
};
14 changes: 9 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "ember-decorators-polyfill",
"version": "0.0.0",
"description": "The default blueprint for ember-cli addons.",
"description": "Polyfills Ember's built-in decorators",
"keywords": [
"ember-addon"
],
"repository": "",
"repository": "https://github.com/pzuraq/ember-decorators-polyfill",
"license": "MIT",
"author": "",
"author": "Chris Garrett",
"directories": {
"doc": "doc",
"test": "tests"
Expand All @@ -21,10 +21,13 @@
"test:all": "ember try:each"
},
"dependencies": {
"ember-cli-babel": "^7.1.2"
"ember-cli-babel": "^7.1.2",
"ember-cli-version-checker": "^3.1.3",
"ember-compatibility-helpers": "^1.2.0"
},
"devDependencies": {
"@ember/optional-features": "^0.6.3",
"babel-eslint": "^10.0.1",
"broccoli-asset-rev": "^2.7.0",
"ember-cli": "~3.8.1",
"ember-cli-dependency-checker": "^3.1.0",
Expand Down Expand Up @@ -53,6 +56,7 @@
"node": "6.* || 8.* || >= 10.*"
},
"ember-addon": {
"configPath": "tests/dummy/config"
"configPath": "tests/dummy/config",
"after": "ember-source"
}
}
4 changes: 2 additions & 2 deletions tests/dummy/config/targets.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const browsers = [
'last 1 Chrome versions',
'last 1 Firefox versions',
'last 1 Safari versions'
'last 1 Safari versions',
];

const isCI = !!process.env.CI;
Expand All @@ -14,5 +14,5 @@ if (isCI || isProduction) {
}

module.exports = {
browsers
browsers,
};
Empty file removed tests/unit/.gitkeep
Empty file.
Loading

0 comments on commit 9eddd07

Please sign in to comment.