back to building with ncc

This commit is contained in:
SamKirkland 2020-10-24 00:56:44 -05:00
parent c14c34b02c
commit 928e32c59b
6 changed files with 6783 additions and 131 deletions

View File

@ -43,7 +43,7 @@ inputs:
description: 'strict or loose'
runs:
using: 'node12'
main: 'dist/main.js'
main: 'dist/index.js'
branding:
icon: 'upload-cloud'
color: 'orange'

6772
dist/index.js vendored Normal file

File diff suppressed because it is too large Load Diff

128
dist/main.js vendored
View File

@ -1,128 +0,0 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(require("@actions/core"));
const ftp_deploy_1 = require("@samkirkland/ftp-deploy");
async function runDeployment() {
const args = {
server: core.getInput("server", { required: true }),
username: core.getInput("username", { required: true }),
password: core.getInput("password", { required: true }),
port: optionalInt("port", core.getInput("port")),
protocol: optionalProtocol("protocol", core.getInput("protocol")),
"local-dir": optionalString(core.getInput("local-dir")),
"server-dir": optionalString(core.getInput("server-dir")),
"state-name": optionalString(core.getInput("state-name")),
"dry-run": optionalBoolean("dry-run", core.getInput("dry-run")),
"dangerous-clean-slate": optionalBoolean("dangerous-clean-slate", core.getInput("dangerous-clean-slate")),
"exclude": optionalStringArray("exclude", core.getInput("exclude")),
"log-level": optionalLogLevel("log-level", core.getInput("log-level")),
"security": optionalSecurity("security", core.getInput("security"))
};
try {
await ftp_deploy_1.deploy(args);
}
catch (error) {
core.setFailed(error);
}
}
runDeployment();
function optionalString(rawValue) {
if (rawValue.length === 0) {
return undefined;
}
return rawValue;
}
function optionalBoolean(argumentName, rawValue) {
if (rawValue.length === 0) {
return undefined;
}
const cleanValue = rawValue.toLowerCase();
if (cleanValue === "true") {
return true;
}
if (cleanValue === "false") {
return false;
}
core.setFailed(`${argumentName}: invalid parameter - please use a boolean, you provided "${rawValue}". Try true or false instead.`);
}
function optionalProtocol(argumentName, rawValue) {
if (rawValue.length === 0) {
return undefined;
}
const cleanValue = rawValue.toLowerCase();
if (cleanValue === "ftp") {
return "ftp";
}
if (cleanValue === "ftps") {
return "ftps";
}
if (cleanValue === "ftps-legacy") {
return "ftps-legacy";
}
core.setFailed(`${argumentName}: invalid parameter - you provided "${rawValue}". Try "ftp", "ftps", or "ftps-legacy" instead.`);
}
function optionalLogLevel(argumentName, rawValue) {
if (rawValue.length === 0) {
return undefined;
}
const cleanValue = rawValue.toLowerCase();
if (cleanValue === "minimal") {
return "minimal";
}
if (cleanValue === "standard") {
return "standard";
}
if (cleanValue === "verbose") {
return "verbose";
}
core.setFailed(`${argumentName}: invalid parameter - you provided "${rawValue}". Try "minimal", "standard", or "verbose" instead.`);
}
function optionalSecurity(argumentName, rawValue) {
if (rawValue.length === 0) {
return undefined;
}
const cleanValue = rawValue.toLowerCase();
if (cleanValue === "loose") {
return "loose";
}
if (cleanValue === "strict") {
return "strict";
}
core.setFailed(`${argumentName}: invalid parameter - you provided "${rawValue}". Try "loose" or "strict" instead.`);
}
function optionalInt(argumentName, rawValue) {
if (rawValue.length === 0) {
return undefined;
}
const valueAsNumber = parseFloat(rawValue);
if (Number.isInteger(valueAsNumber)) {
return valueAsNumber;
}
core.setFailed(`${argumentName}: invalid parameter - you provided "${rawValue}". Try a whole number (no decimals) instead like 1234`);
}
function optionalStringArray(argumentName, rawValue) {
if (rawValue.length === 0) {
return undefined;
}
// split value by space and comma
return rawValue.split(", ");
}

6
package-lock.json generated
View File

@ -240,6 +240,12 @@
"eslint-visitor-keys": "^2.0.0"
}
},
"@vercel/ncc": {
"version": "0.24.1",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.24.1.tgz",
"integrity": "sha512-r9m7brz2hNmq5TF3sxrK4qR/FhXn44XIMglQUir4sT7Sh5GOaYXlMYikHFwJStf8rmQGTlvOoBXt4yHVonRG8A==",
"dev": true
},
"acorn": {
"version": "7.4.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.0.tgz",

View File

@ -3,9 +3,9 @@
"version": "1.0.1",
"private": true,
"description": "Automate deploying websites and more with this GitHub action",
"main": "dist/main.js",
"main": "dist/index.js",
"scripts": {
"build": "tsc",
"build": "ncc build src/main.ts --no-cache",
"lint": "eslint src/**/*.ts"
},
"repository": {
@ -28,6 +28,7 @@
"devDependencies": {
"@types/node": "^14.0.27",
"@typescript-eslint/parser": "^4.0.1",
"@vercel/ncc": "^0.24.0",
"eslint": "^7.8.1",
"js-yaml": "^3.14.0",
"typescript": "^4.0.2"

View File

@ -7,6 +7,7 @@
"strict": true, /* Enable all strict type-checking options. */
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
"noEmit": true
},
"exclude": [
"node_modules"