feat: export data into dist folder for easier debugging during dev

This commit is contained in:
Zeke Sikelianos 2018-06-21 14:07:58 -07:00
Родитель 1d592fd9e6
Коммит ffcd83b74c
9 изменённых файлов: 345478 добавлений и 5 удалений

16042
dist/apis.json поставляемый Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

23382
dist/apps.json поставляемый Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

304937
dist/packages.json поставляемый Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

1093
dist/tutorials.json поставляемый Normal file

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

1
index.js Normal file
Просмотреть файл

@ -0,0 +1 @@
module.exports = require('require-directory')(module, './dist')

Просмотреть файл

@ -6,16 +6,21 @@
"repository": "https://github.com/electron/algolia-indices",
"author": "zeke",
"license": "MIT",
"main": "index.js",
"scripts": {
"echo": "script/echo.js",
"build": "script/build.js",
"preupload": "npm run test",
"upload": "script/upload.js",
"update": "script/update.sh",
"pretest": "npm run build",
"test": "tape test.js | tap-spec && standard --fix",
"lint": "standard --fix",
"start": "budo demo.js --live --no-debug --open --css demo.css",
"repl": "local-repl"
},
"dependencies": {
"require-directory": "^2.1.1"
},
"devDependencies": {
"algoliasearch": "^3.27.1",
"budo": "^11.2.0",
@ -32,7 +37,6 @@
"lodash": "^4.17.10",
"nanohtml": "^1.2.4",
"prettier-standard": "^8.0.1",
"require-directory": "^2.1.1",
"standard": "^11.0.1",
"tap-spec": "^4.1.1",
"tape": "^4.9.0"

12
script/build.js Executable file
Просмотреть файл

@ -0,0 +1,12 @@
#!/usr/bin/env node
const fs = require('fs')
const path = require('path')
const indices = require('../indices')
Object.keys(indices).forEach(key => {
fs.writeFileSync(
path.join(__dirname, `../dist/${key}.json`),
JSON.stringify(indices[key], null, 2)
)
})

Просмотреть файл

@ -1,3 +0,0 @@
#!/usr/bin/env node
process.stdout.write(JSON.stringify(require('../indices'), null, 2))

Просмотреть файл

@ -1,8 +1,13 @@
const test = require('tape')
const isURL = require('is-url')
const indices = require('./indices')
const exportedIndices = require('.')
test('electron-search', t => {
// ensure the object exported by `require('electron-algolia-indices')`
// is the same as what we are testing in this file
t.deepEqual(indices, exportedIndices, 'exports and indices object')
// All Indices
// ----------------------------------------------------------------------
const indexNames = ['apis', 'apps', 'packages', 'tutorials']