<commit_before>var gulp = require('gulp'),
// gulp modules
    autoprefixer = require('gulp-autoprefixer'),
    bower = require('gulp-bower'),
    concat = require('gulp-concat'),
    imagemin = require('gulp-imagemin'),
    jade = require('gulp-jade'),
    livereload = require('gulp-livereload'),
    minify = require('gulp-minify-css'),
    newer = require('gulp-newer'),
    sass = require('gulp-sass'),
    uglify = require('gulp-uglify'),
    sourcemaps = require('gulp-sourcemaps'),
// image optimizers
    optipng = require('imagemin-optipng'),
    svgo = require('imagemin-svgo'),
// native modules
    del = require('del');

var paths = {
    templates: {
        'watch': 'assets/templates/**/*.jade',
        'src': 'assets/templates/**/[^_]*.jade'
    },
    stylesheets: {
        'watch': 'assets/stylesheets/*.scss',
        'src': 'assets/stylesheets/tenside.scss'
    },
    javascripts: {
        'watch': [
            'assets/javascripts/*.js'
        ],
        'src': [
            'bower_components/jquery/dist/jquery.js',
            'bower_components/bootstrap-sass-official/assets/javascripts/bootstrap.js',
            'bower_components/angular/angular.js',
            'bower_components/angular-route/angular-route.js',
            'bower_components/angular-bootstrap/ui-bootstrap.js',
            'assets/javascripts/*.js'
        ]
    },
    images: {
        'watch': 'assets/images/*',
        'src': 'assets/images/*'
    }
};

/**
 * Installation tasks
 */
gulp.task('install-bower', function () {
    return bower();
});

gulp.task('install', ['install-bower']);

/**
 * Build templates tasks
 */
gulp.task('clean-templates', function (cb) {
    del(['build/*.html'], cb);
});

gulp.task('build-templates', ['clean-templates'], function () {
    var variables = {
        'stylesheets': ['css/tenside.css'],
        'javascripts': ['js/tenside.js']
    };

    return gulp.src(paths.templates.src)
        .pipe(jade({ locals: variables }))
        .pipe(gulp.dest('build'));
});

gulp.task('watch-templates', [], function () {
    var variables = {
        'stylesheets': ['css/tenside.css'],
        'javascripts': [
            'js/jquery.js',
            'js/angular.js',
            'js/angular-route.js',
            'js/ui-bootstrap.js',
            'js/bootstrap.js',
            'js/tenside.js',
            'js/tenside-search.js'
        ]
    };

    return gulp.src(paths.templates.src)
        .pipe(jade({ locals: variables }))
        .pipe(gulp.dest('build'));
});

/**
 * Build stylesheets tasks
 */
gulp.task('clean-stylesheets', function (cb) {
    del(['build/css'], cb);
});

gulp.task('build-stylesheets', ['clean-stylesheets'], function () {
    return gulp.src(paths.stylesheets.src)
        .pipe(sourcemaps.init())
        .pipe(sass())
        .pipe(autoprefixer({
            browsers: ['last 2 versions'],
            cascade: false
        }))
        .pipe(minify())
        .pipe(concat('tenside.css'))
        .pipe(sourcemaps.write('.'))
        .pipe(gulp.dest('build/css'));
});

gulp.task('watch-stylesheets', [], function () {
    return gulp.src(paths.stylesheets.src)
        .pipe(sourcemaps.init())
        .pipe(sass())
        .pipe(autoprefixer({
            browsers: ['last 2 versions'],
            cascade: false
        }))
        .pipe(sourcemaps.write('.'))
        .pipe(gulp.dest('build/css'));
});

/**
 * Build javascripts tasks
 */
gulp.task('clean-javascripts', function (cb) {
    del(['build/js'], cb);
});

gulp.task('build-javascripts', ['clean-javascripts'], function () {
    return gulp.src(paths.javascripts.src)
        .pipe(sourcemaps.init())
        .pipe(uglify())
        .pipe(concat('tenside.js'))
        .pipe(sourcemaps.write('.'))
        .pipe(gulp.dest('build/js'));
});

gulp.task('watch-javascripts', [], function () {
    return gulp.src(paths.javascripts.src)
        .pipe(sourcemaps.init())
        .pipe(sourcemaps.write('.'))
        .pipe(gulp.dest('build/js'));
});

/**
 * Build images tasks
 */
gulp.task('clean-images', function (cb) {
    del(['build/img'], cb);
});

gulp.task('build-images', ['clean-images'], function () {
    return gulp.src(paths.images.src)
        .pipe(imagemin({
            use: [optipng(), svgo()]
        }))
        .pipe(gulp.dest('build/img'));
});

gulp.task('watch-images', [], function () {
    return gulp.src(paths.images.src)
        .pipe(newer('build/img'))
        .pipe(gulp.dest('build/img'));
});

/**
 * Global build tasks
 */
gulp.task('clean', function (cb) {
    del(['build'], cb);
});

gulp.task('build', ['clean', 'build-templates', 'build-stylesheets', 'build-javascripts', 'build-images']);

gulp.task('watch', function () {
    livereload.listen();
    gulp.watch(paths.templates.watch, ['watch-templates']);
    gulp.watch(paths.stylesheets.watch, ['watch-stylesheets']);
    gulp.watch(paths.javascripts.watch, ['watch-javascripts']);
    gulp.watch(paths.images.watch, ['watch-images']);
    gulp.watch('build/**/*').on('change', livereload.changed);
});

gulp.task('default', ['watch', 'watch-templates', 'watch-stylesheets', 'watch-javascripts', 'watch-images']);
<commit_msg>tweaked the gulpfile, listen to changes in stylesheet sub-directory<commit_after>var gulp = require('gulp'),
// gulp modules
    autoprefixer = require('gulp-autoprefixer'),
    bower = require('gulp-bower'),
    concat = require('gulp-concat'),
    imagemin = require('gulp-imagemin'),
    jade = require('gulp-jade'),
    livereload = require('gulp-livereload'),
    minify = require('gulp-minify-css'),
    newer = require('gulp-newer'),
    sass = require('gulp-sass'),
    uglify = require('gulp-uglify'),
    sourcemaps = require('gulp-sourcemaps'),
// image optimizers
    optipng = require('imagemin-optipng'),
    svgo = require('imagemin-svgo'),
// native modules
    del = require('del');

var paths = {
    templates: {
        'watch': 'assets/templates/**/*.jade',
        'src': 'assets/templates/**/[^_]*.jade'
    },
    stylesheets: {
        'watch': 'assets/stylesheets/*.scss',
        'watch': 'assets/stylesheets/**/*.scss',
        'src': 'assets/stylesheets/tenside.scss'
    },
    javascripts: {
        'watch': [
            'assets/javascripts/*.js'
        ],
        'src': [
            'bower_components/jquery/dist/jquery.js',
            'bower_components/bootstrap-sass-official/assets/javascripts/bootstrap.js',
            'bower_components/angular/angular.js',
            'bower_components/angular-route/angular-route.js',
            'bower_components/angular-bootstrap/ui-bootstrap.js',
            'assets/javascripts/*.js'
        ]
    },
    images: {
        'watch': 'assets/images/*',
        'src': 'assets/images/*'
    }
};

/**
 * Installation tasks
 */
gulp.task('install-bower', function () {
    return bower();
});

gulp.task('install', ['install-bower']);

/**
 * Build templates tasks
 */
gulp.task('clean-templates', function (cb) {
    del(['build/*.html'], cb);
});

gulp.task('build-templates', ['clean-templates'], function () {
    var variables = {
        'stylesheets': ['css/tenside.css'],
        'javascripts': ['js/tenside.js']
    };

    return gulp.src(paths.templates.src)
        .pipe(jade({ locals: variables }))
        .pipe(gulp.dest('build'));
});

gulp.task('watch-templates', [], function () {
    var variables = {
        'stylesheets': ['css/tenside.css'],
        'javascripts': [
            'js/jquery.js',
            'js/angular.js',
            'js/angular-route.js',
            'js/ui-bootstrap.js',
            'js/bootstrap.js',
            'js/tenside.js',
            'js/tenside-search.js'
        ]
    };

    return gulp.src(paths.templates.src)
        .pipe(jade({ locals: variables }))
        .pipe(gulp.dest('build'));
});

/**
 * Build stylesheets tasks
 */
gulp.task('clean-stylesheets', function (cb) {
    del(['build/css'], cb);
});

gulp.task('build-stylesheets', ['clean-stylesheets'], function () {
    return gulp.src(paths.stylesheets.src)
        .pipe(sourcemaps.init())
        .pipe(sass())
        .pipe(autoprefixer({
            browsers: ['last 2 versions'],
            cascade: false
        }))
        .pipe(minify())
        .pipe(concat('tenside.css'))
        .pipe(sourcemaps.write('.'))
        .pipe(gulp.dest('build/css'));
});

gulp.task('watch-stylesheets', [], function () {
    return gulp.src(paths.stylesheets.src)
        .pipe(sourcemaps.init())
        .pipe(sass())
        .pipe(autoprefixer({
            browsers: ['last 2 versions'],
            cascade: false
        }))
        .pipe(sourcemaps.write('.'))
        .pipe(gulp.dest('build/css'));
});

/**
 * Build javascripts tasks
 */
gulp.task('clean-javascripts', function (cb) {
    del(['build/js'], cb);
});

gulp.task('build-javascripts', ['clean-javascripts'], function () {
    return gulp.src(paths.javascripts.src)
        .pipe(sourcemaps.init())
        .pipe(uglify())
        .pipe(concat('tenside.js'))
        .pipe(sourcemaps.write('.'))
        .pipe(gulp.dest('build/js'));
});

gulp.task('watch-javascripts', [], function () {
    return gulp.src(paths.javascripts.src)
        .pipe(sourcemaps.init())
        .pipe(sourcemaps.write('.'))
        .pipe(gulp.dest('build/js'));
});

/**
 * Build images tasks
 */
gulp.task('clean-images', function (cb) {
    del(['build/img'], cb);
});

gulp.task('build-images', ['clean-images'], function () {
    return gulp.src(paths.images.src)
        .pipe(imagemin({
            use: [optipng(), svgo()]
        }))
        .pipe(gulp.dest('build/img'));
});

gulp.task('watch-images', [], function () {
    return gulp.src(paths.images.src)
        .pipe(newer('build/img'))
        .pipe(gulp.dest('build/img'));
});

/**
 * Global build tasks
 */
gulp.task('clean', function (cb) {
    del(['build'], cb);
});

gulp.task('build', ['clean', 'build-templates', 'build-stylesheets', 'build-javascripts', 'build-images']);

gulp.task('watch', function () {
    livereload.listen();
    gulp.watch(paths.templates.watch, ['watch-templates']);
    gulp.watch(paths.stylesheets.watch, ['watch-stylesheets']);
    gulp.watch(paths.javascripts.watch, ['watch-javascripts']);
    gulp.watch(paths.images.watch, ['watch-images']);
    gulp.watch('build/**/*').on('change', livereload.changed);
});

gulp.task('default', ['watch', 'watch-templates', 'watch-stylesheets', 'watch-javascripts', 'watch-images']);
<|endoftext|>


<commit_before>var gulp = require('gulp'),
    gutil = require('gulp-util'),
    coffee = require('gulp-coffee');

gulp.task('logger-change', function(){
    gulp.src('src/*.coffee')
        .pipe(coffee({bare: true}).on('error', gutil.log))
        .pipe(gulp.dest('lib'));
});

gulp.task('watch', function() {
    gulp.watch('src/*.coffee', ['logger-change']);
});
<commit_msg>Make compilation the gulp default task<commit_after>var gulp = require('gulp'),
    gutil = require('gulp-util'),
    coffee = require('gulp-coffee');

gulp.task('default', function(){
    gulp.src('src/*.coffee')
        .pipe(coffee({bare: true}).on('error', gutil.log))
        .pipe(gulp.dest('lib'));
});

gulp.task('watch', function() {
    gulp.watch('src/*.coffee', ['default']);
});
<|endoftext|>


<commit_before>const gulp = require("gulp");
const postcss = require("gulp-postcss");
const autoprefixer = require("autoprefixer");
const postcssPresetEnv = require("postcss-preset-env");
const cssImport = require("postcss-import");
const customProperties = require("postcss-custom-properties");
const apply = require("postcss-apply");
const mixins = require("postcss-mixins");
const nested = require("postcss-nested");
const customMedia = require("postcss-custom-media");
const cssnano = require("cssnano");
const notify = require("gulp-notify");
const rename = require("gulp-rename");
const inject = require("gulp-inject-string");
const replace = require("gulp-string-replace");
const insert = require("gulp-insert");

function css() {
  return gulp
    .src("./src/nakDS.css")
    .pipe(
      postcss([
        cssImport(),
        mixins(),
        nested(),
        postcssPresetEnv(),
        autoprefixer()
      ])
    )
    .pipe(postcss([cssnano()]))
    .pipe(gulp.dest("./dist/css/"))
    .pipe(gulp.dest("./docs/css/"))
    .pipe(
      notify({
        message: "Your nakDS CSS is ready ♡"
      })
    );
}

function utils() {
  return gulp
    .src("./src/variables/core-utils.css")
    .pipe(
      postcss([
        cssImport(),
        mixins(),
        nested(),
        postcssPresetEnv(),
        autoprefixer()
      ])
    )
    .pipe(postcss([cssnano()]))
    .pipe(gulp.dest("./dist/css/"))
    .pipe(
      notify({
        message: "Your utils are ready ♡"
      })
    );
}

function tokens() {
  return (
    gulp
      .src("./src/tokens/**.css")
      .pipe(
        postcss([
          cssImport(),
          mixins(),
          nested(),
          postcssPresetEnv(),
          autoprefixer()
        ])
      )
      // .pipe(postcss([cssnano()]))
      .pipe(gulp.dest("./dist/css/tokens"))
      .pipe(
        notify({
          message: "Your tokens are ready ♡"
        })
      )
  );
}

function components() {
  return gulp
    .src("./src/components/**.css")
    .pipe(
      postcss([
        cssImport(),
        mixins(),
        nested(),
        postcssPresetEnv(),
        autoprefixer()
      ])
    )
    .pipe(postcss([cssnano()]))
    .pipe(gulp.dest("./dist/css/components/"))
    .pipe(
      notify({
        message: "Your components are ready ♡"
      })
    );
}

function fonts() {
  return gulp
    .src("./assets/fonts/*.*")
    .pipe(gulp.dest("./dist/assets/fonts/"))
    .pipe(gulp.dest("./docs/assets/fonts/"));
}

function svg() {
  return gulp
    .src("./assets/svg/*.*")
    .pipe(gulp.dest("./dist/assets/svg/"))
    .pipe(gulp.dest("./docs/assets/svg/"));
}

function watch() {
  gulp.watch("./src/**/*.css", css);
}

function colorTokens() {
  return gulp
    .src("./src/tokens/tokens--color.css")
    .pipe(postcss([cssnano()]))
    .pipe(
      inject.beforeEach("--color", ''))
    .pipe(replace(":root{", '
'))
    .pipe(replace("}", "
"))
    .pipe(rename("tokens--color.html"))
    .pipe(gulp.dest("./docs/"))
    .pipe(
      notify({
        message: "Your COLOR TOKEN HTML is ready ♡ "
      })
    );
}

const build = gulp.series(
  css,
  utils,
  tokens,
  components,
  colorTokens,
  fonts,
  svg,
  watch
);

exports.css = css;
exports.utils = utils;
exports.tokens = tokens;
exports.components = components;
exports.fonts = fonts;
exports.svg = svg;
exports.colorTokens = colorTokens;
exports.watch = watch;
exports.default = build;
<commit_msg>Try the CI workfrow without the watcher<commit_after>const gulp = require("gulp");
const postcss = require("gulp-postcss");
const autoprefixer = require("autoprefixer");
const postcssPresetEnv = require("postcss-preset-env");
const cssImport = require("postcss-import");
const customProperties = require("postcss-custom-properties");
const apply = require("postcss-apply");
const mixins = require("postcss-mixins");
const nested = require("postcss-nested");
const customMedia = require("postcss-custom-media");
const cssnano = require("cssnano");
const notify = require("gulp-notify");
const rename = require("gulp-rename");
const inject = require("gulp-inject-string");
const replace = require("gulp-string-replace");
const insert = require("gulp-insert");

function css() {
  return gulp
    .src("./src/nakDS.css")
    .pipe(
      postcss([
        cssImport(),
        mixins(),
        nested(),
        postcssPresetEnv(),
        autoprefixer()
      ])
    )
    .pipe(postcss([cssnano()]))
    .pipe(gulp.dest("./dist/css/"))
    .pipe(gulp.dest("./docs/css/"))
    .pipe(
      notify({
        message: "Your nakDS CSS is ready ♡"
      })
    );
}

function utils() {
  return gulp
    .src("./src/variables/core-utils.css")
    .pipe(
      postcss([
        cssImport(),
        mixins(),
        nested(),
        postcssPresetEnv(),
        autoprefixer()
      ])
    )
    .pipe(postcss([cssnano()]))
    .pipe(gulp.dest("./dist/css/"))
    .pipe(
      notify({
        message: "Your utils are ready ♡"
      })
    );
}

function tokens() {
  return (
    gulp
      .src("./src/tokens/**.css")
      .pipe(
        postcss([
          cssImport(),
          mixins(),
          nested(),
          postcssPresetEnv(),
          autoprefixer()
        ])
      )
      .pipe(gulp.dest("./dist/css/tokens"))
      .pipe(
        notify({
          message: "Your tokens are ready ♡"
        })
      )
  );
}

function components() {
  return gulp
    .src("./src/components/**.css")
    .pipe(
      postcss([
        cssImport(),
        mixins(),
        nested(),
        postcssPresetEnv(),
        autoprefixer()
      ])
    )
    .pipe(postcss([cssnano()]))
    .pipe(gulp.dest("./dist/css/components/"))
    .pipe(
      notify({
        message: "Your components are ready ♡"
      })
    );
}

function fonts() {
  return gulp
    .src("./assets/fonts/*.*")
    .pipe(gulp.dest("./dist/assets/fonts/"))
    .pipe(gulp.dest("./docs/assets/fonts/"));
}

function svg() {
  return gulp
    .src("./assets/svg/*.*")
    .pipe(gulp.dest("./dist/assets/svg/"))
    .pipe(gulp.dest("./docs/assets/svg/"));
}

// function watch() {
//   gulp.watch("./src/**/*.css", css);
// }

function colorTokens() {
  return gulp
    .src("./src/tokens/tokens--color.css")
    .pipe(postcss([cssnano()]))
    .pipe(
      inject.beforeEach("--color", ''))
    .pipe(replace(":root{", '
'))
    .pipe(replace("}", "
"))
    .pipe(rename("tokens--color.html"))
    .pipe(gulp.dest("./docs/"))
    .pipe(
      notify({
        message: "Your COLOR TOKEN HTML is ready ♡ "
      })
    );
}

const build = gulp.series(
  css,
  utils,
  tokens,
  components,
  colorTokens,
  fonts,
  svg
);

exports.css = css;
exports.utils = utils;
exports.tokens = tokens;
exports.components = components;
exports.fonts = fonts;
exports.svg = svg;
exports.colorTokens = colorTokens;
// exports.watch = watch;
exports.default = build;
<|endoftext|>


<commit_before>var gulp = require('gulp');
var LiveServer = require('gulp-live-server');
var browserSync = require('browser-sync');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var reactify = require('reactify');
var babelify = require('babelify');
var mocha = require('gulp-mocha');
var gulpJsx = require('gulp-jsx-coverage');
var uglify = require('gulp-uglify');
var isWatching = false;

gulp.on('stop', function() {
   if (!isWatching) {
       process.nextTick(function() {
           process.exit(0);
       });
   }
});

gulp.task('env-set', function() {
  var env = process.argv[3];
  if (env == '--production') {
    process.env.NODE_ENV = 'production';
  } else if (env == '--test') {
    process.env.NODE_ENV = 'test';
  } else {
    process.env.NODE_ENV = 'development';
  }
});

gulp.task('env:test', function() {
  process.env.NODE_ENV = 'test';
});

gulp.task('live-server', function() {
  var server = new LiveServer('server/server.js');
  server.start();
});

gulp.task('bundle', function() {
  return browserify({
      entries: 'app/main.jsx',
      debug: true,
    })
    .transform("babelify", {presets: ["es2015", "react"]})
    .bundle()
    .pipe(source('app.js'))
    .pipe(buffer())
    // .pipe(uglify())
    .pipe(gulp.dest('./.tmp'));
});

gulp.task('bundle-n-reload',['bundle'],browserSync.reload);

gulp.task('temp', function() {
  gulp.src(['app/index.html', 'app/*.css'])
    .pipe(gulp.dest('./.tmp'));

  gulp.src(['app/images/**'])
    .pipe(gulp.dest('./.tmp/images'));
});

gulp.task('observe-all', function() {
  isWatching = true;
  gulp.watch('app/**/**/*.*', ['bundle-n-reload']);

  gulp.watch('app/**/*.*', ['bundle-n-reload']);
  gulp.watch('app/*.*', ['temp']);
  gulp.watch('./server/**/*.js', ['live-server']);
});

gulp.task('frontend_test_cover', gulpJsx.createTask({
  src: ['tests/**/*.jsx'], // will pass to gulp.src as mocha tests
  istanbul: { // will pass to istanbul or isparta
    preserveComments: true, // required for istanbul 0.4.0+
    coverageVariable: '__MY_TEST_COVERAGE__',
    exclude: /node_modules|tests/ // do not instrument these files
  },

  transpile: {
    babel: {
      include: /\.jsx?$/,
      exclude: /node_modules/,
      omitExt: false
    }
  },

  threshold: [ // fail the task when coverage lower than one of this array
    {
      type: 'lines', // one of 'lines', 'statements', 'functions', 'banches'
      min: 50
    }
  ],
  coverage: {
    reporters: ['text-summary', 'json', 'lcov'], // list of istanbul reporters
    directory: 'coverage' // will pass to istanbul reporters
  },

  mocha: { // will pass to mocha
    reporter: 'spec'
  },
  // Recommend moving this to .babelrc
babel: {                                         // will pass to babel-core
    presets: ['es2015', 'react'],                // Use proper presets or plugins for your scripts
    sourceMap: 'both'                            // get hints in covarage reports or error stack
}
}));

gulp.task('test_cover', ['frontend_test_cover'], gulpJsx.createTask({
  src: ['tests/*.js'], // will pass to gulp.src as mocha tests
  istanbul: { // will pass to istanbul or isparta
    preserveComments: true, // required for istanbul 0.4.0+
    coverageVariable: '__MY_TEST_COVERAGE__',
    exclude: /node_modules|tests/ // do not instrument these files
  },

  transpile: {
    babel: {
      include: /\.jsx?$/,
      exclude: /node_modules/,
      omitExt: false
    }
  },

  threshold: [ // fail the task when coverage lower than one of this array
    {
      type: 'lines', // one of 'lines', 'statements', 'functions', 'banches'
      min: 60
    }
  ],
  coverage: {
    reporters: ['text-summary', 'json', 'lcov'], // list of istanbul reporters
    directory: 'coverage' // will pass to istanbul reporters
  },

  mocha: { // will pass to mocha
    reporter: 'spec'
  },
  // Recommend moving this to .babelrc
babel: {                                         // will pass to babel-core
    presets: ['es2015', 'react'],                // Use proper presets or plugins for your scripts
    sourceMap: 'both'                            // get hints in covarage reports or error stack
}
}));

gulp.task('test', ['env:test', 'test_cover']);

gulp.task('serve', ['env-set', 'live-server', 'bundle', 'temp', 'observe-all'], function() {
  browserSync.init(null, {
    proxy: 'http://localhost:3000',
    port: 9001,
  });
});
<commit_msg>Update the gulpfile to prevent the bundle task from crashing on syntax error<commit_after>var gulp = require('gulp');
var LiveServer = require('gulp-live-server');
var browserSync = require('browser-sync');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var reactify = require('reactify');
var babelify = require('babelify');
var mocha = require('gulp-mocha');
var gulpJsx = require('gulp-jsx-coverage');
var uglify = require('gulp-uglify');
var isWatching = false;

gulp.on('stop', function() {
   if (!isWatching) {
       process.nextTick(function() {
           process.exit(0);
       });
   }
});

gulp.task('env-set', function() {
  var env = process.argv[3];
  if (env == '--production') {
    process.env.NODE_ENV = 'production';
  } else if (env == '--test') {
    process.env.NODE_ENV = 'test';
  } else {
    process.env.NODE_ENV = 'development';
  }
});

gulp.task('env:test', function() {
  process.env.NODE_ENV = 'test';
});

gulp.task('live-server', function() {
  var server = new LiveServer('server/server.js');
  server.start();
});

gulp.task('bundle', function() {
  return browserify({
    entries: 'app/main.jsx',
    debug: true,
  })
    .transform("babelify", {presets: ["es2015", "react"]})
    .bundle()
    .on('error', function(err) {
      console.error(err.message);
      console.error(err.codeFrame);
      // end this stream
      this.emit('end');
    })
    .pipe(source('app.js'))
    .pipe(buffer())
    // .pipe(uglify())
    .pipe(gulp.dest('./.tmp'));
});

gulp.task('bundle-n-reload',['bundle'],browserSync.reload);

gulp.task('temp', function() {
  gulp.src(['app/index.html', 'app/*.css'])
    .pipe(gulp.dest('./.tmp'));

  gulp.src(['app/images/**'])
    .pipe(gulp.dest('./.tmp/images'));
});

gulp.task('observe-all', function() {
  isWatching = true;
  gulp.watch('app/**/**/*.*', ['bundle-n-reload']);

  gulp.watch('app/**/*.*', ['bundle-n-reload']);
  gulp.watch('app/*.*', ['temp']);
  gulp.watch('./server/**/*.js', ['live-server']);
});

gulp.task('frontend_test_cover', gulpJsx.createTask({
  src: ['tests/**/*.jsx'], // will pass to gulp.src as mocha tests
  istanbul: { // will pass to istanbul or isparta
    preserveComments: true, // required for istanbul 0.4.0+
    coverageVariable: '__MY_TEST_COVERAGE__',
    exclude: /node_modules|tests/ // do not instrument these files
  },

  transpile: {
    babel: {
      include: /\.jsx?$/,
      exclude: /node_modules/,
      omitExt: false
    }
  },

  threshold: [ // fail the task when coverage lower than one of this array
    {
      type: 'lines', // one of 'lines', 'statements', 'functions', 'banches'
      min: 50
    }
  ],
  coverage: {
    reporters: ['text-summary', 'json', 'lcov'], // list of istanbul reporters
    directory: 'coverage' // will pass to istanbul reporters
  },

  mocha: { // will pass to mocha
    reporter: 'spec'
  },
  // Recommend moving this to .babelrc
babel: {                                         // will pass to babel-core
    presets: ['es2015', 'react'],                // Use proper presets or plugins for your scripts
    sourceMap: 'both'                            // get hints in covarage reports or error stack
}
}));

gulp.task('test_cover', ['frontend_test_cover'], gulpJsx.createTask({
  src: ['tests/*.js'], // will pass to gulp.src as mocha tests
  istanbul: { // will pass to istanbul or isparta
    preserveComments: true, // required for istanbul 0.4.0+
    coverageVariable: '__MY_TEST_COVERAGE__',
    exclude: /node_modules|tests/ // do not instrument these files
  },

  transpile: {
    babel: {
      include: /\.jsx?$/,
      exclude: /node_modules/,
      omitExt: false
    }
  },

  threshold: [ // fail the task when coverage lower than one of this array
    {
      type: 'lines', // one of 'lines', 'statements', 'functions', 'banches'
      min: 60
    }
  ],
  coverage: {
    reporters: ['text-summary', 'json', 'lcov'], // list of istanbul reporters
    directory: 'coverage' // will pass to istanbul reporters
  },

  mocha: { // will pass to mocha
    reporter: 'spec'
  },
  // Recommend moving this to .babelrc
babel: {                                         // will pass to babel-core
    presets: ['es2015', 'react'],                // Use proper presets or plugins for your scripts
    sourceMap: 'both'                            // get hints in covarage reports or error stack
}
}));

gulp.task('test', ['env:test', 'test_cover']);

gulp.task('serve', ['env-set', 'live-server', 'bundle', 'temp', 'observe-all'], function() {
  browserSync.init(null, {
    proxy: 'http://localhost:3000',
    port: 9001,
  });
});
<|endoftext|>


<commit_before>var gulp = require('gulp');
var ts = require('gulp-typescript');
var merge = require('merge2');
var sourcemaps = require('gulp-sourcemaps');
var runSequence = require('run-sequence');
var del = require('del');
var rename = require('gulp-rename');
var jasmine = require('gulp-jasmine');
var jasmineBrowser = require('gulp-jasmine-browser');
var JasmineConsoleReporter = require('jasmine-console-reporter');
var webpack = require('webpack-stream');
var typedoc = require("gulp-typedoc");

var tsProject = ts.createProject('tsconfig.json', {
	sortOutput: true,
	declaration: true,
	rootDir: "./src",
	noExternalResolve: false
}, ts.reporter.fullReporter(true));

gulp.task('compile', function() {
	var tsResult = tsProject.src()
		.pipe(sourcemaps.init({ loadMaps: true }))
		.pipe(ts(tsProject, {referencedFrom:['typescript-ioc.ts']}));

	return merge([
		tsResult.dts.pipe(gulp.dest('release')),

		tsResult.js
				.pipe(sourcemaps.write('./'))
				.pipe(gulp.dest('release'))
	]);
});

gulp.task('clean', function() {
	return del(['release/**/*']);
});

gulp.task('docs-clean', function() {
	return del(['doc/']);
});

gulp.task('test-compile', function(done) {
 	return tsResult = gulp.src('src/**/test.ts')
		.pipe(sourcemaps.init({ loadMaps: true }))
		.pipe(ts(tsProject))
		.pipe(rename({ extname: '_spec.js' }))
		.pipe(sourcemaps.write('./'))
		.pipe(gulp.dest('release'));
});

gulp.task('test-run', function() {
	return gulp.src('release/**/*_spec.js')
		.pipe(jasmine({
	        timeout: 10000,
	        includeStackTrace: false,
	        reporter: new JasmineConsoleReporter({
				colors: 2,           // (0|false)|(1|true)|2
				cleanStack: 1,       // (0|false)|(1|true)|2|3
				verbosity: 4,        // (0|false)|1|2|(3|true)|4
				listStyle: 'indent', // "flat"|"indent"
				activity: false
			})
	    }));
});

gulp.task('test-run-browser', function() {
  var JasminePlugin = require('gulp-jasmine-browser/webpack/jasmine-plugin');
  var plugin = new JasminePlugin();
  return gulp.src('release/**/*_spec.js')
	    .pipe(webpack({output: {filename: 'browser_spec.js'}, plugins: [plugin]}))
	    .pipe(jasmineBrowser.specRunner({console: true}))
	    // .pipe(jasmineBrowser.server({port: 8888, whenReady: plugin.whenReady})); // to test on real browsers, uncomment
	    .pipe(jasmineBrowser.headless());// to test on real browsers, comment

});

gulp.task('test', function(done) {
    runSequence('test-compile', 'test-run', function() {
        console.log('Release tested.');
        done();
    });
});

gulp.task('test-browser-only', function(done) {
    runSequence('test-compile', 'test-run-browser', function() {
        console.log('Release tested.');
        done();
    });
});

gulp.task("docs", ['docs-clean'], function() {
    return gulp
        .src(["./src/typescript-ioc.ts"])
        .pipe(typedoc({
            module: "commonjs",
            target: "es5",
            out: "./doc/",
            name: "Typescript-ioc",
			includeDeclarations: true,
			experimentalDecorators: true,
			emitDecoratorMetadata: true,
			excludeExternals: true,
			// TypeDoc options (see typedoc docs)
			version: true,
			verbose: true
			// json: "output/to/file.json"

			// theme: "/path/to/my/theme",
			// ignoreCompilerErrors: false
        }))
    ;
});

gulp.task('release', function(done) {
    runSequence('clean', 'compile', 'test', 'docs', function() {
        console.log('Release deployed.');
        done();
    });
});

gulp.task('build', function(done) {
    runSequence('clean', 'compile', 'test', function() {
        console.log('Release deployed.');
        done();
    });
});

gulp.task('watch', ['compile'], function() {
    gulp.watch('src/**/*.ts', ['compile']);
});<commit_msg>Fix gulpfile<commit_after>var gulp = require('gulp');
var ts = require('gulp-typescript');
var merge = require('merge2');
var sourcemaps = require('gulp-sourcemaps');
var runSequence = require('run-sequence');
var del = require('del');
var rename = require('gulp-rename');
var jasmine = require('gulp-jasmine');
var jasmineBrowser = require('gulp-jasmine-browser');
var JasmineConsoleReporter = require('jasmine-console-reporter');
var webpack = require('webpack-stream');
var typedoc = require("gulp-typedoc");

var tsProject = ts.createProject('tsconfig.json', {
	declaration: true,
	rootDir: "./src",
	noResolve: false
}, ts.reporter.fullReporter(true));

gulp.task('compile', function() {
	var tsResult = gulp.src('src/typescript-ioc.ts')
		.pipe(sourcemaps.init({ loadMaps: true }))
		.pipe(tsProject());

	return merge([
		tsResult.dts.pipe(gulp.dest('release')),

		tsResult.js
				.pipe(sourcemaps.write('./'))
				.pipe(gulp.dest('release'))
	]);
});

gulp.task('clean', function() {
	return del(['release/**/*']);
});

gulp.task('docs-clean', function() {
	return del(['doc/']);
});

gulp.task('test-compile', function(done) {
 	return tsResult = gulp.src('src/**/test.ts')
		.pipe(sourcemaps.init({ loadMaps: true }))
		.pipe(tsProject())
		.pipe(sourcemaps.write('./'))
		.pipe(gulp.dest('release'));
});

gulp.task('test-run', function() {
	return gulp.src('release/spec/*.js')
		.pipe(jasmine({
	        timeout: 10000,
	        includeStackTrace: false,
	        reporter: new JasmineConsoleReporter({
				colors: 2,           // (0|false)|(1|true)|2
				cleanStack: 1,       // (0|false)|(1|true)|2|3
				verbosity: 4,        // (0|false)|1|2|(3|true)|4
				listStyle: 'indent', // "flat"|"indent"
				activity: false
			})
	    }));
});

gulp.task('test-run-browser', function() {
  var JasminePlugin = require('gulp-jasmine-browser/webpack/jasmine-plugin');
  var plugin = new JasminePlugin();
  return gulp.src('release/spec/*.js')
	    .pipe(webpack({output: {filename: 'browser.spec.js'}, plugins: [plugin]}))
	    .pipe(jasmineBrowser.specRunner({console: true}))
	    // .pipe(jasmineBrowser.server({port: 8888, whenReady: plugin.whenReady})); // to test on real browsers, uncomment
	    .pipe(jasmineBrowser.headless());// to test on real browsers, comment

});

gulp.task('test', function(done) {
    runSequence('test-compile', 'test-run', function() {
        console.log('Release tested.');
        done();
    });
});

gulp.task('test-browser-only', function(done) {
    runSequence('test-compile', 'test-run-browser', function() {
        console.log('Release tested.');
        done();
    });
});

gulp.task("docs", ['docs-clean'], function() {
    return gulp
        .src(["./src/typescript-ioc.ts"])
        .pipe(typedoc({
            module: "commonjs",
            target: "es5",
            out: "./doc/",
            name: "Typescript-ioc",
			includeDeclarations: true,
			experimentalDecorators: true,
			emitDecoratorMetadata: true,
			excludeExternals: true,
			// TypeDoc options (see typedoc docs)
			version: true,
			verbose: true
			// json: "output/to/file.json"

			// theme: "/path/to/my/theme",
			// ignoreCompilerErrors: false
        }))
    ;
});

gulp.task('release', function(done) {
    runSequence('clean', 'compile', 'test', 'docs', function() {
        console.log('Release deployed.');
        done();
    });
});

gulp.task('build', function(done) {
    runSequence('clean', 'compile', 'test', function() {
        console.log('Release deployed.');
        done();
    });
});

gulp.task('watch', ['compile'], function() {
    gulp.watch('src/**/*.ts', ['compile']);
});<|endoftext|>


<commit_before>var gulp = require('gulp')
var pug = require('gulp-pug')
var less = require('gulp-less')
var autoprefixer = require('gulp-autoprefixer')
var clean_css = require('gulp-clean-css')
var sourcemaps = require('gulp-sourcemaps')

gulp.task('pug:index', function () {
  return gulp.src('index.pug')
    .pipe(pug({
      basedir: './',
    }))
    .pipe(gulp.dest('./'))
})

gulp.task('pug:docs', function () {
  return gulp.src('docs/{index,principles,base,obj,comp,org,help,atom}.pug')
    .pipe(pug({
      basedir: './',
      locals: {
        Color             : require('csscolor').Color,
        Docs              : require('./docs/_models/Docs.class.js'),
        Util              : require('./_models/Util.class.js'),
        ConfSite          : require('./_models/ConfSite.class.js'),
        ConfPage          : require('./_models/ConfPage.class.js'),
        Conference        : require('./_models/Conference.class.js'),
        SupporterLevel    : require('./_models/SupporterLevel.class.js'),
        Supporter         : require('./_models/Supporter.class.js'),
        Person            : require('./_models/Person.class.js'),
        Place             : require('./_models/Place.class.js'),
        RegistrationPeriod: require('./_models/RegistrationPeriod.class.js'),
        Pass              : require('./_models/Pass.class.js'),
        Session           : require('./_models/Session.class.js'),
        ImportantDate     : require('./_models/ImportantDate.class.js'),
      },
    }))
    .pipe(gulp.dest('./docs/'))
})

gulp.task('pug:all', ['pug:index', 'pug:docs'])

gulp.task('lessc:neo', function () {
  return gulp.src('neo.less')
    .pipe(less())
    .pipe(autoprefixer({
      grid: true,
      cascade: false,
    }))
    .pipe(gulp.dest('./'))
})

gulp.task('lessc:docs', function () {
  return gulp.src('./docs/styles/docs.less')
    .pipe(less())
    .pipe(autoprefixer({
      grid: true,
      cascade: false,
    }))
    .pipe(gulp.dest('./docs/styles/'))
})

gulp.task('lessc:all', ['lessc:neo', 'lessc:docs'])

gulp.task('minify:neo', ['lessc:neo'], function () {
  return gulp.src('neo.css')
    .pipe(sourcemaps.init())
    .pipe(clean_css())
    .pipe(sourcemaps.write('./')) // write to an external .map file
    .pipe(gulp.dest('./'))
})

gulp.task('minify:docs', ['lessc:docs'], function () {
  return gulp.src('./docs/styles/docs.css')
    .pipe(sourcemaps.init())
    .pipe(clean_css())
    .pipe(sourcemaps.write('./')) // write to an external .map file
    .pipe(gulp.dest('./docs/styles/'))
})

gulp.task('minify:all', ['minify:neo', 'minify:docs'])

gulp.task('build', ['pug:all', 'lessc:all', 'minify:all'])
<commit_msg>update gulp tasks<commit_after>var gulp = require('gulp')
var pug = require('gulp-pug')
var less = require('gulp-less')
var autoprefixer = require('gulp-autoprefixer')
var clean_css = require('gulp-clean-css')
var sourcemaps = require('gulp-sourcemaps')

gulp.task('pug:index', function () {
  return gulp.src('index.pug')
    .pipe(pug({
      basedir: './',
    }))
    .pipe(gulp.dest('./'))
})

gulp.task('pug:docs', function () {
  return gulp.src('docs/{index,principles,base,obj,comp,org,help,atom}.pug')
    .pipe(pug({
      basedir: './',
      locals: {
        Color             : require('csscolor').Color,
        Docs              : require('./docs/_models/Docs.class.js'),
        Util              : require('./_models/Util.class.js'),
        ConfSite          : require('./_models/ConfSite.class.js'),
        ConfPage          : require('./_models/ConfPage.class.js'),
        Conference        : require('./_models/Conference.class.js'),
        SupporterLevel    : require('./_models/SupporterLevel.class.js'),
        Supporter         : require('./_models/Supporter.class.js'),
        Person            : require('./_models/Person.class.js'),
        Place             : require('./_models/Place.class.js'),
        RegistrationPeriod: require('./_models/RegistrationPeriod.class.js'),
        Pass              : require('./_models/Pass.class.js'),
        Session           : require('./_models/Session.class.js'),
        ImportantDate     : require('./_models/ImportantDate.class.js'),
      },
    }))
    .pipe(gulp.dest('./docs/'))
})

gulp.task('pug:all', ['pug:index', 'pug:docs'])

gulp.task('lessc:core', function () {
  return gulp.src('neo.less')
    .pipe(less())
    .pipe(autoprefixer({
      grid: true,
      cascade: false,
    }))
    .pipe(gulp.dest('./'))
    .pipe(sourcemaps.init())
    .pipe(clean_css())
    .pipe(sourcemaps.write('./')) // write to an external .map file
    .pipe(gulp.dest('./'))
})

gulp.task('lessc:docs', function () {
  return gulp.src('./docs/styles/docs.less')
    .pipe(less())
    .pipe(autoprefixer({
      grid: true,
      cascade: false,
    }))
    .pipe(gulp.dest('./docs/styles/'))
})

gulp.task('lessc:all', ['lessc:core', 'lessc:docs'])

gulp.task('build', ['pug:all', 'lessc:all'])
<|endoftext|>


<commit_before>
"use strict";

class Widget {

    constructor() {
        this.restrict = 'E';
        this.scope = {app: '=', model: '=', field: '='};
        this.transclude = true;
        this.controllerAs = 'widget';
        this.bindToController = true;
    }

    get controller() {
        return ['$scope', $scope => {}];
    }

};

export {Widget};

<commit_msg>pompidom, experiment with non-isolate scope<commit_after>
"use strict";

class Widget {

    constructor() {
        this.restrict = 'E';
        this.transclude = true;
        this.controllerAs = 'widget';
        this.bindToController = true;
    }

    get controller() {
        return ['$attrs', '$scope', ($attrs, $scope) => {
            this.model = $scope.$eval($attrs.model);
            $scope.app = $scope.$parent.data.app;
            $scope.model = $scope.$parent.data.model;
        }];
    }

};

export {Widget};

<|endoftext|>


<commit_before>/*
 * Copyright (c) 2016 Steven Soloff
 *
 * This is free software: you can redistribute it and/or modify it under the
 * terms of the MIT License (https://opensource.org/licenses/MIT).
 * This software comes with ABSOLUTELY NO WARRANTY.
 */

'use strict';

const _ = require('underscore');
const childProcess = require('child_process');
const del = require('del');
const fs = require('fs');
const gulp = require('gulp');

const BUILD_OUTPUT_DIR = 'build';
const FEATURES_DIR = 'features';
const NODE_MODULES_BIN_DIR = 'node_modules/.bin';
const SRC_DIR = 'src';
const CLIENT_SRC_DIR = `${SRC_DIR}/client`;
const SERVER_SRC_DIR = `${SRC_DIR}/server`;
const SUPPORT_DIR = 'support';
const TEST_DIR = 'test';
const SERVER_TEST_DIR = `${TEST_DIR}/server`;
const COMPILE_OUTPUT_DIR = `${BUILD_OUTPUT_DIR}/compile`;
const COVERAGE_OUTPUT_DIR = `${BUILD_OUTPUT_DIR}/coverage`;
const DIST_OUTPUT_DIR = `${BUILD_OUTPUT_DIR}/dist`;

const SERVER_PID = 'server.pid';
const SERVER_PID_ENCODING = 'utf8';

function exec(command, callback) {
  childProcess.exec(command, (err) => {
    if (err) {
      return callback(err);
    }
    callback();
  });
}

function runCucumber(path) {
  const cucumber = require('gulp-cucumber');
  const glob = require('glob');
  const streamToPromise = require('stream-to-promise');

  let promise = Promise.resolve();

  const featureDirs = glob.sync(`${path}/*`, {
    ignore: `${path}/support`,
  });
  featureDirs.forEach((featureDir) => {
    promise = promise.then(() => streamToPromise(gulp.src([`${featureDir}/*.feature`]).pipe(cucumber({}))));
  });

  return promise;
}

function runEsLint(globs, configPath) {
  const eslint = require('gulp-eslint');
  return gulp.src(globs)
    .pipe(eslint({
      configFile: configPath,
    }))
    .pipe(eslint.format())
    .pipe(eslint.failAfterError());
}

function runHtmlHint(stream) {
  const htmlhint = require('gulp-htmlhint');
  return stream
    .pipe(htmlhint())
    .pipe(htmlhint.failReporter());
}

function runJsDoc(configPath, callback) {
  exec(`${NODE_MODULES_BIN_DIR}/jsdoc -c ${configPath}`, callback);
}

function runUnitTests() {
  const jasmine = require('gulp-jasmine');
  return gulp.src('') // Files to process are defined in Jasmine configuration below
    .pipe(jasmine({
      config: require(`./${COMPILE_OUTPUT_DIR}/${SERVER_TEST_DIR}/.jasmine.json`),
    }));
}

function wrapHtmlFragment(content) {
  return `<!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="utf-8">
      <title>FRAGMENT</title>
    </head>
    <body>
    ${content}
    </body>
    </html>`;
}

gulp.task('acceptance-test:client', () => {
  return runCucumber(`${FEATURES_DIR}/client`);
});

gulp.task('acceptance-test:server', () => {
  return runCucumber(`${FEATURES_DIR}/server`);
});

gulp.task('acceptance-test', (done) => {
  const runSequence = require('run-sequence');
  runSequence('acceptance-test:client', 'acceptance-test:server', done);
});

gulp.task('clean', () => {
  return del([BUILD_OUTPUT_DIR]);
});

gulp.task('compile:jison', () => {
  const jison = require('gulp-jison');
  return gulp.src(`${SRC_DIR}/**/*.jison`)
    .pipe(jison())
    .pipe(gulp.dest(`${COMPILE_OUTPUT_DIR}/${SRC_DIR}`));
});

gulp.task('compile:js', () => {
  return gulp.src([`${SRC_DIR}/**/*`, `${SUPPORT_DIR}/**/*`, `${TEST_DIR}/**/*`], {base: '.', dot: true})
    .pipe(gulp.dest(COMPILE_OUTPUT_DIR));
});

gulp.task('compile', ['compile:jison', 'compile:js']);

gulp.task('dist:client', () => {
  const eventStream = require('event-stream');
  const flatten = require('gulp-flatten');
  const mainBowerFiles = require('main-bower-files');
  const PUBLIC_DIR = 'public';
  const HTML_DIR = PUBLIC_DIR;
  const CSS_DIR = `${PUBLIC_DIR}/css`;
  const JS_DIR = `${PUBLIC_DIR}/js`;
  const JS_VENDOR_DIR = `${JS_DIR}/vendor`;

  return eventStream.merge(
    gulp.src(`${COMPILE_OUTPUT_DIR}/${CLIENT_SRC_DIR}/**/*.html`)
      .pipe(flatten())
      .pipe(gulp.dest(`${DIST_OUTPUT_DIR}/${HTML_DIR}`)),
    gulp.src(`${COMPILE_OUTPUT_DIR}/${CLIENT_SRC_DIR}/**/*.css`)
      .pipe(flatten())
      .pipe(gulp.dest(`${DIST_OUTPUT_DIR}/${CSS_DIR}`)),
    gulp.src(`${COMPILE_OUTPUT_DIR}/${CLIENT_SRC_DIR}/**/*.js`)
      .pipe(flatten())
      .pipe(gulp.dest(`${DIST_OUTPUT_DIR}/${JS_DIR}`)),
    gulp.src(mainBowerFiles('**/*.js'))
      .pipe(gulp.dest(`${DIST_OUTPUT_DIR}/${JS_VENDOR_DIR}`)),
    gulp.src(mainBowerFiles('**/*.css'))
      .pipe(gulp.dest(`${DIST_OUTPUT_DIR}/${CSS_DIR}`))
  );
});

gulp.task('dist:server', () => {
  return gulp.src(`${COMPILE_OUTPUT_DIR}/${SERVER_SRC_DIR}/**/*.js`)
    .pipe(gulp.dest(DIST_OUTPUT_DIR));
});

gulp.task('dist', ['dist:client', 'dist:server']);

gulp.task('docs:client', (done) => {
  runJsDoc('.jsdoc-client-conf.json', done);
});

gulp.task('docs:server', (done) => {
  runJsDoc('.jsdoc-server-conf.json', done);
});

gulp.task('docs', ['docs:client', 'docs:server']);

gulp.task('instrument-for-coverage', ['compile'], () => {
  const istanbul = require('gulp-istanbul');
  return gulp.src(
    [
      `${COMPILE_OUTPUT_DIR}/${SERVER_SRC_DIR}/**/*.js`,
      `!${COMPILE_OUTPUT_DIR}/${SERVER_SRC_DIR}/model/dice-expression-parser.js`,
      `${COMPILE_OUTPUT_DIR}/${SERVER_TEST_DIR}/**/*.js`,
    ]
    )
    .pipe(istanbul())
    .pipe(istanbul.hookRequire());
});

gulp.task('lint:css', () => {
  const csslint = require('gulp-csslint');
  return gulp.src(`${CLIENT_SRC_DIR}/**/*.css`)
    .pipe(csslint())
    .pipe(csslint.formatter())
    .pipe(csslint.formatter('fail'));
});

gulp.task('lint:html:fragment', () => {
  const change = require('gulp-change');
  return runHtmlHint(
    gulp.src(`${CLIENT_SRC_DIR}/*/**/*.html`)
      .pipe(change(wrapHtmlFragment))
  );
});

gulp.task('lint:html:full', () => {
  return runHtmlHint(
    gulp.src(`${CLIENT_SRC_DIR}/index.html`)
  );
});

gulp.task('lint:html', ['lint:html:full', 'lint:html:fragment']);

gulp.task('lint:js:default', () => {
  return runEsLint([
    `${FEATURES_DIR}/**/*.js`,
    `${COMPILE_OUTPUT_DIR}/${SRC_DIR}/**/*.js`,
    `!${COMPILE_OUTPUT_DIR}/${SERVER_SRC_DIR}/model/dice-expression-parser.js`,
    `${COMPILE_OUTPUT_DIR}/${TEST_DIR}/**/*.js`,
  ]);
});

gulp.task('lint:js:gulpfile', () => {
  return runEsLint('gulpfile.js', '.eslintrc-gulpfile.json');
});

gulp.task('lint:js', ['lint:js:default', 'lint:js:gulpfile']);

gulp.task('lint:json', () => {
  const jsonlint = require('gulp-jsonlint');
  return gulp.src(
    ['./*.json', `${FEATURES_DIR}/**/*.json`, `${SRC_DIR}/**/*.json`, `${TEST_DIR}/**/*.json`],
    {dot: true}
    )
    .pipe(jsonlint())
    .pipe(jsonlint.reporter())
    .pipe(jsonlint.failAfterError());
});

gulp.task('lint:package', (done) => {
  const gutil = require('gulp-util');
  const through = require('through2');
  const validate = require('gulp-nice-package');

  function failOnError() {
    return through.obj((file, enc, cb) => {
      let error = null;
      if (file.nicePackage.valid === false) {
        error = new gutil.PluginError(
          'gulp-nice-package',
          `Failed with ${_.size(file.nicePackage.errors)} error(s), ` +
              `${_.size(file.nicePackage.warnings)} warning(s), ` +
              `${_.size(file.nicePackage.recommendations)} recommendation(s)`
        );
      }
      return cb(error, file);
    });
  };

  return gulp.src('package.json')
    .pipe(validate())
    .pipe(failOnError());
});

gulp.task('lint', ['lint:js', 'lint:json', 'lint:package', 'lint:html', 'lint:css']);

gulp.task('publish-coverage', () => {
  const coveralls = require('gulp-coveralls');
  return gulp.src(`${COVERAGE_OUTPUT_DIR}/lcov.info`)
    .pipe(coveralls());
});

gulp.task('start-server', (done) => {
  const child = childProcess.spawn(
    process.argv[0],
    [
      `${DIST_OUTPUT_DIR}/server.js`,
      `${SERVER_TEST_DIR}/test-keys/private-key.pem`,
      `${SERVER_TEST_DIR}/test-keys/public-key.pem`,
    ],
    {
      detached: true,
      stdio: 'ignore',
    }
    )
    .on('error', done);
  child.unref();

  if (!_.isUndefined(child.pid)) {
    fs.writeFileSync(SERVER_PID, child.pid, {
      encoding: SERVER_PID_ENCODING,
    });
  }

  done();
});

gulp.task('stop-server', () => {
  const pid = fs.readFileSync(SERVER_PID, {
    encoding: SERVER_PID_ENCODING,
  });
  process.kill(pid);
  return del([SERVER_PID]);
});

gulp.task('unit-test', ['compile'], () => {
  return runUnitTests();
});

gulp.task('unit-test-with-coverage', ['instrument-for-coverage'], () => {
  const istanbul = require('gulp-istanbul');
  return runUnitTests()
    .pipe(istanbul.writeReports({
      dir: COVERAGE_OUTPUT_DIR,
      reporters: ['lcov', 'text-summary'],
    }))
    .pipe(istanbul.enforceThresholds({
      thresholds: {
        global: 90,
      },
    }));
});
<commit_msg>Fix lint violations<commit_after>/*
 * Copyright (c) 2016 Steven Soloff
 *
 * This is free software: you can redistribute it and/or modify it under the
 * terms of the MIT License (https://opensource.org/licenses/MIT).
 * This software comes with ABSOLUTELY NO WARRANTY.
 */

'use strict';

const _ = require('underscore');
const childProcess = require('child_process');
const del = require('del');
const fs = require('fs');
const gulp = require('gulp');

const BUILD_OUTPUT_DIR = 'build';
const FEATURES_DIR = 'features';
const NODE_MODULES_BIN_DIR = 'node_modules/.bin';
const SRC_DIR = 'src';
const CLIENT_SRC_DIR = `${SRC_DIR}/client`;
const SERVER_SRC_DIR = `${SRC_DIR}/server`;
const SUPPORT_DIR = 'support';
const TEST_DIR = 'test';
const SERVER_TEST_DIR = `${TEST_DIR}/server`;
const COMPILE_OUTPUT_DIR = `${BUILD_OUTPUT_DIR}/compile`;
const COVERAGE_OUTPUT_DIR = `${BUILD_OUTPUT_DIR}/coverage`;
const DIST_OUTPUT_DIR = `${BUILD_OUTPUT_DIR}/dist`;

const SERVER_PID = 'server.pid';
const SERVER_PID_ENCODING = 'utf8';

function exec(command, callback) {
  childProcess.exec(command, (err) => {
    if (err) {
      return callback(err);
    }
    callback();
  });
}

function runCucumber(path) {
  const cucumber = require('gulp-cucumber');
  const glob = require('glob');
  const streamToPromise = require('stream-to-promise');

  let promise = Promise.resolve();

  const featureDirs = glob.sync(`${path}/*`, {
    ignore: `${path}/support`,
  });
  featureDirs.forEach((featureDir) => {
    promise = promise.then(() => streamToPromise(gulp.src([`${featureDir}/*.feature`]).pipe(cucumber({}))));
  });

  return promise;
}

function runEsLint(globs, configPath) {
  const eslint = require('gulp-eslint');
  return gulp.src(globs)
    .pipe(eslint({
      configFile: configPath,
    }))
    .pipe(eslint.format())
    .pipe(eslint.failAfterError());
}

function runHtmlHint(stream) {
  const htmlhint = require('gulp-htmlhint');
  return stream
    .pipe(htmlhint())
    .pipe(htmlhint.failReporter());
}

function runJsDoc(configPath, callback) {
  exec(`${NODE_MODULES_BIN_DIR}/jsdoc -c ${configPath}`, callback);
}

function runUnitTests() {
  const jasmine = require('gulp-jasmine');
  return gulp.src('') // Files to process are defined in Jasmine configuration below
    .pipe(jasmine({
      config: require(`./${COMPILE_OUTPUT_DIR}/${SERVER_TEST_DIR}/.jasmine.json`),
    }));
}

function wrapHtmlFragment(content) {
  return `<!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="utf-8">
      <title>FRAGMENT</title>
    </head>
    <body>
    ${content}
    </body>
    </html>`;
}

gulp.task('acceptance-test:client', () => {
  return runCucumber(`${FEATURES_DIR}/client`);
});

gulp.task('acceptance-test:server', () => {
  return runCucumber(`${FEATURES_DIR}/server`);
});

gulp.task('acceptance-test', (done) => {
  const runSequence = require('run-sequence');
  runSequence('acceptance-test:client', 'acceptance-test:server', done);
});

gulp.task('clean', () => {
  return del([BUILD_OUTPUT_DIR]);
});

gulp.task('compile:jison', () => {
  const jison = require('gulp-jison');
  return gulp.src(`${SRC_DIR}/**/*.jison`)
    .pipe(jison())
    .pipe(gulp.dest(`${COMPILE_OUTPUT_DIR}/${SRC_DIR}`));
});

gulp.task('compile:js', () => {
  return gulp.src([`${SRC_DIR}/**/*`, `${SUPPORT_DIR}/**/*`, `${TEST_DIR}/**/*`], {base: '.', dot: true})
    .pipe(gulp.dest(COMPILE_OUTPUT_DIR));
});

gulp.task('compile', ['compile:jison', 'compile:js']);

gulp.task('dist:client', () => {
  const eventStream = require('event-stream');
  const flatten = require('gulp-flatten');
  const mainBowerFiles = require('main-bower-files');
  const PUBLIC_DIR = 'public';
  const HTML_DIR = PUBLIC_DIR;
  const CSS_DIR = `${PUBLIC_DIR}/css`;
  const JS_DIR = `${PUBLIC_DIR}/js`;
  const JS_VENDOR_DIR = `${JS_DIR}/vendor`;

  return eventStream.merge(
    gulp.src(`${COMPILE_OUTPUT_DIR}/${CLIENT_SRC_DIR}/**/*.html`)
      .pipe(flatten())
      .pipe(gulp.dest(`${DIST_OUTPUT_DIR}/${HTML_DIR}`)),
    gulp.src(`${COMPILE_OUTPUT_DIR}/${CLIENT_SRC_DIR}/**/*.css`)
      .pipe(flatten())
      .pipe(gulp.dest(`${DIST_OUTPUT_DIR}/${CSS_DIR}`)),
    gulp.src(`${COMPILE_OUTPUT_DIR}/${CLIENT_SRC_DIR}/**/*.js`)
      .pipe(flatten())
      .pipe(gulp.dest(`${DIST_OUTPUT_DIR}/${JS_DIR}`)),
    gulp.src(mainBowerFiles('**/*.js'))
      .pipe(gulp.dest(`${DIST_OUTPUT_DIR}/${JS_VENDOR_DIR}`)),
    gulp.src(mainBowerFiles('**/*.css'))
      .pipe(gulp.dest(`${DIST_OUTPUT_DIR}/${CSS_DIR}`))
  );
});

gulp.task('dist:server', () => {
  return gulp.src(`${COMPILE_OUTPUT_DIR}/${SERVER_SRC_DIR}/**/*.js`)
    .pipe(gulp.dest(DIST_OUTPUT_DIR));
});

gulp.task('dist', ['dist:client', 'dist:server']);

gulp.task('docs:client', (done) => {
  runJsDoc('.jsdoc-client-conf.json', done);
});

gulp.task('docs:server', (done) => {
  runJsDoc('.jsdoc-server-conf.json', done);
});

gulp.task('docs', ['docs:client', 'docs:server']);

gulp.task('instrument-for-coverage', ['compile'], () => {
  const istanbul = require('gulp-istanbul');
  return gulp.src(
    [
      `${COMPILE_OUTPUT_DIR}/${SERVER_SRC_DIR}/**/*.js`,
      `!${COMPILE_OUTPUT_DIR}/${SERVER_SRC_DIR}/model/dice-expression-parser.js`,
      `${COMPILE_OUTPUT_DIR}/${SERVER_TEST_DIR}/**/*.js`,
    ]
    )
    .pipe(istanbul())
    .pipe(istanbul.hookRequire());
});

gulp.task('lint:css', () => {
  const csslint = require('gulp-csslint');
  return gulp.src(`${CLIENT_SRC_DIR}/**/*.css`)
    .pipe(csslint())
    .pipe(csslint.formatter())
    .pipe(csslint.formatter('fail'));
});

gulp.task('lint:html:fragment', () => {
  const change = require('gulp-change');
  return runHtmlHint(
    gulp.src(`${CLIENT_SRC_DIR}/*/**/*.html`)
      .pipe(change(wrapHtmlFragment))
  );
});

gulp.task('lint:html:full', () => {
  return runHtmlHint(
    gulp.src(`${CLIENT_SRC_DIR}/index.html`)
  );
});

gulp.task('lint:html', ['lint:html:full', 'lint:html:fragment']);

gulp.task('lint:js:default', () => {
  return runEsLint([
    `${FEATURES_DIR}/**/*.js`,
    `${COMPILE_OUTPUT_DIR}/${SRC_DIR}/**/*.js`,
    `!${COMPILE_OUTPUT_DIR}/${SERVER_SRC_DIR}/model/dice-expression-parser.js`,
    `${COMPILE_OUTPUT_DIR}/${TEST_DIR}/**/*.js`,
  ]);
});

gulp.task('lint:js:gulpfile', () => {
  return runEsLint('gulpfile.js', '.eslintrc-gulpfile.json');
});

gulp.task('lint:js', ['lint:js:default', 'lint:js:gulpfile']);

gulp.task('lint:json', () => {
  const jsonlint = require('gulp-jsonlint');
  return gulp.src(
    ['./*.json', `${FEATURES_DIR}/**/*.json`, `${SRC_DIR}/**/*.json`, `${TEST_DIR}/**/*.json`],
    {dot: true}
    )
    .pipe(jsonlint())
    .pipe(jsonlint.reporter())
    .pipe(jsonlint.failAfterError());
});

gulp.task('lint:package', () => {
  const gutil = require('gulp-util');
  const through = require('through2');
  const validate = require('gulp-nice-package');

  function failOnError() {
    return through.obj((file, enc, cb) => {
      let error = null;
      if (file.nicePackage.valid === false) {
        error = new gutil.PluginError(
          'gulp-nice-package',
          `Failed with ${_.size(file.nicePackage.errors)} error(s), ` +
              `${_.size(file.nicePackage.warnings)} warning(s), ` +
              `${_.size(file.nicePackage.recommendations)} recommendation(s)`
        );
      }
      return cb(error, file);
    });
  }

  return gulp.src('package.json')
    .pipe(validate())
    .pipe(failOnError());
});

gulp.task('lint', ['lint:js', 'lint:json', 'lint:package', 'lint:html', 'lint:css']);

gulp.task('publish-coverage', () => {
  const coveralls = require('gulp-coveralls');
  return gulp.src(`${COVERAGE_OUTPUT_DIR}/lcov.info`)
    .pipe(coveralls());
});

gulp.task('start-server', (done) => {
  const child = childProcess.spawn(
    process.argv[0],
    [
      `${DIST_OUTPUT_DIR}/server.js`,
      `${SERVER_TEST_DIR}/test-keys/private-key.pem`,
      `${SERVER_TEST_DIR}/test-keys/public-key.pem`,
    ],
    {
      detached: true,
      stdio: 'ignore',
    }
    )
    .on('error', done);
  child.unref();

  if (!_.isUndefined(child.pid)) {
    fs.writeFileSync(SERVER_PID, child.pid, {
      encoding: SERVER_PID_ENCODING,
    });
  }

  done();
});

gulp.task('stop-server', () => {
  const pid = fs.readFileSync(SERVER_PID, {
    encoding: SERVER_PID_ENCODING,
  });
  process.kill(pid);
  return del([SERVER_PID]);
});

gulp.task('unit-test', ['compile'], () => {
  return runUnitTests();
});

gulp.task('unit-test-with-coverage', ['instrument-for-coverage'], () => {
  const istanbul = require('gulp-istanbul');
  return runUnitTests()
    .pipe(istanbul.writeReports({
      dir: COVERAGE_OUTPUT_DIR,
      reporters: ['lcov', 'text-summary'],
    }))
    .pipe(istanbul.enforceThresholds({
      thresholds: {
        global: 90,
      },
    }));
});
<|endoftext|>


<commit_before>import escapeAttr from '../utils/escapeAttr';
import isInArray from '../utils/isInArray';
import dasherize from '../utils/dasherize';
import { IS_DEBUG } from '../utils/debug';

function setAttr(node, name, val) {
    if(name === 'type' && node.tagName === 'INPUT') {
        const value = node.value; // value will be lost in IE if type is changed

        node.setAttribute(name, '' + val);
        node.value = value;
    }
    else {
        node.setAttribute(ATTR_NAMES[name] || name, '' + val);
    }
}

function setBooleanAttr(node, name, val) {
    if(val) {
        setAttr(node, name, val);
    }
    else {
        removeAttr(node, name);
    }
}

function setProp(node, name, val) {
    node[name] = val;
}

function setObjProp(node, name, val) {
    if(IS_DEBUG) {
        const typeOfVal = typeof val;

        if(typeOfVal !== 'object') {
            throw TypeError(`vidom: "${name}" attribute value must be an object, not a ${typeOfVal}`);
        }
    }

    const prop = node[name];

    for(const i in val) {
        prop[i] = val[i] == null? '' : val[i];
    }
}

function setPropWithCheck(node, name, val) {
    if(name === 'value' && node.tagName === 'SELECT') {
        setSelectValue(node, val);
    }
    else {
        node[name] !== val && (node[name] = val);
    }
}

function removeAttr(node, name) {
    node.removeAttribute(ATTR_NAMES[name] || name);
}

function removeProp(node, name) {
    if(name === 'style') {
        node[name].cssText = '';
    }
    else if(name === 'value' && node.tagName === 'SELECT') {
        removeSelectValue(node);
    }
    else {
        node[name] = getDefaultPropVal(node.tagName, name);
    }
}

function setSelectValue(node, value) {
    const isMultiple = Array.isArray(value);

    if(isMultiple) {
        const { options } = node,
            len = options.length;
        let i = 0,
            optionNode;

        while(i < len) {
            optionNode = options[i++];
            optionNode.selected = value != null && isInArray(value, optionNode.value);
        }
    }
    else {
        node.value = value;
    }
}

function removeSelectValue(node) {
    const options = node.options,
        len = options.length;
    let i = 0;

    while(i < len) {
        options[i++].selected = false;
    }
}

function attrToString(name, value) {
    return value === false?
        '' :
        (ATTR_NAMES[name] || name) + (value === true? '' : '="' + escapeAttr(value) + '"');
}

function booleanAttrToString(name, value) {
    return value? name : '';
}

function stylePropToString(name, value) {
    let styles = '',
        i;

    for(i in value) {
        if(value[i] != null) {
            styles += dasherize(i) + ':' + value[i] + ';';
        }
    }

    return styles? name + '="' + styles + '"' : styles;
}

const defaultPropVals = {};

function getDefaultPropVal(tag, attrName) {
    const tagAttrs = defaultPropVals[tag] || (defaultPropVals[tag] = {});

    return attrName in tagAttrs?
        tagAttrs[attrName] :
        tagAttrs[attrName] = document.createElement(tag)[attrName];
}

const ATTR_NAMES = {
        acceptCharset : 'accept-charset',
        className : 'class',
        htmlFor : 'for',
        httpEquiv : 'http-equiv',
        autoCapitalize : 'autocapitalize',
        autoComplete : 'autocomplete',
        autoCorrect : 'autocorrect',
        autoFocus : 'autofocus',
        autoPlay : 'autoplay',
        encType : 'encoding',
        hrefLang : 'hreflang',
        radioGroup : 'radiogroup',
        spellCheck : 'spellcheck',
        srcDoc : 'srcdoc',
        srcSet : 'srcset',
        tabIndex : 'tabindex'
    },
    DEFAULT_ATTR_CFG = {
        set : setAttr,
        remove : removeAttr,
        toString : attrToString
    },
    BOOLEAN_ATTR_CFG = {
        set : setBooleanAttr,
        remove : removeAttr,
        toString : booleanAttrToString
    },
    DEFAULT_PROP_CFG = {
        set : setProp,
        remove : removeProp,
        toString : attrToString
    },
    BOOLEAN_PROP_CFG = {
        set : setProp,
        remove : removeProp,
        toString : booleanAttrToString
    },
    attrsCfg = {
        checked : BOOLEAN_PROP_CFG,
        controls : DEFAULT_PROP_CFG,
        disabled : BOOLEAN_ATTR_CFG,
        id : DEFAULT_PROP_CFG,
        ismap : BOOLEAN_ATTR_CFG,
        loop : DEFAULT_PROP_CFG,
        multiple : BOOLEAN_PROP_CFG,
        muted : DEFAULT_PROP_CFG,
        open : BOOLEAN_ATTR_CFG,
        readOnly : BOOLEAN_PROP_CFG,
        selected : BOOLEAN_PROP_CFG,
        srcDoc : DEFAULT_PROP_CFG,
        style : {
            set : setObjProp,
            remove : removeProp,
            toString : stylePropToString
        },
        value : {
            set : setPropWithCheck,
            remove : removeProp,
            toString : attrToString
        }
    };

export default function(attrName) {
    return attrsCfg[attrName] || DEFAULT_ATTR_CFG;
}
<commit_msg>Add support of some missing html attributes (closes #305)<commit_after>import escapeAttr from '../utils/escapeAttr';
import isInArray from '../utils/isInArray';
import dasherize from '../utils/dasherize';
import { IS_DEBUG } from '../utils/debug';

function setAttr(node, name, val) {
    if(name === 'type' && node.tagName === 'INPUT') {
        const value = node.value; // value will be lost in IE if type is changed

        node.setAttribute(name, '' + val);
        node.value = value;
    }
    else {
        node.setAttribute(getAttrName(name), '' + val);
    }
}

function setBooleanAttr(node, name, val) {
    if(val) {
        setAttr(node, name, val);
    }
    else {
        removeAttr(node, name);
    }
}

function setProp(node, name, val) {
    node[name] = val;
}

function setObjProp(node, name, val) {
    if(IS_DEBUG) {
        const typeOfVal = typeof val;

        if(typeOfVal !== 'object') {
            throw TypeError(`vidom: "${name}" attribute value must be an object, not a ${typeOfVal}`);
        }
    }

    const prop = node[name];

    for(const i in val) {
        prop[i] = val[i] == null? '' : val[i];
    }
}

function setPropWithCheck(node, name, val) {
    if(name === 'value' && node.tagName === 'SELECT') {
        setSelectValue(node, val);
    }
    else {
        node[name] !== val && (node[name] = val);
    }
}

function removeAttr(node, name) {
    node.removeAttribute(getAttrName(name));
}

function removeProp(node, name) {
    if(name === 'style') {
        node[name].cssText = '';
    }
    else if(name === 'value' && node.tagName === 'SELECT') {
        removeSelectValue(node);
    }
    else {
        node[name] = getDefaultPropVal(node.tagName, name);
    }
}

function setSelectValue(node, value) {
    const isMultiple = Array.isArray(value);

    if(isMultiple) {
        const { options } = node,
            len = options.length;
        let i = 0,
            optionNode;

        while(i < len) {
            optionNode = options[i++];
            optionNode.selected = value != null && isInArray(value, optionNode.value);
        }
    }
    else {
        node.value = value;
    }
}

function removeSelectValue(node) {
    const options = node.options,
        len = options.length;
    let i = 0;

    while(i < len) {
        options[i++].selected = false;
    }
}

function attrToString(name, value) {
    return value === false?
        '' :
        getAttrName(name) + (value === true? '' : '="' + escapeAttr(value) + '"');
}

function booleanAttrToString(name, value) {
    return value? getAttrName(name) : '';
}

function stylePropToString(name, value) {
    let styles = '',
        i;

    for(i in value) {
        if(value[i] != null) {
            styles += dasherize(i) + ':' + value[i] + ';';
        }
    }

    return styles? name + '="' + styles + '"' : styles;
}

const defaultPropVals = {};

function getDefaultPropVal(tag, attrName) {
    const tagAttrs = defaultPropVals[tag] || (defaultPropVals[tag] = {});

    return attrName in tagAttrs?
        tagAttrs[attrName] :
        tagAttrs[attrName] = document.createElement(tag)[attrName];
}

function getAttrName(attrName) {
    return ATTR_NAMES[attrName] || (ATTR_NAMES[attrName] = attrName.toLowerCase());
}

const ATTR_NAMES = {
        acceptCharset : 'accept-charset',
        className : 'class',
        htmlFor : 'for',
        httpEquiv : 'http-equiv'
    },
    DEFAULT_ATTR_CFG = {
        set : setAttr,
        remove : removeAttr,
        toString : attrToString
    },
    BOOLEAN_ATTR_CFG = {
        set : setBooleanAttr,
        remove : removeAttr,
        toString : booleanAttrToString
    },
    DEFAULT_PROP_CFG = {
        set : setProp,
        remove : removeProp,
        toString : attrToString
    },
    BOOLEAN_PROP_CFG = {
        set : setProp,
        remove : removeProp,
        toString : booleanAttrToString
    },
    attrsCfg = {
        autoPlay : BOOLEAN_ATTR_CFG,
        checked : BOOLEAN_PROP_CFG,
        controls : DEFAULT_PROP_CFG,
        disabled : BOOLEAN_ATTR_CFG,
        id : DEFAULT_PROP_CFG,
        ismap : BOOLEAN_ATTR_CFG,
        loop : DEFAULT_PROP_CFG,
        multiple : BOOLEAN_PROP_CFG,
        muted : DEFAULT_PROP_CFG,
        open : BOOLEAN_ATTR_CFG,
        readOnly : BOOLEAN_PROP_CFG,
        selected : BOOLEAN_PROP_CFG,
        srcDoc : DEFAULT_PROP_CFG,
        style : {
            set : setObjProp,
            remove : removeProp,
            toString : stylePropToString
        },
        value : {
            set : setPropWithCheck,
            remove : removeProp,
            toString : attrToString
        }
    };

export default function(attrName) {
    return attrsCfg[attrName] || DEFAULT_ATTR_CFG;
}
<|endoftext|>