Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
* development:
  build(npm): Update build task to perform all steps (es6, es5 and npm)
  build(build): build using semantic-release and its dependencies (#45)
  translate es6 code to es5
  Updates to generated .d.ts files that contains typings to be used by typescript
  • Loading branch information
Skotiniotis committed May 9, 2017
2 parents 234d298 + d0004df commit 0aecc6e
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 25 deletions.
16 changes: 16 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# See https://docs.npmjs.com/misc/developers#keeping-files-out-of-your-package
# Use `npm pack` to create a tgz file. View the contents of the .tgz to test your .npmignore
docs
ion-tests
tests
.baseDir*
.travis.yml
_config.yml
.nojekyll
.gitmodules
.tscache
.idea
browser
src
*.map
Gruntfile.js
24 changes: 17 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@

language: node_js

node_js:
- "node"

script: grunt all

cache:
directories:
- node_modules
notifications:
email: false
node_js:
- '7'
before_script:
- npm prune
script:
- npm run test
after_success:
- 'if [ "$TRAVIS_BRANCH" == "master" -a "$TRAVIS_PULL_REQUEST" == "false" ]; then npm run semantic-release; fi'
- 'if [ "$TRAVIS_BRANCH" != "master" ]; then exit 0; fi'
branches:
except:
- /^v\d+\.\d+\.\d+$/
36 changes: 33 additions & 3 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,17 @@ module.exports = function(grunt) {
outDir: 'dist/amd/es6',
options: {
target: "es6",
module: "amd"
module: "amd",
declaration: true
}
},
'commonjs-es6': {
src: ['src/**/*.ts'],
outDir: 'dist/commonjs/es6',
options: {
target: "es6",
module: "commonjs",
declaration: true
}
}
},
Expand All @@ -82,15 +92,31 @@ module.exports = function(grunt) {
main: {
files: [
{ expand: true,
src: ['dist/amd/es6/*.js'],
src: ['dist/amd/es5/*.js'],
dest: 'browser/scripts/ion/',
flatten: true
}
]
}
},
babel: {
options: {
sourceMap: true,
presets: ['es2015']
},
dist: {
files: [{
'expand': true,
cwd: 'dist/amd/es6',
'src': ['*.js'],
'dest': 'dist/amd/es5/',
'ext': '.js',
}],
},
},
});

grunt.loadNpmTasks('grunt-babel');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
Expand All @@ -99,11 +125,15 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('remap-istanbul');
grunt.loadNpmTasks('intern');

grunt.registerTask('build', ['clean', 'ts:amd-es6','copy:main']);
grunt.registerTask('build', ['clean', 'ts:amd-es6', 'ts:commonjs-es6','babel', 'copy:main']);
grunt.registerTask('test', ['build', 'intern:es6']);
grunt.registerTask('doc', ['test', 'typedoc']);
grunt.registerTask('coverage', ['doc', 'remapIstanbul']);
grunt.registerTask('all', ['coverage']);


// NPM
grunt.registerTask('build:npm', ['ts:commonjs-es6']);

grunt.registerTask('default', ['test']);
};
34 changes: 25 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,41 @@
{
"name": "ion-js",
"version": "0.9.0",
"version": "0.0.0-development",
"description": "A JavaScript implementation of the Ion data interchange format",
"main": "Gruntfile.js",
"directories": {
"test": "test"
},
"main": "dist/commonjs/es6/Ion.js",
"types": "dist/commonjs/es6/Ion.d.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"commit": "git-cz",
"test": "grunt test",
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
},
"repository": {
"type": "git",
"url": "git+https://github.com/amzn/ion-js.git"
"url": "https://github.com/amzn/ion-js.git"
},
"author": "[email protected]",
"keywords": [
"ion",
"JSON",
"data format"
],
"author": "The Ion Team <[email protected]> (https://amzn.github.io/ion-docs/index.html)",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/amzn/ion-js/issues"
},
"homepage": "https://github.com/amzn/ion-js#readme",
"config": {
"commitizen": {
"path": "node_modules/cz-conventional-changelog"
}
},
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-preset-es2015": "^6.24.1",
"commitizen": "^2.9.6",
"cz-conventional-changelog": "^2.0.0",
"grunt": "^1.0.1",
"grunt-babel": "^6.0.0",
"grunt-cli": "^1.2.0",
"grunt-contrib-clean": "^1.0.0",
"grunt-contrib-copy": "^1.0.0",
Expand All @@ -30,6 +45,7 @@
"intern": "^3.4.1",
"remap-istanbul": "^0.9.1",
"typedoc": "^0.5.8",
"typescript": "^2.2.1"
"typescript": "^2.2.1",
"semantic-release": "^6.3.6"
}
}
2 changes: 1 addition & 1 deletion src/Ion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const e = {
* Holds the Ion catalogue @see http://amznlabs.github.io/ion-docs/symbols.html#the-catalog
* and the Ion source type (i.e., binary or text) as a `string`
*/
interface Options {
export interface Options {
catalog: Catalog;
sourceType: string;
}
Expand Down
6 changes: 3 additions & 3 deletions src/IonBinaryWriter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -481,14 +481,14 @@ export class BinaryWriter implements Writer {
}
}

interface Node {
export interface Node {
isContainer(): boolean;
addChild(child: Node, name?: number[]): void;
write() : void;
getLength() : number;
}

abstract class AbstractNode implements Node {
export abstract class AbstractNode implements Node {
constructor(
private readonly _writer: LowLevelBinaryWriter,
private readonly parent: Node,
Expand Down Expand Up @@ -678,7 +678,7 @@ class StructNode extends ContainerNode {
}
}

abstract class LeafNode extends AbstractNode {
export abstract class LeafNode extends AbstractNode {
addChild(child: Node, name?: number[]) : void {
throw new Error("Cannot add a child to a leaf node");
}
Expand Down
2 changes: 1 addition & 1 deletion src/IonText.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ export enum CharCodes {
COLON = ':'.charCodeAt(0),
}

interface EscapeIndex {
export interface EscapeIndex {
[index: number]: number[];
}

Expand Down
2 changes: 1 addition & 1 deletion src/IonUtilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function last<T>(array: T[]) : T {
return array[array.length - 1];
}

type Comparator<T> = (x: T, y: T) => number;
export type Comparator<T> = (x: T, y: T) => number;

export function max<T>(array: T[], comparator: Comparator<T>): T {
let best: T;
Expand Down

0 comments on commit 0aecc6e

Please sign in to comment.