-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Mount React component in web component
- Loading branch information
Showing
15 changed files
with
303 additions
and
38 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
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,5 +1,6 @@ | ||
/node_modules | ||
/lib | ||
/docs/node_modules/ | ||
/docs/public/script.js | ||
/docs/public/script.js.map | ||
/coverage | ||
|
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,5 +1,4 @@ | ||
const { build } = require("esbuild"); | ||
const { esm, cjs } = require("./buildConfigs"); | ||
const { esm } = require("./buildConfigs"); | ||
|
||
build(esm); | ||
build(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
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,25 +1,38 @@ | ||
const esbuild = require("esbuild"); | ||
const chokidar = require("chokidar"); | ||
const liveServer = require("live-server"); | ||
const { config: devScriptBuildConfig } = require("./buildConfigs"); | ||
const { config: docsBuildConfig } = require("./buildConfigs"); | ||
const { esm: packageBuildConfig } = require("../buildConfigs"); | ||
|
||
// Update chat package entry points since this script is executing in a subdirectory | ||
const normalizedPackageBuildConfig = { | ||
...packageBuildConfig, | ||
entryPoints: ["../src/index.tsx", "../src/useChat.ts"], | ||
outdir: "../lib", | ||
outbase: "../src" | ||
}; | ||
|
||
(async () => { | ||
// Builder for the component package | ||
const packageBuilder = await esbuild.context(normalizedPackageBuildConfig); | ||
|
||
// Builder for the development page | ||
const devPageBuilder = await esbuild.context(devScriptBuildConfig); | ||
const docsPageBuilder = await esbuild.context(docsBuildConfig); | ||
|
||
chokidar | ||
// Watch for changes to dev env code or react-search src | ||
.watch(["docs/src/*.{ts,tsx,scss}", "docs/src/**/*.{ts,tsx,scss}", "src/**/*.{ts,tsx,scss}"], { | ||
// Watch for changes to docs code or react-search src | ||
.watch(["src/*.{ts,tsx,scss}", "../src/**/*.{ts,tsx,scss}"], { | ||
interval: 0 // No delay | ||
}) | ||
.on("all", () => { | ||
devPageBuilder.rebuild(); | ||
.on("all", async () => { | ||
await packageBuilder.rebuild(); | ||
docsPageBuilder.rebuild(); | ||
}); | ||
|
||
// `liveServer` local server for hot reload. | ||
liveServer.start({ | ||
open: true, | ||
port: +process.env.PORT || 8080, | ||
root: "docs/public" | ||
root: "public" | ||
}); | ||
})(); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 @@ | ||
{ | ||
"name": "docs", | ||
"version": "0.0.1", | ||
"description": "Docs page for React-Chatbot", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"docs": "node docsServer.js", | ||
"buildDocs": "node build.js" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"@vectara/react-chatbot": "file:.." | ||
} | ||
} |
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
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@import "./components/chatView.scss"; | ||
@import "./components/loader.scss"; | ||
@import "./vui/_index.scss"; |
Oops, something went wrong.