From 7f616fbcef5c6e5ab3e689f522edb4b0c24a5a26 Mon Sep 17 00:00:00 2001 From: Gery Hirschfeld Date: Sat, 13 Jan 2024 15:54:16 +0100 Subject: [PATCH 1/6] feat: add schematics for angular and nx projects --- .changeset/shiny-rockets-shake.md | 5 + package-lock.json | 198 ++++-- packages/schematics/.gitignore | 19 + packages/schematics/.npmignore | 4 + packages/schematics/LICENSE | 201 ++++++ packages/schematics/README.md | 38 ++ packages/schematics/package-lock.json | 573 ++++++++++++++++++ packages/schematics/package.json | 37 ++ packages/schematics/src/collection.json | 11 + .../i18n.initialize/i18n.initialize.__ts__ | 32 + .../ng-add/files/polyfills/polyfills.__ts__ | 5 + .../ng-add/files/zone-flags/zone-flags.__ts__ | 6 + .../src/ng-add/generators/app.get.ts | 105 ++++ .../src/ng-add/generators/i18n.gen.ts | 10 + .../src/ng-add/generators/polyfills.gen.ts | 11 + .../src/ng-add/generators/project.gen.ts | 47 ++ .../src/ng-add/generators/styles.ts | 42 ++ .../src/ng-add/generators/ts-config.gen.ts | 19 + .../src/ng-add/generators/zone-flags.gen.ts | 10 + packages/schematics/src/ng-add/index.ts | 81 +++ packages/schematics/src/ng-add/schema.json | 29 + packages/schematics/src/ng-add/schema.ts | 21 + .../schematics/src/ng-add/utils/workspace.ts | 24 + packages/schematics/tsconfig.json | 24 + 24 files changed, 1511 insertions(+), 41 deletions(-) create mode 100644 .changeset/shiny-rockets-shake.md create mode 100644 packages/schematics/.gitignore create mode 100644 packages/schematics/.npmignore create mode 100644 packages/schematics/LICENSE create mode 100644 packages/schematics/README.md create mode 100644 packages/schematics/package-lock.json create mode 100644 packages/schematics/package.json create mode 100644 packages/schematics/src/collection.json create mode 100644 packages/schematics/src/ng-add/files/i18n.initialize/i18n.initialize.__ts__ create mode 100644 packages/schematics/src/ng-add/files/polyfills/polyfills.__ts__ create mode 100644 packages/schematics/src/ng-add/files/zone-flags/zone-flags.__ts__ create mode 100644 packages/schematics/src/ng-add/generators/app.get.ts create mode 100644 packages/schematics/src/ng-add/generators/i18n.gen.ts create mode 100644 packages/schematics/src/ng-add/generators/polyfills.gen.ts create mode 100644 packages/schematics/src/ng-add/generators/project.gen.ts create mode 100644 packages/schematics/src/ng-add/generators/styles.ts create mode 100644 packages/schematics/src/ng-add/generators/ts-config.gen.ts create mode 100644 packages/schematics/src/ng-add/generators/zone-flags.gen.ts create mode 100644 packages/schematics/src/ng-add/index.ts create mode 100644 packages/schematics/src/ng-add/schema.json create mode 100644 packages/schematics/src/ng-add/schema.ts create mode 100644 packages/schematics/src/ng-add/utils/workspace.ts create mode 100644 packages/schematics/tsconfig.json diff --git a/.changeset/shiny-rockets-shake.md b/.changeset/shiny-rockets-shake.md new file mode 100644 index 0000000000..2cca7211f6 --- /dev/null +++ b/.changeset/shiny-rockets-shake.md @@ -0,0 +1,5 @@ +--- +'@baloise/design-system-schematics': minor +--- + +Add an Angular schematic to seamlessly integrate the design system into your existing project. diff --git a/package-lock.json b/package-lock.json index ab8afab029..3610c18801 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2525,6 +2525,10 @@ "resolved": "packages/output-targets/vue", "link": true }, + "node_modules/@baloise/design-system-schematics": { + "resolved": "packages/schematics", + "link": true + }, "node_modules/@baloise/design-system-testing": { "resolved": "packages/testing", "link": true @@ -9390,7 +9394,6 @@ "version": "8.11.0", "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", - "dev": true, "dependencies": { "fast-deep-equal": "^3.1.1", "json-schema-traverse": "^1.0.0", @@ -9406,7 +9409,6 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", - "dev": true, "dependencies": { "ajv": "^8.0.0" }, @@ -9543,7 +9545,7 @@ "version": "3.1.3", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "dev": true, + "devOptional": true, "dependencies": { "normalize-path": "^3.0.0", "picomatch": "^2.0.4" @@ -10222,7 +10224,7 @@ "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "dev": true, + "devOptional": true, "engines": { "node": ">=8" } @@ -10243,7 +10245,6 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", - "dev": true, "dependencies": { "buffer": "^5.5.0", "inherits": "^2.0.4", @@ -10553,7 +10554,7 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, + "devOptional": true, "dependencies": { "fill-range": "^7.0.1" }, @@ -11072,7 +11073,7 @@ "version": "3.5.3", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", - "dev": true, + "devOptional": true, "funding": [ { "type": "individual", @@ -11234,7 +11235,6 @@ "version": "2.9.2", "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.2.tgz", "integrity": "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==", - "dev": true, "engines": { "node": ">=6" }, @@ -11349,7 +11349,6 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", "integrity": "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==", - "dev": true, "engines": { "node": ">=0.8" } @@ -13922,7 +13921,6 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz", "integrity": "sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==", - "dev": true, "dependencies": { "clone": "^1.0.2" }, @@ -15706,8 +15704,7 @@ "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, "node_modules/fast-diff": { "version": "1.3.0", @@ -15958,7 +15955,7 @@ "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, + "devOptional": true, "dependencies": { "to-regex-range": "^5.0.1" }, @@ -17053,7 +17050,7 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, + "devOptional": true, "dependencies": { "is-glob": "^4.0.1" }, @@ -18224,7 +18221,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, + "devOptional": true, "dependencies": { "binary-extensions": "^2.0.0" }, @@ -18380,7 +18377,7 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "dev": true, + "devOptional": true, "engines": { "node": ">=0.10.0" } @@ -18428,7 +18425,7 @@ "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, + "devOptional": true, "dependencies": { "is-extglob": "^2.1.1" }, @@ -18474,7 +18471,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz", "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==", - "dev": true, "engines": { "node": ">=8" } @@ -18541,7 +18537,7 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true, + "devOptional": true, "engines": { "node": ">=0.12.0" } @@ -19630,8 +19626,7 @@ "node_modules/json-schema-traverse": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", @@ -19659,8 +19654,7 @@ "node_modules/jsonc-parser": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", - "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", - "dev": true + "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==" }, "node_modules/jsonfile": { "version": "6.1.0", @@ -22705,7 +22699,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true, + "devOptional": true, "engines": { "node": ">=0.10.0" } @@ -23202,7 +23196,6 @@ "version": "5.4.1", "resolved": "https://registry.npmjs.org/ora/-/ora-5.4.1.tgz", "integrity": "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==", - "dev": true, "dependencies": { "bl": "^4.1.0", "chalk": "^4.1.0", @@ -23225,7 +23218,6 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, "dependencies": { "color-convert": "^2.0.1" }, @@ -23240,7 +23232,6 @@ "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -23256,7 +23247,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, "engines": { "node": ">=8" } @@ -23265,7 +23255,6 @@ "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, "dependencies": { "has-flag": "^4.0.0" }, @@ -23871,7 +23860,7 @@ "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, + "devOptional": true, "engines": { "node": ">=8.6" }, @@ -25245,7 +25234,6 @@ "version": "3.6.2", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "dev": true, "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -25289,7 +25277,7 @@ "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dev": true, + "devOptional": true, "dependencies": { "picomatch": "^2.2.1" }, @@ -25996,7 +25984,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -27154,7 +27141,6 @@ "version": "0.7.4", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", - "dev": true, "engines": { "node": ">= 8" } @@ -27479,7 +27465,6 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dev": true, "dependencies": { "safe-buffer": "~5.2.0" } @@ -27488,7 +27473,6 @@ "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true, "funding": [ { "type": "github", @@ -28271,7 +28255,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, + "devOptional": true, "dependencies": { "is-number": "^7.0.0" }, @@ -28875,6 +28859,12 @@ "node": ">=14.0" } }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + }, "node_modules/unicode-canonical-property-names-ecmascript": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz", @@ -29282,7 +29272,6 @@ "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dev": true, "dependencies": { "punycode": "^2.1.0" } @@ -29392,8 +29381,7 @@ "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", - "dev": true + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" }, "node_modules/utils-merge": { "version": "1.0.1", @@ -29791,7 +29779,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", "integrity": "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==", - "dev": true, "dependencies": { "defaults": "^1.0.3" } @@ -30709,6 +30696,135 @@ "vue": "^3.2.37" } }, + "packages/schematics": { + "version": "0.0.1", + "license": "Apache-2.0", + "dependencies": { + "@angular-devkit/core": "^17.0.10", + "@angular-devkit/schematics": "^17.0.10", + "@schematics/angular": "^17.0.10", + "typescript": "~5.2.2" + }, + "devDependencies": { + "@types/node": "^20.11.0" + } + }, + "packages/schematics/node_modules/@angular-devkit/core": { + "version": "17.0.10", + "resolved": "https://registry.npmjs.org/@angular-devkit/core/-/core-17.0.10.tgz", + "integrity": "sha512-93N6oHnmtRt0hL3AXxvnk47sN1rHndfj+pqI5haEY41AGWzIWv9cSBsqlM0PWltNpo6VivcExZESvbLJ71wqbQ==", + "dependencies": { + "ajv": "8.12.0", + "ajv-formats": "2.1.1", + "jsonc-parser": "3.2.0", + "picomatch": "3.0.1", + "rxjs": "7.8.1", + "source-map": "0.7.4" + }, + "engines": { + "node": "^18.13.0 || >=20.9.0", + "npm": "^6.11.0 || ^7.5.6 || >=8.0.0", + "yarn": ">= 1.13.0" + }, + "peerDependencies": { + "chokidar": "^3.5.2" + }, + "peerDependenciesMeta": { + "chokidar": { + "optional": true + } + } + }, + "packages/schematics/node_modules/@angular-devkit/schematics": { + "version": "17.0.10", + "resolved": "https://registry.npmjs.org/@angular-devkit/schematics/-/schematics-17.0.10.tgz", + "integrity": "sha512-hjf4gaMx2uB6ZhBstBSH0Q2hzfp6kxI4IiJ5i1QrxPNE1MdGnb2h+LgPTRCdO72a7PGeWcSxFRE7cxrXeQy19g==", + "dependencies": { + "@angular-devkit/core": "17.0.10", + "jsonc-parser": "3.2.0", + "magic-string": "0.30.5", + "ora": "5.4.1", + "rxjs": "7.8.1" + }, + "engines": { + "node": "^18.13.0 || >=20.9.0", + "npm": "^6.11.0 || ^7.5.6 || >=8.0.0", + "yarn": ">= 1.13.0" + } + }, + "packages/schematics/node_modules/@schematics/angular": { + "version": "17.0.10", + "resolved": "https://registry.npmjs.org/@schematics/angular/-/angular-17.0.10.tgz", + "integrity": "sha512-rRBlDMXfVPkW3CqVQxazFqkuJXd0BFnD1zjI9WtDiNt3o2pTHbLzuWJnXKuIt5rzv0x/bFwNqIt4CPW2DYGNMg==", + "dependencies": { + "@angular-devkit/core": "17.0.10", + "@angular-devkit/schematics": "17.0.10", + "jsonc-parser": "3.2.0" + }, + "engines": { + "node": "^18.13.0 || >=20.9.0", + "npm": "^6.11.0 || ^7.5.6 || >=8.0.0", + "yarn": ">= 1.13.0" + } + }, + "packages/schematics/node_modules/@types/node": { + "version": "20.11.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.0.tgz", + "integrity": "sha512-o9bjXmDNcF7GbM4CNQpmi+TutCgap/K3w1JyKgxAjqx41zp9qlIAVFi0IhCNsJcXolEqLWhbFbEeL0PvYm4pcQ==", + "dev": true, + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "packages/schematics/node_modules/ajv": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "packages/schematics/node_modules/magic-string": { + "version": "0.30.5", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.5.tgz", + "integrity": "sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA==", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.4.15" + }, + "engines": { + "node": ">=12" + } + }, + "packages/schematics/node_modules/picomatch": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-3.0.1.tgz", + "integrity": "sha512-I3EurrIQMlRc9IaAZnqRR044Phh2DXY+55o7uJ0V+hYZAcQYSuFWsc9q5PvyDHUSCe1Qxn/iBz+78s86zWnGag==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "packages/schematics/node_modules/typescript": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", + "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, "packages/testing": { "name": "@baloise/design-system-testing", "version": "15.1.1", diff --git a/packages/schematics/.gitignore b/packages/schematics/.gitignore new file mode 100644 index 0000000000..d4b3bf2873 --- /dev/null +++ b/packages/schematics/.gitignore @@ -0,0 +1,19 @@ + +# Outputs +src/**/*.js +src/**/*.js.map +src/**/*.d.ts + +# IDEs +.idea/ +jsconfig.json +.vscode/ + +# Misc +node_modules/ +npm-debug.log* +yarn-error.log* + +# Mac OSX Finder files. +**/.DS_Store +.DS_Store diff --git a/packages/schematics/.npmignore b/packages/schematics/.npmignore new file mode 100644 index 0000000000..7c31f4692f --- /dev/null +++ b/packages/schematics/.npmignore @@ -0,0 +1,4 @@ + +# Ignores TypeScript files, but keeps definitions. +*.ts +!*.d.ts diff --git a/packages/schematics/LICENSE b/packages/schematics/LICENSE new file mode 100644 index 0000000000..ccfcddd007 --- /dev/null +++ b/packages/schematics/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2020 Baloise Group + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/packages/schematics/README.md b/packages/schematics/README.md new file mode 100644 index 0000000000..282f2a13f6 --- /dev/null +++ b/packages/schematics/README.md @@ -0,0 +1,38 @@ + + Baloise Design System + + +
+ +[![Continuous](https://github.com/baloise/design-system/actions/workflows/continuous.yml/badge.svg?branch=main)](https://github.com/baloise/design-system/actions/workflows/continuous.yml) + +![npm](https://img.shields.io/npm/v/@baloise/design-system-components) +![npm bundle size](https://img.shields.io/bundlephobia/min/@baloise/design-system-components) +![npm](https://img.shields.io/npm/dt/@baloise/design-system-components) +![GitHub](https://img.shields.io/github/license/baloise/design-system) +![GitHub issues](https://img.shields.io/github/issues/baloise/design-system) +[![Registred on webnamespaces.org](https://img.shields.io/static/v1?label=webnamespaces.org&color=blue&message=bal)](https://webnamespaces.org) +![Built With Stencil](https://img.shields.io/badge/-Built%20With%20Stencil-16161d.svg?logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMSwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCA1MTIgNTEyIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA1MTIgNTEyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI%2BCjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI%2BCgkuc3Qwe2ZpbGw6I0ZGRkZGRjt9Cjwvc3R5bGU%2BCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik00MjQuNywzNzMuOWMwLDM3LjYtNTUuMSw2OC42LTkyLjcsNjguNkgxODAuNGMtMzcuOSwwLTkyLjctMzAuNy05Mi43LTY4LjZ2LTMuNmgzMzYuOVYzNzMuOXoiLz4KPHBhdGggY2xhc3M9InN0MCIgZD0iTTQyNC43LDI5Mi4xSDE4MC40Yy0zNy42LDAtOTIuNy0zMS05Mi43LTY4LjZ2LTMuNkgzMzJjMzcuNiwwLDkyLjcsMzEsOTIuNyw2OC42VjI5Mi4xeiIvPgo8cGF0aCBjbGFzcz0ic3QwIiBkPSJNNDI0LjcsMTQxLjdIODcuN3YtMy42YzAtMzcuNiw1NC44LTY4LjYsOTIuNy02OC42SDMzMmMzNy45LDAsOTIuNywzMC43LDkyLjcsNjguNlYxNDEuN3oiLz4KPC9zdmc%2BCg%3D%3D&colorA=16161d&style=flat-square) + +## About + +The Baloise Design System consists of reusable components and a clearly defined visual style, that can be assembled together to build any number of applications. + +Check out the [documentation](https://design.baloise.dev). + +## Packages + +| Package | Status | Description | +| ------------------------------------------------------- | ------------------------------------------------------------------------------ | ----------------------------------------------------------------------- | +| [Components](https://design.baloise.dev) | ![npm](https://img.shields.io/npm/v/@baloise/design-system-components) | Core package build with web components and global styling. | +| [Components Angular](https://design.baloise.dev) | ![npm](https://img.shields.io/npm/v/@baloise/design-system-components-angular) | Angular component proxies based on the the core package. | +| [Components Vue](https://design.baloise.dev) | ![npm](https://img.shields.io/npm/v/@baloise/design-system-components-vue) | Vue component proxies based on the the core package. | +| [Components React](https://design.baloise.dev) | ![npm](https://img.shields.io/npm/v/@baloise/design-system-components-react) | React component proxies based on the the core package. | +| [Components Table](https://design.baloise.dev) | ![npm](https://img.shields.io/npm/v/@baloise/design-system-components-table) | Integration library for AG-Grid with styles and renderer functions | +| [Tokens](https://design.baloise.dev) | ![npm](https://img.shields.io/npm/v/@baloise/design-system-tokens) | Design Tokens like color and spacing. | +| [CSS](https://design.baloise.dev) | ![npm](https://img.shields.io/npm/v/@baloise/design-system-css) | Basic CSS styles with utility classes. | +| [Icons](https://design.baloise.dev) | ![npm](https://img.shields.io/npm/v/@baloise/design-system-icons) | SVG icons of the design system. | +| [Favicons](https://design.baloise.dev) | ![npm](https://img.shields.io/npm/v/@baloise/design-system-favicons) | Favicons of the design system. | +| [Maps](https://design.baloise.dev) | ![npm](https://img.shields.io/npm/v/@baloise/design-system-maps) | Google Maps styles and icons. | +| [Fonts](https://design.baloise.dev) | ![npm](https://img.shields.io/npm/v/@baloise/design-system-fonts) | Web-Font of the design system. | +| [Testing](https://design.baloise.dev) | ![npm](https://img.shields.io/npm/v/@baloise/design-system-testing) | Testing package with custom and overridden commands for each component. | diff --git a/packages/schematics/package-lock.json b/packages/schematics/package-lock.json new file mode 100644 index 0000000000..edd8179b03 --- /dev/null +++ b/packages/schematics/package-lock.json @@ -0,0 +1,573 @@ +{ + "name": "@baloise/design-system-schematics", + "version": "0.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "@baloise/design-system-schematics", + "version": "0.0.0", + "license": "Apache-2.0", + "dependencies": { + "@angular-devkit/core": "^17.0.10", + "@angular-devkit/schematics": "^17.0.10", + "@schematics/angular": "^17.0.10", + "typescript": "~5.2.2" + }, + "devDependencies": { + "@types/node": "^20.11.0" + } + }, + "node_modules/@angular-devkit/core": { + "version": "17.0.10", + "resolved": "https://registry.npmjs.org/@angular-devkit/core/-/core-17.0.10.tgz", + "integrity": "sha512-93N6oHnmtRt0hL3AXxvnk47sN1rHndfj+pqI5haEY41AGWzIWv9cSBsqlM0PWltNpo6VivcExZESvbLJ71wqbQ==", + "dependencies": { + "ajv": "8.12.0", + "ajv-formats": "2.1.1", + "jsonc-parser": "3.2.0", + "picomatch": "3.0.1", + "rxjs": "7.8.1", + "source-map": "0.7.4" + }, + "engines": { + "node": "^18.13.0 || >=20.9.0", + "npm": "^6.11.0 || ^7.5.6 || >=8.0.0", + "yarn": ">= 1.13.0" + }, + "peerDependencies": { + "chokidar": "^3.5.2" + }, + "peerDependenciesMeta": { + "chokidar": { + "optional": true + } + } + }, + "node_modules/@angular-devkit/schematics": { + "version": "17.0.10", + "resolved": "https://registry.npmjs.org/@angular-devkit/schematics/-/schematics-17.0.10.tgz", + "integrity": "sha512-hjf4gaMx2uB6ZhBstBSH0Q2hzfp6kxI4IiJ5i1QrxPNE1MdGnb2h+LgPTRCdO72a7PGeWcSxFRE7cxrXeQy19g==", + "dependencies": { + "@angular-devkit/core": "17.0.10", + "jsonc-parser": "3.2.0", + "magic-string": "0.30.5", + "ora": "5.4.1", + "rxjs": "7.8.1" + }, + "engines": { + "node": "^18.13.0 || >=20.9.0", + "npm": "^6.11.0 || ^7.5.6 || >=8.0.0", + "yarn": ">= 1.13.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==" + }, + "node_modules/@schematics/angular": { + "version": "17.0.10", + "resolved": "https://registry.npmjs.org/@schematics/angular/-/angular-17.0.10.tgz", + "integrity": "sha512-rRBlDMXfVPkW3CqVQxazFqkuJXd0BFnD1zjI9WtDiNt3o2pTHbLzuWJnXKuIt5rzv0x/bFwNqIt4CPW2DYGNMg==", + "dependencies": { + "@angular-devkit/core": "17.0.10", + "@angular-devkit/schematics": "17.0.10", + "jsonc-parser": "3.2.0" + }, + "engines": { + "node": "^18.13.0 || >=20.9.0", + "npm": "^6.11.0 || ^7.5.6 || >=8.0.0", + "yarn": ">= 1.13.0" + } + }, + "node_modules/@types/node": { + "version": "20.11.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.0.tgz", + "integrity": "sha512-o9bjXmDNcF7GbM4CNQpmi+TutCgap/K3w1JyKgxAjqx41zp9qlIAVFi0IhCNsJcXolEqLWhbFbEeL0PvYm4pcQ==", + "dev": true, + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/ajv": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-formats": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", + "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", + "dependencies": { + "ajv": "^8.0.0" + }, + "peerDependencies": { + "ajv": "^8.0.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "dependencies": { + "restore-cursor": "^3.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cli-spinners": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.2.tgz", + "integrity": "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==", + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/defaults": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz", + "integrity": "sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==", + "dependencies": { + "clone": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/is-interactive": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz", + "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" + }, + "node_modules/jsonc-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", + "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==" + }, + "node_modules/log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "dependencies": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/magic-string": { + "version": "0.30.5", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.5.tgz", + "integrity": "sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA==", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.4.15" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "engines": { + "node": ">=6" + } + }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/ora/-/ora-5.4.1.tgz", + "integrity": "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==", + "dependencies": { + "bl": "^4.1.0", + "chalk": "^4.1.0", + "cli-cursor": "^3.1.0", + "cli-spinners": "^2.5.0", + "is-interactive": "^1.0.0", + "is-unicode-supported": "^0.1.0", + "log-symbols": "^4.1.0", + "strip-ansi": "^6.0.0", + "wcwidth": "^1.0.1" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/ora/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/picomatch": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-3.0.1.tgz", + "integrity": "sha512-I3EurrIQMlRc9IaAZnqRR044Phh2DXY+55o7uJ0V+hYZAcQYSuFWsc9q5PvyDHUSCe1Qxn/iBz+78s86zWnGag==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "engines": { + "node": ">=6" + } + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "dependencies": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/restore-cursor/node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" + }, + "node_modules/rxjs": { + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", + "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/source-map": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", + "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", + "engines": { + "node": ">= 8" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" + }, + "node_modules/typescript": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", + "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, + "node_modules/wcwidth": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==", + "dependencies": { + "defaults": "^1.0.3" + } + } + } +} diff --git a/packages/schematics/package.json b/packages/schematics/package.json new file mode 100644 index 0000000000..23ef4968bf --- /dev/null +++ b/packages/schematics/package.json @@ -0,0 +1,37 @@ +{ + "name": "@baloise/design-system-schematics", + "version": "0.0.1", + "description": "The Baloise Design-System is an open source project for styling awesome web applications that follow the Baloise corporate styling guidelines.", + "scripts": { + "build": "tsc -p tsconfig.json" + }, + "keywords": [ + "design-system", + "schematics" + ], + "publishConfig": { + "access": "public" + }, + "bugs": { + "url": "https://github.com/baloise/design-system/issues" + }, + "homepage": "https://design.baloise.dev", + "contributors": [ + "Gery Hirschfeld (https://github.com/hirsch88)", + "Yannick Holzenkamp (https://github.com/yannickholzenkamp)", + "Petar Nobilo (https://github.com/nobilo)", + "Mladen Planinicic (https://github.com/mladenplaninicic)", + "Andreas Stebler (https://github.com/Clastzoo)" + ], + "license": "Apache-2.0", + "schematics": "./src/collection.json", + "dependencies": { + "@angular-devkit/core": "^17.0.10", + "@angular-devkit/schematics": "^17.0.10", + "@schematics/angular": "^17.0.10", + "typescript": "~5.2.2" + }, + "devDependencies": { + "@types/node": "^20.11.0" + } +} diff --git a/packages/schematics/src/collection.json b/packages/schematics/src/collection.json new file mode 100644 index 0000000000..dc62d30ee1 --- /dev/null +++ b/packages/schematics/src/collection.json @@ -0,0 +1,11 @@ +{ + "$schema": "../node_modules/@angular-devkit/schematics/collection-schema.json", + "schematics": { + "ng-add": { + "aliases": ["init"], + "schema": "./ng-add/schema.json", + "factory": "./ng-add/index", + "description": "Add Baloise Design System" + } + } +} diff --git a/packages/schematics/src/ng-add/files/i18n.initialize/i18n.initialize.__ts__ b/packages/schematics/src/ng-add/files/i18n.initialize/i18n.initialize.__ts__ new file mode 100644 index 0000000000..fef5a53ba1 --- /dev/null +++ b/packages/schematics/src/ng-add/files/i18n.initialize/i18n.initialize.__ts__ @@ -0,0 +1,32 @@ +import { + BalConfigState, + BalLanguage, + onBalConfigChange, +} from '@baloise/design-system-components'; +import { BalConfigService } from '@baloise/design-system-components-angular/standalone'; +import { TranslocoService } from '@ngneat/transloco'; + +export function initializeI18n( + transloco: TranslocoService, + balConfig: BalConfigService +) { + return (): Promise => { + const activeLanguage = transloco.getActiveLang() as BalLanguage; + const allowedLanguages = transloco.getAvailableLangs() as BalLanguage[]; + + balConfig.setLanguage(activeLanguage); + balConfig.setAllowedLanguages(allowedLanguages); + + onBalConfigChange((config: BalConfigState) => { + if (transloco.getActiveLang() !== config.language) { + transloco.setActiveLang(config.language); + } + }); + + transloco.langChanges$.subscribe((value) => { + balConfig.setLanguage(value as BalLanguage); + }); + + return Promise.resolve(); + }; +} diff --git a/packages/schematics/src/ng-add/files/polyfills/polyfills.__ts__ b/packages/schematics/src/ng-add/files/polyfills/polyfills.__ts__ new file mode 100644 index 0000000000..352724176f --- /dev/null +++ b/packages/schematics/src/ng-add/files/polyfills/polyfills.__ts__ @@ -0,0 +1,5 @@ +/*************************************************************************************************** + * Zone JS is required by default for Angular itself. + */ +import './zone-flags' +import 'zone.js' // Included with Angular CLI. diff --git a/packages/schematics/src/ng-add/files/zone-flags/zone-flags.__ts__ b/packages/schematics/src/ng-add/files/zone-flags/zone-flags.__ts__ new file mode 100644 index 0000000000..ada6d2a3ef --- /dev/null +++ b/packages/schematics/src/ng-add/files/zone-flags/zone-flags.__ts__ @@ -0,0 +1,6 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +// disable patching requestAnimationFrame +(window as any).__Zone_disable_requestAnimationFrame = true; + +// disable patching custom elements (web components) +(window as any).__Zone_disable_customElements = true; diff --git a/packages/schematics/src/ng-add/generators/app.get.ts b/packages/schematics/src/ng-add/generators/app.get.ts new file mode 100644 index 0000000000..303c0ac05f --- /dev/null +++ b/packages/schematics/src/ng-add/generators/app.get.ts @@ -0,0 +1,105 @@ +import { SchematicsException, Tree } from '@angular-devkit/schematics'; +import { SchemaOptions } from '../schema'; + +export const updateAppComponent = (host: Tree, options: SchemaOptions) => { + const prefix = options.project || 'app'; + + const appTemplatePath = `src/app/app.component.html`; + const appComponentPath = `src/app/app.component.ts`; + const appStylesPath = `src/app/app.component.css`; + const appStylesSassPath = `src/app/app.component.scss`; + + const isInlineTemplate = !host.exists(appTemplatePath); + const hasCssStyles = host.exists(appStylesPath); + const hasSassStyles = host.exists(appStylesSassPath); + const hasStyles = hasCssStyles || hasSassStyles; + const styleTemplate = hasStyles + ? `styleUrl: './app.component.${hasCssStyles ? 'css' : 'scss'}',` + : ''; + + const appComponentBuffer = host.read(appComponentPath); + if (appComponentBuffer) { + const appComponentContent = appComponentBuffer.toString(); + const isOnPush = appComponentContent.includes( + 'ChangeDetectionStrategy.OnPush' + ); + const onPushTemplate = isOnPush + ? `changeDetection: ChangeDetectionStrategy.OnPush,` + : ''; + + if (isInlineTemplate) { + host.overwrite( + appComponentPath, + ` + import { Component, CUSTOM_ELEMENTS_SCHEMA${ + isOnPush ? ', ChangeDetectionStrategy' : '' + } } from '@angular/core' + import { CommonModule } from '@angular/common' + import { BalLayoutBundle, BalHeading, BalButton } from '@baloise/design-system-components-angular/standalone' + + @Component({ + selector: '${prefix}-root', + standalone: true,${onPushTemplate} + schemas: [CUSTOM_ELEMENTS_SCHEMA], + imports: [CommonModule, BalLayoutBundle, BalHeading, BalButton], + ${styleTemplate} + template: \` +
+ +
+
+ + Hello World! + Button +
+ + + +
\`, + }) + export class AppComponent {} + ` + ); + } else { + host.overwrite( + appComponentPath, + ` + import { Component, CUSTOM_ELEMENTS_SCHEMA${ + isOnPush ? ', ChangeDetectionStrategy' : '' + } } from '@angular/core' + import { CommonModule } from '@angular/common' + import { BalLayoutBundle, BalHeading, BalButton } from '@baloise/design-system-components-angular/standalone' + + @Component({ + selector: '${prefix}-root', + standalone: true,${onPushTemplate} + schemas: [CUSTOM_ELEMENTS_SCHEMA], + imports: [CommonModule, BalLayoutBundle, BalHeading, BalButton], + templateUrl: './app.component.html', + ${styleTemplate} + }) + export class AppComponent {} + ` + ); + + host.overwrite( + appTemplatePath, + ` +
+ +
+
+ + Hello World! + Button +
+ + + +
` + ); + } + } else { + throw new SchematicsException(`Could not find (${appComponentPath})`); + } +}; diff --git a/packages/schematics/src/ng-add/generators/i18n.gen.ts b/packages/schematics/src/ng-add/generators/i18n.gen.ts new file mode 100644 index 0000000000..81f038b22b --- /dev/null +++ b/packages/schematics/src/ng-add/generators/i18n.gen.ts @@ -0,0 +1,10 @@ +import { Source, apply, move, template, url } from '@angular-devkit/schematics'; + +export function createI18nFile(): Source { + return apply(url(`./files/i18n.initialize`), [ + template({ + ts: 'ts', + }), + move('/', 'src/app'), + ]); +} diff --git a/packages/schematics/src/ng-add/generators/polyfills.gen.ts b/packages/schematics/src/ng-add/generators/polyfills.gen.ts new file mode 100644 index 0000000000..7be77d111c --- /dev/null +++ b/packages/schematics/src/ng-add/generators/polyfills.gen.ts @@ -0,0 +1,11 @@ +import { Source, apply, move, template, url } from '@angular-devkit/schematics'; + +export function createPolyfillsFile(): Source { + return apply(url(`./files/polyfills`), [ + template({ + ts: 'ts', + }), + move('/', 'src'), + ]); +} + diff --git a/packages/schematics/src/ng-add/generators/project.gen.ts b/packages/schematics/src/ng-add/generators/project.gen.ts new file mode 100644 index 0000000000..a459839b64 --- /dev/null +++ b/packages/schematics/src/ng-add/generators/project.gen.ts @@ -0,0 +1,47 @@ +import { Tree } from '@angular-devkit/schematics'; +import { + getAngularWorkspace, + getNXWorkspace, + isNxWorkspace, +} from '../utils/workspace'; + +const POLYFILLS = ['./src/polyfills.ts']; + +const BUDGETS = [ + { + type: 'initial', + maximumWarning: '3mb', + maximumError: '5mb', + }, + { + type: 'anyComponentStyle', + maximumWarning: '2kb', + maximumError: '4kb', + }, +]; + +export function updateProjectConfig(host: Tree) { + if (isNxWorkspace(host)) { + /** + * Nx Workspace + */ + const nxConfig = getNXWorkspace(host); + nxConfig.targets.build.options.polyfills = POLYFILLS; + nxConfig.targets.build.configurations.production.budgets = BUDGETS; + const newNxConfig = JSON.stringify(nxConfig, undefined, 2); + return host.overwrite('project.json', newNxConfig); + } else { + /** + * Angular Workspace + */ + const angularConfig = getAngularWorkspace(host) as any; + const projectName = Object.keys(angularConfig.projects)[0]; + angularConfig.projects[projectName].architect.build.options.polyfills = + POLYFILLS; + angularConfig.projects[ + projectName + ].architect.build.configurations.production.budgets.budgets = BUDGETS; + const newNxConfig = JSON.stringify(angularConfig, undefined, 2); + return host.overwrite('angular.json', newNxConfig); + } +} diff --git a/packages/schematics/src/ng-add/generators/styles.ts b/packages/schematics/src/ng-add/generators/styles.ts new file mode 100644 index 0000000000..98ddecaed5 --- /dev/null +++ b/packages/schematics/src/ng-add/generators/styles.ts @@ -0,0 +1,42 @@ +import { SchematicsException, Tree } from '@angular-devkit/schematics'; + +export const addStyles = (host: Tree) => { + const filePath = `src/styles.scss`; + const configBuffer = host.read(filePath); + if (configBuffer === null) { + throw new SchematicsException(`Could not find (${filePath})`); + } + const content = configBuffer.toString(); + + if (!content.includes('@baloise/design-system-css/css/core')) { + const newContent = + content + + ` + // SASS mixins and variables + @import '@baloise/design-system-css/sass/mixins'; + + // Resets CSS for all browser + @import '@baloise/design-system-css/css/normalize'; + @import '@baloise/design-system-css/css/structure'; + + // Custom font faces + @import '@baloise/design-system-css/css/font'; + + // Core CSS, always required + @import '@baloise/design-system-css/css/core'; + + // CSS utilities classes (optional) + @import '@baloise/design-system-css/css/border'; + @import '@baloise/design-system-css/css/color'; + @import '@baloise/design-system-css/css/display'; + @import '@baloise/design-system-css/css/flex'; + @import '@baloise/design-system-css/css/grid'; + @import '@baloise/design-system-css/css/opacity'; + @import '@baloise/design-system-css/css/radius'; + @import '@baloise/design-system-css/css/shadow'; + @import '@baloise/design-system-css/css/spacing'; + @import '@baloise/design-system-css/css/typography'; +`; + host.overwrite(filePath, newContent); + } +}; diff --git a/packages/schematics/src/ng-add/generators/ts-config.gen.ts b/packages/schematics/src/ng-add/generators/ts-config.gen.ts new file mode 100644 index 0000000000..ee61beab4c --- /dev/null +++ b/packages/schematics/src/ng-add/generators/ts-config.gen.ts @@ -0,0 +1,19 @@ +import { Tree } from '@angular-devkit/schematics'; +import { JsonObject } from '@angular-devkit/core'; + +export const TS_CONFIG_APP = 'tsconfig.app.json'; + +export function updateTsConfig(host: Tree) { + if (host.exists(TS_CONFIG_APP)) { + const json = host.readJson(TS_CONFIG_APP) as JsonObject; + if (json && json.files) { + const files = json.files as string[]; + if (!files.includes('src/polyfills.ts')) { + json.files = ['src/polyfills.ts', ...files]; + } + + const newTsConfig = JSON.stringify(json, undefined, 2); + return host.overwrite(TS_CONFIG_APP, newTsConfig); + } + } +} diff --git a/packages/schematics/src/ng-add/generators/zone-flags.gen.ts b/packages/schematics/src/ng-add/generators/zone-flags.gen.ts new file mode 100644 index 0000000000..926ae14cdb --- /dev/null +++ b/packages/schematics/src/ng-add/generators/zone-flags.gen.ts @@ -0,0 +1,10 @@ +import { Source, apply, move, template, url } from '@angular-devkit/schematics'; + +export function createZoneFlagsFile(): Source { + return apply(url(`./files/zone-flags`), [ + template({ + ts: 'ts', + }), + move('/', 'src'), + ]); +} diff --git a/packages/schematics/src/ng-add/index.ts b/packages/schematics/src/ng-add/index.ts new file mode 100644 index 0000000000..328e717fe9 --- /dev/null +++ b/packages/schematics/src/ng-add/index.ts @@ -0,0 +1,81 @@ +import { + Rule, + SchematicContext, + Tree, + chain, + mergeWith, +} from '@angular-devkit/schematics'; +import { + addDependency, + addRootProvider, +} from '@schematics/angular/utility/index'; + +import { SchemaOptions } from './schema'; +import { createPolyfillsFile } from './generators/polyfills.gen'; +import { createZoneFlagsFile } from './generators/zone-flags.gen'; +import { updateProjectConfig } from './generators/project.gen'; +import { updateTsConfig } from './generators/ts-config.gen'; +import { addStyles } from './generators/styles'; +import { createI18nFile } from './generators/i18n.gen'; +import { updateAppComponent } from './generators/app.get'; + +export default function (options: SchemaOptions): Rule { + return async ( + host: Tree, + context: SchematicContext + ): Promise => { + const actions: Rule[] = []; + + actions.push(mergeWith(createPolyfillsFile())); + actions.push(mergeWith(createZoneFlagsFile())); + + updateProjectConfig(host); + updateTsConfig(host); + addStyles(host); + + actions.push( + addRootProvider(options.project, ({ code, external }) => { + return code`, + ${external( + 'provideBaloiseDesignSystem', + '@baloise/design-system-components-angular/standalone' + )}({ + defaults: { + region: '${options.region}', + } + })`; + }) + ); + + if (options.i18n) { + actions.push(mergeWith(createI18nFile())); + actions.push( + addRootProvider(options.project, ({ code, external }) => { + return code`, + { + provide: ${external('APP_INITIALIZER', '@angular/core')}, + useFactory: ${external('initializeI18n', './i18n.initialize')}, + multi: true, + deps: [${external('TranslocoService', '@ngneat/transloco')}, ${external( + 'BalConfigService', + '@baloise/design-system-components-angular/standalone' + )}], + }`; + }) + ); + } + + const nxExample = 'src/app/nx-welcome.component.ts'; + if (host.exists(nxExample)) { + host.delete(nxExample); + } + + updateAppComponent(host, options); + + actions.push( + addDependency('@baloise/design-system-components-angular', 'latest') + ); + + return chain(actions)(host, context) as any; + }; +} diff --git a/packages/schematics/src/ng-add/schema.json b/packages/schematics/src/ng-add/schema.json new file mode 100644 index 0000000000..f5c4c63346 --- /dev/null +++ b/packages/schematics/src/ng-add/schema.json @@ -0,0 +1,29 @@ +{ + "$schema": "http://json-schema.org/schema", + "$id": "bds-ng-add", + "title": "Adds Baloise Design System to a project", + "type": "object", + "properties": { + "i18n": { + "description": "If the user is working with transloco.", + "x-prompt": "Are you working with transloco internationalization library?", + "type": "boolean", + "default": false + }, + "region": { + "description": "The region of the of internationalization", + "x-prompt": "For which region is the app developed", + "type": "string", + "default": "CH", + "enum": ["CH", "DE", "BE", "LU"] + }, + "project": { + "description": "The project name.", + "type": "string", + "$default": { + "$source": "projectName" + } + } + }, + "required": [] +} diff --git a/packages/schematics/src/ng-add/schema.ts b/packages/schematics/src/ng-add/schema.ts new file mode 100644 index 0000000000..abd39b2a2a --- /dev/null +++ b/packages/schematics/src/ng-add/schema.ts @@ -0,0 +1,21 @@ +export enum Region { + CH = 'CH', + BE = 'BE', + DE = 'DE', + LU = 'LU', +} + +export interface SchemaOptions { + /** + * The root project name. + */ + project: string; + /** + * Transloco is available + */ + i18n: boolean; + /** + * The region of i18n + */ + region: Region; +} diff --git a/packages/schematics/src/ng-add/utils/workspace.ts b/packages/schematics/src/ng-add/utils/workspace.ts new file mode 100644 index 0000000000..97b18f6c59 --- /dev/null +++ b/packages/schematics/src/ng-add/utils/workspace.ts @@ -0,0 +1,24 @@ +import { SchematicsException, Tree } from '@angular-devkit/schematics'; +import { WorkspaceSchema } from '@schematics/angular/utility/workspace-models'; + +export function isNxWorkspace(host: Tree): boolean { + return host.exists('project.json'); +} + +export function getNXWorkspace(host: Tree): any { + return getWorkspace(host, 'project.json'); +} + +export function getAngularWorkspace(host: Tree): WorkspaceSchema { + return getWorkspace(host, 'angular.json'); +} + +export function getWorkspace(host: Tree, path: string): WorkspaceSchema { + const configBuffer = host.read(path); + if (configBuffer === null) { + throw new SchematicsException(`Could not find (${path})`); + } + const config = configBuffer.toString(); + + return JSON.parse(config); +} diff --git a/packages/schematics/tsconfig.json b/packages/schematics/tsconfig.json new file mode 100644 index 0000000000..49a6f1cd38 --- /dev/null +++ b/packages/schematics/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "baseUrl": "tsconfig", + "lib": ["es2018", "dom"], + "declaration": true, + "module": "commonjs", + "moduleResolution": "node", + "noEmitOnError": true, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": true, + "noImplicitThis": true, + "noUnusedParameters": true, + "noUnusedLocals": true, + "rootDir": "src/", + "skipDefaultLibCheck": true, + "skipLibCheck": true, + "sourceMap": true, + "strictNullChecks": true, + "target": "es6", + "types": ["node"] + }, + "include": ["src/**/*"], + "exclude": ["src/*/files/**/*"] +} From 92abf82db72a409f701d9489433a0c0656be5774 Mon Sep 17 00:00:00 2001 From: Gery Hirschfeld Date: Sat, 13 Jan 2024 15:59:03 +0100 Subject: [PATCH 2/6] chore: format files --- .eslintignore | 6 ++ .prettierignore | 4 + .../src/ng-add/generators/app.get.ts | 62 ++++++-------- .../src/ng-add/generators/i18n.gen.ts | 4 +- .../src/ng-add/generators/polyfills.gen.ts | 5 +- .../src/ng-add/generators/project.gen.ts | 37 ++++----- .../src/ng-add/generators/styles.ts | 16 ++-- .../src/ng-add/generators/ts-config.gen.ts | 16 ++-- .../src/ng-add/generators/zone-flags.gen.ts | 4 +- packages/schematics/src/ng-add/index.ts | 81 ++++++++----------- packages/schematics/src/ng-add/schema.ts | 6 +- .../schematics/src/ng-add/utils/workspace.ts | 18 ++--- 12 files changed, 117 insertions(+), 142 deletions(-) diff --git a/.eslintignore b/.eslintignore index 02fadd1c0d..1f8826c2b5 100644 --- a/.eslintignore +++ b/.eslintignore @@ -19,6 +19,7 @@ packages/icons/src/icons.ts packages/components/loader/ packages/components/www/ +packages/components/components/ packages/components/.storybook/vue/generated/ packages/components/src/assets/fonts packages/components/src/components/**/readme.md @@ -42,3 +43,8 @@ packages/components-angular/src/directives/ packages/components-angular/src/overlays packages/components-vue/src/proxies.ts packages/components-vue/.build/template/utils.ts + +packages/components-angular/**/*.d.ts +packages/components-angular/esm2020 +packages/components-angular/fesm2015 +packages/components-angular/fesm2020 diff --git a/.prettierignore b/.prettierignore index 8a885b15af..1c17125a61 100644 --- a/.prettierignore +++ b/.prettierignore @@ -47,6 +47,10 @@ packages/components-angular/src/directives/value-accessor.ts packages/components-angular/src/directives/proxies.ts packages/components-angular/src/directives/proxies-list.ts packages/components-angular/src/directives/proxies.module.ts +packages/components-angular/esm2020 +packages/components-angular/fesm2015 +packages/components-angular/fesm2020 +packages/components-angular/**/*.d.ts packages/components/src/utils/constants/icons.constant.ts packages/css/css packages/components-vue/src/proxies.ts diff --git a/packages/schematics/src/ng-add/generators/app.get.ts b/packages/schematics/src/ng-add/generators/app.get.ts index 303c0ac05f..a7850ce0fb 100644 --- a/packages/schematics/src/ng-add/generators/app.get.ts +++ b/packages/schematics/src/ng-add/generators/app.get.ts @@ -1,39 +1,31 @@ -import { SchematicsException, Tree } from '@angular-devkit/schematics'; -import { SchemaOptions } from '../schema'; +import { SchematicsException, Tree } from '@angular-devkit/schematics' +import { SchemaOptions } from '../schema' export const updateAppComponent = (host: Tree, options: SchemaOptions) => { - const prefix = options.project || 'app'; + const prefix = options.project || 'app' - const appTemplatePath = `src/app/app.component.html`; - const appComponentPath = `src/app/app.component.ts`; - const appStylesPath = `src/app/app.component.css`; - const appStylesSassPath = `src/app/app.component.scss`; + const appTemplatePath = `src/app/app.component.html` + const appComponentPath = `src/app/app.component.ts` + const appStylesPath = `src/app/app.component.css` + const appStylesSassPath = `src/app/app.component.scss` - const isInlineTemplate = !host.exists(appTemplatePath); - const hasCssStyles = host.exists(appStylesPath); - const hasSassStyles = host.exists(appStylesSassPath); - const hasStyles = hasCssStyles || hasSassStyles; - const styleTemplate = hasStyles - ? `styleUrl: './app.component.${hasCssStyles ? 'css' : 'scss'}',` - : ''; + const isInlineTemplate = !host.exists(appTemplatePath) + const hasCssStyles = host.exists(appStylesPath) + const hasSassStyles = host.exists(appStylesSassPath) + const hasStyles = hasCssStyles || hasSassStyles + const styleTemplate = hasStyles ? `styleUrl: './app.component.${hasCssStyles ? 'css' : 'scss'}',` : '' - const appComponentBuffer = host.read(appComponentPath); + const appComponentBuffer = host.read(appComponentPath) if (appComponentBuffer) { - const appComponentContent = appComponentBuffer.toString(); - const isOnPush = appComponentContent.includes( - 'ChangeDetectionStrategy.OnPush' - ); - const onPushTemplate = isOnPush - ? `changeDetection: ChangeDetectionStrategy.OnPush,` - : ''; + const appComponentContent = appComponentBuffer.toString() + const isOnPush = appComponentContent.includes('ChangeDetectionStrategy.OnPush') + const onPushTemplate = isOnPush ? `changeDetection: ChangeDetectionStrategy.OnPush,` : '' if (isInlineTemplate) { host.overwrite( appComponentPath, ` - import { Component, CUSTOM_ELEMENTS_SCHEMA${ - isOnPush ? ', ChangeDetectionStrategy' : '' - } } from '@angular/core' + import { Component, CUSTOM_ELEMENTS_SCHEMA${isOnPush ? ', ChangeDetectionStrategy' : ''} } from '@angular/core' import { CommonModule } from '@angular/common' import { BalLayoutBundle, BalHeading, BalButton } from '@baloise/design-system-components-angular/standalone' @@ -58,15 +50,13 @@ export const updateAppComponent = (host: Tree, options: SchemaOptions) => { \`, }) export class AppComponent {} - ` - ); + `, + ) } else { host.overwrite( appComponentPath, ` - import { Component, CUSTOM_ELEMENTS_SCHEMA${ - isOnPush ? ', ChangeDetectionStrategy' : '' - } } from '@angular/core' + import { Component, CUSTOM_ELEMENTS_SCHEMA${isOnPush ? ', ChangeDetectionStrategy' : ''} } from '@angular/core' import { CommonModule } from '@angular/common' import { BalLayoutBundle, BalHeading, BalButton } from '@baloise/design-system-components-angular/standalone' @@ -79,8 +69,8 @@ export const updateAppComponent = (host: Tree, options: SchemaOptions) => { ${styleTemplate} }) export class AppComponent {} - ` - ); + `, + ) host.overwrite( appTemplatePath, @@ -96,10 +86,10 @@ export const updateAppComponent = (host: Tree, options: SchemaOptions) => { - ` - ); + `, + ) } } else { - throw new SchematicsException(`Could not find (${appComponentPath})`); + throw new SchematicsException(`Could not find (${appComponentPath})`) } -}; +} diff --git a/packages/schematics/src/ng-add/generators/i18n.gen.ts b/packages/schematics/src/ng-add/generators/i18n.gen.ts index 81f038b22b..151791713b 100644 --- a/packages/schematics/src/ng-add/generators/i18n.gen.ts +++ b/packages/schematics/src/ng-add/generators/i18n.gen.ts @@ -1,4 +1,4 @@ -import { Source, apply, move, template, url } from '@angular-devkit/schematics'; +import { Source, apply, move, template, url } from '@angular-devkit/schematics' export function createI18nFile(): Source { return apply(url(`./files/i18n.initialize`), [ @@ -6,5 +6,5 @@ export function createI18nFile(): Source { ts: 'ts', }), move('/', 'src/app'), - ]); + ]) } diff --git a/packages/schematics/src/ng-add/generators/polyfills.gen.ts b/packages/schematics/src/ng-add/generators/polyfills.gen.ts index 7be77d111c..055a0e6d50 100644 --- a/packages/schematics/src/ng-add/generators/polyfills.gen.ts +++ b/packages/schematics/src/ng-add/generators/polyfills.gen.ts @@ -1,4 +1,4 @@ -import { Source, apply, move, template, url } from '@angular-devkit/schematics'; +import { Source, apply, move, template, url } from '@angular-devkit/schematics' export function createPolyfillsFile(): Source { return apply(url(`./files/polyfills`), [ @@ -6,6 +6,5 @@ export function createPolyfillsFile(): Source { ts: 'ts', }), move('/', 'src'), - ]); + ]) } - diff --git a/packages/schematics/src/ng-add/generators/project.gen.ts b/packages/schematics/src/ng-add/generators/project.gen.ts index a459839b64..4ecd4e6cd6 100644 --- a/packages/schematics/src/ng-add/generators/project.gen.ts +++ b/packages/schematics/src/ng-add/generators/project.gen.ts @@ -1,11 +1,7 @@ -import { Tree } from '@angular-devkit/schematics'; -import { - getAngularWorkspace, - getNXWorkspace, - isNxWorkspace, -} from '../utils/workspace'; +import { Tree } from '@angular-devkit/schematics' +import { getAngularWorkspace, getNXWorkspace, isNxWorkspace } from '../utils/workspace' -const POLYFILLS = ['./src/polyfills.ts']; +const POLYFILLS = ['./src/polyfills.ts'] const BUDGETS = [ { @@ -18,30 +14,27 @@ const BUDGETS = [ maximumWarning: '2kb', maximumError: '4kb', }, -]; +] export function updateProjectConfig(host: Tree) { if (isNxWorkspace(host)) { /** * Nx Workspace */ - const nxConfig = getNXWorkspace(host); - nxConfig.targets.build.options.polyfills = POLYFILLS; - nxConfig.targets.build.configurations.production.budgets = BUDGETS; - const newNxConfig = JSON.stringify(nxConfig, undefined, 2); - return host.overwrite('project.json', newNxConfig); + const nxConfig = getNXWorkspace(host) + nxConfig.targets.build.options.polyfills = POLYFILLS + nxConfig.targets.build.configurations.production.budgets = BUDGETS + const newNxConfig = JSON.stringify(nxConfig, undefined, 2) + return host.overwrite('project.json', newNxConfig) } else { /** * Angular Workspace */ - const angularConfig = getAngularWorkspace(host) as any; - const projectName = Object.keys(angularConfig.projects)[0]; - angularConfig.projects[projectName].architect.build.options.polyfills = - POLYFILLS; - angularConfig.projects[ - projectName - ].architect.build.configurations.production.budgets.budgets = BUDGETS; - const newNxConfig = JSON.stringify(angularConfig, undefined, 2); - return host.overwrite('angular.json', newNxConfig); + const angularConfig = getAngularWorkspace(host) as any + const projectName = Object.keys(angularConfig.projects)[0] + angularConfig.projects[projectName].architect.build.options.polyfills = POLYFILLS + angularConfig.projects[projectName].architect.build.configurations.production.budgets.budgets = BUDGETS + const newNxConfig = JSON.stringify(angularConfig, undefined, 2) + return host.overwrite('angular.json', newNxConfig) } } diff --git a/packages/schematics/src/ng-add/generators/styles.ts b/packages/schematics/src/ng-add/generators/styles.ts index 98ddecaed5..57825761a6 100644 --- a/packages/schematics/src/ng-add/generators/styles.ts +++ b/packages/schematics/src/ng-add/generators/styles.ts @@ -1,12 +1,12 @@ -import { SchematicsException, Tree } from '@angular-devkit/schematics'; +import { SchematicsException, Tree } from '@angular-devkit/schematics' export const addStyles = (host: Tree) => { - const filePath = `src/styles.scss`; - const configBuffer = host.read(filePath); + const filePath = `src/styles.scss` + const configBuffer = host.read(filePath) if (configBuffer === null) { - throw new SchematicsException(`Could not find (${filePath})`); + throw new SchematicsException(`Could not find (${filePath})`) } - const content = configBuffer.toString(); + const content = configBuffer.toString() if (!content.includes('@baloise/design-system-css/css/core')) { const newContent = @@ -36,7 +36,7 @@ export const addStyles = (host: Tree) => { @import '@baloise/design-system-css/css/shadow'; @import '@baloise/design-system-css/css/spacing'; @import '@baloise/design-system-css/css/typography'; -`; - host.overwrite(filePath, newContent); +` + host.overwrite(filePath, newContent) } -}; +} diff --git a/packages/schematics/src/ng-add/generators/ts-config.gen.ts b/packages/schematics/src/ng-add/generators/ts-config.gen.ts index ee61beab4c..b2e2a1533d 100644 --- a/packages/schematics/src/ng-add/generators/ts-config.gen.ts +++ b/packages/schematics/src/ng-add/generators/ts-config.gen.ts @@ -1,19 +1,19 @@ -import { Tree } from '@angular-devkit/schematics'; -import { JsonObject } from '@angular-devkit/core'; +import { Tree } from '@angular-devkit/schematics' +import { JsonObject } from '@angular-devkit/core' -export const TS_CONFIG_APP = 'tsconfig.app.json'; +export const TS_CONFIG_APP = 'tsconfig.app.json' export function updateTsConfig(host: Tree) { if (host.exists(TS_CONFIG_APP)) { - const json = host.readJson(TS_CONFIG_APP) as JsonObject; + const json = host.readJson(TS_CONFIG_APP) as JsonObject if (json && json.files) { - const files = json.files as string[]; + const files = json.files as string[] if (!files.includes('src/polyfills.ts')) { - json.files = ['src/polyfills.ts', ...files]; + json.files = ['src/polyfills.ts', ...files] } - const newTsConfig = JSON.stringify(json, undefined, 2); - return host.overwrite(TS_CONFIG_APP, newTsConfig); + const newTsConfig = JSON.stringify(json, undefined, 2) + return host.overwrite(TS_CONFIG_APP, newTsConfig) } } } diff --git a/packages/schematics/src/ng-add/generators/zone-flags.gen.ts b/packages/schematics/src/ng-add/generators/zone-flags.gen.ts index 926ae14cdb..fabe2cc225 100644 --- a/packages/schematics/src/ng-add/generators/zone-flags.gen.ts +++ b/packages/schematics/src/ng-add/generators/zone-flags.gen.ts @@ -1,4 +1,4 @@ -import { Source, apply, move, template, url } from '@angular-devkit/schematics'; +import { Source, apply, move, template, url } from '@angular-devkit/schematics' export function createZoneFlagsFile(): Source { return apply(url(`./files/zone-flags`), [ @@ -6,5 +6,5 @@ export function createZoneFlagsFile(): Source { ts: 'ts', }), move('/', 'src'), - ]); + ]) } diff --git a/packages/schematics/src/ng-add/index.ts b/packages/schematics/src/ng-add/index.ts index 328e717fe9..a1ae08ca1d 100644 --- a/packages/schematics/src/ng-add/index.ts +++ b/packages/schematics/src/ng-add/index.ts @@ -1,54 +1,39 @@ -import { - Rule, - SchematicContext, - Tree, - chain, - mergeWith, -} from '@angular-devkit/schematics'; -import { - addDependency, - addRootProvider, -} from '@schematics/angular/utility/index'; +import { Rule, SchematicContext, Tree, chain, mergeWith } from '@angular-devkit/schematics' +import { addDependency, addRootProvider } from '@schematics/angular/utility/index' -import { SchemaOptions } from './schema'; -import { createPolyfillsFile } from './generators/polyfills.gen'; -import { createZoneFlagsFile } from './generators/zone-flags.gen'; -import { updateProjectConfig } from './generators/project.gen'; -import { updateTsConfig } from './generators/ts-config.gen'; -import { addStyles } from './generators/styles'; -import { createI18nFile } from './generators/i18n.gen'; -import { updateAppComponent } from './generators/app.get'; +import { SchemaOptions } from './schema' +import { createPolyfillsFile } from './generators/polyfills.gen' +import { createZoneFlagsFile } from './generators/zone-flags.gen' +import { updateProjectConfig } from './generators/project.gen' +import { updateTsConfig } from './generators/ts-config.gen' +import { addStyles } from './generators/styles' +import { createI18nFile } from './generators/i18n.gen' +import { updateAppComponent } from './generators/app.get' export default function (options: SchemaOptions): Rule { - return async ( - host: Tree, - context: SchematicContext - ): Promise => { - const actions: Rule[] = []; + return async (host: Tree, context: SchematicContext): Promise => { + const actions: Rule[] = [] - actions.push(mergeWith(createPolyfillsFile())); - actions.push(mergeWith(createZoneFlagsFile())); + actions.push(mergeWith(createPolyfillsFile())) + actions.push(mergeWith(createZoneFlagsFile())) - updateProjectConfig(host); - updateTsConfig(host); - addStyles(host); + updateProjectConfig(host) + updateTsConfig(host) + addStyles(host) actions.push( addRootProvider(options.project, ({ code, external }) => { return code`, - ${external( - 'provideBaloiseDesignSystem', - '@baloise/design-system-components-angular/standalone' - )}({ + ${external('provideBaloiseDesignSystem', '@baloise/design-system-components-angular/standalone')}({ defaults: { region: '${options.region}', } - })`; - }) - ); + })` + }), + ) if (options.i18n) { - actions.push(mergeWith(createI18nFile())); + actions.push(mergeWith(createI18nFile())) actions.push( addRootProvider(options.project, ({ code, external }) => { return code`, @@ -58,24 +43,22 @@ export default function (options: SchemaOptions): Rule { multi: true, deps: [${external('TranslocoService', '@ngneat/transloco')}, ${external( 'BalConfigService', - '@baloise/design-system-components-angular/standalone' + '@baloise/design-system-components-angular/standalone', )}], - }`; - }) - ); + }` + }), + ) } - const nxExample = 'src/app/nx-welcome.component.ts'; + const nxExample = 'src/app/nx-welcome.component.ts' if (host.exists(nxExample)) { - host.delete(nxExample); + host.delete(nxExample) } - updateAppComponent(host, options); + updateAppComponent(host, options) - actions.push( - addDependency('@baloise/design-system-components-angular', 'latest') - ); + actions.push(addDependency('@baloise/design-system-components-angular', 'latest')) - return chain(actions)(host, context) as any; - }; + return chain(actions)(host, context) as any + } } diff --git a/packages/schematics/src/ng-add/schema.ts b/packages/schematics/src/ng-add/schema.ts index abd39b2a2a..cba2b19dbf 100644 --- a/packages/schematics/src/ng-add/schema.ts +++ b/packages/schematics/src/ng-add/schema.ts @@ -9,13 +9,13 @@ export interface SchemaOptions { /** * The root project name. */ - project: string; + project: string /** * Transloco is available */ - i18n: boolean; + i18n: boolean /** * The region of i18n */ - region: Region; + region: Region } diff --git a/packages/schematics/src/ng-add/utils/workspace.ts b/packages/schematics/src/ng-add/utils/workspace.ts index 97b18f6c59..69606ec524 100644 --- a/packages/schematics/src/ng-add/utils/workspace.ts +++ b/packages/schematics/src/ng-add/utils/workspace.ts @@ -1,24 +1,24 @@ -import { SchematicsException, Tree } from '@angular-devkit/schematics'; -import { WorkspaceSchema } from '@schematics/angular/utility/workspace-models'; +import { SchematicsException, Tree } from '@angular-devkit/schematics' +import { WorkspaceSchema } from '@schematics/angular/utility/workspace-models' export function isNxWorkspace(host: Tree): boolean { - return host.exists('project.json'); + return host.exists('project.json') } export function getNXWorkspace(host: Tree): any { - return getWorkspace(host, 'project.json'); + return getWorkspace(host, 'project.json') } export function getAngularWorkspace(host: Tree): WorkspaceSchema { - return getWorkspace(host, 'angular.json'); + return getWorkspace(host, 'angular.json') } export function getWorkspace(host: Tree, path: string): WorkspaceSchema { - const configBuffer = host.read(path); + const configBuffer = host.read(path) if (configBuffer === null) { - throw new SchematicsException(`Could not find (${path})`); + throw new SchematicsException(`Could not find (${path})`) } - const config = configBuffer.toString(); + const config = configBuffer.toString() - return JSON.parse(config); + return JSON.parse(config) } From 5230e7bd5a714380379abfef071ba726ef462705 Mon Sep 17 00:00:00 2001 From: Gery Hirschfeld Date: Sat, 13 Jan 2024 19:17:46 +0100 Subject: [PATCH 3/6] chore: update docs --- .../00-guides/00-getting-started.stories.mdx | 40 ++++++++++++++++--- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/docs/stories/development/00-guides/00-getting-started.stories.mdx b/docs/stories/development/00-guides/00-getting-started.stories.mdx index fc7fae06b2..c77deec38b 100644 --- a/docs/stories/development/00-guides/00-getting-started.stories.mdx +++ b/docs/stories/development/00-guides/00-getting-started.stories.mdx @@ -36,9 +36,39 @@ If you do not have an Angular app yet create one with the [Angular CLI](https:// - Use **SCSS** as stylesheet format to be able to breakpoint mixins and more. - For the translations use [\{TRANSLOCO\}](https://ngneat.github.io/transloco/). - For a reactive store use [Elf](https://ngneat.github.io/elf/). +- Smart build system [Nx](https://nx.dev/getting-started/tutorials/angular-standalone-tutorial). +## Installation + +Lets install the schematics to configure and add the design system to an Angular project. + + + + +If the projects requires translatiojns, then install [\{TRANSLOCO\}](https://ngneat.github.io/transloco/) before the Baloise Design System. + +```bash +ng add @ngneat/transloco +# On an nx workspace +nx g @ngneat/transloco:ng-add +``` + + + +Install the library using Angular CLI: + +```bash +ng add @baloise/design-system-schematics:ng-add +# On an nx workspace +nx g @baloise/design-system-schematics:ng-add +``` + +## Manual Installation + +Continue here for the manual instalation guide without schematics. + ### Zone.js Configuring zone.js is essential for enhancing the performance of the web components. @@ -93,13 +123,13 @@ Open the `angular.json` file and make the following adjustment to `architect.bui } ``` -## Installation +### Installation Let's install the latest Angular components. This package includes the Font, Token, Icon, and CSS-Utilities packages. -## Import Styles +### Import Styles Component styles are automatically loaded lazily in the browser. However, CSS Utilities and other fundamentals need to be imported into the global stylesheet of the application. These stylesheets can be @@ -141,7 +171,7 @@ However, if the application requires all styles regardless of payload size, simp @import '@baloise/design-system-css/css/typography'; ``` -## Standalone +### Standalone Use the `provideBaloiseDesignSystem` provider within the `app.config.ts` file, where Angular providers are typically defined. @@ -196,7 +226,7 @@ Add the `bal-app` to your `app.component.html` root element. ``` -## Module Based +### Module Based Import the `BaloiseDesignSystemModule.forRoot()` into your angular root module. To use the custom web components add the schema `CUSTOM_ELEMENTS_SCHEMA` to your root angular module. @@ -249,7 +279,7 @@ Add the `bal-app` to your `app.component.html` root element. `} /> -### Shared Modules +#### Shared Modules It is recommended to import the `BaloiseDesignSystemModule` in your `SharedModule` to provide access to the components and value accessors. From 7288a29fc8830165f78bacbcfe16ae706bcb0224 Mon Sep 17 00:00:00 2001 From: Gery Hirschfeld Date: Sat, 13 Jan 2024 19:20:16 +0100 Subject: [PATCH 4/6] chore: update docs --- .../development/00-guides/00-getting-started.stories.mdx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/stories/development/00-guides/00-getting-started.stories.mdx b/docs/stories/development/00-guides/00-getting-started.stories.mdx index c77deec38b..e860392cbd 100644 --- a/docs/stories/development/00-guides/00-getting-started.stories.mdx +++ b/docs/stories/development/00-guides/00-getting-started.stories.mdx @@ -47,7 +47,11 @@ Lets install the schematics to configure and add the design system to an Angular -If the projects requires translatiojns, then install [\{TRANSLOCO\}](https://ngneat.github.io/transloco/) before the Baloise Design System. +If the projects requires translations, then install [\{TRANSLOCO\}](https://ngneat.github.io/transloco/) before the Baloise Design System. + + + +Configure project: ```bash ng add @ngneat/transloco From e440a372fae076b0bf1b6a153630a4ccb1e48bb8 Mon Sep 17 00:00:00 2001 From: Gery Hirschfeld Date: Sun, 14 Jan 2024 07:18:30 +0100 Subject: [PATCH 5/6] chore: rename to cli --- .../00-guides/00-getting-started.stories.mdx | 12 +- package-lock.json | 255 +++++++++--------- packages/{schematics => cli}/.gitignore | 0 packages/{schematics => cli}/.npmignore | 0 packages/{schematics => cli}/LICENSE | 0 packages/{schematics => cli}/README.md | 0 .../{schematics => cli}/package-lock.json | 0 packages/{schematics => cli}/package.json | 7 +- .../{schematics => cli}/src/collection.json | 0 .../i18n.initialize/i18n.initialize.__ts__ | 0 .../ng-add/files/polyfills/polyfills.__ts__ | 0 .../ng-add/files/zone-flags/zone-flags.__ts__ | 0 .../src/ng-add/generators/app.get.ts | 0 .../src/ng-add/generators/i18n.gen.ts | 0 .../src/ng-add/generators/polyfills.gen.ts | 0 .../src/ng-add/generators/project.gen.ts | 0 .../src/ng-add/generators/styles.ts | 0 .../src/ng-add/generators/ts-config.gen.ts | 0 .../src/ng-add/generators/zone-flags.gen.ts | 0 .../{schematics => cli}/src/ng-add/index.ts | 2 +- .../src/ng-add/schema.json | 0 .../{schematics => cli}/src/ng-add/schema.ts | 0 .../src/ng-add/utils/workspace.ts | 0 packages/{schematics => cli}/tsconfig.json | 0 24 files changed, 146 insertions(+), 130 deletions(-) rename packages/{schematics => cli}/.gitignore (100%) rename packages/{schematics => cli}/.npmignore (100%) rename packages/{schematics => cli}/LICENSE (100%) rename packages/{schematics => cli}/README.md (100%) rename packages/{schematics => cli}/package-lock.json (100%) rename packages/{schematics => cli}/package.json (92%) rename packages/{schematics => cli}/src/collection.json (100%) rename packages/{schematics => cli}/src/ng-add/files/i18n.initialize/i18n.initialize.__ts__ (100%) rename packages/{schematics => cli}/src/ng-add/files/polyfills/polyfills.__ts__ (100%) rename packages/{schematics => cli}/src/ng-add/files/zone-flags/zone-flags.__ts__ (100%) rename packages/{schematics => cli}/src/ng-add/generators/app.get.ts (100%) rename packages/{schematics => cli}/src/ng-add/generators/i18n.gen.ts (100%) rename packages/{schematics => cli}/src/ng-add/generators/polyfills.gen.ts (100%) rename packages/{schematics => cli}/src/ng-add/generators/project.gen.ts (100%) rename packages/{schematics => cli}/src/ng-add/generators/styles.ts (100%) rename packages/{schematics => cli}/src/ng-add/generators/ts-config.gen.ts (100%) rename packages/{schematics => cli}/src/ng-add/generators/zone-flags.gen.ts (100%) rename packages/{schematics => cli}/src/ng-add/index.ts (99%) rename packages/{schematics => cli}/src/ng-add/schema.json (100%) rename packages/{schematics => cli}/src/ng-add/schema.ts (100%) rename packages/{schematics => cli}/src/ng-add/utils/workspace.ts (100%) rename packages/{schematics => cli}/tsconfig.json (100%) diff --git a/docs/stories/development/00-guides/00-getting-started.stories.mdx b/docs/stories/development/00-guides/00-getting-started.stories.mdx index e860392cbd..ae0a3ca17a 100644 --- a/docs/stories/development/00-guides/00-getting-started.stories.mdx +++ b/docs/stories/development/00-guides/00-getting-started.stories.mdx @@ -42,10 +42,6 @@ If you do not have an Angular app yet create one with the [Angular CLI](https:// ## Installation -Lets install the schematics to configure and add the design system to an Angular project. - - - If the projects requires translations, then install [\{TRANSLOCO\}](https://ngneat.github.io/transloco/) before the Baloise Design System. @@ -61,12 +57,16 @@ nx g @ngneat/transloco:ng-add +Lets install the schematics to configure and add the design system to an Angular project. + + + Install the library using Angular CLI: ```bash -ng add @baloise/design-system-schematics:ng-add +ng add @baloise/design-system-cli:ng-add # On an nx workspace -nx g @baloise/design-system-schematics:ng-add +nx g @baloise/design-system-cli:ng-add ``` ## Manual Installation diff --git a/package-lock.json b/package-lock.json index 3610c18801..d117ac3851 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2473,6 +2473,10 @@ "resolved": "packages/brand-icons", "link": true }, + "node_modules/@baloise/design-system-cli": { + "resolved": "packages/cli", + "link": true + }, "node_modules/@baloise/design-system-components": { "resolved": "packages/components", "link": true @@ -2525,10 +2529,6 @@ "resolved": "packages/output-targets/vue", "link": true }, - "node_modules/@baloise/design-system-schematics": { - "resolved": "packages/schematics", - "link": true - }, "node_modules/@baloise/design-system-testing": { "resolved": "packages/testing", "link": true @@ -30536,6 +30536,136 @@ "version": "15.1.1", "license": "Apache-2.0" }, + "packages/cli": { + "name": "@baloise/design-system-cli", + "version": "0.0.2", + "license": "Apache-2.0", + "dependencies": { + "@angular-devkit/core": "^17.0.10", + "@angular-devkit/schematics": "^17.0.10", + "@schematics/angular": "^17.0.10", + "typescript": "~5.2.2" + }, + "devDependencies": { + "@types/node": "^20.11.0" + } + }, + "packages/cli/node_modules/@angular-devkit/core": { + "version": "17.0.10", + "resolved": "https://registry.npmjs.org/@angular-devkit/core/-/core-17.0.10.tgz", + "integrity": "sha512-93N6oHnmtRt0hL3AXxvnk47sN1rHndfj+pqI5haEY41AGWzIWv9cSBsqlM0PWltNpo6VivcExZESvbLJ71wqbQ==", + "dependencies": { + "ajv": "8.12.0", + "ajv-formats": "2.1.1", + "jsonc-parser": "3.2.0", + "picomatch": "3.0.1", + "rxjs": "7.8.1", + "source-map": "0.7.4" + }, + "engines": { + "node": "^18.13.0 || >=20.9.0", + "npm": "^6.11.0 || ^7.5.6 || >=8.0.0", + "yarn": ">= 1.13.0" + }, + "peerDependencies": { + "chokidar": "^3.5.2" + }, + "peerDependenciesMeta": { + "chokidar": { + "optional": true + } + } + }, + "packages/cli/node_modules/@angular-devkit/schematics": { + "version": "17.0.10", + "resolved": "https://registry.npmjs.org/@angular-devkit/schematics/-/schematics-17.0.10.tgz", + "integrity": "sha512-hjf4gaMx2uB6ZhBstBSH0Q2hzfp6kxI4IiJ5i1QrxPNE1MdGnb2h+LgPTRCdO72a7PGeWcSxFRE7cxrXeQy19g==", + "dependencies": { + "@angular-devkit/core": "17.0.10", + "jsonc-parser": "3.2.0", + "magic-string": "0.30.5", + "ora": "5.4.1", + "rxjs": "7.8.1" + }, + "engines": { + "node": "^18.13.0 || >=20.9.0", + "npm": "^6.11.0 || ^7.5.6 || >=8.0.0", + "yarn": ">= 1.13.0" + } + }, + "packages/cli/node_modules/@schematics/angular": { + "version": "17.0.10", + "resolved": "https://registry.npmjs.org/@schematics/angular/-/angular-17.0.10.tgz", + "integrity": "sha512-rRBlDMXfVPkW3CqVQxazFqkuJXd0BFnD1zjI9WtDiNt3o2pTHbLzuWJnXKuIt5rzv0x/bFwNqIt4CPW2DYGNMg==", + "dependencies": { + "@angular-devkit/core": "17.0.10", + "@angular-devkit/schematics": "17.0.10", + "jsonc-parser": "3.2.0" + }, + "engines": { + "node": "^18.13.0 || >=20.9.0", + "npm": "^6.11.0 || ^7.5.6 || >=8.0.0", + "yarn": ">= 1.13.0" + } + }, + "packages/cli/node_modules/@types/node": { + "version": "20.11.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.0.tgz", + "integrity": "sha512-o9bjXmDNcF7GbM4CNQpmi+TutCgap/K3w1JyKgxAjqx41zp9qlIAVFi0IhCNsJcXolEqLWhbFbEeL0PvYm4pcQ==", + "dev": true, + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "packages/cli/node_modules/ajv": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "packages/cli/node_modules/magic-string": { + "version": "0.30.5", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.5.tgz", + "integrity": "sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA==", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.4.15" + }, + "engines": { + "node": ">=12" + } + }, + "packages/cli/node_modules/picomatch": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-3.0.1.tgz", + "integrity": "sha512-I3EurrIQMlRc9IaAZnqRR044Phh2DXY+55o7uJ0V+hYZAcQYSuFWsc9q5PvyDHUSCe1Qxn/iBz+78s86zWnGag==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "packages/cli/node_modules/typescript": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", + "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, "packages/components": { "name": "@baloise/design-system-components", "version": "15.1.1", @@ -30698,6 +30828,7 @@ }, "packages/schematics": { "version": "0.0.1", + "extraneous": true, "license": "Apache-2.0", "dependencies": { "@angular-devkit/core": "^17.0.10", @@ -30709,122 +30840,6 @@ "@types/node": "^20.11.0" } }, - "packages/schematics/node_modules/@angular-devkit/core": { - "version": "17.0.10", - "resolved": "https://registry.npmjs.org/@angular-devkit/core/-/core-17.0.10.tgz", - "integrity": "sha512-93N6oHnmtRt0hL3AXxvnk47sN1rHndfj+pqI5haEY41AGWzIWv9cSBsqlM0PWltNpo6VivcExZESvbLJ71wqbQ==", - "dependencies": { - "ajv": "8.12.0", - "ajv-formats": "2.1.1", - "jsonc-parser": "3.2.0", - "picomatch": "3.0.1", - "rxjs": "7.8.1", - "source-map": "0.7.4" - }, - "engines": { - "node": "^18.13.0 || >=20.9.0", - "npm": "^6.11.0 || ^7.5.6 || >=8.0.0", - "yarn": ">= 1.13.0" - }, - "peerDependencies": { - "chokidar": "^3.5.2" - }, - "peerDependenciesMeta": { - "chokidar": { - "optional": true - } - } - }, - "packages/schematics/node_modules/@angular-devkit/schematics": { - "version": "17.0.10", - "resolved": "https://registry.npmjs.org/@angular-devkit/schematics/-/schematics-17.0.10.tgz", - "integrity": "sha512-hjf4gaMx2uB6ZhBstBSH0Q2hzfp6kxI4IiJ5i1QrxPNE1MdGnb2h+LgPTRCdO72a7PGeWcSxFRE7cxrXeQy19g==", - "dependencies": { - "@angular-devkit/core": "17.0.10", - "jsonc-parser": "3.2.0", - "magic-string": "0.30.5", - "ora": "5.4.1", - "rxjs": "7.8.1" - }, - "engines": { - "node": "^18.13.0 || >=20.9.0", - "npm": "^6.11.0 || ^7.5.6 || >=8.0.0", - "yarn": ">= 1.13.0" - } - }, - "packages/schematics/node_modules/@schematics/angular": { - "version": "17.0.10", - "resolved": "https://registry.npmjs.org/@schematics/angular/-/angular-17.0.10.tgz", - "integrity": "sha512-rRBlDMXfVPkW3CqVQxazFqkuJXd0BFnD1zjI9WtDiNt3o2pTHbLzuWJnXKuIt5rzv0x/bFwNqIt4CPW2DYGNMg==", - "dependencies": { - "@angular-devkit/core": "17.0.10", - "@angular-devkit/schematics": "17.0.10", - "jsonc-parser": "3.2.0" - }, - "engines": { - "node": "^18.13.0 || >=20.9.0", - "npm": "^6.11.0 || ^7.5.6 || >=8.0.0", - "yarn": ">= 1.13.0" - } - }, - "packages/schematics/node_modules/@types/node": { - "version": "20.11.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.0.tgz", - "integrity": "sha512-o9bjXmDNcF7GbM4CNQpmi+TutCgap/K3w1JyKgxAjqx41zp9qlIAVFi0IhCNsJcXolEqLWhbFbEeL0PvYm4pcQ==", - "dev": true, - "dependencies": { - "undici-types": "~5.26.4" - } - }, - "packages/schematics/node_modules/ajv": { - "version": "8.12.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", - "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", - "dependencies": { - "fast-deep-equal": "^3.1.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "packages/schematics/node_modules/magic-string": { - "version": "0.30.5", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.5.tgz", - "integrity": "sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA==", - "dependencies": { - "@jridgewell/sourcemap-codec": "^1.4.15" - }, - "engines": { - "node": ">=12" - } - }, - "packages/schematics/node_modules/picomatch": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-3.0.1.tgz", - "integrity": "sha512-I3EurrIQMlRc9IaAZnqRR044Phh2DXY+55o7uJ0V+hYZAcQYSuFWsc9q5PvyDHUSCe1Qxn/iBz+78s86zWnGag==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "packages/schematics/node_modules/typescript": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", - "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, "packages/testing": { "name": "@baloise/design-system-testing", "version": "15.1.1", diff --git a/packages/schematics/.gitignore b/packages/cli/.gitignore similarity index 100% rename from packages/schematics/.gitignore rename to packages/cli/.gitignore diff --git a/packages/schematics/.npmignore b/packages/cli/.npmignore similarity index 100% rename from packages/schematics/.npmignore rename to packages/cli/.npmignore diff --git a/packages/schematics/LICENSE b/packages/cli/LICENSE similarity index 100% rename from packages/schematics/LICENSE rename to packages/cli/LICENSE diff --git a/packages/schematics/README.md b/packages/cli/README.md similarity index 100% rename from packages/schematics/README.md rename to packages/cli/README.md diff --git a/packages/schematics/package-lock.json b/packages/cli/package-lock.json similarity index 100% rename from packages/schematics/package-lock.json rename to packages/cli/package-lock.json diff --git a/packages/schematics/package.json b/packages/cli/package.json similarity index 92% rename from packages/schematics/package.json rename to packages/cli/package.json index 23ef4968bf..db797898a4 100644 --- a/packages/schematics/package.json +++ b/packages/cli/package.json @@ -1,13 +1,14 @@ { - "name": "@baloise/design-system-schematics", - "version": "0.0.1", + "name": "@baloise/design-system-cli", + "version": "0.0.2", "description": "The Baloise Design-System is an open source project for styling awesome web applications that follow the Baloise corporate styling guidelines.", "scripts": { "build": "tsc -p tsconfig.json" }, "keywords": [ "design-system", - "schematics" + "schematics", + "cli" ], "publishConfig": { "access": "public" diff --git a/packages/schematics/src/collection.json b/packages/cli/src/collection.json similarity index 100% rename from packages/schematics/src/collection.json rename to packages/cli/src/collection.json diff --git a/packages/schematics/src/ng-add/files/i18n.initialize/i18n.initialize.__ts__ b/packages/cli/src/ng-add/files/i18n.initialize/i18n.initialize.__ts__ similarity index 100% rename from packages/schematics/src/ng-add/files/i18n.initialize/i18n.initialize.__ts__ rename to packages/cli/src/ng-add/files/i18n.initialize/i18n.initialize.__ts__ diff --git a/packages/schematics/src/ng-add/files/polyfills/polyfills.__ts__ b/packages/cli/src/ng-add/files/polyfills/polyfills.__ts__ similarity index 100% rename from packages/schematics/src/ng-add/files/polyfills/polyfills.__ts__ rename to packages/cli/src/ng-add/files/polyfills/polyfills.__ts__ diff --git a/packages/schematics/src/ng-add/files/zone-flags/zone-flags.__ts__ b/packages/cli/src/ng-add/files/zone-flags/zone-flags.__ts__ similarity index 100% rename from packages/schematics/src/ng-add/files/zone-flags/zone-flags.__ts__ rename to packages/cli/src/ng-add/files/zone-flags/zone-flags.__ts__ diff --git a/packages/schematics/src/ng-add/generators/app.get.ts b/packages/cli/src/ng-add/generators/app.get.ts similarity index 100% rename from packages/schematics/src/ng-add/generators/app.get.ts rename to packages/cli/src/ng-add/generators/app.get.ts diff --git a/packages/schematics/src/ng-add/generators/i18n.gen.ts b/packages/cli/src/ng-add/generators/i18n.gen.ts similarity index 100% rename from packages/schematics/src/ng-add/generators/i18n.gen.ts rename to packages/cli/src/ng-add/generators/i18n.gen.ts diff --git a/packages/schematics/src/ng-add/generators/polyfills.gen.ts b/packages/cli/src/ng-add/generators/polyfills.gen.ts similarity index 100% rename from packages/schematics/src/ng-add/generators/polyfills.gen.ts rename to packages/cli/src/ng-add/generators/polyfills.gen.ts diff --git a/packages/schematics/src/ng-add/generators/project.gen.ts b/packages/cli/src/ng-add/generators/project.gen.ts similarity index 100% rename from packages/schematics/src/ng-add/generators/project.gen.ts rename to packages/cli/src/ng-add/generators/project.gen.ts diff --git a/packages/schematics/src/ng-add/generators/styles.ts b/packages/cli/src/ng-add/generators/styles.ts similarity index 100% rename from packages/schematics/src/ng-add/generators/styles.ts rename to packages/cli/src/ng-add/generators/styles.ts diff --git a/packages/schematics/src/ng-add/generators/ts-config.gen.ts b/packages/cli/src/ng-add/generators/ts-config.gen.ts similarity index 100% rename from packages/schematics/src/ng-add/generators/ts-config.gen.ts rename to packages/cli/src/ng-add/generators/ts-config.gen.ts diff --git a/packages/schematics/src/ng-add/generators/zone-flags.gen.ts b/packages/cli/src/ng-add/generators/zone-flags.gen.ts similarity index 100% rename from packages/schematics/src/ng-add/generators/zone-flags.gen.ts rename to packages/cli/src/ng-add/generators/zone-flags.gen.ts diff --git a/packages/schematics/src/ng-add/index.ts b/packages/cli/src/ng-add/index.ts similarity index 99% rename from packages/schematics/src/ng-add/index.ts rename to packages/cli/src/ng-add/index.ts index a1ae08ca1d..b5bd142b06 100644 --- a/packages/schematics/src/ng-add/index.ts +++ b/packages/cli/src/ng-add/index.ts @@ -1,5 +1,5 @@ import { Rule, SchematicContext, Tree, chain, mergeWith } from '@angular-devkit/schematics' -import { addDependency, addRootProvider } from '@schematics/angular/utility/index' +import { addDependency, addRootProvider } from '@schematics/angular/utility' import { SchemaOptions } from './schema' import { createPolyfillsFile } from './generators/polyfills.gen' diff --git a/packages/schematics/src/ng-add/schema.json b/packages/cli/src/ng-add/schema.json similarity index 100% rename from packages/schematics/src/ng-add/schema.json rename to packages/cli/src/ng-add/schema.json diff --git a/packages/schematics/src/ng-add/schema.ts b/packages/cli/src/ng-add/schema.ts similarity index 100% rename from packages/schematics/src/ng-add/schema.ts rename to packages/cli/src/ng-add/schema.ts diff --git a/packages/schematics/src/ng-add/utils/workspace.ts b/packages/cli/src/ng-add/utils/workspace.ts similarity index 100% rename from packages/schematics/src/ng-add/utils/workspace.ts rename to packages/cli/src/ng-add/utils/workspace.ts diff --git a/packages/schematics/tsconfig.json b/packages/cli/tsconfig.json similarity index 100% rename from packages/schematics/tsconfig.json rename to packages/cli/tsconfig.json From 0eebe1e952adbd39a3f70d0c95399bd45e2834fd Mon Sep 17 00:00:00 2001 From: Gery Hirschfeld Date: Mon, 15 Jan 2024 10:35:07 +0100 Subject: [PATCH 6/6] chore: update format of temp files --- package-lock.json | 2 +- packages/cli/package.json | 2 +- packages/cli/src/ng-add/generators/app.get.ts | 100 +++++++++--------- packages/cli/src/ng-add/generators/styles.ts | 48 ++++----- packages/cli/src/ng-add/index.ts | 4 +- 5 files changed, 77 insertions(+), 79 deletions(-) diff --git a/package-lock.json b/package-lock.json index d117ac3851..7d03d90638 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30538,7 +30538,7 @@ }, "packages/cli": { "name": "@baloise/design-system-cli", - "version": "0.0.2", + "version": "0.0.3", "license": "Apache-2.0", "dependencies": { "@angular-devkit/core": "^17.0.10", diff --git a/packages/cli/package.json b/packages/cli/package.json index db797898a4..cbfc5ff3a7 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@baloise/design-system-cli", - "version": "0.0.2", + "version": "0.0.4", "description": "The Baloise Design-System is an open source project for styling awesome web applications that follow the Baloise corporate styling guidelines.", "scripts": { "build": "tsc -p tsconfig.json" diff --git a/packages/cli/src/ng-add/generators/app.get.ts b/packages/cli/src/ng-add/generators/app.get.ts index a7850ce0fb..9186ccbcf2 100644 --- a/packages/cli/src/ng-add/generators/app.get.ts +++ b/packages/cli/src/ng-add/generators/app.get.ts @@ -24,57 +24,17 @@ export const updateAppComponent = (host: Tree, options: SchemaOptions) => { if (isInlineTemplate) { host.overwrite( appComponentPath, - ` - import { Component, CUSTOM_ELEMENTS_SCHEMA${isOnPush ? ', ChangeDetectionStrategy' : ''} } from '@angular/core' - import { CommonModule } from '@angular/common' - import { BalLayoutBundle, BalHeading, BalButton } from '@baloise/design-system-components-angular/standalone' - - @Component({ - selector: '${prefix}-root', - standalone: true,${onPushTemplate} - schemas: [CUSTOM_ELEMENTS_SCHEMA], - imports: [CommonModule, BalLayoutBundle, BalHeading, BalButton], - ${styleTemplate} - template: \` -
- -
-
- - Hello World! - Button -
- - - -
\`, - }) - export class AppComponent {} - `, - ) - } else { - host.overwrite( - appComponentPath, - ` - import { Component, CUSTOM_ELEMENTS_SCHEMA${isOnPush ? ', ChangeDetectionStrategy' : ''} } from '@angular/core' - import { CommonModule } from '@angular/common' - import { BalLayoutBundle, BalHeading, BalButton } from '@baloise/design-system-components-angular/standalone' - - @Component({ - selector: '${prefix}-root', - standalone: true,${onPushTemplate} - schemas: [CUSTOM_ELEMENTS_SCHEMA], - imports: [CommonModule, BalLayoutBundle, BalHeading, BalButton], - templateUrl: './app.component.html', - ${styleTemplate} - }) - export class AppComponent {} - `, - ) + `import { Component, CUSTOM_ELEMENTS_SCHEMA${isOnPush ? ', ChangeDetectionStrategy' : ''} } from '@angular/core' +import { CommonModule } from '@angular/common' +import { BalLayoutBundle, BalHeading, BalButton } from '@baloise/design-system-components-angular/standalone' - host.overwrite( - appTemplatePath, - ` +@Component({ + selector: '${prefix}-root', + standalone: true,${onPushTemplate} + schemas: [CUSTOM_ELEMENTS_SCHEMA], + imports: [CommonModule, BalLayoutBundle, BalHeading, BalButton], + ${styleTemplate} + template: \`
@@ -86,7 +46,45 @@ export const updateAppComponent = (host: Tree, options: SchemaOptions) => { -
`, +
\`, +}) +export class AppComponent {} +`, + ) + } else { + host.overwrite( + appComponentPath, + `import { Component, CUSTOM_ELEMENTS_SCHEMA${isOnPush ? ', ChangeDetectionStrategy' : ''} } from '@angular/core' +import { CommonModule } from '@angular/common' +import { BalLayoutBundle, BalHeading, BalButton } from '@baloise/design-system-components-angular/standalone' + +@Component({ + selector: '${prefix}-root', + standalone: true,${onPushTemplate} + schemas: [CUSTOM_ELEMENTS_SCHEMA], + imports: [CommonModule, BalLayoutBundle, BalHeading, BalButton], + templateUrl: './app.component.html', + ${styleTemplate} +}) +export class AppComponent {} +`, + ) + + host.overwrite( + appTemplatePath, + ` +
+ +
+
+ + Hello World! + Button +
+ + + +
`, ) } } else { diff --git a/packages/cli/src/ng-add/generators/styles.ts b/packages/cli/src/ng-add/generators/styles.ts index 57825761a6..eeb87fa1b9 100644 --- a/packages/cli/src/ng-add/generators/styles.ts +++ b/packages/cli/src/ng-add/generators/styles.ts @@ -12,30 +12,30 @@ export const addStyles = (host: Tree) => { const newContent = content + ` - // SASS mixins and variables - @import '@baloise/design-system-css/sass/mixins'; - - // Resets CSS for all browser - @import '@baloise/design-system-css/css/normalize'; - @import '@baloise/design-system-css/css/structure'; - - // Custom font faces - @import '@baloise/design-system-css/css/font'; - - // Core CSS, always required - @import '@baloise/design-system-css/css/core'; - - // CSS utilities classes (optional) - @import '@baloise/design-system-css/css/border'; - @import '@baloise/design-system-css/css/color'; - @import '@baloise/design-system-css/css/display'; - @import '@baloise/design-system-css/css/flex'; - @import '@baloise/design-system-css/css/grid'; - @import '@baloise/design-system-css/css/opacity'; - @import '@baloise/design-system-css/css/radius'; - @import '@baloise/design-system-css/css/shadow'; - @import '@baloise/design-system-css/css/spacing'; - @import '@baloise/design-system-css/css/typography'; +// SASS mixins and variables +@import '@baloise/design-system-css/sass/mixins'; + +// Resets CSS for all browser +@import '@baloise/design-system-css/css/normalize'; +@import '@baloise/design-system-css/css/structure'; + +// Custom font faces +@import '@baloise/design-system-css/css/font'; + +// Core CSS, always required +@import '@baloise/design-system-css/css/core'; + +// CSS utilities classes (optional) +@import '@baloise/design-system-css/css/border'; +@import '@baloise/design-system-css/css/color'; +@import '@baloise/design-system-css/css/display'; +@import '@baloise/design-system-css/css/flex'; +@import '@baloise/design-system-css/css/grid'; +@import '@baloise/design-system-css/css/opacity'; +@import '@baloise/design-system-css/css/radius'; +@import '@baloise/design-system-css/css/shadow'; +@import '@baloise/design-system-css/css/spacing'; +@import '@baloise/design-system-css/css/typography'; ` host.overwrite(filePath, newContent) } diff --git a/packages/cli/src/ng-add/index.ts b/packages/cli/src/ng-add/index.ts index b5bd142b06..baf26a9512 100644 --- a/packages/cli/src/ng-add/index.ts +++ b/packages/cli/src/ng-add/index.ts @@ -23,7 +23,7 @@ export default function (options: SchemaOptions): Rule { actions.push( addRootProvider(options.project, ({ code, external }) => { - return code`, + return code` ${external('provideBaloiseDesignSystem', '@baloise/design-system-components-angular/standalone')}({ defaults: { region: '${options.region}', @@ -36,7 +36,7 @@ export default function (options: SchemaOptions): Rule { actions.push(mergeWith(createI18nFile())) actions.push( addRootProvider(options.project, ({ code, external }) => { - return code`, + return code` { provide: ${external('APP_INITIALIZER', '@angular/core')}, useFactory: ${external('initializeI18n', './i18n.initialize')},