mirror of
https://github.com/actions/setup-node.git
synced 2025-06-29 22:23:47 +00:00
test-cases
This commit is contained in:
parent
6a4f7710a5
commit
9312b4364b
7 changed files with 199 additions and 205 deletions
|
@ -10,22 +10,22 @@ export default class NightlyNodejs extends BasePrereleaseNodejs {
|
|||
super(nodeInfo);
|
||||
}
|
||||
|
||||
protected getDistributionMirrorUrl(): string {
|
||||
// Implement the method to return the mirror URL or an empty string if not available
|
||||
return this.nodeInfo.mirrorURL || '';
|
||||
}
|
||||
|
||||
// Updated getDistributionUrl method to handle mirror URL or fallback
|
||||
protected getDistributionUrl(): string {
|
||||
// Check if mirrorUrl exists in the nodeInfo and return it if available
|
||||
const mirrorUrl = this.nodeInfo.mirrorURL;
|
||||
if (mirrorUrl) {
|
||||
core.info(`Downloding Using mirror URL: ${mirrorUrl}`);
|
||||
return mirrorUrl;
|
||||
|
||||
if (this.nodeInfo.mirrorURL) {
|
||||
if(this.nodeInfo.mirrorURL != '') {
|
||||
return this.nodeInfo.mirrorURL;
|
||||
}else{
|
||||
if(this.nodeInfo.mirrorURL === '') {
|
||||
throw new Error('Mirror URL is empty. Please provide a valid mirror URL.');
|
||||
}else{
|
||||
throw new Error('Mirror URL is not a valid');
|
||||
}
|
||||
}
|
||||
|
||||
// Default to the official Node.js nightly distribution URL if no mirror URL is provided
|
||||
core.info('Using default distribution URL for nightly Node.js.');
|
||||
|
||||
}else{
|
||||
return 'https://nodejs.org/download/nightly';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,9 @@ export default class OfficialBuilds extends BaseDistribution {
|
|||
|
||||
public async setupNodeJs() {
|
||||
if (this.nodeInfo.mirrorURL) {
|
||||
if (this.nodeInfo.mirrorURL === '') {
|
||||
throw new Error('Mirror URL is empty. Please provide a valid mirror URL.');
|
||||
}
|
||||
let downloadPath = '';
|
||||
let toolPath = '';
|
||||
try {
|
||||
|
|
|
@ -3,24 +3,30 @@ import {NodeInputs} from '../base-models';
|
|||
import * as core from '@actions/core';
|
||||
|
||||
export default class RcBuild extends BaseDistribution {
|
||||
getDistributionMirrorUrl() {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
constructor(nodeInfo: NodeInputs) {
|
||||
super(nodeInfo);
|
||||
}
|
||||
|
||||
getDistributionUrl(): string {
|
||||
protected getDistributionUrl(): string {
|
||||
|
||||
if (this.nodeInfo.mirrorURL) {
|
||||
if(this.nodeInfo.mirrorURL != '') {
|
||||
return this.nodeInfo.mirrorURL;
|
||||
}else{
|
||||
if(this.nodeInfo.mirrorURL === '') {
|
||||
throw new Error('Mirror URL is empty. Please provide a valid mirror URL.');
|
||||
}else{
|
||||
throw new Error('Mirror URL is not a valid');
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
return 'https://nodejs.org/download/rc';
|
||||
}
|
||||
|
||||
protected getDistributionMirrorUrl(): string {
|
||||
// Check if mirrorUrl exists in the nodeInfo and return it if available
|
||||
const mirrorUrl = this.nodeInfo.mirrorURL;
|
||||
if (mirrorUrl) {
|
||||
core.info(`Using mirror URL: ${mirrorUrl}`);
|
||||
return mirrorUrl;
|
||||
}
|
||||
|
||||
// Return the default URL if no mirror URL is provided
|
||||
return this.getDistributionUrl();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,16 +9,21 @@ export default class CanaryBuild extends BasePrereleaseNodejs {
|
|||
}
|
||||
|
||||
protected getDistributionUrl(): string {
|
||||
return 'https://nodejs.org/download/v8-canary';
|
||||
}
|
||||
|
||||
protected getDistributionMirrorUrl(): string {
|
||||
// Check if mirrorUrl exists in the nodeInfo and return it if available
|
||||
const mirrorUrl = this.nodeInfo.mirrorURL;
|
||||
if (mirrorUrl) {
|
||||
core.info(`Using mirror URL: ${mirrorUrl}`);
|
||||
return mirrorUrl;
|
||||
|
||||
if (this.nodeInfo.mirrorURL) {
|
||||
if(this.nodeInfo.mirrorURL != '') {
|
||||
return this.nodeInfo.mirrorURL;
|
||||
}else{
|
||||
if(this.nodeInfo.mirrorURL === '') {
|
||||
throw new Error('Mirror URL is empty. Please provide a valid mirror URL.');
|
||||
}else{
|
||||
throw new Error('Mirror URL is not a valid');
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
return 'https://nodejs.org/download/v8-canary';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue