eehitus-data-correction-ui 1.1.4 → 1.1.5

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.
Files changed (2) hide show
  1. package/README.md +172 -6
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,12 +1,178 @@
1
- ### 1. Paigaldamine
1
+ # eehitus-data-correction-ui library
2
2
 
3
- yarn install
3
+ E-Ehitus data correction UI is the library used for data correction views inside eehitus-ui.
4
4
 
5
- ### 2. Käivitamine
5
+ ---
6
6
 
7
- yarn start
7
+ ## Table of Contents
8
8
 
9
- ### 3. Testimine
9
+ * [Getting started with development](#getting-started-with-development)
10
+ * [Prerequisites](#prerequisites)
11
+ * [Running locally](#running-locally)
12
+ * [Local development](#local-development)
13
+ * [Development patterns overview](#development-patterns-overview)
14
+ * [Common components](#common-components)
15
+ * [Form validation](#form-validation)
16
+ * [Translations](#translations)
17
+ * [API requests](#api-requests)
18
+ * [Testing](#testing)
19
+ * [Debugging with source-maps](#debugging-with-source-maps)
20
+ * [Branching](#branching)
10
21
 
11
- yarn test
22
+ ---
23
+
24
+ ## Getting started with development
25
+
26
+ ### Prerequisites
27
+
28
+ - Node.js (v18.20.6)
29
+ - Yarn (v1.x)
30
+
31
+ * Recommendation:
32
+ * [Node version manager](https://github.com/nvm-sh/nvm)
33
+ * [Node version manager for Windows](https://github.com/coreybutler/nvm-windows)
34
+
35
+ ### Running locally
36
+
37
+ * `npm i yarn -g` - If you don't have yarn installed locally for given node version
38
+ * `yarn install`
39
+ * `yarn start`
40
+
41
+ ### Local development
42
+
43
+ `yarn start` opens `http://localhost:3000`
44
+
45
+ You have to look for BrowserRouter definition to find the urls you can navigate to.
46
+ Usually can be found at `./src/App.tsx` or in the component rendered inside it.
47
+
48
+ * `./public/config.js` contains all the endpoint URL-s for different microservices.
49
+ * Default endpoint should end with `/v1`
50
+ * You can specify a certain API to point to your projects API `/project_ingress`
51
+
52
+ ---
53
+
54
+ ## Development patterns overview
55
+
56
+ ---
57
+
58
+ ### Common components
59
+ * [eehitus-ui-extras](https://git.ehr.ee/ehr/ehr-k8s-pipeline/ui-extras)
60
+ * New common business logic components or enums, should be added to this library
61
+ * [TEDI library](https://github.com/TEHIK-EE/tedi-design-system) - E-Ehitus is moving to use Estonian TEDI library for react.
62
+ * New features should be developed using them, if possible.
63
+ * [ehr-components](https://git.ehr.ee/ehr/ehr-k8s-pipeline/ehr-components) Old components
64
+ * These are old components and you should not create new functionality with them if possible.
65
+ * [eehitus-visuaal](https://git.ehr.ee/ehr/ehr-k8s-pipeline/e-ehitus_visuaal) eehitus-ui has usage of global styles
66
+ * When making changes there, make sure your change does not have impact to the rest of the UI libraries
67
+ ---
68
+
69
+ ### Form validation
70
+
71
+ For form validation we use [Yup](https://www.npmjs.com/package/yup).
72
+
73
+ If you have not used it before look find examples used in eehitus-document-ui.
74
+
75
+ For an Example find usage of: `useYupValidation`
76
+
77
+ ---
78
+
79
+ ### Translations
80
+
81
+ All the translations exist in `./src/translations`
82
+
83
+ Webpack at build time merges all the translations into 3 specific files:
84
+ * example_project_name_et.json
85
+ * example_project_name_en.json
86
+ * example_project_name_ru.json
87
+
88
+ To add new translation files under `./src/translations`
89
+
90
+ Follow that the file ends with `*_et.json` pattern
91
+
92
+ ---
93
+
94
+ ### API requests
95
+
96
+ We use axios and we generate the entire API interface for all service requests using OpenApi Generator.
97
+
98
+ The API clients are located in `./src/services`
99
+
100
+ #### Generating API with OpenApi Generator
101
+
102
+ openapi-generator version = 6.6.0
103
+
104
+ version 6 is required for axios 0.x
105
+ ```cmd
106
+ $ npm install -g @openapitools/openapi-generator-cli
107
+ ```
108
+ ```cmd
109
+ $ openapi-generator-cli version-manager set 6
110
+ ```
111
+ If backend is running and openapi doc is accessible (change the port to your matching BE running port)
112
+ ```cmd
113
+ $ openapi-generator-cli generate -i http://localhost:9000/v3/api-docs -g typescript-axios --additional-properties=modelPropertyNaming=original --type-mappings=DateTime=Date --type-mappings=object=any
114
+ ```
115
+ If you need to update service clients with master yaml
116
+ * Find the yaml in [Gitlab swagger project](https://git.ehr.ee/ehr/ehr-k8s-pipeline/swaggerui/-/tree/master/src/swaggers?ref_type=heads) and download it
117
+ * Create a new folder
118
+ * Open terminal in the same folder with the yaml
119
+ ```cmd
120
+ $ openapi-generator-cli generate -i rename-this-to-your-file.yaml -g typescript-axios --additional-properties=modelPropertyNaming=original --type-mappings=DateTime=Date --type-mappings=object=any
121
+ ```
122
+ * Copy the .ts files into your projects `./src/services/you-api` folder
123
+
124
+
125
+ ---
126
+
127
+ ### Testing
128
+
129
+ For library unit testing we use Jest.
130
+
131
+ [E2E Tests](https://git.ehr.ee/ehr/ehr-k8s-pipeline/ehr-e2e) are located in this project.
132
+
133
+ ---
134
+
135
+ ### Debugging with source-maps
136
+
137
+ If you have developed locally and when you update the library version in eehitus-ui project and start receiving errors,
138
+ it's wise to generate local build using `yarn cibuild:debug`
139
+
140
+ This generates `./dist` folder
141
+
142
+ Then go into `eehitus-ui` project
143
+ * Remove .cache `eehitus-ui/node_modules/.cache`
144
+ * Remove old dist `eehitus-ui/node_modules/eehitus-*project_name*/dist`
145
+ * Copy your project local debug build dist folder to `eehitus-ui/node_modules/eehitus-*project_name*`
146
+ * Start `eehitus-ui` using `yarn start` now the error should have source-maps and debugging it, should be easier.
147
+
148
+ ---
149
+
150
+ ### Branching
151
+
152
+ For developing we use `Git Flow` branching pattern
153
+
154
+ Example branch names
155
+ * release/project_name
156
+ * fix/TICKET_NR-short-description
157
+ * feature/TICKET_NR-short-description
158
+ * company_name/feature/TICKET_NR-short-description
159
+
160
+ We don't recommend creating `develop` branch.
161
+
162
+ Good approach is to create a `release/*` branch and all new development in `company_name/feature/*` you create a Merge Request against `release/*`
163
+
164
+ You create tags on the `release/*` branch and you have a separate `project namespace` in rancher where you update `eehitus-ui`
165
+
166
+ ---
167
+
168
+ ### Publishing
169
+
170
+ To get new version of the library up.
171
+
172
+ 1. Go to [Gitlab](https://git.ehr.ee/)
173
+ 2. Find your project and go to tags page [document-ui as example](https://git.ehr.ee/ehr/ehr-k8s-pipeline/ehr-document-ui/-/tags)
174
+ 3. Create a New tag, specify version in semver pattern `version-*.*.*` add a description of project tag or other description
175
+ 4. Update your projects `eehitus-ui/package.json` version and run `yarn` to generate new `yarn.lock` file and commit it
176
+ 5. Create a New tag for `eehitus-ui`
177
+ 6. Update the `eehitus-ui` in rancher project_namespace, you should never update the `v1` ingress `eehitus-ui`. `v1` represents master and should always be in stable state.
12
178
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eehitus-data-correction-ui",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "license": "ISC",
5
5
  "private": false,
6
6
  "main": "./dist/index.cjs.js",