@aaamb/ngx-design-system 1.3.9 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +17 -0
- package/.nvmrc +1 -0
- package/.postcssrc.json +5 -0
- package/.storybook/main.ts +20 -0
- package/.storybook/preview.ts +23 -0
- package/.storybook/storybook.css +1 -0
- package/.storybook/tsconfig.json +19 -0
- package/.vscode/extensions.json +4 -0
- package/.vscode/launch.json +20 -0
- package/.vscode/tasks.json +42 -0
- package/CHANGELOG.md +10 -0
- package/LOCAL_DEVELOPMENT.md +129 -0
- package/angular.json +74 -0
- package/bitbucket-pipelines.yml +41 -0
- package/iac/bin/app.ts +42 -0
- package/iac/cdk.json +82 -0
- package/iac/lib/config/environments.ts +19 -0
- package/iac/lib/config/types.ts +13 -0
- package/iac/lib/stacks/certificate-stack.ts +34 -0
- package/iac/lib/stacks/frontend-stack.ts +120 -0
- package/iac/lib/stacks/index.ts +2 -0
- package/iac/package-lock.json +726 -0
- package/iac/package.json +25 -0
- package/iac/tsconfig.json +24 -0
- package/ng-package.json +8 -0
- package/package.json +58 -14
- package/src/components/button/button-green.stories.ts +101 -0
- package/src/components/button/button-text.stories.ts +105 -0
- package/src/components/button/button-white.stories.ts +105 -0
- package/src/components/button/button.component.stories.ts +91 -0
- package/src/components/button/button.component.ts +93 -0
- package/src/components/checkbox/checkbox.component.html +30 -0
- package/src/components/checkbox/checkbox.component.stories.ts +183 -0
- package/src/components/checkbox/checkbox.component.ts +211 -0
- package/src/components/datepicker-selector/datepicker-selector.component.html +103 -0
- package/src/components/datepicker-selector/datepicker-selector.component.stories.ts +123 -0
- package/src/components/datepicker-selector/datepicker-selector.component.ts +337 -0
- package/src/components/error-message/error-message.component.html +3 -0
- package/src/components/error-message/error-message.component.ts +13 -0
- package/src/components/filter-button/filter-button.component.html +286 -0
- package/src/components/filter-button/filter-button.component.stories.ts +123 -0
- package/src/components/filter-button/filter-button.component.ts +582 -0
- package/src/components/icon/icon.component.ts +20 -0
- package/src/components/icon/icon.html +1424 -0
- package/src/components/icon/icon.stories.ts +49 -0
- package/src/components/icon/icons-list.stories.ts +42 -0
- package/src/components/input/input.component.stories.ts +101 -0
- package/src/components/input/input.component.ts +317 -0
- package/src/components/input/input.html +160 -0
- package/src/components/input-datepicker/input-datepicker.component.ts +356 -0
- package/src/components/input-datepicker/input-datepicker.html +69 -0
- package/src/components/input-datepicker/input-datepicker.stories.ts +99 -0
- package/src/components/input-rangepicker/input-rangepicker.component.ts +365 -0
- package/src/components/input-rangepicker/input-rangepicker.html +54 -0
- package/src/components/input-rangepicker/input-rangepicker.stories.ts +88 -0
- package/src/components/input-weekpicker/input-weekpicker.component.ts +417 -0
- package/src/components/input-weekpicker/input-weekpicker.html +54 -0
- package/src/components/input-weekpicker/input-weekpicker.stories.ts +103 -0
- package/src/components/label/label.component.html +20 -0
- package/src/components/label/label.component.ts +22 -0
- package/src/components/modals/delicate-confirmation-modal/delicate-confirmation-modal.component.html +32 -0
- package/src/components/modals/delicate-confirmation-modal/delicate-confirmation-modal.component.stories.ts +57 -0
- package/src/components/modals/delicate-confirmation-modal/delicate-confirmation-modal.component.ts +48 -0
- package/src/components/modals/feedback-modal/feedback-modal.component.html +118 -0
- package/src/components/modals/feedback-modal/feedback-modal.component.stories.ts +93 -0
- package/src/components/modals/feedback-modal/feedback-modal.component.ts +187 -0
- package/src/components/modals/help-modal/help-modal.component.html +32 -0
- package/src/components/modals/help-modal/help-modal.component.stories.ts +76 -0
- package/src/components/modals/help-modal/help-modal.component.ts +54 -0
- package/src/components/modals/information-modal/information-modal.component.html +24 -0
- package/src/components/modals/information-modal/information-modal.component.stories.ts +62 -0
- package/src/components/modals/information-modal/information-modal.component.ts +35 -0
- package/src/components/modals/main-modal/main-modal.component.html +85 -0
- package/src/components/modals/main-modal/main-modal.component.stories.ts +127 -0
- package/src/components/modals/main-modal/main-modal.component.ts +85 -0
- package/src/components/modals/notification-modal/notification-modal.component.html +22 -0
- package/src/components/modals/notification-modal/notification-modal.component.stories.ts +59 -0
- package/src/components/modals/notification-modal/notification-modal.component.ts +37 -0
- package/src/components/selectors/multiple-selector/multiple-selector.component.html +51 -0
- package/src/components/selectors/multiple-selector/multiple-selector.component.stories.ts +306 -0
- package/src/components/selectors/multiple-selector/multiple-selector.component.ts +308 -0
- package/src/components/selectors/single-selector/single-selector.component.html +46 -0
- package/src/components/selectors/single-selector/single-selector.component.stories.ts +294 -0
- package/src/components/selectors/single-selector/single-selector.component.ts +239 -0
- package/src/components/side-nav/side-nav.component.stories.ts +176 -0
- package/src/components/side-nav/side-nav.component.ts +325 -0
- package/src/components/snackbar/snackbar.component.ts +150 -0
- package/src/components/snackbar/snackbar.html +21 -0
- package/src/components/snackbar/snackbar.stories.ts +51 -0
- package/src/components/state/state.component.ts +30 -0
- package/src/components/state/state.html +13 -0
- package/src/components/state/state.stories.ts +74 -0
- package/src/components/table/table.component.html +466 -0
- package/src/components/table/table.component.scss +28 -0
- package/src/components/table/table.component.stories.ts +655 -0
- package/src/components/table/table.component.ts +475 -0
- package/src/components/tabs/tabs.component.stories.ts +114 -0
- package/src/components/tabs/tabs.component.ts +69 -0
- package/src/core/types.ts +494 -0
- package/src/public-api.ts +23 -0
- package/tsconfig.json +37 -0
- package/tsconfig.lib.json +17 -0
- package/tsconfig.lib.prod.json +9 -0
- package/tsconfig.spec.json +13 -0
- package/fesm2022/aaamb-ngx-design-system.mjs +0 -4075
- package/fesm2022/aaamb-ngx-design-system.mjs.map +0 -1
- package/styles/compiled.css +0 -2
- package/types/aaamb-ngx-design-system.d.ts +0 -1142
package/.editorconfig
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Editor configuration, see https://editorconfig.org
|
|
2
|
+
root = true
|
|
3
|
+
|
|
4
|
+
[*]
|
|
5
|
+
charset = utf-8
|
|
6
|
+
indent_style = space
|
|
7
|
+
indent_size = 2
|
|
8
|
+
insert_final_newline = true
|
|
9
|
+
trim_trailing_whitespace = true
|
|
10
|
+
|
|
11
|
+
[*.ts]
|
|
12
|
+
quote_type = single
|
|
13
|
+
ij_typescript_use_double_quotes = false
|
|
14
|
+
|
|
15
|
+
[*.md]
|
|
16
|
+
max_line_length = off
|
|
17
|
+
trim_trailing_whitespace = false
|
package/.nvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
22
|
package/.postcssrc.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { StorybookConfig } from '@storybook/angular';
|
|
2
|
+
|
|
3
|
+
const config: StorybookConfig = {
|
|
4
|
+
stories: [
|
|
5
|
+
'../src/**/*.stories.ts',
|
|
6
|
+
],
|
|
7
|
+
framework: {
|
|
8
|
+
name: '@storybook/angular',
|
|
9
|
+
options: {
|
|
10
|
+
builder: {
|
|
11
|
+
useBrowserTarget: 'storybook:build-angular',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
core: {
|
|
16
|
+
disableOnboarding: true,
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default config;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { registerLocaleData } from '@angular/common';
|
|
2
|
+
import { importProvidersFrom, LOCALE_ID } from '@angular/core';
|
|
3
|
+
import localeEn from '@angular/common/locales/en';
|
|
4
|
+
import type { Preview } from '@storybook/angular';
|
|
5
|
+
import { applicationConfig } from '@storybook/angular';
|
|
6
|
+
import { NZ_I18N, en_US } from 'ng-zorro-antd/i18n';
|
|
7
|
+
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
|
8
|
+
|
|
9
|
+
registerLocaleData(localeEn, 'en-us');
|
|
10
|
+
|
|
11
|
+
const preview: Preview = {
|
|
12
|
+
decorators: [
|
|
13
|
+
applicationConfig({
|
|
14
|
+
providers: [
|
|
15
|
+
{ provide: LOCALE_ID, useValue: 'en-US' },
|
|
16
|
+
{ provide: NZ_I18N, useValue: en_US },
|
|
17
|
+
importProvidersFrom(NoopAnimationsModule),
|
|
18
|
+
],
|
|
19
|
+
}),
|
|
20
|
+
],
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default preview;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import '../styles/input.css';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"types": [],
|
|
5
|
+
"paths": {
|
|
6
|
+
"ngx-aaamb-design-system": [
|
|
7
|
+
"../src/public-api.ts"
|
|
8
|
+
]
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"include": [
|
|
12
|
+
"./preview.ts",
|
|
13
|
+
"../src/**/*.ts"
|
|
14
|
+
],
|
|
15
|
+
"exclude": [
|
|
16
|
+
"../**/*.spec.ts"
|
|
17
|
+
],
|
|
18
|
+
"files": []
|
|
19
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"configurations": [
|
|
5
|
+
{
|
|
6
|
+
"name": "ng serve",
|
|
7
|
+
"type": "chrome",
|
|
8
|
+
"request": "launch",
|
|
9
|
+
"preLaunchTask": "npm: start",
|
|
10
|
+
"url": "http://localhost:4200/"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"name": "ng test",
|
|
14
|
+
"type": "chrome",
|
|
15
|
+
"request": "launch",
|
|
16
|
+
"preLaunchTask": "npm: test",
|
|
17
|
+
"url": "http://localhost:9876/debug.html"
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
// For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"tasks": [
|
|
5
|
+
{
|
|
6
|
+
"type": "npm",
|
|
7
|
+
"script": "start",
|
|
8
|
+
"isBackground": true,
|
|
9
|
+
"problemMatcher": {
|
|
10
|
+
"owner": "typescript",
|
|
11
|
+
"pattern": "$tsc",
|
|
12
|
+
"background": {
|
|
13
|
+
"activeOnStart": true,
|
|
14
|
+
"beginsPattern": {
|
|
15
|
+
"regexp": "(.*?)"
|
|
16
|
+
},
|
|
17
|
+
"endsPattern": {
|
|
18
|
+
"regexp": "bundle generation complete"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"type": "npm",
|
|
25
|
+
"script": "test",
|
|
26
|
+
"isBackground": true,
|
|
27
|
+
"problemMatcher": {
|
|
28
|
+
"owner": "typescript",
|
|
29
|
+
"pattern": "$tsc",
|
|
30
|
+
"background": {
|
|
31
|
+
"activeOnStart": true,
|
|
32
|
+
"beginsPattern": {
|
|
33
|
+
"regexp": "(.*?)"
|
|
34
|
+
},
|
|
35
|
+
"endsPattern": {
|
|
36
|
+
"regexp": "bundle generation complete"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## [1.1.1] - 2026-05-06
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- Updated `InputDatepickerComponent` string date handling to normalize input values to US date format before parsing.
|
|
10
|
+
- Limited fallback `Date` parsing to ISO-like date strings, returning `null` for unsupported non-ISO string values.
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Local Development Guide
|
|
2
|
+
|
|
3
|
+
This guide explains how to build and test the design system locally against a consumer application (e.g., charge-capture-frontend) before publishing to npm.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- Node.js >= 22 (check `.nvmrc`)
|
|
8
|
+
- The consumer application cloned locally
|
|
9
|
+
|
|
10
|
+
## Step 1: Install dependencies
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
cd aaamb-design-system
|
|
14
|
+
nvm use
|
|
15
|
+
npm install
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Step 2: Build the library
|
|
19
|
+
|
|
20
|
+
This compiles Tailwind utilities into `styles/compiled.css` (with layer stripping for consumer compatibility), then builds the Angular library with ng-packagr:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm run build:lib
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Verify the output exists:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
ls dist/aaamb-ngx-design-system/styles/compiled.css
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Step 3: Link the library globally
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
cd dist/aaamb-ngx-design-system
|
|
36
|
+
npm link
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Step 4: Link in the consumer application
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
cd /path/to/consumer-app
|
|
43
|
+
npm link @aaamb/ngx-design-system
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Step 5: Configure the consumer for symlinks
|
|
47
|
+
|
|
48
|
+
In the consumer's `angular.json`, add `preserveSymlinks: true` to the build options:
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"architect": {
|
|
53
|
+
"build": {
|
|
54
|
+
"options": {
|
|
55
|
+
"preserveSymlinks": true
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
This prevents Angular from resolving `@angular/core` from the design system's `node_modules` instead of the consumer's, which causes type brand mismatches at build time.
|
|
63
|
+
|
|
64
|
+
## Step 6: Import the compiled CSS in the consumer
|
|
65
|
+
|
|
66
|
+
Add the compiled CSS to the consumer's `angular.json` styles array:
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"styles": [
|
|
71
|
+
"node_modules/@aaamb/ngx-design-system/styles/compiled.css",
|
|
72
|
+
"..."
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
No Tailwind installation, no PostCSS config, and no additional CSS files are needed in the consumer.
|
|
78
|
+
|
|
79
|
+
## Step 7: Run the consumer app
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
cd /path/to/consumer-app
|
|
83
|
+
npm start
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
The design system components should render with correct colors, fonts, and spacing.
|
|
87
|
+
|
|
88
|
+
## Iterating on changes
|
|
89
|
+
|
|
90
|
+
Every change to the design system requires a rebuild before the consumer app can pick it up. The consumer imports the pre-compiled CSS and built JS bundle from `dist/`, so there is no live-reload between the two projects.
|
|
91
|
+
|
|
92
|
+
Depending on what changed, you can choose the faster path:
|
|
93
|
+
|
|
94
|
+
**CSS-only changes** (theme tokens, colors, fonts in `styles/theme.css`):
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
npm run build:css
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
This runs in ~30ms. Since ng-packagr already copied the `styles/` directory and the consumer is symlinked to `dist/`, the updated `compiled.css` is available immediately. Restart the consumer dev server to pick up the new CSS.
|
|
101
|
+
|
|
102
|
+
**Component changes** (new Tailwind classes, template changes, new components):
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
npm run build:lib
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
This runs `build:css` first, then recompiles the Angular library with ng-packagr. Both the CSS and JS output are updated. Restart the consumer dev server to pick up the changes.
|
|
109
|
+
|
|
110
|
+
After either rebuild, you will need to restart the consumer's dev server (`npm start`) for changes to take effect.
|
|
111
|
+
|
|
112
|
+
## How the CSS build works
|
|
113
|
+
|
|
114
|
+
1. `tailwindcss` reads `styles/input.css`, which imports only `tailwindcss/theme` and `tailwindcss/utilities` (no preflight/reset) and scans `src/**/*.ts` for Tailwind class usage.
|
|
115
|
+
2. The output is minified into `styles/compiled.css`.
|
|
116
|
+
3. `styles/strip-layers.js` removes `@layer` wrappers from the compiled CSS. This is necessary because CSS `@layer` styles always lose to unlayered styles in the cascade, and consumer apps typically have unlayered styles (ng-zorro, Angular Material) that would override the design system's utility classes.
|
|
117
|
+
4. ng-packagr copies `styles/**/*` into the dist via the `assets` config in `ng-package.json`.
|
|
118
|
+
|
|
119
|
+
## Unlinking
|
|
120
|
+
|
|
121
|
+
When done testing locally:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
cd /path/to/consumer-app
|
|
125
|
+
npm unlink @aaamb/ngx-design-system
|
|
126
|
+
npm install
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Remove `preserveSymlinks: true` from `angular.json` if it was only added for local testing.
|
package/angular.json
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
|
3
|
+
"version": 1,
|
|
4
|
+
"newProjectRoot": "projects",
|
|
5
|
+
"projects": {
|
|
6
|
+
"storybook": {
|
|
7
|
+
"projectType": "application",
|
|
8
|
+
"root": ".storybook",
|
|
9
|
+
"sourceRoot": ".storybook",
|
|
10
|
+
"architect": {
|
|
11
|
+
"build-storybook": {
|
|
12
|
+
"builder": "@storybook/angular:build-storybook",
|
|
13
|
+
"options": {
|
|
14
|
+
"configDir": ".storybook",
|
|
15
|
+
"browserTarget": "storybook:build-angular",
|
|
16
|
+
"compodoc": false
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"storybook": {
|
|
20
|
+
"builder": "@storybook/angular:start-storybook",
|
|
21
|
+
"options": {
|
|
22
|
+
"configDir": ".storybook",
|
|
23
|
+
"browserTarget": "storybook:build-angular",
|
|
24
|
+
"port": 6006,
|
|
25
|
+
"compodoc": false
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"build-angular": {
|
|
29
|
+
"builder": "@angular-devkit/build-angular:browser",
|
|
30
|
+
"options": {
|
|
31
|
+
"outputPath": "dist/storybook-angular",
|
|
32
|
+
"index": "",
|
|
33
|
+
"main": "",
|
|
34
|
+
"tsConfig": ".storybook/tsconfig.json",
|
|
35
|
+
"styles": [
|
|
36
|
+
"node_modules/ng-zorro-antd/ng-zorro-antd.min.css",
|
|
37
|
+
".storybook/storybook.css"
|
|
38
|
+
],
|
|
39
|
+
"scripts": []
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"ngx-aaamb-design-system": {
|
|
45
|
+
"projectType": "library",
|
|
46
|
+
"root": ".",
|
|
47
|
+
"sourceRoot": "src",
|
|
48
|
+
"prefix": "aaamb",
|
|
49
|
+
"architect": {
|
|
50
|
+
"build": {
|
|
51
|
+
"builder": "@angular/build:ng-packagr",
|
|
52
|
+
"configurations": {
|
|
53
|
+
"production": {
|
|
54
|
+
"tsConfig": "tsconfig.lib.prod.json"
|
|
55
|
+
},
|
|
56
|
+
"development": {
|
|
57
|
+
"tsConfig": "tsconfig.lib.json"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"defaultConfiguration": "production"
|
|
61
|
+
},
|
|
62
|
+
"test": {
|
|
63
|
+
"builder": "@angular/build:karma",
|
|
64
|
+
"options": {
|
|
65
|
+
"tsConfig": "tsconfig.spec.json"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"cli": {
|
|
72
|
+
"analytics": "40277e73-172c-4717-8a22-321956708774"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
image: node:22-alpine
|
|
2
|
+
|
|
3
|
+
pipelines:
|
|
4
|
+
pull-requests:
|
|
5
|
+
'**':
|
|
6
|
+
- step:
|
|
7
|
+
name: Build Storybook
|
|
8
|
+
max-time: 10
|
|
9
|
+
caches:
|
|
10
|
+
- node
|
|
11
|
+
script:
|
|
12
|
+
- npm ci
|
|
13
|
+
- npm run build-storybook
|
|
14
|
+
|
|
15
|
+
branches:
|
|
16
|
+
main:
|
|
17
|
+
- step:
|
|
18
|
+
name: Build Storybook
|
|
19
|
+
caches:
|
|
20
|
+
- node
|
|
21
|
+
script:
|
|
22
|
+
- npm ci
|
|
23
|
+
- npm run build-storybook
|
|
24
|
+
artifacts:
|
|
25
|
+
- storybook-static/**
|
|
26
|
+
|
|
27
|
+
- step:
|
|
28
|
+
name: Deploy to S3 and Invalidate CloudFront
|
|
29
|
+
script:
|
|
30
|
+
- apk add --no-cache aws-cli
|
|
31
|
+
- export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID
|
|
32
|
+
- export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY
|
|
33
|
+
- export AWS_DEFAULT_REGION=${AWS_REGION:-sa-east-1}
|
|
34
|
+
- aws s3 sync storybook-static/ s3://${S3_BUCKET} --delete --exclude "*" --include "*.html" --content-type "text/html"
|
|
35
|
+
- aws s3 sync storybook-static/ s3://${S3_BUCKET} --delete --exclude "*.html"
|
|
36
|
+
- |
|
|
37
|
+
if [ -n "${CLOUDFRONT_DISTRIBUTION_ID}" ]; then
|
|
38
|
+
aws cloudfront create-invalidation --distribution-id ${CLOUDFRONT_DISTRIBUTION_ID} --paths "/*"
|
|
39
|
+
else
|
|
40
|
+
echo "CloudFront distribution not configured yet. Skipping invalidation."
|
|
41
|
+
fi
|
package/iac/bin/app.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import 'source-map-support/register';
|
|
3
|
+
import * as cdk from 'aws-cdk-lib';
|
|
4
|
+
import { environments } from '../lib/config/environments';
|
|
5
|
+
import { CertificateStack, FrontendStack } from '../lib/stacks';
|
|
6
|
+
|
|
7
|
+
const app = new cdk.App();
|
|
8
|
+
|
|
9
|
+
const envConfig = environments['production'];
|
|
10
|
+
|
|
11
|
+
const cdkEnv: cdk.Environment = {
|
|
12
|
+
account: envConfig.account,
|
|
13
|
+
region: envConfig.region,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const createCert = app.node.tryGetContext('createCert') === 'true';
|
|
17
|
+
if (createCert) {
|
|
18
|
+
new CertificateStack(app, 'design-system-cert-us-east-1', {
|
|
19
|
+
env: {
|
|
20
|
+
account: envConfig.account,
|
|
21
|
+
region: 'us-east-1',
|
|
22
|
+
},
|
|
23
|
+
hostedZoneId: envConfig.hostedZoneId,
|
|
24
|
+
hostedZoneName: envConfig.hostedZoneName,
|
|
25
|
+
certificateDomainName: envConfig.frontend.certificateDomainName,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const cloudfrontCertArn =
|
|
30
|
+
app.node.tryGetContext('cloudfrontCertArn') || process.env.CLOUDFRONT_CERT_ARN;
|
|
31
|
+
if (cloudfrontCertArn) {
|
|
32
|
+
new FrontendStack(app, 'design-system-frontend', {
|
|
33
|
+
env: cdkEnv,
|
|
34
|
+
envConfig,
|
|
35
|
+
cloudFrontCertificateArn: cloudfrontCertArn,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
cdk.Tags.of(app).add('Project', 'design-system');
|
|
40
|
+
cdk.Tags.of(app).add('ManagedBy', 'CDK');
|
|
41
|
+
|
|
42
|
+
app.synth();
|
package/iac/cdk.json
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"app": "npx ts-node --prefer-ts-exts bin/app.ts",
|
|
3
|
+
"context": {
|
|
4
|
+
"@aws-cdk/aws-ecs:arnFormatIncludesClusterName": true,
|
|
5
|
+
"@aws-cdk/core:checkSecretUsage": true,
|
|
6
|
+
"@aws-cdk/core:target-partitions": [
|
|
7
|
+
"aws",
|
|
8
|
+
"aws-cn"
|
|
9
|
+
],
|
|
10
|
+
"@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true,
|
|
11
|
+
"@aws-cdk/aws-ec2:uniqueImdsv2TemplateName": true,
|
|
12
|
+
"@aws-cdk/aws-iam:minimizePolicies": true,
|
|
13
|
+
"@aws-cdk/core:validateSnapshotRemovalPolicy": true,
|
|
14
|
+
"@aws-cdk/aws-codepipeline:crossAccountKeyAliasStackSafeResourceName": true,
|
|
15
|
+
"@aws-cdk/aws-s3:createDefaultLoggingPolicy": true,
|
|
16
|
+
"@aws-cdk/aws-sns-subscriptions:restrictSqsDescryption": true,
|
|
17
|
+
"@aws-cdk/aws-apigateway:disableCloudWatchRole": true,
|
|
18
|
+
"@aws-cdk/aws-events:eventsTargetQueueSameAccount": true,
|
|
19
|
+
"@aws-cdk/aws-iam:standardizedServicePrincipals": true,
|
|
20
|
+
"@aws-cdk/aws-ecs:disableExplicitDeploymentControllerForCircuitBreaker": true,
|
|
21
|
+
"@aws-cdk/aws-ecs:removeDefaultDeploymentAlarm": true,
|
|
22
|
+
"@aws-cdk/aws-secretsmanager:useAttachedSecretResourcePolicyForSecretTargetAttachments": true,
|
|
23
|
+
"@aws-cdk/aws-redshift:columnId": true,
|
|
24
|
+
"@aws-cdk/aws-stepfunctions-tasks:enableEmrServicePolicyV2": true,
|
|
25
|
+
"@aws-cdk/aws-ec2:restrictDefaultSecurityGroup": true,
|
|
26
|
+
"@aws-cdk/aws-apigateway:requestValidatorUniqueId": true,
|
|
27
|
+
"@aws-cdk/aws-kms:aliasNameRef": true,
|
|
28
|
+
"@aws-cdk/aws-autoscaling:generateLaunchTemplateInsteadOfLaunchConfig": true,
|
|
29
|
+
"@aws-cdk/core:includePrefixInUniqueNameGeneration": true,
|
|
30
|
+
"@aws-cdk/aws-opensearchservice:enableOpensearchMultiAzWithStandby": true,
|
|
31
|
+
"@aws-cdk/aws-lambda-nodejs:useLatestRuntimeVersion": true,
|
|
32
|
+
"@aws-cdk/aws-efs:denyAnonymousAccess": true,
|
|
33
|
+
"@aws-cdk/aws-rds:databaseProxyUniqueResourceName": true,
|
|
34
|
+
"@aws-cdk/aws-codedeploy:removeAlarmsFromDeploymentGroup": true,
|
|
35
|
+
"@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId": true,
|
|
36
|
+
"@aws-cdk/aws-ec2:launchTemplateDefaultUserData": true,
|
|
37
|
+
"@aws-cdk/aws-secretsmanager:parseOwnedSecretName": true,
|
|
38
|
+
"@aws-cdk/aws-kms:reduceCrossAccountRegionPolicyScope": true,
|
|
39
|
+
"@aws-cdk/aws-eks:nodegroupNameDefault": true,
|
|
40
|
+
"@aws-cdk/aws-ecs:enableImdsBlockingDeprecatedFeature": true,
|
|
41
|
+
"@aws-cdk/aws-ecs:disableEcsImdsBlocking": false,
|
|
42
|
+
"@aws-cdk/aws-ecs:enableServiceConnectDefaultLogDriver": true,
|
|
43
|
+
"@aws-cdk/aws-applicationautoscaling:policyTargetTrackingScaling": true,
|
|
44
|
+
"@aws-cdk/aws-route53-patters:useCertificate": true,
|
|
45
|
+
"@aws-cdk/customresources:installLatestAwsSdkDefault": false,
|
|
46
|
+
"@aws-cdk/aws-rds:auroraClusterChangeScopeOfInstanceParameterGroupWithEachParameters": true,
|
|
47
|
+
"@aws-cdk/aws-appsync:useArnForSourceApiAssociationIdentifier": true,
|
|
48
|
+
"@aws-cdk/aws-rds:preventRenderingDeprecatedCredentials": true,
|
|
49
|
+
"@aws-cdk/aws-codepipeline-actions:useNewDefaultBranchForCodeCommitSource": true,
|
|
50
|
+
"@aws-cdk/aws-cloudwatch-actions:changeLambdaPermissionLogicalIdForLambdaAction": true,
|
|
51
|
+
"@aws-cdk/aws-codepipeline:crossAccountKeysDefaultValueToFalse": true,
|
|
52
|
+
"@aws-cdk/aws-codepipeline:defaultPipelineTypeToV2": true,
|
|
53
|
+
"@aws-cdk/aws-kms:useDangerouslyUnrestrictedTrustPolicy": false,
|
|
54
|
+
"@aws-cdk/aws-s3:keepNotificationInImportedBucket": false,
|
|
55
|
+
"@aws-cdk/aws-codepipeline:enableKeyRotation": true,
|
|
56
|
+
"@aws-cdk/aws-ec2:ebsDefaultGp3Volume": true,
|
|
57
|
+
"@aws-cdk/aws-ecs:enableFargateCapacityProviders": true,
|
|
58
|
+
"@aws-cdk/aws-ec2:ec2SumTImeoutEnabled": true,
|
|
59
|
+
"@aws-cdk/aws-ecs:enabledCpuReservationMetrics": true,
|
|
60
|
+
"@aws-cdk/aws-iam:importedRoleStackSafeDefaultPolicyName": true,
|
|
61
|
+
"@aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy": true,
|
|
62
|
+
"@aws-cdk/aws-route53-recoveryreadiness:aprnRef": true,
|
|
63
|
+
"@aws-cdk/aws-bedrock:bedrockAgentVersionProperty": true,
|
|
64
|
+
"@aws-cdk/aws-rds:clusterScalabilityType": true,
|
|
65
|
+
"@aws-cdk/aws-ec2:ec2Safeguards": true,
|
|
66
|
+
"@aws-cdk/aws-lambda:recognizeVersionProps": true,
|
|
67
|
+
"@aws-cdk/aws-cloudfront:useS3ObjectLambda": true,
|
|
68
|
+
"@aws-cdk/aws-lambda:recognizeLayerVersion": true,
|
|
69
|
+
"@aws-cdk/core:cfnIncludeRejectComplexResourceUpdateCreatePolicyIntrinsics": true,
|
|
70
|
+
"@aws-cdk/aws-s3tables:bucketDefaultPolicyName": true,
|
|
71
|
+
"@aws-cdk/aws-ec2:routeTableUniqueId": true,
|
|
72
|
+
"@aws-cdk/aws-eventschemas:targetedReferencePolicy": true,
|
|
73
|
+
"@aws-cdk/aws-opensearchservice:enableDomainEndpointV2": true,
|
|
74
|
+
"@aws-cdk/aws-redshift:useLaunchTemplateForCluster": true,
|
|
75
|
+
"@aws-cdk/aws-rds:setCorrectValueForDatabaseInstanceReadReplicaInstanceResourceId": true,
|
|
76
|
+
"@aws-cdk/aws-stepfunctions-tasks:fixRunEcsTaskPolicy": true,
|
|
77
|
+
"@aws-cdk/aws-ecs:removeDefaultDenyPolicyInEcsTaskDefinitionExecutionRole": true,
|
|
78
|
+
"@aws-cdk/aws-route53-targets:albDualstackWithoutPublicIpv4SecurityPolicyDefault": true,
|
|
79
|
+
"@aws-cdk/aws-codepipeline-actions:deploymentApprovalStageTimeDefault": true,
|
|
80
|
+
"@aws-cdk/aws-codepipeline-actions:usePipelineRoleForActions": true
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { EnvironmentConfig } from './types';
|
|
2
|
+
|
|
3
|
+
const account = '389422718771';
|
|
4
|
+
|
|
5
|
+
export const environments: Record<string, EnvironmentConfig> = {
|
|
6
|
+
production: {
|
|
7
|
+
name: 'production',
|
|
8
|
+
account,
|
|
9
|
+
region: 'sa-east-1',
|
|
10
|
+
baseDomain: 'rcmsuite.io',
|
|
11
|
+
hostedZoneId: 'Z02457401HAGJIC87FP40',
|
|
12
|
+
hostedZoneName: 'rcmsuite.io',
|
|
13
|
+
frontend: {
|
|
14
|
+
recordName: 'design-system',
|
|
15
|
+
certificateDomainName: 'design-system.rcmsuite.io',
|
|
16
|
+
bucketName: `design-system-frontend-${account}`,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface EnvironmentConfig {
|
|
2
|
+
name: string;
|
|
3
|
+
account: string;
|
|
4
|
+
region: string;
|
|
5
|
+
baseDomain: string;
|
|
6
|
+
hostedZoneId: string;
|
|
7
|
+
hostedZoneName: string;
|
|
8
|
+
frontend: {
|
|
9
|
+
recordName: string;
|
|
10
|
+
certificateDomainName: string;
|
|
11
|
+
bucketName: string;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as cdk from 'aws-cdk-lib';
|
|
2
|
+
import * as acm from 'aws-cdk-lib/aws-certificatemanager';
|
|
3
|
+
import * as route53 from 'aws-cdk-lib/aws-route53';
|
|
4
|
+
import { Construct } from 'constructs';
|
|
5
|
+
|
|
6
|
+
interface CertificateStackProps extends cdk.StackProps {
|
|
7
|
+
hostedZoneId: string;
|
|
8
|
+
hostedZoneName: string;
|
|
9
|
+
certificateDomainName: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export class CertificateStack extends cdk.Stack {
|
|
13
|
+
public readonly certificate: acm.Certificate;
|
|
14
|
+
|
|
15
|
+
constructor(scope: Construct, id: string, props: CertificateStackProps) {
|
|
16
|
+
super(scope, id, props);
|
|
17
|
+
|
|
18
|
+
const hostedZone = route53.HostedZone.fromHostedZoneAttributes(this, 'HostedZone', {
|
|
19
|
+
hostedZoneId: props.hostedZoneId,
|
|
20
|
+
zoneName: props.hostedZoneName,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
this.certificate = new acm.Certificate(this, 'Certificate', {
|
|
24
|
+
domainName: props.certificateDomainName,
|
|
25
|
+
validation: acm.CertificateValidation.fromDns(hostedZone),
|
|
26
|
+
certificateName: 'design-system-frontend',
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
new cdk.CfnOutput(this, 'CertificateArn', {
|
|
30
|
+
value: this.certificate.certificateArn,
|
|
31
|
+
exportName: 'design-system-certificate-arn',
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|