( id: string, username: string, password: string, gpgPassphrase?: string | undefined )
| 69 | |
| 70 | // only exported for testing purposes |
| 71 | export function generate( |
| 72 | id: string, |
| 73 | username: string, |
| 74 | password: string, |
| 75 | gpgPassphrase?: string | undefined |
| 76 | ) { |
| 77 | const xmlObj: {[key: string]: any} = { |
| 78 | settings: { |
| 79 | '@xmlns': 'http://maven.apache.org/SETTINGS/1.0.0', |
| 80 | '@xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance', |
| 81 | '@xsi:schemaLocation': |
| 82 | 'http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd', |
| 83 | servers: { |
| 84 | server: [ |
| 85 | { |
| 86 | id: id, |
| 87 | username: `\${env.${username}}`, |
| 88 | password: `\${env.${password}}` |
| 89 | } |
| 90 | ] |
| 91 | } |
| 92 | } |
| 93 | }; |
| 94 | |
| 95 | if (gpgPassphrase) { |
| 96 | const gpgServer = { |
| 97 | id: 'gpg.passphrase', |
| 98 | passphrase: `\${env.${gpgPassphrase}}` |
| 99 | }; |
| 100 | xmlObj.settings.servers.server.push(gpgServer); |
| 101 | } |
| 102 | |
| 103 | return xmlCreate(xmlObj).end({ |
| 104 | headless: true, |
| 105 | prettyPrint: true, |
| 106 | width: 80 |
| 107 | }); |
| 108 | } |
| 109 | |
| 110 | async function write( |
| 111 | directory: string, |
no outgoing calls
no test coverage detected