mirror of
https://github.com/rancher/rancher-docs.git
synced 2026-09-27 21:50:21 +00:00
build updates
This commit is contained in:
+28
-2
@@ -5,13 +5,15 @@ import gulp from 'gulp';
|
||||
import del from 'del';
|
||||
import runSequence from 'run-sequence';
|
||||
import gulpLoadPlugins from 'gulp-load-plugins';
|
||||
import { spawn } from "child_process";
|
||||
import { spawn, exec } from "child_process";
|
||||
import tildeImporter from 'node-sass-tilde-importer';
|
||||
import browserify from 'browserify';
|
||||
import source from 'vinyl-source-stream';
|
||||
import buffer from 'vinyl-buffer';
|
||||
import babelify from 'babelify';
|
||||
import watch from 'gulp-watch';
|
||||
const atomicalgolia = require("atomic-algolia");
|
||||
const fs = require('fs');
|
||||
|
||||
const $ = gulpLoadPlugins();
|
||||
const browserSync = require('browser-sync').create();
|
||||
@@ -166,7 +168,6 @@ gulp.task('pub-delete', () => {
|
||||
return del(['public/**', '!public']);
|
||||
});
|
||||
|
||||
|
||||
gulp.task('build:search-index', (cb) => {
|
||||
const env = process.env;
|
||||
|
||||
@@ -178,3 +179,28 @@ gulp.task('build:search-index', (cb) => {
|
||||
cb();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
gulp.task('publish:search-index', (cb) => {
|
||||
const env = process.env;
|
||||
|
||||
const opts = {
|
||||
stdio: 'inherit',
|
||||
env: env
|
||||
};
|
||||
|
||||
return exec('giddyup leader check', opts).on('close', code => {
|
||||
|
||||
if (code === 0) {
|
||||
|
||||
const rawdata = fs.readFileSync('public/final.algolia.json');
|
||||
const merged = JSON.parse(rawdata);
|
||||
atomicalgolia(process.env.ALGOLIA_INDEX_NAME, merged, (err, result) => {
|
||||
console.log(result);
|
||||
cb(err);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user