1.0.2 • Published 7 years ago

generator-bizxes6 v1.0.2

Weekly downloads
14
License
-
Repository
github
Last release
7 years ago

BizxES6 generator

BizxES6 generator enables you to write .es6 files in your bizx projects.

Get started

Before you get started, please ensure your local environment has already installed npm.

Install Yeoman:

npm install -g yo

cd into your code folder, install generator-bizxes6:

npm install --save-dev generator-bizxes6

Just run:

yo bizxes6

Now everything has been established by BizxES6 automatically, feel free to write your .es6 files. The default source path is ./src. You can change it in the ./gulpfile.js.

You may get warnings if you already have your own gulpfile.js and build.gradle in your project. For this case, you need add gulp tasks and build tasks on your own.

Usages

Compile

To compile your .es6 files, just run:

gulp es6

You can also run a gulp watcher to compile .es6 files automatically once file changes:

gulp watch

Configuration

If you already have your own ./gulpfile.js or ./build.gradle, you need do configuration by yourself. You can also change some configurations to meet your own requirements.

gulp tasks

In ./gulpfile.js, add es6 gulp task to compile the .es6 files:

const gulp = require('gulp');
const sourcemaps = require("gulp-sourcemaps");
const babel = require("gulp-babel");
/* you can change the srcDir to suit your case */
const srcDir = 'src';

gulp.task('es6', function () {
  return gulp.src(srcDir + '/**/*.es6')
    .pipe(sourcemaps.init())
    .pipe(babel())
    .pipe(sourcemaps.write('.'))
    .pipe(gulp.dest(srcDir));
});

Add watch gulp task to make compilation automatic:

gulp.task('watch', function () {
  gulp.watch(srcDir + '/**/*.es6', ['es6']);
});

Template reference: gulpfile.js

build tasks

In .build.gradle, add compileES6 build task to compile the .es6 files when build starts. Notice that this task requires an node executing environment. So make sure you have applied the gradle plugin com.moowork.node.

apply plugin: 'com.moowork.node'

task compileES6(type: NodeTask) {
  script = file('node_modules/gulp/bin/gulp.js')
  args = ['es6']
}
compileES6.dependsOn 'npm_install'
check.dependsOn 'compileES6'

We also provide an internal Node.js source, you can just use our default settings:

node {
  version = '4.5.0'
  distBaseUrl = 'http://uicommons.mo.sap.corp:8082/dist'
  download = true
}

Ensure that the compileES6 task runs before testing tasks because out-of-date .js files may cause testing fail.

Template reference: build.gradle

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago