Skip to content

Commit 5797492

Browse files
committed
Format all files using prettier
1 parent 5f4ca3d commit 5797492

13 files changed

+184
-180
lines changed

.devcontainer/devcontainer.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,10 @@
1919
},
2020
"postCreateCommand": "bash -i -c 'nvm install $(cat .nvmrc) -y && nvm use && corepack enable && pnpm clean && pnpm install'",
2121
"remoteUser": "node",
22-
"runArgs": [
23-
"--network=host"
24-
],
22+
"runArgs": ["--network=host"],
2523
"mounts": [
2624
"type=bind,src=${localEnv:HOME}/.npmrc,dst=/home/node/.npmrc",
2725
"type=bind,src=${localEnv:HOME}/.ssh,dst=/home/node/.ssh",
2826
"type=bind,src=${localEnv:HOME}/movai/src/feapps,dst=/workspaces/"
2927
]
30-
}
28+
}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ typings/
5252

5353
# Optional npm cache directory
5454
.npm
55+
.pnpm-store
5556

5657
# Optional eslint cache
5758
.eslintcache

.storybook/main.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module.exports = {
1111
resolve: {
1212
alias: {
1313
vscode: require.resolve(
14-
"@codingame/monaco-languageclient/lib/vscode-compatibility"
14+
"@codingame/monaco-languageclient/lib/vscode-compatibility",
1515
),
1616
},
1717
extensions: [".js", ".json", ".ttf"],
@@ -39,5 +39,5 @@ module.exports = {
3939
core: {
4040
builder: "webpack5",
4141
},
42-
addons: ['storybook-addon-mock/register'],
42+
addons: ["storybook-addon-mock/register"],
4343
};

.storybook/middleware.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ module.exports = function (router) {
2020
ws: true,
2121
logLevel: "error",
2222
secure: false,
23-
}
24-
)
23+
},
24+
),
2525
);
2626

2727
// to test language server locally
@@ -33,7 +33,7 @@ module.exports = function (router) {
3333
logLevel: "error",
3434
secure: false,
3535
changeOrigin: true,
36-
})
36+
}),
3737
);
3838

3939
// using movai-flow dev

README.md

+58-52
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,28 @@ Mov.ai's library to expose Code Editors
77
# Table of Content
88

99
<!-- 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 -->
2627

2728
# Setting Up Your Development Environment
2829

2930
You can set up your development environment in two ways:
31+
3032
- In a DevContainer (recommended)
3133
- Locally
3234

@@ -71,58 +73,61 @@ To install Node.js using `nvm` (Node Version Manager), follow these steps:
7173

7274
Open your terminal and run the following command to install `nvm`:
7375

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+
```
7779

7880
2. **Load `nvm`:**
7981

8082
After installing `nvm`, you need to load it. Close and reopen your terminal, or run:
8183

82-
```bash
83-
source ~/.nvm/nvm.sh
84-
```
84+
```bash
85+
source ~/.nvm/nvm.sh
86+
```
8587

8688
3. **Install the required Node.js version:**
8789

8890
With `nvm` installed and loaded, run the following command to use the required Node.js version:
8991

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+
```
9395

9496
4. **Set the used Node.js as the default version:**
9597

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+
```
100102

101103
5. **Verify the installation:**
102104

103-
```bash
104-
node -v
105-
```
105+
```bash
106+
node -v
107+
```
106108

107109
This should output the node version specified in `.nvmrc` file.
108110

109-
110111
#### Install PNPM
111112

112113
To install `pnpm`, follow these steps:
113114

114115
1. Using the required pnpm version:
115116

116117
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+
122125
In order to have Node.js use the specified version, run:
123-
```bash
126+
127+
```bash
124128
corepack enable
125-
```
129+
```
130+
126131
Upon first use, Corepack downloads the latest version from the network and uses it when running pnpm commands.
127132

128133
### Using a DevContainer Setup
@@ -138,9 +143,10 @@ To install `pnpm`, follow these steps:
138143
## How to install this library to an app
139144

140145
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+
```
144150

145151
## How to Link this library locally to an App
146152

@@ -149,26 +155,26 @@ Here's how it can be done:
149155

150156
1. In the app, identify this library in the `package.json`:
151157

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+
```
155161

156162
2. Replace the library version with the path of this local library:
157163

158-
```
164+
```
159165
"@mov-ai/mov-fe-lib-code-editor": "file:/home/username/path/to/library/frontend-npm-lib-code-editor"
160-
```
166+
```
161167

162168
3. Build this local library:
163169

164-
```bash
170+
```bash
165171
pnpm install # installs dependencies
166172
pnpm buildDev # builds the app and watches for changes
167-
```
173+
```
168174

169175
4. Install and build the app:
170176

171-
```bash
177+
```bash
172178
pnpm install # installs dependencies including the local library
173179
pnpm start # runs the app
174-
```
180+
```

babel.config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"presets": ["@babel/preset-react", "@babel/preset-env"],
33
"plugins": ["@babel/plugin-transform-react-jsx"]
4-
}
4+
}

jest.config.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ module.exports = {
33
"^.+\\.[tj]sx?$": "babel-jest",
44
},
55
transformIgnorePatterns: [
6-
"node_modules/(?!(@codingame/monaco-languageclient|vscode-languageserver-textdocument)/)"
6+
"node_modules/(?!(@codingame/monaco-languageclient|vscode-languageserver-textdocument)/)",
77
],
8-
testEnvironment: 'jsdom',
8+
testEnvironment: "jsdom",
99
moduleNameMapper: {
10-
'^monaco-editor$': '<rootDir>/src/__mocks__/monaco-editor.js', // Adjust as needed
10+
"^monaco-editor$": "<rootDir>/src/__mocks__/monaco-editor.js", // Adjust as needed
1111
},
1212
};
13-

src/__mocks__/monaco-editor.js

+7-8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
export const editor = {
2-
create: jest.fn(() => ({
3-
// Mocking the returned editor instance methods and properties
4-
getModel: jest.fn(),
5-
dispose: jest.fn(),
6-
// Add more methods as needed
7-
})),
8-
};
9-
2+
create: jest.fn(() => ({
3+
// Mocking the returned editor instance methods and properties
4+
getModel: jest.fn(),
5+
dispose: jest.fn(),
6+
// Add more methods as needed
7+
})),
8+
};

src/components/MonacoCodeEditor/MonacoCodeEditor.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ const MonacoCodeEditor = React.forwardRef((props, ref) => {
129129
if (saveAction) {
130130
const menuItems = MenuRegistry._menuItems;
131131
const contextMenuEntry = [...menuItems].find(
132-
(entry) => entry[0]._debugName == "EditorContext"
132+
(entry) => entry[0]._debugName == "EditorContext",
133133
);
134134
const contextMenuLinks = contextMenuEntry[1];
135135
removeAction(contextMenuLinks, saveAction.id);
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
1+
import * as monaco from "monaco-editor";
2+
import { renderHook } from "@testing-library/react-hooks";
3+
import useMonacoEditor from "./useMonacoEditor";
14

2-
import * as monaco from 'monaco-editor';
3-
import { renderHook } from '@testing-library/react-hooks';
4-
import useMonacoEditor from './useMonacoEditor';
5-
6-
describe('useMonacoEditor', () => {
5+
describe("useMonacoEditor", () => {
76
beforeEach(() => {
87
jest.clearAllMocks();
98
});
109

11-
it('should create editor with given props', () => {
10+
it("should create editor with given props", () => {
1211
const { result } = renderHook(() => useMonacoEditor());
1312
const props = {
14-
element: document.createElement('div'),
13+
element: document.createElement("div"),
1514
value: 'console.log("Hello, world!");',
16-
language: 'javascript',
17-
theme: 'vs-dark',
15+
language: "javascript",
16+
theme: "vs-dark",
1817
options: {},
19-
disableMinimap: false
18+
disableMinimap: false,
2019
};
2120

2221
result.current.createEditor(props);
@@ -25,28 +24,28 @@ describe('useMonacoEditor', () => {
2524
value: props.value,
2625
language: props.language,
2726
theme: props.theme,
28-
'semanticHighlighting.enabled': true,
27+
"semanticHighlighting.enabled": true,
2928
selectOnLineNumbers: true,
30-
autoIndent: 'full',
31-
lineNumbers: 'on',
29+
autoIndent: "full",
30+
lineNumbers: "on",
3231
overviewRulerBorder: true,
3332
overviewRulerLanes: 3,
3433
minimap: {
35-
enabled: true
34+
enabled: true,
3635
},
37-
...props.options
36+
...props.options,
3837
});
3938
});
4039

41-
it('should disable minimap and overview ruler when disableMinimap is true', () => {
40+
it("should disable minimap and overview ruler when disableMinimap is true", () => {
4241
const { result } = renderHook(() => useMonacoEditor());
4342
const props = {
44-
element: document.createElement('div'),
43+
element: document.createElement("div"),
4544
value: 'console.log("Hello, world!");',
46-
language: 'javascript',
47-
theme: 'vs-dark',
45+
language: "javascript",
46+
theme: "vs-dark",
4847
options: {},
49-
disableMinimap: true
48+
disableMinimap: true,
5049
};
5150

5251
result.current.createEditor(props);
@@ -55,16 +54,16 @@ describe('useMonacoEditor', () => {
5554
value: props.value,
5655
language: props.language,
5756
theme: props.theme,
58-
'semanticHighlighting.enabled': true,
57+
"semanticHighlighting.enabled": true,
5958
selectOnLineNumbers: true,
60-
autoIndent: 'full',
61-
lineNumbers: 'off',
59+
autoIndent: "full",
60+
lineNumbers: "off",
6261
overviewRulerBorder: false,
6362
overviewRulerLanes: 0,
6463
minimap: {
65-
enabled: false
64+
enabled: false,
6665
},
67-
...props.options
66+
...props.options,
6867
});
6968
});
7069
});

0 commit comments

Comments
 (0)