Moved algolia indexing to utils

This commit is contained in:
Piotr Janosz
2019-08-01 19:44:30 +02:00
committed by fabioberger
parent f09d56cdb9
commit b3e6e23508
3 changed files with 3 additions and 4 deletions

View File

@@ -17,7 +17,7 @@
"deploy_dogfood": "npm run build:prod; aws s3 sync ./public/. s3://dogfood.0xproject.com --profile 0xproject --region us-east-1 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers",
"deploy_staging": "npm run build:prod; aws s3 sync ./public/. s3://staging-0xproject --profile 0xproject --region us-east-1 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers",
"deploy_live": "DEPLOY_ROLLBAR_SOURCEMAPS=true npm run build:prod; aws s3 sync ./public/. s3://0x.org --profile 0xproject --region us-east-1 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --exclude *.map.js",
"index_docs": "npx ts-node -O '{\"module\": \"commonjs\"}' mdx/algolia_index.ts"
"index_docs": "npx ts-node -O '{\"module\": \"commonjs\"}' ts/utils/algolia_index.ts"
},
"author": "Fabio Berger",
"license": "Apache-2.0",

View File

@@ -107,7 +107,7 @@ async function processMdxAsync(
}
export async function indexFilesAsync(index: any, dirName: string, settings: Settings): Promise<void> {
const dirPath = `${__dirname}/${dirName}`;
const dirPath = path.join(__dirname, `../../mdx/${dirName}`);
fs.readdir(dirPath, async (err: string, items: string[]) => {
for (const fileName of items) {

View File

@@ -1,6 +1,5 @@
import { adminClient, searchIndices, settings } from '../ts/utils/algolia_search';
import { indexFilesAsync } from './algolia_helpers';
import { adminClient, searchIndices, settings } from './algolia_search';
// Get args (index names - i.e. guides) after command (i.e. ts-node) and path to file (i.e. ./index.ts)
const args = process.argv.slice(2);