@appdirect/sfb-toolkit 5.0.9 → 6.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 (119) hide show
  1. package/.eslintrc +35 -35
  2. package/CHANGELOG.md +32 -0
  3. package/Dockerfile +2 -1
  4. package/agent/.cursor/rules/sfb-storefront.mdc +17 -0
  5. package/agent/.cursor/skills/sfb-custom-components/COMPONENT-CATALOG.md +130 -0
  6. package/agent/.cursor/skills/sfb-custom-components/SKILL.md +43 -0
  7. package/agent/.cursor/skills/sfb-localization-settings/SKILL.md +29 -0
  8. package/agent/.cursor/skills/sfb-theme-customize/SKILL.md +25 -0
  9. package/agent/.cursor/skills/sfb-toolkit-commands/SKILL.md +35 -0
  10. package/agent/AGENTS.md +160 -0
  11. package/agent/CLAUDE.md +19 -0
  12. package/bin/index.js +82 -100
  13. package/coverage/clover.xml +1921 -335
  14. package/coverage/coverage-final.json +41 -20
  15. package/coverage/lcov-report/{controllers/controllers-utils → config}/index.html +19 -19
  16. package/coverage/lcov-report/config/index.js.html +124 -0
  17. package/coverage/lcov-report/index.html +108 -78
  18. package/coverage/lcov-report/{constants → src/constants}/customUserAttributesMock.js.html +12 -12
  19. package/coverage/lcov-report/{constants → src/constants}/index.html +10 -10
  20. package/coverage/lcov-report/{constants → src/constants}/pageUrls.js.html +14 -14
  21. package/coverage/lcov-report/{constants → src/constants}/userMock.js.html +13 -13
  22. package/coverage/lcov-report/{controllers → src/controllers}/controllers-utils/assetsUtils.js.html +20 -20
  23. package/coverage/lcov-report/src/controllers/controllers-utils/index.html +131 -0
  24. package/coverage/lcov-report/src/controllers/controllers-utils/locale.js.html +115 -0
  25. package/coverage/lcov-report/{controllers → src/controllers}/data-filters/bootstrap-data-filter.js.html +15 -15
  26. package/coverage/lcov-report/{controllers → src/controllers}/data-filters/call-to-actions-filter.js.html +22 -22
  27. package/coverage/lcov-report/{controllers → src/controllers}/data-filters/index.html +37 -22
  28. package/coverage/lcov-report/src/controllers/data-filters/media-url-filter.js.html +394 -0
  29. package/coverage/lcov-report/{controllers → src/controllers}/index.html +27 -27
  30. package/coverage/lcov-report/{controllers → src/controllers}/index.js.html +159 -126
  31. package/coverage/lcov-report/{front-end-utils → src/front-end-utils}/src/components/base/ResultItem.js.html +43 -43
  32. package/coverage/lcov-report/{front-end-utils → src/front-end-utils}/src/components/base/SearchBar.js.html +22 -22
  33. package/coverage/lcov-report/{front-end-utils → src/front-end-utils}/src/components/base/index.html +28 -28
  34. package/coverage/lcov-report/{front-end-utils → src/front-end-utils}/src/components/base/item.js.html +28 -28
  35. package/coverage/lcov-report/{front-end-utils → src/front-end-utils}/src/components/container.js.html +31 -31
  36. package/coverage/lcov-report/{front-end-utils → src/front-end-utils}/src/components/data-view.js.html +29 -29
  37. package/coverage/lcov-report/{front-end-utils → src/front-end-utils}/src/components/header-view.js.html +35 -38
  38. package/coverage/lcov-report/{front-end-utils → src/front-end-utils}/src/components/index.html +45 -45
  39. package/coverage/lcov-report/{front-end-utils → src/front-end-utils}/src/components/search.js.html +54 -54
  40. package/coverage/lcov-report/{front-end-utils → src/front-end-utils}/src/constants/index.html +22 -22
  41. package/coverage/lcov-report/{front-end-utils → src/front-end-utils}/src/constants/pageUrl.js.html +17 -17
  42. package/coverage/lcov-report/{front-end-utils → src/front-end-utils}/src/constants/roleType.js.html +14 -14
  43. package/coverage/lcov-report/{front-end-utils → src/front-end-utils}/src/constants/searchType.js.html +17 -17
  44. package/coverage/lcov-report/{front-end-utils → src/front-end-utils}/src/utils/debounce.js.html +15 -15
  45. package/coverage/lcov-report/{front-end-utils → src/front-end-utils}/src/utils/index.html +20 -20
  46. package/coverage/lcov-report/{middlewares → src/middlewares}/config.js.html +11 -11
  47. package/coverage/lcov-report/{middlewares → src/middlewares}/index.html +10 -10
  48. package/coverage/lcov-report/{tools → src/routes}/index.html +30 -30
  49. package/coverage/lcov-report/src/routes/media-proxy.js.html +613 -0
  50. package/coverage/lcov-report/src/tools/compile-styles.js.html +1018 -0
  51. package/coverage/lcov-report/src/tools/custom-components-export-compat-loader.js.html +745 -0
  52. package/coverage/lcov-report/src/tools/index.html +371 -0
  53. package/coverage/lcov-report/src/tools/prompt-questions.js.html +1117 -0
  54. package/coverage/lcov-report/{tools → src/tools}/proxy-fetch.js.html +15 -15
  55. package/coverage/lcov-report/src/tools/resolve-components-react.js.html +457 -0
  56. package/coverage/lcov-report/src/tools/sass-legacy-compat.js.html +1192 -0
  57. package/coverage/lcov-report/src/tools/toolkit-cli-argv.js.html +226 -0
  58. package/coverage/lcov-report/src/tools/toolkit-common-fun.js.html +1192 -0
  59. package/coverage/lcov-report/src/tools/toolkit-common-vars-namespace.js.html +403 -0
  60. package/coverage/lcov-report/src/tools/toolkit-common-vars.js.html +283 -0
  61. package/coverage/lcov-report/src/tools/toolkit-components-fun.js.html +1237 -0
  62. package/coverage/lcov-report/src/tools/toolkit-components-vars.js.html +232 -0
  63. package/coverage/lcov-report/src/tools/toolkit-install-agent-guidance.js.html +439 -0
  64. package/coverage/lcov-report/src/tools/toolkit-live-reload.js.html +688 -0
  65. package/coverage/lcov-report/src/tools/toolkit-path.js.html +184 -0
  66. package/coverage/lcov-report/src/tools/toolkit-spawn.js.html +199 -0
  67. package/coverage/lcov-report/src/tools/toolkit-v6-theme-risk.js.html +1039 -0
  68. package/coverage/lcov-report/src/tools/toolkit-zip-utils.js.html +190 -0
  69. package/coverage/lcov.info +3356 -727
  70. package/index.js +40 -20
  71. package/npm-shrinkwrap.json +5026 -15490
  72. package/package.json +49 -40
  73. package/readme.md +20 -1
  74. package/rspack-components.config.cjs +81 -0
  75. package/rspack-components.config.prod.cjs +71 -0
  76. package/rspack.config.cjs +25 -0
  77. package/rspack.shared.cjs +164 -0
  78. package/src/controllers/controllers-utils/locale.js +10 -0
  79. package/src/controllers/data-filters/media-url-filter.js +103 -0
  80. package/src/controllers/index.js +15 -4
  81. package/src/front-end-utils/dist/toolbar.bundle.js +1 -2
  82. package/src/front-end-utils/src/components/header-view.js +0 -1
  83. package/src/routes/index.js +2 -0
  84. package/src/routes/media-proxy.js +176 -0
  85. package/src/tools/compile-styles.js +311 -0
  86. package/src/tools/compiler-components-prod.js +32 -21
  87. package/src/tools/compiler-css.js +7 -7
  88. package/src/tools/custom-components-export-compat-loader.js +220 -0
  89. package/src/tools/resolve-components-react.js +124 -0
  90. package/src/tools/sass-legacy-compat.js +369 -0
  91. package/src/tools/toolkit-checkout.js +3 -6
  92. package/src/tools/toolkit-cli-argv.js +47 -0
  93. package/src/tools/toolkit-common-fun.js +66 -18
  94. package/src/tools/toolkit-common-utils.js +5 -3
  95. package/src/tools/toolkit-common-vars.js +4 -3
  96. package/src/tools/toolkit-components-copy.js +6 -4
  97. package/src/tools/toolkit-components-fun.js +6 -4
  98. package/src/tools/toolkit-config-setup.js +2 -1
  99. package/src/tools/toolkit-create.js +5 -7
  100. package/src/tools/toolkit-import.js +5 -6
  101. package/src/tools/toolkit-install-agent-guidance-cli.js +24 -0
  102. package/src/tools/toolkit-install-agent-guidance.js +118 -0
  103. package/src/tools/toolkit-install.js +8 -8
  104. package/src/tools/toolkit-live-reload.js +201 -0
  105. package/src/tools/toolkit-package.js +25 -7
  106. package/src/tools/toolkit-path.js +33 -0
  107. package/src/tools/toolkit-setup-e2e.js +2 -1
  108. package/src/tools/toolkit-setup.js +5 -1
  109. package/src/tools/toolkit-spawn.js +38 -0
  110. package/src/tools/toolkit-start.js +98 -54
  111. package/src/tools/toolkit-storybook.js +38 -19
  112. package/src/tools/toolkit-update.js +5 -3
  113. package/src/tools/toolkit-v6-theme-risk.js +318 -0
  114. package/themes-param.json +1 -0
  115. package/src/front-end-utils/dist/toolbar.bundle.js.LICENSE.txt +0 -52
  116. package/src/tools/gulp-tasks.js +0 -80
  117. package/webpack-components.config.cjs +0 -123
  118. package/webpack-components.config.prod.cjs +0 -113
  119. package/webpack.config.cjs +0 -25
@@ -0,0 +1,318 @@
1
+ /**
2
+ * Toolkit 6.x theme risk banners: thorough-check notice for non-current-stack
3
+ * themes, plus detected legacy patterns covered by compat shims.
4
+ */
5
+ const fs = require("fs");
6
+ const path = require("path");
7
+ const chalk = require("chalk");
8
+ const {
9
+ ACTIVE_THEME_PATH,
10
+ TOOLKIT_PATH,
11
+ THEME_COMPONENT_MODULE,
12
+ THEME_COMPONENT_VERSION
13
+ } = require("./toolkit-common-vars");
14
+
15
+ const PLAZA_TEMPLATE = "@appdirect/sfb-theme-plaza";
16
+ /** Accept Plaza metadata.themeVersion within this many patch releases of the toolkit pin. */
17
+ const PLAZA_VERSION_GRACE_PATCHES = 5;
18
+
19
+ const REVERT_TO_V5_HINT =
20
+ "To stay on or revert to toolkit 5.x: npm install -g @appdirect/sfb-toolkit@5";
21
+
22
+ const PRE_UPGRADE_V6_NOTICE =
23
+ "Version 6 replaces the entire local tooling stack used to build themes (bundler + Sass compiler). We thoroughly tested this upgrade and added compatibility for common legacy theme patterns, but every customized theme can differ — after upgrading, thoroughly test your theme with toolkit 6 before packaging or publishing. " +
24
+ REVERT_TO_V5_HINT +
25
+ ".";
26
+
27
+ const POST_UPGRADE_LEGACY_NOTICE =
28
+ "You are running sfb-toolkit 6.x. This major version changes the entire theme build tooling, not just dependencies. We thoroughly tested toolkit 6 and include compatibility shims for known older-theme patterns, but themes built or last verified on toolkit 5.x or earlier must still be thoroughly checked (pages, custom CSS/Sass, custom components, package zip) before you publish with version 6. " +
29
+ REVERT_TO_V5_HINT +
30
+ ".";
31
+
32
+ const SHIM_HITS_NOTICE =
33
+ "This theme uses legacy patterns that toolkit 6 supports via compatibility shims (covered in our testing). Still verify CSS and custom components carefully before publishing. " +
34
+ REVERT_TO_V5_HINT +
35
+ ".";
36
+
37
+ const normalizeVersion = value => {
38
+ if (value == null) {
39
+ return "";
40
+ }
41
+ return String(value)
42
+ .trim()
43
+ .replace(/^[~^>=<\s]+/, "")
44
+ .split(/\s+/)[0];
45
+ };
46
+
47
+ const readJsonSafe = filePath => {
48
+ try {
49
+ return JSON.parse(fs.readFileSync(filePath, "utf8"));
50
+ } catch (_err) {
51
+ return null;
52
+ }
53
+ };
54
+
55
+ const getToolkitPlazaVersion = (toolkitRoot = TOOLKIT_PATH) => {
56
+ const pkg = readJsonSafe(path.join(toolkitRoot, "package.json"));
57
+ return normalizeVersion(pkg?.dependencies?.[PLAZA_TEMPLATE]);
58
+ };
59
+
60
+ const parseSemverParts = value => {
61
+ const normalized = normalizeVersion(value);
62
+ const match = normalized.match(/^(\d+)\.(\d+)\.(\d+)/);
63
+ if (!match) {
64
+ return null;
65
+ }
66
+ return {
67
+ major: Number(match[1]),
68
+ minor: Number(match[2]),
69
+ patch: Number(match[3])
70
+ };
71
+ };
72
+
73
+ /**
74
+ * Plaza pin ± recent: same major.minor as the toolkit pin, and patch not older
75
+ * than `PLAZA_VERSION_GRACE_PATCHES` below the pin (newer patches are fine).
76
+ * With pin 0.0.89 → silent for 0.0.84 … and up (e.g. 0.0.90).
77
+ */
78
+ const isPlazaVersionCurrent = (
79
+ themeVersion,
80
+ expectedVersion,
81
+ gracePatches = PLAZA_VERSION_GRACE_PATCHES
82
+ ) => {
83
+ const theme = parseSemverParts(themeVersion);
84
+ const expected = parseSemverParts(expectedVersion);
85
+ if (!theme || !expected) {
86
+ return normalizeVersion(themeVersion) === normalizeVersion(expectedVersion);
87
+ }
88
+ if (theme.major !== expected.major || theme.minor !== expected.minor) {
89
+ return false;
90
+ }
91
+ const oldestAllowed = Math.max(0, expected.patch - gracePatches);
92
+ return theme.patch >= oldestAllowed;
93
+ };
94
+
95
+ const getThemePackageJson = themePath =>
96
+ readJsonSafe(path.join(themePath, "package.json"));
97
+
98
+ const getInstalledComponentsVersion = themePath => {
99
+ const fromNm = readJsonSafe(
100
+ path.join(themePath, "node_modules", ...THEME_COMPONENT_MODULE.split("/"), "package.json")
101
+ );
102
+ if (fromNm?.version) {
103
+ return normalizeVersion(fromNm.version);
104
+ }
105
+ const themePkg = getThemePackageJson(themePath);
106
+ return normalizeVersion(themePkg?.dependencies?.[THEME_COMPONENT_MODULE]);
107
+ };
108
+
109
+ /**
110
+ * Current blessed stack: recent Plaza (pin and up to 5 patches older, or newer),
111
+ * and either matching sfb-theme-components or no custom-components usage.
112
+ */
113
+ const isCurrentBlessedThemeStack = (
114
+ themePath = ACTIVE_THEME_PATH,
115
+ toolkitRoot = TOOLKIT_PATH
116
+ ) => {
117
+ const themePkg = getThemePackageJson(themePath);
118
+ if (!themePkg?.metadata) {
119
+ return false;
120
+ }
121
+ const { themeTemplate, themeVersion } = themePkg.metadata;
122
+ if (themeTemplate !== PLAZA_TEMPLATE) {
123
+ return false;
124
+ }
125
+ const expectedPlaza = getToolkitPlazaVersion(toolkitRoot);
126
+ if (!expectedPlaza || !isPlazaVersionCurrent(themeVersion, expectedPlaza)) {
127
+ return false;
128
+ }
129
+
130
+ const hasCustomComponents = fs.existsSync(
131
+ path.join(themePath, "customComponents")
132
+ );
133
+ const componentsVersion = getInstalledComponentsVersion(themePath);
134
+ if (!componentsVersion && !hasCustomComponents) {
135
+ return true;
136
+ }
137
+ return componentsVersion === normalizeVersion(THEME_COMPONENT_VERSION);
138
+ };
139
+
140
+ const walkFiles = (dir, extensions, out = []) => {
141
+ if (!fs.existsSync(dir)) {
142
+ return out;
143
+ }
144
+ let entries;
145
+ try {
146
+ entries = fs.readdirSync(dir, { withFileTypes: true });
147
+ } catch (_err) {
148
+ return out;
149
+ }
150
+ for (const entry of entries) {
151
+ if (entry.name === "node_modules" || entry.name === ".git") {
152
+ continue;
153
+ }
154
+ const full = path.join(dir, entry.name);
155
+ if (entry.isDirectory()) {
156
+ walkFiles(full, extensions, out);
157
+ } else if (extensions.some(ext => entry.name.endsWith(ext))) {
158
+ out.push(full);
159
+ }
160
+ }
161
+ return out;
162
+ };
163
+
164
+ const COMPOUND_EXTEND_RE = /@extend\s+([^;{]+);/g;
165
+ const NON_STYLESHEET_IMPORT_RE =
166
+ /@import\s+['"][^'"]+\.(?:ico|png|jpe?g|gif|svg|webp|woff2?|ttf|eot)(?:\?[^'"]*)?['"]/gi;
167
+ const ROOT_AMP_UNDER_AT_RE =
168
+ /@(?:media|include)\b[^;{]*\{[^}]*&[.#:[\w-]/s;
169
+ const STAR_EXPORT_RE = /export\s*\*\s*from\s*['"]([^'"]+)['"]/g;
170
+ const SIDE_EFFECT_IMPORT_RE =
171
+ /^\s*import\s+['"]([^'"]+)['"]\s*;?\s*(?:\/\/.*)?$/gm;
172
+ const LIBRARY_HINT = "@appdirect/sfb-theme-components";
173
+
174
+ const isCompoundExtendTarget = selectorList => {
175
+ const trimmed = selectorList.trim();
176
+ if (!trimmed || trimmed.includes(",")) {
177
+ return false;
178
+ }
179
+ const compact = trimmed.replace(/\s+/g, "");
180
+ // Skip obvious combinators outside our rewrite interest for detection noise.
181
+ if (/[>+~]/.test(compact.replace(/\([^)]*\)/g, ""))) {
182
+ return false;
183
+ }
184
+ const simples = compact.match(
185
+ /([.#][-\w]+|:{1,2}[-\w]+(?:\([^)]*\))?)/g
186
+ );
187
+ return Boolean(simples && simples.length > 1 && simples.join("") === compact);
188
+ };
189
+
190
+ const detectLegacyShimPatterns = (themePath = ACTIVE_THEME_PATH) => {
191
+ const hits = [];
192
+ const seen = new Set();
193
+ const add = (id, label) => {
194
+ if (seen.has(id)) {
195
+ return;
196
+ }
197
+ seen.add(id);
198
+ hits.push({ id, label });
199
+ };
200
+
201
+ const styleFiles = walkFiles(themePath, [".scss", ".sass", ".css"]);
202
+ for (const file of styleFiles) {
203
+ let source;
204
+ try {
205
+ source = fs.readFileSync(file, "utf8");
206
+ } catch (_err) {
207
+ continue;
208
+ }
209
+ COMPOUND_EXTEND_RE.lastIndex = 0;
210
+ let match;
211
+ while ((match = COMPOUND_EXTEND_RE.exec(source))) {
212
+ if (isCompoundExtendTarget(match[1])) {
213
+ add(
214
+ "compound-extend",
215
+ "compound @extend (e.g. .foo.bar / .foo:hover)"
216
+ );
217
+ break;
218
+ }
219
+ }
220
+ NON_STYLESHEET_IMPORT_RE.lastIndex = 0;
221
+ if (NON_STYLESHEET_IMPORT_RE.test(source)) {
222
+ add(
223
+ "non-stylesheet-import",
224
+ "non-CSS @import (images, fonts, .ico, etc.)"
225
+ );
226
+ }
227
+ if (ROOT_AMP_UNDER_AT_RE.test(source)) {
228
+ add(
229
+ "root-parent-amp",
230
+ "root-level & under @media / @include (libsass-style)"
231
+ );
232
+ }
233
+ }
234
+
235
+ const customIndex = path.join(themePath, "customComponents", "index.js");
236
+ if (fs.existsSync(customIndex)) {
237
+ let source;
238
+ try {
239
+ source = fs.readFileSync(customIndex, "utf8");
240
+ } catch (_err) {
241
+ source = "";
242
+ }
243
+ const stars = [...source.matchAll(STAR_EXPORT_RE)].map(m => m[1]);
244
+ const hasLibrary = stars.some(s => s.includes(LIBRARY_HINT));
245
+ const hasLocal = stars.some(s => !s.includes(LIBRARY_HINT));
246
+ if (hasLibrary && hasLocal) {
247
+ add(
248
+ "dual-export-star",
249
+ "customComponents dual export * (theme + library barrel)"
250
+ );
251
+ }
252
+
253
+ const barrels = [
254
+ customIndex,
255
+ path.join(themePath, "customComponents", "components", "index.js")
256
+ ];
257
+ for (const barrel of barrels) {
258
+ if (!fs.existsSync(barrel)) {
259
+ continue;
260
+ }
261
+ let barrelSrc;
262
+ try {
263
+ barrelSrc = fs.readFileSync(barrel, "utf8");
264
+ } catch (_err) {
265
+ continue;
266
+ }
267
+ SIDE_EFFECT_IMPORT_RE.lastIndex = 0;
268
+ if (SIDE_EFFECT_IMPORT_RE.test(barrelSrc)) {
269
+ add(
270
+ "barrel-side-effect-css",
271
+ "bare CSS/side-effect imports in customComponents barrels"
272
+ );
273
+ break;
274
+ }
275
+ }
276
+ }
277
+
278
+ return hits;
279
+ };
280
+
281
+ const printV6ThemeRiskWarnings = ({
282
+ themePath = ACTIVE_THEME_PATH,
283
+ toolkitRoot = TOOLKIT_PATH,
284
+ log = console.log
285
+ } = {}) => {
286
+ if (isCurrentBlessedThemeStack(themePath, toolkitRoot)) {
287
+ return { skipped: true, shimHits: [] };
288
+ }
289
+
290
+ log(`\n${chalk.yellow.bold("sfb-toolkit 6.x — theme check recommended")}`);
291
+ log(chalk.yellow(POST_UPGRADE_LEGACY_NOTICE));
292
+
293
+ const shimHits = detectLegacyShimPatterns(themePath);
294
+ if (shimHits.length) {
295
+ log(`\n${chalk.yellow(SHIM_HITS_NOTICE)}`);
296
+ log(chalk.yellow("Detected:"));
297
+ for (const hit of shimHits) {
298
+ log(chalk.yellow(` • ${hit.label}`));
299
+ }
300
+ }
301
+ log("");
302
+ return { skipped: false, shimHits };
303
+ };
304
+
305
+ module.exports = {
306
+ PLAZA_TEMPLATE,
307
+ PLAZA_VERSION_GRACE_PATCHES,
308
+ REVERT_TO_V5_HINT,
309
+ PRE_UPGRADE_V6_NOTICE,
310
+ POST_UPGRADE_LEGACY_NOTICE,
311
+ SHIM_HITS_NOTICE,
312
+ normalizeVersion,
313
+ getToolkitPlazaVersion,
314
+ isPlazaVersionCurrent,
315
+ isCurrentBlessedThemeStack,
316
+ detectLegacyShimPatterns,
317
+ printV6ThemeRiskWarnings
318
+ };
@@ -0,0 +1 @@
1
+ [{"dependency":"@appdirect/sfb-theme-classic","version":"0.0.27","name":"Classic","description":"A theme built with simple HTML/CSS and jQuery."},{"dependency":"@appdirect/sfb-theme-plaza","version":"0.0.95","name":"Plaza","description":"A modern theme built with react components that can be customized with Storefront Builder."}]
@@ -1,52 +0,0 @@
1
- /*
2
- object-assign
3
- (c) Sindre Sorhus
4
- @license MIT
5
- */
6
-
7
- /*! js-cookie v3.0.5 | MIT */
8
-
9
- /**
10
- * Prism: Lightweight, robust, elegant syntax highlighting
11
- *
12
- * @license MIT <https://opensource.org/licenses/MIT>
13
- * @author Lea Verou <https://lea.verou.me>
14
- * @namespace
15
- * @public
16
- */
17
-
18
- /** @license React v0.19.1
19
- * scheduler.production.min.js
20
- *
21
- * Copyright (c) Facebook, Inc. and its affiliates.
22
- *
23
- * This source code is licensed under the MIT license found in the
24
- * LICENSE file in the root directory of this source tree.
25
- */
26
-
27
- /** @license React v16.13.1
28
- * react-is.production.min.js
29
- *
30
- * Copyright (c) Facebook, Inc. and its affiliates.
31
- *
32
- * This source code is licensed under the MIT license found in the
33
- * LICENSE file in the root directory of this source tree.
34
- */
35
-
36
- /** @license React v16.14.0
37
- * react-dom.production.min.js
38
- *
39
- * Copyright (c) Facebook, Inc. and its affiliates.
40
- *
41
- * This source code is licensed under the MIT license found in the
42
- * LICENSE file in the root directory of this source tree.
43
- */
44
-
45
- /** @license React v16.14.0
46
- * react.production.min.js
47
- *
48
- * Copyright (c) Facebook, Inc. and its affiliates.
49
- *
50
- * This source code is licensed under the MIT license found in the
51
- * LICENSE file in the root directory of this source tree.
52
- */
@@ -1,80 +0,0 @@
1
- const { src, dest, series, watch } = require("gulp");
2
- const sass = require("gulp-sass")(require("sass"))
3
- const concat = require("gulp-concat")
4
- const sourcemaps = require("gulp-sourcemaps")
5
-
6
- const currentPath = process.cwd() // used to get current dev folder
7
- const config = require(`${currentPath}/config`)
8
-
9
- const PATHS = {
10
- ASSETS: `${currentPath}/themes/${config.theme}/assets/**/*.s[a|c]ss`,
11
- HEADER_FOOTER: `${currentPath}/themes/${config.theme}/header-footer/**/*.scss`,
12
- COMPONENTS: `./themes/${config.theme}/components/**/*.scss`
13
- }
14
-
15
- const COMPONENTS_DEST = `./themes/${config.theme}/assets/css/components`;
16
-
17
- const sassAssets = () => {
18
- return src([
19
- PATHS.ASSETS,
20
- PATHS.HEADER_FOOTER
21
- ])
22
- .pipe(sourcemaps.init())
23
- .pipe(
24
- sass()
25
- .on("error", sass.logError)
26
- )
27
- .pipe(sourcemaps.write())
28
- .pipe(dest(file => file.base))
29
- }
30
-
31
- const sassComponents = () => {
32
- return src([PATHS.COMPONENTS])
33
- .pipe(concat("components.scss"))
34
- .pipe(sourcemaps.init())
35
- .pipe(
36
- sass()
37
- .on("error", sass.logError)
38
- )
39
- .pipe(sourcemaps.write())
40
- .pipe(dest(COMPONENTS_DEST))
41
- }
42
-
43
- const sassAssetsProd = () => {
44
- return src([
45
- PATHS.ASSETS,
46
- PATHS.HEADER_FOOTER
47
- ])
48
- .pipe(
49
- sass({ outputStyle: "compressed" })
50
- .on("error", sass.logError)
51
- )
52
- .pipe(dest(file => file.base))
53
- }
54
-
55
- const sassComponentsProd = () => {
56
- return src([PATHS.COMPONENTS])
57
- .pipe(concat("components.scss"))
58
- .pipe(
59
- sass({ outputStyle: "compressed" })
60
- .on("error", sass.logError)
61
- )
62
- .pipe(dest(COMPONENTS_DEST))
63
- }
64
-
65
- const gulpCompileStylesTask = () => {
66
- series(sassAssetsProd, sassComponentsProd)();
67
- }
68
- const gulpCompileStylesDevTask = () => {
69
- series(sassAssets, sassComponents)();
70
- }
71
-
72
- const gulpWatchStylesTask = () => {
73
- watch([PATHS.ASSETS, PATHS.HEADER_FOOTER], series(sassAssets, sassComponents));
74
- }
75
-
76
- module.exports = {
77
- gulpCompileStylesTask,
78
- gulpCompileStylesDevTask,
79
- gulpWatchStylesTask
80
- }
@@ -1,123 +0,0 @@
1
- const path = require("path")
2
- const webpack = require("webpack")
3
- const MiniCssExtractPlugin = require("mini-css-extract-plugin")
4
-
5
- module.exports = (currentPath, config, isAsset) => {
6
- const assetPath = path.resolve(
7
- currentPath,
8
- `themes/${config.theme}/assets/js/components`
9
- )
10
- const libPath = path.resolve(
11
- currentPath,
12
- `themes/${config.theme}/components/lib`
13
- )
14
-
15
- return {
16
- entry: [
17
- "webpack-hot-middleware/client?path=/__webpack_hmr&reload=true",
18
- path.resolve(
19
- currentPath,
20
- `themes/${config.theme}/customComponents/index.js`
21
- )
22
- ],
23
- mode: "development",
24
- output: {
25
- library: "__ADComponents",
26
- libraryTarget: "var",
27
- filename: "sfb-components.js",
28
- path: isAsset ? assetPath : libPath,
29
- publicPath: `http://localhost:3555/sfb-toolkit-assets/js/components/`,
30
- hotUpdateChunkFilename: "hot/hot-update.js",
31
- hotUpdateMainFilename: "hot/hot-update.json"
32
- },
33
- plugins: [
34
- new webpack.HotModuleReplacementPlugin(),
35
- new MiniCssExtractPlugin({
36
- filename: "sfb-components.css"
37
- })
38
- ],
39
- module: {
40
- rules: [
41
- {
42
- test: /\.(js|jsx)$/,
43
- use: {
44
- loader: "babel-loader",
45
- options: {
46
- presets: [
47
- require.resolve("@babel/preset-env"),
48
- require.resolve("@babel/preset-react")
49
- ],
50
- plugins: [
51
- require.resolve("@babel/plugin-proposal-class-properties"),
52
- require.resolve("@babel/plugin-transform-runtime")
53
- ],
54
- include: [
55
- path.resolve(
56
- currentPath,
57
- `themes/${config.theme}/customComponents`
58
- ),
59
- path.resolve(
60
- currentPath,
61
- `themes/${config.theme}/node_modules/@appdirect/sfb-theme-components`
62
- )
63
- ]
64
- }
65
- }
66
- },
67
- {
68
- test: /\.(sa|sc|c)ss$/,
69
- use: [
70
- MiniCssExtractPlugin.loader,
71
- { loader: "css-loader" },
72
- { loader: "sass-loader" }
73
- ]
74
- },
75
- {
76
- test: /\.(png|gif|jpg|svg)$/,
77
- use: {
78
- loader: "url-loader",
79
- options: {
80
- limit: 50000
81
- }
82
- }
83
- },
84
- {
85
- test: /\.(woff(2)?|ttf|eot)(\?v=\d+\.\d+\.\d+)?$/,
86
- use: [
87
- {
88
- loader: "file-loader",
89
- options: {
90
- name: "[name].[ext]",
91
- outputPath: "fonts/"
92
- }
93
- }
94
- ]
95
- }
96
- ]
97
- },
98
- resolve: {
99
- modules: [
100
- path.resolve(currentPath, "node_modules"),
101
- path.resolve(__dirname, "node_modules"),
102
- path.resolve(currentPath, `themes/${config.theme}/node_modules`)
103
- ],
104
- extensions: [
105
- ".scss",
106
- ".js",
107
- ".jsx",
108
- ".json",
109
- ".png",
110
- ".gif",
111
- ".jpg",
112
- ".svg"
113
- ]
114
- },
115
- resolveLoader: {
116
- modules: [
117
- path.resolve(currentPath, "node_modules"),
118
- path.resolve(__dirname, "node_modules"),
119
- path.resolve(currentPath, `themes/${config.theme}/node_modules`)
120
- ]
121
- }
122
- }
123
- }
@@ -1,113 +0,0 @@
1
- const path = require("path")
2
- const MiniCssExtractPlugin = require("mini-css-extract-plugin")
3
-
4
- module.exports = (currentPath, config) => {
5
- const assetPath = path.resolve(
6
- currentPath,
7
- `themes/${config.theme}/assets/js/components`
8
- )
9
-
10
- return {
11
- entry: [
12
- path.resolve(
13
- currentPath,
14
- `themes/${config.theme}/customComponents/index.js`
15
- )
16
- ],
17
- mode: "production",
18
- output: {
19
- library: "__ADComponents",
20
- libraryTarget: "var",
21
- filename: "sfb-components.js",
22
- path: assetPath
23
- },
24
- plugins: [
25
- new MiniCssExtractPlugin({
26
- filename: "sfb-components.css"
27
- })
28
- ],
29
- module: {
30
- rules: [
31
- {
32
- test: /\.(js|jsx)$/,
33
- use: {
34
- loader: "babel-loader",
35
- options: {
36
- presets: [
37
- require.resolve("@babel/preset-env"),
38
- require.resolve("@babel/preset-react")
39
- ],
40
- plugins: [
41
- require.resolve("@babel/plugin-proposal-class-properties"),
42
- require.resolve("@babel/plugin-transform-runtime")
43
- ],
44
- include: [
45
- path.resolve(
46
- currentPath,
47
- `themes/${config.theme}/customComponents`
48
- ),
49
- path.resolve(
50
- currentPath,
51
- `themes/${config.theme}/node_modules/@appdirect/sfb-theme-components`
52
- )
53
- ]
54
- }
55
- }
56
- },
57
- {
58
- test: /\.(sa|sc|c)ss$/,
59
- use: [
60
- MiniCssExtractPlugin.loader,
61
- { loader: "css-loader" },
62
- { loader: "sass-loader" }
63
- ]
64
- },
65
- {
66
- test: /\.(png|gif|jpg|svg)$/,
67
- use: {
68
- loader: "url-loader",
69
- options: {
70
- limit: 50000
71
- }
72
- }
73
- },
74
- {
75
- test: /\.(woff(2)?|ttf|eot)(\?v=\d+\.\d+\.\d+)?$/,
76
- use: [
77
- {
78
- loader: "file-loader",
79
- options: {
80
- name: "[name].[ext]",
81
- outputPath: "fonts/"
82
- }
83
- }
84
- ]
85
- }
86
- ]
87
- },
88
- resolve: {
89
- modules: [
90
- path.resolve(currentPath, "node_modules"),
91
- path.resolve(__dirname, "node_modules"),
92
- path.resolve(currentPath, `themes/${config.theme}/node_modules`)
93
- ],
94
- extensions: [
95
- ".scss",
96
- ".js",
97
- ".jsx",
98
- ".json",
99
- ".png",
100
- ".gif",
101
- ".jpg",
102
- ".svg"
103
- ]
104
- },
105
- resolveLoader: {
106
- modules: [
107
- path.resolve(currentPath, "node_modules"),
108
- path.resolve(__dirname, "node_modules"),
109
- path.resolve(currentPath, `themes/${config.theme}/node_modules`)
110
- ]
111
- }
112
- }
113
- }