@madebyseed/seed-cli-tools 2.3.1 → 2.4.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 +42 -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 +77 -83
  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 +70 -0
  38. package/lib/tasks/includes/config.js +117 -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 +106 -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 +48 -0
  53. package/lib/types.js +3 -0
  54. package/lib/types.js.map +1 -0
  55. package/lib/utils.d.ts +90 -0
  56. package/lib/utils.js +194 -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 +70 -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 +222 -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 +197 -0
  75. package/src/tasks/watchers.ts +50 -0
  76. package/src/types/declarations.d.ts +72 -0
  77. package/src/types.ts +74 -0
  78. package/src/utils.ts +304 -0
  79. package/{src → src-legacy}/tasks/build-js.js +5 -6
  80. package/tsconfig.json +14 -0
  81. package/tsconfig.tsbuildinfo +1 -0
  82. package/.babelrc +0 -3
  83. package/.eslintrc +0 -8
  84. /package/{src → src-legacy}/commands/build.js +0 -0
  85. /package/{src → src-legacy}/commands/deploy.js +0 -0
  86. /package/{src → src-legacy}/commands/pull.js +0 -0
  87. /package/{src → src-legacy}/commands/watch.js +0 -0
  88. /package/{src → src-legacy}/commands/zip.js +0 -0
  89. /package/{src → src-legacy}/config.js +0 -0
  90. /package/{src → src-legacy}/gulpfile.js +0 -0
  91. /package/{src → src-legacy}/tasks/build-assets.js +0 -0
  92. /package/{src → src-legacy}/tasks/build-css.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
@@ -1,172 +1,126 @@
1
1
  "use strict";
2
-
3
- var fs = require('fs');
4
-
5
- var join = require("path").join;
6
-
7
- var logger = require("debug")("seed-tools");
8
-
9
- var findRoot = require("find-root");
10
-
11
- var tailwindcss = require("tailwindcss");
12
-
13
- var cssnano = require("cssnano");
14
-
15
- var pxtorem = require('postcss-pxtorem');
16
-
17
- var reporter = require('postcss-reporter');
18
-
19
- var argv = require("minimist")(process.argv.slice(2));
20
-
21
- var webpack = require('webpack');
22
-
23
- var themeRoot = findRoot(process.cwd());
24
- var tailwindConfig = 'tailwind.config.js';
25
- var pkg = {};
26
-
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const path_1 = require("path");
7
+ const debug_1 = __importDefault(require("debug"));
8
+ const find_root_1 = __importDefault(require("find-root"));
9
+ const tailwindcss_1 = __importDefault(require("tailwindcss"));
10
+ const cssnano_1 = __importDefault(require("cssnano"));
11
+ const postcss_pxtorem_1 = __importDefault(require("postcss-pxtorem"));
12
+ const postcss_reporter_1 = __importDefault(require("postcss-reporter"));
13
+ const minimist_1 = __importDefault(require("minimist"));
14
+ const fs_1 = require("fs");
15
+ const autoprefixer_1 = __importDefault(require("autoprefixer"));
16
+ const postcss_import_1 = __importDefault(require("postcss-import"));
17
+ const logger = (0, debug_1.default)("seed-tools");
18
+ const argv = (0, minimist_1.default)(process.argv.slice(2));
19
+ const themeRoot = (0, find_root_1.default)(process.cwd());
20
+ const tailwindConfig = "tailwind.config.js";
21
+ let pkg = {};
27
22
  try {
28
- pkg = require(join(themeRoot, "package.json"));
29
- } catch (err) {
30
- logger(err);
23
+ pkg = require((0, path_1.join)(themeRoot, "package.json"));
24
+ }
25
+ catch (err) {
26
+ logger(err);
31
27
  }
32
- /**
33
- * seed-cli configuration object
34
- *
35
- * @namespace config
36
- * @memberof seed-cli
37
- * @summary Configuring seed-cli
38
- * @prop {String} environment - development | staging | production
39
- * @prop {Boolean} optimize - whether optimize assets or not
40
- * @prop {Boolean} nodelete - run shopiy cli commands with --no-delete flag
41
- * @prop {String} tailwindConfig - tailwind config filename
42
- * @prop {String} seedConfig - seed config filename
43
- * @prop {String} deployLog - path to deploy log file
44
- * @prop {String} src - globs (multi-filename matching patterns) for various source files
45
- * @prop {String} tmp - globs (multi-filename matching patterns) for various tmp files
46
- * @prop {Object} dist - paths to relevant folder locations in the distributable directory
47
- * @prop {Object} roots - array of "root" (entry point) JS & CSS files
48
- * @prop {Object} plugins - configuration objects passed to various plugins used in the task interface
49
- */
50
-
51
-
52
- var config = {
53
- environment: argv.environment === "undefined" || !argv.environment ? "development" : argv.environment,
54
- store: argv.store === "undefined" || !argv.store ? null : argv.store,
55
- storePassword: argv['store-password'] === "undefined" || !argv['store-password'] ? null : argv['store-password'],
56
- optimize: !argv["skip-optimizations"],
57
- nodelete: !argv["delete"],
58
- themeRoot: themeRoot,
59
- packageJson: pkg,
60
- tailwindConfig: tailwindConfig,
61
- usesTailwind: fs.existsSync(join(themeRoot, tailwindConfig)),
62
- usesModuleBundler: !!pkg['bundle-js'],
63
- seedConfig: "seed.config.js",
64
- shopifyIgnore: join(themeRoot, '.shopifyignore'),
65
- src: {
66
- root: "src/",
67
- js: "src/scripts/**/*.{js,js.liquid}",
68
- vendorJs: "src/scripts/vendor/*.js",
69
- json: "src/**/*.json",
70
- css: "src/styles/**/*.css",
71
- scss: "src/styles/**/*.scss",
72
- cssLint: "src/styles/**/*.{css,scss}",
73
- vendorCss: "src/styles/vendor/*.{css,scss}",
74
- assets: "src/assets/**/*",
75
- icons: "src/icons/**/*.svg",
76
- templates: "src/templates/**/*",
77
- snippets: "src/snippets/*",
78
- sections: "src/sections/*",
79
- blocks: "src/blocks/*",
80
- locales: "src/locales/*",
81
- config: "src/config/*",
82
- layout: "src/layout/*",
83
- zip: "src/**/*.zip"
84
- },
85
- tmp: {
86
- root: "tmp/",
87
- js: "tmp/scripts/**/*.{js,js.liquid}",
88
- vendorJs: "tmp/scripts/vendor/*.js",
89
- json: "tmp/**/*.json",
90
- css: "tmp/styles/**/*.css",
91
- scss: "tmp/styles/**/*.scss",
92
- cssLint: "tmp/styles/**/*.{css,scss}",
93
- vendorCss: "tmp/styles/vendor/*.{css,scss}",
94
- assets: "tmp/assets/**/*",
95
- icons: "tmp/icons/**/*.svg",
96
- templates: "tmp/templates/**/*",
97
- snippets: "tmp/snippets/*",
98
- sections: "tmp/sections/*",
99
- sectionsJson: "tmp/sections/*.json",
100
- blocks: "tmp/blocks/*",
101
- blocksJson: "tmp/blocks/*.json",
102
- locales: "tmp/locales/*",
103
- config: "tmp/config/*",
104
- layout: "tmp/layout/*",
105
- zip: "tmp/**/*.zip"
106
- },
107
- dist: {
108
- root: "dist/",
109
- assets: "dist/assets/",
110
- snippets: "dist/snippets/",
111
- sections: "dist/sections/",
112
- blocks: "dist/blocks",
113
- layout: "dist/layout/",
114
- templates: "dist/templates/",
115
- locales: "dist/locales/",
116
- zip: "dist/*.zip"
117
- },
118
- roots: {
119
- js: "src/scripts/*.{js,js.liquid}",
120
- vendorJs: "src/scripts/vendor.js",
121
- css: "src/styles/*.css",
122
- scss: "src/styles/*.scss"
123
- },
124
- plugins: {
125
- // Added at runtime
126
- postcss: [require('postcss-import')],
127
- webpack: {
128
- mode: !argv["skip-optimizations"] ? 'production' : 'development',
129
- output: {
130
- filename: 'theme.js'
131
- },
132
- resolve: {
133
- alias: {
134
- vue: 'vue/dist/vue.esm-bundler.js'
135
- }
136
- },
137
- plugins: [new webpack.DefinePlugin({
138
- __VUE_OPTIONS_API__: true,
139
- __VUE_PROD_DEVTOOLS__: false
140
- })],
141
- stats: 'none'
142
- }
143
- }
28
+ const config = {
29
+ environment: argv.environment === "undefined" || !argv.environment
30
+ ? "development"
31
+ : argv.environment,
32
+ store: argv.store === "undefined" || !argv.store ? null : argv.store,
33
+ storePassword: argv["store-password"] === "undefined" || !argv["store-password"]
34
+ ? null
35
+ : argv["store-password"],
36
+ optimize: !argv["skip-optimizations"],
37
+ nodelete: !argv["delete"],
38
+ themeRoot,
39
+ packageJson: pkg,
40
+ tailwindConfig,
41
+ usesTailwind: (0, fs_1.existsSync)((0, path_1.join)(themeRoot, tailwindConfig)),
42
+ usesModuleBundler: !!pkg["bundle-js"],
43
+ seedConfig: "seed.config.js",
44
+ shopifyIgnore: (0, path_1.join)(themeRoot, ".shopifyignore"),
45
+ src: {
46
+ root: "src/",
47
+ js: "src/scripts/**/*.{js,js.liquid}",
48
+ vendorJs: "src/scripts/vendor/*.js",
49
+ json: "src/**/*.json",
50
+ css: "src/styles/**/*.css",
51
+ scss: "src/styles/**/*.scss",
52
+ cssLint: "src/styles/**/*.{css,scss}",
53
+ vendorCss: "src/styles/vendor/*.{css,scss}",
54
+ assets: "src/assets/**/*",
55
+ icons: "src/icons/**/*.svg",
56
+ templates: "src/templates/**/*",
57
+ snippets: "src/snippets/*",
58
+ sections: "src/sections/*",
59
+ blocks: "src/blocks/*",
60
+ locales: "src/locales/*",
61
+ config: "src/config/*",
62
+ layout: "src/layout/*",
63
+ zip: "src/**/*.zip",
64
+ },
65
+ tmp: {
66
+ root: "tmp/",
67
+ js: "tmp/scripts/**/*.{js,js.liquid}",
68
+ vendorJs: "tmp/scripts/vendor/*.js",
69
+ json: "tmp/**/*.json",
70
+ css: "tmp/styles/**/*.css",
71
+ scss: "tmp/styles/**/*.scss",
72
+ cssLint: "tmp/styles/**/*.{css,scss}",
73
+ vendorCss: "tmp/styles/vendor/*.{css,scss}",
74
+ assets: "tmp/assets/**/*",
75
+ icons: "tmp/icons/**/*.svg",
76
+ templates: "tmp/templates/**/*",
77
+ snippets: "tmp/snippets/*",
78
+ sections: "tmp/sections/*",
79
+ sectionsJson: "tmp/sections/*.json",
80
+ blocks: "tmp/blocks/*",
81
+ blocksJson: "tmp/blocks/*.json",
82
+ locales: "tmp/locales/*",
83
+ config: "tmp/config/*",
84
+ layout: "tmp/layout/*",
85
+ zip: "tmp/**/*.zip",
86
+ },
87
+ dist: {
88
+ root: "dist/",
89
+ assets: "dist/assets/",
90
+ snippets: "dist/snippets/",
91
+ sections: "dist/sections/",
92
+ blocks: "dist/blocks",
93
+ layout: "dist/layout/",
94
+ templates: "dist/templates/",
95
+ locales: "dist/locales/",
96
+ zip: "dist/*.zip",
97
+ },
98
+ roots: {
99
+ js: "src/scripts/*.{js,js.liquid}",
100
+ vendorJs: "src/scripts/vendor.js",
101
+ css: "src/styles/*.css",
102
+ scss: "src/styles/*.scss",
103
+ },
104
+ plugins: {
105
+ postcss: [postcss_import_1.default],
106
+ },
144
107
  };
145
-
146
108
  if (config.usesTailwind) {
147
- config.plugins.postcss.push(tailwindcss({
148
- config: join(themeRoot, tailwindConfig)
149
- }));
109
+ config.plugins.postcss.push((0, tailwindcss_1.default)({ config: (0, path_1.join)(themeRoot, tailwindConfig) }));
150
110
  }
151
-
152
- config.plugins.postcss.push(require('autoprefixer'));
153
- config.plugins.postcss.push(pxtorem({
154
- rootValue: 16,
155
- unitPrecision: 5,
156
- propList: ['*'],
157
- selectorBlackList: [],
158
- replace: true,
159
- mediaQuery: true,
160
- exclude: /node_modules/i
111
+ config.plugins.postcss.push(autoprefixer_1.default);
112
+ config.plugins.postcss.push((0, postcss_pxtorem_1.default)({
113
+ rootValue: 16,
114
+ unitPrecision: 5,
115
+ propList: ["*"],
116
+ selectorBlackList: [],
117
+ replace: true,
118
+ mediaQuery: true,
119
+ exclude: /node_modules/i,
161
120
  }));
162
-
163
121
  if (config.optimize) {
164
- config.plugins.postcss.push(cssnano({
165
- preset: "default"
166
- }));
122
+ config.plugins.postcss.push((0, cssnano_1.default)({ preset: "default" }));
167
123
  }
168
-
169
- config.plugins.postcss.push(reporter({
170
- clearReportedMessages: true
171
- }));
172
- module.exports = config;
124
+ config.plugins.postcss.push((0, postcss_reporter_1.default)({ clearReportedMessages: true }));
125
+ exports.default = config;
126
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/tasks/includes/config.ts"],"names":[],"mappings":";;;;;AAAA,+BAA4B;AAC5B,kDAA0B;AAC1B,0DAAiC;AACjC,8DAAsC;AACtC,sDAA8B;AAC9B,sEAAsC;AACtC,wEAAwC;AACxC,wDAAgC;AAChC,2BAAgC;AAChC,gEAAwC;AACxC,oEAA2C;AAE3C,MAAM,MAAM,GAAG,IAAA,eAAK,EAAC,YAAY,CAAC,CAAC;AACnC,MAAM,IAAI,GAAG,IAAA,kBAAQ,EAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7C,MAAM,SAAS,GAAG,IAAA,mBAAQ,EAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;AAC1C,MAAM,cAAc,GAAG,oBAAoB,CAAC;AAO5C,IAAI,GAAG,GAAgB,EAAE,CAAC;AAE1B,IAAI,CAAC;IACH,GAAG,GAAG,OAAO,CAAC,IAAA,WAAI,EAAC,SAAS,EAAE,cAA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CAAC,YAAY,EAAE,CAAC;IACxB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CACzB,IAAA,qBAAW,EAAC,EAAE,MAAM,EAAE,IAAA,WAAI,EAAC,SAAS,EAAE,cAAc,CAAC,EAAE,CAAC,CACzD,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAY,CAAC,CAAC;AAE1C,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CACzB,IAAA,yBAAO,EAAC;IACN,SAAS,EAAE,EAAE;IACb,aAAa,EAAE,CAAC;IAChB,QAAQ,EAAE,CAAC,GAAG,CAAC;IACf,iBAAiB,EAAE,EAAE;IACrB,OAAO,EAAE,IAAI;IACb,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE,eAAe;CACzB,CAAC,CACH,CAAC;AAEF,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;IACpB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,iBAAO,EAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;AAC9D,CAAC;AAED,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,0BAAQ,EAAC,EAAE,qBAAqB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAEvE,kBAAe,MAAM,CAAC"}
@@ -0,0 +1,19 @@
1
+ declare const messages: {
2
+ logFileEvent: (event: string, path: string, dist?: boolean) => void;
3
+ logTransferDone: () => void;
4
+ logTransferFailed: (errMsg?: string) => void;
5
+ logProcessFiles: (processName: string) => void;
6
+ logChildProcess: (cmd: string) => void;
7
+ logDeploys: (cmd: string, files: string[]) => string;
8
+ logDeployErrors: (cmd: string, files: string[], err: string) => string;
9
+ logError: (message: string) => void;
10
+ logBundleJs: () => void;
11
+ configChange: () => string;
12
+ translationsFailed: () => string;
13
+ invalidThemeId: (themeId: string, env: string) => void;
14
+ logStoreNotFound: () => void;
15
+ configError: () => void;
16
+ deployTo: (environment: string) => void;
17
+ allDeploysComplete: () => void;
18
+ };
19
+ export default messages;
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
-
3
- var chalk = require("chalk");
4
-
5
- var log = require("fancy-log");
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const chalk_1 = __importDefault(require("chalk"));
7
+ const fancy_log_1 = __importDefault(require("fancy-log"));
6
8
  /**
7
9
  * Separates filename and directory from a path string. Returns an object containing both.
8
10
  *
@@ -10,74 +12,80 @@ var log = require("fancy-log");
10
12
  * @returns {Object} - an object with separated `file` (the filename) and `dir` (path minus filename) properties
11
13
  * @private
12
14
  */
13
-
14
-
15
15
  function separatePath(path) {
16
- var tmp = path.split('/');
17
- return {
18
- file: tmp.pop(),
19
- dir: tmp.join('/')
20
- };
16
+ const tmp = path.split("/");
17
+ return {
18
+ file: tmp.pop() || "",
19
+ dir: tmp.join("/"),
20
+ };
21
21
  }
22
-
23
- var messages = {
24
- logFileEvent: function logFileEvent(event, path) {
25
- var dist = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
26
- var pathObject = separatePath(path);
27
-
28
- if (dist) {
29
- log('updated', chalk.green('dist'), chalk.magenta(pathObject.dir), chalk.white('-'), chalk.cyan(event), chalk.yellow(pathObject.file));
30
- } else {
31
- log('change in', chalk.magenta(pathObject.dir), chalk.white('-'), chalk.cyan(event), chalk.yellow(pathObject.file));
32
- }
33
- },
34
- logTransferDone: function logTransferDone() {
35
- log('Transfer Complete:', chalk.green('File changes successfully synced to store'));
36
- },
37
- logTransferFailed: function logTransferFailed(errMsg) {
38
- log('Transfer Failed:', chalk.yellow("".concat(typeof errMsg === 'string' ? errMsg : 'File(s) failed to upload to store. See log notes in deploy.log')));
39
- },
40
- logProcessFiles: function logProcessFiles(processName) {
41
- log('running task', chalk.white('-'), chalk.cyan(processName));
42
- },
43
- logChildProcess: function logChildProcess(cmd) {
44
- log('running task', chalk.bold('[child process]'), chalk.white('-'), chalk.cyan(cmd));
45
- },
46
- logDeploys: function logDeploys(cmd, files) {
47
- var timestamp = "Deploy complete @ ".concat(new Date(), ". ");
48
- var action = cmd === 'upload' ? 'added/changed ' : 'removed ';
49
- var amount = "".concat(files.length, " file(s): ");
50
- var fileList = "".concat(files.join(', '), ".\n");
51
- return timestamp + action + amount + fileList;
52
- },
53
- logDeployErrors: function logDeployErrors(cmd, files, err) {
54
- var timestamp = "Deploy error @ ".concat(new Date(), ". ");
55
- var action = cmd === 'upload' ? 'added/changed ' : 'removed ';
56
- var amount = "".concat(files.length, " file(s): ");
57
- var fileList = "".concat(files.join(', '), ".\n");
58
- var errMsg = "".concat(err, " \n");
59
- return timestamp + action + amount + fileList + errMsg;
60
- },
61
- logBundleJs: function logBundleJs() {
62
- log('Updating JS Bundle...');
63
- },
64
- configChange: function configChange() {
65
- return 'Changes to seed.config.js Detected: You may need to quit <seed watch>' + ' and run a full <seed deploy> as a result.';
66
- },
67
- translationsFailed: function translationsFailed() {
68
- return 'Translation errors detected.';
69
- },
70
- invalidThemeId: function invalidThemeId(themeId, env) {
71
- log('Invalid theme id for', chalk.cyan("".concat(env, ": ").concat(themeId)), chalk.yellow('`theme_id` must be a string.'));
72
- },
73
- configError: function configError() {
74
- log('File missing:', chalk.yellow('`seed.config.js` does not exist. You need to add a config file before you can make changes to your Shopify store.'));
75
- },
76
- deployTo: function deployTo(environment) {
77
- log('Environment:', chalk.bold(environment));
78
- },
79
- allDeploysComplete: function allDeploysComplete() {
80
- log('Multiple environments:', chalk.green('Deploy completed for all environments in series'));
81
- }
22
+ const messages = {
23
+ logFileEvent: (event, path, dist = false) => {
24
+ const pathObject = separatePath(path);
25
+ if (dist) {
26
+ (0, fancy_log_1.default)("updated", chalk_1.default.green("dist"), chalk_1.default.magenta(pathObject.dir), chalk_1.default.white("-"), chalk_1.default.cyan(event), chalk_1.default.yellow(pathObject.file));
27
+ }
28
+ else {
29
+ (0, fancy_log_1.default)("change in", chalk_1.default.magenta(pathObject.dir), chalk_1.default.white("-"), chalk_1.default.cyan(event), chalk_1.default.yellow(pathObject.file));
30
+ }
31
+ },
32
+ logTransferDone: () => {
33
+ (0, fancy_log_1.default)("Transfer Complete:", chalk_1.default.green("File changes successfully synced to store"));
34
+ },
35
+ logTransferFailed: (errMsg) => {
36
+ (0, fancy_log_1.default)("Transfer Failed:", chalk_1.default.yellow(`${typeof errMsg === "string"
37
+ ? errMsg
38
+ : "File(s) failed to upload to store. See log notes in deploy.log"}`));
39
+ },
40
+ logProcessFiles: (processName) => {
41
+ (0, fancy_log_1.default)("running task", chalk_1.default.white("-"), chalk_1.default.cyan(processName));
42
+ },
43
+ logChildProcess: (cmd) => {
44
+ (0, fancy_log_1.default)("running task", chalk_1.default.bold("[child process]"), chalk_1.default.white("-"), chalk_1.default.cyan(cmd));
45
+ },
46
+ logDeploys: (cmd, files) => {
47
+ const timestamp = `Deploy complete @ ${new Date()}. `;
48
+ const action = cmd === "upload" ? "added/changed " : "removed ";
49
+ const amount = `${files.length} file(s): `;
50
+ const fileList = `${files.join(", ")}.\n`;
51
+ return timestamp + action + amount + fileList;
52
+ },
53
+ logDeployErrors: (cmd, files, err) => {
54
+ const timestamp = `Deploy error @ ${new Date()}. `;
55
+ const action = cmd === "upload" ? "added/changed " : "removed ";
56
+ const amount = `${files.length} file(s): `;
57
+ const fileList = `${files.join(", ")}.\n`;
58
+ const errMsg = `${err} \n`;
59
+ return timestamp + action + amount + fileList + errMsg;
60
+ },
61
+ logError: (message) => {
62
+ (0, fancy_log_1.default)(chalk_1.default.red(message));
63
+ },
64
+ logBundleJs: () => {
65
+ (0, fancy_log_1.default)("Updating JS Bundle...");
66
+ },
67
+ configChange: () => {
68
+ return ("Changes to seed.config.js Detected: You may need to quit <seed watch>" +
69
+ " and run a full <seed deploy> as a result.");
70
+ },
71
+ translationsFailed: () => {
72
+ return "Translation errors detected.";
73
+ },
74
+ invalidThemeId: (themeId, env) => {
75
+ (0, fancy_log_1.default)("Invalid theme id for", chalk_1.default.cyan(`${env}: ${themeId}`), chalk_1.default.yellow("`theme_id` must be a string."));
76
+ },
77
+ logStoreNotFound: () => {
78
+ (0, fancy_log_1.default)(chalk_1.default.red("Store domain not found in seed.project.json or seed.config.js. If this is a multi-store project, pass in --store <store>."));
79
+ },
80
+ configError: () => {
81
+ (0, fancy_log_1.default)("File missing:", chalk_1.default.yellow("`seed.config.js` does not exist. You need to add a config file before you can make changes to your Shopify store."));
82
+ },
83
+ deployTo: (environment) => {
84
+ (0, fancy_log_1.default)("Environment:", chalk_1.default.bold(environment));
85
+ },
86
+ allDeploysComplete: () => {
87
+ (0, fancy_log_1.default)("Multiple environments:", chalk_1.default.green("Deploy completed for all environments in series"));
88
+ },
82
89
  };
83
- module.exports = messages;
90
+ exports.default = messages;
91
+ //# sourceMappingURL=messages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../src/tasks/includes/messages.ts"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAC1B,0DAA4B;AAO5B;;;;;;GAMG;AACH,SAAS,YAAY,CAAC,IAAY;IAChC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAE5B,OAAO;QACL,IAAI,EAAE,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE;QACrB,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC;KACnB,CAAC;AACJ,CAAC;AAED,MAAM,QAAQ,GAAG;IACf,YAAY,EAAE,CAAC,KAAa,EAAE,IAAY,EAAE,IAAI,GAAG,KAAK,EAAQ,EAAE;QAChE,MAAM,UAAU,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;QAEtC,IAAI,IAAI,EAAE,CAAC;YACT,IAAA,mBAAG,EACD,SAAS,EACT,eAAK,CAAC,KAAK,CAAC,MAAM,CA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CAA4C,CAC7C,CAAC;IACJ,CAAC;IAED,kBAAkB,EAAE,GAAW,EAAE;QAC/B,OAAO,8BAA8B,CAAC;IACxC,CAAC;IAED,cAAc,EAAE,CAAC,OAAe,EAAE,GAAW,EAAQ,EAAE;QACrD,IAAA,mBAAG,EACD,sBAAsB,EACtB,eAAK,CAAC,IAAI,CAAC,GAAG,GAAG,KAAK,OAAO,EAAE,CAAC,EAChC,eAAK,CAAC,MAAM,CAAC,8BAA8B,CAAC,CAC7C,CAAC;IACJ,CAAC;IAED,gBAAgB,EAAE,GAAS,EAAE;QAC3B,IAAA,mBAAG,EACD,eAAK,CAAC,GAAG,CACP,2HAA2H,CAC5H,CACF,CAAC;IACJ,CAAC;IAED,WAAW,EAAE,GAAS,EAAE;QACtB,IAAA,mBAAG,EACD,eAAe,EACf,eAAK,CAAC,MAAM,CACV,mHAAmH,CACpH,CACF,CAAC;IACJ,CAAC;IAED,QAAQ,EAAE,CAAC,WAAmB,EAAQ,EAAE;QACtC,IAAA,mBAAG,EAAC,cAAc,EAAE,eAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED,kBAAkB,EAAE,GAAS,EAAE;QAC7B,IAAA,mBAAG,EACD,wBAAwB,EACxB,eAAK,CAAC,KAAK,CAAC,iDAAiD,CAAC,CAC/D,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,kBAAe,QAAQ,CAAC"}
@@ -0,0 +1,71 @@
1
+ import _ from "lodash";
2
+ import Promise from "bluebird";
3
+ interface EventCacheOptions {
4
+ changeEvents?: string[];
5
+ unlinkEvents?: string[];
6
+ }
7
+ interface EventCache {
8
+ change: string[];
9
+ unlink: string[];
10
+ addEvent: (event: string, path: string) => void;
11
+ }
12
+ /**
13
+ * Utility and reusable functions used by our Gulp Tasks
14
+ *
15
+ * @summary a set of utility functions used within the gulp tasks of seed-cli
16
+ * @namespace seed-cli.utilities
17
+ * @memberof seed-cli
18
+ */
19
+ declare const utilities: {
20
+ /**
21
+ * Indicates whether there are errors during build/watch
22
+ *
23
+ * @returns {Boolean}
24
+ */
25
+ hasErrors: () => boolean;
26
+ /**
27
+ * Handles the output for any errors that might have been captured
28
+ * during the build and zip Gulp tasks.
29
+ *
30
+ * @memberof seed-cli.utilities
31
+ */
32
+ outputErrors: () => void;
33
+ /**
34
+ * Generic error handler for streams called in `watch` tasks (used by gulp-plumber).
35
+ * Any error that is thrown inside of a task is added to the errors array.
36
+ *
37
+ * @memberof seed-cli.utilities
38
+ * @param {Error} err
39
+ */
40
+ errorHandler: (err: Error) => void;
41
+ /**
42
+ * Executes an array of promises in series
43
+ *
44
+ * @param promiseArrayFactory {Function} - an array of promise factories
45
+ * @returns {Promise} - promise.all() style array of results from each promise
46
+ */
47
+ promiseSeries: <T>(promiseArrayFactory: Array<() => Promise<T>>) => Promise<T[]>;
48
+ /**
49
+ * Factory for creating an event cache - used with a short debounce to batch any
50
+ * file changes that occur in rapid succession during Watch tasks.
51
+ *
52
+ * @memberof seed-cli.utilities
53
+ * @param {Object} options
54
+ * @returns {eventCache} see type definition for more robust documentation
55
+ */
56
+ createEventCache: (options?: EventCacheOptions) => EventCache;
57
+ /**
58
+ * Debounced (320ms) delegator function passing an {@link eventCache} object
59
+ * through to a pair of custom functions for processing batch add/change or unlink events.
60
+ * Clears the appropriate cache array after a change/delete function has been
61
+ * called.
62
+ *
63
+ * @memberof seed-cli.utilities
64
+ * @method
65
+ * @param {eventCache} cache - a specific cache object for tracking file events
66
+ * @param {Function} changeFn - a custom function to process the set of files that have changed
67
+ * @param {Function} delFn - a custom function to remove the set of files that have changed from the `dist` directory
68
+ */
69
+ processCache: _.DebouncedFunc<(cache: EventCache, changeFn: (files: string[]) => void, delFn: (files: string[]) => void) => void>;
70
+ };
71
+ export default utilities;