@yuuvis/client-cli 19.8.0 → 19.10.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.
- package/README.md +70 -0
- package/cli/commands/add/app.js +6 -1
- package/cli/commands/add/app.js.map +1 -1
- package/cli/commands/add/language.d.ts +6 -0
- package/cli/commands/add/language.js +40 -0
- package/cli/commands/add/language.js.map +1 -0
- package/cli/commands/generate/app.js +3 -1
- package/cli/commands/generate/app.js.map +1 -1
- package/cli/commands/generate/theme.d.ts +6 -0
- package/cli/commands/generate/theme.js +65 -0
- package/cli/commands/generate/theme.js.map +1 -0
- package/cli/options/options-add-language.json +7 -0
- package/cli/options/options-generate-theme.json +41 -0
- package/cli/utils.js.map +1 -1
- package/package.json +5 -1
- package/schematics/app-manifest.d.ts +1 -1
- package/schematics/app-manifest.js +1 -1
- package/schematics/app-manifest.js.map +1 -1
- package/schematics/commands/angular-json.d.ts +2 -2
- package/schematics/commands/angular-json.js +3 -16
- package/schematics/commands/angular-json.js.map +1 -1
- package/schematics/commands/app-config-ts.d.ts +12 -3
- package/schematics/commands/app-config-ts.js +77 -3
- package/schematics/commands/app-config-ts.js.map +1 -1
- package/schematics/commands/library-component.d.ts +4 -4
- package/schematics/commands/library-component.js +12 -16
- package/schematics/commands/library-component.js.map +1 -1
- package/schematics/commands/main-json.d.ts +80 -0
- package/schematics/commands/main-json.js +107 -0
- package/schematics/commands/main-json.js.map +1 -0
- package/schematics/commands/package-json.d.ts +20 -7
- package/schematics/commands/package-json.js +43 -8
- package/schematics/commands/package-json.js.map +1 -1
- package/schematics/commands/styles-scss.d.ts +52 -0
- package/schematics/commands/styles-scss.js +91 -0
- package/schematics/commands/styles-scss.js.map +1 -0
- package/schematics/commands/typescript-file.d.ts +10 -0
- package/schematics/commands/typescript-file.js +48 -1
- package/schematics/commands/typescript-file.js.map +1 -1
- package/schematics/factories/add-app/index.js +1 -1
- package/schematics/factories/add-app/index.js.map +1 -1
- package/schematics/factories/add-language/index.d.ts +2 -0
- package/schematics/factories/add-language/index.js +44 -0
- package/schematics/factories/add-language/index.js.map +1 -0
- package/schematics/factories/add-language/schema.json +23 -0
- package/schematics/factories/collection.json +10 -0
- package/schematics/factories/generate-app/index.js +8 -10
- package/schematics/factories/generate-app/index.js.map +1 -1
- package/schematics/factories/generate-app/schema.json +45 -45
- package/schematics/factories/generate-theme/generate-theme.model.d.ts +15 -0
- package/schematics/factories/generate-theme/generate-theme.model.js +3 -0
- package/schematics/factories/generate-theme/generate-theme.model.js.map +1 -0
- package/schematics/factories/generate-theme/index.d.ts +3 -0
- package/schematics/factories/generate-theme/index.js +122 -0
- package/schematics/factories/generate-theme/index.js.map +1 -0
- package/schematics/factories/generate-theme/schema.json +59 -0
- package/schematics/factories/new/index.js +3 -3
- package/schematics/factories/new/index.js.map +1 -1
- package/schematics/files/_i18n-external/__locale__.json +1 -0
- package/schematics/files/_scripts/extract-client-version.js +4 -0
- package/schematics/files/_src_app/app.component.html.template +1 -0
- package/schematics/files/_src_app/app.component.ts.template +7 -7
- package/schematics/files/_src_app/app.config.ts.template +1 -1
- package/schematics/files/_src_app/app.markers.ts.template +1 -0
- package/schematics/files/_src_assets_i18n/de.json +1 -0
- package/schematics/files/_src_assets_i18n/en.json +1 -0
- package/schematics/files/_src_styles_theme/__themeName__.config.scss.template +113 -0
- package/schematics/files/_src_styles_theme/__themeName__.theme.scss.template +5 -0
- package/schematics/patches/impl/0001.patch.js +2 -2
- package/schematics/patches/impl/0001.patch.js.map +1 -1
- package/schematics/patches/impl/0003.patch.d.ts +2 -2
- package/schematics/patches/impl/0003.patch.js +2 -2
- package/schematics/patches/impl/0003.patch.js.map +1 -1
- package/schematics/patches/impl/0004.patch.d.ts +9 -0
- package/schematics/patches/impl/0004.patch.js +37 -0
- package/schematics/patches/impl/0004.patch.js.map +1 -0
- package/schematics/patches/impl/0005.patch.d.ts +9 -0
- package/schematics/patches/impl/0005.patch.js +39 -0
- package/schematics/patches/impl/0005.patch.js.map +1 -0
- package/schematics/project-metadata.d.ts +2 -2
- package/schematics/registry-config.d.ts +18 -0
- package/schematics/registry-config.js +111 -0
- package/schematics/registry-config.js.map +1 -0
- package/schematics/rules/clean-up-ng-app.js +0 -1
- package/schematics/rules/clean-up-ng-app.js.map +1 -1
- package/schematics/rules/copy-resources.d.ts +3 -1
- package/schematics/rules/copy-resources.js +31 -3
- package/schematics/rules/copy-resources.js.map +1 -1
- package/schematics/rules/generate-theme.d.ts +6 -0
- package/schematics/rules/generate-theme.js +25 -0
- package/schematics/rules/generate-theme.js.map +1 -0
- package/schematics/schematics-util.d.ts +9 -0
- package/schematics/schematics-util.js +199 -43
- package/schematics/schematics-util.js.map +1 -1
- package/schematics/types/main-json.d.ts +299 -0
- package/schematics/types/main-json.js +24 -0
- package/schematics/types/main-json.js.map +1 -0
package/README.md
CHANGED
|
@@ -123,6 +123,28 @@ yuv patch list
|
|
|
123
123
|
yuv p l
|
|
124
124
|
```
|
|
125
125
|
|
|
126
|
+
### add language
|
|
127
|
+
|
|
128
|
+
Adds a new language to the client project. Updates the i18n configuration and creates the necessary translation file.
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
yuv add language <locale> [options]
|
|
132
|
+
|
|
133
|
+
# short form
|
|
134
|
+
yuv a l <locale> [options]
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
`<locale>`: The locale code of the language to add (e.g. `es` for Spanish, `fr` for French).
|
|
138
|
+
|
|
139
|
+
#### Options
|
|
140
|
+
- `--label`: The display name of the language, written in that language itself (e.g. `Français` for French). If not specified, the locale code is used as label.
|
|
141
|
+
|
|
142
|
+
After the command completes, run the following to finalize the setup:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
npm run i18n:extract && npm run i18n:collect
|
|
146
|
+
```
|
|
147
|
+
|
|
126
148
|
### patch apply
|
|
127
149
|
|
|
128
150
|
Applies the patch with the given ID to the current client project if necessary.
|
|
@@ -133,3 +155,51 @@ yuv patch apply <patchID>
|
|
|
133
155
|
# short form
|
|
134
156
|
yuv p a <patchID>
|
|
135
157
|
```
|
|
158
|
+
|
|
159
|
+
### generate theme
|
|
160
|
+
|
|
161
|
+
Creates a custom Material Design 3 (M3) theme for your yuuvis client application. Generates SCSS files with color palettes and automatically integrates the theme into your application.
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
yuv generate theme <name> --primaryColor <hex-color>
|
|
165
|
+
|
|
166
|
+
# short forms
|
|
167
|
+
yuv g theme <name> --primaryColor <hex-color>
|
|
168
|
+
yuv g t <name> --primaryColor <hex-color>
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
The `<name>` argument is required and becomes the theme name used for file names and the CSS body class. If `--primaryColor` is omitted you will be prompted for it interactively.
|
|
172
|
+
|
|
173
|
+
#### Options
|
|
174
|
+
|
|
175
|
+
**Required:**
|
|
176
|
+
- `<name>`: Positional argument — the theme name (used for file names and CSS class names).
|
|
177
|
+
- `--primaryColor`: The primary hex color code **without** the leading `#`. Prompted interactively if omitted.
|
|
178
|
+
|
|
179
|
+
**Optional:**
|
|
180
|
+
- `--secondaryColor`: Hex color for the secondary palette without `#`. If omitted, derived from the primary color.
|
|
181
|
+
- `--tertiaryColor`: Hex color for the tertiary palette without `#`. If omitted, derived from the primary color.
|
|
182
|
+
- `--neutralColor`: Hex color for the neutral palette without `#`. If omitted, derived from the primary color.
|
|
183
|
+
- `--neutralVariantColor`: Hex color for the neutral variant palette without `#`. If omitted, derived from the primary color.
|
|
184
|
+
- `--errorColor`: Hex color for the error palette without `#`. If omitted, uses the Material default.
|
|
185
|
+
- `--hasDarkTheme`: Generate a dark variant of the theme. Default: `true`.
|
|
186
|
+
- `--hasLightTheme`: Generate a light variant of the theme. Default: `true`.
|
|
187
|
+
- `--includeHighContrast`: Generate high contrast override theme mixins. Default: `false`.
|
|
188
|
+
|
|
189
|
+
#### What Gets Generated
|
|
190
|
+
|
|
191
|
+
Running the command creates the following files (the target application is detected automatically from the workspace):
|
|
192
|
+
|
|
193
|
+
```
|
|
194
|
+
src/styles/<name>/
|
|
195
|
+
├── <name>_theme-colors.scss # M3 tonal palettes (via @angular/material)
|
|
196
|
+
├── <name>.config.scss # Material theme configuration and yuuvis token overrides
|
|
197
|
+
└── <name>.theme.scss # Theme entry file — applies the theme to body.<name>
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
It also automatically updates:
|
|
201
|
+
- `src/styles.scss` — adds the theme import
|
|
202
|
+
- `src/app/app.config.ts` — adds/updates the `provideYuvCustomTheme` provider (with `label`, `description`, `hasDarkTheme`, `hasLightTheme`)
|
|
203
|
+
- `src/app/app.markers.ts` — adds `marker()` calls for the theme's label and description i18n keys (file is created if absent)
|
|
204
|
+
|
|
205
|
+
For full details see [GENERATE-THEME.md](../GENERATE-THEME.md).
|
package/cli/commands/add/app.js
CHANGED
|
@@ -8,10 +8,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
15
|
exports.handler = exports.builder = exports.desc = exports.aliases = exports.command = void 0;
|
|
13
16
|
const child_process_1 = require("child_process");
|
|
14
17
|
const utils_1 = require("../../utils");
|
|
18
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
15
19
|
exports.command = "app <name>";
|
|
16
20
|
exports.aliases = ["a"];
|
|
17
21
|
exports.desc = "Add an existing app to the client.";
|
|
@@ -24,7 +28,8 @@ const handler = (argv) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
24
28
|
cwd: process.cwd(),
|
|
25
29
|
stdio: "inherit",
|
|
26
30
|
});
|
|
27
|
-
console.log(`App '${argv.name}' added successfully
|
|
31
|
+
console.log(`App '${argv.name}' added successfully!\n` +
|
|
32
|
+
chalk_1.default.yellow('Run "npm run i18n:extract && npm run i18n:collect" to finalize the i18n setup.'));
|
|
28
33
|
});
|
|
29
34
|
exports.handler = handler;
|
|
30
35
|
//# sourceMappingURL=app.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../../src/cli/commands/add/app.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../../src/cli/commands/add/app.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,iDAAyC;AACzC,uCAAiE;AACjE,kDAA0B;AAEb,QAAA,OAAO,GAAW,YAAY,CAAC;AAC/B,QAAA,OAAO,GAAa,CAAC,GAAG,CAAC,CAAC;AAC1B,QAAA,IAAI,GAAW,oCAAoC,CAAC;AAE1D,MAAM,OAAO,GAA4B,CAAC,KAAU,EAAE,EAAE;IAC7D,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC5C,CAAC,CAAC;AAFW,QAAA,OAAO,WAElB;AAEK,MAAM,OAAO,GAAG,CAAO,IAAS,EAAE,EAAE;IAEzC,IAAA,wBAAQ,EAAC,GAAG,IAAA,wBAAgB,GAAE,+BAA+B,IAAA,wBAAgB,EAAC,IAAI,CAAC,EAAE,EAAE;QACrF,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;QAClB,KAAK,EAAE,SAAS;KACjB,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,CAAC,IAAI,yBAAyB;QACtD,eAAK,CAAC,MAAM,CAAC,gFAAgF,CAAC,CAAC,CAAC;AAClG,CAAC,CAAA,CAAC;AATW,QAAA,OAAO,WASlB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CommandBuilder, Options } from "yargs";
|
|
2
|
+
export declare const command: string;
|
|
3
|
+
export declare const aliases: string[];
|
|
4
|
+
export declare const desc: string;
|
|
5
|
+
export declare const builder: CommandBuilder<Options>;
|
|
6
|
+
export declare const handler: (argv: any) => Promise<void>;
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.handler = exports.builder = exports.desc = exports.aliases = exports.command = void 0;
|
|
16
|
+
const child_process_1 = require("child_process");
|
|
17
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
18
|
+
const utils_1 = require("../../utils");
|
|
19
|
+
const options_add_language_json_1 = __importDefault(require("../../options/options-add-language.json"));
|
|
20
|
+
exports.command = "language <locale>";
|
|
21
|
+
exports.aliases = ["l"];
|
|
22
|
+
exports.desc = "Add an existing language to the client.";
|
|
23
|
+
const builder = (yargs) => {
|
|
24
|
+
return yargs
|
|
25
|
+
.string("language")
|
|
26
|
+
.version(false)
|
|
27
|
+
.options(options_add_language_json_1.default);
|
|
28
|
+
};
|
|
29
|
+
exports.builder = builder;
|
|
30
|
+
const handler = (argv) => __awaiter(void 0, void 0, void 0, function* () {
|
|
31
|
+
(0, child_process_1.execSync)(`${(0, utils_1.getSchematicsBin)()} @yuuvis/client-cli:add-language ${(0, utils_1.serializeOptions)(argv)}`, {
|
|
32
|
+
cwd: process.cwd(),
|
|
33
|
+
stdio: "inherit",
|
|
34
|
+
});
|
|
35
|
+
const localeDisplayName = argv.label ? `(${argv.label})` : '';
|
|
36
|
+
console.log(`Language '${argv.locale}' ${localeDisplayName} added successfully!\n` +
|
|
37
|
+
chalk_1.default.yellow('Run "npm run i18n:extract && npm run i18n:collect" to finalize the language setup.'));
|
|
38
|
+
});
|
|
39
|
+
exports.handler = handler;
|
|
40
|
+
//# sourceMappingURL=language.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"language.js","sourceRoot":"","sources":["../../../../src/cli/commands/add/language.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,iDAAyC;AACzC,kDAA0B;AAC1B,uCAAiE;AACjE,wGAA8D;AACjD,QAAA,OAAO,GAAW,mBAAmB,CAAC;AACtC,QAAA,OAAO,GAAa,CAAC,GAAG,CAAC,CAAC;AAC1B,QAAA,IAAI,GAAW,yCAAyC,CAAC;AAE/D,MAAM,OAAO,GAA4B,CAAC,KAAU,EAAE,EAAE;IAC7D,OAAO,KAAK;SACT,MAAM,CAAC,UAAU,CAAC;SAClB,OAAO,CAAC,KAAK,CAAC;SACd,OAAO,CAAC,mCAAO,CAAC,CAAC;AACtB,CAAC,CAAC;AALW,QAAA,OAAO,WAKlB;AAEK,MAAM,OAAO,GAAG,CAAO,IAAS,EAAE,EAAE;IAEzC,IAAA,wBAAQ,EAAC,GAAG,IAAA,wBAAgB,GAAE,oCAAoC,IAAA,wBAAgB,EAAC,IAAI,CAAC,EAAE,EAAE;QAC1F,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;QAClB,KAAK,EAAE,SAAS;KACjB,CAAC,CAAC;IAEH,MAAM,iBAAiB,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9D,OAAO,CAAC,GAAG,CACT,aAAa,IAAI,CAAC,MAAM,KAAK,iBAAiB,wBAAwB;QACtE,eAAK,CAAC,MAAM,CAAC,oFAAoF,CAAC,CACnG,CAAC;AACJ,CAAC,CAAA,CAAC;AAZW,QAAA,OAAO,WAYlB"}
|
|
@@ -18,6 +18,7 @@ const child_process_1 = require("child_process");
|
|
|
18
18
|
const utils_1 = require("../../utils");
|
|
19
19
|
const options_generate_app_json_1 = __importDefault(require("../../options/options-generate-app.json"));
|
|
20
20
|
const utils_2 = require("../../../schematics/utils");
|
|
21
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
21
22
|
exports.command = "app <name>";
|
|
22
23
|
exports.aliases = ["a"];
|
|
23
24
|
exports.desc = "Generate a new yuuvis client app.";
|
|
@@ -86,7 +87,8 @@ const handler = (argv) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
86
87
|
cwd: process.cwd(),
|
|
87
88
|
stdio: "inherit",
|
|
88
89
|
});
|
|
89
|
-
console.log(`App '${argv.name}' created successfully
|
|
90
|
+
console.log(`App '${argv.name}' created successfully!\n` +
|
|
91
|
+
chalk_1.default.yellow('Run "npm run i18n:extract && npm run i18n:collect" to finalize the i18n setup.'));
|
|
90
92
|
});
|
|
91
93
|
exports.handler = handler;
|
|
92
94
|
//# sourceMappingURL=app.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../../src/cli/commands/generate/app.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,wDAAgC;AAChC,iDAAyC;AACzC,uCAAiE;AACjE,wGAA8D;AAC9D,qDAA6D;
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../../src/cli/commands/generate/app.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,wDAAgC;AAChC,iDAAyC;AACzC,uCAAiE;AACjE,wGAA8D;AAC9D,qDAA6D;AAC7D,kDAA0B;AAEb,QAA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|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CommandBuilder, Options } from 'yargs';
|
|
2
|
+
export declare const command: string;
|
|
3
|
+
export declare const aliases: string[];
|
|
4
|
+
export declare const desc: string;
|
|
5
|
+
export declare const builder: CommandBuilder<Options>;
|
|
6
|
+
export declare const handler: (argv: any) => Promise<void>;
|
|
@@ -0,0 +1,65 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.handler = exports.builder = exports.desc = exports.aliases = exports.command = void 0;
|
|
16
|
+
const child_process_1 = require("child_process");
|
|
17
|
+
const utils_1 = require("../../utils");
|
|
18
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
19
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
20
|
+
const options_generate_theme_json_1 = __importDefault(require("../../options/options-generate-theme.json"));
|
|
21
|
+
exports.command = 'theme <name>';
|
|
22
|
+
exports.aliases = ['t'];
|
|
23
|
+
exports.desc = 'Generate a new yuuvis client theme.';
|
|
24
|
+
const HEX_COLOR_REGEX = /^[0-9A-Fa-f]{6}$/;
|
|
25
|
+
function isValidHexColor(value) {
|
|
26
|
+
return HEX_COLOR_REGEX.test(value);
|
|
27
|
+
}
|
|
28
|
+
const builder = (yargs) => {
|
|
29
|
+
return yargs.string('theme').version(false).options(options_generate_theme_json_1.default);
|
|
30
|
+
};
|
|
31
|
+
exports.builder = builder;
|
|
32
|
+
const handler = (argv) => __awaiter(void 0, void 0, void 0, function* () {
|
|
33
|
+
if (!argv.primaryColor) {
|
|
34
|
+
const response = yield inquirer_1.default.prompt([
|
|
35
|
+
{
|
|
36
|
+
type: "input",
|
|
37
|
+
name: "primaryColor",
|
|
38
|
+
message: "Specify the primary color (hex code without #, e.g., 'FF5733'):",
|
|
39
|
+
validate: (input) => /^[0-9A-Fa-f]{6}$/.test(input) || "Please enter a valid 6-character hex color code (e.g., 'FF5733').",
|
|
40
|
+
},
|
|
41
|
+
]);
|
|
42
|
+
argv.primaryColor = argv['primary-color'] = String(response.primaryColor);
|
|
43
|
+
}
|
|
44
|
+
const colorOptions = [
|
|
45
|
+
{ key: 'primaryColor', label: '--primaryColor' },
|
|
46
|
+
{ key: 'secondaryColor', label: '--secondaryColor' },
|
|
47
|
+
{ key: 'tertiaryColor', label: '--tertiaryColor' },
|
|
48
|
+
{ key: 'neutralColor', label: '--neutralColor' },
|
|
49
|
+
{ key: 'neutralVariantColor', label: '--neutralVariantColor' },
|
|
50
|
+
{ key: 'errorColor', label: '--errorColor' },
|
|
51
|
+
];
|
|
52
|
+
for (const { key, label } of colorOptions) {
|
|
53
|
+
const value = argv[key];
|
|
54
|
+
if (value !== undefined && !isValidHexColor(String(value))) {
|
|
55
|
+
console.error(chalk_1.default.red(`Invalid hex color for ${label}: '${value}'. Please provide a 6-character hex code without '#' (e.g. 'FF5733').`));
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
(0, child_process_1.execSync)(`${(0, utils_1.getSchematicsBin)()} @yuuvis/client-cli:generate-theme ${(0, utils_1.serializeOptions)(argv)}`, {
|
|
60
|
+
cwd: process.cwd(),
|
|
61
|
+
stdio: 'inherit'
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
exports.handler = handler;
|
|
65
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../../../src/cli/commands/generate/theme.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,iDAAyC;AAEzC,uCAAiE;AACjE,kDAA0B;AAC1B,wDAAgC;AAEhC,4GAAgE;AAEnD,QAAA,OAAO,GAAW,cAAc,CAAC;AACjC,QAAA,OAAO,GAAa,CAAC,GAAG,CAAC,CAAC;AAC1B,QAAA,IAAI,GAAW,qCAAqC,CAAC;AAElE,MAAM,eAAe,GAAG,kBAAkB,CAAC;AAE3C,SAAS,eAAe,CAAC,KAAa;IACpC,OAAO,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACrC,CAAC;AAEM,MAAM,OAAO,GAA4B,CAAC,KAAU,EAAE,EAAE;IAC7D,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,qCAAO,CAAC,CAAC;AAC/D,CAAC,CAAC;AAFW,QAAA,OAAO,WAElB;AAEK,MAAM,OAAO,GAAG,CAAO,IAAS,EAAE,EAAE;IACzC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;QACvB,MAAM,QAAQ,GAAG,MAAM,kBAAQ,CAAC,MAAM,CAAC;YACrC;gBACE,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,cAAc;gBACpB,OAAO,EAAE,iEAAiE;gBAC1E,QAAQ,EAAE,CAAC,KAAa,EAAE,EAAE,CAC1B,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,mEAAmE;aACxG;SACF,CAAC,CAAC;QACH,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,MAAM,CAAC,QAAQ,CA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
+
"type": "string"
|
|
5
|
+
},
|
|
6
|
+
"secondaryColor": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"description": "Hex color code for the secondary Angular Material color palette (without the leading #). Defaults to a neutral gray."
|
|
9
|
+
},
|
|
10
|
+
"tertiaryColor": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"description": "Hex color code for the tertiary Angular Material color palette (without the leading #). Defaults to a neutral gray."
|
|
13
|
+
},
|
|
14
|
+
"neutralColor": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"description": "Hex color code for the neutral Angular Material color palette (without the leading #). Defaults to a neutral gray."
|
|
17
|
+
},
|
|
18
|
+
"neutralVariantColor": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"description": "Hex color code for the neutral variant Angular Material color palette (without the leading #). Defaults to a neutral gray."
|
|
21
|
+
},
|
|
22
|
+
"errorColor": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"description": "Hex color code for the error Angular Material color palette (without the leading #). Defaults to a red."
|
|
25
|
+
},
|
|
26
|
+
"includeHighContrast": {
|
|
27
|
+
"type": "boolean",
|
|
28
|
+
"default": false,
|
|
29
|
+
"description": "Include high contrast override theme mixins in the generated theme."
|
|
30
|
+
},
|
|
31
|
+
"hasDarkTheme": {
|
|
32
|
+
"type": "boolean",
|
|
33
|
+
"default": true,
|
|
34
|
+
"description": "Generate a dark variant of the theme."
|
|
35
|
+
},
|
|
36
|
+
"hasLightTheme": {
|
|
37
|
+
"type": "boolean",
|
|
38
|
+
"default": true,
|
|
39
|
+
"description": "Generate a light variant of the theme."
|
|
40
|
+
}
|
|
41
|
+
}
|
package/cli/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/cli/utils.ts"],"names":[],"mappings":";;AAGA,4CAEC;AAOD,4CAaC;AAOD,8CAiBC;AAjDD,2BAAgC;AAChC,+
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../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,YAAY,CAAC,CAAC;QACxD,IAAI,IAAA,eAAU,EAAC,eAAe,CAAC,EAAE,CAAC;YAChC,OAAO,WAAW,CAAC;QACrB,CAAC;QACD,MAAM,UAAU,GAAG,IAAA,cAAO,EAAC,WAAW,CAAC,CAAC;QACxC,IAAI,UAAU,KAAK,WAAW,EAAE,CAAC;YAC/B,MAAM;QACR,CAAC;QACD,WAAW,GAAG,UAAU,CAAC;IAC3B,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yuuvis/client-cli",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.10.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"schematics": "./schematics/factories/collection.json",
|
|
6
6
|
"bin": {
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"keywords": [
|
|
10
10
|
"yuuvis",
|
|
11
11
|
"yuuvis Momentum",
|
|
12
|
+
"yuuvis shell",
|
|
12
13
|
"client",
|
|
13
14
|
"CLI",
|
|
14
15
|
"custom client"
|
|
@@ -16,17 +17,20 @@
|
|
|
16
17
|
"author": "OPTIMAL SYSTEMS GmbH <npm@optimal-systems.de>",
|
|
17
18
|
"license": "MIT",
|
|
18
19
|
"description": "CLI tool for yuuvis Momentum clients",
|
|
20
|
+
"homepage": "https://shell.yuuvis.org/developer-tools/client-cli",
|
|
19
21
|
"dependencies": {
|
|
20
22
|
"@angular-devkit/core": "^19.2.1",
|
|
21
23
|
"@angular-devkit/schematics": "^19.2.1",
|
|
22
24
|
"@angular-devkit/schematics-cli": "^19.2.1",
|
|
23
25
|
"@angular/cli": "^19.2.19",
|
|
24
26
|
"@schematics/angular": "^19.2.1",
|
|
27
|
+
"chalk": "^4.1.2",
|
|
25
28
|
"cli-table3": "^0.6.5",
|
|
26
29
|
"inquirer": "^12.4.3",
|
|
27
30
|
"semver": "^7.7.2",
|
|
28
31
|
"typescript": "^5.8.3",
|
|
29
32
|
"yargs": "^17.7.2",
|
|
33
|
+
"npm-registry-fetch": "^18.0.0",
|
|
30
34
|
"zod": "^3.24.2"
|
|
31
35
|
}
|
|
32
36
|
}
|
|
@@ -84,6 +84,6 @@ declare const ManifestSchema: z.ZodObject<{
|
|
|
84
84
|
extension?: string | undefined;
|
|
85
85
|
}>;
|
|
86
86
|
export type AppManifest = z.infer<typeof ManifestSchema>;
|
|
87
|
-
export declare function parseManifest(content: string): AppManifest;
|
|
87
|
+
export declare function parseManifest(content: string | unknown): AppManifest;
|
|
88
88
|
export declare function writeManifest(filePath: string, manifest: AppManifest): void;
|
|
89
89
|
export {};
|
|
@@ -28,7 +28,7 @@ const ManifestSchema = zod_1.z.object({
|
|
|
28
28
|
extension: zod_1.z.string().optional()
|
|
29
29
|
});
|
|
30
30
|
function parseManifest(content) {
|
|
31
|
-
const jsonData = JSON.parse(content);
|
|
31
|
+
const jsonData = typeof content === 'string' ? JSON.parse(content) : content;
|
|
32
32
|
return ManifestSchema.parse(jsonData);
|
|
33
33
|
}
|
|
34
34
|
function writeManifest(filePath, manifest) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-manifest.js","sourceRoot":"","sources":["../../src/schematics/app-manifest.ts"],"names":[],"mappings":";;;;;AA4BA,sCAGC;AAED,sCAMC;AAvCD,4CAAoB;AACpB,6BAAwB;AAExB,MAAM,SAAS,GAAG,OAAC,CAAC,MAAM,CAAC;IACzB,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,SAAS,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACjC,WAAW,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CACpC,CAAC,CAAC;AAEH,MAAM,MAAM,GAAG,OAAC,CAAC,MAAM,CAAC;IACtB,I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
|
-
* @param path The path to the angular.json file. Defaults to 'angular.json'.
|
|
101
|
+
* @param path The path to the angular.json file. Defaults to '/angular.json'.
|
|
102
102
|
* @returns A Promise that resolves to a new AngularJsonEditor instance.
|
|
103
103
|
*/
|
|
104
|
-
static create(tree: Tree, path?: string):
|
|
104
|
+
static create(tree: Tree, path?: string): AngularJsonEditor;
|
|
105
105
|
/**
|
|
106
106
|
* Executes the given command on the angular.json file.
|
|
107
107
|
* @param command The command to execute on the angular.json file.
|
|
@@ -1,17 +1,7 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.AngularJsonEditor = exports.UpdateStylePreprocessorOptionsForTestsCommand = exports.SetStyleForProjectCommand = exports.UpdateDevFileReplacementsForProjectCommand = exports.UpdateInitialBudgetForProjectCommand = exports.AddAllowedCommonJsDependenciesToProjectCommand = exports.AddBuildOptionsScriptsToProjectCommand = exports.AddBuildOptionsAssetsToProjectCommand = exports.CompositeAngularJsonCommand = void 0;
|
|
13
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
14
|
-
const project_util_1 = require("../project-util");
|
|
15
5
|
/**
|
|
16
6
|
* Composite command that executes multiple AngularJsonCommand instances.
|
|
17
7
|
*/
|
|
@@ -183,14 +173,11 @@ class AngularJsonEditor {
|
|
|
183
173
|
/**
|
|
184
174
|
* Creates a new AngularJsonEditor instance.
|
|
185
175
|
* @param tree The Angular DevKit Tree to operate on.
|
|
186
|
-
* @param path The path to the angular.json file. Defaults to 'angular.json'.
|
|
176
|
+
* @param path The path to the angular.json file. Defaults to '/angular.json'.
|
|
187
177
|
* @returns A Promise that resolves to a new AngularJsonEditor instance.
|
|
188
178
|
*/
|
|
189
|
-
static create(tree, path) {
|
|
190
|
-
return
|
|
191
|
-
const angularJsonPath = path !== null && path !== void 0 ? path : (yield (0, project_util_1.getAngularJsonPath)(tree));
|
|
192
|
-
return new AngularJsonEditor(tree, angularJsonPath);
|
|
193
|
-
});
|
|
179
|
+
static create(tree, path = '/angular.json') {
|
|
180
|
+
return new AngularJsonEditor(tree, path);
|
|
194
181
|
}
|
|
195
182
|
/**
|
|
196
183
|
* Executes the given command on the angular.json file.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angular-json.js","sourceRoot":"","sources":["../../../src/schematics/commands/angular-json.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"angular-json.js","sourceRoot":"","sources":["../../../src/schematics/commands/angular-json.ts"],"names":[],"mappings":";;;AAAA,2DAAuE;AAgBvE;;GAEG;AACH,MAAa,2BAA2B;IACtC,YAA6B,QAA8B;QAA9B,aAAQ,GAAR,QAAQ,CAAsB;IAAG,CAAC;IAE/D;;;OAGG;IACH,OAAO,CAAC,WAAgB;QACtB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;IACnE,CAAC;CACF;AAVD,kEAUC;AAED;;GAEG;AACH,MAAa,qCAAqC;IAChD,YAA6B,WAAmB,EAAmB,MAA2B;QAAjE,gBAAW,GAAX,WAAW,CAAQ;QAAmB,WAAM,GAAN,MAAM,CAAqB;IAAG,CAAC;IAClG,OAAO,CAAC,WAAgB;;QACtB,MAAM,OAAO,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M,IAAI,gCAAmB,CAAC,YAAY,WAAW,8BAA8B,CAAC,CAAC;IACvF,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import ts from
|
|
2
|
-
import { TypeScriptFileCommand } from
|
|
3
|
-
import { UpdateRecorder } from
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import { TypeScriptFileCommand } from './typescript-file';
|
|
3
|
+
import { UpdateRecorder } from '@angular-devkit/schematics';
|
|
4
4
|
export interface AppConfigTsCommand extends TypeScriptFileCommand {
|
|
5
5
|
}
|
|
6
6
|
export declare class AddShellExtensionsImportCommand implements AppConfigTsCommand {
|
|
@@ -9,3 +9,12 @@ export declare class AddShellExtensionsImportCommand implements AppConfigTsComma
|
|
|
9
9
|
constructor(appId: string, extensionsFileName: string);
|
|
10
10
|
execute(sourceFile: ts.SourceFile, recorder: UpdateRecorder, filePath: string): void;
|
|
11
11
|
}
|
|
12
|
+
export declare class AddOrUpdateProvideYuvCustomThemeCommand implements AppConfigTsCommand {
|
|
13
|
+
private readonly themeName;
|
|
14
|
+
private readonly label;
|
|
15
|
+
private readonly description;
|
|
16
|
+
private readonly hasDarkTheme;
|
|
17
|
+
private readonly hasLightTheme;
|
|
18
|
+
constructor(themeName: string, label: string, description: string, hasDarkTheme: boolean, hasLightTheme: boolean);
|
|
19
|
+
execute(sourceFile: ts.SourceFile, recorder: UpdateRecorder, filePath: string): void;
|
|
20
|
+
}
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.AddShellExtensionsImportCommand = void 0;
|
|
6
|
+
exports.AddOrUpdateProvideYuvCustomThemeCommand = exports.AddShellExtensionsImportCommand = void 0;
|
|
7
7
|
const typescript_1 = __importDefault(require("typescript"));
|
|
8
8
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
9
9
|
const ast_utils_1 = require("@schematics/angular/utility/ast-utils");
|
|
@@ -24,10 +24,10 @@ class AddShellExtensionsImportCommand {
|
|
|
24
24
|
throw new schematics_1.SchematicsException(`importShellExtensions([...]) does not contain a valid array in ${filePath}.`);
|
|
25
25
|
}
|
|
26
26
|
// check if the entry already exists
|
|
27
|
-
if (argumentArray.elements.some(el => typescript_1.default.isObjectLiteralExpression(el) &&
|
|
27
|
+
if (argumentArray.elements.some((el) => typescript_1.default.isObjectLiteralExpression(el) &&
|
|
28
28
|
el.properties.some(p => typescript_1.default.isPropertyAssignment(p) &&
|
|
29
29
|
p.name.getText() === 'id' &&
|
|
30
|
-
p.initializer.getText().replace(/['"]/g, '') === this.appId) &&
|
|
30
|
+
p.initializer.getText().replace(/['"]/g, '') === `${this.appId}.extension`) &&
|
|
31
31
|
el.properties.some(p => typescript_1.default.isPropertyAssignment(p) &&
|
|
32
32
|
p.name.getText() === 'extension' &&
|
|
33
33
|
p.initializer.getText() === this.extensionsFileName))) {
|
|
@@ -41,4 +41,78 @@ class AddShellExtensionsImportCommand {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
exports.AddShellExtensionsImportCommand = AddShellExtensionsImportCommand;
|
|
44
|
+
class AddOrUpdateProvideYuvCustomThemeCommand {
|
|
45
|
+
constructor(themeName, label, description, hasDarkTheme, hasLightTheme) {
|
|
46
|
+
this.themeName = themeName;
|
|
47
|
+
this.label = label;
|
|
48
|
+
this.description = description;
|
|
49
|
+
this.hasDarkTheme = hasDarkTheme;
|
|
50
|
+
this.hasLightTheme = hasLightTheme;
|
|
51
|
+
}
|
|
52
|
+
execute(sourceFile, recorder, filePath) {
|
|
53
|
+
// Find the providers array in appConfig
|
|
54
|
+
const variableStatements = (0, ast_utils_1.findNodes)(sourceFile, typescript_1.default.SyntaxKind.VariableStatement);
|
|
55
|
+
const appConfigVariable = variableStatements.find((v) => v.declarationList.declarations.some((d) => d.name.text === 'appConfig'));
|
|
56
|
+
if (!appConfigVariable) {
|
|
57
|
+
throw new schematics_1.SchematicsException(`Cannot find 'appConfig' declaration in ${filePath}`);
|
|
58
|
+
}
|
|
59
|
+
const appConfigInit = appConfigVariable.declarationList.declarations[0].initializer;
|
|
60
|
+
if (!appConfigInit || !typescript_1.default.isObjectLiteralExpression(appConfigInit)) {
|
|
61
|
+
throw new schematics_1.SchematicsException(`'appConfig' is not initialized with an object in ${filePath}`);
|
|
62
|
+
}
|
|
63
|
+
// Find the providers property
|
|
64
|
+
const providersProperty = appConfigInit.properties.find((prop) => typescript_1.default.isPropertyAssignment(prop)
|
|
65
|
+
&& prop.name.text === 'providers');
|
|
66
|
+
if (!providersProperty) {
|
|
67
|
+
throw new schematics_1.SchematicsException(`Cannot find 'providers' array in appConfig in ${filePath}`);
|
|
68
|
+
}
|
|
69
|
+
const providersArray = providersProperty.initializer;
|
|
70
|
+
if (!typescript_1.default.isArrayLiteralExpression(providersArray)) {
|
|
71
|
+
throw new schematics_1.SchematicsException(`'providers' is not an array in ${filePath}`);
|
|
72
|
+
}
|
|
73
|
+
// Find if provideYuvCustomTheme already exists
|
|
74
|
+
const callExpressions = (0, ast_utils_1.findNodes)(providersArray, typescript_1.default.SyntaxKind.CallExpression);
|
|
75
|
+
const provideYuvCustomThemeCall = callExpressions.find((node) => node.expression.getText() === 'provideYuvCustomTheme');
|
|
76
|
+
const themeObject = `{
|
|
77
|
+
key: '${this.themeName}',
|
|
78
|
+
label: '${this.label}',
|
|
79
|
+
description: '${this.description}',
|
|
80
|
+
hasDarkTheme: ${this.hasDarkTheme},
|
|
81
|
+
hasLightTheme: ${this.hasLightTheme}
|
|
82
|
+
}`;
|
|
83
|
+
if (!provideYuvCustomThemeCall) {
|
|
84
|
+
// Add new provideYuvCustomTheme call
|
|
85
|
+
const insertPosition = providersArray.elements.end;
|
|
86
|
+
const prefix = providersArray.elements.length > 0 ? ',\n ' : '\n ';
|
|
87
|
+
const newCall = `provideYuvCustomTheme([${themeObject}])`;
|
|
88
|
+
const insertChange = new change_1.InsertChange(filePath, insertPosition, `${prefix}${newCall}`);
|
|
89
|
+
(0, change_1.applyToUpdateRecorder)(recorder, [insertChange]);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
// Update existing provideYuvCustomTheme call
|
|
93
|
+
const argumentArray = provideYuvCustomThemeCall.arguments[0];
|
|
94
|
+
if (!typescript_1.default.isArrayLiteralExpression(argumentArray)) {
|
|
95
|
+
throw new schematics_1.SchematicsException(`provideYuvCustomTheme([...]) does not contain a valid array in ${filePath}.`);
|
|
96
|
+
}
|
|
97
|
+
// Check if theme already exists
|
|
98
|
+
const themeExists = argumentArray.elements.some((element) => {
|
|
99
|
+
if (!typescript_1.default.isObjectLiteralExpression(element))
|
|
100
|
+
return false;
|
|
101
|
+
return element.properties.some((prop) => typescript_1.default.isPropertyAssignment(prop) &&
|
|
102
|
+
prop.name.text === 'key' &&
|
|
103
|
+
typescript_1.default.isStringLiteral(prop.initializer) &&
|
|
104
|
+
prop.initializer.text === this.themeName);
|
|
105
|
+
});
|
|
106
|
+
if (themeExists) {
|
|
107
|
+
return; // Theme already exists, nothing to do
|
|
108
|
+
}
|
|
109
|
+
// Add new theme to existing array
|
|
110
|
+
const insertPosition = argumentArray.elements.end;
|
|
111
|
+
const prefix = argumentArray.elements.length > 0 ? ',\n ' : '\n ';
|
|
112
|
+
const insertChange = new change_1.InsertChange(filePath, insertPosition, `${prefix}${themeObject}`);
|
|
113
|
+
(0, change_1.applyToUpdateRecorder)(recorder, [insertChange]);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
exports.AddOrUpdateProvideYuvCustomThemeCommand = AddOrUpdateProvideYuvCustomThemeCommand;
|
|
44
118
|
//# sourceMappingURL=app-config-ts.js.map
|