diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..8a314f81 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,44 @@ +name: Build + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + client: + name: Client (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + + strategy: + matrix: + node-version: + - 20.x + os: + - ubuntu-20.04 + - windows-2019 + include: + - os: ubuntu-20.04 + script: build-release-linux + - os: windows-2019 + script: build-release + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + + - name: Install dependencies + working-directory: client + run: npm ci + + - name: Build + working-directory: client + run: npm run ${{ matrix.script }} diff --git a/client/copy.sh b/client/copy.sh new file mode 100755 index 00000000..b809b1fc --- /dev/null +++ b/client/copy.sh @@ -0,0 +1,4 @@ +cp ./node_modules/leaflet/dist/leaflet.css ./public/stylesheets/leaflet/leaflet.css +cp ./node_modules/leaflet-gesture-handling/dist/leaflet-gesture-handling.css ./public/stylesheets/leaflet/leaflet-gesture-handling.css +cp ./node_modules/leaflet.nauticscale/dist/leaflet.nauticscale.js ./public/javascripts/leaflet.nauticscale.js +cp ./node_modules/leaflet-path-drag/dist/L.Path.Drag.js ./public/javascripts/L.Path.Drag.js diff --git a/client/package.json b/client/package.json index 4e1de078..da597c07 100644 --- a/client/package.json +++ b/client/package.json @@ -7,6 +7,7 @@ "scripts": { "build": "browserify .\\src\\index.ts --debug -o .\\public\\javascripts\\bundle.js -t [ babelify --global true --presets [ @babel/preset-env ] --extensions '.js'] -p [ tsify --noImplicitAny ] && copy.bat", "build-release": "browserify .\\src\\index.ts -o .\\public\\javascripts\\bundle.js -t [ babelify --global true --presets [ @babel/preset-env ] --extensions '.js'] -p [ tsify --noImplicitAny ] && copy.bat", + "build-release-linux": "browserify ./src/index.ts -o ./public/javascripts/bundle.js -t [ babelify --global true --presets [ @babel/preset-env ] --extensions '.js'] -p [ tsify --noImplicitAny ] && ./copy.sh", "emit-declarations": "tsc --project tsconfig.json --declaration --emitDeclarationOnly --outfile ./@types/olympus/index.d.ts", "copy": "copy.bat", "start": "node ./bin/www",