How to use gulp-json-editor - 10 common examples

To help you get started, we’ve selected a few gulp-json-editor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kevoj / nodetomic-api-swagger / gulpfile.babel.js View on Github external
gulp.task('build-replace', () => {
  // Copy file config dev or production 
  const conf = process.argv[3] ? 'index' : 'production';
  // Copy config production
  gulp.src([`src/config/${conf}.js`]).pipe(babel()).pipe(rename('index.js')).pipe(gulp.dest(`${dist_server}/config`));
  // Copy views
  gulp.src(['src/views/**/*.*', '!src/views/**/*.js']).pipe(minify({ minify: true, collapseWhitespace: true, conservativeCollapse: true, minifyCSS: true })).pipe(gulp.dest(`${dist_server}/views`));
  // Copy assets
  gulp.src(['src/assets/**/*']).pipe(gulp.dest(`${dist_server}/assets`));
  // Copy *.yaml
  gulp.src(['src/**/*.yaml']).pipe(gulp.dest(dist_server));
  // Copy swagger/ui
  gulp.src([`src/lib/swagger/ui/*`]).pipe(gulp.dest(dist_swagger));
  // package.json
  gulp.src("package.json").pipe(jeditor((json) => {
    delete json.devDependencies;
    json.scripts = {
      "start": `node server/app.js`,
      "simple": `npm stop && pm2 start ${pm2_simple} --env production`,
      "cluster": `npm stop && pm2 start ${pm2_cluster} --env production`,
      "stop": `pm2 delete ${pm2_simple} ${pm2_cluster}`
    };
    return json;
  })).pipe(gulp.dest(dist));
  // Copy pm2 files
  gulp.src([pm2_simple, pm2_cluster]).pipe(gulp.dest(dist));
  // If exits client folder, then copy current client
  if (fs.existsSync(`${dist}/client`)) {
    gulp.src(['client/**/*']).pipe(gulp.dest(dist_client));
  } else {
    // If not exists client folder, then copy default client
github youzan / create-utils / packages / utils-scripts / src / tasks / publish.js View on Github external
function publishGit() {
  return merge(
    gulp.src('package.json').pipe(jsonEditor((json) => {
      const name = { name: `${json.name}${config.target.prefix ? ('-' + config.target.prefix) : ''}`}
      return Object.assign({}, json, config.target.packageRewrite, ...name);
    })),
    gulp.src([config.base.dist + '/**', ...config.base.static]),
  ).pipe(
    ghPages({
      branch: config.target.branch,
      cacheDir: config.base.publishCache,
      push: true,
    }),
  );
}
github meedan / check-web / gulpfile.babel.js View on Github external
gulp.task('transifex:prepare', () => {
  if (transifexClient) {
    gulp.src('./localization/react-intl/**/*').pipe(jsonEditor((inputJson) => {
      const outputJson = {};
      inputJson.forEach((entry) => {
        outputJson[entry.id] = entry.defaultMessage;
      });
      return outputJson;
    })).pipe(gulp.dest('./localization/transifex/'));
  }
});
github acierto / gulp-release / lib / registries / BumpRegistry.js View on Github external
}, () => {
                takerInst.src(variables.paths.versionsToBump, variables.srcConfig)
                    .pipe(jeditor({version: newVersion}))
                    .pipe(takerInst.dest('./', {cwd: variables.rootDir}));
                return commitIt(takerInst, newVersion, this.store, resolve);
            });
        }));
github airgram / airgram / gulpfile.ts View on Github external
public packagePreparePackageFile (): NodeJS.ReadWriteStream {
    return gulp
      .src('./package.json')
      .pipe(jsonEditor((json: Record) => {
        const dependencies: Record | undefined = json.dependencies
        const peerDependencies: Record | undefined = json.peerDependencies
        json.private = false
        json.sideEffects = false
        json.main = 'index.js'
        json.types = 'index.d.ts'
        json.author = pkg.author
        json.homepage = pkg.homepage
        json.repository = pkg.repository

        if (dependencies) {
          json.dependencies = Object.keys(dependencies).reduce>((obj, name) => {
            if (name in packages) {
              obj[name] = '^' + (packages as any)[name].version
            }
            return obj
github IceEnd / Yosoro / config / gulp.babel.js View on Github external
const copyMainResource = () => {
  const resource = src(path.join(__dirname, '../app/main/resource/**'))
    .pipe(dest(path.join(__dirname, '../lib/resource')));
  const pkg = src(path.join(__dirname, '../package.json'))
    .pipe(jeditor({
      main: './main.js',
    }))
    .pipe(dest(path.join(__dirname, '../lib')));
  const license = src(path.join(__dirname, '../LICENSE'))
    .pipe(dest(path.join(__dirname, '../lib')));
  const assets = src(path.join(__dirname, ('../assets/**')))
    .pipe(dest(path.join(__dirname, '../lib/assets')));
  return merge(
    resource,
    pkg,
    license,
    assets,
  );
};
copyMainResource.displayName = 'after:buildMain';
github StreetSupport / streetsupport-web / tasks / getLongTermData.js View on Github external
gulp.task('need-categories', (callback) => {
  return request(endpoints.needCategories)
    .pipe(source(`${config.paths.generatedData}need-categories.js`))
    .pipe(streamify(jeditor(function (data) {
      return data
        .sortAsc('value')
    })))
    .pipe(replace('[', 'export const categories = ['))
    .pipe(gulp.dest('./'))
})
github marvinroger / homie-server / gulpfile.babel.js View on Github external
gulp.task('dist:copypkg', function () {
  let txt = gulp.src(['./README.md', './LICENSE'])
    .pipe(plumber(errorHandler('dist:copypkg (txt)')))
    .pipe(gulp.dest('./dist'));

  let pkg = gulp.src('./package.json')
    .pipe(jsoneditor(function (json) {
      delete json.scripts;
      delete json.devDependencies;
      delete json.semistandard;
      return json;
    }))
    .pipe(plumber(errorHandler('dist:copypkg (pkg)')))
    .pipe(gulp.dest('./dist'));

  return merge(txt, pkg);
});
github mthamil / Tab-Wheel-Scroll / gulpfile.babel.js View on Github external
export const version = () =>
    gulp.src(`${config.in}package.json`, { base: `${config.in}` })
        .pipe(jeditor({
            "version": `${moment.utc().format("YYYYMMDD.H.m")}`
        }))
        .pipe(gulp.dest(config.out));
github TIBCOSoftware / tci-flogo / tools / gulpfile.babel.js View on Github external
gulp.task("copy-package", callback => {
    return gulp.src("./package.json")
        .pipe(jeditor((pkgjson) => {
            delete pkgjson.scripts.sdk;
            return pkgjson;
        }))
        .pipe(gulp.dest("./dist"));
});

gulp-json-editor

A gulp plugin to edit JSON objects

MIT
Latest version published 1 year ago

Package Health Score

64 / 100
Full package analysis

Popular gulp-json-editor functions