@madebyseed/seed-cli-tools 2.3.2 → 3.0.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.
Files changed (100) hide show
  1. package/lib/commands/build.d.ts +2 -0
  2. package/lib/commands/build.js +30 -29
  3. package/lib/commands/build.js.map +1 -0
  4. package/lib/commands/deploy.d.ts +2 -0
  5. package/lib/commands/deploy.js +47 -30
  6. package/lib/commands/deploy.js.map +1 -0
  7. package/lib/commands/pull.d.ts +2 -0
  8. package/lib/commands/pull.js +39 -29
  9. package/lib/commands/pull.js.map +1 -0
  10. package/lib/commands/watch.d.ts +2 -0
  11. package/lib/commands/watch.js +44 -40
  12. package/lib/commands/watch.js.map +1 -0
  13. package/lib/commands/zip.d.ts +2 -0
  14. package/lib/commands/zip.js +23 -25
  15. package/lib/commands/zip.js.map +1 -0
  16. package/lib/config.d.ts +3 -0
  17. package/lib/config.js +21 -28
  18. package/lib/config.js.map +1 -0
  19. package/lib/gulpfile.d.ts +1 -0
  20. package/lib/gulpfile.js +26 -33
  21. package/lib/gulpfile.js.map +1 -0
  22. package/lib/tasks/build-assets.d.ts +1 -0
  23. package/lib/tasks/build-assets.js +80 -72
  24. package/lib/tasks/build-assets.js.map +1 -0
  25. package/lib/tasks/build-css.d.ts +1 -0
  26. package/lib/tasks/build-css.js +88 -82
  27. package/lib/tasks/build-css.js.map +1 -0
  28. package/lib/tasks/build-js.d.ts +1 -0
  29. package/lib/tasks/build-js.js +78 -82
  30. package/lib/tasks/build-js.js.map +1 -0
  31. package/lib/tasks/build-svg.d.ts +1 -0
  32. package/lib/tasks/build-svg.js +51 -54
  33. package/lib/tasks/build-svg.js.map +1 -0
  34. package/lib/tasks/build-utils.d.ts +1 -0
  35. package/lib/tasks/build-utils.js +68 -49
  36. package/lib/tasks/build-utils.js.map +1 -0
  37. package/lib/tasks/includes/config.d.ts +71 -0
  38. package/lib/tasks/includes/config.js +118 -163
  39. package/lib/tasks/includes/config.js.map +1 -0
  40. package/lib/tasks/includes/messages.d.ts +19 -0
  41. package/lib/tasks/includes/messages.js +80 -72
  42. package/lib/tasks/includes/messages.js.map +1 -0
  43. package/lib/tasks/includes/utilities.d.ts +71 -0
  44. package/lib/tasks/includes/utilities.js +127 -141
  45. package/lib/tasks/includes/utilities.js.map +1 -0
  46. package/lib/tasks/shopify-cli.d.ts +1 -0
  47. package/lib/tasks/shopify-cli.js +107 -93
  48. package/lib/tasks/shopify-cli.js.map +1 -0
  49. package/lib/tasks/watchers.d.ts +1 -0
  50. package/lib/tasks/watchers.js +29 -29
  51. package/lib/tasks/watchers.js.map +1 -0
  52. package/lib/types.d.ts +53 -0
  53. package/lib/types.js +3 -0
  54. package/lib/types.js.map +1 -0
  55. package/lib/utils.d.ts +102 -0
  56. package/lib/utils.js +310 -189
  57. package/lib/utils.js.map +1 -0
  58. package/package.json +36 -16
  59. package/src/commands/build.ts +39 -0
  60. package/src/commands/deploy.ts +79 -0
  61. package/src/commands/pull.ts +58 -0
  62. package/src/commands/watch.ts +72 -0
  63. package/src/commands/zip.ts +28 -0
  64. package/src/config.ts +28 -0
  65. package/src/gulpfile.ts +134 -0
  66. package/src/tasks/build-assets.ts +135 -0
  67. package/src/tasks/build-css.ts +129 -0
  68. package/src/tasks/build-js.ts +108 -0
  69. package/src/tasks/build-svg.ts +92 -0
  70. package/src/tasks/build-utils.ts +137 -0
  71. package/src/tasks/includes/config.ts +224 -0
  72. package/src/tasks/includes/messages.ts +157 -0
  73. package/src/tasks/includes/utilities.ts +170 -0
  74. package/src/tasks/shopify-cli.ts +199 -0
  75. package/src/tasks/watchers.ts +50 -0
  76. package/src/types/declarations.d.ts +72 -0
  77. package/src/types.ts +84 -0
  78. package/src/utils.ts +444 -0
  79. package/tsconfig.json +14 -0
  80. package/tsconfig.tsbuildinfo +1 -0
  81. package/.babelrc +0 -3
  82. package/.eslintrc +0 -8
  83. /package/{src → src-legacy}/commands/build.js +0 -0
  84. /package/{src → src-legacy}/commands/deploy.js +0 -0
  85. /package/{src → src-legacy}/commands/pull.js +0 -0
  86. /package/{src → src-legacy}/commands/watch.js +0 -0
  87. /package/{src → src-legacy}/commands/zip.js +0 -0
  88. /package/{src → src-legacy}/config.js +0 -0
  89. /package/{src → src-legacy}/gulpfile.js +0 -0
  90. /package/{src → src-legacy}/tasks/build-assets.js +0 -0
  91. /package/{src → src-legacy}/tasks/build-css.js +0 -0
  92. /package/{src → src-legacy}/tasks/build-js.js +0 -0
  93. /package/{src → src-legacy}/tasks/build-svg.js +0 -0
  94. /package/{src → src-legacy}/tasks/build-utils.js +0 -0
  95. /package/{src → src-legacy}/tasks/includes/config.js +0 -0
  96. /package/{src → src-legacy}/tasks/includes/messages.js +0 -0
  97. /package/{src → src-legacy}/tasks/includes/utilities.js +0 -0
  98. /package/{src → src-legacy}/tasks/shopify-cli.js +0 -0
  99. /package/{src → src-legacy}/tasks/watchers.js +0 -0
  100. /package/{src → src-legacy}/utils.js +0 -0
package/lib/types.d.ts ADDED
@@ -0,0 +1,53 @@
1
+ import { SpawnSyncReturns } from "child_process";
2
+ import type { ChildProcess } from "child_process";
3
+ export interface Config {
4
+ gulpFile: string;
5
+ gulp: string;
6
+ themeRoot: string;
7
+ seedConfig: string;
8
+ seedConfigDelimiter: string;
9
+ }
10
+ export interface ShopifyCLI {
11
+ login: (store: string) => SpawnSyncReturns<Buffer>;
12
+ serve: (store: string, options?: Record<string, unknown>) => ChildProcess;
13
+ pull: (store: string, themeId?: string | undefined, dir?: string, nodelete?: boolean) => ChildProcess;
14
+ push: (store: string, themeId?: string | undefined, nodelete?: boolean) => ChildProcess;
15
+ package: () => ChildProcess;
16
+ list: (store: string, options?: {
17
+ role?: string;
18
+ json?: boolean;
19
+ }) => ChildProcess;
20
+ duplicate: (store: string, themeId: string, name?: string, json?: boolean) => ChildProcess;
21
+ }
22
+ export interface SeedConfig {
23
+ store?: string;
24
+ stores?: {
25
+ [key: string]: {
26
+ domain: string;
27
+ themes: {
28
+ [key: string]: string;
29
+ };
30
+ };
31
+ };
32
+ themes?: {
33
+ [key: string]: string;
34
+ };
35
+ __developmentThemeId?: string;
36
+ }
37
+ export interface SeedProjectConfig {
38
+ stores: {
39
+ [key: string]: {
40
+ domain: string;
41
+ password?: string;
42
+ };
43
+ };
44
+ pull: {
45
+ ignoreFiles: string[];
46
+ };
47
+ build: {
48
+ js: {
49
+ type: "legacy" | "bundle";
50
+ };
51
+ };
52
+ }
53
+ export type { BuildConfig, PathConfig, TmpPathConfig, DistPathConfig, RootsConfig, PluginsConfig, } from "./tasks/includes/config";
package/lib/types.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/lib/utils.d.ts ADDED
@@ -0,0 +1,102 @@
1
+ import type { ChildProcess } from "child_process";
2
+ import { SeedConfig, ShopifyCLI, SeedProjectConfig } from "./types";
3
+ /**
4
+ * Get seed.project.json from project root dir
5
+ *
6
+ * @param {string} themeRoot - the path to theme root dir
7
+ * @returns {SeedProjectConfig | null} - project config object or null if not found
8
+ */
9
+ export declare function getProjectConfig(themeRoot: string): SeedProjectConfig | null;
10
+ /**
11
+ * Get seed.config.js from project root dir
12
+ *
13
+ * @param {string} themeRoot - the path to theme root dir
14
+ * @returns {SeedConfig} - seed config object
15
+ */
16
+ export declare function getSeedConfig(themeRoot: string): SeedConfig;
17
+ /**
18
+ * Get store name from seed.project.json or seed.config.js
19
+ *
20
+ * @param {string} themeRoot - the path to theme root dir
21
+ * @param {string} [store] - optional store name, defaults to "main"
22
+ * @returns {string | undefined} - store domain or undefined if not found
23
+ */
24
+ export declare function getStoreName(themeRoot: string, store?: string): string | undefined;
25
+ /**
26
+ * Get store password from seed.project.json
27
+ *
28
+ * @param {string} themeRoot - the path to theme root dir
29
+ * @param {string} [store] - optional store name, defaults to "main"
30
+ * @returns {string | undefined} - store password or undefined if not found
31
+ */
32
+ export declare function getStorePassword(themeRoot: string, store?: string): string | undefined;
33
+ /**
34
+ * Wrappers for Shopify CLI commands
35
+ *
36
+ * @summary a set of utility functions used to wrap shopify's CLI
37
+ * @namespace seed-cli.shopifyCLI
38
+ * @memberof seed-cli
39
+ */
40
+ export declare const shopifyCLI: ShopifyCLI;
41
+ /**
42
+ * Get the live theme ID from a store
43
+ */
44
+ export declare function getLiveThemeId(store: string): Promise<string>;
45
+ /**
46
+ * Duplicate a theme and return the new theme ID
47
+ */
48
+ export declare function duplicateTheme(store: string, sourceThemeId: string, name?: string): Promise<string>;
49
+ /**
50
+ * Duplicate a theme from live theme
51
+ */
52
+ export declare function duplicateFromLive(store: string, name?: string): Promise<string>;
53
+ /**
54
+ * Get theme ID from seed.config.js
55
+ *
56
+ * @param {string} themeRoot - the path to theme root dir
57
+ * @param {string} environment - theme name/environment
58
+ * @param {string} [store] - optional store name
59
+ * @returns {string} themeID
60
+ */
61
+ export declare function getThemeID(themeRoot: string, environment: string, store?: string): string | undefined;
62
+ /**
63
+ * Get dev theme ID from seed.config.js
64
+ *
65
+ * @param {string} themeRoot - the path to theme root dir
66
+ * @returns {string} - development store theme ID
67
+ */
68
+ export declare function getDevThemeID(themeRoot: string): string | undefined;
69
+ /**
70
+ * Given a string, finds the first themeID and returns it, if no themeID found
71
+ * returns false.
72
+ *
73
+ * @param {string} string - string to extract theme id from
74
+ * @return {string|boolean} - themeID or false if not found
75
+ */
76
+ export declare function extractThemeId(string: string): string | false;
77
+ /**
78
+ * Logs out to terminal the output of a piped child process
79
+ *
80
+ * @param {child_process} serveProcess shopify cli serve spawned child process
81
+ */
82
+ export declare function logChildProcessOutput(process: ChildProcess): void;
83
+ /**
84
+ * Writes the development theme ID as a key to seed config file
85
+ *
86
+ * @param {string} themeID - development theme ID
87
+ */
88
+ export declare function setDevThemeID(themeID: string): void;
89
+ /**
90
+ * Logs into seed config shopify store while logging useful messages
91
+ * and handling errors.
92
+ *
93
+ * @param {string} [store] - optional store name, defaults to "main"
94
+ * @returns {boolean} whether login was successful or not
95
+ */
96
+ export declare function login(store?: string): boolean;
97
+ /**
98
+ * Outputs error message if there's no store field in seed config
99
+ *
100
+ * @param {string} [store] - optional store name that was not found
101
+ */
102
+ export declare function storeErrorMessage(store?: string): void;