File tree Expand file tree Collapse file tree 9 files changed +78
-8
lines changed Expand file tree Collapse file tree 9 files changed +78
-8
lines changed Original file line number Diff line number Diff line change 60
60
# if: ${{ steps.test.outputs.exit_code }} != 0
61
61
# run: exit ${{ steps.test.outputs.exit_code }}
62
62
63
- - name : Build application
64
- run : npm run build
63
+ - name : Build frontend
64
+ run : npm run build-ui
65
65
66
66
- name : Save build folder
67
67
uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
Original file line number Diff line number Diff line change 22
22
registry-url : ' https://registry.npmjs.org'
23
23
- run : npm ci
24
24
- run : npm run build
25
+ env :
26
+ IS_PUBLISHING : ' YES'
25
27
- run : npm publish --access=public
26
28
env :
27
29
NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
Original file line number Diff line number Diff line change 1
1
# This file required to override .gitignore when publishing to npm
2
2
website /
3
3
plugins /
4
+ experimental /
5
+ cypress /
Original file line number Diff line number Diff line change 8
8
"clientinstall" : " npm install --prefix client" ,
9
9
"server" : " tsx index.ts" ,
10
10
"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" ,
13
16
"test" : " NODE_ENV=test ts-mocha './test/*.js' --exit" ,
14
17
"test-coverage" : " nyc npm run test" ,
15
18
"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 -euo 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
+ if [ " ${IS_PUBLISHING:- } " != " YES" ]; then
10
+ echo " This script is intended to prepare the directory for publishing"
11
+ echo " and replaces files. If you only want to build the UI run \` npm run build-ui\` ."
12
+ echo " Otherwise set IS_PUBLISHING to \" YES\" "
13
+ exit 1
14
+ fi
15
+
16
+ set -x
17
+
18
+ REPO_ROOT=" $( git rev-parse --show-toplevel) "
19
+ cd " $REPO_ROOT "
20
+
21
+ rm -rf dist || true
22
+ tsc --project tsconfig.publish.json
23
+ # replace tsx with node for the new index.js
24
+ sed -ie ' 1s/tsx/node/' dist/index.js
25
+ # ensure it's executable
26
+ chmod +x dist/index.js
27
+ # move the ts source
28
+ mv src src-old
29
+ # move the built source
30
+ mv dist/src dist/index.js dist/index.d.ts .
31
+ # copy back unchanged ui code
32
+ # could probably drop this as the ui code shouldn't really be imported from
33
+ # the main package but keep for compat until split out.
34
+ mv src-old/ui src/ui
35
+ 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 = {
27
27
cert : getTLSEnabled ( ) ? fs . readFileSync ( getTLSCertPemPath ( ) ) : undefined ,
28
28
} ;
29
29
30
- const proxyPreparations = async ( ) => {
30
+ export const proxyPreparations = async ( ) => {
31
31
const plugins = getPlugins ( ) ;
32
32
const pluginLoader = new PluginLoader ( plugins ) ;
33
33
await pluginLoader . load ( ) ;
@@ -47,15 +47,15 @@ const proxyPreparations = async () => {
47
47
} ;
48
48
49
49
// just keep this async incase it needs async stuff in the future
50
- const createApp = async ( ) => {
50
+ export const createApp = async ( ) => {
51
51
const app = express ( ) ;
52
52
// Setup the proxy middleware
53
53
app . use ( bodyParser . raw ( options ) ) ;
54
54
app . use ( '/' , router ) ;
55
55
return app ;
56
56
} ;
57
57
58
- const start = async ( ) => {
58
+ export const start = async ( ) => {
59
59
const app = await createApp ( ) ;
60
60
await proxyPreparations ( ) ;
61
61
http . createServer ( options as any , app ) . listen ( proxyHttpPort , ( ) => {
Original file line number Diff line number Diff line change 8
8
"moduleResolution" : " Node" ,
9
9
"strict" : true ,
10
10
"noEmit" : true ,
11
+ "declaration" : true ,
11
12
"skipLibCheck" : true ,
12
13
"isolatedModules" : true ,
13
14
"module" : " CommonJS" ,
14
15
"esModuleInterop" : true ,
15
16
"allowSyntheticDefaultImports" : true ,
16
17
"resolveJsonModule" : true
17
18
},
18
- "include" : [" src" ]
19
+ "include" : [" ." ],
20
+ "exclude" : [" experimental/**" , " plugins/**" ]
19
21
}
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