tt-minigame-ide-cli 2.0.4 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -80,7 +80,7 @@ export declare const SLARDAR_EVENT: {
80
80
  readonly IDE_SCENE_END: "IDE_SCENE_END";
81
81
  readonly IDE_APPID_SELECT: "IDE_APPID_SELECT";
82
82
  readonly IDE_APPID_CHANGE: "IDE_APPID_CHANGE";
83
- readonly IDE_JS_BLOCK: "IDE_JS_BLOCK";
83
+ readonly IDE_JS_LONG_TASK: "IDE_JS_LONG_TASK";
84
84
  readonly IDE_LOW_FPS: "IDE_LOW_FPS";
85
85
  readonly IDE_LOW_MEMORY: "IDE_LOW_MEMORY";
86
86
  readonly IDE_FETCH_ADMIN_XCONFIG_TMAR: "IDE_FETCH_ADMIN_XCONFIG_TMAR";
@@ -118,7 +118,18 @@ export declare const SLARDAR_EVENT: {
118
118
  readonly IDE_SCENE_USER_OPERATE: "IDE_SCENE_USER_OPERATE";
119
119
  readonly IDE_TEMPLATE_HOVER: "IDE_TEMPLATE_HOVER";
120
120
  readonly IDE_TEMPLATE_DETAIL: "IDE_TEMPLATE_DETAIL";
121
+ readonly IDE_TEMPLATE_ERROR: "IDE_TEMPLATE_ERROR";
122
+ readonly IDE_TEMPLATE_DOWNLOAD: "IDE_TEMPLATE_DOWNLOAD";
121
123
  readonly IDE_QUICK_JS_ERROR: "IDE_QUICK_JS_ERROR";
124
+ readonly IDE_REMOTE_DEBUG_CONNECTION_QUALITY: "IDE_REMOTE_DEBUG_CONNECTION_QUALITY";
125
+ readonly IDE_REMOTE_DEBUG_EXCEPTION: "IDE_REMOTE_DEBUG_EXCEPTION";
126
+ readonly IDE_MODULE_AUTH_FORCE_LOGOUT: "IDE_MODULE_AUTH_FORCE_LOGOUT";
127
+ readonly IDE_CANVAS_WEBGL_CONTEXT_ENABLE: "IDE_CANVAS_WEBGL_CONTEXT_ENABLE";
128
+ readonly IDE_LOGIN_DATA_FORMAT: "IDE_LOGIN_DATA_FORMAT";
129
+ readonly IDE_ADD_COMPILE_MODE: "IDE_ADD_COMPILE_MODE";
130
+ readonly IDE_DECODE_QRCODE: "IDE_DECODE_QRCODE";
131
+ readonly IDE_DECODE_URL: "IDE_DECODE_URL";
132
+ readonly IDE_MAIN_HELPER_FORK_TIME: "IDE_MAIN_HELPER_FORK_TIME";
122
133
  readonly IDE_LOADER_IO_ERROR: string;
123
134
  readonly IDE_LOADER_INSTALL_RECOVER_ERROR: string;
124
135
  readonly IDE_LOADER_START_FROM_ENTRY: string;
@@ -15,6 +15,8 @@ export interface IApp extends BaseApp {
15
15
  };
16
16
  path?: string;
17
17
  };
18
+ industrySDK?: boolean;
19
+ openDataContext?: string;
18
20
  }
19
21
  /**
20
22
  * JSON object wrapper for `app.json`
@@ -5,6 +5,7 @@ import type { ConditionItem } from './schema/base';
5
5
  import type { IProject } from './schema/project';
6
6
  import { CompilerPlugin } from '../constants/project';
7
7
  import { GetEnvFunction } from '../network/axios';
8
+ import { IProjectPrivate } from './schema/project.private';
8
9
  /**
9
10
  * 因为 @byted/miniprogram-utils 都是分模块打包和引入的,两个模块之间不共享数据,所以需要单独设置
10
11
  * todo 其他文件都直接引入 @byted/miniprogram-utils 而不是 @byted/miniprogram-utils/dist/xxx/xxx
@@ -54,6 +55,7 @@ export interface IProjectConfig extends IProject {
54
55
  miniprogram?: ConditionData;
55
56
  game?: ConditionData;
56
57
  };
58
+ douyinProjectType?: string;
57
59
  }
58
60
  /**
59
61
  * 此处的技术类型与 ide 的技术类型有区别
@@ -65,18 +67,33 @@ export interface IProjectConfig extends IProject {
65
67
  */
66
68
  declare type TechType = 'app' | 'game' | 'toybox';
67
69
  declare type IDEAppTechType = 'microapp' | 'toybox' | 'microgame' | 'microapp-minicode' | 'toybox-minicode' | 'microgame-minicode' | '';
70
+ export declare const PROJECT_TYPE_MAP: Record<string, TechType>;
68
71
  export declare function setIDEAppTechType(type: IDEAppTechType): void;
69
72
  export declare function getIDEAppTechType(): IDEAppTechType;
70
73
  export declare function isTestAppid(appid: string): boolean;
71
74
  export declare function getOriginAppid(appid: string, type?: TechType): string;
75
+ export declare type KeyMap = Record<string, PrivateState | {
76
+ [key in string]: PrivateState | KeyMap;
77
+ }>;
78
+ export declare enum PrivateState {
79
+ ALWAYS = "ALWAYS",
80
+ NORMAL = "NORMAL"
81
+ }
72
82
  /**
73
83
  * 包裹 ProjectConfigJSON 文件的读取。
74
84
  *
75
85
  * 绝大部分数据读取都会在此处有 fallback default value。
76
86
  * 上层调用时,通常是不需要再处理了,使用时请小心。
77
87
  */
78
- export declare class ProjectConfig extends JSONContainer<IProjectConfig> {
88
+ export declare class ProjectConfig extends JSONContainer<Partial<IProjectConfig>> {
89
+ static readonly PRIVATE_CONFIG_KEYS: KeyMap;
90
+ private static _keyPath;
91
+ static getKeyPath(): [string, PrivateState][];
92
+ static getKeyPathList(): string[];
93
+ private static generateList;
79
94
  static from(projectPath: string): Promise<ProjectConfig>;
95
+ static getMergedConfig(publicConfig: Partial<IProjectConfig>, privateConfig: Partial<IProjectPrivate>): Partial<IProjectConfig>;
96
+ update<K extends keyof IProjectConfig>(key: K, value: IProjectConfig[K], write?: boolean): Promise<void>;
80
97
  /**
81
98
  * @param projectPath path to the project that contains `project.config.json`
82
99
  */
@@ -84,13 +101,20 @@ export declare class ProjectConfig extends JSONContainer<IProjectConfig> {
84
101
  * project path
85
102
  */
86
103
  readonly projectPath: string;
87
- constructor(json: IProjectConfig, filepath: string, projectPath: string);
104
+ private readonly privateConfigPath;
105
+ private readonly publicJson;
106
+ private privateJson;
107
+ private _enablePrivateConfig;
108
+ private constructor();
109
+ enablePrivateConfig(mergedJson: Partial<IProjectConfig>, privateJson: Partial<IProjectPrivate>): void;
110
+ getPublicRawJSON(): Partial<IProjectConfig>;
111
+ getPrivateRawJSON(): Partial<IProjectPrivate>;
88
112
  getAppid(): string;
89
113
  getRealAppid(): Promise<string>;
90
114
  getSetting(): IProjectConfig['setting'];
91
115
  getProjectName(): string;
92
116
  getScripts(): IProjectConfig['scripts'];
93
- getConditionData(conditionKeyName: keyof IProjectConfig['condition']): ConditionData;
117
+ getConditionData(conditionKeyName: keyof NonNullable<IProjectConfig['condition']>): ConditionData;
94
118
  getAutoCompileSetting(): boolean;
95
119
  getLocalPluginsSetting(): boolean;
96
120
  getAfterOpenScript(): string;
@@ -25,4 +25,4 @@ declare const AxiosInstance: AxiosInstanceType;
25
25
  declare function setEnvFunction(fn: GetEnvFunction): void;
26
26
  declare function setSlardarInstance(obj: ISlardarInstance): void;
27
27
  declare function setJestMock<T extends keyof AxiosInstanceType>(mockInstance: object): void;
28
- export { AxiosInstance, defaultEnv, GetEnvFunction, setEnvFunction, setSlardarInstance, setJestMock };
28
+ export { AxiosInstance, defaultEnv, IEnvConfig, GetEnvFunction, setEnvFunction, setSlardarInstance, setJestMock };
@@ -8,6 +8,6 @@ export declare const byte2Mb: (byte: number, fixed?: number) => number;
8
8
  /** 获取文件字节数体积,实际上文件夹也支持,获取的是文件夹本身占用的系统体积(测试为 128Byte) */
9
9
  export declare const getFileByteSize: (path: string) => number;
10
10
  /** 获取指定目录下所有文件体积和,支持 glob pattern ignore */
11
- export declare const getDirByteSize: (path: string, ignore?: any[]) => Promise<number>;
11
+ export declare const getDirByteSize: (path: string, ignore?: string[], whiteList?: string[]) => Promise<number>;
12
12
  /** 获取指定路径(兼容文件 / 整个目录)大小 Byte 数 */
13
- export declare const getPathByteSize: (path: string, ignore?: any[]) => number | Promise<number>;
13
+ export declare const getPathByteSize: (path: string, ignore?: any[], whiteList?: string[]) => number | Promise<number>;
@@ -1,3 +1,5 @@
1
1
  export default function openProject(options: {
2
2
  projectPath: string;
3
+ mode?: 'full' | 'lite';
4
+ type: 'microapp' | 'microgame' | 'toybox';
3
5
  }, remotePort?: number): Promise<void>;
@@ -12,7 +12,7 @@ import fg from 'fast-glob';
12
12
  * @param options pass to fast-glob
13
13
  * @returns
14
14
  */
15
- export declare function getFolderSize(folderPath: string, useTypeScript: boolean, options?: fg.Options): Promise<number>;
15
+ export declare function getFolderSize(folderPath: string, useTypeScript: boolean, options: fg.Options, isGame: boolean): Promise<number>;
16
16
  /**
17
17
  * 以文件夹为单位的包体积统计,不适用于依赖分析
18
18
  *
@@ -38,13 +38,13 @@ declare type FolderToZipStreamOption = {
38
38
  *
39
39
  * @param dir path to folder
40
40
  */
41
- export declare function folderToZipStream(dir: string, { whiteList, useTypeScript }: FolderToZipStreamOption): Promise<archiver.Archiver>;
41
+ export declare function folderToZipStream(dir: string, { whiteList, useTypeScript }: FolderToZipStreamOption, isGame: boolean): Promise<archiver.Archiver>;
42
42
  /**
43
43
  *
44
44
  * @param dir path to microapp project
45
45
  * @returns
46
46
  */
47
- export declare function getProjectHash(dir: string): Promise<string>;
47
+ export declare function getProjectHash(dir: string, isGame: boolean): Promise<string>;
48
48
  /**
49
49
  * For cli only
50
50
  * @param input
@@ -1,7 +1,9 @@
1
1
  export declare const CLI_EVENTS: {
2
2
  IDE_CLI_LAUNCH: string;
3
3
  IDE_CLI_COMMAND_CALL: string;
4
+ IDE_CLI_PREVIEW_SUCCESS: string;
4
5
  IDE_CLI_PREVIEW_FAIL: string;
6
+ IDE_CLI_UPLOAD_SUCCESS: string;
5
7
  IDE_CLI_UPLOAD_FAIL: string;
6
8
  IDE_CLI_ERROR: string;
7
9
  };
@@ -1,5 +1,6 @@
1
1
  export interface ProjectInfo {
2
2
  path: string;
3
+ mode?: 'full' | 'lite';
3
4
  }
4
5
  export interface TMACliConfig {
5
6
  proxy: string | null;
@@ -30,6 +30,9 @@ export interface IDEBaseConfig {
30
30
  callContainer: string | null;
31
31
  websocket: string | null;
32
32
  };
33
+ extraInfo?: {
34
+ [k: string]: string;
35
+ };
33
36
  }
34
37
  export interface IDESandboxConfig {
35
38
  isSandbox?: boolean;
@@ -0,0 +1 @@
1
+ export declare function getWhiteList(isGame?: boolean): string[];
@@ -1,4 +1,9 @@
1
1
  import { microgame } from 'tt-ide-cli';
2
+ import type { ProjectInfo } from 'tt-ide-cli/types';
2
3
  declare const preview: typeof microgame.preview, upload: typeof microgame.upload;
3
4
  export { loginByEmail, loginByPhone, checkSession, buildNpm, setConfig, logout, } from 'tt-ide-cli';
4
- export { preview, upload };
5
+ declare function open(options: {
6
+ project: ProjectInfo;
7
+ remotePort?: number;
8
+ }): Promise<void>;
9
+ export { preview, upload, open };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tt-minigame-ide-cli",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "description": "Command line interface for micro app development",
5
5
  "license": "ISC",
6
6
  "main": "dist/index.js",
@@ -18,7 +18,7 @@
18
18
  "dev": "yarn dev:cli",
19
19
  "dev:cli": "cross-env NODE_ENV=development webpack --config webpack.cli.js --progress --watch",
20
20
  "prepublishOnly": "yarn build:cli",
21
- "test": "npx patch-package && jest"
21
+ "test": "jest"
22
22
  },
23
23
  "dependencies": {
24
24
  "@tt-miniprogram/ext-pack": "1.0.33",
@@ -61,4 +61,4 @@
61
61
  "publishConfig": {
62
62
  "registry": "https://registry.npmjs.org"
63
63
  }
64
- }
64
+ }