Skip to content

import local @angular-devkit/schematics #3024

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

rdlabo
Copy link
Contributor

@rdlabo rdlabo commented Mar 23, 2018

This commit is update by 8a83c6b .

use Function importAppScripts.

@imhoffd
Copy link
Contributor

imhoffd commented Mar 23, 2018

Sorry, with my comment I was trying to give you an example of a function that has one parameter, the project directory (local), and then uses that to configure resolve to look for the module in the local node_modules.

app-scripts.ts and importAppScripts refers to @ionic/app-scripts, but we'll be importing two modules of the @angular-devkit/schematics package.

@@ -0,0 +1,8 @@
import { compileNodeModulesPaths, resolve } from '@ionic/cli-framework/utils/npm';

export async function importAppScripts(projectDir: string): Promise<any> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Define two functions, one for importing @angular-devkit/schematics and one for @angular-devkit/schematics/tools.

@@ -208,8 +209,8 @@ ${chalk.cyan('[1]')}: ${chalk.bold('https://ionicframework.com/docs/cli/projects
private async getSchematics(): Promise<Schematic[]> {
if (!this.schematics) {
try {
const { SchematicEngine } = await import('@angular-devkit/schematics');
const { NodeModulesEngineHost } = await import('@angular-devkit/schematics/tools');
const { SchematicEngine } = await importAppScripts('@angular-devkit/schematics');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll need to pass in this.project.directory to the two functions, not the module name.

@rdlabo rdlabo closed this Mar 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants