@youcan/cli 1.0.8 → 1.1.0-beta.2

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.
Files changed (116) hide show
  1. package/bin/exec.cmd +3 -0
  2. package/bin/exec.js +8 -0
  3. package/dist/cli/commands/auth/login.d.ts +4 -2
  4. package/dist/cli/commands/auth/login.js +7 -85
  5. package/dist/cli/commands/auth/logout.d.ts +4 -2
  6. package/dist/cli/commands/auth/logout.js +9 -18
  7. package/dist/index.d.ts +2 -1
  8. package/dist/index.js +20 -2
  9. package/package.json +56 -38
  10. package/bin/index.js +0 -2
  11. package/dist/cli/commands/apps/create.d.ts +0 -2
  12. package/dist/cli/commands/apps/create.js +0 -65
  13. package/dist/cli/commands/apps/install.d.ts +0 -2
  14. package/dist/cli/commands/apps/install.js +0 -28
  15. package/dist/cli/commands/auth/types.d.ts +0 -6
  16. package/dist/cli/commands/index.d.ts +0 -12
  17. package/dist/cli/commands/index.js +0 -14
  18. package/dist/cli/commands/store/info.d.ts +0 -2
  19. package/dist/cli/commands/store/info.js +0 -29
  20. package/dist/cli/commands/store/switch.d.ts +0 -2
  21. package/dist/cli/commands/store/switch.js +0 -59
  22. package/dist/cli/commands/store/types.d.ts +0 -4
  23. package/dist/cli/commands/theme/delete.d.ts +0 -2
  24. package/dist/cli/commands/theme/delete.js +0 -46
  25. package/dist/cli/commands/theme/dev.d.ts +0 -2
  26. package/dist/cli/commands/theme/dev.js +0 -199
  27. package/dist/cli/commands/theme/init.d.ts +0 -2
  28. package/dist/cli/commands/theme/init.js +0 -86
  29. package/dist/cli/commands/theme/list.d.ts +0 -2
  30. package/dist/cli/commands/theme/list.js +0 -35
  31. package/dist/cli/commands/theme/pack.d.ts +0 -2
  32. package/dist/cli/commands/theme/pack.js +0 -31
  33. package/dist/cli/commands/theme/pull.d.ts +0 -2
  34. package/dist/cli/commands/theme/pull.js +0 -56
  35. package/dist/cli/commands/theme/types.d.ts +0 -17
  36. package/dist/cli/commands/types.d.ts +0 -22
  37. package/dist/cli/index.d.ts +0 -12
  38. package/dist/cli/index.js +0 -53
  39. package/dist/config/index.d.ts +0 -21
  40. package/dist/config/index.js +0 -25
  41. package/dist/config/messages.d.ts +0 -36
  42. package/dist/config/messages.js +0 -37
  43. package/dist/core/client/client.d.ts +0 -23
  44. package/dist/core/client/client.js +0 -83
  45. package/dist/core/client/types.d.ts +0 -80
  46. package/dist/core/themes/preview.d.ts +0 -1
  47. package/dist/core/themes/preview.js +0 -37
  48. package/dist/lib/cli/commands/apps/create.d.ts +0 -2
  49. package/dist/lib/cli/commands/apps/install.d.ts +0 -2
  50. package/dist/lib/cli/commands/auth/login.d.ts +0 -2
  51. package/dist/lib/cli/commands/auth/logout.d.ts +0 -2
  52. package/dist/lib/cli/commands/auth/types.d.ts +0 -6
  53. package/dist/lib/cli/commands/index.d.ts +0 -12
  54. package/dist/lib/cli/commands/store/info.d.ts +0 -2
  55. package/dist/lib/cli/commands/store/switch.d.ts +0 -2
  56. package/dist/lib/cli/commands/store/types.d.ts +0 -4
  57. package/dist/lib/cli/commands/theme/delete.d.ts +0 -2
  58. package/dist/lib/cli/commands/theme/dev.d.ts +0 -2
  59. package/dist/lib/cli/commands/theme/init.d.ts +0 -2
  60. package/dist/lib/cli/commands/theme/list.d.ts +0 -2
  61. package/dist/lib/cli/commands/theme/pack.d.ts +0 -2
  62. package/dist/lib/cli/commands/theme/pull.d.ts +0 -2
  63. package/dist/lib/cli/commands/theme/types.d.ts +0 -17
  64. package/dist/lib/cli/commands/types.d.ts +0 -22
  65. package/dist/lib/cli/index.d.ts +0 -12
  66. package/dist/lib/config/index.d.ts +0 -21
  67. package/dist/lib/config/messages.d.ts +0 -36
  68. package/dist/lib/core/client/client.d.ts +0 -23
  69. package/dist/lib/core/client/types.d.ts +0 -80
  70. package/dist/lib/core/themes/preview.d.ts +0 -1
  71. package/dist/lib/index.d.ts +0 -1
  72. package/dist/lib/utils/common.d.ts +0 -22
  73. package/dist/lib/utils/git/cloneRepository.d.ts +0 -6
  74. package/dist/lib/utils/helpers.d.ts +0 -3
  75. package/dist/lib/utils/http.d.ts +0 -11
  76. package/dist/lib/utils/network.d.ts +0 -2
  77. package/dist/lib/utils/system/deleteFile.d.ts +0 -5
  78. package/dist/lib/utils/system/ls.d.ts +0 -1
  79. package/dist/lib/utils/system/openLink.d.ts +0 -1
  80. package/dist/lib/utils/system/saveFile.d.ts +0 -1
  81. package/dist/lib/utils/system/stdout.d.ts +0 -20
  82. package/dist/lib/utils/system/writeToFile.d.ts +0 -6
  83. package/dist/lib/utils/system/zipFolder.d.ts +0 -5
  84. package/dist/lib/utils/system.d.ts +0 -1
  85. package/dist/test/commands/auth/login.d.ts +0 -2
  86. package/dist/test/commands/auth/logout.d.ts +0 -2
  87. package/dist/test/commands/help.d.ts +0 -2
  88. package/dist/test/commands/theme/delete.d.ts +0 -2
  89. package/dist/test/commands/theme/dev.d.ts +0 -2
  90. package/dist/test/commands/theme/init.d.ts +0 -2
  91. package/dist/test/index.test.d.ts +0 -1
  92. package/dist/utils/common.d.ts +0 -22
  93. package/dist/utils/common.js +0 -67
  94. package/dist/utils/git/cloneRepository.d.ts +0 -6
  95. package/dist/utils/git/cloneRepository.js +0 -18
  96. package/dist/utils/helpers.d.ts +0 -3
  97. package/dist/utils/helpers.js +0 -35
  98. package/dist/utils/http.d.ts +0 -11
  99. package/dist/utils/http.js +0 -26
  100. package/dist/utils/network.d.ts +0 -2
  101. package/dist/utils/network.js +0 -81
  102. package/dist/utils/system/deleteFile.d.ts +0 -5
  103. package/dist/utils/system/deleteFile.js +0 -13
  104. package/dist/utils/system/ls.d.ts +0 -1
  105. package/dist/utils/system/ls.js +0 -9
  106. package/dist/utils/system/openLink.d.ts +0 -1
  107. package/dist/utils/system/saveFile.d.ts +0 -1
  108. package/dist/utils/system/saveFile.js +0 -9
  109. package/dist/utils/system/stdout.d.ts +0 -17
  110. package/dist/utils/system/stdout.js +0 -35
  111. package/dist/utils/system/writeToFile.d.ts +0 -1
  112. package/dist/utils/system/writeToFile.js +0 -7
  113. package/dist/utils/system/zipFolder.d.ts +0 -5
  114. package/dist/utils/system/zipFolder.js +0 -57
  115. package/dist/utils/system.d.ts +0 -1
  116. package/dist/utils/system.js +0 -18
@@ -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,83 +0,0 @@
1
- import { FormData } from 'formdata-node';
2
- import { mergeDeepLeft } from 'ramda';
3
- import fetch from 'node-fetch';
4
- import { post, get } from '../../utils/http.js';
5
- import config from '../../config/index.js';
6
- import { delay } from '../../utils/common.js';
7
-
8
- class Client {
9
- accessToken = null;
10
- constructor() { }
11
- setAccessToken(token) {
12
- this.accessToken = token;
13
- }
14
- getAccessToken() {
15
- return this.accessToken;
16
- }
17
- isAuthenticated() {
18
- return this.accessToken != null;
19
- }
20
- async auth(data) {
21
- const form = new FormData();
22
- Object.entries(data).forEach(([key, value]) => form.append(key, value));
23
- return await post(`${config.SELLER_AREA_API_BASE_URI}/auth/login`, this.withDefaults({ body: form }));
24
- }
25
- async listStores() {
26
- return await get(`${config.SELLER_AREA_API_BASE_URI}/stores`, this.withDefaults({}));
27
- }
28
- async selectStore(data) {
29
- return await post(`${config.SELLER_AREA_API_BASE_URI}/switch-store/${data.id}`, this.withDefaults({}));
30
- }
31
- async initTheme(data) {
32
- const form = new FormData();
33
- Object.entries(data).forEach(([key, value]) => form.append(key, value));
34
- const { id } = await post(`${config.SELLER_AREA_API_BASE_URI}/themes/init`, this.withDefaults({ body: form }));
35
- return id;
36
- }
37
- async getThemeMeta(themeId) {
38
- return await get(`${config.SELLER_AREA_API_BASE_URI}/themes/${themeId}/metadata`, this.withDefaults({}));
39
- }
40
- async pullTheme(themeId) {
41
- return await fetch(`${config.SELLER_AREA_API_BASE_URI}/themes/${themeId}`, this.withDefaults({}));
42
- }
43
- async listThemes() {
44
- return await get(`${config.SELLER_AREA_API_BASE_URI}/themes`, this.withDefaults({}));
45
- }
46
- async deleteTheme(themeId) {
47
- return await post(`${config.SELLER_AREA_API_BASE_URI}/themes/${themeId}/delete`, this.withDefaults({}));
48
- }
49
- async updateFile(themeId, data) {
50
- const form = new FormData();
51
- Object.entries(data).forEach(([key, value]) => form.append(key, value));
52
- await post(`${config.SELLER_AREA_API_BASE_URI}/themes/${themeId}/update`, this.withDefaults({ body: form }));
53
- await delay(100);
54
- }
55
- async deleteFile(themeId, data) {
56
- const form = new FormData();
57
- Object.entries(data).forEach(([key, value]) => form.append(key, value));
58
- await post(`${config.SELLER_AREA_API_BASE_URI}/themes/${themeId}/update`, this.withDefaults({ body: form }));
59
- await delay(100);
60
- }
61
- async getStoreInfo() {
62
- return await get(`${config.SELLER_AREA_API_BASE_URI}/me`, this.withDefaults());
63
- }
64
- async createApp(data) {
65
- const form = new FormData();
66
- Object.entries(data).forEach(([key, value]) => form.append(key, value));
67
- return await post(`${config.SELLER_AREA_API_BASE_URI}/apps/draft/create`, this.withDefaults({ body: form }));
68
- }
69
- async generateAppInstallationUrl(name) {
70
- return await get(`${config.SELLER_AREA_API_BASE_URI}/apps/draft/generate-installation-url?name=${name}`, this.withDefaults());
71
- }
72
- withDefaults(override = {}) {
73
- return mergeDeepLeft(override, {
74
- headers: {
75
- Accept: 'application/json',
76
- Authorization: `Bearer ${this.accessToken}`,
77
- },
78
- hostname: config.SELLER_AREA_API_BASE_URI,
79
- });
80
- }
81
- }
82
-
83
- export { Client as default };
@@ -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>;
@@ -1,37 +0,0 @@
1
- import { createServer } from 'node:http';
2
- import { Server } from 'socket.io';
3
- import puppeteer from 'puppeteer';
4
- import stdout from '../../utils/system/stdout.js';
5
- import config from '../../config/index.js';
6
-
7
- async function openPreviewPage(url, disableHardwareAcceleration) {
8
- const options = {
9
- headless: false,
10
- defaultViewport: null,
11
- userDataDir: '/tmp/youcan_puppeteer',
12
- };
13
- if (disableHardwareAcceleration) {
14
- options.args = ['--disable-gpu'];
15
- }
16
- const browser = await puppeteer.launch(options);
17
- browser.on('disconnected', () => {
18
- stdout.info('Browser closed');
19
- return process.exit(0);
20
- });
21
- const page = await browser.newPage();
22
- await page.goto(url);
23
- return page;
24
- }
25
- async function previewTheme(url, options) {
26
- const httpServer = createServer();
27
- const io = new Server(httpServer);
28
- const previewPage = await openPreviewPage(url, options.disableHardwareAcceleration);
29
- io.on('connection', (socket) => {
30
- socket.on('theme:update', async () => {
31
- await previewPage.reload({ waitUntil: 'domcontentloaded' });
32
- });
33
- });
34
- httpServer.listen(config.PREVIEW_SERVER_PORT);
35
- }
36
-
37
- export { previewTheme as default };
@@ -1,2 +0,0 @@
1
- import type { CLI, CommandDefinition } from '@/cli/commands/types';
2
- export default function command(_cli: CLI): CommandDefinition;
@@ -1,2 +0,0 @@
1
- import type { CLI, CommandDefinition } from '@/cli/commands/types';
2
- export default function command(_cli: CLI): CommandDefinition;
@@ -1,2 +0,0 @@
1
- import type { CLI, CommandDefinition } from '@/cli/commands/types';
2
- export default function command(_cli: CLI): CommandDefinition;
@@ -1,2 +0,0 @@
1
- import type { CLI, CommandDefinition } from '@/cli/commands/types';
2
- export default function command(cli: CLI): CommandDefinition;
@@ -1,6 +0,0 @@
1
- export interface TokenResponse {
2
- token_type: string;
3
- expires_in: string;
4
- access_token: string;
5
- refresh_toekn: string;
6
- }
@@ -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,2 +0,0 @@
1
- import type { CLI, CommandDefinition } from '@/cli/commands/types';
2
- export default function command(cli: CLI): CommandDefinition;
@@ -1,2 +0,0 @@
1
- import type { CLI, CommandDefinition } from '@/cli/commands/types';
2
- export default function command(cli: CLI): CommandDefinition;
@@ -1,4 +0,0 @@
1
- import type { Store } from '@/core/client/types';
2
- export interface listStoresResponse {
3
- stores: Store[];
4
- }
@@ -1,2 +0,0 @@
1
- import type { CLI, CommandDefinition } from '@/cli/commands/types';
2
- export default function command(cli: CLI): CommandDefinition;
@@ -1,2 +0,0 @@
1
- import type { CLI, CommandDefinition } from '../types';
2
- export default function command(cli: CLI): CommandDefinition;
@@ -1,2 +0,0 @@
1
- import type { CLI, CommandDefinition } from '@/cli/commands/types';
2
- export default function command(cli: CLI): CommandDefinition;
@@ -1,2 +0,0 @@
1
- import type { CLI, CommandDefinition } from '@/cli/commands/types';
2
- export default function command(cli: CLI): CommandDefinition;
@@ -1,2 +0,0 @@
1
- import type { CLI, CommandDefinition } from '../types';
2
- export default function command(cli: CLI): CommandDefinition;
@@ -1,2 +0,0 @@
1
- import type { CLI, CommandDefinition } from '../types';
2
- export default function command(cli: CLI): CommandDefinition;
@@ -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
- }
@@ -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>;
@@ -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;
@@ -1,6 +0,0 @@
1
- /**
2
- * Clone a git repository
3
- * @param url - URL to open
4
- * @param folder
5
- */
6
- export default function cloneRepository(url: string, folder: string): boolean;
@@ -1,3 +0,0 @@
1
- export declare function stripln(buffer: string, ln: number): string;
2
- export declare function splitln(buffer: string, limit: number): string[];
3
- export declare function getcols(buffer: string, indices: number[], limit?: number | null): string[][];
@@ -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,2 +0,0 @@
1
- export declare function isPortAvailable(port: string | number): Promise<boolean>;
2
- export declare function getPidByPort(port: number | string): Promise<number | null>;
@@ -1,5 +0,0 @@
1
- /**
2
- * @param filePath - The path of the file to delete.
3
- *
4
- */
5
- export default function deleteFile(filePath: string): void;
@@ -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,6 +0,0 @@
1
- /**
2
- * @param filePath - The path to the file to write to.
3
- * @param content - The content to write to the file.
4
- * @returns A promise that resolves when the file has been written.
5
- */
6
- export default function writeToFile(filePath: string, content: string): void;
@@ -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,2 +0,0 @@
1
- declare const _default: () => void;
2
- export default _default;
@@ -1,2 +0,0 @@
1
- declare const _default: () => void;
2
- export default _default;
@@ -1,2 +0,0 @@
1
- declare const _default: () => void;
2
- export default _default;