@tehw0lf/wordlist-generator 0.0.5 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2021 Robert Weyres
3
+ Copyright (c) 2021,2022 Robert Weyres
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
21
+ SOFTWARE.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tehw0lf/wordlist-generator",
3
- "version": "0.0.5",
3
+ "version": "0.0.9",
4
4
  "license": "MIT",
5
5
  "homepage": "https://github.com/tehw0lf/tehwol.fi.git",
6
6
  "repository": {
@@ -23,9 +23,6 @@
23
23
  "tslib": "^2.2.0"
24
24
  },
25
25
  "schematics": "./schematics/collection.json",
26
- "ng-add": {
27
- "save": "dependencies"
28
- },
29
26
  "module": "fesm2015/tehw0lf-wordlist-generator.mjs",
30
27
  "es2020": "fesm2020/tehw0lf-wordlist-generator.mjs",
31
28
  "esm2020": "esm2020/tehw0lf-wordlist-generator.mjs",
@@ -0,0 +1,16 @@
1
+ {
2
+ "$schema": "../../../node_modules/@angular-devkit/schematics/collection-schema.json",
3
+ "schematics": {
4
+ "ng-add": {
5
+ "description": "Add wordlist-generator library to the project if material is installed.",
6
+ "factory": "./ng-add/index",
7
+ "schema": "./ng-add/schema.json"
8
+ },
9
+ "ng-add-setup": {
10
+ "description": "Install dependencies and add the library to the project",
11
+ "private": true,
12
+ "factory": "./ng-add/setup",
13
+ "schema": "./ng-add/schema.json"
14
+ }
15
+ }
16
+ }
@@ -0,0 +1,3 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ import { Schema } from './schema';
3
+ export default function (options: Schema): Rule;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const tasks_1 = require("@angular-devkit/schematics/tasks");
13
+ const dependencies_1 = require("@schematics/angular/utility/dependencies");
14
+ const workspace_1 = require("@schematics/angular/utility/workspace");
15
+ const workspace_models_1 = require("@schematics/angular/utility/workspace-models");
16
+ const package_config_1 = require("./package-config");
17
+ function default_1(options) {
18
+ return (host, context) => __awaiter(this, void 0, void 0, function* () {
19
+ const materialVersion = (0, package_config_1.getPackageVersionFromPackageJson)(host, '@angular/material');
20
+ const workspace = yield (0, workspace_1.getWorkspace)(host);
21
+ const defaultProject = workspace.extensions.defaultProject;
22
+ const project = options.project
23
+ ? workspace.projects.get(options.project)
24
+ : workspace.projects.get(defaultProject);
25
+ if (!project) {
26
+ (0, dependencies_1.removePackageJsonDependency)(host, '@atehw0lf/wordlist-generator');
27
+ context.logger.error(`No project specified and can not find default project ${project}`);
28
+ return;
29
+ }
30
+ if (project.extensions.projectType !== workspace_models_1.ProjectType.Application) {
31
+ (0, dependencies_1.removePackageJsonDependency)(host, '@atehw0lf/wordlist-generator');
32
+ context.logger.error('This library needs to be added to an application project');
33
+ return;
34
+ }
35
+ if (!materialVersion) {
36
+ (0, dependencies_1.removePackageJsonDependency)(host, '@atehw0lf/wordlist-generator');
37
+ context.logger.error(`@angular/material not found.
38
+ Please run 'ng add @angular/material' first`);
39
+ return;
40
+ }
41
+ context.addTask(new tasks_1.RunSchematicTask('ng-add-setup', options));
42
+ });
43
+ }
44
+ exports.default = default_1;
45
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/wordlist-generator/schematics/ng-add/index.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,4DAAoE;AACpE,2EAAuF;AACvF,qEAAqE;AACrE,mFAA2E;AAE3E,qDAAoE;AAGpE,mBAAyB,OAAe;IACtC,OAAO,CAAO,IAAU,EAAE,OAAyB,EAAE,EAAE;QACrD,MAAM,eAAe,GAAG,IAAA,iDAAgC,EACtD,IAAI,EACJ,mBAAmB,CACpB,CAAC;QACF,MAAM,SAAS,GAAG,MAAM,IAAA,wBAAY,EAAC,IAAI,CAAC,CAAC;QAC3C,MAAM,cAAc,GAAG,SAAS,CAAC,UAAU,CAAC,cAAwB,CAAC;QAErE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO;YAC7B,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC;YACzC,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QAE3C,IAAI,CAAC,OAAO,EAAE;YACZ,IAAA,0CAA2B,EAAC,IAAI,EAAE,8BAA8B,CAAC,CAAC;YAClE,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,yDAAyD,OAAO,EAAE,CACnE,CAAC;YACF,OAAO;SACR;QAED,IAAI,OAAO,CAAC,UAAU,CAAC,WAAW,KAAK,8BAAW,CAAC,WAAW,EAAE;YAC9D,IAAA,0CAA2B,EAAC,IAAI,EAAE,8BAA8B,CAAC,CAAC;YAClE,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,0DAA0D,CAC3D,CAAC;YACF,OAAO;SACR;QAED,IAAI,CAAC,eAAe,EAAE;YACpB,IAAA,0CAA2B,EAAC,IAAI,EAAE,8BAA8B,CAAC,CAAC;YAClE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;mDACwB,CAAC,CAAC;YAC/C,OAAO;SACR;QAED,OAAO,CAAC,OAAO,CAAC,IAAI,wBAAgB,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC,CAAC;IACjE,CAAC,CAAA,CAAC;AACJ,CAAC;AAtCD,4BAsCC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const testing_1 = require("@angular-devkit/schematics/testing");
13
+ const file_content_1 = require("../testing/file-content");
14
+ const test_app_1 = require("../testing/test-app");
15
+ const test_library_1 = require("../testing/test-library");
16
+ describe('ng-add-setup schematic with material present', () => {
17
+ let runner;
18
+ let appTree;
19
+ let errorOutput;
20
+ let warnOutput;
21
+ beforeEach(() => __awaiter(void 0, void 0, void 0, function* () {
22
+ runner = new testing_1.SchematicTestRunner('schematics', require.resolve('../collection.json'));
23
+ appTree = yield (0, test_app_1.createTestAppWithMaterial)(runner);
24
+ errorOutput = [];
25
+ warnOutput = [];
26
+ runner.logger.subscribe((e) => {
27
+ if (e.level === 'error') {
28
+ errorOutput.push(e.message);
29
+ }
30
+ else if (e.level === 'warn') {
31
+ warnOutput.push(e.message);
32
+ }
33
+ });
34
+ }));
35
+ describe('add module', () => {
36
+ it('should add the WordlistGeneratorModule to the project module', () => __awaiter(void 0, void 0, void 0, function* () {
37
+ const tree = yield runner
38
+ .runSchematicAsync('ng-add-setup', {}, appTree)
39
+ .toPromise();
40
+ const fileContent = (0, file_content_1.getFileContent)(tree, '/projects/material/src/app/app.module.ts');
41
+ expect(fileContent).toContain('WordlistGeneratorModule');
42
+ }));
43
+ });
44
+ });
45
+ describe('ng-add schematic without material present', () => {
46
+ let runner;
47
+ let appTree;
48
+ let errorOutput;
49
+ let warnOutput;
50
+ beforeEach(() => __awaiter(void 0, void 0, void 0, function* () {
51
+ runner = new testing_1.SchematicTestRunner('schematics', require.resolve('../collection.json'));
52
+ appTree = yield (0, test_app_1.createTestApp)(runner);
53
+ errorOutput = [];
54
+ warnOutput = [];
55
+ runner.logger.subscribe((e) => {
56
+ if (e.level === 'error') {
57
+ errorOutput.push(e.message);
58
+ }
59
+ else if (e.level === 'warn') {
60
+ warnOutput.push(e.message);
61
+ }
62
+ });
63
+ }));
64
+ describe('fail to add module', () => {
65
+ it('should fail if material is missing', () => __awaiter(void 0, void 0, void 0, function* () {
66
+ const tree = yield runner
67
+ .runSchematicAsync('ng-add', {}, appTree)
68
+ .toPromise();
69
+ const fileContent = (0, file_content_1.getFileContent)(tree, '/projects/material/src/app/app.module.ts');
70
+ expect(fileContent).not.toContain('WordlistGeneratorModule');
71
+ expect(errorOutput.length).toBe(1);
72
+ expect(warnOutput.length).toBe(0);
73
+ expect(errorOutput[0]).toMatch(`@angular/material not found.
74
+ Please run 'ng add @angular/material' first`);
75
+ }));
76
+ });
77
+ });
78
+ describe('ng-add schematic - library project', () => {
79
+ let runner;
80
+ let libraryTree;
81
+ let errorOutput;
82
+ let warnOutput;
83
+ beforeEach(() => __awaiter(void 0, void 0, void 0, function* () {
84
+ runner = new testing_1.SchematicTestRunner('schematics', require.resolve('../collection.json'));
85
+ libraryTree = yield (0, test_library_1.createTestLibrary)(runner);
86
+ errorOutput = [];
87
+ warnOutput = [];
88
+ runner.logger.subscribe((e) => {
89
+ if (e.level === 'error') {
90
+ errorOutput.push(e.message);
91
+ }
92
+ else if (e.level === 'warn') {
93
+ warnOutput.push(e.message);
94
+ }
95
+ });
96
+ }));
97
+ it('should do nothing if a library project is targeted', () => __awaiter(void 0, void 0, void 0, function* () {
98
+ yield runner.runSchematicAsync('ng-add', {}, libraryTree).toPromise();
99
+ expect(errorOutput.length).toBe(1);
100
+ expect(errorOutput[0]).toMatch('This library needs to be added to an application project');
101
+ }));
102
+ });
103
+ //# sourceMappingURL=index.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.spec.js","sourceRoot":"","sources":["../../../../../libs/wordlist-generator/schematics/ng-add/index.spec.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,gEAAyE;AAEzE,0DAAyD;AACzD,kDAA+E;AAC/E,0DAA4D;AAE5D,QAAQ,CAAC,8CAA8C,EAAE,GAAG,EAAE;IAC5D,IAAI,MAA2B,CAAC;IAChC,IAAI,OAAa,CAAC;IAClB,IAAI,WAAqB,CAAC;IAC1B,IAAI,UAAoB,CAAC;IAEzB,UAAU,CAAC,GAAS,EAAE;QACpB,MAAM,GAAG,IAAI,6BAAmB,CAC9B,YAAY,EACZ,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,CACtC,CAAC;QACF,OAAO,GAAG,MAAM,IAAA,oCAAyB,EAAC,MAAM,CAAC,CAAC;QAElD,WAAW,GAAG,EAAE,CAAC;QACjB,UAAU,GAAG,EAAE,CAAC;QAChB,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE;YAC5B,IAAI,CAAC,CAAC,KAAK,KAAK,OAAO,EAAE;gBACvB,WAAW,CAAC,IAAI,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ACjB,UAAU,GAAG,EAAE,CAAC;QAChB,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE;YAC5B,IAAI,CAAC,CAAC,KAAK,KAAK,OAAO,EAAE;gBACvB,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;aAC7B;iBAAM,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM,EAAE;gBAC7B,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;aAC5B;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAA,CAAC,CAAC;IAEH,EAAE,CAAC,oDAAoD,EAAE,GAAS,EAAE;QAClE,MAAM,MAAM,CAAC,iBAAiB,CAAC,QAAQ,EAAE,EAAE,EAAE,WAAW,CAAC,CAAC,SAAS,EAAE,CAAC;QAEtE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACnC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAC5B,0DAA0D,CAC3D,CAAC;IACJ,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
8
+ import { Tree } from '@angular-devkit/schematics';
9
+ /** Adds a package to the package.json in the given host tree. */
10
+ export declare function addPackageToPackageJson(host: Tree, pkg: string, version: string): Tree;
11
+ /** Gets the version of the specified package by looking at the package.json in the given tree. */
12
+ export declare function getPackageVersionFromPackageJson(tree: Tree, name: string): string | null;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPackageVersionFromPackageJson = exports.addPackageToPackageJson = void 0;
4
+ /**
5
+ * Sorts the keys of the given object.
6
+ * @returns A new object instance with sorted keys
7
+ */
8
+ function sortObjectByKeys(obj) {
9
+ return Object.keys(obj)
10
+ .sort()
11
+ .reduce((result, key) => {
12
+ result[key] = obj[key];
13
+ return result;
14
+ }, {});
15
+ }
16
+ /** Adds a package to the package.json in the given host tree. */
17
+ function addPackageToPackageJson(host, pkg, version) {
18
+ if (host.exists('package.json')) {
19
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
20
+ const sourceText = host.read('package.json').toString('utf-8');
21
+ const json = JSON.parse(sourceText);
22
+ if (!json.dependencies) {
23
+ json.dependencies = {};
24
+ }
25
+ if (!json.dependencies[pkg]) {
26
+ json.dependencies[pkg] = version;
27
+ json.dependencies = sortObjectByKeys(json.dependencies);
28
+ }
29
+ host.overwrite('package.json', JSON.stringify(json, null, 2));
30
+ }
31
+ return host;
32
+ }
33
+ exports.addPackageToPackageJson = addPackageToPackageJson;
34
+ /** Gets the version of the specified package by looking at the package.json in the given tree. */
35
+ function getPackageVersionFromPackageJson(tree, name) {
36
+ if (!tree.exists('package.json')) {
37
+ return null;
38
+ }
39
+ const packageJson = JSON.parse(
40
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
41
+ tree.read('package.json').toString('utf8'));
42
+ if (packageJson.dependencies && packageJson.dependencies[name]) {
43
+ return packageJson.dependencies[name];
44
+ }
45
+ return null;
46
+ }
47
+ exports.getPackageVersionFromPackageJson = getPackageVersionFromPackageJson;
48
+ //# sourceMappingURL=package-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-config.js","sourceRoot":"","sources":["../../../../../libs/wordlist-generator/schematics/ng-add/package-config.ts"],"names":[],"mappings":";;;AAaA;;;GAGG;AACH,SAAS,gBAAgB,CAAC,GAA2B;IACnD,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;SACpB,IAAI,EAAE;SACN,MAAM,CAAC,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE;QACtB,MAAM,CAAC,GAAG,CAAC,GAAG,G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,EAAE;QAC9D,OAAO,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;KACvC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAlBD,4EAkBC"}
@@ -0,0 +1,3 @@
1
+ export interface Schema {
2
+ project: string;
3
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../../libs/wordlist-generator/schematics/ng-add/schema.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "angular-material-ng-add",
4
+ "title": "Angular Material ng-add schematic",
5
+ "type": "object",
6
+ "properties": {
7
+ "project": {
8
+ "type": "string",
9
+ "description": "Name of the project.",
10
+ "$default": {
11
+ "$source": "projectName"
12
+ }
13
+ }
14
+ },
15
+ "required": []
16
+ }
@@ -0,0 +1,3 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ import { Schema } from './schema';
3
+ export default function (options: Schema): Rule;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const schematics_1 = require("@angular-devkit/schematics");
13
+ const tasks_1 = require("@angular-devkit/schematics/tasks");
14
+ const schematics_2 = require("@angular/cdk/schematics");
15
+ const workspace_1 = require("@schematics/angular/utility/workspace");
16
+ const package_config_1 = require("./package-config");
17
+ const wordlistGeneratorModuleName = 'WordlistGeneratorModule';
18
+ const wordlistGeneratorPackageName = '@tehw0lf/wordlist-generator';
19
+ const flexLayoutFallbackVersion = '^13.0.0-beta.36';
20
+ function default_1(options) {
21
+ return () => __awaiter(this, void 0, void 0, function* () {
22
+ return (0, schematics_1.chain)([addDependencies(), addWordlistGeneratorModule(options)]);
23
+ });
24
+ }
25
+ exports.default = default_1;
26
+ function addWordlistGeneratorModule(options) {
27
+ return (host, context) => __awaiter(this, void 0, void 0, function* () {
28
+ const workspace = yield (0, workspace_1.getWorkspace)(host);
29
+ const project = (0, schematics_2.getProjectFromWorkspace)(workspace, options.project);
30
+ const appModulePath = (0, schematics_2.getAppModulePath)(host, (0, schematics_2.getProjectMainFile)(project));
31
+ if (!(0, schematics_2.hasNgModuleImport)(host, appModulePath, wordlistGeneratorModuleName)) {
32
+ (0, schematics_2.addModuleImportToRootModule)(host, wordlistGeneratorModuleName, wordlistGeneratorPackageName, project);
33
+ }
34
+ context.logger.warn('Library is already installed, nothing to do.');
35
+ return;
36
+ });
37
+ }
38
+ function addDependencies() {
39
+ return (host, context) => __awaiter(this, void 0, void 0, function* () {
40
+ const flexLayoutVersion = (0, package_config_1.getPackageVersionFromPackageJson)(host, '@angular/flex-layout');
41
+ if (!flexLayoutVersion || flexLayoutVersion !== flexLayoutFallbackVersion) {
42
+ (0, package_config_1.addPackageToPackageJson)(host, '@angular/flex-layout', flexLayoutFallbackVersion);
43
+ context.logger.info(`@angular/flex-layout ${flexLayoutFallbackVersion} was added to dependencies.`);
44
+ }
45
+ context.addTask(new tasks_1.NodePackageInstallTask());
46
+ });
47
+ }
48
+ //# sourceMappingURL=setup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../../../libs/wordlist-generator/schematics/ng-add/setup.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,2DAAiF;AACjF,4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EACJ,sBAAsB,EACtB,yBAAyB,CAC1B,CAAC;YAEF,OAAO,CAAC,MAAM,CAAC,IAAI,CACjB,wBAAwB,yBAAyB,6BAA6B,CAC/E,CAAC;SACH;QACD,OAAO,CAAC,OAAO,CAAC,IAAI,8BAAsB,EAAE,CAAC,CAAC;IAChD,CAAC,CAAA,CAAC;AACJ,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
8
+ import { Tree } from '@angular-devkit/schematics';
9
+ /** Gets the content of a specified file from a schematic tree. */
10
+ export declare function getFileContent(tree: Tree, filePath: string): string;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getFileContent = void 0;
4
+ /** Gets the content of a specified file from a schematic tree. */
5
+ function getFileContent(tree, filePath) {
6
+ const contentBuffer = tree.read(filePath);
7
+ if (!contentBuffer) {
8
+ throw new Error(`Cannot read "${filePath}" because it does not exist.`);
9
+ }
10
+ return contentBuffer.toString();
11
+ }
12
+ exports.getFileContent = getFileContent;
13
+ //# sourceMappingURL=file-content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-content.js","sourceRoot":"","sources":["../../../../../libs/wordlist-generator/schematics/testing/file-content.ts"],"names":[],"mappings":";;;AAUA,kEAAkE;AAClE,SAAgB,cAAc,CAAC,IAAU,EAAE,QAAgB;IACzD,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAE1C,IAAI,CAAC,aAAa,EAAE;QAClB,MAAM,IAAI,KAAK,CAAC,gBAAgB,QAAQ,8BAA8B,CAAC,CAAC;KACzE;IAED,OAAO,aAAa,CAAC,QAAQ,EAAE,CAAC;AAClC,CAAC;AARD,wCAQC"}
@@ -0,0 +1,12 @@
1
+ import { Tree } from '@angular-devkit/schematics';
2
+ import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
3
+ /**
4
+ * @license
5
+ * Copyright Google LLC All Rights Reserved.
6
+ *
7
+ * Use of this source code is governed by an MIT-style license that can be
8
+ * found in the LICENSE file at https://angular.io/license
9
+ */
10
+ /** Create a base app used for testing. */
11
+ export declare function createTestApp(runner: SchematicTestRunner, appOptions?: {}, tree?: Tree): Promise<UnitTestTree>;
12
+ export declare function createTestAppWithMaterial(runner: SchematicTestRunner, appOptions?: {}, tree?: Tree): Promise<UnitTestTree>;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.createTestAppWithMaterial = exports.createTestApp = void 0;
13
+ const package_config_1 = require("../ng-add/package-config");
14
+ const file_content_1 = require("./file-content");
15
+ const test_project_1 = require("./test-project");
16
+ /**
17
+ * @license
18
+ * Copyright Google LLC All Rights Reserved.
19
+ *
20
+ * Use of this source code is governed by an MIT-style license that can be
21
+ * found in the LICENSE file at https://angular.io/license
22
+ */
23
+ /** Create a base app used for testing. */
24
+ function createTestApp(runner, appOptions = {}, tree) {
25
+ return __awaiter(this, void 0, void 0, function* () {
26
+ return (0, test_project_1.createTestProject)(runner, 'application', appOptions, tree);
27
+ });
28
+ }
29
+ exports.createTestApp = createTestApp;
30
+ function createTestAppWithMaterial(runner, appOptions = {}, tree) {
31
+ return __awaiter(this, void 0, void 0, function* () {
32
+ const projectTree = yield (0, test_project_1.createTestProject)(runner, 'application', appOptions, tree);
33
+ const coreVersion = (0, package_config_1.getPackageVersionFromPackageJson)(projectTree, '@angular/core');
34
+ const packageJson = (0, file_content_1.getFileContent)(projectTree, '/package.json');
35
+ const updatedPackageJson = packageJson.replace(`"dependencies": {
36
+ "@angular/animations": "${coreVersion}",`, `"dependencies": {
37
+ "@angular/animations": "${coreVersion}",
38
+ "@angular/material": "${coreVersion}",`);
39
+ projectTree.overwrite('/package.json', updatedPackageJson);
40
+ return projectTree;
41
+ });
42
+ }
43
+ exports.createTestAppWithMaterial = createTestAppWithMaterial;
44
+ //# sourceMappingURL=test-app.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-app.js","sourceRoot":"","sources":["../../../../../libs/wordlist-generator/schematics/testing/test-app.ts"],"names":[],"mappings":";;;;;;;;;;;;AAMA,6DAA4E;AAC5E,iDAAgD;AAChD,iDAAmD;AAEnD;;;;;;GAMG;AACH,0CAA0C;AAC1C,SAAsB,aAAa,CACjC,MAA2B,EAC3B,UAAU,GAAG,EAAE,EACf,IAAW;;QAEX,OAAO,IAAA,gCAAiB,EAAC,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;IACpE,CAAC;CAAA;AAND,sCAMC;AAED,SAAsB,yBAAyB,CAC7C,MAA2B,EAC3B,UAAU,GAAG,EAAE,EACf,IAAW;;QAEX,MAAM,WAAW,GAAG,MAAM,IAAA,gCAAiB,EACzC,MAAM,EACN,aAAa,EACb,UAAU,EACV,IAAI,CACL,CAAC;QAEF,MAAM,WAAW,GAAG,IAAA,iDAAgC,EAClD,WAAW,EACX,eAAe,CAChB,CAAC;QAEF,MAAM,WAAW,GAAG,IAAA,6BAAc,EAAC,WAAW,EAAE,eAAe,CAAC,CAAC;QAEjE,MAAM,kBAAkB,GAAG,WAAW,CAAC,OAAO,CAC5C;8BAC0B,WAAW,IAAI,EACzC;8BAC0B,WAAW;4BACb,WAAW,IAAI,CACxC,CAAC;QACF,WAAW,CAAC,SAAS,CAAC,eAAe,EAAE,kBAAkB,CAAC,CAAC;QAC3D,OAAO,WAAW,CAAC;IACrB,CAAC;CAAA;AA5BD,8DA4BC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
8
+ import { Tree } from '@angular-devkit/schematics';
9
+ import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
10
+ /** Create a base library used for testing. */
11
+ export declare function createTestLibrary(runner: SchematicTestRunner, appOptions?: {}, tree?: Tree): Promise<UnitTestTree>;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.createTestLibrary = void 0;
13
+ const test_project_1 = require("./test-project");
14
+ /** Create a base library used for testing. */
15
+ function createTestLibrary(runner, appOptions = {}, tree) {
16
+ return __awaiter(this, void 0, void 0, function* () {
17
+ return (0, test_project_1.createTestProject)(runner, 'library', appOptions, tree);
18
+ });
19
+ }
20
+ exports.createTestLibrary = createTestLibrary;
21
+ //# sourceMappingURL=test-library.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-library.js","sourceRoot":"","sources":["../../../../../libs/wordlist-generator/schematics/testing/test-library.ts"],"names":[],"mappings":";;;;;;;;;;;;AAUA,iDAAmD;AAGnD,8CAA8C;AAC9C,SAAsB,iBAAiB,CACrC,MAA2B,EAC3B,UAAU,GAAG,EAAE,EACf,IAAW;;QAEX,OAAO,IAAA,gCAAiB,EAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;IAChE,CAAC;CAAA;AAND,8CAMC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
8
+ import { Tree } from '@angular-devkit/schematics';
9
+ import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
10
+ /** Create a base project used for testing. */
11
+ export declare function createTestProject(runner: SchematicTestRunner, projectType: 'application' | 'library', appOptions?: {}, tree?: Tree): Promise<UnitTestTree>;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.createTestProject = void 0;
13
+ /** Create a base project used for testing. */
14
+ function createTestProject(runner, projectType, appOptions = {}, tree) {
15
+ return __awaiter(this, void 0, void 0, function* () {
16
+ const workspaceTree = yield runner
17
+ .runExternalSchematicAsync('@schematics/angular', 'workspace', {
18
+ name: 'workspace',
19
+ version: '6.0.0',
20
+ newProjectRoot: 'projects',
21
+ }, tree)
22
+ .toPromise();
23
+ return runner
24
+ .runExternalSchematicAsync('@schematics/angular', projectType, Object.assign({ name: 'material' }, appOptions), workspaceTree)
25
+ .toPromise();
26
+ });
27
+ }
28
+ exports.createTestProject = createTestProject;
29
+ //# sourceMappingURL=test-project.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-project.js","sourceRoot":"","sources":["../../../../../libs/wordlist-generator/schematics/testing/test-project.ts"],"names":[],"mappings":";;;;;;;;;;;;AAWA,8CAA8C;AAC9C,SAAsB,iBAAiB,CACrC,MAA2B,EAC3B,WAAsC,EACtC,UAAU,GAAG,EAAE,EACf,IAAW;;QAEX,MAAM,aAAa,GAAG,MAAM,MAAM;aAC/B,yBAAyB,CACxB,qBAAqB,EACrB,WAAW,EACX;YACE,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,OAAO;YAChB,cAAc,EAAE,UAAU;SAC3B,EACD,IAAI,CACL;aACA,SAAS,EAAE,CAAC;QAEf,OAAO,MAAM;aACV,yBAAyB,CACxB,qBAAqB,EACrB,WAAW,kBACV,IAAI,EAAE,UAAU,IAAK,UAAU,GAChC,aAAa,CACd;aACA,SAAS,EAAE,CAAC;IACjB,CAAC;CAAA;AA3BD,8CA2BC"}