Skip to content

Commit 3ff5fa7

Browse files
committed
chore(release): 11.2.0-rc.0
1 parent ab4f9f2 commit 3ff5fa7

File tree

8 files changed

+32
-30
lines changed

8 files changed

+32
-30
lines changed

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"name": "@nativescript/schematics",
3-
"version": "11.0.0",
3+
"version": "11.2.0-rc.0",
44
"description": "Schematics for NativeScript Angular apps.",
55
"scripts": {
6-
"clean": "npx rimraf node_modules package-lock.json && npm i",
6+
"clean": "npx rimraf node_modules package-lock.json && npm i --legacy-peer-deps",
77
"build": "tsc -p tsconfig.json",
88
"watch": "tsc -w -p tsconfig.json",
99
"test": "npm run build && npm run jasmine",
@@ -25,15 +25,15 @@
2525
},
2626
"schematics": "./src/collection.json",
2727
"dependencies": {
28-
"@angular-devkit/core": "~11.0.0",
29-
"@angular-devkit/schematics": "~11.0.0",
28+
"@angular-devkit/core": "~11.2.0",
29+
"@angular-devkit/schematics": "~11.2.0",
3030
"@nativescript/tslint-rules": "~0.0.5",
3131
"@phenomnomnominal/tsquery": "^4.1.0",
32-
"@schematics/angular": "~11.0.0",
32+
"@schematics/angular": "~11.2.0",
3333
"strip-json-comments": "~3.1.1"
3434
},
3535
"devDependencies": {
36-
"@angular/cli": "~11.0.0",
36+
"@angular/cli": "~11.2.0",
3737
"@types/jasmine": "~3.5.0",
3838
"@types/jasminewd2": "~2.0.3",
3939
"@types/node": "^12.11.1",

src/add-ns/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ const validateOptions = (options: MigrationOptions) => () => {
8181
}
8282
};
8383

84-
const getProjectSettings = (projectName: string) => (tree: Tree, context: SchematicContext) => {
84+
const getProjectSettings = (projectName: string) => async (tree: Tree, context: SchematicContext) => {
8585
context.logger.info('Reading Project Settings');
86-
projectSettings = getAngularProjectSettings(tree, projectName);
86+
projectSettings = await getAngularProjectSettings(tree, projectName);
8787

8888
context.logger.info(`Project settings:
8989
${JSON.stringify(projectSettings, null, 2)}`);

src/angular-project-parser.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import * as ts from 'typescript';
22
import { basename } from 'path';
33
import { Tree, SchematicsException } from '@angular-devkit/schematics';
4-
import { getWorkspace } from '@schematics/angular/utility/config';
54
import {
65
findBootstrapModuleCall,
76
findBootstrapModulePath,
87
} from '@schematics/angular/utility/ng-ast-utils';
8+
import { getWorkspace } from '@schematics/angular/utility/workspace';
99

1010
import { safeGet } from './utils';
1111
import { findNode, findImportPath, getSourceFile } from './ts-utils';
@@ -17,6 +17,8 @@ export interface AngularProjectSettings {
1717
/** default: 'src' */
1818
sourceRoot: string;
1919

20+
architect?: any;
21+
2022
/** default: 'main' */
2123
mainName: string;
2224
/** default: 'src/main.ts' */
@@ -91,8 +93,8 @@ export interface ClassMetadata {
9193

9294
type TypescriptResolver = (moduleName: string, containingFilePath: string) => string;
9395

94-
export function getAngularProjectSettings(tree: Tree, projectName: string): AngularProjectSettings {
95-
const projectSettings = getCoreProjectSettings(tree, projectName);
96+
export async function getAngularProjectSettings(tree: Tree, projectName: string): Promise<AngularProjectSettings> {
97+
const projectSettings = await getCoreProjectSettings(tree, projectName);
9698

9799
const tsResolver = getTypescriptResolver(tree, projectSettings.tsConfig);
98100
const entryModule = getEntryModuleMetadata(tree, projectSettings.mainPath, tsResolver);
@@ -118,8 +120,8 @@ export function getAngularProjectSettings(tree: Tree, projectName: string): Angu
118120
};
119121
}
120122

121-
function getCoreProjectSettings(tree: Tree, projectName: string): CoreProjectSettings {
122-
const { targets, project } = parseAngularConfig(tree, projectName);
123+
async function getCoreProjectSettings(tree: Tree, projectName: string): Promise<CoreProjectSettings> {
124+
const { targets, project } = await parseAngularConfig(tree, projectName);
123125
if (!targets) {
124126
throw new SchematicsException(
125127
`Failed to find build targets for project ${projectName}!`,
@@ -150,22 +152,22 @@ function getCoreProjectSettings(tree: Tree, projectName: string): CoreProjectSet
150152
};
151153
}
152154

153-
export function getTsConfigFromProject(tree: Tree, projectName: string): string {
154-
const { targets } = parseAngularConfig(tree, projectName);
155+
export async function getTsConfigFromProject(tree: Tree, projectName: string) {
156+
const { targets } = await parseAngularConfig(tree, projectName);
155157
const tsConfig = safeGet(targets, 'build', 'options', 'tsConfig');
156158

157159
return tsConfig;
158160
}
159161

160-
function parseAngularConfig(tree, projectName: string) {
161-
const project = getProjectObject(tree, projectName);
162+
async function parseAngularConfig(tree, projectName: string) {
163+
const project = await getProjectObject(tree, projectName);
162164
const targets = project.architect;
163165

164166
return { targets, project };
165167
}
166168

167-
export function getProjectObject(tree: Tree, projectName: string) {
168-
const workspace = getWorkspace(tree);
169+
export async function getProjectObject(tree: Tree, projectName: string) {
170+
const workspace = await getWorkspace(tree);
169171
const project = workspace.projects[projectName];
170172
if (!project) {
171173
throw new SchematicsException(`Couldn't find project "${projectName}" in the workspace!`);

src/convert-relative-imports/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const conversionFailureMessage = `Failed to generate remapped imports! Please se
1515
`https://docs.nativescript.org/angular/code-sharing/intro#remapped-imports`;
1616

1717
export default function(options: ConvertRelativeImportsSchema) {
18-
return (tree: Tree, context: SchematicContext) => {
18+
return async (tree: Tree, context: SchematicContext) => {
1919
const { logger } = context;
2020

2121
const filesToFix = getFilesToFix(tree, options.filesToIgnore);
@@ -25,7 +25,7 @@ export default function(options: ConvertRelativeImportsSchema) {
2525
return tree;
2626
}
2727

28-
const tsConfigPath = getTsConfigFromProject(tree, options.project) || 'tsconfig.json';
28+
const tsConfigPath = await getTsConfigFromProject(tree, options.project) || 'tsconfig.json';
2929
const compilerOptions = getCompilerOptions(tree, tsConfigPath);
3030

3131
if (!compilerOptions) {

src/migrate-component/component-info-utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ export interface ComponentInfo {
1919

2020
let projectSettings: AngularProjectSettings;
2121

22-
export const parseComponentInfo = (options: MigrateComponentSchema) => (tree: Tree, context: SchematicContext) => {
23-
projectSettings = getAngularProjectSettings(tree, options.project);
22+
export const parseComponentInfo = (options: MigrateComponentSchema) => async (tree: Tree, context: SchematicContext) => {
23+
projectSettings = await getAngularProjectSettings(tree, options.project);
2424

2525
const className = (options.name.endsWith('Component'))
2626
? options.name

src/migrate-component/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ export default function(options: MigrateComponentSchema): Rule {
3737
web: options.webext || nsconfigExtensions.web,
3838
};
3939
},
40-
(tree: Tree, context: SchematicContext) => {
41-
componentInfo = parseComponentInfo(options)(tree, context);
40+
async (tree: Tree, context: SchematicContext) => {
41+
componentInfo = await parseComponentInfo(options)(tree, context);
4242
},
4343

4444
(tree: Tree, context: SchematicContext) =>

src/migrate-module/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ export default function(options: MigrateModuleSchema): Rule {
3939
nsext = '.' + nsext;
4040
}
4141
},
42-
(tree: Tree, context: SchematicContext) => {
43-
moduleInfo = parseModuleInfo(options)(tree, context);
42+
async (tree: Tree, context: SchematicContext) => {
43+
moduleInfo = await parseModuleInfo(options)(tree, context);
4444
},
4545

4646
(tree) => {

src/migrate-module/module-info-utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ export interface ModuleInfo {
1616

1717
let projectSettings: AngularProjectSettings;
1818

19-
export const parseModuleInfo = (options: MigrateModuleSchema) => (
19+
export const parseModuleInfo = (options: MigrateModuleSchema) => async (
2020
tree: Tree,
2121
context: SchematicContext,
22-
): ModuleInfo => {
23-
projectSettings = getAngularProjectSettings(tree, options.project);
22+
): Promise<ModuleInfo> => {
23+
projectSettings = await getAngularProjectSettings(tree, options.project);
2424

2525
const className = classify(`${options.name}Module`);
2626
const modulePath = findModulePath(options, tree);

0 commit comments

Comments
 (0)