-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #829 from IgniteUI/dpetev/schematics-workspace-api
refator schematics workspace api
- Loading branch information
Showing
21 changed files
with
212 additions
and
284 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
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,23 +1,23 @@ | ||
// tslint:disable:no-implicit-dependencies | ||
import { workspaces } from "@angular-devkit/core"; | ||
import { Rule, SchematicContext, Tree } from "@angular-devkit/schematics"; | ||
// tslint:disable-next-line:no-submodule-imports | ||
import { getWorkspace } from "@schematics/angular/utility/config"; | ||
import { createWorkspaceHost } from "@igniteui/cli-core"; | ||
|
||
export default function(): Rule { | ||
return (host: Tree, context: SchematicContext) => { | ||
const workspace = getWorkspace(host); | ||
const project = workspace.defaultProject ? | ||
workspace.projects[workspace.defaultProject] : | ||
workspace.projects[0]; | ||
return async (tree: Tree, context: SchematicContext) => { | ||
const { workspace } = await workspaces.readWorkspace("/", createWorkspaceHost(tree)); | ||
const project = workspace.extensions.defaultProject ? | ||
workspace.projects.get(workspace.extensions.defaultProject as string) : | ||
workspace.projects.values().next().value as workspaces.ProjectDefinition; | ||
|
||
const errorService = `${project.sourceRoot}/${project.prefix}/error-routing/error/global-error-handler.service.ts`; | ||
|
||
context.logger.info(`Applying migration for Ignite UI CLI 5.0.3`); | ||
|
||
if (host.exists(errorService)) { | ||
let fileContents = host.read(errorService).toString(); | ||
if (tree.exists(errorService)) { | ||
let fileContents = tree.read(errorService).toString(); | ||
fileContents = fileContents.replace("throw error;", "console.error(error);"); | ||
host.overwrite(errorService, fileContents); | ||
tree.overwrite(errorService, fileContents); | ||
} | ||
}; | ||
} |
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
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.