-
Notifications
You must be signed in to change notification settings - Fork 405
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into fix/features-last
- Loading branch information
Showing
31 changed files
with
669 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export { NgxsTestBed } from './ngxs.setup'; | ||
export { NgxsTesting } from './symbol'; | ||
export { freshPlatform } from './fresh-platform'; | ||
export { NgxsTestBed } from './ngxs.setup'; | ||
export { skipConsoleLogging } from './skip-console-logging'; | ||
export { NgxsTesting } from './symbol'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './schematics'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing'; | ||
import { workspaceRoot } from '@nrwl/devkit'; | ||
import { Schema as ApplicationOptions } from '@schematics/angular/application/schema'; | ||
import { Schema as WorkspaceOptions } from '@schematics/angular/workspace/schema'; | ||
import * as path from 'path'; | ||
|
||
const angularSchematicRunner = new SchematicTestRunner( | ||
'@schematics/angular', | ||
path.join(workspaceRoot, 'node_modules/@schematics/angular/collection.json') | ||
); | ||
|
||
const defaultWorkspaceOptions: WorkspaceOptions = { | ||
name: 'workspace', | ||
newProjectRoot: 'projects', | ||
version: '1.0.0' | ||
}; | ||
|
||
const defaultAppOptions: ApplicationOptions = { | ||
name: 'foo', | ||
inlineStyle: false, | ||
inlineTemplate: false, | ||
routing: true, | ||
skipTests: false, | ||
skipPackageJson: false | ||
}; | ||
|
||
export async function createWorkspace( | ||
isStandalone = false, | ||
schematicRunner = angularSchematicRunner, | ||
workspaceOptions = defaultWorkspaceOptions, | ||
appOptions = defaultAppOptions | ||
) { | ||
let appTree: UnitTestTree = await schematicRunner.runSchematic( | ||
'workspace', | ||
workspaceOptions | ||
); | ||
appTree = await schematicRunner.runSchematic('application', appOptions, appTree); | ||
|
||
isStandalone && updateToStandalone(appTree, workspaceOptions, appOptions); | ||
|
||
return appTree; | ||
} | ||
|
||
// Note: This is a workaround to convert the application as standalone. Should be removed when migrating to NG17 | ||
function updateToStandalone( | ||
appTree: UnitTestTree, | ||
workspaceOptions: WorkspaceOptions, | ||
appOptions: ApplicationOptions | ||
) { | ||
const mainTsContent = ` | ||
import { | ||
bootstrapApplication, | ||
} from '@angular/platform-browser'; | ||
import { AppComponent } from './app/app.component'; | ||
bootstrapApplication(AppComponent).catch((err) => | ||
console.error(err), | ||
); | ||
`; | ||
|
||
const appComponentContent = ` | ||
import { Component } from '@angular/core'; | ||
@Component({ | ||
selector: 'app-root', | ||
standalone: true, | ||
templateUrl: './app.component.html', | ||
styleUrls: ['./app.component.scss'], | ||
}) | ||
export class AppComponent {} | ||
`; | ||
|
||
const projectPath = `/${workspaceOptions.newProjectRoot}/${appOptions.name}`; | ||
appTree.overwrite(`${projectPath}/src/main.ts`, mainTsContent); | ||
appTree.overwrite(`${projectPath}/src/app/app.component.ts`, appComponentContent); | ||
appTree.delete(`${projectPath}/src/app/app.module.ts`); | ||
} |
184 changes: 117 additions & 67 deletions
184
packages/store/schematics/src/ng-add/ng-add.factory.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.