Skip to content

Commit

Permalink
chore: upgrade to latest ember 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
pdud committed Jan 17, 2023
1 parent 65e913f commit 25c4821
Show file tree
Hide file tree
Showing 47 changed files with 11,867 additions and 465 deletions.
6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@

# dependencies
/bower_components/
/node_modules/

# misc
/coverage/
!.*
.*/
.eslintcache

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try
53 changes: 25 additions & 28 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,50 +7,47 @@ module.exports = {
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
legacyDecorators: true
}
legacyDecorators: true,
},
},
plugins: [
'ember'
],
plugins: ['ember'],
extends: [
'eslint:recommended',
'plugin:ember/recommended'
'plugin:ember/recommended',
'plugin:prettier/recommended',
],
env: {
browser: true,
es6: true,
node: true
},
rules: {
'ember/no-observers': 'off'
},
rules: {},
overrides: [
// node files
{
files: [
'ember-cli-build.js',
'index.js',
'testem.js',
'blueprints/*/index.js',
'config/**/*.js',
'tests/dummy/config/**/*.js'
],
excludedFiles: [
'addon/**',
'addon-test-support/**',
'app/**',
'tests/dummy/app/**'
'./.eslintrc.js',
'./.prettierrc.js',
'./.template-lintrc.js',
'./ember-cli-build.js',
'./index.js',
'./testem.js',
'./blueprints/*/index.js',
'./config/**/*.js',
'./tests/dummy/config/**/*.js',
],
parserOptions: {
sourceType: 'script'
sourceType: 'script',
},
env: {
browser: false,
node: true
node: true,
},
plugins: ['node'],
extends: ['plugin:node/recommended']
}
]
extends: ['plugin:node/recommended'],
},
{
// Test files:
files: ['tests/**/*-test.{js,ts}'],
extends: ['plugin:qunit/recommended'],
},
],
};
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ jobs:
# - ember-canary
- ember-classic
- ember-default-with-jquery
- embroider-safe
- embroider-optimized

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
/.env*
/.pnp*
/.sass-cache
/.eslintcache
/connect.lock
/coverage/
/libpeerconnection.log
/npm-debug.log*
/package-lock.json
/testem.log
/yarn-error.log

Expand Down
51 changes: 33 additions & 18 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,36 @@
# compiled output
/dist/
/tmp/

# dependencies
/bower_components/

# misc
/.bowerrc
/.editorconfig
/.ember-cli
/.env*
/.eslintcache
/.eslintignore
/.eslintrc.js
/.git/
/.gitignore
/.prettierignore
/.prettierrc.js
/.template-lintrc.js
/.travis.yml
/.watchmanconfig
/bower.json
/config/ember-try.js
/dist
/tests
/tmp
**/.gitkeep
.bowerrc
.editorconfig
.ember-cli
.eslintrc.js
.gitignore
.watchmanconfig
.travis.yml
bower.json
ember-cli-build.js
testem.js
yarn.lock
/CONTRIBUTING.md
/ember-cli-build.js
/testem.js
/tests/
/yarn-error.log
/yarn.lock
.gitkeep

# ember-try
.node_modules.ember-try/
bower.json.ember-try
package.json.ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try
21 changes: 21 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# unconventional js
/blueprints/*/files/
/vendor/

# compiled output
/dist/
/tmp/

# dependencies
/bower_components/
/node_modules/

# misc
/coverage/
!.*
.eslintcache

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try
5 changes: 5 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

module.exports = {
singleQuote: true,
};
2 changes: 1 addition & 1 deletion .template-lintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';

module.exports = {
extends: 'octane'
extends: 'recommended',
};
9 changes: 6 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ language: node_js
node_js:
# we recommend testing addons with the same minimum supported node version as Ember CLI
# so that your addon works for all apps
- "10"
- "12"

dist: xenial

Expand Down Expand Up @@ -47,12 +47,15 @@ jobs:

# we recommend new addons test the current and previous LTS
# as well as latest stable release (bonus points to beta/canary)
- env: EMBER_TRY_SCENARIO=ember-lts-3.12
- env: EMBER_TRY_SCENARIO=ember-lts-3.16
- env: EMBER_TRY_SCENARIO=ember-lts-3.24
- env: EMBER_TRY_SCENARIO=ember-lts-3.28
- env: EMBER_TRY_SCENARIO=ember-release
- env: EMBER_TRY_SCENARIO=ember-beta
- env: EMBER_TRY_SCENARIO=ember-canary
- env: EMBER_TRY_SCENARIO=ember-default-with-jquery
- env: EMBER_TRY_SCENARIO=ember-classic
- env: EMBER_TRY_SCENARIO=embroider-safe
- env: EMBER_TRY_SCENARIO=embroider-optimized

script:
- node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO
25 changes: 25 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# How To Contribute

## Installation

* `git clone <repository-url>`
* `cd ember-credit-cards`
* `npm install`

## Linting

* `npm run lint`
* `npm run 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"
* `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/).
37 changes: 32 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Ember-credit-cards
ember-credit-cards
==============================================================================

[![Build Status](https://travis-ci.org/arenoir/ember-credit-cards.svg)](https://travis-ci.org/arenoir/ember-credit-cards)
[![npm version](https://badge.fury.io/js/ember-credit-cards.svg)](https://badge.fury.io/js/ember-credit-cards)
Expand All @@ -7,10 +8,25 @@ A credit card utility library and form elements. Influenced by the [jquery.payme

Checkout the [demo](https://arenoir.github.io/ember-credit-cards/).

## Components
* Ember.js v3.4 or above
* Ember CLI v2.13 or above
* Node.js v8 or above

Compatibility
------------------------------------------------------------------------------

* Ember.js v3.24 or above
* Ember CLI v3.24 or above
* Node.js v12 or above


Installation
------------------------------------------------------------------------------

```
ember install ember-credit-cards
```


Usage (Components)
------------------------------------------------------------------------------

### credit-card-form
Full credit card form with validations and formatting.
Expand Down Expand Up @@ -180,3 +196,14 @@ You can provide custom labels for localization.
}}
</div>
```

Contributing
------------------------------------------------------------------------------

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


License
------------------------------------------------------------------------------

This project is licensed under the [MIT License](LICENSE.md).
33 changes: 22 additions & 11 deletions addon/components/credit-card-form.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/* eslint-disable ember/require-tagless-components */
/* eslint-disable ember/no-classic-components */
/* eslint-disable ember/no-classic-classes */
/* eslint-disable ember/no-observers */

import { and } from '@ember/object/computed';
import Component from '@ember/component';
import { computed, observer } from '@ember/object';
Expand All @@ -15,15 +20,21 @@ export default Component.extend({
cvc: null,
zipcode: null,
zipcodeRequired: false,
onValidate(){},
onValidate() {},

isValid: and('nameValid', 'numberValid', 'expirationValid', 'cvcValid', 'zipcodeValid'),
isValid: and(
'nameValid',
'numberValid',
'expirationValid',
'cvcValid',
'zipcodeValid'
),

becameValid: observer('isValid', function() {
becameValid: observer('isValid', function () {
this.onValidate(this.isValid);
}),

nameValid: computed('name', function() {
nameValid: computed('name', function () {
var name = this.name;

if (name) {
Expand All @@ -33,27 +44,27 @@ export default Component.extend({
return false;
}),

numberValid: computed('number', function() {
numberValid: computed('number', function () {
var number = this.number;

return Validations.validateNumber(number);
}),

expirationValid: computed('month', 'year', function() {
expirationValid: computed('month', 'year', function () {
var month = this.month;
var year = this.year;
var year = this.year;

return Validations.validateExpiration(month, year);
}),

cvcValid: computed('cvc', 'type', function() {
cvcValid: computed('cvc', 'type', function () {
var cvc = this.cvc;
var type = this.type;

return Validations.validateCVC(cvc, type);
}),

zipcodeValid: computed('zipcodeRequired', 'zipcode', function() {
zipcodeValid: computed('zipcodeRequired', 'zipcode', function () {
if (this.zipcodeRequired) {
var zip = this.zipcode;

Expand All @@ -63,7 +74,7 @@ export default Component.extend({
return true;
}),

type: computed('number', function() {
type: computed('number', function () {
var number = this.number;
var card = Cards.fromNumber(number);

Expand All @@ -72,5 +83,5 @@ export default Component.extend({
} else {
return '';
}
})
}),
});
Loading

0 comments on commit 25c4821

Please sign in to comment.