Commit cf5dcc15 cf5dcc15bcf72e4c74b64d0df59ed3d466170e3f by Vincent Peybernes

#7 Add build task to transpil

1 parent 4d61bcc8
Pipeline #10 for cf5dcc15 failed in 55 seconds
1 .idea 1 .idea
2 node_modules 2 node_modules
3 dist
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -5,10 +5,22 @@ cache: ...@@ -5,10 +5,22 @@ cache:
5 - node_modules/ 5 - node_modules/
6 6
7 stages: 7 stages:
8 - install
8 - test 9 - test
10 - build
11
12
13 install:
14 stage: install
15 script:
16 - npm install
9 17
10 node_test: 18 node_test:
11 stage: test 19 stage: test
12 script: 20 script:
13 - npm install
14 - npm test 21 - npm test
22
23 build:
24 stage: build
25 script:
26 - npm run build
......
1 /**
2 * Created by Techniv on 05/12/2016.
3 */
4
5 const srcPath = './lib/relative-placement.js';
6 const distPath = './dist/';
7
8 var gulp = require('gulp');
9 var babel = require('gulp-babel');
10 var del = require('del');
11
12 gulp.task('default', ['build']);
13
14 gulp.task('build',['clean'], ()=>{
15 return gulp.src(srcPath)
16 .pipe(babel({
17 presets: ['es2015']
18 }))
19 .pipe(gulp.dest(distPath));
20 });
21
22 gulp.task('clean',() => {
23 return del(distPath);
24 });
...\ No newline at end of file ...\ No newline at end of file
1 /** 1 /**
2 * Created by Techniv on 30/11/2016. 2 * Created by Techniv on 30/11/2016.
3 * @module relative_placement 3 * @module relativePlacement
4 */ 4 */
5 (function (define) { 5 (function (definition) {
6 module.exports = define(); 6 // Node export
7 if(global && module && module.exports) return module.exports = definition();
8 //Browser export
9 if(window){
10 if(angular && angular.version.major == 1) return angular.module('relativePlacement').factory('RelativePlacement', definition);
11 if(requirejs) return define(definition());
12
13 window.RelativePlacement = definition();
14 }
7 })(function(){ 15 })(function(){
8 16
9 /** 17 /**
......
...@@ -3,12 +3,16 @@ ...@@ -3,12 +3,16 @@
3 "version": "0.0.1", 3 "version": "0.0.1",
4 "devDependencies": { 4 "devDependencies": {
5 "gulp": "*", 5 "gulp": "*",
6 "nodeunit": "*", 6 "gulp-babel": "*",
7 "mocha": "*", 7 "del": "*",
8 "karma": "*", 8 "babel-preset-es2015": "*",
9 "karma-mocha": "*" 9 "mocha": "*"
10 }, 10 },
11 "scripts": { 11 "scripts": {
12 "build": "./node_modules/.bin/gulp build",
12 "test" : "./node_modules/.bin/mocha bdd tests/node/**/*Spec.js" 13 "test" : "./node_modules/.bin/mocha bdd tests/node/**/*Spec.js"
14 },
15 "engines": {
16 "node": ">=6.9.*"
13 } 17 }
14 } 18 }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
2 * Created by Techniv on 30/11/2016. 2 * Created by Techniv on 30/11/2016.
3 */ 3 */
4 var assert = require('assert'); 4 var assert = require('assert');
5 var RelativePlacement = require('../../relative-placement'); 5 var RelativePlacement = require('../../lib/relative-placement');
6 6
7 describe('RelativePlacement global', () => { 7 describe('RelativePlacement global', () => {
8 it('should provide RelativePlacement constructor', () => { 8 it('should provide RelativePlacement constructor', () => {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
3 */ 3 */
4 var assert = require('assert'); 4 var assert = require('assert');
5 /** @type RelativePlacement.relativePlacement */ 5 /** @type RelativePlacement.relativePlacement */
6 var relativePlacement = require('../../relative-placement').relativePlacement; 6 var relativePlacement = require('../../lib/relative-placement').relativePlacement;
7 /** @var {TestData[]} */ 7 /** @var {TestData[]} */
8 var testDataList = require('./results_data.json'); 8 var testDataList = require('./results_data.json');
9 describe('RelativePlacement algo', () => { 9 describe('RelativePlacement algo', () => {
......