mirror of
https://github.com/s4u/maven-settings-action.git
synced 2026-02-13 00:05:25 +08:00
Compare commits
57 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e967605742 | |||
| e65dc96bde | |||
| b742fc533f | |||
| d1f8f65870 | |||
| de53ea431e | |||
| cd16d8406c | |||
| abf1253b29 | |||
| 7a5cb7ba33 | |||
| 7799be5210 | |||
| 82e778d8d7 | |||
| 175b85e48d | |||
| 40cb7c6ba4 | |||
| a154ae5bb3 | |||
| 26b06607c7 | |||
| 5391894326 | |||
| a9c25dcc48 | |||
| 6240d8dec2 | |||
| 0ae2055ed1 | |||
| eb98cf558d | |||
| df02243d71 | |||
| a2731cf297 | |||
| fe12eba098 | |||
| fa0be5f968 | |||
| 2a1bf9c27e | |||
| 060e4442b5 | |||
| 4309eaf1f7 | |||
| 530d13699b | |||
| 78af212661 | |||
| 6781626242 | |||
| c2d71a67ea | |||
| 25300b87d9 | |||
| 75f172be63 | |||
| 7e15ec568d | |||
| a8a028af57 | |||
| 2426826ebc | |||
| b1f588d74f | |||
| bfee59b12a | |||
| d016a0cc3c | |||
| fbff164add | |||
| 96e7617cbc | |||
| e970e3e5f9 | |||
| 07702512f4 | |||
| d07365e2cd | |||
| 7b2fa81b55 | |||
| 772d1cd04c | |||
| 3d63f86fbc | |||
| 54bf9b072d | |||
| bda41227d8 | |||
| 9c42cb38ac | |||
| b034b76077 | |||
| ed5f8cf141 | |||
| ae0dfdae9b | |||
| f033cb9cb6 | |||
| e7ad595eea | |||
| 4037eb19d4 | |||
| c5205056ba | |||
| cdd3549d27 |
40
.github/release-drafter.yml
vendored
Normal file
40
.github/release-drafter.yml
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
categories:
|
||||
|
||||
- title: 'New features'
|
||||
labels:
|
||||
- 'enhancement'
|
||||
|
||||
- title: 'Bug Fixes'
|
||||
labels:
|
||||
- 'bug'
|
||||
|
||||
- title: 'Maintenance'
|
||||
labels:
|
||||
- 'code quality'
|
||||
- 'documentation'
|
||||
|
||||
- title: 'Dependency updates'
|
||||
labels:
|
||||
- 'dependencies'
|
||||
|
||||
change-template: '- $TITLE #$NUMBER'
|
||||
|
||||
sort-direction: 'ascending'
|
||||
|
||||
template: |
|
||||
# What's Changed
|
||||
|
||||
$CHANGES
|
||||
|
||||
# Thanks
|
||||
Many thanks for collaboration on this release for: $CONTRIBUTORS
|
||||
|
||||
replacers:
|
||||
- search: '/(?:and )?@dependabot-preview(?:\[bot\])?,?/g'
|
||||
replace: ''
|
||||
|
||||
- search: '/(?:and )?@dependabot(?:\[bot\])?,?/g'
|
||||
replace: ''
|
||||
|
||||
- search: '/(?:and )?Github Action(?:\[bot\])?,?/g'
|
||||
replace: ''
|
||||
4
.github/workflows/audit.yml
vendored
4
.github/workflows/audit.yml
vendored
@ -17,9 +17,9 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.3
|
||||
- uses: actions/checkout@v2.3.4
|
||||
|
||||
- uses: actions/setup-node@v2.1.2
|
||||
- uses: actions/setup-node@v2.1.5
|
||||
with:
|
||||
node-version: '12.x'
|
||||
|
||||
|
||||
19
.github/workflows/release-drafter.yml
vendored
Normal file
19
.github/workflows/release-drafter.yml
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
name: Release Drafter
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
|
||||
jobs:
|
||||
update_release_draft:
|
||||
name: Update Release Draft
|
||||
runs-on: ubuntu-latest
|
||||
if: >
|
||||
github.repository_owner == 's4u'
|
||||
&& !startsWith(github.event.head_commit.message , '[maven-release-plugin]')
|
||||
|
||||
steps:
|
||||
- uses: release-drafter/release-drafter@v5.14.0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
@ -17,9 +17,9 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.3
|
||||
- uses: actions/checkout@v2.3.4
|
||||
|
||||
- uses: actions/setup-node@v2.1.2
|
||||
- uses: actions/setup-node@v2.1.5
|
||||
with:
|
||||
node-version: '12.x'
|
||||
|
||||
|
||||
132
README.md
132
README.md
@ -25,84 +25,176 @@ or use automatic tools like [Dependabot](https://dependabot.com/).
|
||||
# Usage
|
||||
See [action.yml](action.yml)
|
||||
|
||||
Create default ```settings.xml```:
|
||||
## default ```settings.xml```
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.2.0
|
||||
- uses: s4u/maven-settings-action@v2.4.0
|
||||
```
|
||||
|
||||
Create ```settings.xml``` with servers section:
|
||||
## ```settings.xml``` with servers section
|
||||
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.2.0
|
||||
- uses: s4u/maven-settings-action@v2.4.0
|
||||
with:
|
||||
servers: '[{"id": "serverId", "username": "username", "password": "password"}]'
|
||||
```
|
||||
|
||||
Create ```settings.xml``` with mirrors section:
|
||||
All `server` attributes may be specified:
|
||||
* `id` _(required)_
|
||||
* `username`
|
||||
* `password`
|
||||
* `privateKey`
|
||||
* `passphrase`
|
||||
* `filePermissions`
|
||||
* `directoryPermissions`
|
||||
* `configuration`
|
||||
|
||||
Please refer to the [servers](http://maven.apache.org/settings.html#Servers) documentation for more information.
|
||||
|
||||
## ```settings.xml``` with servers section and additional configuration
|
||||
|
||||
``` yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.4.0
|
||||
with:
|
||||
servers: |
|
||||
[{
|
||||
"id": "serverId",
|
||||
"configuration": {
|
||||
"item1": "value1",
|
||||
"item2": {
|
||||
"item21": "value21",
|
||||
"item22": "value22"
|
||||
}
|
||||
}
|
||||
}]
|
||||
```
|
||||
|
||||
result will be:
|
||||
|
||||
```xml
|
||||
<server>
|
||||
<id>serverId</id>
|
||||
<configuration>
|
||||
<item1>value1</item1>
|
||||
<item2>
|
||||
<item21>value21</item21>
|
||||
<item22>value22</item22>
|
||||
</item1>
|
||||
</configuration>
|
||||
</server></servers>
|
||||
```
|
||||
|
||||
|
||||
## ```settings.xml``` with mirrors section
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.2.0
|
||||
- uses: s4u/maven-settings-action@v2.4.0
|
||||
with:
|
||||
mirrors: '[{"id": "mirrorId", "name": "mirrorName", "mirrorOf": "mirrorOf", "url": "mirrorUrl"}]'
|
||||
```
|
||||
|
||||
Create ```settings.xml``` with maven properties:
|
||||
## ```settings.xml``` with properties
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.2.0
|
||||
- uses: s4u/maven-settings-action@v2.4.0
|
||||
with:
|
||||
properties: '[{"propertyName1": "propertyValue1"}, {"propertyName2": "propertyValue2"}]'
|
||||
```
|
||||
|
||||
Create ```settings.xml``` with https://oss.sonatype.org/content/repositories/snapshots in repository list
|
||||
## ```settings.xml``` with https://oss.sonatype.org/content/repositories/snapshots in repository list
|
||||
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.2.0
|
||||
- uses: s4u/maven-settings-action@v2.4.0
|
||||
with:
|
||||
sonatypeSnapshots: true
|
||||
```
|
||||
|
||||
Create ```settings.xml``` with https://repository.apache.org/snapshots/ in repository list
|
||||
## ```settings.xml``` with https://repository.apache.org/snapshots/ in repository list
|
||||
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.2.0
|
||||
- uses: s4u/maven-settings-action@v2.4.0
|
||||
with:
|
||||
apacheSnapshots: true
|
||||
```
|
||||
|
||||
Do not override existing ```settings.xml```, from version 2.0 file is override by default :
|
||||
## Do not override existing ```settings.xml```, from version **2.0** file is override by default :
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.2.0
|
||||
- uses: s4u/maven-settings-action@v2.4.0
|
||||
with:
|
||||
override: false
|
||||
```
|
||||
|
||||
Do not add github to server in ```settings.xml```, by default is added:
|
||||
## Do not add github to server in ```settings.xml```, by default is added:
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.2.0
|
||||
- uses: s4u/maven-settings-action@v2.4.0
|
||||
with:
|
||||
githubServer: false
|
||||
```
|
||||
|
||||
Create ```settings.xml``` with special server item configuration for oracle repository [Oracle Maven Repository](https://docs.oracle.com/middleware/1213/core/MAVEN/config_maven_repo.htm#MAVEN9015)
|
||||
## ```settings.xml``` with special server item configuration for oracle repository [Oracle Maven Repository](https://docs.oracle.com/middleware/1213/core/MAVEN/config_maven_repo.htm#MAVEN9015)
|
||||
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.2.0
|
||||
- uses: s4u/maven-settings-action@v2.4.0
|
||||
with:
|
||||
oracleServers: '[{"id": "serverId", "username": "username", "password": "password"}]'
|
||||
```
|
||||
|
||||
Create ```settings.xml``` with [Oracle Maven Repository](https://docs.oracle.com/middleware/1213/core/MAVEN/config_maven_repo.htm#MAVEN9017)
|
||||
## ```settings.xml``` with [Oracle Maven Repository](https://docs.oracle.com/middleware/1213/core/MAVEN/config_maven_repo.htm#MAVEN9017)
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.2.0
|
||||
- uses: s4u/maven-settings-action@v2.4.0
|
||||
with:
|
||||
oracleRepo: true
|
||||
```
|
||||
|
||||
## GitHub actions secrets
|
||||
|
||||
It is also possible pass in Github Secrets e.g.
|
||||
|
||||
``` yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.4.0
|
||||
with:
|
||||
servers: |
|
||||
[{
|
||||
"id": "sonatype-nexus-snapshots",
|
||||
"username": "${{ secrets.SONATYPE_USERNAME }}",
|
||||
"password": "${{ secrets.SONATYPE_PASSWORD }}"
|
||||
}]
|
||||
```
|
||||
|
||||
**Note**: secrets are *not* passed in if the workflow is triggered from a forked repository. See [here](https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets#using-encrypted-secrets-in-a-workflow) for further information. This can be avoided by using `if` triggers on the job e.g. `if: github.event_name == 'push'`.
|
||||
|
||||
# Notes
|
||||
|
||||
**maven-settings-action** should be put at the latest position before maven run in order to avoid override ```setting.xml``` by another action
|
||||
|
||||
```yml
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.m2/repository
|
||||
key: maven-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: maven-
|
||||
|
||||
- uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 8
|
||||
|
||||
- uses: s4u/maven-settings-action@v2.4.0
|
||||
|
||||
- run: mvn verify
|
||||
```
|
||||
|
||||
# License
|
||||
|
||||
The scripts and documentation in this project are released under the [MIT License](LICENSE)
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
name: 'maven-setings-action'
|
||||
name: 'maven-settings-action'
|
||||
description: 'Prepare maven settings.xml'
|
||||
|
||||
branding:
|
||||
@ -7,7 +7,7 @@ branding:
|
||||
|
||||
inputs:
|
||||
servers:
|
||||
description: 'servers definition in joson array, eg: [{"id": "serverId", "username": "username", "password": "password"}]'
|
||||
description: 'servers definition in json array, eg: [{"id": "serverId", "username": "username", "password": "password"}]'
|
||||
required: false
|
||||
mirrors:
|
||||
description: 'mirrors definition in json array, eg: [{"id": "id", "name": "name", "mirrorOf": "mirrorOf", "url": "url"}]'
|
||||
@ -32,7 +32,7 @@ inputs:
|
||||
default: "true"
|
||||
required: false
|
||||
oracleServers:
|
||||
description: 'servers definition in joson array, eg: [{"id": "serverId", "username": "username", "password": "password"}] for Oracle repository'
|
||||
description: 'servers definition in json array, eg: [{"id": "serverId", "username": "username", "password": "password"}] for Oracle repository'
|
||||
required: false
|
||||
oracleRepo:
|
||||
description: 'add Oracle Maven Repository'
|
||||
|
||||
@ -63,11 +63,11 @@ afterAll(() => {
|
||||
|
||||
test('run with all feature', () => {
|
||||
|
||||
process.env['INPUT_SERVERS'] = '[{"id": "serverId", "username": "sUsername", "password": "sPassword"}]';
|
||||
process.env['INPUT_ORACLESERVERS'] = '[{"id": "oServerId", "username": "oUsername", "password": "oPassword"}]';
|
||||
process.env['INPUT_GITHUBSERVER'] = true;
|
||||
process.env['INPUT_SERVERS'] = '[{"id": "serverId", "username": "sUsername", "password": "sPassword", "configuration": {"props1": "value1"}}]';
|
||||
process.env['INPUT_ORACLESERVERS'] = '[{"id": "oServerId", "username": "oUsername", "password": "oPassword"}]';
|
||||
process.env['INPUT_GITHUBSERVER'] = true;
|
||||
|
||||
process.env['INPUT_MIRRORS'] = '[{"id": "mirrorId", "name": "mirror Name", "mirrorOf": "mirror Off *", "url": "mirror url"}]';
|
||||
process.env['INPUT_MIRRORS'] = '[{"id": "mirrorId", "name": "mirror Name", "mirrorOf": "mirror Off *", "url": "mirror url"}]';
|
||||
process.env['INPUT_PROPERTIES'] = '[{"prop1": "value1"}, {"prop2": "value2"}]'
|
||||
|
||||
process.env['INPUT_APACHESNAPSHOTS'] = true;
|
||||
@ -80,7 +80,7 @@ test('run with all feature', () => {
|
||||
expect(settingsStatus.isFile()).toBeTruthy();
|
||||
expect(settingsStatus.size).toBeGreaterThan(0);
|
||||
|
||||
const settingsBody = fs.readFileSync(settingsPath).toString();
|
||||
const settingsBody = fs.readFileSync(settingsPath).toString().replace(/^\s*$(?:\r\n?|\n)/gm, '');
|
||||
expect(settingsBody).toBe(`<settings>
|
||||
<interactiveMode>false</interactiveMode>
|
||||
<profiles>
|
||||
@ -186,6 +186,7 @@ test('run with all feature', () => {
|
||||
<id>serverId</id>
|
||||
<username>sUsername</username>
|
||||
<password>sPassword</password>
|
||||
<configuration><props1>value1</props1></configuration>
|
||||
</server>
|
||||
<server>
|
||||
<id>oServerId</id>
|
||||
|
||||
21
node_modules/.package-lock.json
generated
vendored
Normal file
21
node_modules/.package-lock.json
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "maven-settings-action",
|
||||
"version": "2.4.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"node_modules/@actions/core": {
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz",
|
||||
"integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA=="
|
||||
},
|
||||
"node_modules/xmldom": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.4.0.tgz",
|
||||
"integrity": "sha512-2E93k08T30Ugs+34HBSTQLVtpi6mCddaY8uO+pMNk1pqSjV5vElzn4mmh6KLxN3hki8rNcHSYzILoh3TEWORvA==",
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
171
node_modules/xmldom/CHANGELOG.md
generated
vendored
171
node_modules/xmldom/CHANGELOG.md
generated
vendored
@ -1,82 +1,175 @@
|
||||
## 0.4.0
|
||||
|
||||
[Commits](https://github.com/xmldom/xmldom/compare/0.3.0...0.4.0)
|
||||
|
||||
### Fixes
|
||||
- **BREAKING** Restore ` ` behavior from v0.1.27 [`#67`](https://github.com/xmldom/xmldom/pull/67)
|
||||
- **BREAKING** Typecheck source param before parsing [`#113`](https://github.com/xmldom/xmldom/pull/113)
|
||||
- Include documents in package files list [`#156`](https://github.com/xmldom/xmldom/pull/156)
|
||||
- Preserve doctype with sysid [`#144`](https://github.com/xmldom/xmldom/pull/144)
|
||||
- Remove ES6 syntax from getElementsByClassName [`#91`](https://github.com/xmldom/xmldom/pull/91)
|
||||
- Revert "Add lowercase of åäö in entityMap" due to duplicate entries [`#84`](https://github.com/xmldom/xmldom/pull/84)
|
||||
- fix: Convert all line separators to LF [`#66`](https://github.com/xmldom/xmldom/pull/66)
|
||||
|
||||
### Docs
|
||||
- Update CHANGELOG.md through version 0.3.0 [`#63`](https://github.com/xmldom/xmldom/pull/63)
|
||||
- Update badges [`#78`](https://github.com/xmldom/xmldom/pull/78)
|
||||
- Add .editorconfig file [`#104`](https://github.com/xmldom/xmldom/pull/104)
|
||||
- Add note about import [`#79`](https://github.com/xmldom/xmldom/pull/79)
|
||||
- Modernize & improve the example in readme.md [`#81`](https://github.com/xmldom/xmldom/pull/81)
|
||||
|
||||
### CI
|
||||
- Add Stryker Mutator [`#70`](https://github.com/xmldom/xmldom/pull/70)
|
||||
- Add Stryker action to update dashboard [`#77`](https://github.com/xmldom/xmldom/pull/77)
|
||||
- Add Node GitHub action workflow [`#64`](https://github.com/xmldom/xmldom/pull/64)
|
||||
- add & enable eslint [`#106`](https://github.com/xmldom/xmldom/pull/106)
|
||||
- Use eslint-plugin-es5 to enforce ES5 syntax [`#107`](https://github.com/xmldom/xmldom/pull/107)
|
||||
- Recover `vows` tests, drop `proof` tests [`#59`](https://github.com/xmldom/xmldom/pull/59)
|
||||
- Add jest tessuite and first tests [`#114`](https://github.com/xmldom/xmldom/pull/114)
|
||||
- Add jest testsuite with `xmltest` cases [`#112`](https://github.com/xmldom/xmldom/pull/112)
|
||||
- Configure Renovate [`#108`](https://github.com/xmldom/xmldom/pull/108)
|
||||
- Test European HTML entities [`#86`](https://github.com/xmldom/xmldom/pull/86)
|
||||
- Updated devDependencies
|
||||
|
||||
### Other
|
||||
- Remove files that are not of any use [`#131`](https://github.com/xmldom/xmldom/pull/131), [`#65`](https://github.com/xmldom/xmldom/pull/65), [`#33`](https://github.com/xmldom/xmldom/pull/33)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
- Node >=10.x now required.
|
||||
- Added getElementsByClassName method.
|
||||
- Added Node to the list of exports
|
||||
- Added lowercase of åäö in entityMap.
|
||||
- Moved existing sources into `lib` subdirectory.
|
||||
- Removed `.npmignore` in favor of `files` entry in package.json.
|
||||
- More `package.json` refactoring.
|
||||
- Replaced CHANGELOG with more rigorous file.
|
||||
- Replaced LICENSE with more rigorous file.
|
||||
- Removed component.json (deprecated package manager https://github.com/componentjs/guide)
|
||||
- `proof` devDep updated to latest.
|
||||
- Fixed CI.
|
||||
- README updates.
|
||||
[Commits](https://github.com/xmldom/xmldom/compare/0.2.1...0.3.0)
|
||||
|
||||
- **BREAKING** Node >=10.x is now required.
|
||||
- **BREAKING** Remove `component.json` (deprecated package manager https://github.com/componentjs/guide)
|
||||
- **BREAKING** Move existing sources into `lib` subdirectory.
|
||||
- **POSSIBLY BREAKING** Introduce `files` entry in `package.json` and remove use of `.npmignore`.
|
||||
- [Add `Document.getElementsByClassName`](https://github.com/xmldom/xmldom/issues/24).
|
||||
- [Add `Node` to the list of exports](https://github.com/xmldom/xmldom/pull/27)
|
||||
- [Add lowercase of åäö in `entityMap`](https://github.com/xmldom/xmldom/pull/23).
|
||||
- Move CHANGELOG to markdown file.
|
||||
- Move LICENSE to markdown file.
|
||||
|
||||
## 0.2.1
|
||||
|
||||
- More package.json refactoring.
|
||||
[Commits](https://github.com/xmldom/xmldom/compare/0.2.0...0.2.1)
|
||||
|
||||
- Correct `homepage`, `repository` and `bugs` URLs in `package.json`.
|
||||
|
||||
## 0.2.0
|
||||
|
||||
- Now publishing under xmldom npm package again; retiring xmldom-alpha.
|
||||
- Remove coveralls.
|
||||
- Disable cache in travis.
|
||||
- Other refactoring.
|
||||
[Commits](https://github.com/xmldom/xmldom/compare/v0.1.27...0.2.0)
|
||||
|
||||
## 0.1.28 (via xmldom-alpha npm package)
|
||||
- Includes all **BREAKING** changes introduced in [`xmldom-alpha@v0.1.28`](#0128) by the original authors.
|
||||
- **POSSIBLY BREAKING** [remove the `Object.create` check from the `_extends` method of `dom.js` that added a `__proto__` property](https://github.com/xmldom/xmldom/commit/0be2ae910a8a22c9ec2cac042e04de4c04317d2a#diff-7d1c5d97786fdf9af5446a241d0b6d56L19-L22) ().
|
||||
- **POSSIBLY BREAKING** [remove code that added a `__proto__` property](https://github.com/xmldom/xmldom/commit/366159a76a181ce9a0d83f5dc48205686cfaf9cc)
|
||||
- formatting/corrections in `package.json`
|
||||
|
||||
- Removed __proto__ accessor.
|
||||
- Appended HTML entities defaults.
|
||||
## 0.1.31
|
||||
|
||||
## 0.1.27 (via xmldom-alpha npm package)
|
||||
[Commits](https://github.com/xmldom/xmldom/compare/v0.1.27...v0.1.31)
|
||||
|
||||
The patch versions (`v0.1.29` - `v0.1.31`) that have been released on the [v0.1.x branch](https://github.com/xmldom/xmldom/tree/0.1.x), to reflect the changed maintainers, **are branched off from [`v0.1.27`](#0127) so they don't include the breaking changes introduced in [`xmldom-alpha@v0.1.28`](#0128)**:
|
||||
|
||||
## Maintainer changes
|
||||
|
||||
After the last commit to the original repository <https://github.com/jindw/xmldom> on the 9th of May 2017, the first commit to <https://github.com/xmldom/xmldom> is from the 19th of December 2019. [The fork has been announced in the original repository on the 2nd of March 2020.](https://github.com/jindw/xmldom/issues/259)
|
||||
|
||||
The versions listed below have been published to one or both of the following packages:
|
||||
- <https://www.npmjs.com/package/xmldom-alpha>
|
||||
- <https://www.npmjs.com/package/xmldom>
|
||||
|
||||
It is currently not planned to continue publishing the `xmldom-alpha` package.
|
||||
|
||||
The new maintainers did not invest time to understand changes that led to the last `xmldom` version [`0.1.27`](#0127) published by the original maintainer, but consider it the basis for their work.
|
||||
A timeline of all the changes that happened from that version until `0.3.0` is available in <https://github.com/xmldom/xmldom/issues/62>. Any related questions should be asked there.
|
||||
|
||||
## 0.1.28
|
||||
|
||||
[Commits](https://github.com/xmldom/xmldom/compare/v0.1.27...xmldom-alpha@v0.1.28)
|
||||
|
||||
Published by @jindw on the 9th of May 2017 as
|
||||
- `xmldom-alpha@0.1.28`
|
||||
|
||||
- **BREAKING** includes [regression regarding ` ` (issue #57)](https://github.com/xmldom/xmldom/issues/57)
|
||||
- [Fix `license` field in `package.json`](https://github.com/jindw/xmldom/pull/178)
|
||||
- [Conditional converting of HTML entities](https://github.com/jindw/xmldom/pull/80)
|
||||
- Fix `dom.js` serialization issue for missing document element ([example that failed on `toString()` before this change](https://github.com/xmldom/xmldom/blob/a58dcf7a265522e80ce520fe3be0cddb1b976f6f/test/parse/unclosedcomment.js#L10-L11))
|
||||
- Add new module `entities.js`
|
||||
|
||||
## 0.1.27
|
||||
|
||||
Published by @jindw on the 28th of Nov 2016 as
|
||||
- `xmldom@0.1.27`
|
||||
- `xmldom-alpha@0.1.27`
|
||||
|
||||
- Various bug fixes.
|
||||
- Don't ask why 0.1.26 and 0.1.25 were skipped. `¯\_(ツ)_/¯`
|
||||
|
||||
## 0.1.24 (via xmldom-alpha package)
|
||||
## 0.1.26
|
||||
|
||||
Published on the 18th of Nov 2016
|
||||
as `xmldom@0.1.26`
|
||||
|
||||
- Details unknown
|
||||
|
||||
## 0.1.25
|
||||
|
||||
Published on the 18th of Nov 2016 as
|
||||
- `xmldom@0.1.25`
|
||||
|
||||
- Details unknown
|
||||
|
||||
## 0.1.24
|
||||
|
||||
Published on the 27th of November 2016 as
|
||||
- `xmldom@0.1.24`
|
||||
- `xmldom-alpha@0.1.24`
|
||||
|
||||
- Added node filter.
|
||||
|
||||
## 0.1.23 (via xmldom-alpha npm package)
|
||||
## 0.1.23
|
||||
|
||||
- Added namespace support for nest node serialize.
|
||||
Published on the 5th of May 2016 as
|
||||
- `xmldom-alpha@0.1.23`
|
||||
|
||||
- Add namespace support for nest node serialize.
|
||||
- Various other bug fixes.
|
||||
|
||||
## 0.1.22
|
||||
|
||||
- Merge XMLNS serialization.
|
||||
- Removed \r from source string.
|
||||
- Remove \r from source string.
|
||||
- Print namespaces for child elements.
|
||||
- Switch references to nodeType to use named constants.
|
||||
- Add nodelist toString support.
|
||||
|
||||
## 0.1.21
|
||||
|
||||
- Fixed serialize bug.
|
||||
- Fix serialize bug.
|
||||
|
||||
## 0.1.20
|
||||
|
||||
- Optimized invalid XML support.
|
||||
- Added toString sorter for attributes output.
|
||||
- Added html self closed node button.
|
||||
- Added `*` NS support for getElementsByTagNameNS.
|
||||
- Converted attribute's value to string in setAttributeNS.
|
||||
- Added support for HTML entities for HTML docs only.
|
||||
- Fixed TypeError when Document is created with DocumentType.
|
||||
- Optimize invalid XML support.
|
||||
- Add toString sorter for attributes output.
|
||||
- Add html self closed node button.
|
||||
- Add `*` NS support for getElementsByTagNameNS.
|
||||
- Convert attribute's value to string in setAttributeNS.
|
||||
- Add support for HTML entities for HTML docs only.
|
||||
- Fix TypeError when Document is created with DocumentType.
|
||||
|
||||
## 0.1.19
|
||||
|
||||
- Fixed issue #68, infinite loop on unclosed comment.
|
||||
- Added error report for unclosed tag.
|
||||
- Fix [infinite loop on unclosed comment (jindw/xmldom#68)](https://github.com/jindw/xmldom/issues/68)
|
||||
- Add error report for unclosed tag.
|
||||
- Various other fixes.
|
||||
|
||||
## 0.1.18
|
||||
|
||||
- Added default `ns` support.
|
||||
- Add default `ns` support.
|
||||
- parseFromString now renders entirely plain text documents as textNode.
|
||||
- Enabled option to ignore white space on parsing.
|
||||
- Enable option to ignore white space on parsing.
|
||||
|
||||
## 0.1.17
|
||||
|
||||
**Details missing for this and potential earlier version**
|
||||
|
||||
## 0.1.16
|
||||
|
||||
|
||||
2
node_modules/xmldom/lib/.eslintrc.yml
generated
vendored
Normal file
2
node_modules/xmldom/lib/.eslintrc.yml
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
extends:
|
||||
- 'plugin:es5/no-es2015'
|
||||
2
node_modules/xmldom/lib/dom-parser.js
generated
vendored
2
node_modules/xmldom/lib/dom-parser.js
generated
vendored
@ -21,7 +21,7 @@ DOMParser.prototype.parseFromString = function(source,mimeType){
|
||||
defaultNSMap['']= 'http://www.w3.org/1999/xhtml';
|
||||
}
|
||||
defaultNSMap.xml = defaultNSMap.xml || 'http://www.w3.org/XML/1998/namespace';
|
||||
if(source){
|
||||
if(source && typeof source === 'string'){
|
||||
sax.parse(source,defaultNSMap,entityMap);
|
||||
}else{
|
||||
sax.errorHandler.error("invalid doc source");
|
||||
|
||||
6
node_modules/xmldom/lib/dom.js
generated
vendored
6
node_modules/xmldom/lib/dom.js
generated
vendored
@ -609,10 +609,10 @@ Document.prototype = {
|
||||
},
|
||||
|
||||
getElementsByClassName: function(className) {
|
||||
const pattern = new RegExp(`(^|\\s)${className}(\\s|$)`);
|
||||
return new LiveNodeList(this, base => {
|
||||
var pattern = new RegExp("(^|\\s)" + className + "(\\s|$)");
|
||||
return new LiveNodeList(this, function(base) {
|
||||
var ls = [];
|
||||
_visitNode(base.documentElement, node => {
|
||||
_visitNode(base.documentElement, function(node) {
|
||||
if(node !== base && node.nodeType == ELEMENT_NODE) {
|
||||
if(pattern.test(node.getAttribute('class'))) {
|
||||
ls.push(node);
|
||||
|
||||
6
node_modules/xmldom/lib/entities.js
generated
vendored
6
node_modules/xmldom/lib/entities.js
generated
vendored
@ -9,9 +9,7 @@ exports.entityMap = {
|
||||
Acirc: "Â",
|
||||
Atilde: "Ã",
|
||||
Auml: "Ä",
|
||||
auml: "ä",
|
||||
Aring: "Å",
|
||||
aring: "å",
|
||||
AElig: "Æ",
|
||||
Ccedil: "Ç",
|
||||
Egrave: "È",
|
||||
@ -29,7 +27,6 @@ exports.entityMap = {
|
||||
Ocirc: "Ô",
|
||||
Otilde: "Õ",
|
||||
Ouml: "Ö",
|
||||
ouml: "ö",
|
||||
Oslash: "Ø",
|
||||
Ugrave: "Ù",
|
||||
Uacute: "Ú",
|
||||
@ -69,7 +66,7 @@ exports.entityMap = {
|
||||
yacute: "ý",
|
||||
thorn: "þ",
|
||||
yuml: "ÿ",
|
||||
nbsp: " ",
|
||||
nbsp: "\u00a0",
|
||||
iexcl: "¡",
|
||||
cent: "¢",
|
||||
pound: "£",
|
||||
@ -244,4 +241,3 @@ exports.entityMap = {
|
||||
hearts: "♥",
|
||||
diams: "♦"
|
||||
};
|
||||
//for(var n in exports.entityMap){console.log(exports.entityMap[n].charCodeAt())}
|
||||
|
||||
12
node_modules/xmldom/lib/sax.js
generated
vendored
12
node_modules/xmldom/lib/sax.js
generated
vendored
@ -531,8 +531,16 @@ function parseDCC(source,start,domBuilder,errorHandler){//sure start with '<!'
|
||||
var len = matchs.length;
|
||||
if(len>1 && /!doctype/i.test(matchs[0][0])){
|
||||
var name = matchs[1][0];
|
||||
var pubid = len>3 && /^public$/i.test(matchs[2][0]) && matchs[3][0]
|
||||
var sysid = len>4 && matchs[4][0];
|
||||
var pubid = false;
|
||||
var sysid = false;
|
||||
if(len>3){
|
||||
if(/^public$/i.test(matchs[2][0])){
|
||||
pubid = matchs[3][0];
|
||||
sysid = len>4 && matchs[4][0];
|
||||
}else if(/^system$/i.test(matchs[2][0])){
|
||||
sysid = matchs[3][0];
|
||||
}
|
||||
}
|
||||
var lastMatch = matchs[len-1]
|
||||
domBuilder.startDTD(name,pubid && pubid.replace(/^(['"])(.*?)\1$/,'$2'),
|
||||
sysid && sysid.replace(/^(['"])(.*?)\1$/,'$2'));
|
||||
|
||||
34
node_modules/xmldom/package.json
generated
vendored
34
node_modules/xmldom/package.json
generated
vendored
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xmldom",
|
||||
"version": "0.3.0",
|
||||
"version": "0.4.0",
|
||||
"description": "A pure JavaScript W3C standard-based (XML DOM Level 2 Core) DOMParser and XMLSerializer module.",
|
||||
"keywords": [
|
||||
"w3c",
|
||||
@ -19,17 +19,39 @@
|
||||
},
|
||||
"main": "lib/dom-parser.js",
|
||||
"files": [
|
||||
"CHANGELOG.md",
|
||||
"LICENSE.md",
|
||||
"readme.md",
|
||||
"lib"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "proof platform win32 && proof test */*/*.t.js || t/test"
|
||||
"lint": "npm-run-all lint:eslint",
|
||||
"lint:eslint": "eslint lib test",
|
||||
"start": "nodemon --watch package.json --watch lib --watch test --exec 'npm --silent run test'",
|
||||
"stryker": "stryker run",
|
||||
"test": "npm-run-all test:unit lint",
|
||||
"test:unit": "npm-run-all test:jest",
|
||||
"test:jest": "jest"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"proof": "~7.0.9"
|
||||
"@stryker-mutator/core": "^3.3.1",
|
||||
"@stryker-mutator/javascript-mutator": "^3.3.1",
|
||||
"dom-js": "0.0.9",
|
||||
"eslint": "^7.12.0",
|
||||
"eslint-config-prettier": "^6.14.0",
|
||||
"eslint-plugin-es5": "^1.5.0",
|
||||
"eslint-plugin-prettier": "^3.1.4",
|
||||
"get-stream": "^6.0.0",
|
||||
"jest": "^26.6.1",
|
||||
"nodemon": "^2.0.6",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^2.1.2",
|
||||
"xmltest": "^1.4.0",
|
||||
"yauzl": "^2.10.0"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
@ -69,8 +91,4 @@
|
||||
"url": "https://github.com/xmldom/xmldom/issues"
|
||||
},
|
||||
"license": "(LGPL-2.0 OR MIT)"
|
||||
|
||||
,"_resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.3.0.tgz"
|
||||
,"_integrity": "sha512-z9s6k3wxE+aZHgXYxSTpGDo7BYOUfJsIRyoZiX6HTjwpwfS2wpQBQKa2fD+ShLyPkqDYo5ud7KitmLZ2Cd6r0g=="
|
||||
,"_from": "xmldom@0.3.0"
|
||||
}
|
||||
}
|
||||
|
||||
42
node_modules/xmldom/readme.md
generated
vendored
42
node_modules/xmldom/readme.md
generated
vendored
@ -1,4 +1,10 @@
|
||||
# XMLDOM [](http://travis-ci.org/xmldom/xmldom) [](http://badge.fury.io/js/xmldom)
|
||||
# XMLDOM
|
||||
|
||||
[](./LICENSE.md)
|
||||
[](https://www.npmjs.com/package/xmldom)
|
||||
[](https://github.com/xmldom/xmldom/issues?q=is%3Aissue+is%3Aopen+label%3Abug)
|
||||
[](https://github.com/xmldom/xmldom/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22)
|
||||
[](https://dashboard.stryker-mutator.io/reports/github.com/brodybits/xmldom/master)
|
||||
|
||||
A JavaScript implementation of W3C DOM for Node.js, Rhino and the browser. Fully
|
||||
compatible with `W3C DOM level2`; and some compatible with `level3`. Supports
|
||||
@ -13,20 +19,30 @@ Install:
|
||||
Example:
|
||||
====
|
||||
```javascript
|
||||
var DOMParser = require('xmldom').DOMParser;
|
||||
var doc = new DOMParser().parseFromString(
|
||||
'<xml xmlns="a" xmlns:c="./lite">\n'+
|
||||
'\t<child>test</child>\n'+
|
||||
'\t<child></child>\n'+
|
||||
'\t<child/>\n'+
|
||||
'</xml>'
|
||||
,'text/xml');
|
||||
doc.documentElement.setAttribute('x','y');
|
||||
doc.documentElement.setAttributeNS('./lite','c:x','y2');
|
||||
var nsAttr = doc.documentElement.getAttributeNS('./lite','x')
|
||||
console.info(nsAttr)
|
||||
const { DOMParser } = require('xmldom')
|
||||
|
||||
const doc = new DOMParser().parseFromString(
|
||||
'<xml xmlns="a" xmlns:c="./lite">\n' +
|
||||
'\t<child>test</child>\n' +
|
||||
'\t<child></child>\n' +
|
||||
'\t<child/>\n' +
|
||||
'</xml>',
|
||||
'text/xml'
|
||||
)
|
||||
doc.documentElement.setAttribute('x', 'y')
|
||||
doc.documentElement.setAttributeNS('./lite', 'c:x', 'y2')
|
||||
console.info(doc)
|
||||
|
||||
const nsAttr = doc.documentElement.getAttributeNS('./lite', 'x')
|
||||
console.info(nsAttr)
|
||||
```
|
||||
|
||||
Note: in Typescript and ES6 you can use the import approach, as follows:
|
||||
|
||||
```javascript
|
||||
import { DOMParser } from 'xmldom'
|
||||
```
|
||||
|
||||
API Reference
|
||||
=====
|
||||
|
||||
|
||||
10500
package-lock.json
generated
10500
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "maven-settings-action",
|
||||
"version": "2.2.0",
|
||||
"version": "2.4.0",
|
||||
"description": "Prepare maven settings",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@ -25,10 +25,10 @@
|
||||
"homepage": "https://github.com/s4u/maven-settings-action#readme",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.2.6",
|
||||
"xmldom": "^0.3.0"
|
||||
"xmldom": "^0.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^7.11.0",
|
||||
"jest": "^26.5.3"
|
||||
"eslint": "^7.20.0",
|
||||
"jest": "^26.6.3"
|
||||
}
|
||||
}
|
||||
|
||||
54
settings.js
54
settings.js
@ -50,17 +50,55 @@ function writeSettings(settingsPath, templateXml) {
|
||||
fs.writeFileSync(settingsPath, settingStr);
|
||||
}
|
||||
|
||||
function fillServer(templateXml, templateName, id, username, password) {
|
||||
function jsonToXml(templateXml, xmlTag, json) {
|
||||
for (const key in json) {
|
||||
const keyXml = templateXml.createElement(key);
|
||||
const value = json[key];
|
||||
if (value instanceof Object) {
|
||||
jsonToXml(templateXml, keyXml, value);
|
||||
} else {
|
||||
keyXml.textContent = value;
|
||||
}
|
||||
xmlTag.appendChild(keyXml);
|
||||
}
|
||||
}
|
||||
|
||||
if (!id || !username || !password) {
|
||||
core.setFailed(templateName + ' must contain id, username and password');
|
||||
function fillServer(templateXml, templateName, id, username, password, privateKey, passphrase, filePermissions, directoryPermissions, configurations) {
|
||||
|
||||
if (!id || (!username && !configurations)) {
|
||||
core.setFailed(templateName + ' must contain id, and username or configuration');
|
||||
return;
|
||||
}
|
||||
|
||||
const serverXml = getTemplate(templateName + '.xml')
|
||||
serverXml.getElementsByTagName('id')[0].textContent = id;
|
||||
serverXml.getElementsByTagName('username')[0].textContent = username;
|
||||
serverXml.getElementsByTagName('password')[0].textContent = password;
|
||||
|
||||
const serverTags = {
|
||||
'username': username,
|
||||
'password': password,
|
||||
'privateKey': privateKey,
|
||||
'passphrase': passphrase,
|
||||
'filePermissions': filePermissions,
|
||||
'directoryPermissions': directoryPermissions
|
||||
};
|
||||
for (const tag in serverTags) {
|
||||
const serverTag = serverXml.getElementsByTagName(tag)[0];
|
||||
const tagValue = serverTags[tag];
|
||||
if (tagValue) {
|
||||
serverTag.textContent = tagValue;
|
||||
} else {
|
||||
serverXml.documentElement.removeChild(serverTag);
|
||||
}
|
||||
}
|
||||
|
||||
const configurationTag = serverXml.getElementsByTagName('configuration')[0];
|
||||
if (configurations) {
|
||||
jsonToXml(templateXml, configurationTag, configurations);
|
||||
} else {
|
||||
if (configurationTag.childNodes.length == 0) {
|
||||
serverXml.documentElement.removeChild(configurationTag);
|
||||
}
|
||||
}
|
||||
|
||||
const serversXml = templateXml.getElementsByTagName('servers')[0];
|
||||
serversXml.appendChild(serverXml);
|
||||
@ -74,7 +112,11 @@ function fillServers(template, templateName) {
|
||||
return;
|
||||
}
|
||||
|
||||
JSON.parse(servers).forEach((server) => fillServer(template, templateName, server.id, server.username, server.password));
|
||||
JSON.parse(servers).forEach((server) =>
|
||||
fillServer(template, templateName, server.id, server.username,
|
||||
server.password, server.privateKey, server.passphrase,
|
||||
server.filePermissions, server.directoryPermissions,
|
||||
server.configuration));
|
||||
}
|
||||
|
||||
function fillMirror(template, id, name, mirrorOf, url) {
|
||||
|
||||
173
settings.test.js
173
settings.test.js
@ -38,6 +38,14 @@ const settingsPath = path.join(testHomePath, '.m2', 'settings.xml');
|
||||
|
||||
var consoleOutput = [];
|
||||
|
||||
function stringAsXml(str) {
|
||||
return new DOMParser().parseFromString(str, 'text/xml');
|
||||
}
|
||||
|
||||
function xmlAsString(xml) {
|
||||
return new XMLSerializer().serializeToString(xml).replace(/^\s*$(?:\r\n?|\n)/gm, '');
|
||||
}
|
||||
|
||||
beforeAll(() => {
|
||||
if (!fs.existsSync(testHomePath)) {
|
||||
fs.mkdirSync(testHomePath);
|
||||
@ -51,7 +59,7 @@ beforeAll(() => {
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
xmlTestProfile = new DOMParser().parseFromString(`<settings>
|
||||
xmlTestProfile = stringAsXml(`<settings>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>_properties_</id>
|
||||
@ -119,7 +127,7 @@ test('xml should be write', () => {
|
||||
|
||||
test('fillServers do nothing if no params', () => {
|
||||
|
||||
const xml = new DOMParser().parseFromString("<servers/>");
|
||||
const xml = stringAsXml("<servers/>");
|
||||
|
||||
settings.fillServers(xml, 'servers');
|
||||
|
||||
@ -130,15 +138,13 @@ test('fillServers do nothing if no params', () => {
|
||||
|
||||
test('fillServers one server', () => {
|
||||
|
||||
const xml = new DOMParser().parseFromString("<servers/>");
|
||||
const xml = stringAsXml("<servers/>");
|
||||
|
||||
process.env['INPUT_SERVERS'] = '[{"id": "id1", "username": "username1", "password":"password1"}]';
|
||||
|
||||
settings.fillServers(xml, 'servers');
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml);
|
||||
|
||||
expect(xmlStr).toBe(`<servers>
|
||||
expect(xmlAsString(xml)).toBe(`<servers>
|
||||
<server>
|
||||
<id>id1</id>
|
||||
<username>username1</username>
|
||||
@ -147,18 +153,133 @@ test('fillServers one server', () => {
|
||||
|
||||
});
|
||||
|
||||
test('fillServers with username and configuration', () => {
|
||||
|
||||
const xml = stringAsXml("<servers/>");
|
||||
|
||||
process.env['INPUT_SERVERS'] = '[{"id": "id1", "username": "username", "configuration": {"prop1": "prop1Value", "prop2": "prop2Value"}}]';
|
||||
|
||||
settings.fillServers(xml, 'servers');
|
||||
|
||||
expect(xmlAsString(xml)).toBe(`<servers>
|
||||
<server>
|
||||
<id>id1</id>
|
||||
<username>username</username>
|
||||
<configuration><prop1>prop1Value</prop1><prop2>prop2Value</prop2></configuration>
|
||||
</server></servers>`);
|
||||
});
|
||||
|
||||
test('fillServers with username, password and configuration', () => {
|
||||
|
||||
const xml = stringAsXml("<servers/>");
|
||||
|
||||
process.env['INPUT_SERVERS'] = '[{"id": "id1", "username": "username", "password": "password", "configuration": {"prop1": "prop1Value", "prop2": "prop2Value"}}]';
|
||||
|
||||
settings.fillServers(xml, 'servers');
|
||||
|
||||
expect(xmlAsString(xml)).toBe(`<servers>
|
||||
<server>
|
||||
<id>id1</id>
|
||||
<username>username</username>
|
||||
<password>password</password>
|
||||
<configuration><prop1>prop1Value</prop1><prop2>prop2Value</prop2></configuration>
|
||||
</server></servers>`);
|
||||
});
|
||||
|
||||
test('fillServers with username, privateKey', () => {
|
||||
|
||||
const xml = stringAsXml("<servers/>");
|
||||
|
||||
process.env['INPUT_SERVERS'] = '[{"id": "id1", "username": "username", "privateKey": "${user.home}/.ssh/id_rsa"}]';
|
||||
|
||||
settings.fillServers(xml, 'servers');
|
||||
|
||||
expect(xmlAsString(xml)).toBe(`<servers>
|
||||
<server>
|
||||
<id>id1</id>
|
||||
<username>username</username>
|
||||
<privateKey>\${user.home}/.ssh/id_rsa</privateKey>
|
||||
</server></servers>`);
|
||||
});
|
||||
|
||||
test('fillServers with username, privateKey, and passphrase', () => {
|
||||
|
||||
const xml = stringAsXml("<servers/>");
|
||||
|
||||
process.env['INPUT_SERVERS'] = '[{"id": "id1", "username": "username", "privateKey": "${user.home}/.ssh/id_rsa", "passphrase": "secret"}]';
|
||||
|
||||
settings.fillServers(xml, 'servers');
|
||||
|
||||
expect(xmlAsString(xml)).toBe(`<servers>
|
||||
<server>
|
||||
<id>id1</id>
|
||||
<username>username</username>
|
||||
<privateKey>\${user.home}/.ssh/id_rsa</privateKey>
|
||||
<passphrase>secret</passphrase>
|
||||
</server></servers>`);
|
||||
});
|
||||
|
||||
test('fillServers with all attributes', () => {
|
||||
|
||||
const xml = stringAsXml("<servers/>");
|
||||
|
||||
process.env['INPUT_SERVERS'] = '[{"id": "server001", "username": "my_login", "password": "my_password", "privateKey": "${user.home}/.ssh/id_dsa", "passphrase": "some_passphrase", "filePermissions": "664", "directoryPermissions": "775", "configuration": {"prop1": "prop1Value", "prop2": "prop2Value"} }]';
|
||||
|
||||
settings.fillServers(xml, 'servers');
|
||||
|
||||
expect(xmlAsString(xml)).toBe(`<servers>
|
||||
<server>
|
||||
<id>server001</id>
|
||||
<username>my_login</username>
|
||||
<password>my_password</password>
|
||||
<privateKey>\${user.home}/.ssh/id_dsa</privateKey>
|
||||
<passphrase>some_passphrase</passphrase>
|
||||
<filePermissions>664</filePermissions>
|
||||
<directoryPermissions>775</directoryPermissions>
|
||||
<configuration><prop1>prop1Value</prop1><prop2>prop2Value</prop2></configuration>
|
||||
</server></servers>`);
|
||||
});
|
||||
|
||||
test('fillServers with configuration', () => {
|
||||
|
||||
const xml = stringAsXml("<servers/>");
|
||||
|
||||
process.env['INPUT_SERVERS'] = '[{"id": "id1", "configuration": {"prop1": "prop1Value", "prop2": "prop2Value"}}]';
|
||||
|
||||
settings.fillServers(xml, 'servers');
|
||||
|
||||
expect(xmlAsString(xml)).toBe(`<servers>
|
||||
<server>
|
||||
<id>id1</id>
|
||||
<configuration><prop1>prop1Value</prop1><prop2>prop2Value</prop2></configuration>
|
||||
</server></servers>`);
|
||||
});
|
||||
|
||||
test('fillServers with configuration subLevel', () => {
|
||||
|
||||
const xml = stringAsXml("<servers/>");
|
||||
|
||||
process.env['INPUT_SERVERS'] = '[{"id": "id1", "configuration": {"prop1": {"prop11": "value11", "prop12": "value12"}, "prop2": "value2"}}]';
|
||||
|
||||
settings.fillServers(xml, 'servers');
|
||||
|
||||
expect(xmlAsString(xml)).toBe(`<servers>
|
||||
<server>
|
||||
<id>id1</id>
|
||||
<configuration><prop1><prop11>value11</prop11><prop12>value12</prop12></prop1><prop2>value2</prop2></configuration>
|
||||
</server></servers>`);
|
||||
});
|
||||
|
||||
test('fillServers two servers', () => {
|
||||
|
||||
const xml = new DOMParser().parseFromString("<servers/>");
|
||||
const xml = stringAsXml("<servers/>");
|
||||
|
||||
process.env['INPUT_SERVERS'] = '[{"id": "id1", "username": "username1", "password":"password1"},\
|
||||
{"id": "id2", "username": "username2", "password":"password2"}]';
|
||||
|
||||
settings.fillServers(xml, 'servers');
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml);
|
||||
|
||||
expect(xmlStr).toBe(`<servers>
|
||||
expect(xmlAsString(xml)).toBe(`<servers>
|
||||
<server>
|
||||
<id>id1</id>
|
||||
<username>username1</username>
|
||||
@ -173,7 +294,7 @@ test('fillServers two servers', () => {
|
||||
|
||||
test('fill servers incorrect fields', () => {
|
||||
|
||||
const xml = new DOMParser().parseFromString("<servers/>");
|
||||
const xml = stringAsXml("<servers/>");
|
||||
|
||||
process.env['INPUT_SERVERS'] = '[{"idx": "id1"}]';
|
||||
|
||||
@ -184,22 +305,20 @@ test('fill servers incorrect fields', () => {
|
||||
expect(xmlStr).toBe('<servers/>');
|
||||
expect(consoleOutput).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.stringMatching(/::error::servers must contain id, username and password/)
|
||||
expect.stringMatching(/::error::servers must contain id, and username or configuration/)
|
||||
])
|
||||
);
|
||||
});
|
||||
|
||||
test('fill oracleServers', () => {
|
||||
|
||||
const xml = new DOMParser().parseFromString("<servers/>");
|
||||
const xml = stringAsXml("<servers/>");
|
||||
|
||||
process.env['INPUT_ORACLESERVERS'] = '[{"id": "id1", "username": "username1", "password":"password1"}]';
|
||||
|
||||
settings.fillServers(xml, 'oracleServers');
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml);
|
||||
|
||||
expect(xmlStr).toBe(`<servers>
|
||||
expect(xmlAsString(xml)).toBe(`<servers>
|
||||
<server>
|
||||
<id>id1</id>
|
||||
<username>username1</username>
|
||||
@ -226,15 +345,13 @@ test('fill oracleServers', () => {
|
||||
|
||||
test('fillServers github', () => {
|
||||
|
||||
const xml = new DOMParser().parseFromString("<servers/>");
|
||||
const xml = stringAsXml("<servers/>");
|
||||
|
||||
process.env['INPUT_GITHUBSERVER'] = 'true';
|
||||
|
||||
settings.fillServerForGithub(xml);
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml);
|
||||
|
||||
expect(xmlStr).toBe(`<servers>
|
||||
expect(xmlAsString(xml)).toBe(`<servers>
|
||||
<server>
|
||||
<id>github</id>
|
||||
<username>\${env.GITHUB_ACTOR}</username>
|
||||
@ -245,7 +362,7 @@ test('fillServers github', () => {
|
||||
|
||||
test('fillMirrors do nothing if no params', () => {
|
||||
|
||||
const xml = new DOMParser().parseFromString("<mirrors/>");
|
||||
const xml = stringAsXml("<mirrors/>");
|
||||
|
||||
settings.fillMirrors(xml);
|
||||
|
||||
@ -257,7 +374,7 @@ test('fillMirrors do nothing if no params', () => {
|
||||
|
||||
test('fillMirrors one mirror', () => {
|
||||
|
||||
const xml = new DOMParser().parseFromString("<mirrors/>");
|
||||
const xml = stringAsXml("<mirrors/>");
|
||||
|
||||
process.env['INPUT_MIRRORS'] = '[{"id": "id1", "name": "name", "mirrorOf":"mirrorOf", "url":"url"}]';
|
||||
|
||||
@ -277,7 +394,7 @@ test('fillMirrors one mirror', () => {
|
||||
|
||||
test('fillMirrors two mirrors', () => {
|
||||
|
||||
const xml = new DOMParser().parseFromString("<mirrors/>");
|
||||
const xml = stringAsXml("<mirrors/>");
|
||||
|
||||
process.env['INPUT_MIRRORS'] = '[{"id": "id1", "name": "name1", "mirrorOf":"mirrorOf1", "url":"url1"},{"id": "id2", "name": "name2", "mirrorOf":"mirrorOf2", "url":"url2"}]';
|
||||
|
||||
@ -303,7 +420,7 @@ test('fillMirrors two mirrors', () => {
|
||||
|
||||
test('fillMirrors incorrect fields', () => {
|
||||
|
||||
const xml = new DOMParser().parseFromString("<mirrors/>");
|
||||
const xml = stringAsXml("<mirrors/>");
|
||||
|
||||
process.env['INPUT_MIRRORS'] = '[{"idx": "id1"}]';
|
||||
|
||||
@ -323,7 +440,7 @@ test('addApacheSnapshots', () => {
|
||||
|
||||
process.env['INPUT_APACHESNAPSHOTS'] = "true";
|
||||
|
||||
const xml = new DOMParser().parseFromString('<profiles/>');
|
||||
const xml = stringAsXml('<profiles/>');
|
||||
|
||||
settings.addApacheSnapshots(xml);
|
||||
|
||||
@ -365,7 +482,7 @@ test('addSonatypeSnapshots', () => {
|
||||
|
||||
process.env['INPUT_SONATYPESNAPSHOTS'] = "true";
|
||||
|
||||
const xml = new DOMParser().parseFromString('<profiles/>');
|
||||
const xml = stringAsXml('<profiles/>');
|
||||
|
||||
settings.addSonatypeSnapshots(xml);
|
||||
|
||||
@ -407,7 +524,7 @@ test('addOracleRepo', () => {
|
||||
|
||||
process.env['INPUT_ORACLEREPO'] = "true";
|
||||
|
||||
const xml = new DOMParser().parseFromString('<profiles/>');
|
||||
const xml = stringAsXml('<profiles/>');
|
||||
|
||||
settings.addOracleRepo(xml);
|
||||
|
||||
@ -449,7 +566,7 @@ test('fillProperties', () => {
|
||||
|
||||
process.env['INPUT_PROPERTIES'] = '[{"propertyName1": "propertyValue1"}, {"propertyName2": "propertyValue2"}]';
|
||||
|
||||
const xml = new DOMParser().parseFromString('<profiles/>');
|
||||
const xml = stringAsXml('<profiles/>');
|
||||
|
||||
settings.fillProperties(xml);
|
||||
|
||||
|
||||
@ -3,6 +3,10 @@
|
||||
<id />
|
||||
<username />
|
||||
<password />
|
||||
<privateKey />
|
||||
<passphrase />
|
||||
<filePermissions />
|
||||
<directoryPermissions />
|
||||
<configuration>
|
||||
<basicAuthScope>
|
||||
<host>ANY</host>
|
||||
|
||||
@ -3,4 +3,9 @@
|
||||
<id />
|
||||
<username />
|
||||
<password />
|
||||
<privateKey />
|
||||
<passphrase />
|
||||
<filePermissions />
|
||||
<directoryPermissions />
|
||||
<configuration />
|
||||
</server>
|
||||
|
||||
Reference in New Issue
Block a user