@@ -7,26 +7,28 @@ Mov.ai's library to expose Code Editors
7
7
# Table of Content
8
8
9
9
<!-- TOC -->
10
- * [ Mov.ai library for code editor] ( #movai-library-for-code-editor )
11
- * [ Table of Content] ( #table-of-content )
12
- * [ Setting Up Your Development Environment] ( #setting-up-your-development-environment )
13
- * [ Common Configuration] ( #common-configuration )
14
- * [ Configure ~ /.npmrc] ( #configure-npmrc )
15
- * [ Using a DevContainer (recommended)] ( #using-a-devcontainer-recommended )
16
- * [ Using a Local Setup] ( #using-a-local-setup )
17
- * [ Tools Required] ( #tools-required )
18
- * [ Install Node with NVM] ( #install-node-with-nvm )
19
- * [ Install PNPM] ( #install-pnpm )
20
- * [ Using a DevContainer Setup] ( #using-a-devcontainer-setup )
21
- * [ Tools Required] ( #tools-required-1 )
22
- * [ Development] ( #development )
23
- * [ How to install this library to an app] ( #how-to-install-this-library-to-an-app )
24
- * [ How to Link this library locally to an App] ( #how-to-link-this-library-locally-to-an-app )
25
- <!-- TOC -->
10
+
11
+ - [ Mov.ai library for code editor] ( #movai-library-for-code-editor )
12
+ - [ Table of Content] ( #table-of-content )
13
+ - [ Setting Up Your Development Environment] ( #setting-up-your-development-environment )
14
+ - [ Common Configuration] ( #common-configuration )
15
+ - [ Configure ~ /.npmrc] ( #configure-npmrc )
16
+ - [ Using a DevContainer (recommended)] ( #using-a-devcontainer-recommended )
17
+ - [ Using a Local Setup] ( #using-a-local-setup )
18
+ - [ Tools Required] ( #tools-required )
19
+ - [ Install Node with NVM] ( #install-node-with-nvm )
20
+ - [ Install PNPM] ( #install-pnpm )
21
+ - [ Using a DevContainer Setup] ( #using-a-devcontainer-setup )
22
+ - [ Tools Required] ( #tools-required-1 )
23
+ - [ Development] ( #development )
24
+ - [ How to install this library to an app] ( #how-to-install-this-library-to-an-app )
25
+ - [ How to Link this library locally to an App] ( #how-to-link-this-library-locally-to-an-app )
26
+ <!-- TOC -->
26
27
27
28
# Setting Up Your Development Environment
28
29
29
30
You can set up your development environment in two ways:
31
+
30
32
- In a DevContainer (recommended)
31
33
- Locally
32
34
@@ -71,58 +73,61 @@ To install Node.js using `nvm` (Node Version Manager), follow these steps:
71
73
72
74
Open your terminal and run the following command to install ` nvm ` :
73
75
74
- ``` bash
75
- curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.4/install.sh | bash
76
- ```
76
+ ``` bash
77
+ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.4/install.sh | bash
78
+ ```
77
79
78
80
2 . ** Load ` nvm ` :**
79
81
80
82
After installing ` nvm ` , you need to load it. Close and reopen your terminal, or run:
81
83
82
- ` ` ` bash
83
- source ~ /.nvm/nvm.sh
84
- ` ` `
84
+ ``` bash
85
+ source ~ /.nvm/nvm.sh
86
+ ```
85
87
86
88
3 . ** Install the required Node.js version:**
87
89
88
90
With ` nvm ` installed and loaded, run the following command to use the required Node.js version:
89
91
90
- ` ` ` bash
91
- nvm install && nvm use # uses the node version specify in the .nvmrc file
92
- ` ` `
92
+ ``` bash
93
+ nvm install && nvm use # uses the node version specify in the .nvmrc file
94
+ ```
93
95
94
96
4 . ** Set the used Node.js as the default version:**
95
97
96
- ` ` ` bash
97
- nvm current # prints the node.js version being used
98
- nvm alias default xx.xx.x # sets xx.xx.x as default
99
- ` ` `
98
+ ``` bash
99
+ nvm current # prints the node.js version being used
100
+ nvm alias default xx.xx.x # sets xx.xx.x as default
101
+ ```
100
102
101
103
5 . ** Verify the installation:**
102
104
103
- ` ` ` bash
104
- node -v
105
- ` ` `
105
+ ``` bash
106
+ node -v
107
+ ```
106
108
107
109
This should output the node version specified in ` .nvmrc ` file.
108
110
109
-
110
111
#### Install PNPM
111
112
112
113
To install ` pnpm ` , follow these steps:
113
114
114
115
1 . Using the required pnpm version:
115
116
116
117
The pnpm version required is specify in the ` package.json ` file as:
117
- ` ` ` json
118
- {
119
- " packageManager" : " [email protected] "
120
- }
121
- ` ` `
118
+
119
+ ``` json
120
+ {
121
+ "packageManager" :
" [email protected] "
122
+ }
123
+ ```
124
+
122
125
In order to have Node.js use the specified version, run:
123
- ` ` ` bash
126
+
127
+ ``` bash
124
128
corepack enable
125
- ` ` `
129
+ ```
130
+
126
131
Upon first use, Corepack downloads the latest version from the network and uses it when running pnpm commands.
127
132
128
133
### Using a DevContainer Setup
@@ -138,9 +143,10 @@ To install `pnpm`, follow these steps:
138
143
## How to install this library to an app
139
144
140
145
1 . - Install package:
141
- ` ` ` bash
142
- " pnpm install @mov-ai/mov-fe-lib-code-editor"
143
- ` ` `
146
+
147
+ ``` bash
148
+ " pnpm install @mov-ai/mov-fe-lib-code-editor"
149
+ ```
144
150
145
151
## How to Link this library locally to an App
146
152
@@ -149,26 +155,33 @@ Here's how it can be done:
149
155
150
156
1 . In the app, identify this library in the ` package.json ` :
151
157
152
- ` ` `
153
- " @mov-ai/mov-fe-lib-code-editor" : " ^x.x.x-X" ,
154
- ` ` `
158
+ ```
159
+ "@mov-ai/mov-fe-lib-code-editor": "^x.x.x-X",
160
+ ```
155
161
156
162
2 . Replace the library version with the path of this local library:
157
163
158
- ` ` `
164
+ ```
159
165
"@mov-ai/mov-fe-lib-code-editor": "file:/home/username/path/to/library/frontend-npm-lib-code-editor"
160
- ` ` `
166
+ ```
161
167
162
168
3 . Build this local library:
163
169
164
- ` ` ` bash
170
+ ``` bash
165
171
pnpm install # installs dependencies
166
172
pnpm buildDev # builds the app and watches for changes
167
- ` ` `
173
+ ```
168
174
169
175
4 . Install and build the app:
170
176
171
- ` ` ` bash
177
+ ``` bash
172
178
pnpm install # installs dependencies including the local library
173
179
pnpm start # runs the app
174
- ` ` `
180
+ ```
181
+
182
+ ## How to setup linting git hook
183
+
184
+ 1 . Install husky git hook:
185
+ ``` bash
186
+ " pnpm prepare"
187
+ ```
0 commit comments