build: update build process

move build to github action;add .signore;add -e option to ncc to make @serverless-devs/core out of
ncc compile
This commit is contained in:
千风 2021-08-12 17:10:01 +08:00 committed by git-qfzhang
parent c3127e9425
commit f3a244a6e1
14 changed files with 33 additions and 161 deletions

View File

@ -21,9 +21,9 @@ jobs:
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install requests
# - name: NPM install
# run: |
# npm install --production
- name: Build
run: |
npm run build
- name: Add publish file
run: |
wget https://serverless-registry.oss-cn-hangzhou.aliyuncs.com/publish-file/python3/hub-publish.py

2
.gitignore vendored
View File

@ -5,3 +5,5 @@ node_modules
package-lock.json
.idea
.vscode
lib

26
Makefile Normal file
View File

@ -0,0 +1,26 @@
.PHONY: push
CURRENT_BRANCH_NAME := $(shell git symbolic-ref --short HEAD)
add:
git add .
commit: add
git-cz
rebase-main: commit
git pull --rebase origin master
push:
git push --force-with-lease origin $(CURRENT_BRANCH_NAME)
release-dev: push
-gh release delete dev -y
-git tag -d dev
-git push origin :refs/tags/dev
gh release create dev --notes "dev release" --target dev --title "Release dev"
roll-back-dev:
git reset --soft HEAD~1
git restore --staged publish.yaml
git restore publish.yaml

44
lib/common/help.d.ts vendored
View File

@ -1,44 +0,0 @@
declare const _default: ({
header: string;
content: string;
optionList?: undefined;
} | {
header: string;
optionList: ({
name: string;
description: string;
type: StringConstructor;
alias?: undefined;
} | {
name: string;
description: string;
alias: string;
type: StringConstructor;
} | {
name: string;
description: string;
type: BooleanConstructor;
alias?: undefined;
})[];
content?: undefined;
} | {
header: string;
optionList: {
name: string;
description: string;
alias: string;
type: BooleanConstructor;
}[];
content?: undefined;
} | {
header: string;
content: string[];
optionList?: undefined;
} | {
header: string;
content: {
example: string;
}[];
optionList?: undefined;
})[];
export default _default;

View File

@ -1,10 +0,0 @@
export default class ComponentLogger {
static CONTENT: string;
static setContent(content: any): void;
static log(m: any, color?: 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'whiteBright' | 'gray'): void;
static info(m: any): void;
static debug(m: any): void;
static error(m: any): void;
static warning(m: any): void;
static success(m: any): void;
}

View File

@ -1,4 +0,0 @@
export default class StdoutFormatter {
static stdoutFormatter: any;
static initStdout(): Promise<void>;
}

11
lib/index.d.ts vendored
View File

@ -1,11 +0,0 @@
import { InputProps } from './interface/entity';
export default class FcRemoteInvoke {
/**
* event
* @param inputs
* @returns
*/
invoke(inputs: InputProps): Promise<any>;
private report;
private handlerInputs;
}

File diff suppressed because one or more lines are too long

View File

@ -1,34 +0,0 @@
export interface ICredentials {
AccountID?: string;
AccessKeyID?: string;
AccessKeySecret?: string;
SecurityToken?: string;
}
export interface InputProps {
props?: IProperties;
credentials: ICredentials;
appName: string;
project: {
component: string;
access: string;
projectName: string;
};
command: string;
args: string;
path: {
configPath: string;
};
}
export interface IProperties {
region: string;
serviceName: string;
functionName: string;
qualifier?: string;
domainName?: string;
}
export declare function isProperties(args: any): args is IProperties;
export interface IEventPayload {
event?: string;
eventFile?: string;
eventStdin?: boolean;
}

5
lib/lib/client.d.ts vendored
View File

@ -1,5 +0,0 @@
import { ICredentials } from '../interface/entity';
export default class Client {
static buildFcClient(region: string, credentials: ICredentials): Promise<any>;
private static getFcEndpoint;
}

4
lib/lib/event.d.ts vendored
View File

@ -1,4 +0,0 @@
export default class File {
static getEvent(eventFile: any): Promise<unknown>;
static eventPriority(eventPriority: any): Promise<any>;
}

View File

@ -1,39 +0,0 @@
import { IProperties, IEventPayload } from '../interface/entity';
export default class RemoteInvoke {
fcClient: any;
accountId: string;
constructor(fcClient: any, accountId: string);
invoke(props: IProperties, eventPayload: IEventPayload, { invocationType }: {
invocationType: any;
}): Promise<void>;
requestDomain(url: string, event: string): Promise<void>;
getHttpTrigger(serviceName: any, functionName: any): Promise<any>;
eventInvoke({ serviceName, functionName, event, qualifier, invocationType }: {
serviceName: any;
functionName: any;
event: any;
qualifier?: string;
invocationType: any;
}): Promise<void>;
httpInvoke({ region, serviceName, functionName, event, qualifier }: {
region: any;
serviceName: any;
functionName: any;
event: any;
qualifier: any;
}): Promise<void>;
/**
* @param event: { body, headers, method, queries, path }
* path /proxy/serviceName/functionName/path ,
*/
request(event: any): Promise<void>;
handlerHttpParmase(event: any): {
headers: any;
queries: any;
method: any;
path: any;
body: any;
};
private showLog;
private getJsonEvent;
}

5
lib/lib/stdin.d.ts vendored
View File

@ -1,5 +0,0 @@
/// <reference types="node" />
export declare function getStdin(): Promise<string>;
export declare namespace getStdin {
var buffer: () => Promise<Buffer>;
}

View File

@ -25,7 +25,8 @@
"start": "npm run watch",
"watch": "tsc -w",
"prebuild": "rm -rf node_modules && rm -rf package-lock.json && npm i && rimraf lib",
"build": "ncc build src/index.ts -m -o lib"
"build": "ncc build src/index.ts -m -e @serverless-devs/core -o lib",
"postbuild": "rm -rf package-lock.json && rm -rf node_modules"
},
"dependencies": {
"@alicloud/fc2": "^2.2.2",