Skip to content

Commit 929767b

Browse files
Remove code around indexing guides
1 parent 80be19c commit 929767b

File tree

8 files changed

+13
-178
lines changed

8 files changed

+13
-178
lines changed

.env.example

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
GUIDES_DOCS_PATH="../guides-app/dist/content"
21
ALGOLIA_APP_ID=""
32
ALGOLIA_ADMIN_KEY=""
43
AWS_ACCESS_KEY=""

README.md

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,11 @@
1212

1313
Use any valid AWS tokens to setup the `AWS_ACCESS_KEY` & `AWS_SECRET_KEY` to download the json api docs.
1414

15-
Once generated, use the following command to re-index algolia:
16-
`yarn start -p api`
17-
18-
### Indexing Guides
19-
20-
Guides json files are currently not stored somewhere, because they are built on demand using [broccoli-static-site-json](https://github.com/stonecircle/broccoli-static-site-json) in [guides-app](https://github.com/ember-learn/guides-app).
21-
To Generate the JSON files locally, clone [guides-app](https://github.com/ember-learn/guides-app), and run `ember build`.
22-
23-
Once generated, use the following command to re-index algolia:
24-
`yarn start -p guides`
15+
Use the following command to re-index algolia:
16+
`yarn start`
2517

2618
## .env variables
2719

28-
1. `GUIDES_DOCS_PATH` - The path to the root of the built documentation from [guides-app](https://github.com/ember-learn/guides-app)
29-
2. `ALGOLIA_APP_ID` - The Algolia application ID, found in "API Keys" section of the Algolia dashboard
30-
3. `ALGOLIA_ADMIN_KEY` - The Algolia admin key, found in "API Keys" section of the Algolia dashboard
31-
4. `AWS_ACCESS_KEY` & `AWS_SECRET_KEY` - Any valid AWS token that can be used to read our public json docs
20+
1. `ALGOLIA_APP_ID` - The Algolia application ID, found in "API Keys" section of the Algolia dashboard
21+
2. `ALGOLIA_ADMIN_KEY` - The Algolia admin key, found in "API Keys" section of the Algolia dashboard
22+
3. `AWS_ACCESS_KEY` & `AWS_SECRET_KEY` - Any valid AWS token that can be used to read our public json docs

index.js

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@ require = require('esm')(module)
22
const program = require('commander')
33

44
const { version, description } = require('./package.json')
5-
const { run: runGuides } = require('./lib/guides')
6-
const { run: runApi } = require('./lib/api')
5+
const { runApi } = require('./lib/api')
76

87
program
98
.version(version, '-v, --version')
109
.description(description)
11-
.option('-p, --project <project>', 'Project name. Accepts "api" or "guides"')
1210
.option(
1311
'-c, --clear-index',
1412
'Whether indexes of the project should be cleared while processing'
@@ -18,20 +16,12 @@ program
1816
program.on('--help', function() {
1917
console.log(`
2018
Examples:
21-
$ yarn start -p api
22-
$ yarn start -p guides
19+
$ yarn start
20+
$ yarn start -j # to write to fs
21+
$ yarn start -c # Clear indexes before populating content
2322
`)
2423
})
2524

2625
program.parse(process.argv)
2726

28-
switch (program.project) {
29-
case 'guides':
30-
runGuides(program.clearIndex, program.jsonDriver)
31-
break
32-
case 'api':
33-
runApi(program.clearIndex, program.jsonDriver)
34-
break
35-
default:
36-
throw new Error('Invalid --project property')
37-
}
27+
runApi(program.clearIndex, program.jsonDriver)

lib/api.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import schemas from './schemas'
1010

1111
const apiIndexes = ['modules', 'classes', 'methods', 'versions']
1212

13-
export async function run(clearIndex = false, useJsonDriver = false) {
13+
export async function runApi(clearIndex = false, useJsonDriver = false) {
1414
let driver = useJsonDriver ? jsonDriver : algoliaDriver
1515

1616
apiIndexes.map(driver.init)

lib/drivers/json.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,7 @@ const outputFolder = './drivers-output'
1313
function init(indexName) {}
1414

1515
function write(indexName, content, projectName, version) {
16-
let fileName = `${outputFolder}/json/`
17-
18-
if (projectName) {
19-
fileName += `${projectName}/`
20-
}
16+
let fileName = `${outputFolder}/json/${projectName}/`
2117

2218
if (version) {
2319
fileName += `${version}/${indexName}.json`

lib/guides.js

Lines changed: 0 additions & 114 deletions
This file was deleted.

lib/schemas/guideItem.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

lib/schemas/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import classSchema from './class'
22
import moduleSchema from './module'
33
import methodSchema from './method'
4-
import guideItemSchema from './guideItem'
54

6-
export default { moduleSchema, classSchema, methodSchema, guideItemSchema }
5+
export default { moduleSchema, classSchema, methodSchema }

0 commit comments

Comments
 (0)