Using Travis-CI for client-side JavaScript libraries?

前端 未结 4 1692
耶瑟儿~
耶瑟儿~ 2020-12-23 14:04

I\'m not sure to use Travis-CI for my client-side JavaScript library or not, because it compiles with NodeJs on Travis-CI servers.

I want to know is this a good appr

4条回答
  •  有刺的猬
    2020-12-23 14:38

    I started with the answer from Odi and moved to gulp to get it working. If you specify node_js as your language in your travis file, travis will automatically run

    npm install
    

    followed by

    npm test
    

    The first will install any devDependencies specified in a package.json file, the second will run the script named "test" also from package.json. Below you'll find the three files I needed to have in the top level of my repo for travis to run a single qunit suite.

    .travis.yml

    language: node_js
    node_js:
      - "0.10"
    

    gulpfile.js

    var gulp = require('gulp'),
        qunit = require('gulp-qunit');
    
    gulp.task('default', function() {
        return gulp.src('./tests/unit/unittests_nupic-js.html')
            .pipe(qunit());
    });
    

    package.json

    {
      "name": "nupic-js",
      "version": "0.0.1",
      "description": "JavaScript port of NuPIC",
      "license": "GPL-3.0",
      "repository": "iandanforth/nupic-js",
      "bugs": { "url" : "http://github.com/iandanforth/nupic-js/issues"
      },
      "author": {
        "name": "Ian Danforth",
        "email": "iandanforth@gmail.com"
      },
      "engines": {
        "node": ">=0.10.0"
      },
      "scripts": {
        "test": "gulp"
      },
      "keywords": [
        "numenta",
        "nupic",
        "machine learning"
      ],
      "devDependencies": {
        "gulp-qunit": "~0.2.1",
        "gulp-util": "~2.2.14",
        "gulp": "~3.5.1"
      }
    }
    

提交回复
热议问题