mirror of
https://github.com/s4u/maven-settings-action.git
synced 2026-02-13 00:05:25 +08:00
Compare commits
164 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 | |||
| 92800f80ea | |||
| ff8dced6da | |||
| a55e80ab14 | |||
| 27b9fae681 | |||
| 71886e4f1b | |||
| 468da7c285 | |||
| c36b106668 | |||
| ea8b3d6660 | |||
| 65892feef6 | |||
| 10548f9512 | |||
| f5daf9accb | |||
| 7e525dcd8d | |||
| 4f7bcf53f4 | |||
| 8a445a2687 | |||
| d9a39767e3 | |||
| a3e52fbc15 | |||
| d10b249608 | |||
| e357eee8b6 | |||
| 2a3de130be | |||
| ac18e25d5d | |||
| 6d2d96dbc0 | |||
| 7f8ec2fd15 | |||
| abac0c76e7 | |||
| 3c08118ca6 | |||
| c61c04a8ed | |||
| 4eefa8130f | |||
| af860eb623 | |||
| 8224e70aa0 | |||
| b6dea48d5e | |||
| 81a559fbbc | |||
| 6f1342e18b | |||
| c6417d63a2 | |||
| fcf49419d1 | |||
| cf94a9ebeb | |||
| 93bd53060c | |||
| c62d578537 | |||
| 79dd6f6b44 | |||
| 633099f72a | |||
| 9422b33d6f | |||
| 4f51703755 | |||
| d2be263333 | |||
| b7c480a93e | |||
| 47076d1d48 | |||
| a7f883dd5f | |||
| 783d40b5e0 | |||
| 6fb79721ff | |||
| d2ab3a2771 | |||
| 48be4c0ada | |||
| 94cb3ed880 | |||
| 055a005883 | |||
| b09e5585eb | |||
| 256fa3ecf6 | |||
| 2f4effcbc0 | |||
| 32c0b34c7b | |||
| af0727c4dd | |||
| a3c79af90d | |||
| f06d610f38 | |||
| 0b82524ef7 | |||
| 235574376d | |||
| 2cd2aae853 | |||
| 6438bb1dc9 | |||
| 2bd1df6691 | |||
| d5041555ff | |||
| 44e440d5a2 | |||
| d8160953aa | |||
| f313f0ba42 | |||
| 8d8ad4fc4e | |||
| 91a3862919 | |||
| 5070591660 | |||
| c61209d1cb | |||
| 0e30ec546c | |||
| 09d6dddb17 | |||
| 844e084ed1 | |||
| 3fd7e6914e | |||
| 082d702c3a | |||
| 7d928cbb6b | |||
| 89e2aa37f3 | |||
| be701aaad8 | |||
| c18afafd7e | |||
| f94dfbd262 | |||
| 534b1b1076 | |||
| 1dd5e0f3e7 | |||
| 5f6f6f6779 | |||
| 2350e84f5b | |||
| 0e8d6036b1 | |||
| 71b35fd976 | |||
| fcc46e4a85 | |||
| 41ac50e735 | |||
| 63ea49dafa | |||
| 64c06afaca | |||
| b818438be1 | |||
| 10967cd2f2 | |||
| d0b8b534b3 | |||
| 1b34539e65 | |||
| 79bc1c28ad | |||
| f2d19d8a3c | |||
| d38ae3dd0c | |||
| 1a566d6b1a | |||
| 68c0f5968a | |||
| fa170c9efb | |||
| b8e6d4c5c1 | |||
| c79b8c8bae | |||
| 19aa5326f7 | |||
| e754a0a431 | |||
| 79b590b1fa | |||
| 6e3efd3238 | |||
| c920943d3e |
3
.gitattributes
vendored
Normal file
3
.gitattributes
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
*.js eol=lf
|
||||
*.yml eol=lf
|
||||
*.xml eol=lf
|
||||
14
.github/dependabot.yml
vendored
Normal file
14
.github/dependabot.yml
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: npm
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: daily
|
||||
time: '09:09'
|
||||
open-pull-requests-limit: 10
|
||||
- package-ecosystem: github-actions
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: daily
|
||||
time: '09:09'
|
||||
open-pull-requests-limit: 10
|
||||
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: ''
|
||||
28
.github/workflows/audit.yml
vendored
Normal file
28
.github/workflows/audit.yml
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
name: Audit
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches-ignore:
|
||||
- 'dependabot/**'
|
||||
schedule:
|
||||
- cron: '09 22 * * *'
|
||||
|
||||
jobs:
|
||||
audit:
|
||||
name: Audit
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
fail-fast: false
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.4
|
||||
|
||||
- uses: actions/setup-node@v2.1.5
|
||||
with:
|
||||
node-version: '12.x'
|
||||
|
||||
- run: npm version
|
||||
- run: npm ci
|
||||
- run: npm audit
|
||||
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 }}
|
||||
16
.github/workflows/test.yml
vendored
16
.github/workflows/test.yml
vendored
@ -1,12 +1,15 @@
|
||||
name: "Test Action"
|
||||
name: Test
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches-ignore:
|
||||
- 'dependabot/**'
|
||||
schedule:
|
||||
- cron: '22 22 * * 5'
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Test
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
@ -14,9 +17,9 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: actions/checkout@v2.3.4
|
||||
|
||||
- uses: actions/setup-node@v1
|
||||
- uses: actions/setup-node@v2.1.5
|
||||
with:
|
||||
node-version: '12.x'
|
||||
|
||||
@ -26,14 +29,17 @@ jobs:
|
||||
|
||||
- run: npm version
|
||||
- run: npm ci
|
||||
- run: npm audit
|
||||
- run: npm test
|
||||
|
||||
- uses: ./
|
||||
with:
|
||||
servers: '[{"id": "serverId", "username": "username", "password": "password"}]'
|
||||
servers: '[{"id": "serverId", "username": "username", "password": "password"}]'
|
||||
properties: '[{"prop1": "value1"}, {"prop2": "value2"}]'
|
||||
mirrors: '[{"id": "mirrorId", "name": "mirrorName", "mirrorOf": "mirrorOf", "url": "mirrorUrl"}]'
|
||||
apacheSnapshots: true
|
||||
sonatypeSnapshots: true
|
||||
oracleServers: '[{"id": "oServerId", "username": "oUsername", "password": "oPassword"}]'
|
||||
oracleRepo: true
|
||||
|
||||
- run: cat ~/.m2/settings.xml
|
||||
shell: bash
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,6 +3,7 @@
|
||||
|
||||
# Editors
|
||||
.vscode
|
||||
.idea
|
||||
|
||||
# Logs
|
||||
logs
|
||||
|
||||
165
README.md
165
README.md
@ -1,5 +1,7 @@
|
||||
# maven-settings-action
|
||||
[](https://github.com/s4u/maven-settings-action/actions)
|
||||
[](https://github.com/s4u/maven-settings-action/actions?query=workflow%3ATest)
|
||||
[](https://github.com/s4u/maven-settings-action/actions?query=workflow%3AAudit)
|
||||
|
||||
|
||||
This action setup maven environment for use in action by:
|
||||
- create maven settings.xml
|
||||
@ -8,60 +10,191 @@ This action setup maven environment for use in action by:
|
||||
- add server to servers with id=github, username=$GITHUB_ACTOR and password=$GITHUB_TOKEN
|
||||
|
||||
# Contributions
|
||||
|
||||
- Contributions are welcome!
|
||||
- Give a star - if you want to encourage me to work on a project
|
||||
- Don't hesitate create issue
|
||||
- Give :star: - if you want to encourage me to work on a project
|
||||
- Don't hesitate create issue for new feature you dream of or if you suspect some bug
|
||||
|
||||
# Project versioning
|
||||
Project use [Semantic Versioning](https://semver.org/).
|
||||
We recommended to use the latest and specific release version.
|
||||
|
||||
In order to keep your project dependencies up to date you can watch this repository *(Releases only)*
|
||||
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.0
|
||||
- uses: s4u/maven-settings-action@v2.4.0
|
||||
```
|
||||
|
||||
Create ```settings.xml``` with server section:
|
||||
## ```settings.xml``` with servers section
|
||||
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.0
|
||||
- uses: s4u/maven-settings-action@v2.4.0
|
||||
with:
|
||||
servers: '[{"id": "serverId", "username": "username", "password": "password"}]'
|
||||
```
|
||||
|
||||
Create ```settings.xml``` with maven properties:
|
||||
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.0
|
||||
- uses: s4u/maven-settings-action@v2.4.0
|
||||
with:
|
||||
mirrors: '[{"id": "mirrorId", "name": "mirrorName", "mirrorOf": "mirrorOf", "url": "mirrorUrl"}]'
|
||||
```
|
||||
|
||||
## ```settings.xml``` with properties
|
||||
```yml
|
||||
steps:
|
||||
- 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.0
|
||||
- uses: s4u/maven-settings-action@v2.4.0
|
||||
with:
|
||||
sonatypeSnapshots: true
|
||||
```
|
||||
|
||||
Do not override existing ```settings.xml```, from version 2.0 file is override by default :
|
||||
## ```settings.xml``` with https://repository.apache.org/snapshots/ in repository list
|
||||
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.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 :
|
||||
```yml
|
||||
steps:
|
||||
- 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.0
|
||||
- uses: s4u/maven-settings-action@v2.4.0
|
||||
with:
|
||||
githubServer: false
|
||||
```
|
||||
|
||||
## ```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.4.0
|
||||
with:
|
||||
oracleServers: '[{"id": "serverId", "username": "username", "password": "password"}]'
|
||||
```
|
||||
|
||||
## ```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.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)
|
||||
|
||||
20
action.yml
20
action.yml
@ -1,4 +1,4 @@
|
||||
name: 'maven-setings-action'
|
||||
name: 'maven-settings-action'
|
||||
description: 'Prepare maven settings.xml'
|
||||
|
||||
branding:
|
||||
@ -7,7 +7,10 @@ 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"}]'
|
||||
required: false
|
||||
properties:
|
||||
description: 'json array with properties, eg [{"propertyName1": "propertyValue1"}, {"propertyName2": "propertyValue2"}]'
|
||||
@ -16,6 +19,10 @@ inputs:
|
||||
description: 'add https://oss.sonatype.org/content/repositories/snapshots to repository list - true or false'
|
||||
default: "false"
|
||||
required: false
|
||||
apacheSnapshots:
|
||||
description: 'add https://repository.apache.org/snapshots to repository list - true or false'
|
||||
default: "false"
|
||||
required: false
|
||||
override:
|
||||
description: 'override existing settings.xml file'
|
||||
default: "true"
|
||||
@ -24,8 +31,13 @@ inputs:
|
||||
description: 'add to settings.xml servers server-id: github; username=$GITHUB_ACTOR and password=$GITHUB_TOKEN'
|
||||
default: "true"
|
||||
required: false
|
||||
|
||||
|
||||
oracleServers:
|
||||
description: 'servers definition in json array, eg: [{"id": "serverId", "username": "username", "password": "password"}] for Oracle repository'
|
||||
required: false
|
||||
oracleRepo:
|
||||
description: 'add Oracle Maven Repository'
|
||||
default: "false"
|
||||
required: false
|
||||
|
||||
runs:
|
||||
using: 'node12'
|
||||
|
||||
162
index.test.js
162
index.test.js
@ -63,18 +63,164 @@ afterAll(() => {
|
||||
|
||||
test('run with all feature', () => {
|
||||
|
||||
process.env['INPUT_SERVERS'] = '[{"id": "serverId", "username": "username", "password": "password"}]';
|
||||
process.env['INPUT_PROPERTIES'] = '[{"prop1": "value1"}, {"prop2": "value2"}]'
|
||||
process.env['INPUT_SONATYPESNAPSHOT'] = 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;
|
||||
|
||||
cp.execSync(`node ${indexPath}`, { env: process.env }).toString();
|
||||
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;
|
||||
process.env['INPUT_SONATYPESNAPSHOTS'] = true;
|
||||
process.env['INPUT_ORACLEREPO'] = true;
|
||||
|
||||
cp.execSync(`node ${indexPath}`, { env: process.env, stdio: 'inherit' });
|
||||
|
||||
const settingsStatus = fs.lstatSync(settingsPath);
|
||||
expect(settingsStatus.isFile()).toBeTruthy();
|
||||
expect(settingsStatus.size).toBeGreaterThan(0);
|
||||
|
||||
const settingsBody = fs.readFileSync(settingsPath).toString();
|
||||
expect(settingsBody).toMatch('<settings>');
|
||||
expect(settingsBody).toMatch('<servers><server><id>serverId</id><username>username</username><password>password</password></server></servers>');
|
||||
expect(settingsBody).toMatch('prop1');
|
||||
const settingsBody = fs.readFileSync(settingsPath).toString().replace(/^\s*$(?:\r\n?|\n)/gm, '');
|
||||
expect(settingsBody).toBe(`<settings>
|
||||
<interactiveMode>false</interactiveMode>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>_properties_</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties><prop1>value1</prop1><prop2>value2</prop2></properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>_apache-snapshots_</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>apache.snapshots.https</id>
|
||||
<url>https://repository.apache.org/snapshots/</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>apache.snapshots.https</id>
|
||||
<url>https://repository.apache.org/snapshots/</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>_sonatype-snapshots_</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>sonatype-snapshots</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>sonatype-snapshots</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>_maven.oracle.com_</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>maven.oracle.com</id>
|
||||
<url>https://maven.oracle.com</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>maven.oracle.com</id>
|
||||
<url>https://maven.oracle.com</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</profile></profiles>
|
||||
<servers>
|
||||
<server>
|
||||
<id>serverId</id>
|
||||
<username>sUsername</username>
|
||||
<password>sPassword</password>
|
||||
<configuration><props1>value1</props1></configuration>
|
||||
</server>
|
||||
<server>
|
||||
<id>oServerId</id>
|
||||
<username>oUsername</username>
|
||||
<password>oPassword</password>
|
||||
<configuration>
|
||||
<basicAuthScope>
|
||||
<host>ANY</host>
|
||||
<port>ANY</port>
|
||||
<realm>OAM 11g</realm>
|
||||
</basicAuthScope>
|
||||
<httpConfiguration>
|
||||
<all>
|
||||
<params>
|
||||
<property>
|
||||
<name>http.protocol.allow-circular-redirects</name>
|
||||
<value>%b,true</value>
|
||||
</property>
|
||||
</params>
|
||||
</all>
|
||||
</httpConfiguration>
|
||||
</configuration>
|
||||
</server>
|
||||
<server>
|
||||
<id>github</id>
|
||||
<username>\${env.GITHUB_ACTOR}</username>
|
||||
<password>\${env.GITHUB_TOKEN}</password>
|
||||
</server></servers>
|
||||
<mirrors>
|
||||
<mirror>
|
||||
<id>mirrorId</id>
|
||||
<name>mirror Name</name>
|
||||
<mirrorOf>mirror Off *</mirrorOf>
|
||||
<url>mirror url</url>
|
||||
</mirror></mirrors>
|
||||
</settings>`);
|
||||
})
|
||||
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
9
node_modules/@actions/core/LICENSE.md
generated
vendored
Normal file
9
node_modules/@actions/core/LICENSE.md
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2019 GitHub
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
3
node_modules/@actions/core/README.md
generated
vendored
3
node_modules/@actions/core/README.md
generated
vendored
@ -89,6 +89,7 @@ try {
|
||||
}
|
||||
|
||||
// Do stuff
|
||||
core.info('Output to the actions build log')
|
||||
}
|
||||
catch (err) {
|
||||
core.error(`Error ${err}, action may still succeed though`);
|
||||
@ -143,4 +144,4 @@ const core = require('@actions/core');
|
||||
var pid = core.getState("pidToKill");
|
||||
|
||||
process.kill(pid);
|
||||
```
|
||||
```
|
||||
|
||||
4
node_modules/@actions/core/lib/command.d.ts
generated
vendored
4
node_modules/@actions/core/lib/command.d.ts
generated
vendored
@ -1,5 +1,5 @@
|
||||
interface CommandProperties {
|
||||
[key: string]: string;
|
||||
[key: string]: any;
|
||||
}
|
||||
/**
|
||||
* Commands
|
||||
@ -11,6 +11,6 @@ interface CommandProperties {
|
||||
* ::warning::This is the message
|
||||
* ::set-env name=MY_VAR::some value
|
||||
*/
|
||||
export declare function issueCommand(command: string, properties: CommandProperties, message: string): void;
|
||||
export declare function issueCommand(command: string, properties: CommandProperties, message: any): void;
|
||||
export declare function issue(name: string, message?: string): void;
|
||||
export {};
|
||||
|
||||
5
node_modules/@actions/core/lib/command.js
generated
vendored
5
node_modules/@actions/core/lib/command.js
generated
vendored
@ -8,6 +8,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const os = __importStar(require("os"));
|
||||
const utils_1 = require("./utils");
|
||||
/**
|
||||
* Commands
|
||||
*
|
||||
@ -62,13 +63,13 @@ class Command {
|
||||
}
|
||||
}
|
||||
function escapeData(s) {
|
||||
return (s || '')
|
||||
return utils_1.toCommandValue(s)
|
||||
.replace(/%/g, '%25')
|
||||
.replace(/\r/g, '%0D')
|
||||
.replace(/\n/g, '%0A');
|
||||
}
|
||||
function escapeProperty(s) {
|
||||
return (s || '')
|
||||
return utils_1.toCommandValue(s)
|
||||
.replace(/%/g, '%25')
|
||||
.replace(/\r/g, '%0D')
|
||||
.replace(/\n/g, '%0A')
|
||||
|
||||
2
node_modules/@actions/core/lib/command.js.map
generated
vendored
2
node_modules/@actions/core/lib/command.js.map
generated
vendored
@ -1 +1 @@
|
||||
{"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAAwB;AAQxB;;;;;;;;;GASG;AACH,SAAgB,YAAY,CAC1B,OAAe,EACf,UAA6B,EAC7B,OAAe;IAEf,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;IACrD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AAC/C,CAAC;AAPD,oCAOC;AAED,SAAgB,KAAK,CAAC,IAAY,EAAE,UAAkB,EAAE;IACtD,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACjC,CAAC;AAFD,sBAEC;AAED,MAAM,UAAU,GAAG,IAAI,CAAA;AAEvB,MAAM,OAAO;IAKX,YAAY,OAAe,EAAE,UAA6B,EAAE,OAAe;QACzE,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GAAG,iBAAiB,CAAA;SAC5B;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED,QAAQ;QACN,IAAI,MAAM,GAAG,UAAU,GAAG,IAA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E;oBACvC,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;oBAChC,IAAI,GAAG,EAAE;wBACP,IAAI,KAAK,EAAE;4BACT,KAAK,GAAG,KAAK,CAAA;yBACd;6BAAM;4BACL,MAAM,IAAI,GAAG,CAAA;yBACd;wBAED,MAAM,IAAI,GAAG,GAAG,IAAI,cAAc,CAAC,GAAG,CAAC,EAAE,CAAA;qBAC1C;iBACF;aACF;SACF;QAED,MAAM,IAAI,GAAG,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAA;QACpD,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AAED,SAAS,UAAU,CAAC,CAAM;IACxB,OAAO,sBAAc,CAAC,CAAC,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AAC1B,CAAC;AAED,SAAS,cAAc,CAAC,CAAM;IAC5B,OAAO,sBAAc,CAAC,CAAC,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;AACzB,CAAC"}
|
||||
28
node_modules/@actions/core/lib/core.d.ts
generated
vendored
28
node_modules/@actions/core/lib/core.d.ts
generated
vendored
@ -21,9 +21,9 @@ export declare enum ExitCode {
|
||||
/**
|
||||
* Sets env variable for this action and future actions in the job
|
||||
* @param name the name of the variable to set
|
||||
* @param val the value of the variable
|
||||
* @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
|
||||
*/
|
||||
export declare function exportVariable(name: string, val: string): void;
|
||||
export declare function exportVariable(name: string, val: any): void;
|
||||
/**
|
||||
* Registers a secret which will get masked from logs
|
||||
* @param secret value of the secret
|
||||
@ -46,15 +46,21 @@ export declare function getInput(name: string, options?: InputOptions): string;
|
||||
* Sets the value of an output.
|
||||
*
|
||||
* @param name name of the output to set
|
||||
* @param value value to store
|
||||
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
||||
*/
|
||||
export declare function setOutput(name: string, value: string): void;
|
||||
export declare function setOutput(name: string, value: any): void;
|
||||
/**
|
||||
* Enables or disables the echoing of commands into stdout for the rest of the step.
|
||||
* Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
|
||||
*
|
||||
*/
|
||||
export declare function setCommandEcho(enabled: boolean): void;
|
||||
/**
|
||||
* Sets the action status to failed.
|
||||
* When the action exits it will be with an exit code of 1
|
||||
* @param message add error issue message
|
||||
*/
|
||||
export declare function setFailed(message: string): void;
|
||||
export declare function setFailed(message: string | Error): void;
|
||||
/**
|
||||
* Gets whether Actions Step Debug is on or not
|
||||
*/
|
||||
@ -66,14 +72,14 @@ export declare function isDebug(): boolean;
|
||||
export declare function debug(message: string): void;
|
||||
/**
|
||||
* Adds an error issue
|
||||
* @param message error issue message
|
||||
* @param message error issue message. Errors will be converted to string via toString()
|
||||
*/
|
||||
export declare function error(message: string): void;
|
||||
export declare function error(message: string | Error): void;
|
||||
/**
|
||||
* Adds an warning issue
|
||||
* @param message warning issue message
|
||||
* @param message warning issue message. Errors will be converted to string via toString()
|
||||
*/
|
||||
export declare function warning(message: string): void;
|
||||
export declare function warning(message: string | Error): void;
|
||||
/**
|
||||
* Writes info to log with console.log.
|
||||
* @param message info message
|
||||
@ -104,9 +110,9 @@ export declare function group<T>(name: string, fn: () => Promise<T>): Promise<T>
|
||||
* Saves state for current action, the state can only be retrieved by this action's post job execution.
|
||||
*
|
||||
* @param name name of the state to store
|
||||
* @param value value to store
|
||||
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
||||
*/
|
||||
export declare function saveState(name: string, value: string): void;
|
||||
export declare function saveState(name: string, value: any): void;
|
||||
/**
|
||||
* Gets the value of an state set by this action's main execution.
|
||||
*
|
||||
|
||||
49
node_modules/@actions/core/lib/core.js
generated
vendored
49
node_modules/@actions/core/lib/core.js
generated
vendored
@ -17,6 +17,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const command_1 = require("./command");
|
||||
const file_command_1 = require("./file-command");
|
||||
const utils_1 = require("./utils");
|
||||
const os = __importStar(require("os"));
|
||||
const path = __importStar(require("path"));
|
||||
/**
|
||||
@ -39,11 +41,21 @@ var ExitCode;
|
||||
/**
|
||||
* Sets env variable for this action and future actions in the job
|
||||
* @param name the name of the variable to set
|
||||
* @param val the value of the variable
|
||||
* @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function exportVariable(name, val) {
|
||||
process.env[name] = val;
|
||||
command_1.issueCommand('set-env', { name }, val);
|
||||
const convertedVal = utils_1.toCommandValue(val);
|
||||
process.env[name] = convertedVal;
|
||||
const filePath = process.env['GITHUB_ENV'] || '';
|
||||
if (filePath) {
|
||||
const delimiter = '_GitHubActionsFileCommandDelimeter_';
|
||||
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
|
||||
file_command_1.issueCommand('ENV', commandValue);
|
||||
}
|
||||
else {
|
||||
command_1.issueCommand('set-env', { name }, convertedVal);
|
||||
}
|
||||
}
|
||||
exports.exportVariable = exportVariable;
|
||||
/**
|
||||
@ -59,7 +71,13 @@ exports.setSecret = setSecret;
|
||||
* @param inputPath
|
||||
*/
|
||||
function addPath(inputPath) {
|
||||
command_1.issueCommand('add-path', {}, inputPath);
|
||||
const filePath = process.env['GITHUB_PATH'] || '';
|
||||
if (filePath) {
|
||||
file_command_1.issueCommand('PATH', inputPath);
|
||||
}
|
||||
else {
|
||||
command_1.issueCommand('add-path', {}, inputPath);
|
||||
}
|
||||
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
|
||||
}
|
||||
exports.addPath = addPath;
|
||||
@ -82,12 +100,22 @@ exports.getInput = getInput;
|
||||
* Sets the value of an output.
|
||||
*
|
||||
* @param name name of the output to set
|
||||
* @param value value to store
|
||||
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function setOutput(name, value) {
|
||||
command_1.issueCommand('set-output', { name }, value);
|
||||
}
|
||||
exports.setOutput = setOutput;
|
||||
/**
|
||||
* Enables or disables the echoing of commands into stdout for the rest of the step.
|
||||
* Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
|
||||
*
|
||||
*/
|
||||
function setCommandEcho(enabled) {
|
||||
command_1.issue('echo', enabled ? 'on' : 'off');
|
||||
}
|
||||
exports.setCommandEcho = setCommandEcho;
|
||||
//-----------------------------------------------------------------------
|
||||
// Results
|
||||
//-----------------------------------------------------------------------
|
||||
@ -121,18 +149,18 @@ function debug(message) {
|
||||
exports.debug = debug;
|
||||
/**
|
||||
* Adds an error issue
|
||||
* @param message error issue message
|
||||
* @param message error issue message. Errors will be converted to string via toString()
|
||||
*/
|
||||
function error(message) {
|
||||
command_1.issue('error', message);
|
||||
command_1.issue('error', message instanceof Error ? message.toString() : message);
|
||||
}
|
||||
exports.error = error;
|
||||
/**
|
||||
* Adds an warning issue
|
||||
* @param message warning issue message
|
||||
* @param message warning issue message. Errors will be converted to string via toString()
|
||||
*/
|
||||
function warning(message) {
|
||||
command_1.issue('warning', message);
|
||||
command_1.issue('warning', message instanceof Error ? message.toString() : message);
|
||||
}
|
||||
exports.warning = warning;
|
||||
/**
|
||||
@ -190,8 +218,9 @@ exports.group = group;
|
||||
* Saves state for current action, the state can only be retrieved by this action's post job execution.
|
||||
*
|
||||
* @param name name of the state to store
|
||||
* @param value value to store
|
||||
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function saveState(name, value) {
|
||||
command_1.issueCommand('save-state', { name }, value);
|
||||
}
|
||||
|
||||
2
node_modules/@actions/core/lib/core.js.map
generated
vendored
2
node_modules/@actions/core/lib/core.js.map
generated
vendored
@ -1 +1 @@
|
||||
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,uCAA6C;AAE7C,uCAAwB;AACxB,2CAA4B;AAU5B;;GAEG;AACH,IAAY,QAUX;AAVD,WAAY,QAAQ;IAClB;;OAEG;IACH,6CAAW,CAAA;IAEX;;OAEG;IACH,6CAAW,CAAA;AACb,CAAC,EAVW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAUnB;AAED,yEAAyE;AACzE,YAAY;AACZ,yEAAyE;AAEzE;;;;GAIG;AACH,SAAgB,cAAc,CAAC,IAAY,EAAE,GAAW;IACtD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAA;IACvB,sBAAY,CAAC,SAAS,EAAE,EAAC,IAAI,EAAC,EAAE,GAAG,CAAC,CAAA;AACtC,CAAC;AAHD,wCAGC;AAED;;;GAGG;AACH,SAAgB,SAAS,CAAC,MAAc;IACtC,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;AACtC,CAAC;AAFD,8BAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,SAAiB;IACvC,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,SAAS,CAAC,CAAA;IACvC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,SAAS,GAAG,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAA;AAC7E,CAAC;AAHD,0BAGC;AAED;;;;;;GAMG;AACH,SAAgB,QAAQ,CAAC,IAAY,EAAE,OAAsB;IAC3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;;GAKG;AACH,8DAA8D;AAC9D,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAU;IAChD,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,8BAEC;AAED;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,IAAY;IACnC,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,IAAI,EAAE,CAAA;AAC3C,CAAC;AAFD,4BAEC"}
|
||||
1
node_modules/@actions/core/lib/file-command.d.ts
generated
vendored
Normal file
1
node_modules/@actions/core/lib/file-command.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export declare function issueCommand(command: string, message: any): void;
|
||||
29
node_modules/@actions/core/lib/file-command.js
generated
vendored
Normal file
29
node_modules/@actions/core/lib/file-command.js
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
// For internal use, subject to change.
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
// We use any as a valid input type
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
const fs = __importStar(require("fs"));
|
||||
const os = __importStar(require("os"));
|
||||
const utils_1 = require("./utils");
|
||||
function issueCommand(command, message) {
|
||||
const filePath = process.env[`GITHUB_${command}`];
|
||||
if (!filePath) {
|
||||
throw new Error(`Unable to find environment variable for file command ${command}`);
|
||||
}
|
||||
if (!fs.existsSync(filePath)) {
|
||||
throw new Error(`Missing file at path: ${filePath}`);
|
||||
}
|
||||
fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
|
||||
encoding: 'utf8'
|
||||
});
|
||||
}
|
||||
exports.issueCommand = issueCommand;
|
||||
//# sourceMappingURL=file-command.js.map
|
||||
1
node_modules/@actions/core/lib/file-command.js.map
generated
vendored
Normal file
1
node_modules/@actions/core/lib/file-command.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"file-command.js","sourceRoot":"","sources":["../src/file-command.ts"],"names":[],"mappings":";AAAA,uCAAuC;;;;;;;;;AAEvC,mCAAmC;AACnC,uDAAuD;AAEvD,uCAAwB;AACxB,uCAAwB;AACxB,mCAAsC;AAEtC,SAAgB,YAAY,CAAC,OAAe,EAAE,OAAY;IACxD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,OAAO,EAAE,CAAC,CAAA;IACjD,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,IAAI,KAAK,CACb,wDAAwD,OAAO,EAAE,CAClE,CAAA;KACF;IACD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;QAC5B,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,EAAE,CAAC,CAAA;KACrD;IAED,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,GAAG,sBAAc,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE;QACjE,QAAQ,EAAE,MAAM;KACjB,CAAC,CAAA;AACJ,CAAC;AAdD,oCAcC"}
|
||||
5
node_modules/@actions/core/lib/utils.d.ts
generated
vendored
Normal file
5
node_modules/@actions/core/lib/utils.d.ts
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
/**
|
||||
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
||||
* @param input input to sanitize into a string
|
||||
*/
|
||||
export declare function toCommandValue(input: any): string;
|
||||
19
node_modules/@actions/core/lib/utils.js
generated
vendored
Normal file
19
node_modules/@actions/core/lib/utils.js
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
// We use any as a valid input type
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
/**
|
||||
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
||||
* @param input input to sanitize into a string
|
||||
*/
|
||||
function toCommandValue(input) {
|
||||
if (input === null || input === undefined) {
|
||||
return '';
|
||||
}
|
||||
else if (typeof input === 'string' || input instanceof String) {
|
||||
return input;
|
||||
}
|
||||
return JSON.stringify(input);
|
||||
}
|
||||
exports.toCommandValue = toCommandValue;
|
||||
//# sourceMappingURL=utils.js.map
|
||||
1
node_modules/@actions/core/lib/utils.js.map
generated
vendored
Normal file
1
node_modules/@actions/core/lib/utils.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA,mCAAmC;AACnC,uDAAuD;;AAEvD;;;GAGG;AACH,SAAgB,cAAc,CAAC,KAAU;IACvC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;QACzC,OAAO,EAAE,CAAA;KACV;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,MAAM,EAAE;QAC/D,OAAO,KAAe,CAAA;KACvB;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;AAC9B,CAAC;AAPD,wCAOC"}
|
||||
74
node_modules/@actions/core/package.json
generated
vendored
74
node_modules/@actions/core/package.json
generated
vendored
@ -1,23 +1,57 @@
|
||||
{
|
||||
"name": "@actions/core",
|
||||
"version": "1.2.3",
|
||||
"description": "Actions core lib",
|
||||
"keywords": [
|
||||
"github",
|
||||
"actions",
|
||||
"core"
|
||||
"_args": [
|
||||
[
|
||||
"@actions/core@1.2.6",
|
||||
"."
|
||||
]
|
||||
],
|
||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/core",
|
||||
"license": "MIT",
|
||||
"main": "lib/core.js",
|
||||
"types": "lib/core.d.ts",
|
||||
"_from": "@actions/core@1.2.6",
|
||||
"_id": "@actions/core@1.2.6",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA==",
|
||||
"_location": "/@actions/core",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@actions/core@1.2.6",
|
||||
"name": "@actions/core",
|
||||
"escapedName": "@actions%2fcore",
|
||||
"scope": "@actions",
|
||||
"rawSpec": "1.2.6",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.2.6"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz",
|
||||
"_spec": "1.2.6",
|
||||
"_where": ".",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"description": "Actions core lib",
|
||||
"devDependencies": {
|
||||
"@types/node": "^12.0.2"
|
||||
},
|
||||
"directories": {
|
||||
"lib": "lib",
|
||||
"test": "__tests__"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
"lib",
|
||||
"!.DS_Store"
|
||||
],
|
||||
"homepage": "https://github.com/actions/toolkit/tree/main/packages/core",
|
||||
"keywords": [
|
||||
"github",
|
||||
"actions",
|
||||
"core"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "lib/core.js",
|
||||
"name": "@actions/core",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
@ -27,18 +61,10 @@
|
||||
"directory": "packages/core"
|
||||
},
|
||||
"scripts": {
|
||||
"audit-moderate": "npm install && npm audit --audit-level=moderate",
|
||||
"audit-moderate": "npm install && npm audit --json --audit-level=moderate > audit.json",
|
||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||
"tsc": "tsc"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^12.0.2"
|
||||
}
|
||||
|
||||
,"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.3.tgz"
|
||||
,"_integrity": "sha512-Wp4xnyokakM45Uuj4WLUxdsa8fJjKVl1fDTsPbTEcTcuu0Nb26IPQbOtjmnfaCPGcaoPOOqId8H9NapZ8gii4w=="
|
||||
,"_from": "@actions/core@1.2.3"
|
||||
}
|
||||
"types": "lib/core.d.ts",
|
||||
"version": "1.2.6"
|
||||
}
|
||||
|
||||
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
|
||||
=====
|
||||
|
||||
|
||||
1
node_modules/xpath/.npmignore
generated
vendored
1
node_modules/xpath/.npmignore
generated
vendored
@ -1 +0,0 @@
|
||||
node_modules/
|
||||
133
node_modules/xpath/README.md
generated
vendored
133
node_modules/xpath/README.md
generated
vendored
@ -1,133 +0,0 @@
|
||||
## xpath
|
||||
DOM 3 XPath 1.0 implemention and helper for JavaScript, with node.js support.
|
||||
|
||||
Originally written by Cameron McCormack ([blog](http://mcc.id.au/xpathjs)).
|
||||
|
||||
Additional contributions from
|
||||
Yaron Naveh ([blog](http://webservices20.blogspot.com/))
|
||||
goto100
|
||||
Thomas Weinert
|
||||
Jimmy Rishe
|
||||
and [others](https://github.com/goto100/xpath/graphs/contributors)
|
||||
|
||||
## Install
|
||||
Install with [npm](http://github.com/isaacs/npm):
|
||||
|
||||
npm install xpath
|
||||
|
||||
xpath is xml engine agnostic but I recommend to use [xmldom](https://github.com/jindw/xmldom):
|
||||
|
||||
npm install xmldom
|
||||
|
||||
## API Documentation
|
||||
|
||||
Can be found [here](https://github.com/goto100/xpath/blob/master/docs/xpath%20methods.md). See below for example usage.
|
||||
|
||||
## Your first xpath:
|
||||
`````javascript
|
||||
var xpath = require('xpath')
|
||||
, dom = require('xmldom').DOMParser
|
||||
|
||||
var xml = "<book><title>Harry Potter</title></book>"
|
||||
var doc = new dom().parseFromString(xml)
|
||||
var nodes = xpath.select("//title", doc)
|
||||
|
||||
console.log(nodes[0].localName + ": " + nodes[0].firstChild.data)
|
||||
console.log("Node: " + nodes[0].toString())
|
||||
`````
|
||||
➡
|
||||
|
||||
title: Harry Potter
|
||||
Node: <title>Harry Potter</title>
|
||||
|
||||
### Alternatively
|
||||
|
||||
Using the same interface you have on modern browsers ([MDN])
|
||||
|
||||
`````javascript
|
||||
var node = null;
|
||||
var xml = "<book author='J. K. Rowling'><title>Harry Potter</title></book>"
|
||||
var doc = new dom().parseFromString(xml)
|
||||
var result = xpath.evaluate(
|
||||
"/book/title", // xpathExpression
|
||||
doc, // contextNode
|
||||
null, // namespaceResolver
|
||||
xpath.XPathResult.ANY_TYPE, // resultType
|
||||
null // result
|
||||
)
|
||||
|
||||
node = result.iterateNext();
|
||||
while (node) {
|
||||
console.log(node.localName + ": " + node.firstChild.data);
|
||||
console.log("Node: " + node.toString());
|
||||
|
||||
node = result.iterateNext();
|
||||
}
|
||||
`````
|
||||
➡
|
||||
|
||||
title: Harry Potter
|
||||
Node: <title>Harry Potter</title>
|
||||
|
||||
## Evaluate string values directly:
|
||||
`````javascript
|
||||
var xml = "<book><title>Harry Potter</title></book>";
|
||||
var doc = new dom().parseFromString(xml);
|
||||
var title = xpath.select("string(//title)", doc);
|
||||
|
||||
console.log(title);
|
||||
`````
|
||||
➡
|
||||
|
||||
Harry Potter
|
||||
|
||||
## Namespaces
|
||||
`````javascript
|
||||
var xml = "<book><title xmlns='myns'>Harry Potter</title></book>"
|
||||
var doc = new dom().parseFromString(xml)
|
||||
var node = xpath.select("//*[local-name(.)='title' and namespace-uri(.)='myns']", doc)[0]
|
||||
|
||||
console.log(node.namespaceURI)
|
||||
`````
|
||||
➡
|
||||
|
||||
myns
|
||||
|
||||
## Namespaces with easy mappings
|
||||
`````javascript
|
||||
var xml = "<book xmlns:bookml='http://example.com/book'><bookml:title>Harry Potter</bookml:title></book>"
|
||||
var select = xpath.useNamespaces({"bookml": "http://example.com/book"});
|
||||
|
||||
console.log(select('//bookml:title/text()', doc)[0].nodeValue);
|
||||
`````
|
||||
➡
|
||||
|
||||
Harry Potter
|
||||
|
||||
## Default namespace with mapping
|
||||
`````javascript
|
||||
var xml = "<book xmlns='http://example.com/book'><title>Harry Potter</title></book>"
|
||||
var select = xpath.useNamespaces({"bookml": "http://example.com/book"});
|
||||
|
||||
console.log(select('//bookml:title/text()', doc)[0].nodeValue);
|
||||
`````
|
||||
➡
|
||||
|
||||
Harry Potter
|
||||
|
||||
## Attributes
|
||||
`````javascript
|
||||
var xml = "<book author='J. K. Rowling'><title>Harry Potter</title></book>"
|
||||
var doc = new dom().parseFromString(xml)
|
||||
var author = xpath.select1("/book/@author", doc).value
|
||||
|
||||
console.log(author)
|
||||
`````
|
||||
➡
|
||||
|
||||
J. K. Rowling
|
||||
|
||||
[MDN]: https://developer.mozilla.org/en/docs/Web/API/Document/evaluate
|
||||
|
||||
## License
|
||||
MIT
|
||||
62
node_modules/xpath/docs/XPathEvaluator.md
generated
vendored
62
node_modules/xpath/docs/XPathEvaluator.md
generated
vendored
@ -1,62 +0,0 @@
|
||||
# `XPathEvaluator`
|
||||
|
||||
The `xpath.parse()` method returns an `XPathEvaluator`, which contains the following methods.
|
||||
|
||||
Each of these methods takes an optional `options` object, which can contain any of the following properties:
|
||||
|
||||
`namespaces` - a namespace resolver. See the [documentation page](namespace%20resolvers.md) for details.
|
||||
|
||||
`variables` - a variable resolver. See the [documentation page](variable%20resolvers.md) for details.
|
||||
|
||||
`functions` - a function resolver. See the [documentation page](function%20resolvers.md) for details.
|
||||
|
||||
`node` - the context node for evaluating the expression
|
||||
|
||||
Example usage:
|
||||
|
||||
```js
|
||||
var evaluator = xpath.parse('/characters/character[@greeting = $greeting]');
|
||||
var character = evaluator.select1({
|
||||
node: myCharacterDoc,
|
||||
variables: {
|
||||
greeting: "Hello, I'm Harry, Harry Potter."
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## `XPathEvaluator` methods
|
||||
|
||||
`evaluate([options])`
|
||||
|
||||
Evaluates the XPath expression and returns the result. The resulting type is determined based on the type of the expression, using the same criteria as [`xpath.select`](xpath%20methods.md).
|
||||
|
||||
`evaluateNumber([options])`
|
||||
|
||||
Evaluates the XPath expression and returns the result as a number.
|
||||
|
||||
`evaluateString([options])`
|
||||
|
||||
Evaluates the XPath expression and returns the result as a string.
|
||||
|
||||
`evaluateBoolean([options])`
|
||||
|
||||
Evaluates the XPath expression and returns the result as a boolean value.
|
||||
|
||||
`evaluateNodeSet([options])`
|
||||
|
||||
Evaluates the XPath expression and returns the result as an XNodeSet. See the [documentation page](#) for details on this interface.
|
||||
|
||||
This is only valid for expressions that evaluate to a node set.
|
||||
|
||||
`select([options])`
|
||||
|
||||
Evaluates the XPath expression and returns an array of the resulting nodes, in document order.
|
||||
|
||||
This is only valid for expressions that evaluate to a node set.
|
||||
|
||||
`select1([options])`
|
||||
|
||||
Evaluates the XPath expression and the first node in the resulting node set, in document order. Returns `undefined`
|
||||
|
||||
This is only valid for expressions that evaluate to a node set.
|
||||
|
||||
47
node_modules/xpath/docs/XPathResult.md
generated
vendored
47
node_modules/xpath/docs/XPathResult.md
generated
vendored
@ -1,47 +0,0 @@
|
||||
# XPathResult interface
|
||||
|
||||
Represents the result of an XPath expression. This interface is used for the parameters passed into custom functions
|
||||
used in [function resolvers](function resolvers.md) and can represent a number, a string, a boolean value, or a node set.
|
||||
|
||||
## Methods
|
||||
|
||||
```js
|
||||
booleanValue() -> boolean
|
||||
```
|
||||
|
||||
Returns the boolean value of the result in accordance with the XPath 1.0 spec.
|
||||
|
||||
```js
|
||||
numberValue() -> number
|
||||
```
|
||||
|
||||
Returns the numeric value of the result in accordance with the XPath 1.0 spec.
|
||||
|
||||
```js
|
||||
stringValue() -> string
|
||||
```
|
||||
|
||||
Returns the string value of the result in accordance with the XPath 1.0 spec.
|
||||
|
||||
## Methods and properties that are only present on `XPathResult`s representing node sets
|
||||
|
||||
```js
|
||||
toArray() -> Array of nodes
|
||||
```
|
||||
|
||||
Returns an array of the nodes in the node set, in document order.
|
||||
|
||||
```js
|
||||
first() -> Node
|
||||
```
|
||||
|
||||
Returns the first node in the node set, in document order.
|
||||
|
||||
```js
|
||||
size -> number
|
||||
```
|
||||
|
||||
Returns the number of nodes in this node set
|
||||
|
||||
|
||||
|
||||
88
node_modules/xpath/docs/function resolvers.md
generated
vendored
88
node_modules/xpath/docs/function resolvers.md
generated
vendored
@ -1,88 +0,0 @@
|
||||
# Function Resolvers
|
||||
|
||||
The methods on the [XPathEvaluator](XPathEvaluator.md) type can optionally take a function resolver to resolve
|
||||
function references in the XPath expression being evaluated.
|
||||
|
||||
There are three ways to specify a function resolver and you can use any one of them depending on which is
|
||||
most suited to your particular situation.
|
||||
|
||||
Note that if your functions are in a namespace (e.g. `fn:myFunction()`), you must use the second or third
|
||||
type as the plain object implementation does not support namespaces.
|
||||
|
||||
## Function implementations
|
||||
|
||||
Custom XPath functions are implemented as JavaScript functions taking one or more arguments.
|
||||
|
||||
The first argument passed in is a context object containing a number of properties relating to the execution context,
|
||||
the most important being `contextNode`, the context in which the function is being evaluated.
|
||||
|
||||
The remaining arguments are the arguments passed into the XPath function, as instances of the `XPathResult` interface.
|
||||
Please see [the documentation on that interface](XPathResult.md) for details.
|
||||
|
||||
As the return value, you can return a string, number, boolean, single node, or array of nodes.
|
||||
|
||||
## Function Resolver Type 1: Plain object
|
||||
|
||||
A plain object with function names as the keys and function implementations as the values.
|
||||
|
||||
|
||||
Example usage:
|
||||
|
||||
```js
|
||||
var evaluator = xpath.parse('squareRoot(10)');
|
||||
var aboutPi = evaluator.evaluateNumber({
|
||||
functions: {
|
||||
'squareRoot': function (c, value) {
|
||||
return Math.sqrt(value.numberValue());
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## Function Resolver Type 2: Function
|
||||
|
||||
A function that takes a function name as its first parameter and an optional namespace URI as its second parameter
|
||||
and returns a function based on the name and namespace.
|
||||
|
||||
Example usage:
|
||||
|
||||
```js
|
||||
var evaluator = xpath.parse('math:squareRoot(10)');
|
||||
var aboutPi = evaluator.evaluateNumber({
|
||||
functions: function (name, namespace) {
|
||||
if (name === 'squareRoot' && namespace === 'http://sample.org/math/') {
|
||||
return function (c, value) {
|
||||
return Math.sqrt(value.numberValue());
|
||||
};
|
||||
}
|
||||
},
|
||||
namespaces: {
|
||||
math: 'http://sample.org/math/'
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## Function Resolver Type 3: Object with `getFunction` method
|
||||
|
||||
An object with a method named `getFunction` that works in the same way as the function-based function resolver
|
||||
described above.
|
||||
|
||||
Example usage:
|
||||
|
||||
```js
|
||||
var evaluator = xpath.parse('math:squareRoot(10)');
|
||||
var aboutPi = evaluator.evaluateNumber({
|
||||
functions: {
|
||||
getFunction: function (name, namespace) {
|
||||
if (name === 'squareRoot' && namespace === 'http://sample.org/math/') {
|
||||
return function (c, value) {
|
||||
return Math.sqrt(value.numberValue());
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
namespaces: {
|
||||
math: 'http://sample.org/math/'
|
||||
}
|
||||
});
|
||||
```
|
||||
69
node_modules/xpath/docs/namespace resolvers.md
generated
vendored
69
node_modules/xpath/docs/namespace resolvers.md
generated
vendored
@ -1,69 +0,0 @@
|
||||
# Namespace Resolvers
|
||||
|
||||
The methods on the [XPathEvaluator](XPathEvaluator.md) type can optionally take a namespace resolver to resolve
|
||||
namespace references in the XPath expression being evaluated.
|
||||
|
||||
There are three ways to specify a namespace resolver and you can use any one of them depending on which is
|
||||
most suited to your particular situation.
|
||||
|
||||
## Namespace Resolver Type 1: Plain object
|
||||
|
||||
A plain object with namespace prefixes as the keys and namespace URIs as the values:
|
||||
|
||||
Example usage:
|
||||
|
||||
```js
|
||||
var evaluator = xpath.parse('/bk:book/hp:characters');
|
||||
var characters = evaluator.select({
|
||||
node: myBookNode,
|
||||
namespaces: {
|
||||
'bk': 'http://sample.org/books/',
|
||||
'hp': 'http://sample.org/harrypotter/'
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## Namespace Resolver Type 2: Function
|
||||
|
||||
A function that takes a namespace prefix as a parameter and returns the corresponding namespace URI.
|
||||
|
||||
Example usage:
|
||||
|
||||
```js
|
||||
var evaluator = xpath.parse('/bk:book/hp:characters');
|
||||
var characters = evaluator.select({
|
||||
node: myBookNode,
|
||||
namespaces: function (prefix) {
|
||||
if (prefix === 'bk') {
|
||||
return 'http://sample.org/books/';
|
||||
}
|
||||
if (prefix === 'hp') {
|
||||
return 'http://sample.org/books/';
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## Namespace Resolver Type 3: Object with `getNamespace` method
|
||||
|
||||
An object with a method named `getNamespace` that works in the same way as the function-based namespace resolver
|
||||
described above.
|
||||
|
||||
Example usage:
|
||||
|
||||
```js
|
||||
var evaluator = xpath.parse('/bk:book/hp:characters');
|
||||
var characters = evaluator.select({
|
||||
node: myBookNode,
|
||||
namespaces: {
|
||||
getNamespace: function (prefix) {
|
||||
if (prefix === 'bk') {
|
||||
return 'http://sample.org/books/';
|
||||
}
|
||||
if (prefix === 'hp') {
|
||||
return 'http://sample.org/books/';
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
21
node_modules/xpath/docs/parsed expressions.md
generated
vendored
21
node_modules/xpath/docs/parsed expressions.md
generated
vendored
@ -1,21 +0,0 @@
|
||||
# Using Parsed Expressions
|
||||
|
||||
The `xpath.parse()` method allows pre-parsing an XPath expression and creating an XPath executor to evaluate the XPath as many times as needed.
|
||||
|
||||
This can provide a performance benefit if you plan to evaluate the same XPath multiple times, because the expression only needs to be parsed once.
|
||||
|
||||
This also provides access to additional features such as the use of variables and custom XPath functions, which are not available using the evaluation methods on the `xpath` object.
|
||||
|
||||
#### xpath.parse(expression)
|
||||
|
||||
Parses the specified XPath expression and returns an `XPathEvaluator`. See the [documentation page](XPathEvaluator.md) for API details.
|
||||
|
||||
`expression` should be a string.
|
||||
|
||||
Example usage:
|
||||
|
||||
```js
|
||||
var evaluator = xpath.parse('/book/characters');
|
||||
```
|
||||
|
||||
|
||||
89
node_modules/xpath/docs/variable resolvers.md
generated
vendored
89
node_modules/xpath/docs/variable resolvers.md
generated
vendored
@ -1,89 +0,0 @@
|
||||
# Variable Resolvers
|
||||
|
||||
The methods on the [XPathEvaluator](#) type can optionally take a variable resolver to resolve
|
||||
variable references in the XPath expression being evaluated.
|
||||
|
||||
There are three ways to specify a variable resolver and you can use any one of them depending on which is
|
||||
most suited to your particular situation.
|
||||
|
||||
Note that if your variables are in a namespace (e.g. `$myVars:var`), you must use the second or third
|
||||
type as the plain object implementation does not support namespaces.
|
||||
|
||||
## Variable values
|
||||
|
||||
You can use any of five types of values to specify the values of variables:
|
||||
|
||||
- string
|
||||
- number
|
||||
- boolean
|
||||
- single node (will be treated as a node set)
|
||||
- array of nodes or array-like collection of nodes (will be treated as a node set)
|
||||
|
||||
## Variable Resolver Type 1: Plain object
|
||||
|
||||
A plain object with variable names as the keys and variable values as the values.
|
||||
|
||||
Example usage:
|
||||
|
||||
````
|
||||
var evaluator = xpath.parse('concat($character1, ", ", $character2, ", and ", $character3)');
|
||||
var mainCharacters = evaluator.evaluateString({
|
||||
variables: {
|
||||
character1: 'Harry',
|
||||
character2: 'Ron',
|
||||
character3: 'Hermione'
|
||||
}
|
||||
});
|
||||
````
|
||||
|
||||
## Variable Resolver Type 2: Function
|
||||
|
||||
A function that takes a variable name as its first parameter and an optional namespace URI as its second parameter
|
||||
and returns a value based on the name and namespace.
|
||||
|
||||
Example usage:
|
||||
|
||||
````
|
||||
var evaluator = xpath.parse('concat($hp:character1, ", ", $hp:character2, ", and ", $hp:character3)');
|
||||
var mainCharacters = evaluator.evaluateString({
|
||||
variables: function (name, namespace) {
|
||||
if (namespace === 'http://sample.org/harrypotter/') {
|
||||
switch (name) {
|
||||
case 'character1': return 'Harry';
|
||||
case 'character2': return 'Ron';
|
||||
case 'character3': return 'Hermione';
|
||||
}
|
||||
}
|
||||
},
|
||||
namespaces: {
|
||||
hp: 'http://sample.org/harrypotter/'
|
||||
}
|
||||
});
|
||||
````
|
||||
|
||||
## Function Resolver Type 3: Object with `getFunction` method
|
||||
|
||||
An object with a method named `getVariable` that works in the same way as the function-based variable resolver
|
||||
described above.
|
||||
|
||||
Example usage:
|
||||
|
||||
````
|
||||
var evaluator = xpath.parse('concat($hp:character1, ", ", $hp:character2, ", and ", $hp:character3)');
|
||||
var mainCharacters = evaluator.evaluateString({
|
||||
variables: {
|
||||
getVariable: function (name, namespace) {
|
||||
if (namespace === 'http://sample.org/harrypotter/') {
|
||||
switch (name) {
|
||||
case 'character1': return 'Harry';
|
||||
case 'character2': return 'Ron';
|
||||
case 'character3': return 'Hermione';
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
namespaces: {
|
||||
hp: 'http://sample.org/harrypotter/'
|
||||
}
|
||||
});
|
||||
````
|
||||
39
node_modules/xpath/docs/xpath methods.md
generated
vendored
39
node_modules/xpath/docs/xpath methods.md
generated
vendored
@ -1,39 +0,0 @@
|
||||
# xpath methods
|
||||
|
||||
This page details the methods exposed on the `xpath` object.
|
||||
|
||||
### `xpath.parse(expression)`
|
||||
|
||||
Creates a parsed expression. See the [documentation page](parsed%20expressions.md) for details.
|
||||
|
||||
### `xpath.select(expression[, node[, single]])`
|
||||
|
||||
Evaluates an XPath expression and returns the result. The return value is determined based on the result type of the expression (which can always be predicted ahead of time based on the expression's syntax):
|
||||
|
||||
- A boolean value if the expression evaluates to a boolean value.
|
||||
- A number if the expression evaluates to a numeric value.
|
||||
- A string if the expression evaluates to a string.
|
||||
- If the expression evaluates to a nodeset:
|
||||
- An array of 0 or more nodes if `single` is unspecified or falsy
|
||||
- A single node (the first node in document order) or `undefined` if `single` is truthy
|
||||
|
||||
`node` is optional and if specified, is used as the context node for evaluating the expression. (It is necessary if the expression makes use of the current contex.)
|
||||
|
||||
`single` is optional and is ignored if the expression evaluates to anything other than a nodeset.
|
||||
|
||||
### `xpath.select1(expression[, node])`
|
||||
|
||||
Alias for [`xpath.select(expression, node, true)`](#xpathselectexpression-node-single). Selects a single node or value.
|
||||
|
||||
### `xpath.useNamespaces(mappings)`
|
||||
|
||||
Produces a function with the same signature as [`xpath.select()`](#xpathselectexpression-node-single) that evaluates the provided xpath expression using the XML namespace definitions provided in `mapppings`.
|
||||
|
||||
`mappings` should be an object with namespace prefixes as its property names and namespace URIs as its property values.
|
||||
|
||||
Example usage:
|
||||
|
||||
```js
|
||||
var expr = xpath.useNamespaces({ hp: 'http://www.example.com/harryPotter', bk: 'http://www.example.com/books' });
|
||||
var result = expr('/bk:books/bk:book[@name = "Harry Potter and the Half-Blood Prince"]/hp:characters', myBooks);
|
||||
```
|
||||
42
node_modules/xpath/package.json
generated
vendored
42
node_modules/xpath/package.json
generated
vendored
@ -1,42 +0,0 @@
|
||||
{
|
||||
"name": "xpath",
|
||||
"version": "0.0.27",
|
||||
"description": "DOM 3 XPath implemention and helper for node.js.",
|
||||
"engines": {
|
||||
"node": ">=0.6.0"
|
||||
},
|
||||
"author": {
|
||||
"name": "Cameron McCormack"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "goto100"
|
||||
},
|
||||
{
|
||||
"name": "James Rishe"
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"nodeunit": ">=0.6.4",
|
||||
"xmldom": "^0.1.19"
|
||||
},
|
||||
"typings": "./xpath.d.ts",
|
||||
"scripts": {
|
||||
"test": "./node_modules/.bin/nodeunit test.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/goto100/xpath.git"
|
||||
},
|
||||
"main": "./xpath.js",
|
||||
"keywords": [
|
||||
"xpath",
|
||||
"xml"
|
||||
],
|
||||
"license": "MIT"
|
||||
|
||||
,"_resolved": "https://registry.npmjs.org/xpath/-/xpath-0.0.27.tgz"
|
||||
,"_integrity": "sha512-fg03WRxtkCV6ohClePNAECYsmpKKTv5L8y/X3Dn1hQrec3POx2jHZ/0P2qQ6HvsrU1BmeqXcof3NGGueG6LxwQ=="
|
||||
,"_from": "xpath@0.0.27"
|
||||
}
|
||||
1092
node_modules/xpath/test.js
generated
vendored
1092
node_modules/xpath/test.js
generated
vendored
File diff suppressed because it is too large
Load Diff
9
node_modules/xpath/xpath.d.ts
generated
vendored
9
node_modules/xpath/xpath.d.ts
generated
vendored
@ -1,9 +0,0 @@
|
||||
type SelectedValue = Node | Attr | string | number | boolean;
|
||||
interface XPathSelect {
|
||||
(expression: string, node?: Node): Array<SelectedValue>;
|
||||
(expression: string, node: Node, single: true): SelectedValue;
|
||||
}
|
||||
export var select: XPathSelect;
|
||||
export function select1(expression: string, node?: Node): SelectedValue;
|
||||
export function evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver, type: number, result: XPathResult): XPathResult;
|
||||
export function useNamespaces(namespaceMap: { [name: string]: string }): XPathSelect;
|
||||
4764
node_modules/xpath/xpath.js
generated
vendored
4764
node_modules/xpath/xpath.js
generated
vendored
File diff suppressed because it is too large
Load Diff
12034
package-lock.json
generated
12034
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
11
package.json
11
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "maven-settings-action",
|
||||
"version": "1.0.0",
|
||||
"version": "2.4.0",
|
||||
"description": "Prepare maven settings",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@ -24,12 +24,11 @@
|
||||
},
|
||||
"homepage": "https://github.com/s4u/maven-settings-action#readme",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.2.3",
|
||||
"xmldom": "^0.3.0",
|
||||
"xpath": "0.0.27"
|
||||
"@actions/core": "^1.2.6",
|
||||
"xmldom": "^0.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^6.8.0",
|
||||
"jest": "^25.1.0"
|
||||
"eslint": "^7.20.0",
|
||||
"jest": "^26.6.3"
|
||||
}
|
||||
}
|
||||
|
||||
165
settings.js
165
settings.js
@ -28,15 +28,13 @@ const path = require('path');
|
||||
const fs = require('fs');
|
||||
const DOMParser = require('xmldom').DOMParser;
|
||||
const XMLSerializer = require('xmldom').XMLSerializer;
|
||||
const xpath = require('xpath');
|
||||
|
||||
|
||||
function getSettingsPath() {
|
||||
return path.join(os.homedir(), '.m2', 'settings.xml');
|
||||
}
|
||||
|
||||
function getSettingsTemplate() {
|
||||
const templatePath = path.join(__dirname, 'templates', 'settings.xml');
|
||||
function getTemplate(templateName) {
|
||||
const templatePath = path.join(__dirname, 'templates', templateName);
|
||||
const templateStr = fs.readFileSync(templatePath).toString();
|
||||
return new DOMParser().parseFromString(templateStr, 'text/xml');
|
||||
}
|
||||
@ -52,43 +50,101 @@ function writeSettings(settingsPath, templateXml) {
|
||||
fs.writeFileSync(settingsPath, settingStr);
|
||||
}
|
||||
|
||||
function createElementWithText(template, tag, text) {
|
||||
const tagXml = template.createElement(tag);
|
||||
tagXml.textContent = text;
|
||||
return tagXml;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
function fillServer(template, id, username, password) {
|
||||
function fillServer(templateXml, templateName, id, username, password, privateKey, passphrase, filePermissions, directoryPermissions, configurations) {
|
||||
|
||||
const serverXml = template.createElement('server');
|
||||
|
||||
if (!id || !username || !password) {
|
||||
core.setFailed('servers must contain id, username and password');
|
||||
if (!id || (!username && !configurations)) {
|
||||
core.setFailed(templateName + ' must contain id, and username or configuration');
|
||||
return;
|
||||
}
|
||||
|
||||
const idXml = createElementWithText(template, 'id', id);
|
||||
serverXml.appendChild(idXml);
|
||||
const serverXml = getTemplate(templateName + '.xml')
|
||||
serverXml.getElementsByTagName('id')[0].textContent = id;
|
||||
|
||||
const usernameXml = createElementWithText(template, 'username', username);
|
||||
serverXml.appendChild(usernameXml);
|
||||
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 passwordXml = createElementWithText(template, 'password', password);
|
||||
serverXml.appendChild(passwordXml);
|
||||
const configurationTag = serverXml.getElementsByTagName('configuration')[0];
|
||||
if (configurations) {
|
||||
jsonToXml(templateXml, configurationTag, configurations);
|
||||
} else {
|
||||
if (configurationTag.childNodes.length == 0) {
|
||||
serverXml.documentElement.removeChild(configurationTag);
|
||||
}
|
||||
}
|
||||
|
||||
const serversXml = template.getElementsByTagName('servers')[0];
|
||||
const serversXml = templateXml.getElementsByTagName('servers')[0];
|
||||
serversXml.appendChild(serverXml);
|
||||
}
|
||||
|
||||
function fillServers(template) {
|
||||
function fillServers(template, templateName) {
|
||||
|
||||
const servers = core.getInput('servers');
|
||||
const servers = core.getInput(templateName);
|
||||
|
||||
if (!servers) {
|
||||
return;
|
||||
}
|
||||
|
||||
JSON.parse(servers).forEach((server) => fillServer(template, 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) {
|
||||
|
||||
if (!id || !name || !mirrorOf || !url) {
|
||||
core.setFailed('mirrors must contain id, name, mirrorOf and url');
|
||||
return;
|
||||
}
|
||||
|
||||
const mirrorXml = getTemplate('mirrors.xml');
|
||||
mirrorXml.getElementsByTagName('id')[0].textContent = id;
|
||||
mirrorXml.getElementsByTagName('name')[0].textContent = name;
|
||||
mirrorXml.getElementsByTagName('mirrorOf')[0].textContent = mirrorOf;
|
||||
mirrorXml.getElementsByTagName('url')[0].textContent = url;
|
||||
|
||||
const mirrorsXml = template.getElementsByTagName('mirrors')[0];
|
||||
mirrorsXml.appendChild(mirrorXml);
|
||||
}
|
||||
|
||||
function fillMirrors(template) {
|
||||
|
||||
const mirrors = core.getInput('mirrors');
|
||||
|
||||
if (!mirrors) {
|
||||
return;
|
||||
}
|
||||
|
||||
JSON.parse(mirrors).forEach((mirror) => fillMirror(template, mirror.id, mirror.name, mirror.mirrorOf, mirror.url));
|
||||
}
|
||||
|
||||
function isInputTrue(inputName) {
|
||||
@ -102,42 +158,54 @@ function fillServerForGithub(templateXml) {
|
||||
return;
|
||||
}
|
||||
|
||||
fillServer(templateXml, 'github', '${env.GITHUB_ACTOR}', '${env.GITHUB_TOKEN}');
|
||||
}
|
||||
|
||||
function activateProfile(template, profileId) {
|
||||
const activeByDefault = xpath
|
||||
.select(`/settings/profiles/profile[id[contains(text(),"${profileId}")]]/activation/activeByDefault`, template);
|
||||
|
||||
if (activeByDefault) {
|
||||
activeByDefault[0].textContent = 'true';
|
||||
}
|
||||
fillServer(templateXml, 'servers', 'github', '${env.GITHUB_ACTOR}', '${env.GITHUB_TOKEN}');
|
||||
}
|
||||
|
||||
function fillProperties(template) {
|
||||
|
||||
const properties = core.getInput('properties');
|
||||
|
||||
if (!properties) {
|
||||
return;
|
||||
}
|
||||
|
||||
activateProfile(template, '_properties_')
|
||||
const propertiesXml = xpath
|
||||
.select(`/settings/profiles/profile[id[contains(text(),"_properties_")]]/properties`, template)[0];
|
||||
const propertiesProfileXml = getTemplate('properties.xml');
|
||||
const propertiesXml = propertiesProfileXml.getElementsByTagName('properties')[0];
|
||||
|
||||
JSON.parse(properties).forEach((property) => {
|
||||
|
||||
for (const key in property) {
|
||||
const keyXml = template.createElement(key);
|
||||
keyXml.textContent = property[key];
|
||||
propertiesXml.appendChild(keyXml);
|
||||
}
|
||||
});
|
||||
|
||||
const profilesXml = template.getElementsByTagName('profiles')[0];
|
||||
profilesXml.appendChild(propertiesProfileXml);
|
||||
|
||||
}
|
||||
|
||||
function addProfile(template, profileName) {
|
||||
const sonatypeXml = getTemplate(profileName);
|
||||
const profilesXml = template.getElementsByTagName('profiles')[0];
|
||||
profilesXml.appendChild(sonatypeXml);
|
||||
}
|
||||
|
||||
function addApacheSnapshots(template) {
|
||||
if (isInputTrue('apacheSnapshots')) {
|
||||
addProfile(template, 'apache-snapshot.xml')
|
||||
}
|
||||
}
|
||||
|
||||
function addSonatypeSnapshots(template) {
|
||||
if (isInputTrue('sonatypeSnapshots')) {
|
||||
activateProfile(template, '_sonatype-snapshots_')
|
||||
addProfile(template, 'sonatype-snapshot.xml')
|
||||
}
|
||||
}
|
||||
|
||||
function addOracleRepo(template) {
|
||||
if (isInputTrue('oracleRepo')) {
|
||||
addProfile(template, 'oracle-repo.xml')
|
||||
}
|
||||
}
|
||||
|
||||
@ -156,12 +224,16 @@ function generate() {
|
||||
}
|
||||
}
|
||||
|
||||
const templateXml = getSettingsTemplate();
|
||||
fillServers(templateXml);
|
||||
fillServerForGithub(templateXml);
|
||||
fillProperties(templateXml);
|
||||
addSonatypeSnapshots(templateXml);
|
||||
writeSettings(settingsPath, templateXml);
|
||||
const settingsXml = getTemplate('settings.xml');
|
||||
fillMirrors(settingsXml);
|
||||
fillServers(settingsXml, 'servers');
|
||||
fillServers(settingsXml, 'oracleServers');
|
||||
fillServerForGithub(settingsXml);
|
||||
fillProperties(settingsXml);
|
||||
addApacheSnapshots(settingsXml);
|
||||
addSonatypeSnapshots(settingsXml);
|
||||
addOracleRepo(settingsXml);
|
||||
writeSettings(settingsPath, settingsXml);
|
||||
core.saveState('maven-settings', 'ok');
|
||||
}
|
||||
|
||||
@ -182,12 +254,15 @@ function cleanup() {
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getSettingsTemplate,
|
||||
getTemplate,
|
||||
writeSettings,
|
||||
fillMirrors,
|
||||
fillServers,
|
||||
fillServerForGithub,
|
||||
fillProperties,
|
||||
addApacheSnapshots,
|
||||
addSonatypeSnapshots,
|
||||
addOracleRepo,
|
||||
generate,
|
||||
cleanup
|
||||
}
|
||||
|
||||
469
settings.test.js
469
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>
|
||||
@ -99,8 +107,7 @@ afterEach(() => {
|
||||
});
|
||||
|
||||
test('template should be read', () => {
|
||||
|
||||
const template = settings.getSettingsTemplate();
|
||||
const template = settings.getTemplate('settings.xml');
|
||||
|
||||
expect(template).toBeDefined();
|
||||
});
|
||||
@ -120,9 +127,9 @@ 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);
|
||||
settings.fillServers(xml, 'servers');
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml);
|
||||
|
||||
@ -131,119 +138,447 @@ 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);
|
||||
settings.fillServers(xml, 'servers');
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml);
|
||||
expect(xmlAsString(xml)).toBe(`<servers>
|
||||
<server>
|
||||
<id>id1</id>
|
||||
<username>username1</username>
|
||||
<password>password1</password>
|
||||
</server></servers>`);
|
||||
|
||||
expect(xmlStr).toBe("<servers>" +
|
||||
"<server><id>id1</id><username>username1</username><password>password1</password></server>" +
|
||||
"</servers>");
|
||||
});
|
||||
|
||||
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);
|
||||
settings.fillServers(xml, 'servers');
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml);
|
||||
|
||||
expect(xmlStr).toBe("<servers>" +
|
||||
"<server><id>id1</id><username>username1</username><password>password1</password></server>" +
|
||||
"<server><id>id2</id><username>username2</username><password>password2</password></server>" +
|
||||
"</servers>");
|
||||
expect(xmlAsString(xml)).toBe(`<servers>
|
||||
<server>
|
||||
<id>id1</id>
|
||||
<username>username1</username>
|
||||
<password>password1</password>
|
||||
</server>
|
||||
<server>
|
||||
<id>id2</id>
|
||||
<username>username2</username>
|
||||
<password>password2</password>
|
||||
</server></servers>`);
|
||||
});
|
||||
|
||||
test('fillServers incorrect fields', () => {
|
||||
test('fill servers incorrect fields', () => {
|
||||
|
||||
const xml = new DOMParser().parseFromString("<servers/>");
|
||||
const xml = stringAsXml("<servers/>");
|
||||
|
||||
process.env['INPUT_SERVERS'] = '[{"idx": "id1"}]';
|
||||
|
||||
settings.fillServers(xml);
|
||||
settings.fillServers(xml, 'servers');
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml);
|
||||
|
||||
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 = stringAsXml("<servers/>");
|
||||
|
||||
process.env['INPUT_ORACLESERVERS'] = '[{"id": "id1", "username": "username1", "password":"password1"}]';
|
||||
|
||||
settings.fillServers(xml, 'oracleServers');
|
||||
|
||||
expect(xmlAsString(xml)).toBe(`<servers>
|
||||
<server>
|
||||
<id>id1</id>
|
||||
<username>username1</username>
|
||||
<password>password1</password>
|
||||
<configuration>
|
||||
<basicAuthScope>
|
||||
<host>ANY</host>
|
||||
<port>ANY</port>
|
||||
<realm>OAM 11g</realm>
|
||||
</basicAuthScope>
|
||||
<httpConfiguration>
|
||||
<all>
|
||||
<params>
|
||||
<property>
|
||||
<name>http.protocol.allow-circular-redirects</name>
|
||||
<value>%b,true</value>
|
||||
</property>
|
||||
</params>
|
||||
</all>
|
||||
</httpConfiguration>
|
||||
</configuration>
|
||||
</server></servers>`);
|
||||
});
|
||||
|
||||
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><server><id>github</id><username>${env.GITHUB_ACTOR}</username><password>${env.GITHUB_TOKEN}</password></server></servers>');
|
||||
expect(xmlAsString(xml)).toBe(`<servers>
|
||||
<server>
|
||||
<id>github</id>
|
||||
<username>\${env.GITHUB_ACTOR}</username>
|
||||
<password>\${env.GITHUB_TOKEN}</password>
|
||||
</server></servers>`);
|
||||
expect(consoleOutput).toEqual([]);
|
||||
});
|
||||
|
||||
test('addSonatypeSnapshots activate', () => {
|
||||
test('fillMirrors do nothing if no params', () => {
|
||||
|
||||
const xml = stringAsXml("<mirrors/>");
|
||||
|
||||
settings.fillMirrors(xml);
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml);
|
||||
|
||||
expect(xmlStr).toBe("<mirrors/>");
|
||||
expect(consoleOutput).toEqual([]);
|
||||
});
|
||||
|
||||
test('fillMirrors one mirror', () => {
|
||||
|
||||
const xml = stringAsXml("<mirrors/>");
|
||||
|
||||
process.env['INPUT_MIRRORS'] = '[{"id": "id1", "name": "name", "mirrorOf":"mirrorOf", "url":"url"}]';
|
||||
|
||||
settings.fillMirrors(xml);
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml);
|
||||
|
||||
expect(xmlStr).toBe(`<mirrors>
|
||||
<mirror>
|
||||
<id>id1</id>
|
||||
<name>name</name>
|
||||
<mirrorOf>mirrorOf</mirrorOf>
|
||||
<url>url</url>
|
||||
</mirror></mirrors>`);
|
||||
expect(consoleOutput).toEqual([]);
|
||||
});
|
||||
|
||||
test('fillMirrors two 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"}]';
|
||||
|
||||
settings.fillMirrors(xml);
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml);
|
||||
|
||||
expect(xmlStr).toBe(`<mirrors>
|
||||
<mirror>
|
||||
<id>id1</id>
|
||||
<name>name1</name>
|
||||
<mirrorOf>mirrorOf1</mirrorOf>
|
||||
<url>url1</url>
|
||||
</mirror>
|
||||
<mirror>
|
||||
<id>id2</id>
|
||||
<name>name2</name>
|
||||
<mirrorOf>mirrorOf2</mirrorOf>
|
||||
<url>url2</url>
|
||||
</mirror></mirrors>`);
|
||||
expect(consoleOutput).toEqual([]);
|
||||
});
|
||||
|
||||
test('fillMirrors incorrect fields', () => {
|
||||
|
||||
const xml = stringAsXml("<mirrors/>");
|
||||
|
||||
process.env['INPUT_MIRRORS'] = '[{"idx": "id1"}]';
|
||||
|
||||
settings.fillMirrors(xml);
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml);
|
||||
|
||||
expect(xmlStr).toBe('<mirrors/>');
|
||||
expect(consoleOutput).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.stringMatching(/::error::mirrors must contain id, name, mirrorOf and url/)
|
||||
])
|
||||
);
|
||||
});
|
||||
|
||||
test('addApacheSnapshots', () => {
|
||||
|
||||
process.env['INPUT_APACHESNAPSHOTS'] = "true";
|
||||
|
||||
const xml = stringAsXml('<profiles/>');
|
||||
|
||||
settings.addApacheSnapshots(xml);
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml);
|
||||
expect(xmlStr).toBe(`<profiles>
|
||||
<profile>
|
||||
<id>_apache-snapshots_</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>apache.snapshots.https</id>
|
||||
<url>https://repository.apache.org/snapshots/</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>apache.snapshots.https</id>
|
||||
<url>https://repository.apache.org/snapshots/</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</profile></profiles>`);
|
||||
});
|
||||
|
||||
test('addSonatypeSnapshots', () => {
|
||||
|
||||
process.env['INPUT_SONATYPESNAPSHOTS'] = "true";
|
||||
|
||||
settings.addSonatypeSnapshots(xmlTestProfile);
|
||||
const xml = stringAsXml('<profiles/>');
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xmlTestProfile);
|
||||
expect(xmlStr).toBe(`<settings>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>_properties_</id>
|
||||
<activation>
|
||||
<activeByDefault>false</activeByDefault>
|
||||
</activation>
|
||||
<properties/>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>_sonatype-snapshots_</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
</profile>
|
||||
</profiles>
|
||||
</settings>`);
|
||||
settings.addSonatypeSnapshots(xml);
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml);
|
||||
expect(xmlStr).toBe(`<profiles>
|
||||
<profile>
|
||||
<id>_sonatype-snapshots_</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>sonatype-snapshots</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>sonatype-snapshots</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</profile></profiles>`);
|
||||
});
|
||||
|
||||
test('addOracleRepo', () => {
|
||||
|
||||
process.env['INPUT_ORACLEREPO'] = "true";
|
||||
|
||||
const xml = stringAsXml('<profiles/>');
|
||||
|
||||
settings.addOracleRepo(xml);
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml);
|
||||
expect(xmlStr).toBe(`<profiles>
|
||||
<profile>
|
||||
<id>_maven.oracle.com_</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>maven.oracle.com</id>
|
||||
<url>https://maven.oracle.com</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>maven.oracle.com</id>
|
||||
<url>https://maven.oracle.com</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</profile></profiles>`);
|
||||
});
|
||||
|
||||
test('fillProperties', () => {
|
||||
|
||||
process.env['INPUT_PROPERTIES'] = '[{"propertyName1": "propertyValue1"}, {"propertyName2": "propertyValue2"}]';
|
||||
|
||||
settings.fillProperties(xmlTestProfile);
|
||||
const xml = stringAsXml('<profiles/>');
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xmlTestProfile);
|
||||
expect(xmlStr).toBe(`<settings>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>_properties_</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties><propertyName1>propertyValue1</propertyName1><propertyName2>propertyValue2</propertyName2></properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>_sonatype-snapshots_</id>
|
||||
<activation>
|
||||
<activeByDefault>false</activeByDefault>
|
||||
</activation>
|
||||
</profile>
|
||||
</profiles>
|
||||
</settings>`);
|
||||
settings.fillProperties(xml);
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml);
|
||||
expect(xmlStr).toBe(`<profiles>
|
||||
<profile>
|
||||
<id>_properties_</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties><propertyName1>propertyValue1</propertyName1><propertyName2>propertyValue2</propertyName2></properties>
|
||||
</profile></profiles>`);
|
||||
})
|
||||
|
||||
test('fillProperties do nothing if no params', () => {
|
||||
|
||||
31
templates/apache-snapshot.xml
Normal file
31
templates/apache-snapshot.xml
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
<profile>
|
||||
<id>_apache-snapshots_</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>apache.snapshots.https</id>
|
||||
<url>https://repository.apache.org/snapshots/</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>apache.snapshots.https</id>
|
||||
<url>https://repository.apache.org/snapshots/</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</profile>
|
||||
7
templates/mirrors.xml
Normal file
7
templates/mirrors.xml
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
<mirror>
|
||||
<id/>
|
||||
<name/>
|
||||
<mirrorOf/>
|
||||
<url/>
|
||||
</mirror>
|
||||
31
templates/oracle-repo.xml
Normal file
31
templates/oracle-repo.xml
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
<profile>
|
||||
<id>_maven.oracle.com_</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>maven.oracle.com</id>
|
||||
<url>https://maven.oracle.com</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>maven.oracle.com</id>
|
||||
<url>https://maven.oracle.com</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</profile>
|
||||
27
templates/oracleServers.xml
Normal file
27
templates/oracleServers.xml
Normal file
@ -0,0 +1,27 @@
|
||||
|
||||
<server>
|
||||
<id />
|
||||
<username />
|
||||
<password />
|
||||
<privateKey />
|
||||
<passphrase />
|
||||
<filePermissions />
|
||||
<directoryPermissions />
|
||||
<configuration>
|
||||
<basicAuthScope>
|
||||
<host>ANY</host>
|
||||
<port>ANY</port>
|
||||
<realm>OAM 11g</realm>
|
||||
</basicAuthScope>
|
||||
<httpConfiguration>
|
||||
<all>
|
||||
<params>
|
||||
<property>
|
||||
<name>http.protocol.allow-circular-redirects</name>
|
||||
<value>%b,true</value>
|
||||
</property>
|
||||
</params>
|
||||
</all>
|
||||
</httpConfiguration>
|
||||
</configuration>
|
||||
</server>
|
||||
8
templates/properties.xml
Normal file
8
templates/properties.xml
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
<profile>
|
||||
<id>_properties_</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties />
|
||||
</profile>
|
||||
11
templates/servers.xml
Normal file
11
templates/servers.xml
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
<server>
|
||||
<id />
|
||||
<username />
|
||||
<password />
|
||||
<privateKey />
|
||||
<passphrase />
|
||||
<filePermissions />
|
||||
<directoryPermissions />
|
||||
<configuration />
|
||||
</server>
|
||||
@ -1,48 +1,6 @@
|
||||
<settings>
|
||||
|
||||
<interactiveMode>false</interactiveMode>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>_properties_</id>
|
||||
<activation>
|
||||
<activeByDefault>false</activeByDefault>
|
||||
</activation>
|
||||
<properties />
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>_sonatype-snapshots_</id>
|
||||
<activation>
|
||||
<activeByDefault>false</activeByDefault>
|
||||
</activation>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>sonatype-snapshots</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>sonatype-snapshots</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</profile>
|
||||
|
||||
</profiles>
|
||||
|
||||
<profiles/>
|
||||
<servers />
|
||||
<mirrors />
|
||||
</settings>
|
||||
|
||||
31
templates/sonatype-snapshot.xml
Normal file
31
templates/sonatype-snapshot.xml
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
<profile>
|
||||
<id>_sonatype-snapshots_</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>sonatype-snapshots</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>sonatype-snapshots</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</profile>
|
||||
Reference in New Issue
Block a user