@youcan/cli 1.0.8 → 1.1.0-beta.0
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/package.json +5 -2
- package/dist/lib/cli/commands/apps/create.d.ts +0 -2
- package/dist/lib/cli/commands/apps/install.d.ts +0 -2
- package/dist/lib/cli/commands/auth/login.d.ts +0 -2
- package/dist/lib/cli/commands/auth/logout.d.ts +0 -2
- package/dist/lib/cli/commands/auth/types.d.ts +0 -6
- package/dist/lib/cli/commands/index.d.ts +0 -12
- package/dist/lib/cli/commands/store/info.d.ts +0 -2
- package/dist/lib/cli/commands/store/switch.d.ts +0 -2
- package/dist/lib/cli/commands/store/types.d.ts +0 -4
- package/dist/lib/cli/commands/theme/delete.d.ts +0 -2
- package/dist/lib/cli/commands/theme/dev.d.ts +0 -2
- package/dist/lib/cli/commands/theme/init.d.ts +0 -2
- package/dist/lib/cli/commands/theme/list.d.ts +0 -2
- package/dist/lib/cli/commands/theme/pack.d.ts +0 -2
- package/dist/lib/cli/commands/theme/pull.d.ts +0 -2
- package/dist/lib/cli/commands/theme/types.d.ts +0 -17
- package/dist/lib/cli/commands/types.d.ts +0 -22
- package/dist/lib/cli/index.d.ts +0 -12
- package/dist/lib/config/index.d.ts +0 -21
- package/dist/lib/config/messages.d.ts +0 -36
- package/dist/lib/core/client/client.d.ts +0 -23
- package/dist/lib/core/client/types.d.ts +0 -80
- package/dist/lib/core/themes/preview.d.ts +0 -1
- package/dist/lib/index.d.ts +0 -1
- package/dist/lib/utils/common.d.ts +0 -22
- package/dist/lib/utils/git/cloneRepository.d.ts +0 -6
- package/dist/lib/utils/helpers.d.ts +0 -3
- package/dist/lib/utils/http.d.ts +0 -11
- package/dist/lib/utils/network.d.ts +0 -2
- package/dist/lib/utils/system/deleteFile.d.ts +0 -5
- package/dist/lib/utils/system/ls.d.ts +0 -1
- package/dist/lib/utils/system/openLink.d.ts +0 -1
- package/dist/lib/utils/system/saveFile.d.ts +0 -1
- package/dist/lib/utils/system/stdout.d.ts +0 -20
- package/dist/lib/utils/system/writeToFile.d.ts +0 -6
- package/dist/lib/utils/system/zipFolder.d.ts +0 -5
- package/dist/lib/utils/system.d.ts +0 -1
- package/dist/test/commands/auth/login.d.ts +0 -2
- package/dist/test/commands/auth/logout.d.ts +0 -2
- package/dist/test/commands/help.d.ts +0 -2
- package/dist/test/commands/theme/delete.d.ts +0 -2
- package/dist/test/commands/theme/dev.d.ts +0 -2
- package/dist/test/commands/theme/init.d.ts +0 -2
- package/dist/test/index.test.d.ts +0 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@youcan/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.1.0-beta.0",
|
|
5
5
|
"description": "YouCan CLI for developers.",
|
|
6
6
|
"author": "YouCan <contact@youcan.shop> (https://youcan.shop)",
|
|
7
7
|
"keywords": [],
|
|
@@ -38,6 +38,8 @@
|
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@azuradara/eslint-config-base": "^0.1.3",
|
|
40
40
|
"@azuradara/eslint-config-ts": "^0.1.3",
|
|
41
|
+
"@oclif/plugin-autocomplete": "^2.3.8",
|
|
42
|
+
"@oclif/plugin-commands": "^2.2.26",
|
|
41
43
|
"@types/archiver": "^5.3.3",
|
|
42
44
|
"@types/file-saver": "^2.0.5",
|
|
43
45
|
"@types/node": "^18.18.0",
|
|
@@ -51,10 +53,11 @@
|
|
|
51
53
|
"rollup-plugin-dts": "^5.3.1",
|
|
52
54
|
"rollup-plugin-node-externals": "^6.1.1",
|
|
53
55
|
"rollup-plugin-typescript2": "^0.34.1",
|
|
56
|
+
"shx": "^0.3.4",
|
|
54
57
|
"typescript": "^4.9.5"
|
|
55
58
|
},
|
|
56
59
|
"scripts": {
|
|
57
|
-
"build": "tsc --noEmit && rollup --config rollup.config.js",
|
|
60
|
+
"build": "shx rm -rf dist && tsc --noEmit && rollup --config rollup.config.js",
|
|
58
61
|
"dev": "rollup --config rollup.config.js --watch",
|
|
59
62
|
"release": "pnpm publish --access public",
|
|
60
63
|
"type-check": "tsc --noEmit",
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export { default as LoginCommand } from './auth/login';
|
|
2
|
-
export { default as LogoutCommand } from './auth/logout';
|
|
3
|
-
export { default as ThemeInitCommand } from './theme/init';
|
|
4
|
-
export { default as ThemeListCommand } from './theme/list';
|
|
5
|
-
export { default as ThemeDevCommand } from './theme/dev';
|
|
6
|
-
export { default as ThemeDeleteCommand } from './theme/delete';
|
|
7
|
-
export { default as ThemePullCommand } from './theme/pull';
|
|
8
|
-
export { default as ThemePackCommand } from './theme/pack';
|
|
9
|
-
export { default as StoreInfoCommand } from './store/info';
|
|
10
|
-
export { default as StoreSwitchCommand } from './store/switch';
|
|
11
|
-
export { default as CreateAppCommand } from './apps/create';
|
|
12
|
-
export { default as InstallAppCommand } from './apps/install';
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export interface FileEventOptions {
|
|
2
|
-
path: string;
|
|
3
|
-
size: number;
|
|
4
|
-
roundtrip: number;
|
|
5
|
-
event: string;
|
|
6
|
-
}
|
|
7
|
-
export interface ThemeMetaData {
|
|
8
|
-
id: string;
|
|
9
|
-
name: string;
|
|
10
|
-
size: number;
|
|
11
|
-
version: string;
|
|
12
|
-
live: boolean;
|
|
13
|
-
}
|
|
14
|
-
export interface listThemesResponse {
|
|
15
|
-
dev: ThemeMetaData[];
|
|
16
|
-
published: ThemeMetaData[];
|
|
17
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { CAC } from 'cac';
|
|
2
|
-
import type Client from '@/core/client/client';
|
|
3
|
-
export interface CommandOptionDefinition {
|
|
4
|
-
name: string;
|
|
5
|
-
description: string;
|
|
6
|
-
config?: {
|
|
7
|
-
default?: any;
|
|
8
|
-
type?: any[];
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
export interface CommandDefinition {
|
|
12
|
-
name: string;
|
|
13
|
-
group: string;
|
|
14
|
-
aliases?: string[];
|
|
15
|
-
description: string;
|
|
16
|
-
action: ReturnType<any>;
|
|
17
|
-
options?: CommandOptionDefinition[];
|
|
18
|
-
}
|
|
19
|
-
export interface CLI {
|
|
20
|
-
handler: CAC;
|
|
21
|
-
client: Client;
|
|
22
|
-
}
|
package/dist/lib/cli/index.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as commands from './commands';
|
|
2
|
-
import type { CommandDefinition } from './commands/types';
|
|
3
|
-
import Client from '@/core/client/client';
|
|
4
|
-
declare const cli: {
|
|
5
|
-
client: Client;
|
|
6
|
-
handler: import("cac").CAC;
|
|
7
|
-
registerCommand(command: (cli: typeof this) => CommandDefinition): void;
|
|
8
|
-
getAvailableCommands(): (typeof commands.LoginCommand | typeof commands.LogoutCommand | typeof commands.ThemeInitCommand | typeof commands.ThemeListCommand | typeof commands.ThemeDevCommand | typeof commands.ThemeDeleteCommand | typeof commands.ThemePullCommand | typeof commands.ThemePackCommand | typeof commands.StoreInfoCommand | typeof commands.StoreSwitchCommand | typeof commands.CreateAppCommand | typeof commands.InstallAppCommand)[];
|
|
9
|
-
init(): Promise<void>;
|
|
10
|
-
prepareClient(): Promise<void>;
|
|
11
|
-
};
|
|
12
|
-
export default cli;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
OAUTH_CLIENT_ID: number;
|
|
3
|
-
OAUTH_CALLBACK_PORT: number;
|
|
4
|
-
OAUTH_CALLBACK_SERVER_TIMEOUT: number;
|
|
5
|
-
OAUTH_CALLBACK_URL: string;
|
|
6
|
-
OAUTH_CLIENT_SECRET: string;
|
|
7
|
-
OAUTH_AUTH_CODE_URL: string;
|
|
8
|
-
OAUTH_ACCESS_TOKEN_URL: string;
|
|
9
|
-
SELLER_AREA_API_BASE_URI: string;
|
|
10
|
-
SELLER_AREA_WEB_BASE_URI: string;
|
|
11
|
-
STARTER_THEME_GIT_REPOSITORY: string;
|
|
12
|
-
AVAILABLE_THEMES: {
|
|
13
|
-
name: string;
|
|
14
|
-
repository: string;
|
|
15
|
-
}[];
|
|
16
|
-
CLI_GLOBAL_CONFIG_DIR: string;
|
|
17
|
-
CLI_GLOBAL_CONFIG_PATH: string;
|
|
18
|
-
THEME_FILE_TYPES: string[];
|
|
19
|
-
PREVIEW_SERVER_PORT: number;
|
|
20
|
-
};
|
|
21
|
-
export default _default;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
LOGIN_OPEN_LINK: string;
|
|
3
|
-
LOGIN_SUCCESS: string;
|
|
4
|
-
FETCHING_CURRENT_STORE_INFO: string;
|
|
5
|
-
CURRENT_DEVELOPMENT_STORE: string;
|
|
6
|
-
ERROR_WHILE_FETCHING_CURRENT_STORE_INFO: string;
|
|
7
|
-
SELECT_STORE: string;
|
|
8
|
-
NO_STORE_FOUND: string;
|
|
9
|
-
NO_STORE_SELECTED: string;
|
|
10
|
-
SELECT_STORE_IN_PROGRESS: string;
|
|
11
|
-
CANNOT_SELECT_STORE: string;
|
|
12
|
-
STORE_SELECTED: string;
|
|
13
|
-
FETCHING_DEV_THEMES: string;
|
|
14
|
-
ERROR_WHILE_FETCHING_DEV_THEMES: string;
|
|
15
|
-
INIT_SUCCESS: string;
|
|
16
|
-
INIT_CLONE_START: string;
|
|
17
|
-
AUTH_USER_NOT_LOGGED_IN: string;
|
|
18
|
-
AUTH_USER_LOGGED_OUT: string;
|
|
19
|
-
DELETE_NO_THEME_SELECTED: string;
|
|
20
|
-
DELETE_THEME_DELETED: string;
|
|
21
|
-
NO_REMOTE_THEMES: string;
|
|
22
|
-
DELETE_SELECT_THEME: string;
|
|
23
|
-
DELETE_IN_PROGRESS: string;
|
|
24
|
-
DELETE_ERROR: string;
|
|
25
|
-
DEV_PREVIEW_SERVER_CONNECTED: string;
|
|
26
|
-
DEV_WATCHING_FILES: string;
|
|
27
|
-
DEV_NO_THEME_DETECTED: string;
|
|
28
|
-
PULL_NO_THEME_FOUND: string;
|
|
29
|
-
PULL_PULLING_THEME: string;
|
|
30
|
-
PULL_UNPACKING_THEME: string;
|
|
31
|
-
PULL_THEME_PULLED: string;
|
|
32
|
-
PREVIEW_BROWSER_CLOSED: string;
|
|
33
|
-
PREVIEW_THEME_UPDATED: string;
|
|
34
|
-
PREVIEW_RELOADED: string;
|
|
35
|
-
};
|
|
36
|
-
export default _default;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { CreateAppRequest, CreateAppResponse, DeleteThemeFileRequestData, GenerateAppInstallationUrlResponse, InitThemeRequest as InitThemeRequestData, LoginRequest, LoginResponse, SelectStoreRequest, SelectStoreResponse, StoreInfoResponse, ThemeMetaResponse, UpdateThemeFileRequestData } from './types';
|
|
2
|
-
import type { listStoresResponse } from '@/cli/commands/store/types';
|
|
3
|
-
export default class Client {
|
|
4
|
-
private accessToken;
|
|
5
|
-
constructor();
|
|
6
|
-
setAccessToken(token: string): void;
|
|
7
|
-
getAccessToken(): string | null;
|
|
8
|
-
isAuthenticated(): boolean;
|
|
9
|
-
auth(data: LoginRequest): Promise<LoginResponse>;
|
|
10
|
-
listStores(): Promise<listStoresResponse>;
|
|
11
|
-
selectStore(data: SelectStoreRequest): Promise<SelectStoreResponse>;
|
|
12
|
-
initTheme(data: InitThemeRequestData): Promise<string>;
|
|
13
|
-
getThemeMeta(themeId: string): Promise<ThemeMetaResponse>;
|
|
14
|
-
pullTheme(themeId: string): Promise<import("node-fetch").Response>;
|
|
15
|
-
listThemes(): Promise<unknown>;
|
|
16
|
-
deleteTheme(themeId: string): Promise<unknown>;
|
|
17
|
-
updateFile(themeId: string, data: UpdateThemeFileRequestData): Promise<void>;
|
|
18
|
-
deleteFile(themeId: string, data: DeleteThemeFileRequestData): Promise<void>;
|
|
19
|
-
getStoreInfo(): Promise<StoreInfoResponse>;
|
|
20
|
-
createApp(data: CreateAppRequest): Promise<CreateAppResponse>;
|
|
21
|
-
generateAppInstallationUrl(name: string): Promise<GenerateAppInstallationUrlResponse>;
|
|
22
|
-
private withDefaults;
|
|
23
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import type { File } from 'formdata-node';
|
|
2
|
-
export interface InitThemeRequest {
|
|
3
|
-
archive: File;
|
|
4
|
-
theme_name: string;
|
|
5
|
-
theme_author: string;
|
|
6
|
-
theme_version: string;
|
|
7
|
-
theme_support_url: string;
|
|
8
|
-
theme_documentation_url: string;
|
|
9
|
-
}
|
|
10
|
-
export interface LoginRequest {
|
|
11
|
-
email: string;
|
|
12
|
-
password: string;
|
|
13
|
-
}
|
|
14
|
-
export interface LoginResponse {
|
|
15
|
-
token: string;
|
|
16
|
-
stores: Store[];
|
|
17
|
-
}
|
|
18
|
-
export interface SelectStoreRequest {
|
|
19
|
-
id: string;
|
|
20
|
-
}
|
|
21
|
-
export interface SelectStoreResponse {
|
|
22
|
-
token: string;
|
|
23
|
-
}
|
|
24
|
-
export interface Store {
|
|
25
|
-
store_id: string;
|
|
26
|
-
slug: string;
|
|
27
|
-
is_active: boolean;
|
|
28
|
-
}
|
|
29
|
-
export interface UpdateThemeFileRequestData {
|
|
30
|
-
file_type: string;
|
|
31
|
-
file_name: string;
|
|
32
|
-
file_content: File;
|
|
33
|
-
file_operation: 'save';
|
|
34
|
-
}
|
|
35
|
-
export interface DeleteThemeFileRequestData {
|
|
36
|
-
file_type: string;
|
|
37
|
-
file_name: string;
|
|
38
|
-
file_operation: 'delete';
|
|
39
|
-
}
|
|
40
|
-
export interface InitThemeResponse {
|
|
41
|
-
id: string;
|
|
42
|
-
}
|
|
43
|
-
export interface StoreInfoResponse {
|
|
44
|
-
name: string;
|
|
45
|
-
slug: string;
|
|
46
|
-
domain: string;
|
|
47
|
-
}
|
|
48
|
-
export interface ThemeFileInfo {
|
|
49
|
-
id: string;
|
|
50
|
-
type: string;
|
|
51
|
-
name: string;
|
|
52
|
-
file_name: string;
|
|
53
|
-
updated: boolean;
|
|
54
|
-
deleted: boolean;
|
|
55
|
-
size: number;
|
|
56
|
-
hash: string;
|
|
57
|
-
}
|
|
58
|
-
export interface ThemeMetaResponse {
|
|
59
|
-
theme_name: string;
|
|
60
|
-
theme_author: string;
|
|
61
|
-
theme_version: string;
|
|
62
|
-
theme_support_url: string;
|
|
63
|
-
theme_documentation_url: string;
|
|
64
|
-
config: ThemeFileInfo[];
|
|
65
|
-
layout: ThemeFileInfo[];
|
|
66
|
-
sections: ThemeFileInfo[];
|
|
67
|
-
templates: ThemeFileInfo[];
|
|
68
|
-
locales: ThemeFileInfo[];
|
|
69
|
-
snippets: ThemeFileInfo[];
|
|
70
|
-
assets: ThemeFileInfo[];
|
|
71
|
-
}
|
|
72
|
-
export interface CreateAppRequest {
|
|
73
|
-
name: string;
|
|
74
|
-
}
|
|
75
|
-
export interface CreateAppResponse {
|
|
76
|
-
name: string;
|
|
77
|
-
}
|
|
78
|
-
export interface GenerateAppInstallationUrlResponse {
|
|
79
|
-
url: string;
|
|
80
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function previewTheme(url: string, options: Record<string, string>): Promise<void>;
|
package/dist/lib/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import type { PathLike } from 'fs';
|
|
4
|
-
export declare const homeDir: string;
|
|
5
|
-
/**
|
|
6
|
-
* Get youcan token from $HOME/.youcan file
|
|
7
|
-
* @returns string - youcan token
|
|
8
|
-
*/
|
|
9
|
-
export declare function getUserToken(): Promise<string>;
|
|
10
|
-
export declare function getCurrentThemeId(dir: PathLike): Promise<string | null>;
|
|
11
|
-
export declare class LoadingSpinner {
|
|
12
|
-
private message;
|
|
13
|
-
timer: NodeJS.Timer | null;
|
|
14
|
-
constructor(message: string);
|
|
15
|
-
start(): this;
|
|
16
|
-
private flush;
|
|
17
|
-
stop(): this;
|
|
18
|
-
error(message?: string | null): this;
|
|
19
|
-
static exec(message: string, closure: (spinner: LoadingSpinner) => Promise<void>): Promise<void>;
|
|
20
|
-
}
|
|
21
|
-
export declare function delay(ms: number): Promise<void>;
|
|
22
|
-
export declare function getCurrentDate(): string;
|
package/dist/lib/utils/http.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { Agent } from 'https';
|
|
3
|
-
import type { RequestInit } from 'node-fetch';
|
|
4
|
-
export declare const DEFAULT_HTTP_CLIENT_OPTIONS: {
|
|
5
|
-
headers: {
|
|
6
|
-
Accept: string;
|
|
7
|
-
};
|
|
8
|
-
agent: Agent;
|
|
9
|
-
};
|
|
10
|
-
export declare function get<T>(endpoint: string, options?: RequestInit): Promise<T>;
|
|
11
|
-
export declare function post<T>(endpoint: string, options?: RequestInit): Promise<T>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function lsDir(path: string): string[];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function openLink(url: string): void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function saveHttpFile(res: any, filename: string): Promise<void>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Print to standard output with meaningful colors
|
|
3
|
-
*/
|
|
4
|
-
declare function log(arg: string): void;
|
|
5
|
-
declare function info(arg: string): void;
|
|
6
|
-
declare function warn(arg: string): void;
|
|
7
|
-
declare function error(arg: string): void;
|
|
8
|
-
declare function success(arg: string): void;
|
|
9
|
-
declare function clear(): void;
|
|
10
|
-
declare function table(arg: any): void;
|
|
11
|
-
declare const _default: {
|
|
12
|
-
log: typeof log;
|
|
13
|
-
info: typeof info;
|
|
14
|
-
warn: typeof warn;
|
|
15
|
-
error: typeof error;
|
|
16
|
-
clear: typeof clear;
|
|
17
|
-
success: typeof success;
|
|
18
|
-
table: typeof table;
|
|
19
|
-
};
|
|
20
|
-
export default _default;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zip folder and save it to a given path and return zip folder path
|
|
3
|
-
*/
|
|
4
|
-
export declare function zipFolder(folderPath: string, folderName: string): Promise<string>;
|
|
5
|
-
export declare function zipDirectory(dirPath: string, folderName: string, only?: string[]): Promise<unknown>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const kill: (pid: number, signal?: string, timeout?: number) => Promise<void>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|