Skip to content

Commit

Permalink
Merge pull request #38 from scurker/v1
Browse files Browse the repository at this point in the history
v1 🎊
  • Loading branch information
scurker committed Aug 4, 2017
2 parents 29562bb + 33bee09 commit 1eff354
Show file tree
Hide file tree
Showing 25 changed files with 8,641 additions and 490 deletions.
15 changes: 15 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"presets": [
["es2015", { modules: false }]
],
"plugins": [
"./config/rename-internal"
],
"env": {
"test": {
"presets": [
["es2015"]
]
}
}
}
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist/
coverage/
*.flow.js
11 changes: 11 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"env": {
"node": true,
"browser": true,
"es6": true
},
"parserOptions": {
"sourceType": "module"
},
"extends": ["eslint:recommended"]
}
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@
*.sublime-workspace
node_modules/
bower_components/
reports/
reports/
dist/
coverage/
.nyc_output
.flowconfig
17 changes: 0 additions & 17 deletions .jshintrc

This file was deleted.

8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
language: node_js
node_js:
- '0.12'
- '4.1'
- '6'
- '7'
before_install:
- npm install -g grunt-cli coveralls
script:
- grunt jshint
- npm run lint
- npm run test
sudo: false
cache:
directories:
- node_modules
after_success:
- npm run coverage
- cat reports/lcov.info | coveralls
- ./node_modules/.bin/nyc report --reporter=text-lcov | coveralls
deploy:
provider: npm
email:
Expand Down
41 changes: 9 additions & 32 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/*global module:false*/
module.exports = function(grunt) {

'use strict';
Expand All @@ -7,6 +6,9 @@ module.exports = function(grunt) {

pkg: grunt.file.readJSON('package.json'),

minified: 'dist/currency.min.js',
umd: 'dist/currency.umd.js',

banner: '/*!\n' +
' * <%= pkg.name %> - v<%= pkg.version %>\n' +
' * <%= pkg.homepage %>\n' +
Expand All @@ -17,19 +19,19 @@ module.exports = function(grunt) {

'closure-compiler': {
compile: {
src: 'currency.js',
dest: 'currency.min.js'
src: '<%= umd %>',
dest: '<%= minified %>'
},
options: {
compilation_level: 'SIMPLE'
compilation_level: 'SIMPLE',
rewrite_polyfills: false
}
},

concat: {
dist: {
files: {
'currency.js': 'currency.js',
'currency.min.js': 'currency.min.js'
'<%= minified %>': '<%= minified %>'
}
},
options: {
Expand All @@ -40,31 +42,6 @@ module.exports = function(grunt) {
return filepath === 'currency.js' ? src.replace(/^\/\*!/, '/*') : src;
}
}
},

mochaTest: {
options: {
reporter: 'spec'
},
test: {
src: ['test/**/*.js']
}
},

jshint: {
options: {
jshintrc: true
},
files: {
src: ['currency.js', 'Gruntfile.js', 'test/*.js']
}
},

watch: {
scripts: {
files: ['currency.js'],
tasks: ['qunit', 'jshint']
}
}

});
Expand All @@ -73,6 +50,6 @@ module.exports = function(grunt) {
require('matchdep').filterAll('grunt-*').forEach(grunt.loadNpmTasks);

grunt.registerTask('build', ['closure-compiler', 'concat', 'sync']);
grunt.registerTask('default', ['jshint', 'mochaTest', 'build']);
grunt.registerTask('default', ['build']);

};
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "currency.js",
"main": [
"currency.js"
"dist/currency.js"
],
"version": "0.4.4",
"version": "1.0.0-rc1",
"homepage": "http://scurker.github.io/currency.js",
"authors": [
"Jason Wilson"
Expand Down
27 changes: 18 additions & 9 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
**1.0.0**

* Node < 4 support dropped.
* Separate UMD, ES6, CommonJS modules now available.
* Global currency settings removed. Settings are now passed per currency.js instance.
* Different precision currencies supported. ([#29](https://github.com/scurker/currency.js/issues/29))
* Added Typescript definition. ([#36](https://github.com/scurker/currency.js/issues/36))
* Added Flow definition. ([#37](https://github.com/scurker/currency.js/issues/37))

**0.4.4**

* Fix for currency.min.js being compiled incorrectly.

**0.4.3**

* Added AMD support.
* Fixed issue #24 resolving bundling with webpack/browserify.
* Fixed issue resolving bundling with webpack/browserify. ([#24](https://github.com/scurker/currency.js/issues/24))
* Updated to latest closure compiler for minification.

**0.4.2**
Expand All @@ -23,30 +32,30 @@

**v0.3.4**

* Fix bower package management
* Fix bower package management.

**v0.3.2**

* Fix spelling of "seperator" to "separator"
* Automatic publish to npm when tags are pushed to master
* Fix spelling of "seperator" to "separator".
* Automatic publish to npm when tags are pushed to master.

**v0.3.1**

* Added bower support
* Added bower support.

**v0.3.0**

* Added new format option to optionally include the set currency symbol
* Added travis ci integration
* Fixed issue #6 where international values were not being formatted correctly
* Added new format option to optionally include the set currency symbol.
* Added travis ci integration.
* Fixed issue where international values were not being formatted correctly. ([#6](https://github.com/scurker/currency.js/issues/6))

**v0.2.0**

* Adding nodejs / commonjs support

**v0.1.4**

* Fixes issue #1 with serializing currency via JSON.stringify
* Fixes issue with serializing currency via JSON.stringify ([#1](https://github.com/scurker/currency.js/issues/1))
* Added grunt tasks

**v0.1.3**
Expand Down
19 changes: 19 additions & 0 deletions config/rename-internal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict';

module.exports = function({ types: t }) {
return {
visitor: {
MemberExpression(path) {
if(t.isThisExpression(path.node.object)) {
path.traverse({
Identifier(path) {
if(['_precision', '_settings'].includes(path.node.name)) {
path.node.name = { _precision: 'p', _settings: 's' }[path.node.name]
}
}
});
}
}
}
};
}
23 changes: 23 additions & 0 deletions config/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { readFileSync } from 'fs';
import babel from 'rollup-plugin-babel';

const pkg = JSON.parse(readFileSync('./package.json', 'utf8'));

export default {
entry: 'src/currency.js',
plugins: [
babel({
exclude: 'node_modules/**'
})
],
targets: [
{
format: 'es',
dest: pkg.module
},
{
format: 'cjs',
dest: pkg.main
}
]
};
18 changes: 18 additions & 0 deletions config/rollup.umd.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import babel from 'rollup-plugin-babel';

export default {
entry: 'src/currency.js',
plugins: [
babel({
exclude: 'node_modules/**',
plugins: ['transform-object-assign']
})
],
targets: [
{
format: 'umd',
dest: 'dist/currency.umd.js',
moduleName: 'currency'
}
]
};

0 comments on commit 1eff354

Please sign in to comment.