miniprogram-ci 1.6.1 → 1.8.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/README.md +3 -1
- package/dist/@types/ci/cos-upload.d.ts +1 -3
- package/dist/@types/config.d.ts +1 -3
- package/dist/@types/core/js/generateMap.d.ts +3 -0
- package/dist/@types/core/json/app/checkAppFields.d.ts +2 -0
- package/dist/@types/index.d.ts +2 -0
- package/dist/@types/summer/devtool.d.ts +5 -0
- package/dist/@types/summer/graph/basegraph.d.ts +2 -0
- package/dist/@types/summer/summer.d.ts +1 -0
- package/dist/@types/summer/types.d.ts +13 -3
- package/dist/@types/types/miniprogram-json/app.d.ts +5 -1
- package/dist/@types/types/miniprogram-json/page.d.ts +1 -0
- package/dist/@types/types/miniprogram-json/projectconfig.d.ts +1 -0
- package/dist/@types/utils/locales/locales.d.ts +6 -0
- package/dist/@types/utils/locales/zh.d.ts +6 -0
- package/dist/@types/utils/tools.d.ts +1 -0
- package/dist/ci/code-analyse.js +3 -1
- package/dist/ci/cos-upload.js +3 -1
- package/dist/ci/getCompiledResult.js +3 -1
- package/dist/ci/getDevSourceMap.js +3 -1
- package/dist/ci/getLatestVersion.js +3 -1
- package/dist/ci/jsserver.js +3 -1
- package/dist/ci/preview.js +3 -1
- package/dist/ci/project.js +3 -1
- package/dist/ci/projectattr.js +3 -1
- package/dist/ci/upload.js +3 -1
- package/dist/ci/utils/pack.js +3 -1
- package/dist/ci/utils/packfile.js +3 -1
- package/dist/ci/utils/terminalQrcode.js +3 -1
- package/dist/cli.js +3 -1
- package/dist/cloud/cloudapi.js +3 -1
- package/dist/cloud/createTimeTrigger.js +3 -1
- package/dist/cloud/uploadContainer.js +3 -1
- package/dist/cloud/uploadFile.js +3 -1
- package/dist/cloud/uploadFunction.js +3 -1
- package/dist/cloud/utils.js +3 -1
- package/dist/config.js +3 -1
- package/dist/core/analyse/partial.js +3 -1
- package/dist/core/compile/common.js +3 -1
- package/dist/core/compile/game.js +3 -1
- package/dist/core/compile/game_plugin.js +3 -1
- package/dist/core/compile/handler/js.js +3 -1
- package/dist/core/compile/handler/mpjson.js +3 -1
- package/dist/core/compile/handler/wxml.js +3 -1
- package/dist/core/compile/handler/wxss.js +3 -1
- package/dist/core/compile/index.js +3 -1
- package/dist/core/compile/mini_program.js +3 -1
- package/dist/core/compile/mini_program_plugin.js +3 -1
- package/dist/core/js/enhance.js +1 -1
- package/dist/core/js/generateMap.js +1 -0
- package/dist/core/js/index.js +1 -1
- package/dist/core/js/minifyjs.js +1 -1
- package/dist/core/js/minifyjs_after_wrap.js +1 -1
- package/dist/core/json/app/checkAppFields.js +3 -1
- package/dist/core/json/app/getAppJSON.js +3 -1
- package/dist/core/json/app/getExtJSON.js +3 -1
- package/dist/core/json/app/index.js +3 -1
- package/dist/core/json/common.js +3 -1
- package/dist/core/json/game.js +3 -1
- package/dist/core/json/page/checkPageJSON.js +3 -1
- package/dist/core/json/page/getPageJSON.js +3 -1
- package/dist/core/json/plugin/plugin.js +3 -1
- package/dist/core/json/plugin/plugin_page.js +3 -1
- package/dist/core/json/projectWithMockBuffer.js +3 -1
- package/dist/core/json/projectconfig.js +3 -1
- package/dist/core/json/reactiveCache.js +3 -1
- package/dist/core/json/signaturejson.js +3 -1
- package/dist/core/json/sitemap.js +3 -1
- package/dist/core/json/theme.js +3 -1
- package/dist/core/npm/filterdeps.js +3 -1
- package/dist/core/npm/packnpm.js +3 -1
- package/dist/core/protect/file_flatter.js +3 -1
- package/dist/core/protect/uglifyfilenames.js +3 -1
- package/dist/core/utils/env.js +3 -1
- package/dist/core/utils/logger.js +3 -1
- package/dist/core/validate/validate.js +1 -1
- package/dist/core/worker_thread/childprocess.js +1 -1
- package/dist/core/worker_thread/childprocess_manager.js +1 -1
- package/dist/core/worker_thread/fork.js +1 -1
- package/dist/core/worker_thread/index.js +1 -1
- package/dist/core/worker_thread/task/call_func.js +1 -1
- package/dist/core/worker_thread/task/compilejs.js +1 -1
- package/dist/core/worker_thread/task/compilewxss.js +1 -1
- package/dist/core/worker_thread/task/func.js +1 -1
- package/dist/core/worker_thread/task/minifywxml.js +1 -1
- package/dist/core/worker_thread/worker.js +1 -1
- package/dist/core/worker_thread/worker_manager.js +1 -1
- package/dist/core.js +3 -1
- package/dist/index.js +3 -1
- package/dist/manifest.json +2 -2
- package/dist/schema/dist/index.d.ts +1 -1
- package/dist/summer/ci.js +3 -1
- package/dist/summer/devtool.js +3 -1
- package/dist/summer/entry_process.js +1 -1
- package/dist/summer/error.js +3 -1
- package/dist/summer/graph/appconf.js +3 -1
- package/dist/summer/graph/appgraph.js +3 -1
- package/dist/summer/graph/basegraph.js +3 -1
- package/dist/summer/graph/pluginconf.js +3 -1
- package/dist/summer/graph/plugingraph.js +3 -1
- package/dist/summer/index.js +3 -1
- package/dist/summer/initPlugin.js +3 -1
- package/dist/summer/module.js +3 -1
- package/dist/summer/persist_cache.js +3 -1
- package/dist/summer/plugin_driver.js +3 -1
- package/dist/summer/plugins/base/es6module.js +1 -1
- package/dist/summer/plugins/base/javascript.js +1 -1
- package/dist/summer/plugins/base/wxss.js +1 -1
- package/dist/summer/plugins/enhance.js +1 -1
- package/dist/summer/plugins/less.js +1 -1
- package/dist/summer/plugins/sass.js +1 -1
- package/dist/summer/plugins/terser.js +1 -1
- package/dist/summer/plugins/typescript.js +1 -1
- package/dist/summer/project.js +3 -1
- package/dist/summer/recorder.js +3 -1
- package/dist/summer/resolver.js +3 -1
- package/dist/summer/summer.js +3 -1
- package/dist/summer/types.js +3 -1
- package/dist/summer/utils/async.js +3 -1
- package/dist/summer/utils/ensureArray.js +3 -1
- package/dist/summer/worker.js +3 -1
- package/dist/types/index.js +3 -1
- package/dist/types/miniprogram-json/app.js +3 -1
- package/dist/types/miniprogram-json/base.js +3 -1
- package/dist/types/miniprogram-json/ext.js +3 -1
- package/dist/types/miniprogram-json/game.js +3 -1
- package/dist/types/miniprogram-json/index.js +3 -1
- package/dist/types/miniprogram-json/page.js +3 -1
- package/dist/types/miniprogram-json/plugin.js +3 -1
- package/dist/types/miniprogram-json/projectconfig.js +3 -1
- package/dist/types/miniprogram-json/sitemap.js +3 -1
- package/dist/types/miniprogram-json/theme.js +3 -1
- package/dist/utils/babel_helper.js +3 -1
- package/dist/utils/babel_transform_plugin.js +3 -1
- package/dist/utils/cache.js +3 -1
- package/dist/utils/common.js +3 -1
- package/dist/utils/error.js +3 -1
- package/dist/utils/fs.js +3 -1
- package/dist/utils/fsagent.js +3 -1
- package/dist/utils/glob.js +3 -1
- package/dist/utils/interruptibletask.js +3 -1
- package/dist/utils/jsonParse.js +3 -1
- package/dist/utils/jsonlint.js +3 -1
- package/dist/utils/locales/en.js +3 -1
- package/dist/utils/locales/fomatable_string.js +3 -1
- package/dist/utils/locales/locales.js +3 -1
- package/dist/utils/locales/zh.js +3 -1
- package/dist/utils/log.js +3 -1
- package/dist/utils/report.js +3 -1
- package/dist/utils/request.js +3 -1
- package/dist/utils/sign.js +3 -1
- package/dist/utils/taskstatus.js +3 -1
- package/dist/utils/tools.js +3 -1
- package/dist/utils/url_config.js +3 -1
- package/dist/utils/white_ext_list.js +3 -1
- package/dist/utils/wxvpkgreader/wxvpkgreader.js +1 -1
- package/dist/vendor/cloud-api/src/apis/apis.js +3 -1
- package/dist/vendor/cloud-api/src/apis/cdn/cdn.apis.js +3 -1
- package/dist/vendor/cloud-api/src/apis/cdn/index.js +3 -1
- package/dist/vendor/cloud-api/src/apis/flexdb/flexdb.apis.js +3 -1
- package/dist/vendor/cloud-api/src/apis/flexdb/index.js +3 -1
- package/dist/vendor/cloud-api/src/apis/scf/index.js +3 -1
- package/dist/vendor/cloud-api/src/apis/scf/scf.apis.js +3 -1
- package/dist/vendor/cloud-api/src/apis/ssl/index.js +3 -1
- package/dist/vendor/cloud-api/src/apis/ssl/ssl.apis.js +3 -1
- package/dist/vendor/cloud-api/src/apis/tcb/general.apis.js +3 -1
- package/dist/vendor/cloud-api/src/apis/tcb/index.js +3 -1
- package/dist/vendor/cloud-api/src/apis/tcb/tcb.apis.js +3 -1
- package/dist/vendor/cloud-api/src/index.js +3 -1
- package/dist/vendor/cloud-api/src/transaction/contracts/cdn.contracts.js +3 -1
- package/dist/vendor/cloud-api/src/transaction/contracts/contracts.js +3 -1
- package/dist/vendor/cloud-api/src/transaction/contracts/factory.js +3 -1
- package/dist/vendor/cloud-api/src/transaction/contracts/flexdb.contracts.js +3 -1
- package/dist/vendor/cloud-api/src/transaction/contracts/scf.contracts.js +3 -1
- package/dist/vendor/cloud-api/src/transaction/contracts/ssl.contracts.js +3 -1
- package/dist/vendor/cloud-api/src/transaction/contracts/tcb.contracts.js +3 -1
- package/dist/vendor/cloud-api/src/transaction/transactor.js +3 -1
- package/dist/vendor/cloud-api/src/transaction/validations/cdn.validations.js +3 -1
- package/dist/vendor/cloud-api/src/transaction/validations/common.validations.js +3 -1
- package/dist/vendor/cloud-api/src/transaction/validations/flexdb.validations.js +3 -1
- package/dist/vendor/cloud-api/src/transaction/validations/scf.validations.js +3 -1
- package/dist/vendor/cloud-api/src/transaction/validations/ssl.validations.js +3 -1
- package/dist/vendor/cloud-api/src/transaction/validations/tcb.validations.js +3 -1
- package/dist/vendor/cloud-api/src/transaction/validations/validations.js +3 -1
- package/dist/vendor/cloud-api/src/utils/common.js +3 -1
- package/dist/vendor/cloud-api/src/utils/validator.js +3 -1
- package/dist/vendor/schema/dist/app.js +47 -1
- package/dist/vendor/schema/dist/ext.js +46 -1
- package/dist/vendor/schema/dist/game.js +29 -1
- package/dist/vendor/schema/dist/index.js +2 -1
- package/dist/vendor/schema/dist/page.js +38 -1
- package/dist/vendor/schema/dist/plugin.js +1 -1
- package/dist/vendor/schema/dist/pluginpage.js +1 -1
- package/dist/vendor/schema/dist/projectconfig.js +425 -9
- package/dist/vendor/schema/dist/projectprivateconfig.js +347 -0
- package/dist/vendor/schema/dist/sitemap.js +1 -1
- package/dist/vendor/schema/dist/theme.js +1 -1
- package/package.json +21 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
## 1.8.12
|
|
3
|
+
- `new` app.json 配置支持 halfPage
|
|
4
|
+
- `new` 更新 上传时忽略 project.private.config.json 文件
|
|
5
|
+
- `new` 更新 代码包超过 5MB 后,默认通过异步方式上传代码,详情可查看 useCOS 参数
|
|
6
|
+
- `fix` 修复 ts 项目支持 babelSetting ignore 配置
|
|
7
|
+
- `fix` 修复 windows 编译 less 或 sass 文件提示路径出错的 bug [相关反馈](https://developers.weixin.qq.com/community/develop/doc/000ecc927587e0aca69df553851400)
|
|
1
8
|
## 1.6.1
|
|
2
9
|
- `new` 新增 支持编译工具上对应的 Typescript 模板项目。
|
|
3
10
|
- `fix` 更新 wxml压缩逻辑,可通过 minifyWXML 参数开启 wxml 压缩。
|
package/README.md
CHANGED
|
@@ -67,6 +67,8 @@ interface IProject {
|
|
|
67
67
|
|
|
68
68
|
```javascript
|
|
69
69
|
const ci = require('miniprogram-ci')
|
|
70
|
+
|
|
71
|
+
// 注意: new ci.Project 调用时,请确保项目代码已经是完整的,避免编译过程出现找不到文件的报错。
|
|
70
72
|
const project = new ci.Project({
|
|
71
73
|
appid: 'wxsomeappid',
|
|
72
74
|
type: 'miniProgram',
|
|
@@ -120,7 +122,7 @@ const ci = require('miniprogram-ci')
|
|
|
120
122
|
| onProgressUpdate | function | 否 | 进度更新监听函数 |
|
|
121
123
|
| robot | number | 否 | 指定使用哪一个 ci 机器人,可选值:1 ~ 30 |
|
|
122
124
|
| threads | number | 否 | 指定本地编译过程中开启的线程数 |
|
|
123
|
-
| useCOS | boolean | 否 |
|
|
125
|
+
| useCOS | boolean | 否 | 使用异步方式上传,当代码包大于 5MB 时,默认开启 |
|
|
124
126
|
|
|
125
127
|
#### 返回
|
|
126
128
|
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { IProject } from '../types';
|
|
3
|
-
export declare function uploadByCos(
|
|
4
|
-
[key: string]: string | Buffer;
|
|
5
|
-
}, commitUrl: string, project: IProject, robot: any): Promise<{
|
|
3
|
+
export declare function uploadByCos(gzipBuffer: Buffer, commitUrl: string, project: IProject, robot: any): Promise<{
|
|
6
4
|
fallback: boolean;
|
|
7
5
|
body?: any;
|
|
8
6
|
uploadCOSCostTime?: number;
|
package/dist/@types/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const CI_VERSION = "1.
|
|
1
|
+
export declare const CI_VERSION = "1.8.12";
|
|
2
2
|
export declare const PARAM_ERROR = 10000;
|
|
3
3
|
export declare const WXML_NOT_FOUND = 10007;
|
|
4
4
|
export declare const JS_NOT_FOUND = 10008;
|
|
@@ -44,8 +44,6 @@ export declare enum COMPILE_TYPE {
|
|
|
44
44
|
miniGame = "miniGame",
|
|
45
45
|
miniGamePlugin = "miniGamePlugin"
|
|
46
46
|
}
|
|
47
|
-
export declare const MiniProgramWhiteList: Record<string, true>;
|
|
48
|
-
export declare const GameWhiteList: Record<string, true>;
|
|
49
47
|
export declare const TABBAR_ICON_WHITE_LIST: string[];
|
|
50
48
|
export declare const DefaultProjectAttr: {
|
|
51
49
|
platform: boolean;
|
|
@@ -36,4 +36,6 @@ interface IVariableDeclareProperty {
|
|
|
36
36
|
}
|
|
37
37
|
export declare function getAppJSONVariableDecalearProperty(appJSON: AppJSON.IAppJSON): Array<IVariableDeclareProperty>;
|
|
38
38
|
export declare function checkOpenDataContext(options: IInnerAppJSONCheckOptions, appJSON: AppJSON.IAppJSON): void;
|
|
39
|
+
export declare function checkRenderer(options: IInnerAppJSONCheckOptions): void;
|
|
40
|
+
export declare function checkResolveAlias(options: IInnerAppJSONCheckOptions): void;
|
|
39
41
|
export {};
|
package/dist/@types/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ import { uploadJsServer } from './ci/jsserver';
|
|
|
12
12
|
import { analyseCode } from './ci/code-analyse';
|
|
13
13
|
import { getCompiledResult } from './ci/getCompiledResult';
|
|
14
14
|
import { getLatestVersion } from './ci/getLatestVersion';
|
|
15
|
+
import { getWhiteExtList } from './utils/white_ext_list';
|
|
15
16
|
export { Project };
|
|
16
17
|
export type { IUploadOptions };
|
|
17
18
|
export declare const upload: typeof _upload;
|
|
@@ -31,5 +32,6 @@ export declare const cloud: {
|
|
|
31
32
|
export { uploadJsServer };
|
|
32
33
|
export { getLatestVersion };
|
|
33
34
|
export { analyseCode };
|
|
35
|
+
export { getWhiteExtList };
|
|
34
36
|
export * from './core';
|
|
35
37
|
export * from './summer';
|
|
@@ -111,6 +111,10 @@ export interface IPluginConf {
|
|
|
111
111
|
comps: Record<string, any>;
|
|
112
112
|
}
|
|
113
113
|
declare type ISummerPluginConfig = Array<string | [string, SummerPluginOptions]>;
|
|
114
|
+
export declare type IBabelSetting = {
|
|
115
|
+
outputPath?: string;
|
|
116
|
+
ignore?: any[];
|
|
117
|
+
};
|
|
114
118
|
export interface ICompilerOptions {
|
|
115
119
|
appid: string;
|
|
116
120
|
attr: any;
|
|
@@ -118,6 +122,7 @@ export interface ICompilerOptions {
|
|
|
118
122
|
miniprogramRoot: string;
|
|
119
123
|
pluginRoot: string;
|
|
120
124
|
summerPlugins: ISummerPluginConfig;
|
|
125
|
+
babelSetting?: IBabelSetting;
|
|
121
126
|
}
|
|
122
127
|
export declare class SummerCompiler {
|
|
123
128
|
projectPath: string;
|
|
@@ -10,6 +10,7 @@ import PersistCache from '../persist_cache';
|
|
|
10
10
|
declare type GraphType = 'miniprogram' | 'plugin' | 'other';
|
|
11
11
|
export declare type FileInfo = ResolveFileInfo & {
|
|
12
12
|
independentRoot: string;
|
|
13
|
+
isBabelIgnore: boolean;
|
|
13
14
|
};
|
|
14
15
|
export interface IGraphOptions {
|
|
15
16
|
type: GraphType;
|
|
@@ -49,6 +50,7 @@ export declare abstract class BaseGraph {
|
|
|
49
50
|
}>>;
|
|
50
51
|
private compileOther;
|
|
51
52
|
private compileCodeWithoutJSON;
|
|
53
|
+
protected isBabelSettingIgnore(fileInfo: ResolveFileInfo): boolean;
|
|
52
54
|
protected abstract onFileChangeForGraph(type: 'unlink' | 'unlinkDir' | 'add' | 'addDir' | 'change', path: string): void;
|
|
53
55
|
protected abstract getConf(recorder: Recorder): Promise<IAppConf | IPluginConf>;
|
|
54
56
|
protected abstract getDevCode(recorder: Recorder, options?: IPackageCodeOptions): Promise<CodeFiles>;
|
|
@@ -16,6 +16,7 @@ export declare class SummerCompiler {
|
|
|
16
16
|
proxyProject: any;
|
|
17
17
|
persistCache: PersistCache;
|
|
18
18
|
constructor(project: Project, cachePath: string, options: ICompilerOptions);
|
|
19
|
+
getBabelSetting(): import("./devtool").IBabelSetting | undefined;
|
|
19
20
|
private initPlugins;
|
|
20
21
|
private initAppGraph;
|
|
21
22
|
private initPluginGraph;
|
|
@@ -40,6 +40,7 @@ export interface PluginContext {
|
|
|
40
40
|
addWatchFile: (absFilePath: string) => void;
|
|
41
41
|
error: (err: any) => never;
|
|
42
42
|
runWorkerMethod: (method: string, ...args: any[]) => Promise<any>;
|
|
43
|
+
rootPath?: string;
|
|
43
44
|
}
|
|
44
45
|
export declare type SourceMap = Omit<RawSourceMap, 'version'> & {
|
|
45
46
|
version: number | string;
|
|
@@ -72,10 +73,19 @@ export declare type AsyncPluginHooks = 'load' | 'transform' | 'optimize' | 'gene
|
|
|
72
73
|
export declare type FirstPluginHooks = 'load' | 'generate';
|
|
73
74
|
export declare type SequentialPluginHooks = 'transform' | 'optimize' | 'compress';
|
|
74
75
|
export declare type ParallelPluginHooks = 'sealed';
|
|
75
|
-
export declare type LoadHook = (this: PluginContext, targetPath: string, sourcePath: string,
|
|
76
|
-
|
|
76
|
+
export declare type LoadHook = (this: PluginContext, targetPath: string, sourcePath: string, options: {
|
|
77
|
+
independentRoot: string;
|
|
78
|
+
isBabelIgnore: boolean;
|
|
79
|
+
}) => Promise<LoadResult> | LoadResult;
|
|
80
|
+
export declare type TransformHook = (this: PluginContext, source: SourceDescription, targetPath: string, sourcePath: string, options: {
|
|
81
|
+
independentRoot: string;
|
|
82
|
+
isBabelIgnore: boolean;
|
|
83
|
+
}) => Promise<SourceDescription> | SourceDescription;
|
|
77
84
|
declare type GenerateResult = GenerateDescription | string | null | undefined;
|
|
78
|
-
export declare type GenerateHook = (this: PluginContext, source: SourceDescription, targetPath: string, sourcePath: string,
|
|
85
|
+
export declare type GenerateHook = (this: PluginContext, source: SourceDescription, targetPath: string, sourcePath: string, options: {
|
|
86
|
+
independentRoot: string;
|
|
87
|
+
isBabelIgnore: boolean;
|
|
88
|
+
}) => Promise<GenerateResult> | GenerateResult;
|
|
79
89
|
export declare type OptimizeHook = (this: PluginContext, codes: Record<string, string>, appConf: IAppConf) => Promise<Record<string, string>>;
|
|
80
90
|
export declare type CompressHook = (this: PluginContext, content: Record<string, string | Buffer>) => Promise<Record<string, string | Buffer>>;
|
|
81
91
|
export declare type SealedHook = (this: PluginContext, content: Record<string, string | Buffer>) => Promise<void>;
|
|
@@ -89,7 +89,11 @@ export declare namespace AppJSON {
|
|
|
89
89
|
darkmode?: boolean;
|
|
90
90
|
themeLocation?: string;
|
|
91
91
|
theme?: string;
|
|
92
|
-
lazyCodeLoading?:
|
|
92
|
+
lazyCodeLoading?: 'requiredComponents';
|
|
93
|
+
renderer?: 'skyline' | 'webview';
|
|
94
|
+
resolveAlias?: {
|
|
95
|
+
[key: string]: string;
|
|
96
|
+
};
|
|
93
97
|
}
|
|
94
98
|
interface IPluginConfig {
|
|
95
99
|
provider: string;
|
|
@@ -15,6 +15,7 @@ declare const _default: {
|
|
|
15
15
|
NOT_FOUND: import("./fomatable_string").FormatableString;
|
|
16
16
|
MINIPROGRAM_APP_JSON_NOT_FOUND: import("./fomatable_string").FormatableString;
|
|
17
17
|
PLUGIN_JSON_NOT_FOUND: import("./fomatable_string").FormatableString;
|
|
18
|
+
PLUGIN_PATH_SAME_WITH_MINIPROGRAM: import("./fomatable_string").FormatableString;
|
|
18
19
|
FILE_NOT_FOUND: import("./fomatable_string").FormatableString;
|
|
19
20
|
JSON_PARSE_ERROR: import("./fomatable_string").FormatableString;
|
|
20
21
|
ENTRANCE_NOT_FOUND: import("./fomatable_string").FormatableString;
|
|
@@ -26,9 +27,14 @@ declare const _default: {
|
|
|
26
27
|
JSON_TABBAR_AT_LEAST: import("./fomatable_string").FormatableString;
|
|
27
28
|
JSON_TABBAR_AT_MOST: import("./fomatable_string").FormatableString;
|
|
28
29
|
JSON_TABBAR_PATH_EMPTY: import("./fomatable_string").FormatableString;
|
|
30
|
+
JSON_TABBAR_PATH_SAME_WITH_OTHER: import("./fomatable_string").FormatableString;
|
|
29
31
|
JSON_TABBAR_ICON_MAX_SIZE: import("./fomatable_string").FormatableString;
|
|
30
32
|
JSON_TABBAR_ICON_EXT: import("./fomatable_string").FormatableString;
|
|
31
33
|
JSON_CONTENT_SHOULD_NOT_BE: import("./fomatable_string").FormatableString;
|
|
34
|
+
JSON_RESOLVE_ALIAS_ILLEGAL: import("./fomatable_string").FormatableString;
|
|
35
|
+
APP_JSON_SHOULD_SET_LAZYCODELOADING: import("./fomatable_string").FormatableString;
|
|
36
|
+
PAGE_JSON_SHOULD_SET_DISABLESCROLL_TRUE: import("./fomatable_string").FormatableString;
|
|
37
|
+
PAGE_JSON_SHOULD_SET_NAVIGATIONSTYLE_CUSTOM: import("./fomatable_string").FormatableString;
|
|
32
38
|
CONTENT_EXIST: import("./fomatable_string").FormatableString;
|
|
33
39
|
JSON_CONTENT_EXISTED: import("./fomatable_string").FormatableString;
|
|
34
40
|
JSON_CONTENT_NOT_FOUND: import("./fomatable_string").FormatableString;
|
|
@@ -15,6 +15,7 @@ declare const _default: {
|
|
|
15
15
|
NOT_FOUND: FormatableString;
|
|
16
16
|
MINIPROGRAM_APP_JSON_NOT_FOUND: FormatableString;
|
|
17
17
|
PLUGIN_JSON_NOT_FOUND: FormatableString;
|
|
18
|
+
PLUGIN_PATH_SAME_WITH_MINIPROGRAM: FormatableString;
|
|
18
19
|
FILE_NOT_FOUND: FormatableString;
|
|
19
20
|
JSON_PARSE_ERROR: FormatableString;
|
|
20
21
|
ENTRANCE_NOT_FOUND: FormatableString;
|
|
@@ -26,9 +27,14 @@ declare const _default: {
|
|
|
26
27
|
JSON_TABBAR_AT_LEAST: FormatableString;
|
|
27
28
|
JSON_TABBAR_AT_MOST: FormatableString;
|
|
28
29
|
JSON_TABBAR_PATH_EMPTY: FormatableString;
|
|
30
|
+
JSON_TABBAR_PATH_SAME_WITH_OTHER: FormatableString;
|
|
29
31
|
JSON_TABBAR_ICON_MAX_SIZE: FormatableString;
|
|
30
32
|
JSON_TABBAR_ICON_EXT: FormatableString;
|
|
31
33
|
JSON_CONTENT_SHOULD_NOT_BE: FormatableString;
|
|
34
|
+
JSON_RESOLVE_ALIAS_ILLEGAL: FormatableString;
|
|
35
|
+
APP_JSON_SHOULD_SET_LAZYCODELOADING: FormatableString;
|
|
36
|
+
PAGE_JSON_SHOULD_SET_DISABLESCROLL_TRUE: FormatableString;
|
|
37
|
+
PAGE_JSON_SHOULD_SET_NAVIGATIONSTYLE_CUSTOM: FormatableString;
|
|
32
38
|
CONTENT_EXIST: FormatableString;
|
|
33
39
|
JSON_CONTENT_EXISTED: FormatableString;
|
|
34
40
|
JSON_CONTENT_NOT_FOUND: FormatableString;
|
|
@@ -15,6 +15,7 @@ export declare function escapeQuot(str: string, type?: string): string;
|
|
|
15
15
|
export declare function trailing(str: string, char: string, reversed?: boolean): string;
|
|
16
16
|
export declare function leading(str: string, char: string, reversed?: boolean): string;
|
|
17
17
|
export declare const isFileIgnored: (file: string, ignoreRule: any) => any;
|
|
18
|
+
export declare const isFileIncluded: (file: string, ignoreRule: any) => any;
|
|
18
19
|
export declare function formatSourceMap(map: string | RawSourceMap): string | undefined;
|
|
19
20
|
export declare function generateMD5(buffer: Buffer | string): string;
|
|
20
21
|
export declare const formatNumber: (n: number) => string;
|
package/dist/ci/code-analyse.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
!function(require, directRequire){
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.analyseCode=void 0;const tslib_1=require("tslib"),projectconfig_1=require("../core/json/projectconfig"),code_analyse_1=require("../vendor/code-analyse"),path_1=(0,tslib_1.__importDefault)(require("path"));function transCompileType(e){if("miniProgram"===e.type)return"miniprogram";if("miniProgramPlugin"===e.type)return"plugin";if("miniGame"===e.type)return"game";if("miniGamePlugin"===e.type)return"gamePlugin";throw new Error("unknown compile type "+e.type)}class LogPlugin{constructor(){this.name="LogPlugin"}onDepResolveFailed(e,o){var n,i;console.warn(`${null===(n=e.originModule)||void 0===n?void 0:n.type} module ${null===(i=e.originModule)||void 0===i?void 0:i.path} resolve dep failed`),console.warn(o)}onModuleBuildFailed(e,o,n){console.warn(`${e.type} module ${e.path} build failed`),console.warn(n)}}async function analyseCode(e,o){const n=(0,projectconfig_1.getProjectConfigJSON)(e),i=transCompileType(e);if("gamePlugin"===i)throw new Error("gamePlugin is not support yet!");let r="plugin"===i?n.pluginRoot:n.miniprogramRoot;r=r?path_1.default.posix.join(e.projectPath,r):e.projectPath;const t=new code_analyse_1.Analyzer({root:r,type:i,plugins:(null==o?void 0:o.silent)?[]:[new LogPlugin]});return await t.analyse(),t.serialize()}exports.analyseCode=analyseCode;
|
|
3
|
+
}(require("licia/lazyImport")(require), require)
|
package/dist/ci/cos-upload.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
!function(require, directRequire){
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.uploadByCos=void 0;const tslib_1=require("tslib"),url_config_1=require("../utils/url_config"),tools_1=require("../utils/tools"),request_1=require("../utils/request"),sign_1=require("../utils/sign"),pack_1=require("./utils/pack"),zlib=require("zlib"),crypto=require("crypto"),config_1=require("../config"),upload_1=require("./upload"),log_1=(0,tslib_1.__importDefault)(require("../utils/log")),jsonParse_1=require("../utils/jsonParse"),COS=require("cos-nodejs-sdk-v5");async function putBufferToCos(e,t){const r=new COS({Proxy:(0,request_1.getCiProxy)(),getAuthorization(e,r){r({TmpSecretId:t.secret_id,TmpSecretKey:t.secret_key,XCosSecurityToken:t.token,ExpiredTime:t.expired_time})}});try{return await new Promise((o,i)=>{r.putObject({Bucket:t.bucket,Region:"ap-shanghai",Key:t.object,Body:e,onProgress(e){}},(e,t)=>{if(e)return console.error(e),i(e.error);o(t)})})}catch(e){throw new Error("upload to cos failed: "+e.message)}}async function innerRequest(e,t){const r=await(0,request_1.request)({url:e,method:"post",body:t,headers:{"content-type":"application/json"}});let o;try{o=JSON.parse(r.body)}catch(t){const r=`request ${e} failed: resp body is not a valid json`;throw log_1.default.error(r),new Error(r)}if(0!==o.errCode)throw new Error(`request failed, errCode: ${o.errCode}, errMsg: ${o.errMsg}`);return o.data}async function uploadByCos(e,t,r,o){let i;try{const e=await(0,sign_1.getSignature)(r.privateKey,r.appid);i=await innerRequest(url_config_1.GET_UPLOAD_TOKEN,JSON.stringify({appid:r.appid,signature:e,robot:o}))}catch(e){return console.error("uploadToken error",e),{fallback:!0}}const s=e,a=crypto.randomBytes(12),n=crypto.createCipheriv("aes-256-gcm",Buffer.from(i.crypt_key,"base64"),a),u=Buffer.concat([n.update(s),n.final()]),c=n.getAuthTag(),l=Buffer.alloc(1);l.writeUInt8(c.length+a.length,0);const p=Buffer.concat([l,c,a,u]),d=Date.now();await putBufferToCos(p,i);const _=Date.now()-d,f=(0,tools_1.generateMD5)(s),g=await(0,sign_1.getSignature)(r.privateKey,r.appid),y=`${t}&task_id=${i.task_id}&new_hash=${f}&upload_cos_cost_time=${_}`;log_1.default.info("request url:",y);let w=await(0,request_1.request)({url:y,method:"post",body:zlib.gzipSync((0,pack_1.pack)({[upload_1.SIGNATURE_FILE_NAME]:JSON.stringify({signature:g,version:config_1.CI_VERSION})}).buffer)});if(0!==(0,jsonParse_1.jsonRespParse)(w.body.toString(),t).errCode)throw new Error(w.body.toString());for(;;){const e=await(0,sign_1.getSignature)(r.privateKey,r.appid),t=await innerRequest(`${url_config_1.GET_ASYNC_RESULT}?task_id=${i.task_id}`,JSON.stringify({appid:r.appid,signature:e,robot:o}));if(1!==t.status){if(0===t.status)return{fallback:!1,body:t,uploadCOSCostTime:_};if(3===t.status)throw new Error(`upload failed with status ${t.status}, task not found`);throw new Error("upload failed with status "+t.status)}await new Promise(e=>{setTimeout(e,1e3)})}}exports.uploadByCos=uploadByCos;
|
|
3
|
+
}(require("licia/lazyImport")(require), require)
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
!function(require, directRequire){
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getCompiledResult=exports.SIGNATURE_FILE_NAME=void 0;const tslib_1=require("tslib"),fs_extra_1=(0,tslib_1.__importDefault)(require("fs-extra")),compile_1=require("../core/compile"),config_1=require("../config"),error_1=require("../utils/error"),locales_1=(0,tslib_1.__importDefault)(require("../utils/locales/locales")),cache_1=require("../utils/cache"),jszip_1=(0,tslib_1.__importDefault)(require("jszip")),path_1=(0,tslib_1.__importDefault)(require("path"));async function getCompiledResult(e,t){const{project:r,setting:o={},version:i="",onProgressUpdate:s=function(e){console.log(""+e)},threads:a=0,includedMap:l=!1}=e;if(process.env.COMPILE_THREADS=a.toString(),!i)throw new error_1.CodeError(locales_1.default.config.PARAM_ERROR.format("upload","version"),config_1.PARAM_ERROR);if(!r)throw new error_1.CodeError(locales_1.default.config.PARAM_ERROR.format("upload","project"),config_1.PARAM_ERROR);cache_1.cacheManager.clean();const _=await(0,compile_1.compile)(r,{setting:o,onProgressUpdate:s}),c={};if(Object.keys(_).sort().forEach(e=>{e.endsWith("js.map")&&!l||(c[e]=_[e])}),t){const e=new jszip_1.default;Object.keys(c).forEach(t=>{e.folder(path_1.default.dirname(t)).file(path_1.default.basename(t),c[t])});const r=await e.generateAsync({type:"nodebuffer"});fs_extra_1.default.ensureDirSync(path_1.default.dirname(t)),fs_extra_1.default.writeFileSync(t,r)}return c}exports.SIGNATURE_FILE_NAME="ci.signature",exports.getCompiledResult=getCompiledResult;
|
|
3
|
+
}(require("licia/lazyImport")(require), require)
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
!function(require, directRequire){
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getDevSourceMap=void 0;const tslib_1=require("tslib"),fs_1=(0,tslib_1.__importDefault)(require("fs")),path_1=(0,tslib_1.__importDefault)(require("path")),log_1=(0,tslib_1.__importDefault)(require("../utils/log")),request_1=require("../utils/request"),url_config_1=require("../utils/url_config"),sign_1=require("../utils/sign"),JsZip=require("jszip"),ERR_MSG_PREFIX="download source map failed:";async function getDevSourceMap(e){return new Promise(async(r,t)=>{const{project:o,robot:a}=e;let{sourceMapSavePath:i}=e;if(!o){const e="params project is requried";return log_1.default.error(e),void t(e)}if("number"!=typeof a||Math.round(a)>30||Math.round(a)<=0){const e="params robot is invalid";return log_1.default.error(e),void t(e)}if(!i){const e="params sourceMapSavePath is invalid";return log_1.default.error(e),void t(e)}path_1.default.isAbsolute(i)||(i=path_1.default.join(process.cwd(),i));const s=await(0,sign_1.getSignature)(o.privateKey,o.appid),{body:u}=await(0,request_1.request)({url:url_config_1.GET_DEV_SOURCE_MAP,method:"post",gzip:!0,body:JSON.stringify({appid:o.appid,signature:s,robot:a}),headers:{"content-type":"application/json"}});let l;try{l=JSON.parse(u)}catch(e){const r=ERR_MSG_PREFIX+" resp body is not a valid json";return log_1.default.error(r),void t(r)}const n=l.data;if(!Array.isArray(n.sourcemap_list)){const e=`${ERR_MSG_PREFIX} respData.sourcemap_list, respData: ${JSON.stringify(n)}`;return log_1.default.error(e),void t(e)}const p=n.sourcemap_list,_=new JsZip;try{p.forEach(e=>{_.folder(path_1.default.dirname(e.fullpath)).file(path_1.default.basename(e.fullpath),e.sourcemap)})}catch(e){const r=ERR_MSG_PREFIX+" source map add folder or add file error";return log_1.default.error(r),void t(r)}_.generateAsync({type:"nodebuffer"}).then(e=>{try{fs_1.default.writeFileSync(i,e),r(void 0)}catch(e){const r=`${ERR_MSG_PREFIX} save source map to ${i} failed. Error detail: ${JSON.stringify(e)}`;return log_1.default.error(r),void t(r)}r(e)}).catch(()=>{const e=ERR_MSG_PREFIX+" source map generate zip error";log_1.default.error(e),t(e)})})}exports.getDevSourceMap=getDevSourceMap;
|
|
3
|
+
}(require("licia/lazyImport")(require), require)
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
!function(require, directRequire){
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getLatestVersion=void 0;const tslib_1=require("tslib"),request_1=require("../utils/request"),sign_1=require("../utils/sign"),config_1=require("../config"),error_1=require("../utils/error"),locales_1=(0,tslib_1.__importDefault)(require("../utils/locales/locales")),querystring_1=(0,tslib_1.__importDefault)(require("querystring")),url_config_1=require("../utils/url_config"),jsonParse_1=require("../utils/jsonParse");async function getLatestVersion(e){const{project:r}=e;if(!r)throw new error_1.CodeError(locales_1.default.config.PARAM_ERROR.format("getLatestVersion","project"),config_1.PARAM_ERROR);if("miniProgramPlugin"!==r.type&&"miniGamePlugin"!==r.type)throw new Error("getLatestVersion only support plugin type project");const t=await(0,sign_1.getSignature)(r.privateKey,r.appid),i={appid:r.appid,signature:t};try{const e=`${url_config_1.GET_LATEST_VERSION}?${querystring_1.default.stringify(i)}`,r=(await(0,request_1.request)({url:e,method:"get"})).body.toString(),t=(0,jsonParse_1.jsonRespParse)(r,e);if(0!==t.errCode)throw new Error(r);return t.data}catch(e){throw new error_1.CodeError(e.toString(),config_1.GET_LATEST_VERSION_CGI_ERR)}}exports.getLatestVersion=getLatestVersion;
|
|
3
|
+
}(require("licia/lazyImport")(require), require)
|
package/dist/ci/jsserver.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
!function(require, directRequire){
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.uploadJsServer=exports.SIGNATURE_FILE_NAME=void 0;const tslib_1=require("tslib"),path_1=(0,tslib_1.__importDefault)(require("path")),request_1=require("../utils/request"),packfile_1=require("./utils/packfile"),zlib_1=(0,tslib_1.__importDefault)(require("zlib")),sign_1=require("../utils/sign"),config_1=require("../config"),log_1=(0,tslib_1.__importDefault)(require("../utils/log")),error_1=require("../utils/error"),locales_1=(0,tslib_1.__importDefault)(require("../utils/locales/locales")),querystring_1=(0,tslib_1.__importDefault)(require("querystring")),url_config_1=require("../utils/url_config"),jsonParse_1=require("../utils/jsonParse"),projectconfig_1=require("../core/json/projectconfig");async function uploadJsServer(e){var r;const{project:o,env:t}=e;if(!t||"test"!==t&&"release"!==t)throw new error_1.CodeError(locales_1.default.config.PARAM_ERROR.format("uploadJsServer","env"),config_1.PARAM_ERROR);if(!o)throw new error_1.CodeError(locales_1.default.config.PARAM_ERROR.format("uploadJsServer","project"),config_1.PARAM_ERROR);const i=(0,projectconfig_1.getProjectConfigJSON)(o);if("string"!=typeof i.jsserverRoot||!(null===(r=o.stat("",i.jsserverRoot))||void 0===r?void 0:r.isDirectory))throw new error_1.CodeError("please set a correct jsserverRoot value in project.config.json",config_1.PARAM_ERROR);const s=await(0,packfile_1.packFiledir)(path_1.default.posix.join(o.projectPath,i.jsserverRoot)),_=await(0,sign_1.getSignature)(o.privateKey,o.appid),l={type:"release"===t?0:1,appid:o.appid,signature:_};try{const e=`${url_config_1.UPLOAD_JS_SERVER}?${querystring_1.default.stringify(l)}`;log_1.default.info("request url:",e);const r=zlib_1.default.gzipSync(s.data),o=(await(0,request_1.request)({url:e,method:"post",body:r})).body.toString();if(0!==(0,jsonParse_1.jsonRespParse)(o,e).errCode)throw new Error(o);return!0}catch(e){throw new error_1.CodeError(e.toString(),config_1.UPLOAD_JS_SERVER_CGI_ERR)}}exports.SIGNATURE_FILE_NAME="ci.signature",exports.uploadJsServer=uploadJsServer;
|
|
3
|
+
}(require("licia/lazyImport")(require), require)
|
package/dist/ci/preview.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
!function(require, directRequire){
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.preview=void 0;const tslib_1=require("tslib"),upload_1=require("./upload"),terminalQrcode_1=require("./utils/terminalQrcode"),fs_1=(0,tslib_1.__importDefault)(require("fs")),config_1=require("../config"),error_1=require("../utils/error"),locales_1=(0,tslib_1.__importDefault)(require("../utils/locales/locales")),log_1=(0,tslib_1.__importDefault)(require("../utils/log"));async function preview(e){const r=Object.assign({},e);if(r.test=!0,r.version="0.0.1",r.qrcodeFormat||(r.qrcodeFormat="terminal"),!["base64","image","terminal"].includes(r.qrcodeFormat))throw new error_1.CodeError(locales_1.default.config.INVALID.format("qrcodeFormat"),config_1.PARAM_ERROR);if(["base64","image"].includes(r.qrcodeFormat)&&("string"!=typeof r.qrcodeOutputDest||"."===r.qrcodeOutputDest.trim()))throw new error_1.CodeError(locales_1.default.config.INVALID.format("qrcodeOutputDest"),config_1.PARAM_ERROR);const o=await(0,upload_1.innerUpload)(r);if(!o.respBody.qrcode_img)throw new Error("No `qrcode_img` in response.");if("terminal"===r.qrcodeFormat)try{const e=await(0,terminalQrcode_1.generateTerminalQrcode)(o.respBody.qrcode_img);log_1.default.log(e),log_1.default.log("terminal qrcode shown above")}catch(e){log_1.default.error("Termianl qrcode generate failed, but you can still visit the dev version on your cell phone.")}else if(r.qrcodeOutputDest)if("image"===r.qrcodeFormat)try{fs_1.default.writeFileSync(r.qrcodeOutputDest,Buffer.from(o.respBody.qrcode_img,"base64")),log_1.default.info(`Qrcode image saved, file path: '${r.qrcodeOutputDest}'`)}catch(e){throw new Error("write qrcode image error: "+JSON.stringify(e))}else if("base64"===r.qrcodeFormat)try{fs_1.default.writeFileSync(r.qrcodeOutputDest,"data:image/jpeg;base64,"+o.respBody.qrcode_img,"utf8"),log_1.default.info(`Qrcode base64 file saved, file path: '${r.qrcodeOutputDest}'`)}catch(e){throw new Error("write qrcode base64 error: "+JSON.stringify(e))}return{subPackageInfo:o.subPackageInfo,pluginInfo:o.pluginInfo}}exports.preview=preview;
|
|
3
|
+
}(require("licia/lazyImport")(require), require)
|
package/dist/ci/project.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
!function(require, directRequire){
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Project=void 0;const tslib_1=require("tslib"),path_1=(0,tslib_1.__importDefault)(require("path")),glob_1=(0,tslib_1.__importDefault)(require("glob")),fs_1=(0,tslib_1.__importDefault)(require("fs")),projectattr_1=require("./projectattr"),tools_1=require("../utils/tools"),config_1=require("../config"),locales_1=(0,tslib_1.__importDefault)(require("../utils/locales/locales")),error_1=require("../utils/error"),request_1=require("../utils/request"),projectconfig_1=require("../core/json/projectconfig"),defaultIgnores=["node_modules/**/*","**/node_modules/**","**/.git/**",".git/**/*","**/.svn/**",".svn/**/*",".DS_Store","**/.DS_Store"];class Project{constructor(t){this.miniprogramRoot="",this.pluginRoot="",this._appid="",this._projectPath="",this._dirSet=new Set,this._fileSet=new Set,this._fileBufferCache={},this._privateKey="",this._ignores=[];const{appid:e,type:i,projectPath:r,ignores:s,privateKey:o="",privateKeyPath:a=""}=t;if(!e)throw new error_1.CodeError(locales_1.default.config.SHOULD_NOT_BE_EMPTY.format("appid"),config_1.PARAM_ERROR);if(!r)throw new error_1.CodeError(locales_1.default.config.SHOULD_NOT_BE_EMPTY.format("projectPath"),config_1.PARAM_ERROR);if(o)this._privateKey=o;else{if(!a)throw new error_1.CodeError(locales_1.default.config.SHOULD_NOT_BE_EMPTY.format("privateKeyPath"),config_1.PARAM_ERROR);try{this._privateKey=fs_1.default.readFileSync(a).toString("utf8")}catch(t){throw new error_1.CodeError(t.toString(),config_1.PARAM_ERROR)}}this._appid=e,this._type=i||"miniProgram",this._projectPath=r,this.init(s)}init(t=[]){(0,request_1.initGlobalProxy)(),this._ignores=t,this.updateFiles()}cacheDirName(t){this._dirSet.has(t)||(this._dirSet.add(t),this.cacheDirName(path_1.default.posix.dirname(t)))}getTargetPath(t,e){return(0,tools_1.normalizePath)(path_1.default.posix.join(t,e)).replace(/\/$/,"").replace(/^\//,"")}updateFiles(){this._fileBufferCache={};const t=glob_1.default.sync("**",{nodir:!1,ignore:[...defaultIgnores,...this._ignores],nosort:!0,strict:!1,silent:!0,cwd:this.projectPath,absolute:!1,mark:!0,dot:!0});for(const e of t){const t=e.replace(/\\/g,path_1.default.posix.sep),i=fs_1.default.statSync(path_1.default.posix.join(this.projectPath,e));i.isDirectory()&&this.cacheDirName(t.replace(/\/$/,"")),i.isFile()&&(this._fileSet.add(t),this.cacheDirName(path_1.default.posix.dirname(t)))}}async attr(){return this._attr||(this._attr=await(0,projectattr_1.getProjectAttr)(this._privateKey,this._appid)),this._attr}get projectPath(){return this._projectPath}get appid(){return this._appid}get type(){return this._type}get privateKey(){return this._privateKey||""}getFilesAndDirs(){return{files:Array.from(this._fileSet),dirs:Array.from(this._dirSet)}}async getExtAppid(){if(this._extAppid)return this._extAppid;if(null!==this._extAppid)try{const t=await(0,projectconfig_1.getProjectConfigJSON)(this),{miniprogramRoot:e=""}=t,i=await this.getFile(e,"ext.json"),r=JSON.parse(i.toString("utf-8"));return r.extEnable&&r.extAppid?this._extAppid=r.extAppid:this._extAppid=null,this._extAppid}catch(t){this._extAppid=null}}stat(t,e){const i=this.getTargetPath(t,e);if(this._fileSet.has(i)){return{isFile:!0,isDirectory:!1,size:fs_1.default.statSync(path_1.default.posix.join(this.projectPath,i)).size}}if(this._dirSet.has(i))return{isFile:!1,isDirectory:!0}}getFile(t,e){const i=this.getTargetPath(t,e),r=(0,tools_1.normalizePath)(path_1.default.posix.join(this.projectPath,i));return this._fileBufferCache[i]?this._fileBufferCache[i]:fs_1.default.readFileSync(r,null)}getFileList(t,e=""){return Array.from(this._fileSet).filter(i=>(!e||path_1.default.posix.extname(i)===e)&&(!t||0===i.indexOf(t)))}async onFileChange(t,e){if(e=(0,tools_1.normalizePath)(e).replace(/\/$/,"").replace(/^\//,""),"add"!==t&&"addDir"!==t||(this.cacheDirName(path_1.default.posix.dirname(e)),this._fileSet.add(e)),"addDir"===t&&this.cacheDirName(e),"unlink"===t&&this._fileSet.has(e)&&this._fileSet.delete(e),"unlinkDir"===t&&this._dirSet.has(e)){this._dirSet.delete(e);const t=e+"/",i=Array.from(this._dirSet);for(const e of i)0===e.indexOf(t)&&this._dirSet.delete(e);const r=Array.from(this._fileSet);for(const e of r)0===e.indexOf(t)&&this._fileSet.delete(e)}"change"===t&&this._fileSet.has(e)&&delete this._fileBufferCache[e]}}exports.Project=Project;
|
|
3
|
+
}(require("licia/lazyImport")(require), require)
|
package/dist/ci/projectattr.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
!function(require, directRequire){
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getProjectAttr=void 0;const tslib_1=require("tslib"),request_1=require("../utils/request"),sign_1=require("../utils/sign"),log_1=(0,tslib_1.__importDefault)(require("../utils/log")),config_1=require("../config"),url_config_1=require("../utils/url_config"),jsonParse_1=require("../utils/jsonParse"),testCache={};async function getProjectAttr(e,t){try{if(global.useAttrCache&&testCache[t])return testCache[t];const r=await(0,sign_1.getSignature)(e,t),{body:o}=await(0,request_1.request)({url:url_config_1.GET_ATTR_URL,method:"post",body:JSON.stringify({appid:t,signature:r}),headers:{"content-type":"application/json"}}),s=(0,jsonParse_1.jsonRespParse)(o,url_config_1.GET_ATTR_URL);if(0===s.errCode)return global.useAttrCache&&(testCache[t]=s.data),s.data;log_1.default.error(`get ${t} project attr fail errCode: ${s.errCode}, errMsg: ${s.errMsg}`)}catch(e){log_1.default.error(`get ${t} project attr fail ${e}`)}return config_1.DefaultProjectAttr}exports.getProjectAttr=getProjectAttr;
|
|
3
|
+
}(require("licia/lazyImport")(require), require)
|
package/dist/ci/upload.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
!function(require, directRequire){
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.innerUpload=exports.upload=exports.SIGNATURE_FILE_NAME=void 0;const tslib_1=require("tslib"),request_1=require("../utils/request"),compile_1=require("../core/compile"),pack_1=require("./utils/pack"),zlib_1=(0,tslib_1.__importDefault)(require("zlib")),sign_1=require("../utils/sign"),tools_1=require("../utils/tools"),config_1=require("../config"),taskstatus_1=require("../utils/taskstatus"),log_1=(0,tslib_1.__importDefault)(require("../utils/log")),error_1=require("../utils/error"),locales_1=(0,tslib_1.__importDefault)(require("../utils/locales/locales")),querystring_1=(0,tslib_1.__importDefault)(require("querystring")),url_config_1=require("../utils/url_config"),jsonParse_1=require("../utils/jsonParse"),cache_1=require("../utils/cache"),cos_upload_1=require("./cos-upload");exports.SIGNATURE_FILE_NAME="ci.signature";const MIN_COS_UPLOAD_SIZE=5242880;async function upload(e){var o;const t=await innerUpload(e);return(null===(o=t.respBody)||void 0===o?void 0:o.dev_plugin_id)&&(log_1.default.log("Development Version Plugin ID: "+t.respBody.dev_plugin_id),t.devPluginId=t.respBody.dev_plugin_id),{subPackageInfo:t.subPackageInfo,pluginInfo:t.pluginInfo,devPluginId:t.devPluginId}}async function innerUpload(e){const{project:o,setting:t={},desc:r=`robot ${e.robot||"1"} use miniprogram-ci to upload at ${(0,tools_1.formatTime)(new Date)}`,version:i="",robot:a="1",onProgressUpdate:l=function(e){console.log(""+e)},test:s,pagePath:n,searchQuery:u,threads:p=0}=e;let{useCOS:_}=e;if(process.env.COMPILE_THREADS=p.toString(),!i)throw new error_1.CodeError(locales_1.default.config.PARAM_ERROR.format("upload","version"),config_1.PARAM_ERROR);if(!o)throw new error_1.CodeError(locales_1.default.config.PARAM_ERROR.format("upload","project"),config_1.PARAM_ERROR);cache_1.cacheManager.clean();let d=await(0,compile_1.compile)(o,{setting:t,onProgressUpdate:l}),c=config_1.CI_VERSION;const f={codeprotect:t.codeProtect?1:0,type:o.type,appid:o.appid,version:i,desc:r,robot:a},g={scene:e.scene||1011};let b;n&&(g.path=n,f.path=n),u&&(g.query=querystring_1.default.parse(u)),f.debugLaunchInfo=JSON.stringify(g),n&&u&&(f.path+="?"+u);let y={};try{b=await o.getFile(o.miniprogramRoot,"ext.json"),y=JSON.parse(b.toString("utf-8"))}catch(e){}if(y&&(y.extEnable&&(f.extAppId=y.extAppid),y.directCommit)){let e="";e=y.extEnable?"The code will be uploaded into the waiting list of extAppid.":"The code will be uploaded into the draft box of the third-party platform.",log_1.default.warn(e)}try{const e=new taskstatus_1.TaskStatus(locales_1.default.config.UPLOAD.toString());l(e);const t=`${s?url_config_1.TEST_SOURCE_URL:url_config_1.UPLOAD_URL}?${querystring_1.default.stringify(f)}`;let r,i=!1,n=0;const u=(0,pack_1.pack)(d),p=zlib_1.default.gzipSync(u.buffer);if(log_1.default.info("useCOS parameter: ",_),log_1.default.info("upload zip buffer size: ",p.length),void 0===_&&(_=p.length>5242880),_){log_1.default.info("upload by COS: ",_);const e=await(0,cos_upload_1.uploadByCos)(p,t,o,a);e.fallback?(i=e.fallback,log_1.default.info("upload by COS failed, fallback to http way")):(r={body:e.body},n=e.uploadCOSCostTime)}if(!_||i){const e=await(0,sign_1.getSignature)(o.privateKey,o.appid);d[exports.SIGNATURE_FILE_NAME]=JSON.stringify({signature:e,version:c});const i=(0,pack_1.pack)(d),a=zlib_1.default.gzipSync(i.buffer);log_1.default.info("request url:",t);let l=(await(0,request_1.request)({url:t,method:"post",body:a})).body.toString();if(r=(0,jsonParse_1.jsonRespParse)(l,t),0!==r.errCode)throw new Error(l)}e.done(),l(e);const g={respBody:r.body};if(Array.isArray(r.body.subpackage_info)){const e=r.body.subpackage_info;g.subPackageInfo=e}if(Array.isArray(r.body.ext_plugin_info)){const e=r.body.ext_plugin_info;g.pluginInfo=e.map(e=>({pluginProviderAppid:e.provider,version:e.version,size:e.size}))}return g}catch(e){throw new error_1.CodeError(e.toString(),config_1.UPLOAD_CGI_ERR)}}exports.upload=upload,exports.innerUpload=innerUpload;
|
|
3
|
+
}(require("licia/lazyImport")(require), require)
|
package/dist/ci/utils/pack.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
!function(require, directRequire){
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.pack=void 0;const B_PROTOCOL=0,B_PROTOCOL_VERSION=1,B_FILEINFO_LEN=2,B_FILEDATA_LEN=3,B_PROTOCOL_END=4;function pack(t){const e=[Buffer.alloc(1),Buffer.alloc(4),Buffer.alloc(4),Buffer.alloc(4),Buffer.alloc(1)];e[0][0]=190,e[1].writeInt32BE(0,0),e[4][0]=237;const f=Object.keys(t),r=f.length,c=[],n=[];let o=0;for(const e of f){const f=e.replace(/\\/g,"/"),r=f.startsWith("/")?f:"/"+f,l=Buffer.from(r);c.push(l);const a=t[e];let B;if(a instanceof Buffer)B=a;else{if("string"!=typeof a)throw new Error("pack invalid data: "+e);B=Buffer.from(a,"utf8")}n.push(B),/\.js\.map$/.test(e)||(o+=B.length,o+=l.length)}let l=18+12*r+Buffer.concat(c).length;const a=c.map((t,e)=>{const f=Buffer.alloc(4);f.writeInt32BE(t.length,0);const r=Buffer.alloc(4),c=n[e].length,o=l;r.writeInt32BE(o,0),l+=c;const a=Buffer.alloc(4);return a.writeInt32BE(c,0),Buffer.concat([f,t,r,a])}),B=Buffer.alloc(4);B.writeInt32BE(r,0),a.unshift(B);const s=Buffer.concat(a),u=Buffer.concat(n);e[2].writeInt32BE(s.length,0),e[3].writeInt32BE(u.length,0);const i=Buffer.concat(e);return{validSize:o,buffer:Buffer.concat([i,s,u])}}exports.pack=pack;
|
|
3
|
+
}(require("licia/lazyImport")(require), require)
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
!function(require, directRequire){
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.packFiledir=exports.packFileMap=void 0;const tslib_1=require("tslib"),fs_1=(0,tslib_1.__importDefault)(require("fs")),path_1=(0,tslib_1.__importDefault)(require("path")),crypto_1=(0,tslib_1.__importDefault)(require("crypto")),glob_1=(0,tslib_1.__importDefault)(require("glob")),packFileMap=(e,t={})=>{const r=[Buffer.alloc(1),Buffer.alloc(4),Buffer.alloc(4),Buffer.alloc(4),Buffer.alloc(1)];r[0][0]=190,r[1].writeInt32BE(0,0),r[4][0]=237;let o=0;const l=[],c=[],f={};let i=0;for(const r in e){const n=Buffer.isBuffer(e[r])?e[r]:Buffer.from(e[r]);if(t.needMd5){const e=crypto_1.default.createHash("md5");e.update(n);const o=e.digest("hex");if(f[r]=o,t.ignoreFileMd5&&t.ignoreFileMd5[r]===o)continue}const a=Buffer.from("/"+r.replace(/\\/g,"/"));o++,l.push(a),c.push(n),/\.js\.map$/.test(r)||(i+=n.length,i+=a.length,i+=12)}let n=18+12*o+Buffer.concat(l).length;const a=l.map((e,t)=>{const r=Buffer.alloc(4);r.writeInt32BE(e.length,0);const o=Buffer.alloc(4),l=c[t].length,f=n;o.writeInt32BE(f,0),n+=l;const i=Buffer.alloc(4);return i.writeInt32BE(l,0),Buffer.concat([r,e,o,i])}),s=Buffer.alloc(4);s.writeInt32BE(o,0),a.unshift(s);const u=Buffer.concat(a),p=Buffer.concat(c);r[2].writeInt32BE(u.length,0),r[3].writeInt32BE(p.length,0);const B=Buffer.concat(r);return i+=18,{data:Buffer.concat([B,u,p]),totalSize:i,fileMd5Info:f}};exports.packFileMap=packFileMap;const packFiledir=(e,t={})=>new Promise((r,o)=>{const l=Object.assign({nodir:!0},t);(0,glob_1.default)(e+"/**",l,(l,c)=>{if(l)return o(l);const f={};c.forEach(t=>{const r=fs_1.default.readFileSync(t),o=path_1.default.relative(e,t);f[o]=r});const i=(0,exports.packFileMap)(f,t);r(i)})});exports.packFiledir=packFiledir;
|
|
3
|
+
}(require("licia/lazyImport")(require), require)
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
!function(require, directRequire){
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.generateTerminalQrcode=void 0;const qrcodeTerminal=require("qrcode-terminal"),QrCode=require("qrcode-reader"),Jimp=require("jimp");async function generateTerminalQrcode(e){return new Promise((r,o)=>{const n=Buffer.from(e,"base64");Jimp.read(n,(function(n,t){n&&o(n);const c=new QrCode;c.callback=function(n,t){n&&o(n),t&&t.result?qrcodeTerminal.generate(t.result,e=>{r(e)}):o("qrcode decode error, no result, qrcodeDataURI: "+e)},c.decode(t.bitmap)}))})}exports.generateTerminalQrcode=generateTerminalQrcode;
|
|
3
|
+
}(require("licia/lazyImport")(require), require)
|
package/dist/cli.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib"),ci=tslib_1.__importStar(require("./index")),yargs_1=tslib_1.__importDefault(require("yargs")),log_1=tslib_1.__importDefault(require("./utils/log"));async function run(){let e;function o(o){return{command:o,describe:o+" commands",builder:a=>a.usage(`Usage: $0 cloud ${o} <command>`).command({command:"upload",describe:"upload files",builder:e=>e.options({env:{alias:"e",desc:"env id",string:!0,demandOption:!0},path:{alias:"p",desc:"path to the local folder",string:!0,demandOption:!0},remotePath:{alias:"rp",desc:"path to the remote folder",string:!0,demandOption:!0},concurrency:{alias:"c",desc:"concurrenct upload file count",number:!0,default:5,demandOption:!0}}).group(["env","path","remotePath"],"Options:"),handler:a=>e=e=>ci.cloud["storage"===o?"uploadStorage":"uploadStaticStorage"]({project:e,env:a.env,path:a.path,remotePath:a.remotePath})}),handler:()=>{}}}const a=yargs_1.default.usage("Usage: miniprogram-ci <command> [options]").command("$0","",a=>{a.command({command:"preview",describe:"preview project and get a preview qrcode",builder:e=>e.options("appid",{describe:"project appid",string:!0,demandOption:!0}).options("project-path",{alias:"pp",describe:"project path",string:!0,demandOption:!0}).options("private-key-path",{alias:"pkp",describe:"private key path",string:!0,demandOption:!0}),handler:()=>{}}).command({command:"upload",describe:"upload project",builder:e=>e.options("appid",{describe:"project appid",string:!0,demandOption:!0}).options("project-path",{alias:"pp",describe:"project path",string:!0,demandOption:!0}).options("private-key-path",{alias:"pkp",describe:"private key path",string:!0,demandOption:!0}),handler:()=>{}}).command({command:"get-compiled-result",describe:"get local compiled result, which will be uploaded to the server",builder:e=>e.options("appid",{describe:"project appid",string:!0,demandOption:!0}).options("project-path",{alias:"pp",describe:"project path",string:!0,demandOption:!0}).options("private-key-path",{alias:"pkp",describe:"private key path",string:!0,demandOption:!0}).options("save-path",{alias:"sp",describe:"save path",string:!0,demandOption:!0}),handler:()=>{}}).command({command:"pack-npm",describe:"pack npm modules for miniprogram",builder:e=>e.demandOption("appid").demandOption("project-path").demandOption("private-key-path"),handler:()=>{}}).command({command:"get-dev-source-map",describe:"get source map of last upload version",builder:e=>e.demandOption("appid").demandOption("project-path").demandOption("private-key-path").options("robot",{alias:"r",describe:"the robot user who is uploading the project",string:!0,default:"1",choices:["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30"],demandOption:!0}).options("source-map-save-path",{describe:"path to save source map zip",string:!0,demandOption:!0}),handler:()=>{}}).command({command:"pack-npm-manually",describe:"pack npm modules with specified node_modules position",builder:e=>e.options({"pack-npm-manually-package-json-path":{desc:"path of node_modules related package.json",string:!0,demandOption:!0},"pack-npm-manually-miniprogram-npm-dist-dir":{desc:"path of target miniprogram_npm position",string:!0,demandOption:!0},ignores:{alias:"i",desc:"ignore files, glob format",array:!0,demandOption:!1}}).group(["pack-npm-manually-package-json-path","pack-npm-manually-miniprogram-npm-dist-dir","ignores"],"Options:"),handler:e=>{(async()=>{const o=await ci.packNpmManually({packageJsonPath:String(e.packNpmManuallyPackageJsonPath),miniprogramNpmDistDir:String(e.packNpmManuallyMiniprogramNpmDistDir),ignores:[]});log_1.default.log("pack npm done, pack result:",o)})()}}).command({command:"cloud",describe:"cloudbase commands",builder:a=>a.usage("Usage: $0 cloud <command>").command({command:"functions",describe:"cloudfunctions commands",builder:o=>o.usage("Usage: $0 cloud functions <command>").command({command:"upload",describe:"upload a cloudfunction",builder:e=>e.options({env:{alias:"e",desc:"env id",string:!0,demandOption:!0},name:{alias:"n",desc:"cloudfunction name",string:!0,demandOption:!0},path:{alias:"p",desc:"path to the folder containing cloudfunction code",string:!0,demandOption:!0},"remote-npm-install":{alias:"rnpm",desc:"if true, node_modules will not be uploaded and NPM dependencies will be installed in the cloud. if false, node_modules will be uploaded.",boolean:!0}}).group(["env","name","path","remote-npm-install"],"Options:"),handler:o=>e=e=>ci.cloud.uploadFunction({project:e,env:o.env,name:o.name,path:o.path,remoteNpmInstall:o["remote-npm-install"]})}),handler:()=>{}}).command(o("storage")).command(o("staticstorage")).command({command:"container",describe:"container commands",builder:o=>o.usage("Usage: $0 cloud container <command>").command({command:"create",describe:"create a version by uploading package",builder:e=>e.options({env:{alias:"e",desc:"env id",string:!0,demandOption:!0},flow:{desc:"flow ratio of this version",number:!0,demandOption:!0},cpu:{desc:"cpu cores of this version",number:!0,demandOption:!0},mem:{desc:"memory gigabytes of this version",number:!0,demandOption:!0},min:{desc:"minimal copies",number:!0,demandOption:!0},max:{desc:"maximum copies",number:!0,demandOption:!0},threshold:{desc:"cpu threshold for auto scaling",number:!0,demandOption:!0},port:{desc:"container listening port for liveness",number:!0,demandOption:!0},service:{desc:"service name",string:!0,demandOption:!0},remark:{desc:"version remark",string:!0},envParams:{desc:"stringified environment parameters Record<string, string>",string:!0,default:"{}"},allowHttp:{desc:"allow direct http request to this version",boolean:!0,default:!1},containerRoot:{alias:"cr",desc:"path to the container folder",string:!0,demandOption:!0},dockerfilePath:{desc:"custom docker file path",string:!0},buildDir:{desc:"build directory",string:!0}}).group(["env","flow","cpu","mem","min","max","threshold","port","service","remark","envParams","allowHttp","containerRoot","dockerfilePath","buildDir"],"Options:"),handler:o=>e=e=>ci.cloud.uploadContainer({project:e,env:o.env,containerRoot:o.containerRoot,version:{flowRatio:o.flow,cpu:o.cpu,mem:o.mem,minNum:o.min,maxNum:o.max,policyType:"cpu",policyThreshold:o.threshold,containerPort:o.port,serverName:o.service,uploadType:"package",buildDir:o.buildDir,envParams:o.envParams,dockerfilePath:o.dockerfilePath,useHttpRoute:o.allowHttp,versionRemark:o.remark}})}),handler:()=>{}}),handler:()=>{}}).options("appid",{describe:"project appid",string:!0}).options("project-path",{alias:"pp",describe:"project path",string:!0}).options("private-key-path",{alias:"pkp",describe:"private key path",string:!0}).options("locales",{describe:"set locales",default:"en",string:!0,choices:["en","zh"]}).option("verbose",{alias:"v",description:"run with verbose logging",default:!0,boolean:!0}).options("proxy",{describe:"proxy url",default:"",string:!0}).options("project-type",{alias:"pt",describe:"project type",string:!0,default:"miniProgram",choices:["miniProgram","miniGame","miniProgramPlugin","miniGamePlugin"]}).options("project-ignores",{alias:"pi",describe:"project ignores",array:!0}).options("upload-description",{alias:"ud",describe:"the uploaded code version description",string:!0}).options("upload-version",{alias:"uv",describe:"the uploaded code version description",string:!0,demandOption:process.argv.includes("preview")||process.argv.includes("upload")&&!process.argv.includes("cloud")}).options("threads",{describe:"the number indicates how many threads will be created for compile the source files",number:!0,default:0,demandOption:process.argv.includes("preview")||process.argv.includes("upload")&&!process.argv.includes("cloud")}).options("use-cos",{describe:"enable uploading code-package through the async way, which is more stable than the direct way",boolean:!0,default:!1,demandOption:process.argv.includes("preview")||process.argv.includes("upload")&&!process.argv.includes("cloud")}).options("robot",{alias:"r",describe:"the robot user who is uploading the project",string:!0,default:"1",choices:["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30"]}).options("enable-es6",{describe:"enable transform from es6 to es5",default:!1,boolean:!0}).options("enable-es7",{describe:"enable transform from es7 to es5",default:!1,boolean:!0}).options("enable-autoprefixwxss",{describe:"enable autoprefixwxss",default:!1,boolean:!0}).options("enable-minify-wxss",{describe:"enable minify wxss",default:!1,boolean:!0}).options("enable-minify-wxml",{describe:"enable minify wxml",default:!1,boolean:!0}).options("enable-minify-js",{describe:"enable minify js",default:!1,boolean:!0}).options("enable-minify",{describe:"enable minify js/wxml/wxss",default:!1,boolean:!0}).options("enable-code-protect",{describe:"enable code protect",default:!1,boolean:!0}).options("enable-qrcode",{describe:"enable generate weapp qrcode",default:!1,boolean:!0}).options("qrcode-format",{describe:"format of output qrcode",default:"terminal",string:!0,choices:["base64","image","terminal"]}).options("qrcode-output-dest",{describe:"destination of output qrcode",string:!0}).options("preview-page-path",{describe:"preview with page path",string:!0}).options("preview-search-query",{describe:'preview with query, Tips: "&" should be "\\&" in command line',string:!0}).options("scene",{describe:"preview with scene, about scene: https://developers.weixin.qq.com/miniprogram/dev/reference/scene-list.html",string:!0})},e=>e).help().argv;if(a.help&&(yargs_1.default.showHelp(),process.exit(0)),a.proxy&&ci.proxy(a.proxy),ci.setLocale(a.locales),a._&&!a._.includes("pack-npm-manually")){const o=new ci.Project({appid:a.appid,projectPath:a.projectPath,privateKeyPath:a.privateKeyPath,type:a.projectType,ignores:a.projectIgnores});if(e)await e(o);else if(a._.includes("upload"))await ci.upload({project:o,setting:{es6:a.enableEs6,es7:a.enableEs7,minify:a.enableMinify,autoPrefixWXSS:a.enableHijack,minifyWXML:a.enableMinify||a.enableMinifyWxml,minifyWXSS:a.enableMinify||a.enableMinifyWxss,minifyJS:a.enableMinify||a.enableMinifyJs,codeProtect:a.enableCodeProtect},threads:a.threads,version:a.uploadVersion,desc:a.uploadDescription,robot:a.robot,onProgressUpdate:e=>{a.verbose&&log_1.default.log(""+e)}});else if(a._.includes("preview")){let e=a.scene;e&&(e=parseInt(e,10)),await ci.preview({project:o,setting:{es6:a.enableEs6,es7:a.enableEs7,minify:a.enableMinify,autoPrefixWXSS:a.enableHijack,minifyWXML:a.enableMinify||a.enableMinifyWxml,minifyWXSS:a.enableMinify||a.enableMinifyWxss,minifyJS:a.enableMinify||a.enableMinifyJs,codeProtect:a.enableCodeProtect},threads:a.threads,version:a.uploadVersion,desc:a.uploadDescription,robot:a.robot,pagePath:a.previewPagePath,searchQuery:a.previewSearchQuery,scene:e,onProgressUpdate:e=>{a.verbose&&log_1.default.log(""+e)},qrcodeFormat:a.qrcodeFormat,qrcodeOutputDest:a.qrcodeOutputDest})}else if(a._.includes("get-compiled-result")){let e=a.scene;e&&(e=parseInt(e,10)),await ci.getCompiledResult({project:o,setting:{es6:a.enableEs6,es7:a.enableEs7,minify:a.enableMinify,autoPrefixWXSS:a.enableHijack,minifyWXML:a.enableMinify||a.enableMinify,minifyWXSS:a.enableMinify||a.enableMinifyWxss,minifyJS:a.enableMinify||a.enableMinifyJs,codeProtect:a.enableCodeProtect},threads:a.threads,version:a.uploadVersion,desc:a.uploadDescription,robot:a.robot,pagePath:a.previewPagePath,searchQuery:a.previewSearchQuery,scene:e,onProgressUpdate:e=>{a.verbose&&log_1.default.log(""+e)},qrcodeFormat:a.qrcodeFormat,qrcodeOutputDest:a.qrcodeOutputDest},a.savePath)}else if(a._.includes("pack-npm")){const e=await ci.packNpm(o,{ignores:a.packNpmIgnores,reporter:e=>{a.verbose&&console.log(e)}})||[];e.length&&(log_1.default.log("Pack npm warning:"),log_1.default.log(e.map((e,o)=>`${o+1}. ${e.msg}\n \t> code: ${e.code}\n \t@ ${e.jsPath}:${e.startLine}-${e.endLine}`).join("---------------\n")))}else a._.includes("get-dev-source-map")&&(await ci.getDevSourceMap({project:o,robot:parseInt(a.robot,10),sourceMapSavePath:a.sourceMapSavePath}),log_1.default.info(`save sourcemap.zip to ${a.sourceMapSavePath} successfully`))}}run().catch(e=>{console.error(e),process.exit(1)});
|
|
1
|
+
!function(require, directRequire){
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib"),ci=(0,tslib_1.__importStar)(require("./index")),yargs_1=(0,tslib_1.__importDefault)(require("yargs")),log_1=(0,tslib_1.__importDefault)(require("./utils/log"));async function run(){let e;function o(o){return{command:o,describe:o+" commands",builder:a=>a.usage(`Usage: $0 cloud ${o} <command>`).command({command:"upload",describe:"upload files",builder:e=>e.options({env:{alias:"e",desc:"env id",string:!0,demandOption:!0},path:{alias:"p",desc:"path to the local folder",string:!0,demandOption:!0},remotePath:{alias:"rp",desc:"path to the remote folder",string:!0,demandOption:!0},concurrency:{alias:"c",desc:"concurrenct upload file count",number:!0,default:5,demandOption:!0}}).group(["env","path","remotePath"],"Options:"),handler:a=>e=e=>ci.cloud["storage"===o?"uploadStorage":"uploadStaticStorage"]({project:e,env:a.env,path:a.path,remotePath:a.remotePath})}),handler:()=>{}}}const a=yargs_1.default.usage("Usage: miniprogram-ci <command> [options]").command("$0","",a=>{a.command({command:"preview",describe:"preview project and get a preview qrcode",builder:e=>e.options("appid",{describe:"project appid",string:!0,demandOption:!0}).options("project-path",{alias:"pp",describe:"project path",string:!0,demandOption:!0}).options("private-key-path",{alias:"pkp",describe:"private key path",string:!0,demandOption:!0}),handler:()=>{}}).command({command:"upload",describe:"upload project",builder:e=>e.options("appid",{describe:"project appid",string:!0,demandOption:!0}).options("project-path",{alias:"pp",describe:"project path",string:!0,demandOption:!0}).options("private-key-path",{alias:"pkp",describe:"private key path",string:!0,demandOption:!0}),handler:()=>{}}).command({command:"get-compiled-result",describe:"get local compiled result, which will be uploaded to the server",builder:e=>e.options("appid",{describe:"project appid",string:!0,demandOption:!0}).options("project-path",{alias:"pp",describe:"project path",string:!0,demandOption:!0}).options("private-key-path",{alias:"pkp",describe:"private key path",string:!0,demandOption:!0}).options("save-path",{alias:"sp",describe:"save path",string:!0,demandOption:!0}),handler:()=>{}}).command({command:"pack-npm",describe:"pack npm modules for miniprogram",builder:e=>e.demandOption("appid").demandOption("project-path").demandOption("private-key-path"),handler:()=>{}}).command({command:"get-dev-source-map",describe:"get source map of last upload version",builder:e=>e.demandOption("appid").demandOption("project-path").demandOption("private-key-path").options("robot",{alias:"r",describe:"the robot user who is uploading the project",string:!0,default:"1",choices:["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30"],demandOption:!0}).options("source-map-save-path",{describe:"path to save source map zip",string:!0,demandOption:!0}),handler:()=>{}}).command({command:"pack-npm-manually",describe:"pack npm modules with specified node_modules position",builder:e=>e.options({"pack-npm-manually-package-json-path":{desc:"path of node_modules related package.json",string:!0,demandOption:!0},"pack-npm-manually-miniprogram-npm-dist-dir":{desc:"path of target miniprogram_npm position",string:!0,demandOption:!0},ignores:{alias:"i",desc:"ignore files, glob format",array:!0,demandOption:!1}}).group(["pack-npm-manually-package-json-path","pack-npm-manually-miniprogram-npm-dist-dir","ignores"],"Options:"),handler:e=>{(async()=>{const o=await ci.packNpmManually({packageJsonPath:String(e.packNpmManuallyPackageJsonPath),miniprogramNpmDistDir:String(e.packNpmManuallyMiniprogramNpmDistDir),ignores:[]});log_1.default.log("pack npm done, pack result:",o)})()}}).command({command:"cloud",describe:"cloudbase commands",builder:a=>a.usage("Usage: $0 cloud <command>").command({command:"functions",describe:"cloudfunctions commands",builder:o=>o.usage("Usage: $0 cloud functions <command>").command({command:"upload",describe:"upload a cloudfunction",builder:e=>e.options({env:{alias:"e",desc:"env id",string:!0,demandOption:!0},name:{alias:"n",desc:"cloudfunction name",string:!0,demandOption:!0},path:{alias:"p",desc:"path to the folder containing cloudfunction code",string:!0,demandOption:!0},"remote-npm-install":{alias:"rnpm",desc:"if true, node_modules will not be uploaded and NPM dependencies will be installed in the cloud. if false, node_modules will be uploaded.",boolean:!0}}).group(["env","name","path","remote-npm-install"],"Options:"),handler:o=>e=e=>ci.cloud.uploadFunction({project:e,env:o.env,name:o.name,path:o.path,remoteNpmInstall:o["remote-npm-install"]})}),handler:()=>{}}).command(o("storage")).command(o("staticstorage")).command({command:"container",describe:"container commands",builder:o=>o.usage("Usage: $0 cloud container <command>").command({command:"create",describe:"create a version by uploading package",builder:e=>e.options({env:{alias:"e",desc:"env id",string:!0,demandOption:!0},flow:{desc:"flow ratio of this version",number:!0,demandOption:!0},cpu:{desc:"cpu cores of this version",number:!0,demandOption:!0},mem:{desc:"memory gigabytes of this version",number:!0,demandOption:!0},min:{desc:"minimal copies",number:!0,demandOption:!0},max:{desc:"maximum copies",number:!0,demandOption:!0},threshold:{desc:"cpu threshold for auto scaling",number:!0,demandOption:!0},port:{desc:"container listening port for liveness",number:!0,demandOption:!0},service:{desc:"service name",string:!0,demandOption:!0},remark:{desc:"version remark",string:!0},envParams:{desc:"stringified environment parameters Record<string, string>",string:!0,default:"{}"},allowHttp:{desc:"allow direct http request to this version",boolean:!0,default:!1},containerRoot:{alias:"cr",desc:"path to the container folder",string:!0,demandOption:!0},dockerfilePath:{desc:"custom docker file path",string:!0},buildDir:{desc:"build directory",string:!0}}).group(["env","flow","cpu","mem","min","max","threshold","port","service","remark","envParams","allowHttp","containerRoot","dockerfilePath","buildDir"],"Options:"),handler:o=>e=e=>ci.cloud.uploadContainer({project:e,env:o.env,containerRoot:o.containerRoot,version:{flowRatio:o.flow,cpu:o.cpu,mem:o.mem,minNum:o.min,maxNum:o.max,policyType:"cpu",policyThreshold:o.threshold,containerPort:o.port,serverName:o.service,uploadType:"package",buildDir:o.buildDir,envParams:o.envParams,dockerfilePath:o.dockerfilePath,useHttpRoute:o.allowHttp,versionRemark:o.remark}})}),handler:()=>{}}),handler:()=>{}}).options("appid",{describe:"project appid",string:!0}).options("project-path",{alias:"pp",describe:"project path",string:!0}).options("private-key-path",{alias:"pkp",describe:"private key path",string:!0}).options("locales",{describe:"set locales",default:"en",string:!0,choices:["en","zh"]}).option("verbose",{alias:"v",description:"run with verbose logging",default:!0,boolean:!0}).options("proxy",{describe:"proxy url",default:"",string:!0}).options("project-type",{alias:"pt",describe:"project type",string:!0,default:"miniProgram",choices:["miniProgram","miniGame","miniProgramPlugin","miniGamePlugin"]}).options("project-ignores",{alias:"pi",describe:"project ignores",array:!0}).options("upload-description",{alias:"ud",describe:"the uploaded code version description",string:!0}).options("upload-version",{alias:"uv",describe:"the uploaded code version description",string:!0,demandOption:process.argv.includes("preview")||process.argv.includes("upload")&&!process.argv.includes("cloud")}).options("threads",{describe:"the number indicates how many threads will be created for compile the source files",number:!0,default:0,demandOption:process.argv.includes("preview")||process.argv.includes("upload")&&!process.argv.includes("cloud")}).options("use-cos",{describe:"enable uploading code-package through the async way, which is more stable than the direct way",boolean:!0,default:!1,demandOption:process.argv.includes("preview")||process.argv.includes("upload")&&!process.argv.includes("cloud")}).options("robot",{alias:"r",describe:"the robot user who is uploading the project",string:!0,default:"1",choices:["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30"]}).options("enable-es6",{describe:"enable transform from es6 to es5",default:!1,boolean:!0}).options("enable-es7",{describe:"enable transform from es7 to es5",default:!1,boolean:!0}).options("enable-autoprefixwxss",{describe:"enable autoprefixwxss",default:!1,boolean:!0}).options("enable-minify-wxss",{describe:"enable minify wxss",default:!1,boolean:!0}).options("enable-minify-wxml",{describe:"enable minify wxml",default:!1,boolean:!0}).options("enable-minify-js",{describe:"enable minify js",default:!1,boolean:!0}).options("enable-minify",{describe:"enable minify js/wxml/wxss",default:!1,boolean:!0}).options("enable-code-protect",{describe:"enable code protect",default:!1,boolean:!0}).options("enable-qrcode",{describe:"enable generate weapp qrcode",default:!1,boolean:!0}).options("qrcode-format",{describe:"format of output qrcode",default:"terminal",string:!0,choices:["base64","image","terminal"]}).options("qrcode-output-dest",{describe:"destination of output qrcode",string:!0}).options("preview-page-path",{describe:"preview with page path",string:!0}).options("preview-search-query",{describe:'preview with query, Tips: "&" should be "\\&" in command line',string:!0}).options("scene",{describe:"preview with scene, about scene: https://developers.weixin.qq.com/miniprogram/dev/reference/scene-list.html",string:!0})},e=>e).help().argv;if(a.help&&(yargs_1.default.showHelp(),process.exit(0)),a.proxy&&ci.proxy(a.proxy),ci.setLocale(a.locales),a._&&!a._.includes("pack-npm-manually")){const o=new ci.Project({appid:a.appid,projectPath:a.projectPath,privateKeyPath:a.privateKeyPath,type:a.projectType,ignores:a.projectIgnores});if(e)await e(o);else if(a._.includes("upload"))await ci.upload({project:o,setting:{es6:a.enableEs6,es7:a.enableEs7,minify:a.enableMinify,autoPrefixWXSS:a.enableHijack,minifyWXML:a.enableMinify||a.enableMinifyWxml,minifyWXSS:a.enableMinify||a.enableMinifyWxss,minifyJS:a.enableMinify||a.enableMinifyJs,codeProtect:a.enableCodeProtect},threads:a.threads,version:a.uploadVersion,desc:a.uploadDescription,robot:a.robot,onProgressUpdate:e=>{a.verbose&&log_1.default.log(""+e)}});else if(a._.includes("preview")){let e=a.scene;e&&(e=parseInt(e,10)),await ci.preview({project:o,setting:{es6:a.enableEs6,es7:a.enableEs7,minify:a.enableMinify,autoPrefixWXSS:a.enableHijack,minifyWXML:a.enableMinify||a.enableMinifyWxml,minifyWXSS:a.enableMinify||a.enableMinifyWxss,minifyJS:a.enableMinify||a.enableMinifyJs,codeProtect:a.enableCodeProtect},threads:a.threads,version:a.uploadVersion,desc:a.uploadDescription,robot:a.robot,pagePath:a.previewPagePath,searchQuery:a.previewSearchQuery,scene:e,onProgressUpdate:e=>{a.verbose&&log_1.default.log(""+e)},qrcodeFormat:a.qrcodeFormat,qrcodeOutputDest:a.qrcodeOutputDest})}else if(a._.includes("get-compiled-result")){let e=a.scene;e&&(e=parseInt(e,10)),await ci.getCompiledResult({project:o,setting:{es6:a.enableEs6,es7:a.enableEs7,minify:a.enableMinify,autoPrefixWXSS:a.enableHijack,minifyWXML:a.enableMinify||a.enableMinify,minifyWXSS:a.enableMinify||a.enableMinifyWxss,minifyJS:a.enableMinify||a.enableMinifyJs,codeProtect:a.enableCodeProtect},threads:a.threads,version:a.uploadVersion,desc:a.uploadDescription,robot:a.robot,pagePath:a.previewPagePath,searchQuery:a.previewSearchQuery,scene:e,onProgressUpdate:e=>{a.verbose&&log_1.default.log(""+e)},qrcodeFormat:a.qrcodeFormat,qrcodeOutputDest:a.qrcodeOutputDest},a.savePath)}else if(a._.includes("pack-npm")){const e=await ci.packNpm(o,{ignores:a.packNpmIgnores,reporter:e=>{a.verbose&&console.log(e)}})||[];e.length&&(log_1.default.log("Pack npm warning:"),log_1.default.log(e.map((e,o)=>`${o+1}. ${e.msg}\n \t> code: ${e.code}\n \t@ ${e.jsPath}:${e.startLine}-${e.endLine}`).join("---------------\n")))}else a._.includes("get-dev-source-map")&&(await ci.getDevSourceMap({project:o,robot:parseInt(a.robot,10),sourceMapSavePath:a.sourceMapSavePath}),log_1.default.info(`save sourcemap.zip to ${a.sourceMapSavePath} successfully`))}}run().catch(e=>{console.error(e),process.exit(1)});
|
|
3
|
+
}(require("licia/lazyImport")(require), require)
|
package/dist/cloud/cloudapi.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
!function(require, directRequire){
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.boundTransactRequest=exports.get3rdCloudCodeSecret=exports.initCloudAPI=void 0;const tslib_1=require("tslib"),crypto_1=(0,tslib_1.__importDefault)(require("crypto")),request_1=(0,tslib_1.__importDefault)(require("request")),cloudAPI=(0,tslib_1.__importStar)(require("../vendor/cloud-api/src/index")),request_2=require("../utils/request"),sign_1=require("../utils/sign"),jsonParse_1=require("../utils/jsonParse"),urlConfig=(0,tslib_1.__importStar)(require("../utils/url_config"));function initCloudAPI(e){cloudAPI.setDefaultAppID(e),cloudAPI.setTransactType(cloudAPI.TransactType.IDE),cloudAPI.setRequest(transactRequest)}exports.initCloudAPI=initCloudAPI;const SERVICE_CLOUD_URL={scf:"https://scf.tencentcloudapi.com",flexdb:"https://flexdb.tencentcloudapi.com",tcb:"https://tcb.tencentcloudapi.com"},DIRECT_CLOUD_API_SET=new Set(["UpdateFunctionCode","CreateFunction"]);async function transactRequest(e){var t;const r=e.project,o=await(0,sign_1.getSignature)(r.privateKey,r.appid),s=await r.getExtAppid();if(DIRECT_CLOUD_API_SET.has(e.identity.action||"")&&Boolean(SERVICE_CLOUD_URL[e.identity.service])){const{body:i}=await(0,request_2.request)({url:urlConfig.GET_CLOUD_API_SIGNATURE,method:"post",body:JSON.stringify({appid:r.appid,extAppid:s||void 0,signature:o,signReq:{action:e.identity.action,path:e.identity.path,service:e.identity.service,version:e.identity.version,region:e.identity.region,hashed_postdata:crypto_1.default.createHash("sha256").update(e.postdata).digest("hex")}}),headers:{"content-type":"application/json"}}),n=(0,jsonParse_1.jsonRespParse)(i,"cloudapi.getCloudAPISignedHeader");if(n.errCode)throw new Error(`getCloudAPISignedHeader failed, errCode: ${i.errCode}, errMsg: ${i.errMsg}`);const a=n.header;if(!a)throw new Error("empty header, recv cgi resp: "+i);const{resp:d}=await new Promise((t,r)=>{(0,request_1.default)({url:SERVICE_CLOUD_URL[e.identity.service],method:"post",body:e.postdata,headers:a.split("\n").map(e=>e.trim()).reduce((e,t)=>{const r=t.indexOf(":");return e[t.slice(0,r)]=t.slice(r+1),e},{})},(e,o)=>{e?r(e):t({resp:o})})});if(413===d.statusCode)throw new Error("Body too large");const p=d.body;if(!p)throw new Error("Empty body "+d);const c="string"==typeof p?JSON.parse(p):p;if(!c.Response||(null===(t=c.Response)||void 0===t?void 0:t.Error))throw new Error("TencentCloud API error: "+p);return p}{const{resp:t,body:i}=await(0,request_2.request)({url:urlConfig.cloudAPIAgentURL,method:"post",body:JSON.stringify({appid:r.appid,extAppid:s||void 0,signature:o,agentReq:Object.assign({postdata:e.postdata,test:!1},e.identity)}),headers:Object.assign(Object.assign({},e.headers),{"content-type":"application/json"})});if(413===t.statusCode)throw new Error("Body too large");if(!i)throw new Error("Empty body "+t);const n="string"==typeof i?JSON.parse(i):i;if(n.errCode)throw new Error(`${n.errCode} ${n.errMsg}`);const a=n.data;if(!a||!a.base_resp||"0"!=a.base_resp.ret){if(80210===a.base_resp.ret)throw new Error("NO_CLOUD_MANAGE_PERMISSION_AUTHORIZED_TO_3RD_PLATFORM");throw new Error("Base resp abnormal, "+JSON.stringify(null==a?void 0:a.base_resp))}return a.content}}async function get3rdCloudCodeSecret(e){const t=await e.attr();let r,o="",s={};try{r=await e.getFile(e.miniprogramRoot,"ext.json"),s=JSON.parse(r.toString("utf-8"))}catch(e){}if(s&&s.extEnable&&(o=s.extAppid||""),(null==t?void 0:t.platform)&&o)try{const t=await(0,sign_1.getSignature)(e.privateKey,e.appid),{body:r}=await(0,request_2.request)({url:urlConfig.get3rdCloudCodeSecret,method:"post",headers:{"content-type":"application/json"},body:JSON.stringify({appid:e.appid,extAppid:o,signature:t})}),s=(0,jsonParse_1.jsonRespParse)(r);if(0===s.errCode)return s.codeSecret;throw new Error("get 3rd cloud codesecret invalid resp "+JSON.stringify(r))}catch(e){throw new Error("get 3rd cloud codesecret error "+e)}}function boundTransactRequest(e){return t=>transactRequest(Object.assign(Object.assign({},t),{project:e}))}exports.get3rdCloudCodeSecret=get3rdCloudCodeSecret,exports.boundTransactRequest=boundTransactRequest;
|
|
3
|
+
}(require("licia/lazyImport")(require), require)
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
!function(require, directRequire){
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.createTimeTrigger=void 0;const tslib_1=require("tslib"),cloudAPI=(0,tslib_1.__importStar)(require("../vendor/cloud-api")),cloudapi_1=require("./cloudapi"),error_1=require("../utils/error"),locales_1=(0,tslib_1.__importDefault)(require("../utils/locales/locales")),config_1=require("../config"),requiredParams=["project","envId","functionName","triggersConfig"];async function createTimeTrigger(r){if(!Array.isArray(r.triggersConfig))throw new Error("triggersConfig is not Array");requiredParams.forEach(e=>{if(!r[e])throw new error_1.CodeError(locales_1.default.config.PARAM_ERROR.format("cloud.createTimeTrigger",e),config_1.PARAM_ERROR)});const{project:e,envId:i,functionName:t,triggersConfig:o}=r,n=await e.getExtAppid();(0,cloudapi_1.initCloudAPI)(n||e.appid);const{envList:a}=await cloudAPI.tcbGetEnvironments({},{request:(0,cloudapi_1.boundTransactRequest)(e),transactType:cloudAPI.TransactType.IDE}),c=a.find(r=>r.envId===i);if(!c)throw new Error("env not found");const g=c.functions[0].region,s=o.map((r,e)=>{if("Object"!==Object.prototype.toString.call(r).slice(8,-1))throw new Error(`triggersConfig index ${e} is not Object`);if(!r.name)throw new Error(`triggersConfig index ${e} required name`);if(!r.type)throw new Error(`triggersConfig index ${e} required type`);switch(r.type){case"timer":if(!r.config)throw new Error(`triggersConfig index ${e} required config`)}return{triggerName:r.name,type:r.type,triggerDesc:r.config}});try{return await cloudAPI.scfBatchCreateTrigger({namespace:i,region:g,functionName:t,triggers:s},{request:(0,cloudapi_1.boundTransactRequest)(e),transactType:cloudAPI.TransactType.IDE}),"创建定时触发器成功"}catch(r){return"请检查传入的 triggersConfig 是否符合格式"}}exports.createTimeTrigger=createTimeTrigger;
|
|
3
|
+
}(require("licia/lazyImport")(require), require)
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
!function(require, directRequire){
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.uploadContainer=void 0;const tslib_1=require("tslib"),request_1=(0,tslib_1.__importDefault)(require("request")),utils_1=require("./utils"),util_1=require("util"),request_2=require("../utils/request"),request=(0,util_1.promisify)(request_1.default);async function uploadContainer(e){var t;const{currentEnv:o,cloudAPI:a}=await(0,utils_1.initEnvironmentByProject)(e.project,e.env),r=e.version;if("package"===r.uploadType){const o=await a.tcbDescribeCloudBaseBuildService({envId:e.env,serviceName:e.version.serverName}),i=(0,utils_1.zipFile)(e.containerRoot,{});console.log("[ ] uploading container package..."),console.time("[+] upload elapsed");const s=await request({url:o.uploadUrl,proxy:(0,request_2.getCiProxy)(),method:"PUT",headers:Object.assign({"Content-type":"application/zip"},null===(t=o.uploadHeaders)||void 0===t?void 0:t.reduce((e,{key:t,value:o})=>(e[t]=o,e),{})),body:i.generateNodeStream()});console.timeEnd("[+] upload elapsed"),console.log("[+] upload file status",s.statusCode),r.packageName=o.packageName,r.packageVersion=o.packageVersion}const i=await a.tcbCreateCloudBaseRunServerVersion(Object.assign(Object.assign({},r),{envId:o.envId}));return console.log("[+] create version done.",i),i}exports.uploadContainer=uploadContainer;
|
|
3
|
+
}(require("licia/lazyImport")(require), require)
|