@nstudio/xplat
Advanced tools
Comparing version 15.0.3 to 15.0.4-rc.0
{ | ||
"schematics": { | ||
"update-to-10.2.0": { | ||
"version": "10.2.0", | ||
"description": "Migrate workspace to 10.2.0", | ||
"factory": "./migrations/update-10-2-0/update-10-2-0" | ||
}, | ||
"update-to-11.0.0": { | ||
"version": "11.0.21", | ||
"description": "Migrate workspace to 11.0.0", | ||
"factory": "./migrations/update-11-0-0/update-11-0-0" | ||
}, | ||
"update-to-11-imports": { | ||
"version": "11.0.21", | ||
"description": "Migrate workspace to use v11 import barrels", | ||
"factory": "./migrations/update-11-0-0/update-to-11-imports" | ||
}, | ||
"update-to-11-env-base": { | ||
"version": "11.0.21", | ||
"description": "Migrate workspace to use v11 env base option", | ||
"factory": "./migrations/update-11-0-0/update-to-11-env-base" | ||
}, | ||
"update-to-11-clean-old-dirs": { | ||
"version": "11.0.21", | ||
"description": "Remove old dirs", | ||
"factory": "./migrations/update-11-0-0/clean-old-dirs" | ||
}, | ||
"update-to-12.4.3": { | ||
@@ -40,43 +15,2 @@ "version": "12.4.3", | ||
"packageJsonUpdates": { | ||
"11.0.21": { | ||
"version": "11.0.21", | ||
"packages": { | ||
"@nstudio/angular": { | ||
"version": "11.0.21", | ||
"alwaysAddToPackageJson": false | ||
}, | ||
"@nstudio/electron": { | ||
"version": "11.0.21", | ||
"alwaysAddToPackageJson": false | ||
}, | ||
"@nstudio/electron-angular": { | ||
"version": "11.0.21", | ||
"alwaysAddToPackageJson": false | ||
}, | ||
"@nstudio/ionic": { | ||
"version": "11.0.21", | ||
"alwaysAddToPackageJson": false | ||
}, | ||
"@nstudio/ionic-angular": { | ||
"version": "11.0.21", | ||
"alwaysAddToPackageJson": false | ||
}, | ||
"@nstudio/nativescript": { | ||
"version": "11.0.21", | ||
"alwaysAddToPackageJson": false | ||
}, | ||
"@nstudio/nativescript-angular": { | ||
"version": "11.0.21", | ||
"alwaysAddToPackageJson": false | ||
}, | ||
"@nstudio/web": { | ||
"version": "11.0.21", | ||
"alwaysAddToPackageJson": false | ||
}, | ||
"@nstudio/web-angular": { | ||
"version": "11.0.21", | ||
"alwaysAddToPackageJson": false | ||
} | ||
} | ||
}, | ||
"12.4.3": { | ||
@@ -83,0 +17,0 @@ "version": "12.4.3", |
@@ -6,3 +6,2 @@ "use strict"; | ||
const fs = require("fs"); | ||
const workspace_1 = require("@nrwl/workspace"); | ||
const xplat_1 = require("@nstudio/xplat"); | ||
@@ -58,3 +57,3 @@ const xplat_utils_1 = require("@nstudio/xplat-utils"); | ||
}); | ||
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/webpack.config.js`, webpackConfig | ||
(0, xplat_utils_1.updateFile)(tree, `${dirPath}/webpack.config.js`, webpackConfig | ||
.replace(/<%= pathOffset %>/gi, relativePath + '/') | ||
@@ -106,3 +105,3 @@ .replace(/<%= npmScope %>/gi, npmScope)); | ||
} | ||
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/tools/xplat-postinstall.js`, `//#!/usr/bin/env node | ||
(0, xplat_utils_1.updateFile)(tree, `${dirPath}/tools/xplat-postinstall.js`, `//#!/usr/bin/env node | ||
@@ -131,3 +130,3 @@ const fs = require('fs-extra'); | ||
`); | ||
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/tsconfig.app.json`, `{ | ||
(0, xplat_utils_1.updateFile)(tree, `${dirPath}/tsconfig.app.json`, `{ | ||
"extends": "./tsconfig.json", | ||
@@ -148,3 +147,3 @@ "compilerOptions": { | ||
}`); | ||
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/tsconfig.editor.json`, `{ | ||
(0, xplat_utils_1.updateFile)(tree, `${dirPath}/tsconfig.editor.json`, `{ | ||
"extends": "./tsconfig.json", | ||
@@ -157,3 +156,3 @@ "include": ["**/*.ts"], | ||
`); | ||
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/tsconfig.json`, `{ | ||
(0, xplat_utils_1.updateFile)(tree, `${dirPath}/tsconfig.json`, `{ | ||
"extends": "${relativePath}/tsconfig.base.json", | ||
@@ -175,3 +174,3 @@ "files": [], | ||
`); | ||
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/tsconfig.spec.json`, `{ | ||
(0, xplat_utils_1.updateFile)(tree, `${dirPath}/tsconfig.spec.json`, `{ | ||
"extends": "./tsconfig.json", | ||
@@ -187,4 +186,4 @@ "compilerOptions": { | ||
`); | ||
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/src/test-setup.ts`, `import 'jest-preset-angular';`); | ||
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/src/polyfills.ts`, `/** | ||
(0, xplat_utils_1.updateFile)(tree, `${dirPath}/src/test-setup.ts`, `import 'jest-preset-angular';`); | ||
(0, xplat_utils_1.updateFile)(tree, `${dirPath}/src/polyfills.ts`, `/** | ||
* NativeScript Polyfills | ||
@@ -210,3 +209,3 @@ */ | ||
`); | ||
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/.eslintrc.json`, `{ | ||
(0, xplat_utils_1.updateFile)(tree, `${dirPath}/.eslintrc.json`, `{ | ||
"extends": "${relativePath}/.eslintrc.json", | ||
@@ -276,25 +275,24 @@ "ignorePatterns": [ | ||
function updateRootPackage(tree, context) { | ||
return (0, workspace_1.updateJsonInTree)('package.json', (json) => { | ||
json.scripts = json.scripts || {}; | ||
const nativeScriptDeps = { | ||
'@nativescript/angular': nsNgScopedVersion, | ||
'@nativescript/core': nsCoreVersion, | ||
}; | ||
const nativeScriptDevDeps = { | ||
'@nativescript/types': nsCoreVersion, | ||
'@nativescript/webpack': nsWebpackVersion, | ||
}; | ||
json.scripts.clean = | ||
'npx rimraf hooks node_modules package-lock.json && yarn config set ignore-engines true && yarn'; | ||
json.dependencies = json.dependencies || {}; | ||
json.dependencies = Object.assign(Object.assign(Object.assign(Object.assign({}, json.dependencies), ngDeps), (hasNativeScriptApps ? nativeScriptDeps : {})), { '@ngx-translate/core': ngxTranslateVersion, rxjs: rxjsVersion, 'zone.js': zoneJsVersion }); | ||
delete json.dependencies['nativescript-angular']; | ||
delete json.dependencies['tns-core-modules']; | ||
delete json.devDependencies['tns-core-modules']; | ||
delete json.dependencies['tns-platform-declarations']; | ||
delete json.devDependencies['tns-platform-declarations']; | ||
json.devDependencies = json.devDependencies || {}; | ||
json.devDependencies = Object.assign(Object.assign(Object.assign(Object.assign({}, json.devDependencies), { '@angular-devkit/architect': '^0.1200.0', '@angular-devkit/build-angular': angularVersion, '@angular-devkit/core': angularVersion, '@angular-devkit/schematics': angularVersion, '@angular/compiler-cli': angularVersion, '@angular/language-service': angularVersion }), (hasNativeScriptApps ? nativeScriptDevDeps : {})), { typescript: typescriptVersion }); | ||
return json; | ||
})(tree, context); | ||
const json = (0, xplat_utils_1.getJsonFromFile)(tree, 'package.json'); | ||
json.scripts = json.scripts || {}; | ||
const nativeScriptDeps = { | ||
'@nativescript/angular': nsNgScopedVersion, | ||
'@nativescript/core': nsCoreVersion, | ||
}; | ||
const nativeScriptDevDeps = { | ||
'@nativescript/types': nsCoreVersion, | ||
'@nativescript/webpack': nsWebpackVersion, | ||
}; | ||
json.scripts.clean = | ||
'npx rimraf hooks node_modules package-lock.json && yarn config set ignore-engines true && yarn'; | ||
json.dependencies = json.dependencies || {}; | ||
json.dependencies = Object.assign(Object.assign(Object.assign(Object.assign({}, json.dependencies), ngDeps), (hasNativeScriptApps ? nativeScriptDeps : {})), { '@ngx-translate/core': ngxTranslateVersion, rxjs: rxjsVersion, 'zone.js': zoneJsVersion }); | ||
delete json.dependencies['nativescript-angular']; | ||
delete json.dependencies['tns-core-modules']; | ||
delete json.devDependencies['tns-core-modules']; | ||
delete json.dependencies['tns-platform-declarations']; | ||
delete json.devDependencies['tns-platform-declarations']; | ||
json.devDependencies = json.devDependencies || {}; | ||
json.devDependencies = Object.assign(Object.assign(Object.assign(Object.assign({}, json.devDependencies), { '@angular-devkit/architect': '^0.1200.0', '@angular-devkit/build-angular': angularVersion, '@angular-devkit/core': angularVersion, '@angular-devkit/schematics': angularVersion, '@angular/compiler-cli': angularVersion, '@angular/language-service': angularVersion }), (hasNativeScriptApps ? nativeScriptDevDeps : {})), { typescript: typescriptVersion }); | ||
return (0, xplat_utils_1.updateJsonFile)(tree, 'package.json', json); | ||
} | ||
@@ -301,0 +299,0 @@ function default_1() { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const schematics_1 = require("@angular-devkit/schematics"); | ||
const workspace_1 = require("@nrwl/workspace"); | ||
const xplat_1 = require("@nstudio/xplat"); | ||
@@ -74,3 +73,3 @@ const xplat_utils_1 = require("@nstudio/xplat-utils"); | ||
} | ||
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/tools/xplat-postinstall.js`, `//#!/usr/bin/env node | ||
(0, xplat_utils_1.updateFile)(tree, `${dirPath}/tools/xplat-postinstall.js`, `//#!/usr/bin/env node | ||
@@ -115,3 +114,3 @@ const fs = require('fs-extra'); | ||
`); | ||
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/tsconfig.app.json`, `{ | ||
(0, xplat_utils_1.updateFile)(tree, `${dirPath}/tsconfig.app.json`, `{ | ||
"extends": "./tsconfig.json", | ||
@@ -132,3 +131,3 @@ "compilerOptions": { | ||
}`); | ||
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/tsconfig.editor.json`, `{ | ||
(0, xplat_utils_1.updateFile)(tree, `${dirPath}/tsconfig.editor.json`, `{ | ||
"extends": "./tsconfig.json", | ||
@@ -141,3 +140,3 @@ "include": ["**/*.ts"], | ||
`); | ||
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/tsconfig.json`, `{ | ||
(0, xplat_utils_1.updateFile)(tree, `${dirPath}/tsconfig.json`, `{ | ||
"extends": "${relativePath}/tsconfig.base.json", | ||
@@ -159,3 +158,3 @@ "files": [], | ||
`); | ||
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/tsconfig.spec.json`, `{ | ||
(0, xplat_utils_1.updateFile)(tree, `${dirPath}/tsconfig.spec.json`, `{ | ||
"extends": "./tsconfig.json", | ||
@@ -171,4 +170,4 @@ "compilerOptions": { | ||
`); | ||
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/src/test-setup.ts`, `import 'jest-preset-angular/setup-jest';`); | ||
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/src/polyfills.ts`, `/** | ||
(0, xplat_utils_1.updateFile)(tree, `${dirPath}/src/test-setup.ts`, `import 'jest-preset-angular/setup-jest';`); | ||
(0, xplat_utils_1.updateFile)(tree, `${dirPath}/src/polyfills.ts`, `/** | ||
* NativeScript Polyfills | ||
@@ -194,3 +193,3 @@ */ | ||
`); | ||
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/.eslintrc.json`, `{ | ||
(0, xplat_utils_1.updateFile)(tree, `${dirPath}/.eslintrc.json`, `{ | ||
"extends": "${relativePath}/.eslintrc.json", | ||
@@ -260,33 +259,32 @@ "ignorePatterns": [ | ||
function updateRootPackage(tree, context) { | ||
return (0, workspace_1.updateJsonInTree)('package.json', (json) => { | ||
json.scripts = json.scripts || {}; | ||
const nativeScriptDeps = { | ||
'@nativescript/angular': nsNgScopedVersion, | ||
'@nativescript/core': nsCoreVersion, | ||
}; | ||
const nativeScriptDevDeps = { | ||
'@nativescript/types': nsCoreVersion, | ||
'@nativescript/webpack': nsWebpackVersion, | ||
}; | ||
json.dependencies = json.dependencies || {}; | ||
json.dependencies = Object.assign(Object.assign(Object.assign({}, json.dependencies), (hasNativeScriptApps ? nativeScriptDeps : {})), { '@ngx-translate/core': ngxTranslateVersion }); | ||
let ngToolsDeps = { | ||
'@ngtools/webpack': angularVersion | ||
}; | ||
if (json.dependencies['@angular/core']) { | ||
// make sure in sync with current angular versions | ||
ngToolsDeps['@ngtools/webpack'] = json.dependencies['@angular/core']; | ||
} | ||
else { | ||
ngToolsDeps = null; | ||
} | ||
delete json.dependencies['nativescript-angular']; | ||
delete json.dependencies['tns-core-modules']; | ||
delete json.devDependencies['tns-core-modules']; | ||
delete json.dependencies['tns-platform-declarations']; | ||
delete json.devDependencies['tns-platform-declarations']; | ||
json.devDependencies = json.devDependencies || {}; | ||
json.devDependencies = Object.assign(Object.assign(Object.assign({}, json.devDependencies), (hasNativeScriptApps ? nativeScriptDevDeps : {})), (ngToolsDeps ? ngToolsDeps : {})); | ||
return json; | ||
})(tree, context); | ||
const json = (0, xplat_utils_1.getJsonFromFile)(tree, 'package.json'); | ||
json.scripts = json.scripts || {}; | ||
const nativeScriptDeps = { | ||
'@nativescript/angular': nsNgScopedVersion, | ||
'@nativescript/core': nsCoreVersion, | ||
}; | ||
const nativeScriptDevDeps = { | ||
'@nativescript/types': nsCoreVersion, | ||
'@nativescript/webpack': nsWebpackVersion, | ||
}; | ||
json.dependencies = json.dependencies || {}; | ||
json.dependencies = Object.assign(Object.assign(Object.assign({}, json.dependencies), (hasNativeScriptApps ? nativeScriptDeps : {})), { '@ngx-translate/core': ngxTranslateVersion }); | ||
let ngToolsDeps = { | ||
'@ngtools/webpack': angularVersion | ||
}; | ||
if (json.dependencies['@angular/core']) { | ||
// make sure in sync with current angular versions | ||
ngToolsDeps['@ngtools/webpack'] = json.dependencies['@angular/core']; | ||
} | ||
else { | ||
ngToolsDeps = null; | ||
} | ||
delete json.dependencies['nativescript-angular']; | ||
delete json.dependencies['tns-core-modules']; | ||
delete json.devDependencies['tns-core-modules']; | ||
delete json.dependencies['tns-platform-declarations']; | ||
delete json.devDependencies['tns-platform-declarations']; | ||
json.devDependencies = json.devDependencies || {}; | ||
json.devDependencies = Object.assign(Object.assign(Object.assign({}, json.devDependencies), (hasNativeScriptApps ? nativeScriptDevDeps : {})), (ngToolsDeps ? ngToolsDeps : {})); | ||
return (0, xplat_utils_1.updateJsonFile)(tree, 'package.json', json); | ||
} | ||
@@ -293,0 +291,0 @@ function default_1() { |
{ | ||
"name": "@nstudio/xplat", | ||
"version": "15.0.3", | ||
"version": "15.0.4-rc.0", | ||
"description": "Cross-platform (xplat) tools for Nx workspaces.", | ||
@@ -44,4 +44,4 @@ "homepage": "https://nstudio.io/xplat", | ||
"dependencies": { | ||
"@nstudio/focus": "15.0.3", | ||
"@nstudio/xplat-utils": "15.0.3" | ||
"@nstudio/focus": "15.0.4-rc.0", | ||
"@nstudio/xplat-utils": "15.0.4-rc.0" | ||
}, | ||
@@ -48,0 +48,0 @@ "author": "Nathan Walker", |
@@ -14,5 +14,5 @@ "use strict"; | ||
const schematics_1 = require("@angular-devkit/schematics"); | ||
const workspace_1 = require("@nrwl/workspace"); | ||
const testing_utils_1 = require("../../utils/testing-utils"); | ||
const testing_1 = require("../../utils/testing"); | ||
const xplat_utils_1 = require("@nstudio/xplat-utils"); | ||
xdescribe('feature schematic', () => { | ||
@@ -331,3 +331,3 @@ let appTree; | ||
const homeCmpPath = `/apps/nativescript-viewer/src/features/home/components/home.component.html`; | ||
(0, workspace_1.createOrUpdate)(appTree, homeCmpPath, sandboxHomeSetup()); | ||
(0, xplat_utils_1.updateFile)(appTree, homeCmpPath, sandboxHomeSetup()); | ||
// console.log('homecmp:', getFileContent(tree, homeCmpPath)); | ||
@@ -334,0 +334,0 @@ options.onlyProject = true; |
@@ -1,77 +0,5 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT- style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
import { Tree } from '@angular-devkit/schematics'; | ||
import * as ts from 'typescript'; | ||
export declare function findNodes(node: ts.Node, kind: ts.SyntaxKind | ts.SyntaxKind[], max?: number): ts.Node[]; | ||
export declare function getSourceNodes(sourceFile: ts.SourceFile): ts.Node[]; | ||
export interface Change { | ||
apply(host: any): Promise<void>; | ||
readonly type: string; | ||
readonly path: string | null; | ||
readonly order: number; | ||
readonly description: string; | ||
} | ||
export declare class NoopChange implements Change { | ||
type: string; | ||
description: string; | ||
order: number; | ||
path: any; | ||
apply(): Promise<void>; | ||
} | ||
export declare class InsertChange implements Change { | ||
path: string; | ||
pos: number; | ||
toAdd: string; | ||
type: string; | ||
order: number; | ||
description: string; | ||
constructor(path: string, pos: number, toAdd: string); | ||
apply(host: any): any; | ||
} | ||
export declare class RemoveChange implements Change { | ||
path: string; | ||
private pos; | ||
private toRemove; | ||
type: string; | ||
order: number; | ||
description: string; | ||
constructor(path: string, pos: number, toRemove: string); | ||
apply(host: any): Promise<void>; | ||
} | ||
export declare class ReplaceChange implements Change { | ||
path: string; | ||
pos: number; | ||
oldText: string; | ||
newText: string; | ||
type: string; | ||
order: number; | ||
description: string; | ||
constructor(path: string, pos: number, oldText: string, newText: string); | ||
apply(host: any): Promise<void>; | ||
} | ||
export declare function addParameterToConstructor(source: ts.SourceFile, modulePath: string, opts: { | ||
className: string; | ||
param: string; | ||
}): Change[]; | ||
export declare function addMethod(source: ts.SourceFile, modulePath: string, opts: { | ||
className: string; | ||
methodHeader: string; | ||
body: string; | ||
}): Change[]; | ||
export declare function findClass(source: ts.SourceFile, className: string, silent?: boolean): ts.ClassDeclaration; | ||
export declare function offset(text: string, numberOfTabs: number, wrap: boolean): string; | ||
export declare function addIncludeToTsConfig(tsConfigPath: string, source: ts.SourceFile, include: string): Change[]; | ||
export declare function getImport(source: ts.SourceFile, predicate: (a: any) => boolean): { | ||
moduleSpec: string; | ||
bindings: string[]; | ||
}[]; | ||
export declare function addGlobal(source: ts.SourceFile, modulePath: string, statement: string, isExport?: boolean): Change[]; | ||
export declare function insert(host: Tree, modulePath: string, changes: Change[]): void; | ||
export declare function getProjectConfig(tree: Tree, name: string): any; | ||
export declare function insertImport(source: ts.SourceFile, fileToEdit: string, symbolName: string, fileName: string, isDefault?: boolean): Change; | ||
export declare function replaceNodeValue(host: Tree, modulePath: string, node: ts.Node, content: string): void; | ||
import { Tree } from '@nrwl/devkit'; | ||
import { Tree as NgTree } from '@angular-devkit/schematics'; | ||
export declare function addGlobal(tree: Tree, source: ts.SourceFile, modulePath: string, statement: string, isExport?: boolean): ts.SourceFile[]; | ||
export declare function insert(host: NgTree, modulePath: string, changes: any[]): void; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.replaceNodeValue = exports.insertImport = exports.getProjectConfig = exports.insert = exports.addGlobal = exports.getImport = exports.addIncludeToTsConfig = exports.offset = exports.findClass = exports.addMethod = exports.addParameterToConstructor = exports.ReplaceChange = exports.RemoveChange = exports.InsertChange = exports.NoopChange = exports.getSourceNodes = exports.findNodes = void 0; | ||
exports.insert = exports.addGlobal = void 0; | ||
const js_1 = require("@nrwl/js"); | ||
const typescript_1 = require("nx/src/utils/typescript"); | ||
const ts = require("typescript"); | ||
const general_1 = require("./general"); | ||
function nodesByPosition(first, second) { | ||
return first.getStart() - second.getStart(); | ||
} | ||
function insertAfterLastOccurrence(nodes, toInsert, file, fallbackPos, syntaxKind) { | ||
// sort() has a side effect, so make a copy so that we won't overwrite the parent's object. | ||
let lastItem = [...nodes].sort(nodesByPosition).pop(); | ||
if (!lastItem) { | ||
throw new Error(); | ||
} | ||
if (syntaxKind) { | ||
lastItem = findNodes(lastItem, syntaxKind).sort(nodesByPosition).pop(); | ||
} | ||
if (!lastItem && fallbackPos == undefined) { | ||
throw new Error(`tried to insert ${toInsert} as first occurence with no fallback position`); | ||
} | ||
const lastItemPosition = lastItem ? lastItem.getEnd() : fallbackPos; | ||
return new InsertChange(file, lastItemPosition, toInsert); | ||
} | ||
function findNodes(node, kind, max = Infinity) { | ||
if (!node || max == 0) { | ||
return []; | ||
} | ||
const arr = []; | ||
const hasMatch = Array.isArray(kind) | ||
? kind.includes(node.kind) | ||
: node.kind === kind; | ||
if (hasMatch) { | ||
arr.push(node); | ||
max--; | ||
} | ||
if (max > 0) { | ||
for (const child of node.getChildren()) { | ||
findNodes(child, kind, max).forEach((node) => { | ||
if (max > 0) { | ||
arr.push(node); | ||
} | ||
max--; | ||
}); | ||
if (max <= 0) { | ||
break; | ||
} | ||
} | ||
} | ||
return arr; | ||
} | ||
exports.findNodes = findNodes; | ||
function getSourceNodes(sourceFile) { | ||
const nodes = [sourceFile]; | ||
const result = []; | ||
while (nodes.length > 0) { | ||
const node = nodes.shift(); | ||
if (node) { | ||
result.push(node); | ||
if (node.getChildCount(sourceFile) >= 0) { | ||
nodes.unshift(...node.getChildren()); | ||
} | ||
} | ||
} | ||
return result; | ||
} | ||
exports.getSourceNodes = getSourceNodes; | ||
class NoopChange { | ||
constructor() { | ||
this.type = 'noop'; | ||
this.description = 'No operation.'; | ||
this.order = Infinity; | ||
this.path = null; | ||
} | ||
apply() { | ||
return Promise.resolve(); | ||
} | ||
} | ||
exports.NoopChange = NoopChange; | ||
class InsertChange { | ||
constructor(path, pos, toAdd) { | ||
this.path = path; | ||
this.pos = pos; | ||
this.toAdd = toAdd; | ||
this.type = 'insert'; | ||
if (pos < 0) { | ||
throw new Error('Negative positions are invalid'); | ||
} | ||
this.description = `Inserted ${toAdd} into position ${pos} of ${path}`; | ||
this.order = pos; | ||
} | ||
apply(host) { | ||
return host.read(this.path).then((content) => { | ||
const prefix = content.substring(0, this.pos); | ||
const suffix = content.substring(this.pos); | ||
return host.write(this.path, `${prefix}${this.toAdd}${suffix}`); | ||
}); | ||
} | ||
} | ||
exports.InsertChange = InsertChange; | ||
class RemoveChange { | ||
constructor(path, pos, toRemove) { | ||
this.path = path; | ||
this.pos = pos; | ||
this.toRemove = toRemove; | ||
this.type = 'remove'; | ||
if (pos < 0) { | ||
throw new Error('Negative positions are invalid'); | ||
} | ||
this.description = `Removed ${toRemove} into position ${pos} of ${path}`; | ||
this.order = pos; | ||
} | ||
apply(host) { | ||
return host.read(this.path).then((content) => { | ||
const prefix = content.substring(0, this.pos); | ||
const suffix = content.substring(this.pos + this.toRemove.length); | ||
return host.write(this.path, `${prefix}${suffix}`); | ||
}); | ||
} | ||
} | ||
exports.RemoveChange = RemoveChange; | ||
class ReplaceChange { | ||
constructor(path, pos, oldText, newText) { | ||
this.path = path; | ||
this.pos = pos; | ||
this.oldText = oldText; | ||
this.newText = newText; | ||
this.type = 'replace'; | ||
if (pos < 0) { | ||
throw new Error('Negative positions are invalid'); | ||
} | ||
this.description = `Replaced ${oldText} into position ${pos} of ${path} with ${newText}`; | ||
this.order = pos; | ||
} | ||
apply(host) { | ||
return host.read(this.path).then((content) => { | ||
const prefix = content.substring(0, this.pos); | ||
const suffix = content.substring(this.pos + this.oldText.length); | ||
const text = content.substring(this.pos, this.pos + this.oldText.length); | ||
if (text !== this.oldText) { | ||
return Promise.reject(new Error(`Invalid replace: "${text}" != "${this.oldText}".`)); | ||
} | ||
return host.write(this.path, `${prefix}${this.newText}${suffix}`); | ||
}); | ||
} | ||
} | ||
exports.ReplaceChange = ReplaceChange; | ||
function addParameterToConstructor(source, modulePath, opts) { | ||
const clazz = findClass(source, opts.className); | ||
const constructor = clazz.members.filter((m) => m.kind === ts.SyntaxKind.Constructor)[0]; | ||
if (constructor) { | ||
throw new Error('Should be tested'); | ||
} | ||
else { | ||
const methodHeader = `constructor(${opts.param})`; | ||
return addMethod(source, modulePath, { | ||
className: opts.className, | ||
methodHeader, | ||
body: null, | ||
}); | ||
} | ||
} | ||
exports.addParameterToConstructor = addParameterToConstructor; | ||
function addMethod(source, modulePath, opts) { | ||
const clazz = findClass(source, opts.className); | ||
const body = opts.body | ||
? ` | ||
${opts.methodHeader} { | ||
${offset(opts.body, 1, false)} | ||
} | ||
` | ||
: ` | ||
${opts.methodHeader} {} | ||
`; | ||
return [new InsertChange(modulePath, clazz.end - 1, offset(body, 1, true))]; | ||
} | ||
exports.addMethod = addMethod; | ||
function findClass(source, className, silent = false) { | ||
const nodes = getSourceNodes(source); | ||
const clazz = (nodes.filter((n) => n.kind === ts.SyntaxKind.ClassDeclaration && | ||
n.name.text === className)[0]); | ||
if (!clazz && !silent) { | ||
throw new Error(`Cannot find class '${className}'`); | ||
} | ||
return clazz; | ||
} | ||
exports.findClass = findClass; | ||
function offset(text, numberOfTabs, wrap) { | ||
const lines = text | ||
.trim() | ||
.split('\n') | ||
.map((line) => { | ||
let tabs = ''; | ||
for (let c = 0; c < numberOfTabs; ++c) { | ||
tabs += ' '; | ||
} | ||
return `${tabs}${line}`; | ||
}) | ||
.join('\n'); | ||
return wrap ? `\n${lines}\n` : lines; | ||
} | ||
exports.offset = offset; | ||
function addIncludeToTsConfig(tsConfigPath, source, include) { | ||
const includeKeywordPos = source.text.indexOf('"include":'); | ||
if (includeKeywordPos > -1) { | ||
const includeArrayEndPos = source.text.indexOf(']', includeKeywordPos); | ||
return [new InsertChange(tsConfigPath, includeArrayEndPos, include)]; | ||
} | ||
else { | ||
return []; | ||
} | ||
} | ||
exports.addIncludeToTsConfig = addIncludeToTsConfig; | ||
function getImport(source, predicate) { | ||
const allImports = findNodes(source, ts.SyntaxKind.ImportDeclaration); | ||
const matching = allImports.filter((i) => predicate(i.moduleSpecifier.getText())); | ||
return matching.map((i) => { | ||
const moduleSpec = i.moduleSpecifier | ||
.getText() | ||
.substring(1, i.moduleSpecifier.getText().length - 1); | ||
const t = i.importClause.namedBindings.getText(); | ||
const bindings = t | ||
.replace('{', '') | ||
.replace('}', '') | ||
.split(',') | ||
.map((q) => q.trim()); | ||
return { moduleSpec, bindings }; | ||
}); | ||
} | ||
exports.getImport = getImport; | ||
function addGlobal(source, modulePath, statement, isExport) { | ||
function addGlobal(tree, source, modulePath, statement, isExport) { | ||
if (isExport) { | ||
const allExports = findNodes(source, ts.SyntaxKind.ExportDeclaration); | ||
const allExports = (0, typescript_1.findNodes)(source, ts.SyntaxKind.ExportDeclaration); | ||
// console.log('allExports:', allExports.length); | ||
@@ -237,18 +15,18 @@ if (allExports.length > 0) { | ||
// console.log('lastExport.end:', lastExport.end); | ||
return [new InsertChange(modulePath, lastExport.end, `\n${statement}\n`)]; | ||
return [(0, js_1.insertChange)(tree, source, modulePath, lastExport.end, `\n${statement}\n`)]; | ||
} | ||
else { | ||
return [new InsertChange(modulePath, 0, `${statement}\n`)]; | ||
return [(0, js_1.insertChange)(tree, source, modulePath, 0, `${statement}\n`)]; | ||
} | ||
} | ||
else { | ||
const allImports = findNodes(source, ts.SyntaxKind.ImportDeclaration); | ||
const allImports = (0, typescript_1.findNodes)(source, ts.SyntaxKind.ImportDeclaration); | ||
if (allImports.length > 0) { | ||
const lastImport = allImports[allImports.length - 1]; | ||
return [ | ||
new InsertChange(modulePath, lastImport.end + 1, `\n${statement}\n`), | ||
(0, js_1.insertChange)(tree, source, modulePath, lastImport.end + 1, `\n${statement}\n`), | ||
]; | ||
} | ||
else { | ||
return [new InsertChange(modulePath, 0, `${statement}\n`)]; | ||
return [(0, js_1.insertChange)(tree, source, modulePath, 0, `${statement}\n`)]; | ||
} | ||
@@ -266,13 +44,18 @@ } | ||
for (const change of orderedChanges) { | ||
if (change.type == 'insert') { | ||
// console.log('change.type:', change, ' -change.kind:', change.kind) | ||
let type = change.type; | ||
if (change.kind === 'c' || change.kind === 'o') { | ||
type = general_1.actionToFileChangeMap[change.kind]; | ||
} | ||
if (type == 'insert') { | ||
recorder.insertLeft(change.pos, change.toAdd); | ||
} | ||
else if (change.type == 'remove') { | ||
else if (type == 'remove') { | ||
recorder.remove(change.pos - 1, change.toRemove.length + 1); | ||
} | ||
else if (change.type == 'replace') { | ||
else if (type == 'replace') { | ||
recorder.remove(change.pos, change.oldText.length); | ||
recorder.insertLeft(change.pos, change.newText); | ||
} | ||
else if (change.type === 'noop') { | ||
else if (type === 'noop') { | ||
// do nothing | ||
@@ -287,69 +70,1 @@ } | ||
exports.insert = insert; | ||
function getProjectConfig(tree, name) { | ||
const workspaceJson = (0, general_1.readWorkspaceJson)(tree); | ||
const projectConfig = workspaceJson.projects[name]; | ||
if (!projectConfig) { | ||
throw new Error(`Cannot find project '${name}'`); | ||
} | ||
else { | ||
return projectConfig; | ||
} | ||
} | ||
exports.getProjectConfig = getProjectConfig; | ||
function insertImport(source, fileToEdit, symbolName, fileName, isDefault = false) { | ||
const rootNode = source; | ||
const allImports = findNodes(rootNode, ts.SyntaxKind.ImportDeclaration); | ||
// get nodes that map to import statements from the file fileName | ||
const relevantImports = allImports.filter((node) => { | ||
// StringLiteral of the ImportDeclaration is the import file (fileName in this case). | ||
const importFiles = node | ||
.getChildren() | ||
.filter((child) => child.kind === ts.SyntaxKind.StringLiteral) | ||
.map((n) => n.text); | ||
return importFiles.filter((file) => file === fileName).length === 1; | ||
}); | ||
if (relevantImports.length > 0) { | ||
let importsAsterisk = false; | ||
// imports from import file | ||
const imports = []; | ||
relevantImports.forEach((n) => { | ||
Array.prototype.push.apply(imports, findNodes(n, ts.SyntaxKind.Identifier)); | ||
if (findNodes(n, ts.SyntaxKind.AsteriskToken).length > 0) { | ||
importsAsterisk = true; | ||
} | ||
}); | ||
// if imports * from fileName, don't add symbolName | ||
if (importsAsterisk) { | ||
return new NoopChange(); | ||
} | ||
const importTextNodes = imports.filter((n) => n.text === symbolName); | ||
// insert import if it's not there | ||
if (importTextNodes.length === 0) { | ||
const fallbackPos = findNodes(relevantImports[0], ts.SyntaxKind.CloseBraceToken)[0].getStart() || | ||
findNodes(relevantImports[0], ts.SyntaxKind.FromKeyword)[0].getStart(); | ||
return insertAfterLastOccurrence(imports, `, ${symbolName}`, fileToEdit, fallbackPos); | ||
} | ||
return new NoopChange(); | ||
} | ||
// no such import declaration exists | ||
const useStrict = findNodes(rootNode, ts.SyntaxKind.StringLiteral).filter((n) => n.text === 'use strict'); | ||
let fallbackPos = 0; | ||
if (useStrict.length > 0) { | ||
fallbackPos = useStrict[0].end; | ||
} | ||
const open = isDefault ? '' : '{ '; | ||
const close = isDefault ? '' : ' }'; | ||
// if there are no imports or 'use strict' statement, insert import at beginning of file | ||
const insertAtBeginning = allImports.length === 0 && useStrict.length === 0; | ||
const separator = insertAtBeginning ? '' : ';\n'; | ||
const toInsert = `${separator}import ${open}${symbolName}${close}` + | ||
` from '${fileName}'${insertAtBeginning ? ';\n' : ''}`; | ||
return insertAfterLastOccurrence(allImports, toInsert, fileToEdit, fallbackPos, ts.SyntaxKind.StringLiteral); | ||
} | ||
exports.insertImport = insertImport; | ||
function replaceNodeValue(host, modulePath, node, content) { | ||
insert(host, modulePath, [ | ||
new ReplaceChange(modulePath, node.getStart(node.getSourceFile()), node.getFullText(), content), | ||
]); | ||
} | ||
exports.replaceNodeValue = replaceNodeValue; |
@@ -1,3 +0,7 @@ | ||
import { Tree } from '@angular-devkit/schematics'; | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import { Tree as NgTree } from '@angular-devkit/schematics'; | ||
import { PlatformTypes, FrameworkTypes, ITargetPlatforms } from '@nstudio/xplat-utils'; | ||
import type { Mode } from 'fs'; | ||
import type { FileChange, Tree as DevKitTree, TreeWriteOptions } from 'nx/src/generators/tree'; | ||
export interface NodeDependency { | ||
@@ -32,7 +36,6 @@ name: string; | ||
export declare function hasWebPlatform(targetPlatforms: ITargetPlatforms): boolean; | ||
export declare function updatePackageForNgrx(tree: Tree, packagePath?: string): import("@angular-devkit/schematics/src/tree/interface").Tree; | ||
export declare function updateTsConfig(tree: Tree, callback: (data: any) => void, targetSuffix?: string, prefixPath?: string): import("@angular-devkit/schematics/src/tree/interface").Tree; | ||
export declare function updatePackageScripts(tree: Tree, scripts: any): import("@angular-devkit/schematics/src/tree/interface").Tree; | ||
export declare function readWorkspaceJson(tree: Tree): any; | ||
export declare function updateWorkspace(updates: any): any; | ||
export declare function updatePackageForNgrx(tree: NgTree, packagePath?: string): import("@angular-devkit/schematics/src/tree/interface").Tree; | ||
export declare function updateTsConfig(tree: NgTree, callback: (data: any) => void, targetSuffix?: string, prefixPath?: string): import("@angular-devkit/schematics/src/tree/interface").Tree; | ||
export declare function updatePackageScripts(tree: NgTree, scripts: any): import("@angular-devkit/schematics/src/tree/interface").Tree; | ||
export declare function readWorkspaceJson(tree: NgTree): any; | ||
export declare function getPrefixWarning(prefix: string): string; | ||
@@ -85,1 +88,27 @@ export declare function getDefaultTemplateOptions(): { | ||
export declare const toNgModuleClassName: (name: string) => string; | ||
export declare const actionToFileChangeMap: { | ||
c: string; | ||
o: string; | ||
d: string; | ||
}; | ||
export declare function convertNgTreeToDevKit(tree: NgTree, context: any): DevkitTreeFromAngularDevkitTree; | ||
export declare class DevkitTreeFromAngularDevkitTree implements DevKitTree { | ||
tree: NgTree; | ||
private _root; | ||
private skipWritingConfigInOldFormat?; | ||
private configFileName; | ||
constructor(tree: NgTree, _root: any, skipWritingConfigInOldFormat?: boolean); | ||
get root(): any; | ||
children(dirPath: string): string[]; | ||
delete(filePath: string): void; | ||
exists(filePath: string): boolean; | ||
isFile(filePath: string): boolean; | ||
listChanges(): FileChange[]; | ||
private normalize; | ||
read(filePath: string): Buffer; | ||
read(filePath: string, encoding: BufferEncoding): string; | ||
rename(from: string, to: string): void; | ||
write(filePath: string, content: Buffer | string, options?: TreeWriteOptions): void; | ||
changePermissions(filePath: string, mode: Mode): void; | ||
private warnUnsupportedFilePermissionsChange; | ||
} |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.toNgModuleClassName = exports.toComponentClassName = exports.stringUtils = exports.sanitize = exports.getDefaultTemplateOptions = exports.getPrefixWarning = exports.updateWorkspace = exports.readWorkspaceJson = exports.updatePackageScripts = exports.updateTsConfig = exports.updatePackageForNgrx = exports.hasWebPlatform = exports.hasFrontendPlatform = exports.supportedSandboxPlatforms = exports.supportedHelpers = void 0; | ||
exports.DevkitTreeFromAngularDevkitTree = exports.convertNgTreeToDevKit = exports.actionToFileChangeMap = exports.toNgModuleClassName = exports.toComponentClassName = exports.stringUtils = exports.sanitize = exports.getDefaultTemplateOptions = exports.getPrefixWarning = exports.readWorkspaceJson = exports.updatePackageScripts = exports.updateTsConfig = exports.updatePackageForNgrx = exports.hasWebPlatform = exports.hasFrontendPlatform = exports.supportedSandboxPlatforms = exports.supportedHelpers = void 0; | ||
const workspace_1 = require("@nrwl/workspace"); | ||
const xplat_utils_1 = require("@nstudio/xplat-utils"); | ||
const path_1 = require("path"); | ||
// list of all supported helpers | ||
@@ -86,14 +96,5 @@ // TODO: add more convenient helpers (like firebase or Travis ci support files) | ||
function readWorkspaceJson(tree) { | ||
return (0, workspace_1.readJsonInTree)(tree, (0, workspace_1.getWorkspacePath)(tree)); | ||
return (0, xplat_utils_1.getJsonFromFile)(tree, 'workspace.json'); | ||
} | ||
exports.readWorkspaceJson = readWorkspaceJson; | ||
function updateWorkspace(updates) { | ||
return (0, workspace_1.updateWorkspaceInTree)((json) => { | ||
for (const key in updates) { | ||
json[key] = Object.assign(Object.assign({}, (json[key] || {})), updates[key]); | ||
} | ||
return json; | ||
}); | ||
} | ||
exports.updateWorkspace = updateWorkspace; | ||
// export function persistPrefix(prefix: string) { | ||
@@ -146,1 +147,144 @@ // return (tree: Tree) => { | ||
exports.toNgModuleClassName = toNgModuleClassName; | ||
exports.actionToFileChangeMap = { | ||
c: 'CREATE', | ||
o: 'UPDATE', | ||
d: 'DELETE', | ||
}; | ||
class RunCallbackTask { | ||
constructor(callback) { | ||
this.callback = callback; | ||
} | ||
toConfiguration() { | ||
return { | ||
name: 'RunCallback', | ||
options: { | ||
callback: this.callback, | ||
}, | ||
}; | ||
} | ||
} | ||
function createRunCallbackTask() { | ||
return { | ||
name: 'RunCallback', | ||
create: () => { | ||
return Promise.resolve(({ callback }) => __awaiter(this, void 0, void 0, function* () { | ||
yield callback(); | ||
})); | ||
}, | ||
}; | ||
} | ||
function convertNgTreeToDevKit(tree, context) { | ||
if (context.engine.workflow) { | ||
const engineHost = context.engine.workflow.engineHost; | ||
engineHost.registerTaskExecutor(createRunCallbackTask()); | ||
} | ||
const root = context.engine.workflow && context.engine.workflow.engineHost.paths | ||
? context.engine.workflow.engineHost.paths[1] | ||
: tree.root.path; | ||
return new DevkitTreeFromAngularDevkitTree(tree, root, true); | ||
} | ||
exports.convertNgTreeToDevKit = convertNgTreeToDevKit; | ||
class DevkitTreeFromAngularDevkitTree { | ||
constructor(tree, _root, skipWritingConfigInOldFormat) { | ||
this.tree = tree; | ||
this._root = _root; | ||
this.skipWritingConfigInOldFormat = skipWritingConfigInOldFormat; | ||
/** | ||
* When using the UnitTestTree from @angular-devkit/schematics/testing, the root is just `/`. | ||
* This causes a massive issue if `getProjects()` is used in the underlying generator because it | ||
* causes fast-glob to be set to work on the user's entire file system. | ||
* | ||
* Therefore, in this case, patch the root to match what Nx Devkit does and use /virtual instead. | ||
*/ | ||
try { | ||
const { UnitTestTree } = require('@angular-devkit/schematics/testing'); | ||
if (tree instanceof UnitTestTree && _root === '/') { | ||
this._root = '/virtual'; | ||
} | ||
} | ||
catch (_a) { } | ||
} | ||
get root() { | ||
return this._root; | ||
} | ||
children(dirPath) { | ||
const { subdirs, subfiles } = this.tree.getDir(dirPath); | ||
return [...subdirs, ...subfiles]; | ||
} | ||
delete(filePath) { | ||
this.tree.delete(filePath); | ||
} | ||
exists(filePath) { | ||
if (this.isFile(filePath)) { | ||
return this.tree.exists(filePath); | ||
} | ||
else { | ||
return this.children(filePath).length > 0; | ||
} | ||
} | ||
isFile(filePath) { | ||
return this.tree.exists(filePath) && !!this.tree.read(filePath); | ||
} | ||
listChanges() { | ||
const fileChanges = []; | ||
for (const action of this.tree.actions) { | ||
if (action.kind === 'r') { | ||
fileChanges.push({ | ||
path: this.normalize(action.to), | ||
type: 'CREATE', | ||
content: this.read(action.to), | ||
}); | ||
fileChanges.push({ | ||
path: this.normalize(action.path), | ||
type: 'DELETE', | ||
content: null, | ||
}); | ||
} | ||
else if (action.kind === 'c' || action.kind === 'o') { | ||
fileChanges.push({ | ||
path: this.normalize(action.path), | ||
type: exports.actionToFileChangeMap[action.kind], | ||
content: action.content, | ||
}); | ||
} | ||
else { | ||
fileChanges.push({ | ||
path: this.normalize(action.path), | ||
type: 'DELETE', | ||
content: null, | ||
}); | ||
} | ||
} | ||
return fileChanges; | ||
} | ||
normalize(path) { | ||
return (0, path_1.relative)(this.root, (0, path_1.join)(this.root, path)); | ||
} | ||
read(filePath, encoding) { | ||
return encoding | ||
? this.tree.read(filePath).toString(encoding) | ||
: this.tree.read(filePath); | ||
} | ||
rename(from, to) { | ||
this.tree.rename(from, to); | ||
} | ||
write(filePath, content, options) { | ||
if (options === null || options === void 0 ? void 0 : options.mode) { | ||
this.warnUnsupportedFilePermissionsChange(filePath, options.mode); | ||
} | ||
if (this.tree.exists(filePath)) { | ||
this.tree.overwrite(filePath, content); | ||
} | ||
else { | ||
this.tree.create(filePath, content); | ||
} | ||
} | ||
changePermissions(filePath, mode) { | ||
this.warnUnsupportedFilePermissionsChange(filePath, mode); | ||
} | ||
warnUnsupportedFilePermissionsChange(filePath, mode) { | ||
console.log(`The Angular DevKit tree does not support changing a file permissions. | ||
Ignoring changing ${filePath} permissions to ${mode}.`); | ||
} | ||
} | ||
exports.DevkitTreeFromAngularDevkitTree = DevkitTreeFromAngularDevkitTree; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.nxVersion = exports.xplatVersion = void 0; | ||
exports.xplatVersion = '15.0.3'; | ||
exports.xplatVersion = '15.0.4-rc.0'; | ||
exports.nxVersion = '^15.0.0'; |
@@ -8,3 +8,2 @@ "use strict"; | ||
const xplat_utils_1 = require("@nstudio/xplat-utils"); | ||
const workspace_1 = require("@nrwl/workspace"); | ||
const ast_1 = require("./ast"); | ||
@@ -47,3 +46,3 @@ const errors_1 = require("./errors"); | ||
return (host) => { | ||
const { dependencies, devDependencies } = (0, workspace_1.readJsonInTree)(host, 'package.json'); | ||
const { dependencies, devDependencies } = (0, xplat_utils_1.getJsonFromFile)(host, 'package.json'); | ||
return dependencies[packageName] || devDependencies[packageName] | ||
@@ -774,3 +773,4 @@ ? callSchematicIfAdded | ||
function adjustBarrelIndex(options, indexFilePath) { | ||
return (tree) => { | ||
return (tree, context) => { | ||
const devKitTree = (0, general_1.convertNgTreeToDevKit)(tree, context); | ||
// console.log('adjustBarrelIndex indexFilePath:', indexFilePath); | ||
@@ -780,6 +780,15 @@ // console.log('tree.exists(indexFilePath):', tree.exists(indexFilePath)); | ||
const indexSourceFile = (0, typescript_1.createSourceFile)(indexFilePath, indexSource, typescript_1.ScriptTarget.Latest, true); | ||
(0, ast_1.insert)(tree, indexFilePath, [ | ||
...(0, ast_1.addGlobal)(indexSourceFile, indexFilePath, `export * from './${options.directory ? options.directory + '/' : ''}${options.name.toLowerCase()}';`, true), | ||
]); | ||
return tree; | ||
// insert(tree, indexFilePath, [ | ||
// ...addGlobal( | ||
// devKitTree, | ||
// indexSourceFile, | ||
// indexFilePath, | ||
// `export * from './${ | ||
// options.directory ? options.directory + '/' : '' | ||
// }${options.name.toLowerCase()}';`, | ||
// true | ||
// ), | ||
// ]); | ||
(0, ast_1.addGlobal)(devKitTree, indexSourceFile, indexFilePath, `export * from './${options.directory ? options.directory + '/' : ''}${options.name.toLowerCase()}';`, true); | ||
return devKitTree.tree; | ||
}; | ||
@@ -786,0 +795,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
0
2
223076
69
4739
1
+ Added@nstudio/focus@15.0.4-rc.0(transitive)
+ Added@nstudio/xplat-utils@15.0.4-rc.0(transitive)
- Removed@nstudio/focus@15.0.3(transitive)
- Removed@nstudio/xplat-utils@15.0.3(transitive)
Updated@nstudio/focus@15.0.4-rc.0