Skip to content

Commit

Permalink
feat(angular-universal-vercel): add support for ng 17
Browse files Browse the repository at this point in the history
  • Loading branch information
damienwebdev committed Jan 29, 2024
1 parent 144f60b commit b146b4d
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 30 deletions.
15 changes: 8 additions & 7 deletions angular-universal-vercel-wflw-run/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ inputs:
artifact-zip-name:
required: false
description: 'The name of the zip file in the artifact (omit if you do not store a zip INSIDE your artifact).'
type: string
vercel-token:
reqired: true
required: true
description: "A secret representing the used Vercel Token"
type: string
vercel-org:
reqired: true
required: true
description: "A secret representing the used Vercel Organization"
type: string
vercel-project-id:
reqired: true
required: true
description: "A secret representing the used Vercel Project ID"
type: string
ng-version:
description: "Your Angular Version"
required: false
default: '16'

outputs:
url:
Expand Down Expand Up @@ -64,3 +64,4 @@ runs:
vercel_token: ${{ inputs.vercel-token }}
vercel_org: ${{ inputs.vercel-org }}
vercel_project_id: ${{ inputs.vercel-project-id }}
ng_version: ${{ inputs.ng-version }}
5 changes: 2 additions & 3 deletions angular-universal-vercel/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ RUN npm install -g vercel

WORKDIR /app

COPY vercel.json vercel.json

COPY entrypoint.sh /entrypoint.sh

COPY api api
COPY v16 /v16
COPY v17 /v17

ENTRYPOINT ["bash", "/entrypoint.sh"]
4 changes: 4 additions & 0 deletions angular-universal-vercel/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ inputs:
vercel_project_id:
description: "Your Vercel Project Id"
required: true
ng_version:
description: "Your Angular Version"
required: false
default: '16'

outputs:
url:
Expand Down
8 changes: 8 additions & 0 deletions angular-universal-vercel/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ set -e
echo "Copy workspace files to /app"
cp -R "${GITHUB_WORKSPACE}/." "/app"

echo "Copy appropriate serverless files to /api for Angular $INPUT_NG_VERSION"
if [ "$INPUT_NG_VERSION" == "17" ]
then
cp -R /v17/* /app
else
cp -R /v16/* /app
fi

echo "Switch current working directory to app"
cd "/app"

Expand Down
File renamed without changes.
20 changes: 20 additions & 0 deletions angular-universal-vercel/v16/vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"version": 2,
"public": true,
"functions": {
"api/serverless.js": {
"includeFiles": "{server/*.*,browser/{*.html,*.css},browser/**/*.json}",
"runtime": "@vercel/[email protected]"
}
},
"rewrites": [
{
"source": "/(.*[.].+)",
"destination": "/browser/$1"
},
{
"source": "/(.*)",
"destination": "api/serverless"
}
]
}
3 changes: 3 additions & 0 deletions angular-universal-vercel/v17/api/serverless.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import * as server from '../server/server.mjs';

export default server.app();
3 changes: 3 additions & 0 deletions angular-universal-vercel/v17/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "module"
}
19 changes: 19 additions & 0 deletions angular-universal-vercel/v17/vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"version": 2,
"public": true,
"functions": {
"api/serverless.js": {
"includeFiles": "{server/*.*,browser/{*.html,*.css},browser/**/*.json}"
}
},
"rewrites": [
{
"source": "/(.*[.].+)",
"destination": "/browser/$1"
},
{
"source": "/(.*)",
"destination": "api/serverless"
}
]
}
20 changes: 0 additions & 20 deletions angular-universal-vercel/vercel.json

This file was deleted.

0 comments on commit b146b4d

Please sign in to comment.