Skip to content

Commit d55eef9

Browse files
authored
Merge pull request #151 from marklogic-community/release/3.6.0
Merge 3.6.0 changes into master.
2 parents 84a1f87 + d460b5b commit d55eef9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+158736
-113768
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,8 @@ server/node_modules
55
*.vsix
66
dist
77
.DS_Store
8+
.vscode/settings.json
89
.vscode-test
10+
.gradle
11+
gradle-local.properties
12+
results/

.vscode/launch.json

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"type": "node",
88
"request": "attach",
99
"port": 6004,
10-
"protocol": "inspector",
1110
"sourceMaps": true,
1211
"outFiles": [
1312
"${workspaceRoot}/server/**/*.js"
@@ -53,7 +52,22 @@
5352
"--extensionDevelopmentPath=${workspaceFolder}/client",
5453
"--extensionTestsPath=${workspaceRoot}/dist/test/suite/index"
5554
],
56-
"stopOnEntry": false,
55+
"sourceMaps": true,
56+
"outFiles": [
57+
"${workspaceRoot}/dist/**/*.js"
58+
],
59+
"preLaunchTask": "npm: pretest",
60+
"cwd": "${workspaceFolder}"
61+
},
62+
{
63+
"name": "Launch Client-Integration Tests",
64+
"type": "extensionHost",
65+
"request": "launch",
66+
"runtimeExecutable": "${execPath}",
67+
"args": [
68+
"--extensionDevelopmentPath=${workspaceFolder}",
69+
"--extensionTestsPath=${workspaceRoot}/dist/test/integration/index"
70+
],
5771
"sourceMaps": true,
5872
"outFiles": [
5973
"${workspaceRoot}/dist/**/*.js"
@@ -70,10 +84,9 @@
7084
"--extensionDevelopmentPath=${workspaceRoot}/server",
7185
"--extensionTestsPath=${workspaceRoot}/server/dist/test/suite/index"
7286
],
73-
"stopOnEntry": false,
7487
"sourceMaps": true,
7588
"outFiles": [
76-
"${workspaceRoot}/server/out/test/**/*.js"
89+
"${workspaceRoot}/server/dist/test/**/*.js"
7790
],
7891
"preLaunchTask": "npm: pretest-server",
7992
"cwd": "${workspaceFolder}/server"
@@ -87,7 +100,6 @@
87100
"--extensionDevelopmentPath=${workspaceFolder}/client",
88101
"--extensionTestsPath=${workspaceRoot}/dist/test/integration/index"
89102
],
90-
"stopOnEntry": false,
91103
"sourceMaps": true,
92104
"outFiles": [
93105
"${workspaceRoot}/dist/**/*.js"
@@ -140,4 +152,4 @@
140152
]
141153
}
142154
]
143-
}
155+
}

.vscode/settings.json renamed to .vscode/setting.json.template

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
},
99
"editor.formatOnSave": true,
1010
"[typescript]": {
11-
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
12-
}
13-
}
11+
"editor.defaultFormatter": "vscode.typescript-language-features"
12+
},
13+
"marklogic.host": "localhost",
14+
"marklogic.username": "admin",
15+
"marklogic.password": "XXXX",
16+
"marklogic.port": 8055,
17+
"marklogic.documentsDb": "mlxprs-test-content",
18+
"marklogic.modulesDb": "mlxprs-test-modules",
19+
}

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
## [3.6.0](https://github.com/marklogic-community/mlxprs/releases/tag/v3.6.0)
2+
3+
- [#116](https://github.com/marklogic-community/mlxprs/issues/116) Updated dependencies and fixed all known security vulnerabilities
4+
- [#119](https://github.com/marklogic-community/mlxprs/issues/119) Added SJS binding to JavaScript language
5+
- [#97](https://github.com/marklogic-community/mlxprs/issues/97) Added a configuration option for the MarkLogic Manage app server port (used for the SJS debug server port)
6+
- [#117](https://github.com/marklogic-community/mlxprs/issues/117) Fixed a bug with the first attempt to eval a JavaScript tab
7+
- [#109](https://github.com/marklogic-community/mlxprs/issues/109) Prevent the database param from being used in REST calls when the database setting is empty
8+
9+
110
## [3.5.1](https://github.com/mikrovvelle/mlxprs/tree/v3.5.1)
211

312
- Fix [#92](https://github.com/mikrovvelle/mlxprs/issues/92), better error handling with XQuery debug launch failures

CONTRIBUTING.md

Lines changed: 139 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ _This project and its code and functionality are not representative of MarkLogic
66

77
## Found a bug or issue?
88

9-
If you find a problem, or want to request something that’s lacking, please [file an issue](https://github.com/mikrovvelle/mlxprs/issues/new). Make sure to specify which version of the extension you’re using as well as the version of MarkLogic you’re working against.
9+
If you find a problem, or want to request something that’s lacking, please [file an issue](https://github.com/marklogic-community/mlxprs/issues/new). Make sure to specify which version of the extension you’re using as well as the version of MarkLogic you’re working against.
1010

1111
Even better, you can submit a Pull Request with a fix for the issue you filed.
1212

1313
If you would like to implement a new feature, please create a new issue with your proposal.
1414

15-
### Submitting an Issue
15+
## Submitting an Issue
1616

1717
Please check the issue tracker before you submit an issue search, to help avoid duplicates. If your issue appears to be a bug, and hasn't been reported, open a new issue.
1818

@@ -25,21 +25,153 @@ The following information is most helpful:
2525
* **Pointers** — If you have a hunch or just don't want to bother with a pull request,
2626
please point me in the right direction (e.g. line numbers) to fix it.
2727

28-
### Submitting a Pull Request
28+
# Development
29+
30+
## Project Layout
31+
32+
* **package.json** — Metadata about the project, including details for the extensions browser, dependencies, build scripts, commands and user configuration
33+
* **client** — Main extension folder
34+
* **extension.ts** — Code insertion point. Contains initialization code and defines commands callable by user.
35+
* **marklogicClient.ts** — Interface to MarkLogic [Node Client API](https://github.com/marklogic/node-client-api) package, which is used to communicate with ML Server.
36+
* **marklogic-types.d.ts** — TypeScript type declarations used by the package.
37+
* **server** — Language server extension folder (provides syntax highlighting; based on vscode-languageserver extension)
38+
* **package.json** — As the language server is technically a separate package, this defines the dependencies for it
39+
* **server.ts** — Code insertion point. Contains initialization code for language server.
40+
41+
* Another important file is .vscode/settings.json. It is recommended that you use settings.json.template to create settings.json, and then customize settings.json to your local environment. Alternatively, these values can also be changed within VSCode when you change settings for this specific workspace.
42+
43+
## Building The Project
44+
45+
It is recommended to use VSCode as the editor for this package, as it can self-load a debug instance.
46+
47+
* Open the project folder in VSCode
48+
* Select the "Run and Debug" sidebar window (Ctrl+Shift+D)
49+
* Choose "Launch Extension (debug)" from the RUN AND DEBUG dropdown menu
50+
* Press the green play button or F5 to compile and launch the plugin in a test environment
51+
* Please see the README.md file for information on configuring and working in the test environment
52+
53+
Building the project requires [Node.js](https://nodejs.org/) to be installed on your local machine. Node v14 LTS is recommended.
54+
55+
First, dev dependencies must be installed. Run `npm install` in both this folder, and in the `./server` folder. For example:
56+
57+
```
58+
npm install
59+
cd server
60+
npm install
61+
cd ..
62+
```
63+
A shorthand script that does all of that for you is
64+
```
65+
npm run npmInstallClientAndServer
66+
```
67+
68+
## Testing
69+
70+
The project contains three test applications.
71+
72+
* Client Tests - Runs the test files under /client/test/suite, transpiled to /dist/test/suite
73+
* client.test.js
74+
* xqyRuntime.test.js
75+
* Server Tests - Runs the test files under /server/test/suite, transpiled to /server/dist/test/suite
76+
* server.test.js
77+
* Client-Integration Tests - Runs the test files under /client/test/integration, transpiled to /dist/test/integration
78+
* Requires ML App Server setup first (See "Integration Testing Setup" below for more information)
79+
* sjsAdapter.test.js
80+
81+
82+
### Integration Testing Setup
83+
84+
JavaScript debugger integration testing requires a running MarkLogic server where you have full admin rights. Ideally, you should use a dedicated MarkLogic instance for this purpose. The tests assume the existence of a "mlxprs-test" application server running on port 8055 using the "mlxprs-test-content" and "mlxprs-test-modules" databases. Those values are set in gradle.properties and the admin password should be set in gradle-local.properties. Then you can use the command, "./gradlew -i mlDeploy" to build and configure the databases and application servers.
85+
86+
### Integration Test Overview
87+
The integration test will do the following:
88+
* Upload test scripts and modules to `Modules` database
89+
* Run tests against the uploaded scripts and MarkLogic application server, simulating JS debugger interactions
90+
* Delete scripts from `Modules` databse
91+
* Results are currently written to "results/integrationTestResults.xml".
92+
93+
### Testing from within VSCode
94+
Within VSCode, unit tests are available from the dropdown menu in the Run and Debug panel. There are currently three run configurations for three test sets in launch.json
95+
96+
* "Launch Client Tests"
97+
* "Launch Server Tests"
98+
* "Launch Client-Integration Tests"
99+
100+
101+
For the Client-Integration test, the code (test code only) defaults to the same settings as the default values in the gradle.properties file. If you need to override the default properties, you have 3 options.
102+
1. Edit the values the integration.env file (in ${workspaceFolder}/client/test/integration), and add the following property to the launch configuration for Client-Integration:
103+
```
104+
"envFile": "${workspaceFolder}/client/test/integration/integration.env"`
105+
```
106+
2. Export environment variables with the same names as the examples in integration.env. For example in a bash shell:
107+
```
108+
export ML_PASSWORD=admin
109+
```
110+
3. If you are running the tests from within VSCode, you can package and load the MarkLogic extension, and set the values on the extension settings page. If you need to build the artifact so that you can load the version of the extension you are working on, please see the "Building the artifact" section below.
111+
112+
Note that the order of priority for setting the property values in the test code is the following
113+
1. Environment variables
114+
2. Extension settings
115+
3. Default values (hard-coded, but matches gradle.properties)
116+
117+
118+
### Testing from the command line
119+
Run these two npm scripts from the command line in the root directory of the project to execute the tests. Note that VSCode must not be running while you run the tests.
120+
```
121+
npm run npmInstallClientAndServer
122+
npm run test
123+
npm run testServer
124+
code --extensionDevelopmentPath=<mlxprs-project-dir>/client --extensionTestsPath=<mlxprs-project-dir>/dist/test/integration/index
125+
```
126+
<mark>The final test (the integration tests), should not be run while VSCode is open.</mark>
127+
128+
To ensure a clean build, you may also run this npm script before running the npmInstallClientAndServer script.
129+
```
130+
npm run completeClean
131+
```
132+
133+
## Building the artifact
134+
135+
- Install the vsce tool
136+
```
137+
npm install -g @vscode/vsce
138+
```
139+
- Build the artifact
140+
```
141+
vsce package
142+
```
143+
- If you are running in a Windows environment, you will need to use npx:
144+
```
145+
npx vsce package
146+
```
147+
This should produce a file with the name, "mlxprs-<version>.vsix"
148+
149+
### Windows environment - IMPORTANT NOTE
150+
The same NPM scripts should work in Windows, however this is not thoroughly verified. In order to run all the scripts from package.json in a Windows environment, it is recommended that you install the 'rimraf', 'typescript', and 'webpack' node packages globally.
151+
```
152+
npm install -g rimraf
153+
npm install -g typescript
154+
npm install -g webpack
155+
```
156+
157+
## Submitting a Pull Request
29158

30159
Please refer to [Github's documentation on the matter](https://help.github.com/articles/creating-a-pull-request/).
31160

32-
#### Formatting code
161+
## Formatting code
33162

34163
Project coding standards for formatting and styling are documented in `.editorconfig` and `.eslintrc.json`. Both of these tools offer VS Code extensions to automatically recommend and/or apply rules while editing:
35164

36165
- [editorconfig VS Code extension](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig)
37166
- [eslint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
38167

39-
### Notes on development environment
168+
## Notes on development environment
40169

41170
Please try to develop, build, and test with the most recent stable releases of the following components:
42171

43172
- Visual Studio Code
44-
- node.js, `npm`
45-
- MarkLogic 9 or 10
173+
- node.js, npm (v14 LTS)
174+
- MarkLogic 9, 10, or 11
175+
176+
## Publishing the artifact
177+
See [Publishing Extensions](https://code.visualstudio.com/api/working-with-extensions/publishing-extension) for more information

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
[![](https://vsmarketplacebadge.apphb.com/version/mlxprs.mlxprs.svg)](https://marketplace.visualstudio.com/items?itemName=mlxprs.mlxprs)
2-
[![](https://vsmarketplacebadge.apphb.com/installs-short/mlxprs.mlxprs.svg)](https://marketplace.visualstudio.com/items?itemName=mlxprs.mlxprs)
3-
[![](https://vsmarketplacebadge.apphb.com/rating-short/mlxprs.mlxprs.svg)](https://marketplace.visualstudio.com/items?itemName=mlxprs.mlxprs)
1+
[![](https://vsmarketplacebadges.dev/version/mlxprs.mlxprs.png)](https://marketplace.visualstudio.com/items?itemName=mlxprs.mlxprs)
2+
[![](https://vsmarketplacebadges.dev/installs-short/mlxprs.mlxprs.png)](https://marketplace.visualstudio.com/items?itemName=mlxprs.mlxprs)
3+
[![](https://vsmarketplacebadges.dev/rating-short/mlxprs.mlxprs.png)](https://marketplace.visualstudio.com/items?itemName=mlxprs.mlxprs)
44

55
# MarkLogic Extension for Visual Studio Code
66

@@ -30,12 +30,14 @@ The MarkLogic extension exposes several configuration options from the standard
3030
{
3131
"marklogic.host": "marklogic-instance.geocities.com",
3232
"marklogic.port": 8040,
33+
"marklogic.managePort": 8002,
3334
"marklogic.username": "username",
3435
"marklogic.password": "****************",
3536
"marklogic.documentsDb": "myproject-content",
3637
"marklogic.modulesDb": "myproject-modules"
3738
}
3839
```
40+
Note that marklogic.documentsDb *must* be declared in order to attach to remote JavaScript request.
3941

4042
You can also set `marklogic.authType` to `DIGEST` or `BASIC`. Digest is the default,
4143
and works even if the server is running basic authentication.

build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Only used for setting up the test AppServer in MarkLogic
2+
plugins {
3+
id 'net.saliman.properties' version '1.5.2'
4+
id "com.marklogic.ml-gradle" version "4.5.0"
5+
}

0 commit comments

Comments
 (0)