Skip to content

Commit

Permalink
build(daffio)!: use ng17 version of vercel build (#2739)
Browse files Browse the repository at this point in the history
Previously, used webpack to bundle the serverless app together.
We no longer have to do this due to support for ng17 and esm chunks in
https://github.com/graycoreio/github-actions/tree/main/angular-universal-vercel
  • Loading branch information
damienwebdev committed Jan 29, 2024
1 parent 4c18908 commit 5097583
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 38 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
vercel_token: ${{ secrets.VERCEL_TOKEN }}
vercel_org: ${{ secrets.VERCEL_ORG }}
vercel_project_id: ${{ secrets.VERCEL_NEXT_PROJECT_ID }}
ng_version: '17'

production:
name: 'Production'
Expand All @@ -65,4 +66,5 @@ jobs:
prod: true
vercel_token: ${{ secrets.VERCEL_TOKEN }}
vercel_org: ${{ secrets.VERCEL_ORG }}
vercel_project_id: ${{ secrets.VERCEL_PROJECT_ID }}
vercel_project_id: ${{ secrets.VERCEL_PROJECT_ID }}
ng_version: '17'
1 change: 1 addition & 0 deletions .github/workflows/deploy_preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ jobs:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org: ${{ secrets.VERCEL_ORG }}
vercel-project-id: ${{ secrets.VERCEL_DAFFIO_NEXT_PROJECT_ID }}
ng-version: '17'
6 changes: 1 addition & 5 deletions apps/daffio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@
}
},
"scripts": {
"build": "npm run build:app && npm run build:serverless",
"build:app": "ng build daffio --configuration production",
"build:serverless": "npm run build:serverless:compile && npm run build:serverless:vercel",
"build:serverless:compile": "webpack-cli --config serverless/webpack.serverless.config.js",
"build:serverless:vercel": "shx cp -r ./serverless/vercel/. ../../dist/apps/daffio/",
"build": "ng build daffio --configuration production",
"test": "ng test daffio --watch=false --browsers=ChromeHeadless",
"lint": "cd ../.. && ng lint daffio",
"lint:fix": "npm run lint -- --fix",
Expand Down
17 changes: 16 additions & 1 deletion apps/daffio/server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,21 @@ function run(): void {
});
}

run();
/**
* Determine whether or not the file is the main file run via
* `node path/to/server.js`
*
* If it is, likely you're running npm run serve:ssr and you want
* to run the server locally.
*
* If it isn't, you're probably importing the module to use in a severless
* environment and that command controls running the server.
*/
const isMainModule = import.meta.url === `file://${process.argv[1]}`;

if (isMainModule) {
run();
}


export * from '../src/main.server';
3 changes: 0 additions & 3 deletions apps/daffio/serverless/serverless.js

This file was deleted.

1 change: 0 additions & 1 deletion apps/daffio/serverless/vercel/.vercelignore

This file was deleted.

27 changes: 0 additions & 27 deletions apps/daffio/serverless/webpack.serverless.config.js

This file was deleted.

0 comments on commit 5097583

Please sign in to comment.