ag-schematics 0.0.1
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/README.md +70 -0
- package/dist/adr/files/__number__-__slug__.md.template +19 -0
- package/dist/adr/index.d.ts +8 -0
- package/dist/adr/index.js +19 -0
- package/dist/adr/index.js.map +1 -0
- package/dist/adr/schema.json +24 -0
- package/dist/collection.json +56 -0
- package/dist/components/header/index.d.ts +6 -0
- package/dist/components/header/index.js +17 -0
- package/dist/components/header/index.js.map +1 -0
- package/dist/docker-config/files/Dockerfile.template +15 -0
- package/dist/docker-config/files/compose.yaml.template +10 -0
- package/dist/docker-config/files/nginx.conf.template +35 -0
- package/dist/docker-config/index.d.ts +8 -0
- package/dist/docker-config/index.js +16 -0
- package/dist/docker-config/index.js.map +1 -0
- package/dist/docker-config/schema.json +24 -0
- package/dist/gitignore-config/files/.gitignore.template +42 -0
- package/dist/gitignore-config/index.d.ts +5 -0
- package/dist/gitignore-config/index.js +16 -0
- package/dist/gitignore-config/index.js.map +1 -0
- package/dist/gitignore-config/schema.json +8 -0
- package/dist/k8s-config/files/k8s/deployment.yaml.template +22 -0
- package/dist/k8s-config/files/k8s/ingress.yaml.template +17 -0
- package/dist/k8s-config/files/k8s/service.yaml.template +14 -0
- package/dist/k8s-config/index.d.ts +10 -0
- package/dist/k8s-config/index.js +21 -0
- package/dist/k8s-config/index.js.map +1 -0
- package/dist/k8s-config/schema.json +34 -0
- package/dist/lint-config/files/.editorconfig.template +17 -0
- package/dist/lint-config/files/.eslintignore.template +2 -0
- package/dist/lint-config/files/.eslintrc.json.template +61 -0
- package/dist/lint-config/files/.prettierignore.template +47 -0
- package/dist/lint-config/files/.prettierrc.json.template +11 -0
- package/dist/lint-config/index.d.ts +5 -0
- package/dist/lint-config/index.js +90 -0
- package/dist/lint-config/index.js.map +1 -0
- package/dist/lint-config/schema.json +8 -0
- package/dist/npm-config/files/.nvmrc.template +1 -0
- package/dist/npm-config/index.d.ts +5 -0
- package/dist/npm-config/index.js +16 -0
- package/dist/npm-config/index.js.map +1 -0
- package/dist/npm-config/schema.json +8 -0
- package/dist/orval-config/files/openapi.yaml.template +0 -0
- package/dist/orval-config/files/orval.config.ts.template +24 -0
- package/dist/orval-config/index.d.ts +5 -0
- package/dist/orval-config/index.js +23 -0
- package/dist/orval-config/index.js.map +1 -0
- package/dist/orval-config/schema.json +8 -0
- package/dist/otel-config/files/otel-config.yaml.template +16 -0
- package/dist/otel-config/index.d.ts +5 -0
- package/dist/otel-config/index.js +98 -0
- package/dist/otel-config/index.js.map +1 -0
- package/dist/otel-config/schema.json +8 -0
- package/dist/sonar-config/files/sonar-project.properties.template +7 -0
- package/dist/sonar-config/index.d.ts +8 -0
- package/dist/sonar-config/index.js +16 -0
- package/dist/sonar-config/index.js.map +1 -0
- package/dist/sonar-config/schema.json +24 -0
- package/dist/utils/dependency-shortcuts.d.ts +2 -0
- package/dist/utils/dependency-shortcuts.js +20 -0
- package/dist/utils/dependency-shortcuts.js.map +1 -0
- package/dist/utils/dependency.d.ts +142 -0
- package/dist/utils/dependency.js +213 -0
- package/dist/utils/dependency.js.map +1 -0
- package/dist/utils/eol.d.ts +8 -0
- package/dist/utils/eol.js +23 -0
- package/dist/utils/eol.js.map +1 -0
- package/dist/utils/json-file.d.ts +24 -0
- package/dist/utils/json-file.js +78 -0
- package/dist/utils/json-file.js.map +1 -0
- package/dist/utils/script.d.ts +2 -0
- package/dist/utils/script.js +17 -0
- package/dist/utils/script.js.map +1 -0
- package/dist/versions.d.ts +6 -0
- package/dist/versions.js +10 -0
- package/dist/versions.js.map +1 -0
- package/package.json +34 -0
|
@@ -0,0 +1,142 @@
|
|
|
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.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import { Rule, Tree } from '@angular-devkit/schematics';
|
|
9
|
+
/**
|
|
10
|
+
* An enum used to specify the type of a dependency found within a package manifest
|
|
11
|
+
* file (`package.json`).
|
|
12
|
+
*/
|
|
13
|
+
export declare enum DependencyType {
|
|
14
|
+
Default = "dependencies",
|
|
15
|
+
Dev = "devDependencies",
|
|
16
|
+
Peer = "peerDependencies"
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* An enum used to specify the dependency installation behavior for the {@link addDependency}
|
|
20
|
+
* schematics rule. The installation behavior affects if and when {@link NodePackageInstallTask}
|
|
21
|
+
* will be scheduled when using the rule.
|
|
22
|
+
*/
|
|
23
|
+
export declare enum InstallBehavior {
|
|
24
|
+
/**
|
|
25
|
+
* No installation will occur as a result of the rule when specified.
|
|
26
|
+
*
|
|
27
|
+
* NOTE: This does not prevent other rules from scheduling a {@link NodePackageInstallTask}
|
|
28
|
+
* which may install the dependency.
|
|
29
|
+
*/
|
|
30
|
+
None = 0,
|
|
31
|
+
/**
|
|
32
|
+
* Automatically determine the need to schedule a {@link NodePackageInstallTask} based on
|
|
33
|
+
* previous usage of the {@link addDependency} within the schematic.
|
|
34
|
+
*/
|
|
35
|
+
Auto = 1,
|
|
36
|
+
/**
|
|
37
|
+
* Always schedule a {@link NodePackageInstallTask} when the rule is executed.
|
|
38
|
+
*/
|
|
39
|
+
Always = 2
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* An enum used to specify the existing dependency behavior for the {@link addDependency}
|
|
43
|
+
* schematics rule. The existing behavior affects whether the named dependency will be added
|
|
44
|
+
* to the `package.json` when the dependency is already present with a differing specifier.
|
|
45
|
+
*/
|
|
46
|
+
export declare enum ExistingBehavior {
|
|
47
|
+
/**
|
|
48
|
+
* The dependency will not be added or otherwise changed if it already exists.
|
|
49
|
+
*/
|
|
50
|
+
Skip = 0,
|
|
51
|
+
/**
|
|
52
|
+
* The dependency's existing specifier will be replaced with the specifier provided in the
|
|
53
|
+
* {@link addDependency} call. A warning will also be shown during schematic execution to
|
|
54
|
+
* notify the user of the replacement.
|
|
55
|
+
*/
|
|
56
|
+
Replace = 1
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Represents a dependency found in a package manifest.
|
|
60
|
+
*/
|
|
61
|
+
export interface Dependency {
|
|
62
|
+
/**
|
|
63
|
+
* The type of the dependency.
|
|
64
|
+
*/
|
|
65
|
+
type: DependencyType;
|
|
66
|
+
/**
|
|
67
|
+
* The name of the package.
|
|
68
|
+
*/
|
|
69
|
+
name: string;
|
|
70
|
+
/**
|
|
71
|
+
* The version specifier of the package.
|
|
72
|
+
*/
|
|
73
|
+
version: string;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Gets information about a dependency from a `package.json` file.
|
|
77
|
+
*
|
|
78
|
+
* @param tree The schematic's virtual file system representation.
|
|
79
|
+
* @param name The name of the package to check.
|
|
80
|
+
* @param packageJsonPath The path to the `package.json` file. Defaults to `/package.json`.
|
|
81
|
+
* @returns An object containing the dependency's type and version, or null if not found.
|
|
82
|
+
*/
|
|
83
|
+
export declare function getDependency(tree: Tree, name: string, packageJsonPath?: string): Dependency | null;
|
|
84
|
+
/**
|
|
85
|
+
* Adds a package as a dependency to a `package.json`. By default the `package.json` located
|
|
86
|
+
* at the schematic's root will be used. The `manifestPath` option can be used to explicitly specify
|
|
87
|
+
* a `package.json` in different location. The type of the dependency can also be specified instead
|
|
88
|
+
* of the default of the `dependencies` section by using the `type` option for either `devDependencies`
|
|
89
|
+
* or `peerDependencies`.
|
|
90
|
+
*
|
|
91
|
+
* When using this rule, {@link NodePackageInstallTask} does not need to be included directly by
|
|
92
|
+
* a schematic. A package manager install task will be automatically scheduled as needed.
|
|
93
|
+
*
|
|
94
|
+
* @param name The name of the package to add.
|
|
95
|
+
* @param specifier The package specifier for the package to add. Typically a SemVer range.
|
|
96
|
+
* @param options An optional object that can contain the `type` of the dependency
|
|
97
|
+
* and/or a path (`packageJsonPath`) of a manifest file (`package.json`) to modify.
|
|
98
|
+
* @returns A Schematics {@link Rule}
|
|
99
|
+
*/
|
|
100
|
+
export declare function addDependency(name: string, specifier: string, options?: {
|
|
101
|
+
/**
|
|
102
|
+
* The type of the dependency determines the section of the `package.json` to which the
|
|
103
|
+
* dependency will be added. Defaults to {@link DependencyType.Default} (`dependencies`).
|
|
104
|
+
*/
|
|
105
|
+
type?: DependencyType;
|
|
106
|
+
/**
|
|
107
|
+
* The path of the package manifest file (`package.json`) that will be modified.
|
|
108
|
+
* Defaults to `/package.json`.
|
|
109
|
+
*/
|
|
110
|
+
packageJsonPath?: string;
|
|
111
|
+
/**
|
|
112
|
+
* The dependency installation behavior to use to determine whether a
|
|
113
|
+
* {@link NodePackageInstallTask} should be scheduled after adding the dependency.
|
|
114
|
+
* Defaults to {@link InstallBehavior.Auto}.
|
|
115
|
+
*/
|
|
116
|
+
install?: InstallBehavior;
|
|
117
|
+
/**
|
|
118
|
+
* The behavior to use when the dependency already exists within the `package.json`.
|
|
119
|
+
* Defaults to {@link ExistingBehavior.Replace}.
|
|
120
|
+
*/
|
|
121
|
+
existing?: ExistingBehavior;
|
|
122
|
+
}): Rule;
|
|
123
|
+
/**
|
|
124
|
+
* Removes a package from the package.json in the project root.
|
|
125
|
+
*
|
|
126
|
+
* @param name The name of the package to remove.
|
|
127
|
+
* @param options An optional object that can contain a path of a manifest file to modify.
|
|
128
|
+
* @returns A Schematics {@link Rule}
|
|
129
|
+
*/
|
|
130
|
+
export declare function removeDependency(name: string, options?: {
|
|
131
|
+
/**
|
|
132
|
+
* The path of the package manifest file (`package.json`) that will be modified.
|
|
133
|
+
* Defaults to `/package.json`.
|
|
134
|
+
*/
|
|
135
|
+
packageJsonPath?: string;
|
|
136
|
+
/**
|
|
137
|
+
* The dependency installation behavior to use to determine whether a
|
|
138
|
+
* {@link NodePackageInstallTask} should be scheduled after removing the dependency.
|
|
139
|
+
* Defaults to {@link InstallBehavior.Auto}.
|
|
140
|
+
*/
|
|
141
|
+
install?: InstallBehavior;
|
|
142
|
+
}): Rule;
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
+
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
26
|
+
var ownKeys = function(o) {
|
|
27
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
28
|
+
var ar = [];
|
|
29
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30
|
+
return ar;
|
|
31
|
+
};
|
|
32
|
+
return ownKeys(o);
|
|
33
|
+
};
|
|
34
|
+
return function (mod) {
|
|
35
|
+
if (mod && mod.__esModule) return mod;
|
|
36
|
+
var result = {};
|
|
37
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
38
|
+
__setModuleDefault(result, mod);
|
|
39
|
+
return result;
|
|
40
|
+
};
|
|
41
|
+
})();
|
|
42
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
+
exports.ExistingBehavior = exports.InstallBehavior = exports.DependencyType = void 0;
|
|
44
|
+
exports.getDependency = getDependency;
|
|
45
|
+
exports.addDependency = addDependency;
|
|
46
|
+
exports.removeDependency = removeDependency;
|
|
47
|
+
const tasks_1 = require("@angular-devkit/schematics/tasks");
|
|
48
|
+
const path = __importStar(require("node:path"));
|
|
49
|
+
const installTasks = new WeakMap();
|
|
50
|
+
/**
|
|
51
|
+
* An enum used to specify the type of a dependency found within a package manifest
|
|
52
|
+
* file (`package.json`).
|
|
53
|
+
*/
|
|
54
|
+
var DependencyType;
|
|
55
|
+
(function (DependencyType) {
|
|
56
|
+
DependencyType["Default"] = "dependencies";
|
|
57
|
+
DependencyType["Dev"] = "devDependencies";
|
|
58
|
+
DependencyType["Peer"] = "peerDependencies";
|
|
59
|
+
})(DependencyType || (exports.DependencyType = DependencyType = {}));
|
|
60
|
+
/**
|
|
61
|
+
* An enum used to specify the dependency installation behavior for the {@link addDependency}
|
|
62
|
+
* schematics rule. The installation behavior affects if and when {@link NodePackageInstallTask}
|
|
63
|
+
* will be scheduled when using the rule.
|
|
64
|
+
*/
|
|
65
|
+
var InstallBehavior;
|
|
66
|
+
(function (InstallBehavior) {
|
|
67
|
+
/**
|
|
68
|
+
* No installation will occur as a result of the rule when specified.
|
|
69
|
+
*
|
|
70
|
+
* NOTE: This does not prevent other rules from scheduling a {@link NodePackageInstallTask}
|
|
71
|
+
* which may install the dependency.
|
|
72
|
+
*/
|
|
73
|
+
InstallBehavior[InstallBehavior["None"] = 0] = "None";
|
|
74
|
+
/**
|
|
75
|
+
* Automatically determine the need to schedule a {@link NodePackageInstallTask} based on
|
|
76
|
+
* previous usage of the {@link addDependency} within the schematic.
|
|
77
|
+
*/
|
|
78
|
+
InstallBehavior[InstallBehavior["Auto"] = 1] = "Auto";
|
|
79
|
+
/**
|
|
80
|
+
* Always schedule a {@link NodePackageInstallTask} when the rule is executed.
|
|
81
|
+
*/
|
|
82
|
+
InstallBehavior[InstallBehavior["Always"] = 2] = "Always";
|
|
83
|
+
})(InstallBehavior || (exports.InstallBehavior = InstallBehavior = {}));
|
|
84
|
+
/**
|
|
85
|
+
* An enum used to specify the existing dependency behavior for the {@link addDependency}
|
|
86
|
+
* schematics rule. The existing behavior affects whether the named dependency will be added
|
|
87
|
+
* to the `package.json` when the dependency is already present with a differing specifier.
|
|
88
|
+
*/
|
|
89
|
+
var ExistingBehavior;
|
|
90
|
+
(function (ExistingBehavior) {
|
|
91
|
+
/**
|
|
92
|
+
* The dependency will not be added or otherwise changed if it already exists.
|
|
93
|
+
*/
|
|
94
|
+
ExistingBehavior[ExistingBehavior["Skip"] = 0] = "Skip";
|
|
95
|
+
/**
|
|
96
|
+
* The dependency's existing specifier will be replaced with the specifier provided in the
|
|
97
|
+
* {@link addDependency} call. A warning will also be shown during schematic execution to
|
|
98
|
+
* notify the user of the replacement.
|
|
99
|
+
*/
|
|
100
|
+
ExistingBehavior[ExistingBehavior["Replace"] = 1] = "Replace";
|
|
101
|
+
})(ExistingBehavior || (exports.ExistingBehavior = ExistingBehavior = {}));
|
|
102
|
+
/**
|
|
103
|
+
* Gets information about a dependency from a `package.json` file.
|
|
104
|
+
*
|
|
105
|
+
* @param tree The schematic's virtual file system representation.
|
|
106
|
+
* @param name The name of the package to check.
|
|
107
|
+
* @param packageJsonPath The path to the `package.json` file. Defaults to `/package.json`.
|
|
108
|
+
* @returns An object containing the dependency's type and version, or null if not found.
|
|
109
|
+
*/
|
|
110
|
+
function getDependency(tree, name, packageJsonPath = '/package.json') {
|
|
111
|
+
const manifest = tree.readJson(packageJsonPath);
|
|
112
|
+
for (const type of [DependencyType.Default, DependencyType.Dev, DependencyType.Peer]) {
|
|
113
|
+
const section = manifest[type];
|
|
114
|
+
if (section === null || section === void 0 ? void 0 : section[name]) {
|
|
115
|
+
return {
|
|
116
|
+
type,
|
|
117
|
+
name,
|
|
118
|
+
version: section[name],
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Adds a package as a dependency to a `package.json`. By default the `package.json` located
|
|
126
|
+
* at the schematic's root will be used. The `manifestPath` option can be used to explicitly specify
|
|
127
|
+
* a `package.json` in different location. The type of the dependency can also be specified instead
|
|
128
|
+
* of the default of the `dependencies` section by using the `type` option for either `devDependencies`
|
|
129
|
+
* or `peerDependencies`.
|
|
130
|
+
*
|
|
131
|
+
* When using this rule, {@link NodePackageInstallTask} does not need to be included directly by
|
|
132
|
+
* a schematic. A package manager install task will be automatically scheduled as needed.
|
|
133
|
+
*
|
|
134
|
+
* @param name The name of the package to add.
|
|
135
|
+
* @param specifier The package specifier for the package to add. Typically a SemVer range.
|
|
136
|
+
* @param options An optional object that can contain the `type` of the dependency
|
|
137
|
+
* and/or a path (`packageJsonPath`) of a manifest file (`package.json`) to modify.
|
|
138
|
+
* @returns A Schematics {@link Rule}
|
|
139
|
+
*/
|
|
140
|
+
function addDependency(name, specifier, options = {}) {
|
|
141
|
+
const { type = DependencyType.Default, packageJsonPath = '/package.json', install = InstallBehavior.Auto, existing = ExistingBehavior.Replace, } = options;
|
|
142
|
+
return (tree, context) => {
|
|
143
|
+
var _a;
|
|
144
|
+
const manifest = tree.readJson(packageJsonPath);
|
|
145
|
+
const dependencySection = manifest[type];
|
|
146
|
+
if (!dependencySection) {
|
|
147
|
+
// Section is not present. The dependency can be added to a new object literal for the section.
|
|
148
|
+
manifest[type] = { [name]: specifier };
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
const existingSpecifier = dependencySection[name];
|
|
152
|
+
if (existingSpecifier === specifier) {
|
|
153
|
+
// Already present with same specifier
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
if (existingSpecifier) {
|
|
157
|
+
// Already present but different specifier
|
|
158
|
+
if (existing === ExistingBehavior.Skip) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
// ExistingBehavior.Replace is the only other behavior currently
|
|
162
|
+
context.logger.warn(`Package dependency "${name}" already exists with a different specifier. ` +
|
|
163
|
+
`"${existingSpecifier}" will be replaced with "${specifier}".`);
|
|
164
|
+
}
|
|
165
|
+
// Add new dependency in alphabetical order
|
|
166
|
+
const entries = Object.entries(dependencySection);
|
|
167
|
+
entries.push([name, specifier]);
|
|
168
|
+
entries.sort((a, b) => a[0].localeCompare(b[0]));
|
|
169
|
+
manifest[type] = Object.fromEntries(entries);
|
|
170
|
+
}
|
|
171
|
+
tree.overwrite(packageJsonPath, JSON.stringify(manifest, null, 2));
|
|
172
|
+
const installPaths = (_a = installTasks.get(context)) !== null && _a !== void 0 ? _a : new Set();
|
|
173
|
+
if (install === InstallBehavior.Always ||
|
|
174
|
+
(install === InstallBehavior.Auto && !installPaths.has(packageJsonPath))) {
|
|
175
|
+
context.addTask(new tasks_1.NodePackageInstallTask({ workingDirectory: path.dirname(packageJsonPath) }));
|
|
176
|
+
installPaths.add(packageJsonPath);
|
|
177
|
+
installTasks.set(context, installPaths);
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Removes a package from the package.json in the project root.
|
|
183
|
+
*
|
|
184
|
+
* @param name The name of the package to remove.
|
|
185
|
+
* @param options An optional object that can contain a path of a manifest file to modify.
|
|
186
|
+
* @returns A Schematics {@link Rule}
|
|
187
|
+
*/
|
|
188
|
+
function removeDependency(name, options = {}) {
|
|
189
|
+
const { packageJsonPath = '/package.json', install = InstallBehavior.Auto } = options;
|
|
190
|
+
return (tree, context) => {
|
|
191
|
+
var _a;
|
|
192
|
+
const manifest = tree.readJson(packageJsonPath);
|
|
193
|
+
let wasRemoved = false;
|
|
194
|
+
for (const type of [DependencyType.Default, DependencyType.Dev, DependencyType.Peer]) {
|
|
195
|
+
const dependencySection = manifest[type];
|
|
196
|
+
if (dependencySection === null || dependencySection === void 0 ? void 0 : dependencySection[name]) {
|
|
197
|
+
delete dependencySection[name];
|
|
198
|
+
wasRemoved = true;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
if (wasRemoved) {
|
|
202
|
+
tree.overwrite(packageJsonPath, JSON.stringify(manifest, null, 2));
|
|
203
|
+
const installPaths = (_a = installTasks.get(context)) !== null && _a !== void 0 ? _a : new Set();
|
|
204
|
+
if (install === InstallBehavior.Always ||
|
|
205
|
+
(install === InstallBehavior.Auto && !installPaths.has(packageJsonPath))) {
|
|
206
|
+
context.addTask(new tasks_1.NodePackageInstallTask({ workingDirectory: path.dirname(packageJsonPath) }));
|
|
207
|
+
installPaths.add(packageJsonPath);
|
|
208
|
+
installTasks.set(context, installPaths);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
//# sourceMappingURL=dependency.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependency.js","sourceRoot":"","sources":["../../src/utils/dependency.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiGH,sCAmBC;AAkBD,sCAuFC;AASD,4CA+CC;AAlRD,4DAA0E;AAC1E,gDAAkC;AAElC,MAAM,YAAY,GAAG,IAAI,OAAO,EAAiC,CAAC;AAQlE;;;GAGG;AACH,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,0CAAwB,CAAA;IACxB,yCAAuB,CAAA;IACvB,2CAAyB,CAAA;AAC3B,CAAC,EAJW,cAAc,8BAAd,cAAc,QAIzB;AAED;;;;GAIG;AACH,IAAY,eAmBX;AAnBD,WAAY,eAAe;IACzB;;;;;OAKG;IACH,qDAAI,CAAA;IAEJ;;;OAGG;IACH,qDAAI,CAAA;IAEJ;;OAEG;IACH,yDAAM,CAAA;AACR,CAAC,EAnBW,eAAe,+BAAf,eA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AAC,OAAO,CAAC,mCAAI,IAAI,GAAG,EAAU,CAAC;YACpE,IACE,OAAO,KAAK,eAAe,CAAC,MAAM;gBAClC,CAAC,OAAO,KAAK,eAAe,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,EACxE,CAAC;gBACD,OAAO,CAAC,OAAO,CACb,IAAI,8BAAsB,CAAC,EAAE,gBAAgB,EAAE,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC,CAChF,CAAC;gBACF,YAAY,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;gBAClC,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
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.dev/license
|
|
7
|
+
*/
|
|
8
|
+
export declare function getEOL(content: string): string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.getEOL = getEOL;
|
|
11
|
+
const node_os_1 = require("node:os");
|
|
12
|
+
const CRLF = '\r\n';
|
|
13
|
+
const LF = '\n';
|
|
14
|
+
function getEOL(content) {
|
|
15
|
+
const newlines = content.match(/(?:\r?\n)/g);
|
|
16
|
+
if (newlines === null || newlines === void 0 ? void 0 : newlines.length) {
|
|
17
|
+
const crlf = newlines.filter((l) => l === CRLF).length;
|
|
18
|
+
const lf = newlines.length - crlf;
|
|
19
|
+
return crlf > lf ? CRLF : LF;
|
|
20
|
+
}
|
|
21
|
+
return node_os_1.EOL;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=eol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eol.js","sourceRoot":"","sources":["../../src/utils/eol.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAOH,wBAWC;AAhBD,qCAA8B;AAE9B,MAAM,IAAI,GAAG,MAAM,CAAC;AACpB,MAAM,EAAE,GAAG,IAAI,CAAC;AAEhB,SAAgB,MAAM,CAAC,OAAe;IACpC,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAE7C,IAAI,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,EAAE,CAAC;QACrB,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,MAAM,CAAC;QACvD,MAAM,EAAE,GAAG,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC;QAElC,OAAO,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/B,CAAC;IAED,OAAO,aAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
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.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import { JsonValue } from '@angular-devkit/core';
|
|
9
|
+
import { Tree } from '@angular-devkit/schematics';
|
|
10
|
+
export type InsertionIndex = (properties: string[]) => number;
|
|
11
|
+
export type JSONPath = (string | number)[];
|
|
12
|
+
/** @private */
|
|
13
|
+
export declare class JSONFile {
|
|
14
|
+
private readonly host;
|
|
15
|
+
private readonly path;
|
|
16
|
+
content: string;
|
|
17
|
+
private eol;
|
|
18
|
+
constructor(host: Tree, path: string);
|
|
19
|
+
private _jsonAst;
|
|
20
|
+
private get JsonAst();
|
|
21
|
+
get(jsonPath: JSONPath): unknown;
|
|
22
|
+
modify(jsonPath: JSONPath, value: JsonValue | undefined, insertInOrder?: InsertionIndex | false): void;
|
|
23
|
+
remove(jsonPath: JSONPath): void;
|
|
24
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.JSONFile = void 0;
|
|
11
|
+
const jsonc_parser_1 = require("jsonc-parser");
|
|
12
|
+
const eol_1 = require("./eol");
|
|
13
|
+
/** @private */
|
|
14
|
+
class JSONFile {
|
|
15
|
+
constructor(host, path) {
|
|
16
|
+
this.host = host;
|
|
17
|
+
this.path = path;
|
|
18
|
+
this.content = this.host.readText(this.path);
|
|
19
|
+
this.eol = (0, eol_1.getEOL)(this.content);
|
|
20
|
+
}
|
|
21
|
+
get JsonAst() {
|
|
22
|
+
if (this._jsonAst) {
|
|
23
|
+
return this._jsonAst;
|
|
24
|
+
}
|
|
25
|
+
const errors = [];
|
|
26
|
+
this._jsonAst = (0, jsonc_parser_1.parseTree)(this.content, errors, { allowTrailingComma: true });
|
|
27
|
+
if (errors.length) {
|
|
28
|
+
const { error, offset } = errors[0];
|
|
29
|
+
throw new Error(`Failed to parse "${this.path}" as JSON AST Object. ${(0, jsonc_parser_1.printParseErrorCode)(error)} at location: ${offset}.`);
|
|
30
|
+
}
|
|
31
|
+
return this._jsonAst;
|
|
32
|
+
}
|
|
33
|
+
get(jsonPath) {
|
|
34
|
+
const jsonAstNode = this.JsonAst;
|
|
35
|
+
if (!jsonAstNode) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
if (jsonPath.length === 0) {
|
|
39
|
+
return (0, jsonc_parser_1.getNodeValue)(jsonAstNode);
|
|
40
|
+
}
|
|
41
|
+
const node = (0, jsonc_parser_1.findNodeAtLocation)(jsonAstNode, jsonPath);
|
|
42
|
+
return node === undefined ? undefined : (0, jsonc_parser_1.getNodeValue)(node);
|
|
43
|
+
}
|
|
44
|
+
modify(jsonPath, value, insertInOrder) {
|
|
45
|
+
let getInsertionIndex;
|
|
46
|
+
if (insertInOrder === undefined) {
|
|
47
|
+
const property = jsonPath.slice(-1)[0];
|
|
48
|
+
getInsertionIndex = (properties) => [...properties, property].sort().findIndex((p) => p === property);
|
|
49
|
+
}
|
|
50
|
+
else if (insertInOrder !== false) {
|
|
51
|
+
getInsertionIndex = insertInOrder;
|
|
52
|
+
}
|
|
53
|
+
const edits = (0, jsonc_parser_1.modify)(this.content, jsonPath, value, {
|
|
54
|
+
getInsertionIndex,
|
|
55
|
+
formattingOptions: {
|
|
56
|
+
eol: this.eol,
|
|
57
|
+
insertSpaces: true,
|
|
58
|
+
tabSize: 2,
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
if (edits.length > 0) {
|
|
62
|
+
const editedContent = (0, jsonc_parser_1.applyEdits)(this.content, edits);
|
|
63
|
+
// Update the file content if it changed
|
|
64
|
+
if (editedContent !== this.content) {
|
|
65
|
+
this.content = editedContent;
|
|
66
|
+
this.host.overwrite(this.path, editedContent);
|
|
67
|
+
this._jsonAst = undefined;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
remove(jsonPath) {
|
|
72
|
+
if (this.get(jsonPath) !== undefined) {
|
|
73
|
+
this.modify(jsonPath, undefined);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.JSONFile = JSONFile;
|
|
78
|
+
//# sourceMappingURL=json-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-file.js","sourceRoot":"","sources":["../../src/utils/json-file.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAIH,+CASsB;AACtB,+BAA+B;AAK/B,eAAe;AACf,MAAa,QAAQ;IAInB,YACmB,IAAU,EACV,IAAY;QADZ,SAAI,GAAJ,IAAI,CAAM;QACV,SAAI,GAAJ,IAAI,CAAQ;QAE7B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,CAAC,GAAG,GAAG,IAAA,YAAM,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;IAGD,IAAY,OAAO;QACjB,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,OAAO,IAAI,CAAC,QAAQ,CAAC;QACvB,CAAC;QAED,MAAM,MAAM,GAAiB,EAAE,CAAC;QAChC,IAAI,CAAC,QAAQ,GAAG,IAAA,wBAAS,EAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC,CAAC;QAC9E,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YAClB,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;YACpC,MAAM,IAAI,KAAK,CACb,oBAAoB,IAAI,CAAC,IAAI,yBAAyB,IAAA,kCAAmB,EACvE,KAAK,CACN,iBAAiB,MAAM,GAAG,CAC5B,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,GAAG,CAAC,QAAkB;QACpB,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC;QACjC,IAAI,CA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K,CAAC,CAAC;YAEtD,wCAAwC;YACxC,IAAI,aAAa,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC;gBACnC,IAAI,CAAC,OAAO,GAAG,aAAa,CAAC;gBAC7B,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;gBAC9C,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;YAC5B,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,CAAC,QAAkB;QACvB,IAAI,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,SAAS,EAAE,CAAC;YACrC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;QACnC,CAAC;IACH,CAAC;CACF;AAxFD,4BAwFC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addScript = addScript;
|
|
4
|
+
const json_file_1 = require("./json-file");
|
|
5
|
+
function addScript(name, script) {
|
|
6
|
+
return (tree) => {
|
|
7
|
+
const pkgPath = '/package.json';
|
|
8
|
+
if (!tree.exists(pkgPath)) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const json = new json_file_1.JSONFile(tree, pkgPath);
|
|
12
|
+
if (json.get(['scripts', name]) === undefined) {
|
|
13
|
+
json.modify(['scripts', name], script);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=script.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"script.js","sourceRoot":"","sources":["../../src/utils/script.ts"],"names":[],"mappings":";;AAGA,8BAYC;AAdD,2CAAuC;AAEvC,SAAgB,SAAS,CAAC,IAAY,EAAE,MAAc;IACpD,OAAO,CAAC,IAAU,EAAE,EAAE;QACpB,MAAM,OAAO,GAAG,eAAe,CAAC;QAChC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;YAC1B,OAAO;QACT,CAAC;QAED,MAAM,IAAI,GAAG,IAAI,oBAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACzC,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC;YAC9C,IAAI,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;QACzC,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/versions.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.versions = void 0;
|
|
4
|
+
exports.versions = {
|
|
5
|
+
orval: '8.16.0',
|
|
6
|
+
eslint: '10.4.1',
|
|
7
|
+
angularEslint: '22.0.0',
|
|
8
|
+
typescriptEslint: '8.61.0',
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=versions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"versions.js","sourceRoot":"","sources":["../src/versions.ts"],"names":[],"mappings":";;;AAAa,QAAA,QAAQ,GAAG;IACtB,KAAK,EAAE,QAAQ;IAEf,MAAM,EAAE,QAAQ;IAChB,aAAa,EAAE,QAAQ;IACvB,gBAAgB,EAAE,QAAQ;CAC3B,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ag-schematics",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Ag schematics is a collection of Angular schematics for generating and modifying Angular projects.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/patrick473/ag-schematics"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "rm -rf dist && tsc -p tsconfig.lib.json && cp src/collection.json dist/collection.json && for f in src/*/schema.json; do cp $f dist/${f#src/}; done && for d in src/*/files; do cp -r $d dist/$(dirname ${d#src/})/; done",
|
|
11
|
+
"test": "rm -rf out && tsc -p tsconfig.json && rsync -a --exclude='*.ts' src/ out/ && vitest run",
|
|
12
|
+
"test:coverage": "rm -rf out && tsc -p tsconfig.json && rsync -a --exclude='*.ts' src/ out/ && vitest run --coverage"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"keywords": [
|
|
18
|
+
"schematics"
|
|
19
|
+
],
|
|
20
|
+
"author": "",
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"schematics": "./dist/collection.json",
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@angular-devkit/core": "22.0.4",
|
|
25
|
+
"@angular-devkit/schematics": "22.0.4",
|
|
26
|
+
"jsonc-parser": "3.3.1",
|
|
27
|
+
"typescript": "6.0.3"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/node": "26.0.1",
|
|
31
|
+
"@vitest/coverage-v8": "^4.1.9",
|
|
32
|
+
"vitest": "4.1.9"
|
|
33
|
+
}
|
|
34
|
+
}
|