ngx-devkit-builders 0.1.0 → 1.1.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/LICENSE +1 -1
- package/README.md +11 -36
- package/builders.json +5 -0
- package/package.json +3 -3
- package/robots/index.js +37 -0
- package/robots/schema.json +21 -0
- package/version/schema.json +1 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -13,52 +13,27 @@
|
|
|
13
13
|
|
|
14
14
|
This package contains Architect builders used to build and test Angular applications and libraries.
|
|
15
15
|
|
|
16
|
-
> ✓ _Angular
|
|
16
|
+
> ✓ _Angular 17 compatible_
|
|
17
17
|
|
|
18
18
|
## Builders
|
|
19
19
|
|
|
20
|
-
| Name
|
|
21
|
-
|
|
|
22
|
-
| version | Create build information file
|
|
20
|
+
| Name | Description |
|
|
21
|
+
| ---------------------------------- | --------------------------------- |
|
|
22
|
+
| [version](./src/version/README.md) | Create build information file |
|
|
23
|
+
| [robots](./src/robots/README.md) | Create simplified robots.txt file |
|
|
23
24
|
|
|
24
25
|
_More builders can be added in the future._
|
|
25
26
|
|
|
26
|
-
##
|
|
27
|
+
## Compatibility
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
...,
|
|
33
|
-
"projects": {
|
|
34
|
-
"your-project-name": { // project will be different
|
|
35
|
-
...,
|
|
36
|
-
"architect": {
|
|
37
|
-
...,
|
|
38
|
-
"version": { // name can be different if you want
|
|
39
|
-
"builder": "ngx-devkit-builders:version",
|
|
40
|
-
"options": { // not needed
|
|
41
|
-
"outputFile": "src/environments/version.ts", // or src/assets/version.json
|
|
42
|
-
"fields": ["version", "date", "author", "git"], // or custom selection
|
|
43
|
-
"lint": "eslint", // or "tslint"
|
|
44
|
-
"variable": "VERSION", // or whatever you want
|
|
45
|
-
"verbose": false // or true
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
2. Run command
|
|
54
|
-
|
|
55
|
-
```
|
|
56
|
-
ng run your-project-name:version
|
|
57
|
-
```
|
|
29
|
+
| Angular | ngx-app-version | Install |
|
|
30
|
+
| ------- | --------------- | ---------------------------- |
|
|
31
|
+
| >= 17 | 1.x | `yarn add ngx-app-version` |
|
|
32
|
+
| >= 16 | 0.x | `yarn add ngx-app-version@0` |
|
|
58
33
|
|
|
59
34
|
## License
|
|
60
35
|
|
|
61
|
-
Copyright © 2022 -
|
|
36
|
+
Copyright © 2022 - 2024 [Dominik Hladik](https://github.com/Celtian)
|
|
62
37
|
|
|
63
38
|
All contents are licensed under the [MIT license].
|
|
64
39
|
|
package/builders.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ngx-devkit-builders",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Dominik Hladík",
|
|
6
6
|
"email": "dominik.hladik@seznam.cz",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"builders": "builders.json",
|
|
13
13
|
"scripts": {},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@angular-devkit/architect": "^0.
|
|
16
|
-
"@angular-devkit/core": "^
|
|
15
|
+
"@angular-devkit/architect": "^0.1700.8",
|
|
16
|
+
"@angular-devkit/core": "^17.0.8"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {},
|
|
19
19
|
"homepage": "https://github.com/Celtian/ngx-devkit-builders#readme",
|
package/robots/index.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const architect_1 = require("@angular-devkit/architect");
|
|
4
|
+
const core_1 = require("@angular-devkit/core");
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
const createRobots = (options) => {
|
|
7
|
+
const lines = ['User-agent: *'];
|
|
8
|
+
if (options.allow) {
|
|
9
|
+
lines.push('Allow: /');
|
|
10
|
+
if (options.sitemap) {
|
|
11
|
+
lines.push(`Sitemap: ${options.sitemap}`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
lines.push('Disallow: /');
|
|
16
|
+
}
|
|
17
|
+
return lines.join('\n\n');
|
|
18
|
+
};
|
|
19
|
+
exports.default = (0, architect_1.createBuilder)(async ({ allow, sitemap, verbose }, ctx) => {
|
|
20
|
+
ctx.logger.info('🚧 Creating robots file…');
|
|
21
|
+
const rootPath = (0, core_1.getSystemPath)((0, core_1.normalize)(ctx.workspaceRoot));
|
|
22
|
+
if (ctx.target.configuration) {
|
|
23
|
+
ctx.logger.info(`Selected configuration "${ctx.target.configuration}"`);
|
|
24
|
+
}
|
|
25
|
+
const projectMetadata = await ctx.getProjectMetadata(ctx.target.project);
|
|
26
|
+
const targetFile = `${rootPath}/${projectMetadata.sourceRoot}/robots.txt`;
|
|
27
|
+
if (verbose === true)
|
|
28
|
+
ctx.logger.info(`Target file is here "${targetFile}"`);
|
|
29
|
+
(0, fs_1.writeFileSync)(targetFile, createRobots({
|
|
30
|
+
allow,
|
|
31
|
+
sitemap,
|
|
32
|
+
}), { encoding: 'utf-8' });
|
|
33
|
+
ctx.logger.info(`✔️ Robots file successfully created in ${targetFile}`);
|
|
34
|
+
return {
|
|
35
|
+
success: true,
|
|
36
|
+
};
|
|
37
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"allow": {
|
|
6
|
+
"description": "Allow or disallow",
|
|
7
|
+
"type": "boolean",
|
|
8
|
+
"default": false
|
|
9
|
+
},
|
|
10
|
+
"sitemap": {
|
|
11
|
+
"description": "Sitemap.xml url",
|
|
12
|
+
"type": "string",
|
|
13
|
+
"default": ""
|
|
14
|
+
},
|
|
15
|
+
"verbose": {
|
|
16
|
+
"description": "Extended logging output",
|
|
17
|
+
"type": "boolean",
|
|
18
|
+
"default": false
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|