@ngutil/nx 0.0.3-dev.18 → 0.0.3-dev.19
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/executors.json +5 -0
- package/package.json +5 -1
- package/src/executors/webmanifest/README.md +75 -0
- package/src/executors/webmanifest/executor.d.ts +5 -0
- package/src/executors/webmanifest/executor.js +109 -0
- package/src/executors/webmanifest/executor.js.map +1 -0
- package/src/executors/webmanifest/schema.d.ts +12 -0
- package/src/executors/webmanifest/schema.json +53 -0
- package/src/executors/webmanifest/test-assets/colors.json +6 -0
- package/src/executors/webmanifest/test-assets/icon.png +0 -0
- package/src/executors/webmanifest/test-assets/index.html +13 -0
- package/src/executors/webmanifest/test-assets/package.json +9 -0
- package/src/util/import-value.d.ts +6 -0
- package/src/util/import-value.js +30 -0
- package/src/util/import-value.js.map +1 -0
- package/src/util/index.d.ts +1 -0
- package/src/util/index.js +3 -1
- package/src/util/index.js.map +1 -1
package/executors.json
CHANGED
|
@@ -4,6 +4,11 @@
|
|
|
4
4
|
"implementation": "./src/executors/yaml-style/executor",
|
|
5
5
|
"schema": "./src/executors/yaml-style/schema.json",
|
|
6
6
|
"description": "yaml-style executor"
|
|
7
|
+
},
|
|
8
|
+
"webmanifest": {
|
|
9
|
+
"implementation": "./src/executors/webmanifest/executor",
|
|
10
|
+
"schema": "./src/executors/webmanifest/schema.json",
|
|
11
|
+
"description": "webmanifest executor"
|
|
7
12
|
}
|
|
8
13
|
}
|
|
9
14
|
}
|
package/package.json
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ngutil/nx",
|
|
3
|
-
"version": "0.0.3-dev.
|
|
3
|
+
"version": "0.0.3-dev.19",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"directory": "../../dist/packages/nx/"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@nx/devkit": "18.0.5",
|
|
10
|
+
"favicons": "^7.1.5",
|
|
10
11
|
"glob": "^10.3.10",
|
|
11
12
|
"is-plain-object": "^5.0.0",
|
|
13
|
+
"object-path": "^0.11.8",
|
|
14
|
+
"objectpath": "^2.0.0",
|
|
15
|
+
"rimraf": "^5.0.5",
|
|
12
16
|
"tslib": "^2.3.0",
|
|
13
17
|
"yaml": "^2.4.0"
|
|
14
18
|
},
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# webmanifest
|
|
2
|
+
|
|
3
|
+
## Usage
|
|
4
|
+
|
|
5
|
+
Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
nx add @ngutil/nx
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Add to `project.json`
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
// ...
|
|
16
|
+
"targets": {
|
|
17
|
+
// ...
|
|
18
|
+
"webmanifest": {
|
|
19
|
+
"executor": "@ngutil/nx:webmanifest",
|
|
20
|
+
"options": {
|
|
21
|
+
// ...
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Example to `project.json`
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
{
|
|
32
|
+
"tragets": {
|
|
33
|
+
"webmanifest": {
|
|
34
|
+
"executor": "@ngutil/nx:webmanifest",
|
|
35
|
+
"options": {
|
|
36
|
+
"iconPath": "packages/<project-name>/src/main-icon.png",
|
|
37
|
+
"indexHtml": "packages/<project-name>/src/index.html",
|
|
38
|
+
"indexHtmlReplaceTag": "MANIFEST",
|
|
39
|
+
"outputPath": "packages/<project-name>/src/assets/manifest",
|
|
40
|
+
"commitMessage": "chore(app): Update manifest",
|
|
41
|
+
"packageJson": "./package.json",
|
|
42
|
+
"manifest": {
|
|
43
|
+
"path": "assets/manifest",
|
|
44
|
+
"appName": "<project-name>",
|
|
45
|
+
"appShortName": "<app-name>",
|
|
46
|
+
"appDescription": "<app-name>",
|
|
47
|
+
"lang": "hu-HU",
|
|
48
|
+
"background": "#00827C",
|
|
49
|
+
"theme_color": "import('colors.json').Colors.Primary",
|
|
50
|
+
"display": "standalone",
|
|
51
|
+
"orientation": "portrait",
|
|
52
|
+
"scope": "/",
|
|
53
|
+
"start_url": "/"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
For availbale options run:
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
nx run <project-name>:<target> --help
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Autmatically copy options from `package.json` if not present in `manifest` option
|
|
68
|
+
|
|
69
|
+
| `manifest` | `package.json` |
|
|
70
|
+
| ---------- | -------------- |
|
|
71
|
+
| `version` | `version` |
|
|
72
|
+
| `appName` | `name` |
|
|
73
|
+
| `appDescription` | `description` |
|
|
74
|
+
| `developerName` | `author.name` |
|
|
75
|
+
| `developerURL` | `author.url` |
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const favicons_1 = require("favicons");
|
|
5
|
+
const fs = require("fs/promises");
|
|
6
|
+
const is_plain_object_1 = require("is-plain-object");
|
|
7
|
+
const path = require("path");
|
|
8
|
+
const rimraf_1 = require("rimraf");
|
|
9
|
+
const util_1 = require("../../util");
|
|
10
|
+
function runExecutor(options, context) {
|
|
11
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
12
|
+
options.iconPath = path.resolve(withDefault(options, "iconPath", null, true));
|
|
13
|
+
options.indexHtml = path.resolve(withDefault(options, "indexHtml", null, false));
|
|
14
|
+
options.indexHtmlOutput = path.resolve(withDefault(options, "indexHtmlOutput", options.indexHtml, true));
|
|
15
|
+
options.indexHtmlReplaceTag = withDefault(options, "indexHtmlReplaceTag", "WEBMANIFEST", true);
|
|
16
|
+
options.outputPath = path.resolve(withDefault(options, "outputPath", null, true));
|
|
17
|
+
options.packageJson = path.resolve(withDefault(options, "packageJson", null, true));
|
|
18
|
+
options.manifest = withDefault(options, "manifest", null, true);
|
|
19
|
+
options.commitMessage = withDefault(options, "commitMessage", null, false);
|
|
20
|
+
options.noCommit = withDefault(options, "noCommit", false, false);
|
|
21
|
+
options.clean = withDefault(options, "clean", false, false);
|
|
22
|
+
if (options.clean) {
|
|
23
|
+
yield (0, rimraf_1.rimraf)(options.outputPath);
|
|
24
|
+
}
|
|
25
|
+
yield generate(options, context);
|
|
26
|
+
if (options.commitMessage && options.noCommit !== true) {
|
|
27
|
+
const cpaths = [options.outputPath];
|
|
28
|
+
if (options.indexHtmlOutput) {
|
|
29
|
+
cpaths.push(options.indexHtmlOutput);
|
|
30
|
+
}
|
|
31
|
+
yield (0, util_1.commit)(options.commitMessage, cpaths);
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
success: true
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
exports.default = runExecutor;
|
|
39
|
+
function generate(options, context) {
|
|
40
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
const pckg = yield readPackageJson(options.packageJson);
|
|
42
|
+
const config = yield substManifest(options.manifest, context.root);
|
|
43
|
+
if (!config.version) {
|
|
44
|
+
config.version = pckg.version;
|
|
45
|
+
}
|
|
46
|
+
if (!config.appName) {
|
|
47
|
+
config.version = pckg.name;
|
|
48
|
+
}
|
|
49
|
+
if (!config.appDescription) {
|
|
50
|
+
config.appDescription = pckg.description;
|
|
51
|
+
}
|
|
52
|
+
if (!config.developerName && pckg.author) {
|
|
53
|
+
config.developerName = pckg.author.name;
|
|
54
|
+
}
|
|
55
|
+
if (!config.developerURL && pckg.author) {
|
|
56
|
+
config.developerURL = pckg.author.url;
|
|
57
|
+
}
|
|
58
|
+
const generated = yield (0, favicons_1.favicons)(options.iconPath, config);
|
|
59
|
+
const dest = options.outputPath;
|
|
60
|
+
yield fs.mkdir(dest, { recursive: true });
|
|
61
|
+
yield Promise.all(generated.images.map(image => fs.writeFile(path.join(dest, image.name), image.contents)));
|
|
62
|
+
yield Promise.all(generated.files.map(files => fs.writeFile(path.join(dest, files.name), files.contents)));
|
|
63
|
+
if (options.indexHtml && options.indexHtmlReplaceTag) {
|
|
64
|
+
let htmlContent = yield fs.readFile(options.indexHtml, { encoding: "utf-8" });
|
|
65
|
+
const re = new RegExp(`<!-- ${options.indexHtmlReplaceTag}:BEGIN -->(.|\\r|\\n)*?<!-- ${options.indexHtmlReplaceTag}:END -->`, "g");
|
|
66
|
+
const detectIdent = new RegExp(`^(\\s*)<!-- ${options.indexHtmlReplaceTag}:BEGIN -->`, "m");
|
|
67
|
+
const match = htmlContent.match(detectIdent);
|
|
68
|
+
const ident = match[1];
|
|
69
|
+
htmlContent = htmlContent.replace(re,
|
|
70
|
+
// eslint-disable-next-line max-len
|
|
71
|
+
`<!-- ${options.indexHtmlReplaceTag}:BEGIN -->\n${ident}${generated.html.join(`\n${ident}`)}\n${ident}<!-- ${options.indexHtmlReplaceTag}:END -->`);
|
|
72
|
+
yield fs.writeFile(options.indexHtmlOutput, htmlContent);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
function readPackageJson(pth) {
|
|
77
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
78
|
+
return yield Promise.resolve(`${pth}`).then(s => require(s));
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function withDefault(options, key, def, required) {
|
|
82
|
+
if (options[key] == null) {
|
|
83
|
+
if (def == null && required) {
|
|
84
|
+
throw new Error(`Missing '${key}' option`);
|
|
85
|
+
}
|
|
86
|
+
return def;
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
return options[key];
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function substManifest(manifest, root) {
|
|
93
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
94
|
+
if ((0, is_plain_object_1.isPlainObject)(manifest)) {
|
|
95
|
+
const res = {};
|
|
96
|
+
for (const [k, v] of Object.entries(manifest)) {
|
|
97
|
+
res[k] = yield substManifest(v, root);
|
|
98
|
+
}
|
|
99
|
+
return res;
|
|
100
|
+
}
|
|
101
|
+
else if (Array.isArray(manifest)) {
|
|
102
|
+
return manifest.map((v) => tslib_1.__awaiter(this, void 0, void 0, function* () { return yield substManifest(v, root); }));
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
return (0, util_1.importValue)(manifest, root);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../packages/nx/src/executors/webmanifest/executor.ts"],"names":[],"mappings":";;;AACA,uCAAmC;AACnC,kCAAiC;AACjC,qDAA+C;AAC/C,6BAA4B;AAC5B,mCAA+B;AAE/B,qCAAgD;AAGhD,SAA8B,WAAW,CAAC,OAA+B,EAAE,OAAwB;;QAC/F,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA;QAC7E,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAA;QAChF,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,EAAE,iBAAiB,EAAE,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAA;QACxG,OAAO,CAAC,mBAAmB,GAAG,WAAW,CAAC,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,IAAI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ml?: string
|
|
4
|
+
indexHtmlOutput?: string
|
|
5
|
+
indexHtmlReplaceTag?: string
|
|
6
|
+
outputPath: string
|
|
7
|
+
packageJson: string
|
|
8
|
+
manifest: { [key: string]: any }
|
|
9
|
+
commitMessage?: string
|
|
10
|
+
noCommit?: boolean
|
|
11
|
+
clean?: boolean
|
|
12
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"version": 2,
|
|
4
|
+
"title": "Generate webmanifest assets",
|
|
5
|
+
"description": "",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"iconPath": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "Main icon path, that use for generating all icon variants"
|
|
11
|
+
},
|
|
12
|
+
"indexHtml": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"description": "index.html location, WARNING: replace contents if not provide indexHtmlOutput"
|
|
15
|
+
},
|
|
16
|
+
"indexHtmlOutput": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"description": "Updated index.html output, defaults to 'indexHtml', WARNING: replace contents if not provide indexHtmlOutput"
|
|
19
|
+
},
|
|
20
|
+
"indexHtmlReplaceTag": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"description": "In index.html replace these comments: <!-- [indexHtmlReplaceTag]:BEGIN -->[META CONTENT]<!-- [indexHtmlReplaceTag]:END -->",
|
|
23
|
+
"default": "WEBMANIFEST"
|
|
24
|
+
},
|
|
25
|
+
"outputPath": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"description": "Generated assets output path"
|
|
28
|
+
},
|
|
29
|
+
"packageJson": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"description": "package.json location"
|
|
32
|
+
},
|
|
33
|
+
"manifest": {
|
|
34
|
+
"type": "object",
|
|
35
|
+
"description": "More info at https://www.npmjs.com/package/favicons"
|
|
36
|
+
},
|
|
37
|
+
"commitMessage": {
|
|
38
|
+
"type": "string",
|
|
39
|
+
"description": "If commit message is present, the executor automatically commit the changes"
|
|
40
|
+
},
|
|
41
|
+
"noCommit": {
|
|
42
|
+
"type": "boolean",
|
|
43
|
+
"description": "Skip commit even if 'commitMessage' is provided",
|
|
44
|
+
"default": false
|
|
45
|
+
},
|
|
46
|
+
"clean": {
|
|
47
|
+
"type": "boolean",
|
|
48
|
+
"description": "Remove 'outputPath'",
|
|
49
|
+
"default": false
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"required": ["iconPath", "outputPath", "packageJson", "manifest"]
|
|
53
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.importValue = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const ObjectPathGetter = require("object-path");
|
|
6
|
+
const ObjectPathParser = require("objectpath");
|
|
7
|
+
const path = require("path");
|
|
8
|
+
const IMPORT_REGEX = "^import\\(('|\"|`)(?<import>.*?)\\1\\)(?<opath>[.[].+?)$";
|
|
9
|
+
/**
|
|
10
|
+
* ```ts
|
|
11
|
+
* const value = await importValue("import('from').Path.To.Value")
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
function importValue(expr, root) {
|
|
15
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
if (typeof expr !== "string") {
|
|
17
|
+
return expr;
|
|
18
|
+
}
|
|
19
|
+
const match = expr.match(IMPORT_REGEX);
|
|
20
|
+
if (!match) {
|
|
21
|
+
return expr;
|
|
22
|
+
}
|
|
23
|
+
const opath = ObjectPathParser.parse(match.groups["opath"].replace(/^\./, ""));
|
|
24
|
+
const imp = path.join(root, match.groups["import"]);
|
|
25
|
+
const mod = yield Promise.resolve(`${imp}`).then(s => require(s));
|
|
26
|
+
return ObjectPathGetter.get(mod, opath);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
exports.importValue = importValue;
|
|
30
|
+
//# sourceMappingURL=import-value.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-value.js","sourceRoot":"","sources":["../../../../../packages/nx/src/util/import-value.ts"],"names":[],"mappings":";;;;AAAA,gDAA+C;AAC/C,+CAA8C;AAC9C,6BAA4B;AAE5B,MAAM,YAAY,GAAG,0DAA0D,CAAA;AAE/E;;;;GAIG;AACH,SAAsB,WAAW,CAAC,IAAS,EAAE,IAAY;;QACrD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC3B,OAAO,IAAI,CAAA;QACf,CAAC;QAED,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;QACtC,IAAI,CAAC,KAAK,EAAE,CAAC;YACT,OAAO,IAAI,CAAA;QACf,CAAC;QAED,MAAM,KAAK,GAAG,gBAAgB,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAA;QAC9E,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAA;QACnD,MAAM,GAAG,GAAG,yBAAa,GAAG,yBAAC,CAAA;QAC7B,OAAO,gBAAgB,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IAC3C,CAAC;CAAA;AAdD,kCAcC"}
|
package/src/util/index.d.ts
CHANGED
package/src/util/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.commit = exports.spawn = void 0;
|
|
3
|
+
exports.importValue = exports.commit = exports.spawn = void 0;
|
|
4
4
|
var spawn_1 = require("./spawn");
|
|
5
5
|
Object.defineProperty(exports, "spawn", { enumerable: true, get: function () { return spawn_1.spawn; } });
|
|
6
6
|
var git_1 = require("./git");
|
|
7
7
|
Object.defineProperty(exports, "commit", { enumerable: true, get: function () { return git_1.commit; } });
|
|
8
|
+
var import_value_1 = require("./import-value");
|
|
9
|
+
Object.defineProperty(exports, "importValue", { enumerable: true, get: function () { return import_value_1.importValue; } });
|
|
8
10
|
//# sourceMappingURL=index.js.map
|
package/src/util/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/nx/src/util/index.ts"],"names":[],"mappings":";;;AAAA,iCAA+B;AAAtB,8FAAA,KAAK,OAAA;AACd,6BAA8B;AAArB,6FAAA,MAAM,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/nx/src/util/index.ts"],"names":[],"mappings":";;;AAAA,iCAA+B;AAAtB,8FAAA,KAAK,OAAA;AACd,6BAA8B;AAArB,6FAAA,MAAM,OAAA;AACf,+CAA4C;AAAnC,2GAAA,WAAW,OAAA"}
|