@po-ui/ng-schematics 6.14.0 → 14.0.0-next.0

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.
Files changed (46) hide show
  1. package/README.md +5 -5
  2. package/build-component/build-component.d.ts +3 -3
  3. package/build-component/build-component.js +86 -86
  4. package/build-component/index.d.ts +2 -2
  5. package/build-component/index.js +18 -18
  6. package/build-component/schema.d.ts +34 -34
  7. package/build-component/schema.js +2 -2
  8. package/build-file/build-file.d.ts +3 -3
  9. package/build-file/build-file.js +33 -33
  10. package/build-file/file-options.interface.d.ts +16 -16
  11. package/build-file/file-options.interface.js +2 -2
  12. package/build-file/index.d.ts +2 -2
  13. package/build-file/index.js +18 -18
  14. package/build-target-options/asset-specification.interface.d.ts +21 -21
  15. package/build-target-options/asset-specification.interface.js +2 -2
  16. package/build-target-options/build-target-options.d.ts +7 -7
  17. package/build-target-options/build-target-options.js +37 -37
  18. package/build-target-options/index.d.ts +2 -2
  19. package/build-target-options/index.js +18 -18
  20. package/index.d.ts +7 -7
  21. package/index.js +23 -23
  22. package/module/index.d.ts +1 -1
  23. package/module/index.js +17 -17
  24. package/module/module.d.ts +15 -15
  25. package/module/module.js +128 -128
  26. package/package-config/index.d.ts +2 -2
  27. package/package-config/index.js +18 -18
  28. package/package-config/package-config.d.ts +12 -12
  29. package/package-config/package-config.js +70 -70
  30. package/package-config/update-dependencies.interface.d.ts +7 -7
  31. package/package-config/update-dependencies.interface.js +2 -2
  32. package/package.json +25 -25
  33. package/po-ui-ng-schematics-14.0.0-next.0.tgz +0 -0
  34. package/project/index.d.ts +1 -1
  35. package/project/index.js +17 -17
  36. package/project/project.d.ts +9 -9
  37. package/project/project.js +61 -61
  38. package/replace/index.d.ts +1 -1
  39. package/replace/index.js +17 -17
  40. package/replace/replace.d.ts +13 -13
  41. package/replace/replace.js +28 -28
  42. package/utils/index.d.ts +1 -1
  43. package/utils/index.js +17 -17
  44. package/utils/supported-css-extensions.d.ts +1 -1
  45. package/utils/supported-css-extensions.js +4 -4
  46. package/po-ui-ng-schematics-6.14.0.tgz +0 -0
@@ -1,71 +1,71 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sortObjectByKeys = exports.getPackageVersionFromPackageJson = exports.updatePackageJson = exports.addPackageToPackageJson = void 0;
4
- /** Adds a package to the package.json in the given host tree. */
5
- function addPackageToPackageJson(host, pkg, version) {
6
- if (host.exists('package.json')) {
7
- const sourceText = host.read('package.json').toString('utf-8');
8
- const json = JSON.parse(sourceText);
9
- if (!json.dependencies) {
10
- json.dependencies = {};
11
- }
12
- if (!json.dependencies[pkg]) {
13
- json.dependencies[pkg] = version;
14
- json.dependencies = sortObjectByKeys(json.dependencies);
15
- }
16
- host.overwrite('package.json', JSON.stringify(json, null, 2));
17
- }
18
- return host;
19
- }
20
- exports.addPackageToPackageJson = addPackageToPackageJson;
21
- // Atualiza os pacotes pela versão
22
- function updatePackageJson(version, { dependencies, devDependencies }) {
23
- return (tree) => {
24
- if (tree.exists('package.json')) {
25
- const sourceText = tree.read('package.json').toString('utf-8');
26
- const json = JSON.parse(sourceText);
27
- if (!json.dependencies) {
28
- json.dependencies = {};
29
- }
30
- dependencies === null || dependencies === void 0 ? void 0 : dependencies.forEach(pkg => {
31
- if (json.dependencies[pkg]) {
32
- json.dependencies[pkg] = version;
33
- }
34
- });
35
- devDependencies === null || devDependencies === void 0 ? void 0 : devDependencies.forEach(devDependency => {
36
- const updatedDependency = typeof devDependency === 'object' ? devDependency : { package: devDependency, version };
37
- if (json.devDependencies[updatedDependency.package]) {
38
- json.devDependencies[updatedDependency.package] = updatedDependency.version;
39
- }
40
- });
41
- json.dependencies = sortObjectByKeys(json.dependencies);
42
- json.devDependencies = sortObjectByKeys(json.devDependencies);
43
- tree.overwrite('package.json', JSON.stringify(json, null, 2));
44
- }
45
- return tree;
46
- };
47
- }
48
- exports.updatePackageJson = updatePackageJson;
49
- /** Gets the version of the specified package by looking at the package.json in the given tree. */
50
- function getPackageVersionFromPackageJson(tree, name) {
51
- if (!tree.exists('package.json')) {
52
- return null;
53
- }
54
- const packageJson = JSON.parse(tree.read('package.json').toString('utf8'));
55
- if (packageJson.dependencies && packageJson.dependencies[name]) {
56
- return packageJson.dependencies[name];
57
- }
58
- return null;
59
- }
60
- exports.getPackageVersionFromPackageJson = getPackageVersionFromPackageJson;
61
- /**
62
- * Sorts the keys of the given object.
63
- * @returns A new object instance with sorted keys
64
- */
65
- function sortObjectByKeys(obj) {
66
- return Object.keys(obj)
67
- .sort()
68
- .reduce((result, key) => (result[key] = obj[key]) && result, {});
69
- }
70
- exports.sortObjectByKeys = sortObjectByKeys;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sortObjectByKeys = exports.getPackageVersionFromPackageJson = exports.updatePackageJson = exports.addPackageToPackageJson = void 0;
4
+ /** Adds a package to the package.json in the given host tree. */
5
+ function addPackageToPackageJson(host, pkg, version) {
6
+ if (host.exists('package.json')) {
7
+ const sourceText = host.read('package.json').toString('utf-8');
8
+ const json = JSON.parse(sourceText);
9
+ if (!json.dependencies) {
10
+ json.dependencies = {};
11
+ }
12
+ if (!json.dependencies[pkg]) {
13
+ json.dependencies[pkg] = version;
14
+ json.dependencies = sortObjectByKeys(json.dependencies);
15
+ }
16
+ host.overwrite('package.json', JSON.stringify(json, null, 2));
17
+ }
18
+ return host;
19
+ }
20
+ exports.addPackageToPackageJson = addPackageToPackageJson;
21
+ // Atualiza os pacotes pela versão
22
+ function updatePackageJson(version, { dependencies, devDependencies }) {
23
+ return (tree) => {
24
+ if (tree.exists('package.json')) {
25
+ const sourceText = tree.read('package.json').toString('utf-8');
26
+ const json = JSON.parse(sourceText);
27
+ if (!json.dependencies) {
28
+ json.dependencies = {};
29
+ }
30
+ dependencies === null || dependencies === void 0 ? void 0 : dependencies.forEach(pkg => {
31
+ if (json.dependencies[pkg]) {
32
+ json.dependencies[pkg] = version;
33
+ }
34
+ });
35
+ devDependencies === null || devDependencies === void 0 ? void 0 : devDependencies.forEach(devDependency => {
36
+ const updatedDependency = typeof devDependency === 'object' ? devDependency : { package: devDependency, version };
37
+ if (json.devDependencies[updatedDependency.package]) {
38
+ json.devDependencies[updatedDependency.package] = updatedDependency.version;
39
+ }
40
+ });
41
+ json.dependencies = sortObjectByKeys(json.dependencies);
42
+ json.devDependencies = sortObjectByKeys(json.devDependencies);
43
+ tree.overwrite('package.json', JSON.stringify(json, null, 2));
44
+ }
45
+ return tree;
46
+ };
47
+ }
48
+ exports.updatePackageJson = updatePackageJson;
49
+ /** Gets the version of the specified package by looking at the package.json in the given tree. */
50
+ function getPackageVersionFromPackageJson(tree, name) {
51
+ if (!tree.exists('package.json')) {
52
+ return null;
53
+ }
54
+ const packageJson = JSON.parse(tree.read('package.json').toString('utf8'));
55
+ if (packageJson.dependencies && packageJson.dependencies[name]) {
56
+ return packageJson.dependencies[name];
57
+ }
58
+ return null;
59
+ }
60
+ exports.getPackageVersionFromPackageJson = getPackageVersionFromPackageJson;
61
+ /**
62
+ * Sorts the keys of the given object.
63
+ * @returns A new object instance with sorted keys
64
+ */
65
+ function sortObjectByKeys(obj) {
66
+ return Object.keys(obj)
67
+ .sort()
68
+ .reduce((result, key) => (result[key] = obj[key]) && result, {});
69
+ }
70
+ exports.sortObjectByKeys = sortObjectByKeys;
71
71
  //# sourceMappingURL=package-config.js.map
@@ -1,7 +1,7 @@
1
- export interface UpdateDependencies {
2
- dependencies: Array<string>;
3
- devDependencies?: Array<string | {
4
- package: string;
5
- version: string;
6
- }>;
7
- }
1
+ export interface UpdateDependencies {
2
+ dependencies: Array<string>;
3
+ devDependencies?: Array<string | {
4
+ package: string;
5
+ version: string;
6
+ }>;
7
+ }
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=update-dependencies.interface.js.map
package/package.json CHANGED
@@ -1,25 +1,25 @@
1
- {
2
- "name": "@po-ui/ng-schematics",
3
- "version": "6.14.0",
4
- "tag": "next",
5
- "description": "PO UI - Schematics",
6
- "author": "PO UI",
7
- "license": "MIT",
8
- "homepage": "https://po-ui.io",
9
- "repository": {
10
- "type": "git",
11
- "url": "https://github.com/po-ui/po-angular"
12
- },
13
- "scripts": {
14
- "build": "gulp build:schematics:lib",
15
- "postbuild": "gulp replaceVersion && cd ../../dist/ng-schematics && npm pack"
16
- },
17
- "peerDependencies": {
18
- "@angular-devkit/core": "^13.0.2",
19
- "@angular-devkit/schematics": "^13.0.2",
20
- "@schematics/angular": "^13.0.2"
21
- },
22
- "dependencies": {
23
- "jsonc-parser": "^3.0.0"
24
- }
25
- }
1
+ {
2
+ "name": "@po-ui/ng-schematics",
3
+ "version": "14.0.0-next.0",
4
+ "tag": "next",
5
+ "description": "PO UI - Schematics",
6
+ "author": "PO UI",
7
+ "license": "MIT",
8
+ "homepage": "https://po-ui.io",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/po-ui/po-angular"
12
+ },
13
+ "scripts": {
14
+ "build": "gulp build:schematics:lib",
15
+ "postbuild": "gulp replaceVersion && cd ../../dist/ng-schematics && npm pack"
16
+ },
17
+ "peerDependencies": {
18
+ "@angular-devkit/core": "^14.0.2",
19
+ "@angular-devkit/schematics": "^14.0.2",
20
+ "@schematics/angular": "^14.0.2"
21
+ },
22
+ "dependencies": {
23
+ "jsonc-parser": "^3.0.0"
24
+ }
25
+ }
@@ -1 +1 @@
1
- export * from './project';
1
+ export * from './project';
package/project/index.js CHANGED
@@ -1,18 +1,18 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./project"), exports);
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./project"), exports);
18
18
  //# sourceMappingURL=index.js.map
@@ -1,9 +1,9 @@
1
- import { Tree } from '@angular-devkit/schematics';
2
- import { WorkspaceProject, WorkspaceSchema } from '@schematics/angular/utility/workspace-models';
3
- export declare function getWorkspaceConfigGracefully(tree: Tree): null | WorkspaceSchema;
4
- export declare function getProjectFromWorkspace(workspace: WorkspaceSchema, projectName?: string): WorkspaceProject;
5
- /** Resolves the architect options for the build target of the given project. */
6
- export declare function getProjectTargetOptions(project: WorkspaceProject, buildTarget: string): any;
7
- /** Looks for the main TypeScript file in the given project and returns its path. */
8
- export declare function getProjectMainFile(project: WorkspaceProject): string;
9
- export declare function getDefaultPath(project: WorkspaceProject): string;
1
+ import { Tree } from '@angular-devkit/schematics';
2
+ import { WorkspaceProject, WorkspaceSchema } from '@schematics/angular/utility/workspace-models';
3
+ export declare function getWorkspaceConfigGracefully(tree: Tree): null | WorkspaceSchema;
4
+ export declare function getProjectFromWorkspace(workspace: WorkspaceSchema, projectName?: string): WorkspaceProject;
5
+ /** Resolves the architect options for the build target of the given project. */
6
+ export declare function getProjectTargetOptions(project: WorkspaceProject, buildTarget: string): any;
7
+ /** Looks for the main TypeScript file in the given project and returns its path. */
8
+ export declare function getProjectMainFile(project: WorkspaceProject): string;
9
+ export declare function getDefaultPath(project: WorkspaceProject): string;
@@ -1,62 +1,62 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDefaultPath = exports.getProjectMainFile = exports.getProjectTargetOptions = exports.getProjectFromWorkspace = exports.getWorkspaceConfigGracefully = void 0;
4
- const jsonc_parser_1 = require("jsonc-parser");
5
- const schematics_1 = require("@angular-devkit/schematics");
6
- /** Name of the default Angular CLI workspace configuration files. */
7
- const defaultWorkspaceConfigPaths = ['/angular.json', '/.angular.json'];
8
- function getWorkspaceConfigGracefully(tree) {
9
- const path = defaultWorkspaceConfigPaths.find(filePath => tree.exists(filePath));
10
- const configBuffer = tree.read(path);
11
- if (!path || !configBuffer) {
12
- return null;
13
- }
14
- try {
15
- // Parse the workspace file as JSON5 which is also supported for CLI
16
- // workspace configurations.
17
- return (0, jsonc_parser_1.parse)(configBuffer.toString());
18
- }
19
- catch (e) {
20
- return null;
21
- }
22
- }
23
- exports.getWorkspaceConfigGracefully = getWorkspaceConfigGracefully;
24
- function getProjectFromWorkspace(workspace, projectName) {
25
- const project = workspace.projects[projectName || workspace.defaultProject];
26
- if (!project) {
27
- throw new schematics_1.SchematicsException(`Could not find project in workspace: ${projectName}`);
28
- }
29
- return project;
30
- }
31
- exports.getProjectFromWorkspace = getProjectFromWorkspace;
32
- /** Resolves the architect options for the build target of the given project. */
33
- function getProjectTargetOptions(project, buildTarget) {
34
- if (project.targets && project.targets[buildTarget] && project.targets[buildTarget].options) {
35
- return project.targets[buildTarget].options;
36
- }
37
- // TODO(devversion): consider removing this architect check if the CLI completely switched
38
- // over to `targets`, and the `architect` support has been removed.
39
- // See: https://github.com/angular/angular-cli/commit/307160806cb48c95ecb8982854f452303801ac9f
40
- if (project.architect && project.architect[buildTarget] && project.architect[buildTarget].options) {
41
- return project.architect[buildTarget].options;
42
- }
43
- return console.warn(`Cannot determine project target configuration for: ${buildTarget}.`);
44
- }
45
- exports.getProjectTargetOptions = getProjectTargetOptions;
46
- /** Looks for the main TypeScript file in the given project and returns its path. */
47
- function getProjectMainFile(project) {
48
- const buildOptions = getProjectTargetOptions(project, 'build');
49
- if (!buildOptions.main) {
50
- throw new schematics_1.SchematicsException(`Could not find the project main file inside of the ` + `workspace config (${project.sourceRoot})`);
51
- }
52
- return buildOptions.main;
53
- }
54
- exports.getProjectMainFile = getProjectMainFile;
55
- // Return default path of application or library
56
- function getDefaultPath(project) {
57
- const root = project.sourceRoot ? `/${project.sourceRoot}/` : `/${project.root}/src/`;
58
- const projectDirName = project.projectType === 'application' ? 'app' : 'lib';
59
- return `${root}${projectDirName}`;
60
- }
61
- exports.getDefaultPath = getDefaultPath;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDefaultPath = exports.getProjectMainFile = exports.getProjectTargetOptions = exports.getProjectFromWorkspace = exports.getWorkspaceConfigGracefully = void 0;
4
+ const jsonc_parser_1 = require("jsonc-parser");
5
+ const schematics_1 = require("@angular-devkit/schematics");
6
+ /** Name of the default Angular CLI workspace configuration files. */
7
+ const defaultWorkspaceConfigPaths = ['/angular.json', '/.angular.json'];
8
+ function getWorkspaceConfigGracefully(tree) {
9
+ const path = defaultWorkspaceConfigPaths.find(filePath => tree.exists(filePath));
10
+ const configBuffer = tree.read(path);
11
+ if (!path || !configBuffer) {
12
+ return null;
13
+ }
14
+ try {
15
+ // Parse the workspace file as JSON5 which is also supported for CLI
16
+ // workspace configurations.
17
+ return (0, jsonc_parser_1.parse)(configBuffer.toString());
18
+ }
19
+ catch (e) {
20
+ return null;
21
+ }
22
+ }
23
+ exports.getWorkspaceConfigGracefully = getWorkspaceConfigGracefully;
24
+ function getProjectFromWorkspace(workspace, projectName) {
25
+ const project = workspace.projects[projectName || workspace.defaultProject];
26
+ if (!project) {
27
+ throw new schematics_1.SchematicsException(`Could not find project in workspace: ${projectName}`);
28
+ }
29
+ return project;
30
+ }
31
+ exports.getProjectFromWorkspace = getProjectFromWorkspace;
32
+ /** Resolves the architect options for the build target of the given project. */
33
+ function getProjectTargetOptions(project, buildTarget) {
34
+ if (project.targets && project.targets[buildTarget] && project.targets[buildTarget].options) {
35
+ return project.targets[buildTarget].options;
36
+ }
37
+ // TODO(devversion): consider removing this architect check if the CLI completely switched
38
+ // over to `targets`, and the `architect` support has been removed.
39
+ // See: https://github.com/angular/angular-cli/commit/307160806cb48c95ecb8982854f452303801ac9f
40
+ if (project.architect && project.architect[buildTarget] && project.architect[buildTarget].options) {
41
+ return project.architect[buildTarget].options;
42
+ }
43
+ return console.warn(`Cannot determine project target configuration for: ${buildTarget}.`);
44
+ }
45
+ exports.getProjectTargetOptions = getProjectTargetOptions;
46
+ /** Looks for the main TypeScript file in the given project and returns its path. */
47
+ function getProjectMainFile(project) {
48
+ const buildOptions = getProjectTargetOptions(project, 'build');
49
+ if (!buildOptions.main) {
50
+ throw new schematics_1.SchematicsException(`Could not find the project main file inside of the ` + `workspace config (${project.sourceRoot})`);
51
+ }
52
+ return buildOptions.main;
53
+ }
54
+ exports.getProjectMainFile = getProjectMainFile;
55
+ // Return default path of application or library
56
+ function getDefaultPath(project) {
57
+ const root = project.sourceRoot ? `/${project.sourceRoot}/` : `/${project.root}/src/`;
58
+ const projectDirName = project.projectType === 'application' ? 'app' : 'lib';
59
+ return `${root}${projectDirName}`;
60
+ }
61
+ exports.getDefaultPath = getDefaultPath;
62
62
  //# sourceMappingURL=project.js.map
@@ -1 +1 @@
1
- export * from './replace';
1
+ export * from './replace';
package/replace/index.js CHANGED
@@ -1,18 +1,18 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./replace"), exports);
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./replace"), exports);
18
18
  //# sourceMappingURL=index.js.map
@@ -1,13 +1,13 @@
1
- import { Tree } from '@angular-devkit/schematics';
2
- /** Interface dos dados que serão substituidos. */
3
- export interface ReplaceChanges {
4
- replace: string | RegExp;
5
- replaceWith: string | Function;
6
- }
7
- /**
8
- * Método responsável por realizar as substituições no arquivo informado.
9
- *
10
- * @param file Arquivo que sofrerá a alteração
11
- * @param changes Lista de objetos que possuem
12
- */
13
- export declare function replaceInFile(file: string, changes?: Array<ReplaceChanges>): (tree: Tree) => import("@angular-devkit/schematics/src/tree/interface").Tree;
1
+ import { Tree } from '@angular-devkit/schematics';
2
+ /** Interface dos dados que serão substituidos. */
3
+ export interface ReplaceChanges {
4
+ replace: string | RegExp;
5
+ replaceWith: string | Function;
6
+ }
7
+ /**
8
+ * Método responsável por realizar as substituições no arquivo informado.
9
+ *
10
+ * @param file Arquivo que sofrerá a alteração
11
+ * @param changes Lista de objetos que possuem
12
+ */
13
+ export declare function replaceInFile(file: string, changes?: Array<ReplaceChanges>): (tree: Tree) => import("@angular-devkit/schematics/src/tree/interface").Tree;
@@ -1,29 +1,29 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.replaceInFile = void 0;
4
- /**
5
- * Método responsável por realizar as substituições no arquivo informado.
6
- *
7
- * @param file Arquivo que sofrerá a alteração
8
- * @param changes Lista de objetos que possuem
9
- */
10
- function replaceInFile(file, changes = []) {
11
- return (tree) => {
12
- if (tree.exists(file)) {
13
- const sourceText = tree.read(file).toString('utf-8');
14
- let updated = sourceText;
15
- if (updated) {
16
- changes.forEach(replaceChange => {
17
- // força a tipagem para string pois o ts não reconhece a função no String.replace
18
- updated = updated.replace(replaceChange.replace, replaceChange.replaceWith);
19
- });
20
- }
21
- if (updated !== sourceText) {
22
- tree.overwrite(file, updated);
23
- }
24
- }
25
- return tree;
26
- };
27
- }
28
- exports.replaceInFile = replaceInFile;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.replaceInFile = void 0;
4
+ /**
5
+ * Método responsável por realizar as substituições no arquivo informado.
6
+ *
7
+ * @param file Arquivo que sofrerá a alteração
8
+ * @param changes Lista de objetos que possuem
9
+ */
10
+ function replaceInFile(file, changes = []) {
11
+ return (tree) => {
12
+ if (tree.exists(file)) {
13
+ const sourceText = tree.read(file).toString('utf-8');
14
+ let updated = sourceText;
15
+ if (updated) {
16
+ changes.forEach(replaceChange => {
17
+ // força a tipagem para string pois o ts não reconhece a função no String.replace
18
+ updated = updated.replace(replaceChange.replace, replaceChange.replaceWith);
19
+ });
20
+ }
21
+ if (updated !== sourceText) {
22
+ tree.overwrite(file, updated);
23
+ }
24
+ }
25
+ return tree;
26
+ };
27
+ }
28
+ exports.replaceInFile = replaceInFile;
29
29
  //# sourceMappingURL=replace.js.map
package/utils/index.d.ts CHANGED
@@ -1 +1 @@
1
- export * from './supported-css-extensions';
1
+ export * from './supported-css-extensions';
package/utils/index.js CHANGED
@@ -1,18 +1,18 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./supported-css-extensions"), exports);
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./supported-css-extensions"), exports);
18
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- export declare const supportedCssExtensions: string[];
1
+ export declare const supportedCssExtensions: string[];
@@ -1,5 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.supportedCssExtensions = void 0;
4
- exports.supportedCssExtensions = ['css', 'scss', 'less', 'styl'];
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.supportedCssExtensions = void 0;
4
+ exports.supportedCssExtensions = ['css', 'scss', 'less', 'styl'];
5
5
  //# sourceMappingURL=supported-css-extensions.js.map
Binary file