mirror of
https://github.com/rancher/rancher-docs.git
synced 2026-09-29 14:38:50 +00:00
bug fixes for releasing
This commit is contained in:
+19
-2
@@ -31,13 +31,13 @@ gulp.task('dev', ['build-dev'], () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('build', (cb) => {
|
gulp.task('build', (cb) => {
|
||||||
runSequence('pub-delete', 'sass', 'build:vendor', 'build:app', 'fonts', 'img', 'hugo', () => {
|
runSequence('pub-delete', 'sass', 'build:vendor', 'build:app', 'fonts', 'img', 'hugo', 'build:search-index', () => {
|
||||||
cb();
|
cb();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('build-staging', (cb) => {
|
gulp.task('build-staging', (cb) => {
|
||||||
runSequence('pub-delete', 'sass', 'build:vendor', 'build:app', 'fonts', 'img', 'hugo-staging', () => {
|
runSequence('pub-delete', 'sass', 'build:vendor', 'build:app', 'fonts', 'img', 'hugo-staging', 'build:search-index', () => {
|
||||||
cb();
|
cb();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -165,3 +165,20 @@ gulp.task('cms-delete', () => {
|
|||||||
gulp.task('pub-delete', () => {
|
gulp.task('pub-delete', () => {
|
||||||
return del(['public/**', '!public']);
|
return del(['public/**', '!public']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
gulp.task('build:search-index', (cb) => {
|
||||||
|
const env = process.env;
|
||||||
|
|
||||||
|
env.ALGOLIA_APP_ID = '30NEY6C9UY';
|
||||||
|
env.ALGOLIA_INDEX_NAME = isProduction ? 'prod_docs' : 'dev_docs';
|
||||||
|
env.ALGOLIA_INDEX_FILE = 'public/algolia.json';
|
||||||
|
|
||||||
|
const opts = {
|
||||||
|
stdio: 'inherit',
|
||||||
|
env: env
|
||||||
|
};
|
||||||
|
return spawn(process.cwd()+'/scripts/build-algolia.js', opts).on('close', (/* code */) => {
|
||||||
|
cb();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|||||||
@@ -9,23 +9,19 @@ const atomicalgolia = require("atomic-algolia");
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const indexName = "dev_docs"
|
const indexName = "dev_docs"
|
||||||
const nue = [];
|
const nue = [];
|
||||||
const { spawnSync } = require('child_process');
|
const rawdata = fs.readFileSync('public/algolia.json');
|
||||||
|
const nodes = JSON.parse(rawdata);
|
||||||
spawnSync('gulp', ['build'], { stdio: 'inherit' });
|
|
||||||
|
|
||||||
const rawdata = fs.readFileSync('public/algolia.json');
|
|
||||||
const nodes = JSON.parse(rawdata);
|
|
||||||
|
|
||||||
nodes.forEach(node => {
|
nodes.forEach(node => {
|
||||||
const dom = new JSDOM(node.content);
|
const dom = new JSDOM(node.content);
|
||||||
const content = dom.window.document.body; //post content wrapped in a body tag
|
const content = dom.window.document.body; //post content wrapped in a body tag
|
||||||
const contentChildren = content.children; // all the children of the body tag
|
const contentChildren = content.children; // all the children of the body tag
|
||||||
const paragraphOut = {
|
const paragraphOut = {
|
||||||
anchor: '#',
|
anchor: '#',
|
||||||
title: '',
|
title: '',
|
||||||
content: '',
|
content: '',
|
||||||
postref: node.objectID,
|
postref: node.objectID,
|
||||||
objectID: md5(node.permalink),
|
objectID: md5(node.permalink),
|
||||||
permalink: node.permalink
|
permalink: node.permalink
|
||||||
};
|
};
|
||||||
|
|
||||||
Reference in New Issue
Block a user