@appdirect/sfb-toolkit 4.0.7 → 4.0.9

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 (47) hide show
  1. package/Dockerfile +1 -1
  2. package/bin/index.js +25 -1
  3. package/config/index.js +2 -3
  4. package/coverage/clover.xml +166 -161
  5. package/coverage/coverage-final.json +7 -7
  6. package/coverage/lcov-report/constants/customUserAttributesMock.js.html +1 -1
  7. package/coverage/lcov-report/constants/index.html +1 -1
  8. package/coverage/lcov-report/constants/pageUrls.js.html +1 -1
  9. package/coverage/lcov-report/constants/userMock.js.html +1 -1
  10. package/coverage/lcov-report/controllers/controllers-utils/assetsUtils.js.html +1 -1
  11. package/coverage/lcov-report/controllers/controllers-utils/index.html +1 -1
  12. package/coverage/lcov-report/controllers/data-filters/bootstrap-data-filter.js.html +4 -4
  13. package/coverage/lcov-report/controllers/data-filters/call-to-actions-filter.js.html +4 -4
  14. package/coverage/lcov-report/controllers/data-filters/index.html +1 -1
  15. package/coverage/lcov-report/controllers/index.html +21 -21
  16. package/coverage/lcov-report/controllers/index.js.html +164 -128
  17. package/coverage/lcov-report/front-end-utils/src/components/base/ResultItem.js.html +7 -7
  18. package/coverage/lcov-report/front-end-utils/src/components/base/SearchBar.js.html +3 -3
  19. package/coverage/lcov-report/front-end-utils/src/components/base/index.html +1 -1
  20. package/coverage/lcov-report/front-end-utils/src/components/base/item.js.html +11 -11
  21. package/coverage/lcov-report/front-end-utils/src/components/container.js.html +1 -1
  22. package/coverage/lcov-report/front-end-utils/src/components/data-view.js.html +1 -1
  23. package/coverage/lcov-report/front-end-utils/src/components/header-view.js.html +1 -1
  24. package/coverage/lcov-report/front-end-utils/src/components/index.html +1 -1
  25. package/coverage/lcov-report/front-end-utils/src/components/search.js.html +13 -13
  26. package/coverage/lcov-report/front-end-utils/src/constants/index.html +1 -1
  27. package/coverage/lcov-report/front-end-utils/src/constants/pageUrl.js.html +1 -1
  28. package/coverage/lcov-report/front-end-utils/src/constants/roleType.js.html +1 -1
  29. package/coverage/lcov-report/front-end-utils/src/constants/searchType.js.html +1 -1
  30. package/coverage/lcov-report/front-end-utils/src/utils/debounce.js.html +1 -1
  31. package/coverage/lcov-report/front-end-utils/src/utils/index.html +1 -1
  32. package/coverage/lcov-report/index.html +20 -20
  33. package/coverage/lcov-report/middlewares/config.js.html +1 -1
  34. package/coverage/lcov-report/middlewares/index.html +1 -1
  35. package/coverage/lcov.info +341 -330
  36. package/index.js +11 -10
  37. package/npm-shrinkwrap.json +629 -277
  38. package/package.json +7 -7
  39. package/readme.md +14 -0
  40. package/src/api/cors.js +29 -20
  41. package/src/controllers/index.js +58 -46
  42. package/src/tools/prompt-questions.js +120 -68
  43. package/src/tools/proxy-fetch.js +16 -0
  44. package/src/tools/toolkit-common-vars.js +1 -1
  45. package/src/tools/toolkit-components.js +12 -4
  46. package/src/tools/toolkit-install.js +15 -7
  47. package/src/tools/toolkit-start.js +1 -1
package/index.js CHANGED
@@ -14,11 +14,12 @@ const getConfigComponentsWebpack = require("./webpack-components.config.cjs")
14
14
 
15
15
  const {
16
16
  toolkitAssetsPath,
17
- themeAssetsPath
17
+ themeAssetsPath,
18
18
  } = require("./src/constants/pageUrls")
19
19
 
20
20
  const currentPath = process.cwd() // used to get current dev folder
21
21
  const config = require(`${currentPath}/config`)
22
+ const port = config.port || 3555
22
23
 
23
24
  const app = express()
24
25
  if (process.env.RUN_ENV === "dev") {
@@ -26,7 +27,7 @@ if (process.env.RUN_ENV === "dev") {
26
27
  app.use(
27
28
  webpackDevMiddleware(compiler, {
28
29
  publicPath: configWebpack.output.publicPath,
29
- stats: { colors: true }
30
+ stats: { colors: true },
30
31
  })
31
32
  )
32
33
  }
@@ -38,7 +39,7 @@ if (fs.existsSync(`${currentPath}/themes/${config.theme}/customComponents`)) {
38
39
  // (in dev mode), and app modules are imported in some unfortunate ways.
39
40
  if (!global.location) {
40
41
  global.location = {
41
- href: `${pathToFileURL(process.cwd()).href}${sep}`
42
+ href: `${pathToFileURL(process.cwd()).href}${sep}`,
42
43
  }
43
44
  }
44
45
  const configComponentsWebpackAsset = getConfigComponentsWebpack(
@@ -51,21 +52,21 @@ if (fs.existsSync(`${currentPath}/themes/${config.theme}/customComponents`)) {
51
52
  webpackDevMiddleware(compilerComponentsAsset, {
52
53
  publicPath: configComponentsWebpackAsset.output.publicPath,
53
54
  writeToDisk: true,
54
- stats: { colors: true }
55
+ stats: { colors: true },
55
56
  })
56
57
  )
57
58
  app.use(
58
59
  webpackHotMiddleware(compilerComponentsAsset, {
59
60
  log: console.log,
60
61
  path: "/__webpack_hmr",
61
- heartbeat: 10 * 1000
62
+ heartbeat: 10 * 1000,
62
63
  })
63
64
  )
64
65
  }
65
66
 
66
67
  app.use(
67
68
  bodyParser.urlencoded({
68
- extended: true
69
+ extended: true,
69
70
  })
70
71
  )
71
72
 
@@ -84,16 +85,16 @@ app.use(bodyParser.json())
84
85
  // Connect all our routes to our application
85
86
  app.use(configMiddleware)
86
87
  app.use("/", routes)
87
- const server = app.listen(3555, () =>
88
+ const server = app.listen(port, () =>
88
89
  console.log(
89
- "AppDirect Toolkit is running, you can view your storefront preview at: http://localhost:3555/en-US/home"
90
+ `AppDirect Toolkit is running, you can view your storefront preview at: http://localhost:${port}/en-US/home`
90
91
  )
91
92
  )
92
- server.on("error", err => {
93
+ server.on("error", (err) => {
93
94
  switch (err.errno) {
94
95
  case "EADDRINUSE":
95
96
  return console.log(
96
- `Error (${err.errno}):\n Port 3555 is already in use.\n The previous server instance might not have been terminated correctly.\n Make sure the previous sfb-toolkit instance is properly terminated and enter \`rs\` to restart the current instance.`
97
+ `Error (${err.errno}):\n Port ${port} is already in use.\n The previous server instance might not have been terminated correctly.\n Make sure the previous sfb-toolkit instance is properly terminated and enter \`rs\` to restart the current instance.`
97
98
  .red
98
99
  )
99
100
  default: