tectra-ng 0.4.0 → 0.4.2
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 +10 -2
- package/index.d.ts +1 -0
- package/package.json +30 -12
- package/schematics/migrations/declare-kit-packages/index.js +7 -0
- package/schematics/migrations.json +10 -0
- package/schematics/ng-add/index.js +27 -3
package/README.md
CHANGED
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
ng add tectra-ng
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
-
It installs every tectra package at the same version with the Angular peers
|
|
47
|
+
It installs every tectra package at the same version with the Angular peers and lists them in `package.json` — every package manager and editor then resolves the imports from them. It adds `provideTectra` with the preset you pick (`--style`, `--primary`, `--surface`) to `app.config.ts` and the fonts to `index.html`.
|
|
48
48
|
|
|
49
49
|
Without the Angular CLI, install it and provide a theme by hand:
|
|
50
50
|
|
|
@@ -52,6 +52,14 @@ Without the Angular CLI, install it and provide a theme by hand:
|
|
|
52
52
|
npm i tectra-ng
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
+
pnpm lets an app import only the packages its `package.json` lists, so name them all:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pnpm add tectra-ng @tectra-ng/tokens @tectra-ng/themes @tectra-ng/core @tectra-ng/icons @tectra-ng/brand-icons @tectra-ng/flags @tectra-ng/qr @tectra-ng/ui @tectra-ng/charts @tectra-ng/utils @tectra-ng/blocks
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
`ng update tectra-ng` updates all of them together.
|
|
62
|
+
|
|
55
63
|
Then import components from the packages themselves:
|
|
56
64
|
|
|
57
65
|
```ts
|
|
@@ -92,7 +100,7 @@ export class SaveAction {
|
|
|
92
100
|
| `@tectra-ng/utils` | Pipes, directives, validators and helpers next to the components, one entry point per utility: `@tectra-ng/utils/date`, … |
|
|
93
101
|
| `@tectra-ng/qr` | QR codes with no dependencies — the engine of `@tectra-ng/blocks/qr-code`, usable without Angular too |
|
|
94
102
|
|
|
95
|
-
Need only part of it? Install
|
|
103
|
+
Need only part of it? Install the packages on their own, with the ones the app imports the theme and icons from: `npm i @tectra-ng/ui @tectra-ng/core @tectra-ng/themes @tectra-ng/icons`.
|
|
96
104
|
|
|
97
105
|
The rich text editor is not part of `tectra-ng` — it carries the ProseMirror engine, so it is installed only where it is used:
|
|
98
106
|
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tectra-ng",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "Angular UI component library in one install: 80+ standalone components on signals (table, datepicker, select, dialog, toast, tree), design tokens, light and dark themes, charts, icons, brand logos and flags.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://tectra-ng.com",
|
|
@@ -56,23 +56,41 @@
|
|
|
56
56
|
"utils",
|
|
57
57
|
"icons"
|
|
58
58
|
],
|
|
59
|
+
"types": "./index.d.ts",
|
|
59
60
|
"dependencies": {
|
|
60
|
-
"@tectra-ng/tokens": "^0.4.
|
|
61
|
-
"@tectra-ng/themes": "^0.4.
|
|
62
|
-
"@tectra-ng/core": "^0.4.
|
|
63
|
-
"@tectra-ng/icons": "^0.4.
|
|
64
|
-
"@tectra-ng/brand-icons": "^0.4.
|
|
65
|
-
"@tectra-ng/flags": "^0.4.
|
|
66
|
-
"@tectra-ng/qr": "^0.4.
|
|
67
|
-
"@tectra-ng/ui": "^0.4.
|
|
68
|
-
"@tectra-ng/charts": "^0.4.
|
|
69
|
-
"@tectra-ng/utils": "^0.4.
|
|
70
|
-
"@tectra-ng/blocks": "^0.4.
|
|
61
|
+
"@tectra-ng/tokens": "^0.4.2",
|
|
62
|
+
"@tectra-ng/themes": "^0.4.2",
|
|
63
|
+
"@tectra-ng/core": "^0.4.2",
|
|
64
|
+
"@tectra-ng/icons": "^0.4.2",
|
|
65
|
+
"@tectra-ng/brand-icons": "^0.4.2",
|
|
66
|
+
"@tectra-ng/flags": "^0.4.2",
|
|
67
|
+
"@tectra-ng/qr": "^0.4.2",
|
|
68
|
+
"@tectra-ng/ui": "^0.4.2",
|
|
69
|
+
"@tectra-ng/charts": "^0.4.2",
|
|
70
|
+
"@tectra-ng/utils": "^0.4.2",
|
|
71
|
+
"@tectra-ng/blocks": "^0.4.2"
|
|
71
72
|
},
|
|
72
73
|
"schematics": "./schematics/collection.json",
|
|
73
74
|
"ng-add": {
|
|
74
75
|
"save": "dependencies"
|
|
75
76
|
},
|
|
77
|
+
"ng-update": {
|
|
78
|
+
"migrations": "./schematics/migrations.json",
|
|
79
|
+
"packageGroup": [
|
|
80
|
+
"tectra-ng",
|
|
81
|
+
"@tectra-ng/tokens",
|
|
82
|
+
"@tectra-ng/themes",
|
|
83
|
+
"@tectra-ng/core",
|
|
84
|
+
"@tectra-ng/icons",
|
|
85
|
+
"@tectra-ng/brand-icons",
|
|
86
|
+
"@tectra-ng/flags",
|
|
87
|
+
"@tectra-ng/qr",
|
|
88
|
+
"@tectra-ng/ui",
|
|
89
|
+
"@tectra-ng/charts",
|
|
90
|
+
"@tectra-ng/utils",
|
|
91
|
+
"@tectra-ng/blocks"
|
|
92
|
+
]
|
|
93
|
+
},
|
|
76
94
|
"publishConfig": {
|
|
77
95
|
"access": "public"
|
|
78
96
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.migrateDeclareKitPackages = migrateDeclareKitPackages;
|
|
4
|
+
const index_1 = require("../../ng-add/index");
|
|
5
|
+
function migrateDeclareKitPackages() {
|
|
6
|
+
return (0, index_1.declareKitPackages)();
|
|
7
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../../node_modules/@angular-devkit/schematics/collection-schema.json",
|
|
3
|
+
"schematics": {
|
|
4
|
+
"declare-kit-packages": {
|
|
5
|
+
"version": "0.4.1",
|
|
6
|
+
"description": "Lists the @tectra-ng packages in the dependencies of the app, so every package manager and editor resolves the imports from them.",
|
|
7
|
+
"factory": "./migrations/declare-kit-packages/index#migrateDeclareKitPackages"
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FONT_LINKS = exports.ANGULAR_PEERS = exports.MIN_ANGULAR_MAJOR = void 0;
|
|
4
|
+
exports.kitPackages = kitPackages;
|
|
4
5
|
exports.ngAdd = ngAdd;
|
|
5
6
|
exports.presetOptions = presetOptions;
|
|
6
7
|
exports.resolveProject = resolveProject;
|
|
7
8
|
exports.readAngularRange = readAngularRange;
|
|
9
|
+
exports.declareKitPackages = declareKitPackages;
|
|
8
10
|
exports.indexPath = indexPath;
|
|
9
11
|
exports.insertFontLinks = insertFontLinks;
|
|
12
|
+
const node_fs_1 = require("node:fs");
|
|
13
|
+
const node_path_1 = require("node:path");
|
|
10
14
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
11
15
|
const utility_1 = require("@schematics/angular/utility");
|
|
12
16
|
exports.MIN_ANGULAR_MAJOR = 22;
|
|
@@ -16,6 +20,10 @@ exports.FONT_LINKS = [
|
|
|
16
20
|
'<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />',
|
|
17
21
|
'<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Onest:wght@100..900&family=JetBrains+Mono:wght@400;500&display=swap" />',
|
|
18
22
|
];
|
|
23
|
+
function kitPackages(manifestPath = (0, node_path_1.join)(__dirname, '../../package.json')) {
|
|
24
|
+
const manifest = JSON.parse((0, node_fs_1.readFileSync)(manifestPath, 'utf8'));
|
|
25
|
+
return Object.fromEntries(Object.entries(manifest.dependencies ?? {}).filter(([name]) => name.startsWith('@tectra-ng/')));
|
|
26
|
+
}
|
|
19
27
|
function ngAdd(options) {
|
|
20
28
|
return async (tree) => {
|
|
21
29
|
const workspace = await (0, utility_1.readWorkspace)(tree);
|
|
@@ -24,6 +32,7 @@ function ngAdd(options) {
|
|
|
24
32
|
const angularRange = readAngularRange(tree);
|
|
25
33
|
return (0, schematics_1.chain)([
|
|
26
34
|
addPeers(tree, angularRange, options.skipInstall === true),
|
|
35
|
+
declareKitPackages(options.skipInstall === true),
|
|
27
36
|
addProvider(tree, projectName, project, options),
|
|
28
37
|
options.icons === false ? (0, schematics_1.noop)() : addIcons(tree, projectName, project),
|
|
29
38
|
options.fonts === false ? (0, schematics_1.noop)() : addFonts(project),
|
|
@@ -63,15 +72,30 @@ function readAngularRange(tree) {
|
|
|
63
72
|
}
|
|
64
73
|
return range;
|
|
65
74
|
}
|
|
66
|
-
function
|
|
75
|
+
function missingPackages(tree, names) {
|
|
67
76
|
const manifest = tree.readJson('/package.json');
|
|
68
|
-
|
|
69
|
-
|
|
77
|
+
return names.filter((name) => !manifest.dependencies?.[name] && !manifest.devDependencies?.[name]);
|
|
78
|
+
}
|
|
79
|
+
function addPackages(entries, skipInstall) {
|
|
80
|
+
return (0, schematics_1.chain)(entries.map(([name, range]) => (0, utility_1.addDependency)(name, range, {
|
|
70
81
|
type: utility_1.DependencyType.Default,
|
|
71
82
|
existing: utility_1.ExistingBehavior.Skip,
|
|
72
83
|
install: skipInstall ? utility_1.InstallBehavior.None : utility_1.InstallBehavior.Auto,
|
|
73
84
|
})));
|
|
74
85
|
}
|
|
86
|
+
function addPeers(tree, range, skipInstall) {
|
|
87
|
+
return addPackages(missingPackages(tree, exports.ANGULAR_PEERS).map((name) => [name, range]), skipInstall);
|
|
88
|
+
}
|
|
89
|
+
function declareKitPackages(skipInstall = false, packages = kitPackages()) {
|
|
90
|
+
return (tree, context) => {
|
|
91
|
+
const missing = missingPackages(tree, Object.keys(packages));
|
|
92
|
+
if (missing.length === 0) {
|
|
93
|
+
return (0, schematics_1.noop)();
|
|
94
|
+
}
|
|
95
|
+
context.logger.info(`Added ${missing.join(', ')} to dependencies: the app imports from them, so every package manager and editor has to see them in package.json.`);
|
|
96
|
+
return addPackages(missing.map((name) => [name, packages[name]]), skipInstall);
|
|
97
|
+
};
|
|
98
|
+
}
|
|
75
99
|
function addProvider(tree, projectName, project, options) {
|
|
76
100
|
const existing = findProvider(tree, sourceRoot(project));
|
|
77
101
|
if (existing) {
|