-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for debug option, change details structure, bump to 2.0.0 (…
…#11) * Adds support for debug option. * Adds a docs script so we can test and experiment locally. * Refactors the types to prefer undefined over null, to simplify the conditions the consumer must consider. * Changes the details structure (breaking change that bumps the major to 2.0.0) so that it's easier to consume. * Surfaces summary.prompt and chat.rephrasedQuery in debug response. * Adds unit tests using msw. Exports createStreamingServer as part of the module's interface so consumers can use it in their tests.
- Loading branch information
Showing
23 changed files
with
16,945 additions
and
387 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
module.exports = { | ||
extends: [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"prettier", | ||
], | ||
parser: "@typescript-eslint/parser", | ||
plugins: ["@typescript-eslint"], | ||
root: true, | ||
ignorePatterns: [ | ||
".eslintrc.js", | ||
"jest.config.js", | ||
"build.js", | ||
"buildConfigs.js", | ||
"docs/build.js", | ||
"docs/buildConfigs.js", | ||
"docs/docsServer.js", | ||
"docs/public/", | ||
"lib/", | ||
], | ||
rules: { | ||
"@typescript-eslint/no-unused-vars": "error", | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
/node_modules | ||
/coverage | ||
/docs/node_modules/ | ||
/docs/public/script.js | ||
/docs/public/script.js.map | ||
/lib | ||
|
||
/node_modules | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,9 @@ | ||
const { build } = require("esbuild"); | ||
const { devDependencies } = require("./package.json"); | ||
const config = require("./buildConfig"); | ||
|
||
build({ | ||
bundle: true, | ||
...config, | ||
entryPoints: ["src/index.ts"], | ||
logLevel: "info", | ||
treeShaking: true, | ||
minify: true, | ||
|
||
// Removing source maps theoretically shaves around 100kb of the package size. | ||
// Initially setting this to false and will verify the npm package size. | ||
sourcemap: false, | ||
external: [...Object.keys(devDependencies)], | ||
target: ["esnext", "node12.22.0"], | ||
outdir: "./lib", | ||
outbase: "./src", | ||
format: "cjs", | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const { devDependencies } = require("./package.json"); | ||
|
||
module.exports = { | ||
bundle: true, | ||
logLevel: "info", | ||
treeShaking: true, | ||
minify: true, | ||
|
||
// Removing source maps theoretically shaves around 100kb of the package size. | ||
// Initially setting this to false and will verify the npm package size. | ||
sourcemap: false, | ||
external: [...Object.keys(devDependencies)], | ||
target: ["esnext", "node12.22.0"], | ||
format: "cjs", | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
const { build } = require("esbuild"); | ||
const { config } = require("./buildConfigs"); | ||
|
||
build(config); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module.exports = { | ||
config: { | ||
bundle: true, | ||
define: { | ||
"process.env.NODE_ENV": JSON.stringify( | ||
process.env.NODE_ENV || "development" | ||
), | ||
}, | ||
entryPoints: ["src/index.tsx"], | ||
outfile: "public/script.js", | ||
sourcemap: false, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const esbuild = require("esbuild"); | ||
const chokidar = require("chokidar"); | ||
const liveServer = require("live-server"); | ||
const buildConfig = require("../buildConfig"); | ||
const { config: devScriptBuildConfig } = require("./buildConfigs"); | ||
|
||
(async () => { | ||
// Builder for the component package | ||
const packageBuilder = await esbuild.context({ | ||
...buildConfig, | ||
entryPoints: ["../src/index.ts"], | ||
outdir: "../lib", | ||
outbase: "../src", | ||
}); | ||
|
||
// Builder for the development page | ||
const devPageBuilder = await esbuild.context(devScriptBuildConfig); | ||
|
||
chokidar | ||
// Watch for changes to dev env code or react-search src | ||
.watch(["src/*.{ts,tsx}", "src/**/*.{ts,tsx}", "../src/**/*.{ts,tsx}"], { | ||
interval: 0, // No delay | ||
}) | ||
.on("all", async () => { | ||
await packageBuilder.rebuild(); | ||
devPageBuilder.rebuild(); | ||
}); | ||
|
||
// `liveServer` local server for hot reload. | ||
liveServer.start({ | ||
open: true, | ||
port: +process.env.PORT || 8080, | ||
root: "public", | ||
}); | ||
})(); |
Oops, something went wrong.