Skip to content

Commit

Permalink
Allow Angular 18
Browse files Browse the repository at this point in the history
  • Loading branch information
PowerKiKi committed May 26, 2024
1 parent 1be259a commit 29b9fdc
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .changeset/light-pears-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'apollo-angular': patch
---

Allow Angular 18
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
angular_version: [17]
angular_version: [17, 18]
graphql_version: [15, 16]
node_version: [18]
node_version: [18, 20]
steps:
- name: Use Node.js ${{ matrix.node_version }}
uses: actions/setup-node@master
Expand Down
2 changes: 1 addition & 1 deletion packages/apollo-angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"test": "NODE_OPTIONS=--experimental-modules jest --config jest.config.js"
},
"peerDependencies": {
"@angular/core": "^17.0.0",
"@angular/core": "^17.0.0 || ^18.0.0",
"@apollo/client": "^3.0.0",
"graphql": "^15.0.0 || ^16.0.0",
"rxjs": "^6.0.0 || ^7.0.0"
Expand Down
11 changes: 4 additions & 7 deletions packages/apollo-angular/schematics/utils/ast.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as ts from 'typescript';
import { SchematicsException, Tree } from '@angular-devkit/schematics';
import { addFunctionalProvidersToStandaloneBootstrap } from '@schematics/angular/private/components';
import { addRootProvider } from '@schematics/angular/utility';
import { Change, InsertChange } from '@schematics/angular/utility/change';
import { getAppModulePath, isStandaloneApp } from '@schematics/angular/utility/ng-ast-utils';
import { getMainFilePath } from '@schematics/angular/utility/standalone/util';
Expand All @@ -21,12 +21,9 @@ export async function addModuleImportToRootModule(
) {
const mainPath = await getMainFilePath(host, projectName);
if (isStandaloneApp(host, mainPath)) {
addFunctionalProvidersToStandaloneBootstrap(
host,
mainPath,
importedModuleName,
importedModulePath,
);
addRootProvider(projectName, ({ code, external }) => {
return code`${external(importedModuleName, importedModulePath)}()`;
});
} else {
const appModulePath = getAppModulePath(host, mainPath);
addModuleImportToModule(host, appModulePath, importedModuleName, importedModulePath);
Expand Down

0 comments on commit 29b9fdc

Please sign in to comment.