File tree Expand file tree Collapse file tree 6 files changed +63
-6
lines changed Expand file tree Collapse file tree 6 files changed +63
-6
lines changed Original file line number Diff line number Diff line change 88 "clientinstall" : " npm install --prefix client" ,
99 "server" : " tsx index.ts" ,
1010 "start" : " concurrently \" npm run server\" \" npm run client\" " ,
11- "build" : " vite build" ,
12- "build-ts" : " tsc" ,
11+ "build" : " npm run build-ui && npm run build-lib" ,
12+ "build-ui" : " vite build" ,
13+ "build-lib" : " ./scripts/build-for-publish.sh" ,
14+ "restore-lib" : " ./scripts/undo-build.sh" ,
15+ "check-types" : " tsc" ,
1316 "test" : " NODE_ENV=test ts-mocha './test/*.js' --exit" ,
1417 "test-coverage" : " nyc npm run test" ,
1518 "test-coverage-ci" : " nyc --reporter=lcovonly --reporter=text npm run test" ,
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -euxo pipefail
3+
4+ # This script allows for emitting js and definitions from the typescript into
5+ # the same import locations as the original files.
6+ # When we adjust how we import the library we can move to a "dist" folder and
7+ # explicit "exports".
8+
9+ REPO_ROOT=" $( git rev-parse --show-toplevel) "
10+ cd " $REPO_ROOT "
11+
12+ rm -rf dist || true
13+ tsc --project tsconfig.publish.json
14+ # replace tsx with node for the new index.js
15+ sed -ie ' 1s/tsx/node/' dist/index.js
16+ # ensure it's executable
17+ chmod +x dist/index.js
18+ # move the ts source
19+ mv src src-old
20+ # move the built source
21+ mv dist/src dist/index.js dist/index.d.ts .
22+ # copy back unchanged ui code
23+ # could probably drop this as the ui code shouldn't really be imported from
24+ # the main package but keep for compat until split out.
25+ mv src-old/ui src/ui
26+ rm -rf src-old index.ts dist
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -euxo pipefail
3+
4+ # Undo what was done by build-for-publish.sh in the event this was ran locally
5+
6+ REPO_ROOT=" $( git rev-parse --show-toplevel) "
7+ cd " $REPO_ROOT "
8+
9+ rm -rf dist index.js index.d.ts || true
10+ git checkout src index.ts
11+ git clean -f src
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ const options = {
2727 cert : getTLSEnabled ( ) ? fs . readFileSync ( getTLSCertPemPath ( ) ) : undefined ,
2828} ;
2929
30- const proxyPreparations = async ( ) => {
30+ export const proxyPreparations = async ( ) => {
3131 const plugins = getPlugins ( ) ;
3232 const pluginLoader = new PluginLoader ( plugins ) ;
3333 await pluginLoader . load ( ) ;
@@ -47,15 +47,15 @@ const proxyPreparations = async () => {
4747} ;
4848
4949// just keep this async incase it needs async stuff in the future
50- const createApp = async ( ) => {
50+ export const createApp = async ( ) => {
5151 const app = express ( ) ;
5252 // Setup the proxy middleware
5353 app . use ( bodyParser . raw ( options ) ) ;
5454 app . use ( '/' , router ) ;
5555 return app ;
5656} ;
5757
58- const start = async ( ) => {
58+ export const start = async ( ) => {
5959 const app = await createApp ( ) ;
6060 await proxyPreparations ( ) ;
6161 http . createServer ( options as any , app ) . listen ( proxyHttpPort , ( ) => {
Original file line number Diff line number Diff line change 88 "moduleResolution" : " Node" ,
99 "strict" : true ,
1010 "noEmit" : true ,
11+ "declaration" : true ,
1112 "skipLibCheck" : true ,
1213 "isolatedModules" : true ,
1314 "module" : " CommonJS" ,
1415 "esModuleInterop" : true ,
1516 "allowSyntheticDefaultImports" : true ,
1617 "resolveJsonModule" : true
1718 },
18- "include" : [" src" ]
19+ "include" : [" ." ],
20+ "exclude" : [" experimental/**" , " plugins/**" ]
1921}
Original file line number Diff line number Diff line change 1+ {
2+ "extends" : " ./tsconfig.json" ,
3+ "compilerOptions" : {
4+ "noEmit" : false ,
5+ "outDir" : " ./dist"
6+ },
7+ "exclude" : [
8+ " experimental/**" ,
9+ " plugins/**" ,
10+ " ./dist/**" ,
11+ " ./src/ui" ,
12+ " ./src/**/*.jsx" ,
13+ " ./src/context.js"
14+ ]
15+ }
You can’t perform that action at this time.
0 commit comments