Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved build commands from main.sh to npm scripts #3173

Merged
merged 1 commit into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions generator/build/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,5 @@ export LC_ALL=C.UTF-8
echo "+ bash -x ./_scripts/_run_jekyll.sh $BRANCH || exit 6"
bash -x ./_scripts/_run_jekyll.sh $BRANCH || exit 6

cd $WRKDIR/documentation/generator/build/search
$(which npm) i
$(which node) createIndex.js
cp -rf ./searchIndex ./../../_site/assets/
npm ci --prefix $WRKDIR/documentation/generator/_assets/styles
cd $WRKDIR/documentation/generator
npm ci
node_modules/.bin/webpack-cli --config webpack.config.js --mode production
npm run build
6 changes: 3 additions & 3 deletions generator/build/search/createIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const FlexSearch = require("flexsearch");
const fs = require('fs');
const {readdir} = require('fs').promises;

const htmlFilesDir = '../../_site';
const htmlFilesDir = `${__dirname}/../../_site`;

String.prototype.stripHtmlTags = function () {
return this.replace(/<\/?[^>]+(>|$)/g, " ");
Expand Down Expand Up @@ -63,13 +63,13 @@ const getHtmlFiles = async (dir) =>
breadCrumbs = breadCrumbsMatch[0].replace(/\s\s+/g, ' ').replace(/\n/g, " ");
}

fs.writeFileSync(`searchIndex/documents/${key}.json`, JSON.stringify({
fs.writeFileSync(`${__dirname}/searchIndex/documents/${key}.json`, JSON.stringify({
...document,
uri: (htmlFiles[key]),
breadCrumbs
}));
index.add(document)
}

index.export((key, data) => fs.writeFileSync(`searchIndex/${key}.json`, data || ''));
index.export((key, data) => fs.writeFileSync(`${__dirname}/searchIndex/${key}.json`, data || ''));
})();
Loading
Loading