Skip to content

Commit

Permalink
feat(schematic-utils): schematic utils from angular schematics
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysiek-va committed Jul 23, 2021
1 parent 075c5c5 commit a88c2d3
Show file tree
Hide file tree
Showing 23 changed files with 3,027 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/schematic-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"scripts": {
"test": "jest",
"build": "tsc -p tsconfig.json",
"lint": "eslint ./src/**/**",
"lint": "eslint ./src/**/** --ignore-pattern '*.spec.ts'",
"preversion": "npm run build"
},
"dependencies": {
Expand Down
8 changes: 8 additions & 0 deletions packages/schematic-utils/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
export * from "./utils/template";
export * from "./utils/create-app-module";
export * from "./utils/get-file-content";
export * from "./utils/ast-utils";
export * from "./utils/dependencies";
export * from "./utils/find-module";
export * from "./utils/ng-ast-utils";
export * from "./utils/workspace";
export * from "./utils/workspace-models";
15 changes: 15 additions & 0 deletions packages/schematic-utils/src/tree/empty.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* @license
* Copyright Google LLC 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 { HostTree } from "./host-tree";

export class EmptyTree extends HostTree {
constructor() {
super();
}
}
19 changes: 19 additions & 0 deletions packages/schematic-utils/src/tree/unit-test-tree.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { DelegateTree } from "./delegate";

export class UnitTestTree extends DelegateTree {
get files(): string[] {
const result: string[] = [];
this.visit((path) => result.push(path));

return result;
}

readContent(path: string): string {
const buffer = this.read(path);
if (buffer === null) {
return "";
}

return buffer.toString();
}
}
Loading

0 comments on commit a88c2d3

Please sign in to comment.