@appdirect/sfb-toolkit 2.0.12 → 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 (55) hide show
  1. package/Dockerfile +26 -0
  2. package/bin/index.js +191 -189
  3. package/commands.sh +2 -0
  4. package/coverage/clover.xml +567 -0
  5. package/coverage/coverage-final.json +19 -0
  6. package/coverage/lcov-report/base.css +224 -0
  7. package/coverage/lcov-report/block-navigation.js +79 -0
  8. package/coverage/lcov-report/constants/index.html +126 -0
  9. package/coverage/lcov-report/constants/pageUrls.js.html +98 -0
  10. package/coverage/lcov-report/constants/userMock.js.html +158 -0
  11. package/coverage/lcov-report/controllers/controllers-utils/assetsUtils.js.html +173 -0
  12. package/coverage/lcov-report/controllers/controllers-utils/index.html +111 -0
  13. package/coverage/lcov-report/controllers/data-filters/bootstrap-data-filter.js.html +146 -0
  14. package/coverage/lcov-report/controllers/data-filters/call-to-actions-filter.js.html +347 -0
  15. package/coverage/lcov-report/controllers/data-filters/index.html +126 -0
  16. package/coverage/lcov-report/controllers/index.html +111 -0
  17. package/coverage/lcov-report/controllers/index.js.html +1331 -0
  18. package/coverage/lcov-report/favicon.png +0 -0
  19. package/coverage/lcov-report/front-end-utils/src/components/base/ResultItem.js.html +518 -0
  20. package/coverage/lcov-report/front-end-utils/src/components/base/SearchBar.js.html +452 -0
  21. package/coverage/lcov-report/front-end-utils/src/components/base/index.html +141 -0
  22. package/coverage/lcov-report/front-end-utils/src/components/base/item.js.html +458 -0
  23. package/coverage/lcov-report/front-end-utils/src/components/container.js.html +548 -0
  24. package/coverage/lcov-report/front-end-utils/src/components/data-view.js.html +383 -0
  25. package/coverage/lcov-report/front-end-utils/src/components/header-view.js.html +803 -0
  26. package/coverage/lcov-report/front-end-utils/src/components/index.html +156 -0
  27. package/coverage/lcov-report/front-end-utils/src/components/search.js.html +977 -0
  28. package/coverage/lcov-report/front-end-utils/src/constants/index.html +141 -0
  29. package/coverage/lcov-report/front-end-utils/src/constants/pageUrl.js.html +86 -0
  30. package/coverage/lcov-report/front-end-utils/src/constants/roleType.js.html +92 -0
  31. package/coverage/lcov-report/front-end-utils/src/constants/searchType.js.html +164 -0
  32. package/coverage/lcov-report/front-end-utils/src/utils/debounce.js.html +116 -0
  33. package/coverage/lcov-report/front-end-utils/src/utils/index.html +111 -0
  34. package/coverage/lcov-report/index.html +231 -0
  35. package/coverage/lcov-report/middlewares/config.js.html +182 -0
  36. package/coverage/lcov-report/middlewares/index.html +111 -0
  37. package/coverage/lcov-report/prettify.css +1 -0
  38. package/coverage/lcov-report/prettify.js +2 -0
  39. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  40. package/coverage/lcov-report/sorter.js +170 -0
  41. package/coverage/lcov.info +1132 -0
  42. package/npm-shrinkwrap.json +29 -30
  43. package/package.json +10 -4
  44. package/readme.md +17 -0
  45. package/src/constants/userMock.js +27 -0
  46. package/src/controllers/index.js +9 -1
  47. package/src/tools/prompt-questions.js +7 -1
  48. package/src/tools/toolkit-common-fun.js +26 -2
  49. package/src/tools/toolkit-common-vars.js +11 -4
  50. package/src/tools/toolkit-components.js +1 -1
  51. package/src/tools/toolkit-create.js +17 -1
  52. package/src/tools/toolkit-dev-e2e.js +85 -0
  53. package/src/tools/toolkit-install.js +1 -1
  54. package/src/tools/toolkit-setup-e2e.js +109 -0
  55. package/src/tools/toolkit-storybook.js +5 -3
package/Dockerfile ADDED
@@ -0,0 +1,26 @@
1
+ FROM node:12-alpine
2
+
3
+ ENV NO_UPDATE_NOTIFIER=true
4
+ ENV SFB_TOOLKIT=/app/bin/index.js
5
+ ENV HOME=/home/node
6
+
7
+ WORKDIR /app
8
+ RUN adduser node root && \
9
+ chown node:root /app $HOME && \
10
+ chmod g=u /app $HOME
11
+ USER node:root
12
+
13
+ COPY --chown=node:root . ./
14
+ RUN npm ci && \
15
+ npm cache clean --force
16
+
17
+ RUN chmod a+x /app/commands.sh
18
+
19
+ RUN $SFB_TOOLKIT setup-e2e-theme Plaza
20
+
21
+ WORKDIR /app/Plaza
22
+
23
+ RUN $SFB_TOOLKIT use-local-sfb-components
24
+
25
+ EXPOSE 3555
26
+ ENTRYPOINT ["sh", "/app/commands.sh"]
package/bin/index.js CHANGED
@@ -4,209 +4,211 @@ const program = require("commander")
4
4
  const { spawn } = require("child_process")
5
5
  const colors = require("colors")
6
6
 
7
- const PROJECTSETUP_PATH = "src/tools/toolkit-setup.js"
8
- const PROJECTCONFIGSETUP_PATH = "src/tools/toolkit-config-setup.js"
7
+ const PROJECT_SETUP_PATH = "src/tools/toolkit-setup.js"
8
+ const PROJECT_SETUP_E2E_PATH = "src/tools/toolkit-setup-e2e.js"
9
+ const PROJECT_CONFIG_SETUP_PATH = "src/tools/toolkit-config-setup.js"
9
10
  const STATUS_PATH = "src/tools/toolkit-status.js"
10
11
  const ABOUT_PATH = "src/tools/toolkit-about.js"
11
- const NEWTHEME_PATH = "src/tools/toolkit-create.js"
12
+ const NEW_THEME_PATH = "src/tools/toolkit-create.js"
12
13
  const CHECKOUT_PATH = "src/tools/toolkit-checkout.js"
13
14
  const UPDATE_PATH = "src/tools/toolkit-update.js"
14
- const SERVERSTART_PATH = "src/tools/toolkit-start.js"
15
- const PACAKGE_PATH = "src/tools/toolkit-package.js"
15
+ const SERVER_START_PATH = "src/tools/toolkit-start.js"
16
+ const PACKAGE_PATH = "src/tools/toolkit-package.js"
16
17
  const TESTS_PATH = "src/tools/toolkit-tests.js"
17
18
  const VERSION_PATH = "src/tools/toolkit-version.js"
18
19
  const STORYBOOK = "src/tools/toolkit-storybook.js"
19
20
  const INSTALL = "src/tools/toolkit-install.js"
20
21
  const COMPONENTS = "src/tools/toolkit-components.js"
22
+ const DEV_E2E = "src/tools/toolkit-dev-e2e.js"
21
23
 
22
24
  program
23
- .command("setup [name]")
24
- .description("Creates a new project")
25
- .action((name) => {
26
- spawn(
27
- `node "${__dirname}/../${PROJECTSETUP_PATH}" ${name}`, {
28
- stdio: "inherit",
29
- shell: true
30
- }
31
- );
32
- });
33
-
34
- program
35
- .command("config-setup [projname] [themename]")
36
- .description("Creates the config files for a new project")
37
- .action((projname, themename) => {
38
- spawn(
39
- `node "${__dirname}/../${PROJECTCONFIGSETUP_PATH}" ${projname} ${themename}`, {
40
- stdio: "inherit",
41
- shell: true
42
- }
43
- );
44
- });
45
-
46
- program
47
- .command("start")
48
- .description("Starts the Theme Web Server")
49
- .option('-c, --withLocalComponents', 'Use components from node-modules', true, 0)
50
- .on('option:withLocalComponents', function () {
51
- process.env.withLocalComponents = 'true';
52
- })
53
- .option('-v, --verbose', 'Enable all logs in console', true, 0)
54
- .on('option:verbose', function () {
55
- process.env.verboseToolkitOutput = 'true';
56
- })
57
- .action(() => {
58
- spawn(
59
- `node "${__dirname}/../${SERVERSTART_PATH}"`, {
60
- stdio: "inherit",
61
- shell: true
62
- }
63
- );
64
- });
65
-
66
- program
67
- .command("about")
68
- .description("Lists existing themes")
69
- .action((name) => {
70
- spawn(
71
- `node "${__dirname}/../${ABOUT_PATH}" ${name}`, {
72
- stdio: "inherit",
73
- shell: true
74
- }
75
- );
76
- });
77
-
78
- program
79
- .command("status")
80
- .description("Gives information about the current config")
81
- .action(() => {
82
- spawn(
83
- `node "${__dirname}/../${STATUS_PATH}"`, {
84
- stdio: "inherit",
85
- shell: true
86
- }
87
- );
88
- });
89
-
90
- program
91
- .command("create [name]")
92
- .description("Creates a new theme")
93
- .action((name) => {
94
- spawn(
95
- `node "${__dirname}/../${NEWTHEME_PATH}" ${name}`, {
96
- stdio: "inherit",
97
- shell: true
98
- }
99
- );
100
- });
101
-
102
- program
103
- .command("checkout [name]")
104
- .description("Changes context to theme")
105
- .action((name) => {
106
- spawn(
107
- `node "${__dirname}/../${CHECKOUT_PATH}" ${name}`, {
108
- stdio: "inherit",
109
- shell: true
110
- }
111
- );
112
- });
113
-
114
- program
115
- .command("update")
116
- .description("Updates current theme configuration")
117
- .action((name) => {
118
- spawn(
119
- `node "${__dirname}/../${UPDATE_PATH}" ${name}`, {
120
- stdio: "inherit",
121
- shell: true
122
- }
123
- );
124
- });
125
-
126
- program
127
- .command("package")
128
- .description("Creates a .zip file with the current theme files")
129
- .option('-a, --all', 'Pack everything', true, 0)
130
- .on('option:all', function () {
131
- process.env.PACK_ALL = 'true';
132
- })
133
- .action(() => {
134
- spawn(
135
- `node "${__dirname}/../${PACAKGE_PATH}"`, {
136
- stdio: "inherit",
137
- shell: true
138
- }
139
- );
140
- });
141
-
142
- program
143
- .command("test")
144
- .description("Execute tests for current theme")
145
- .option('-h, --headless', 'test in headless mode', true, 0)
146
- .on('option:headless', function () {
147
- process.env.HEADLESS = 'true';
148
- })
149
- .action((name) => {
150
- spawn(
151
- `node "${__dirname}/../${TESTS_PATH}"`, {
152
- stdio: "inherit",
153
- shell: true
154
- }
155
- );
156
- });
157
-
158
- program
159
- .command("storybook")
160
- .description("Start storybook for the currently selected theme.")
161
- .action(() => {
162
- spawn(
163
- `node "${__dirname}/../${STORYBOOK}"`, {
164
- stdio: "inherit",
165
- shell: true
166
- }
167
- );
168
- });
169
-
170
- program
171
- .command("install [module]")
172
- .description("Installs npm module in the currently selected theme.")
173
- .action((module) => {
174
- spawn(
175
- `node "${__dirname}/../${INSTALL}" ${module}`, {
176
- stdio: "inherit",
177
- shell: true
178
- }
179
- );
180
- });
181
-
182
- program
183
- .command('components')
184
- .description('Setup custom components')
185
- .action(() => {
186
- spawn(
187
- `node "${__dirname}/../${COMPONENTS}"`, {
188
- stdio: "inherit",
189
- shell: true
190
- }
191
- );
192
- });
193
-
194
- program
195
- .command("version")
196
- .alias("v")
197
- .description("Shows version of sfb-toolkit\n")
198
- .action(() => {
199
- spawn(
200
- `node "${__dirname}/../${VERSION_PATH}"`, {
201
- stdio: "inherit",
202
- shell: true
203
- }
204
- );
205
- });
25
+ .command("setup [name]")
26
+ .description("Creates a new project")
27
+ .action(name => {
28
+ spawn(`node "${__dirname}/../${PROJECT_SETUP_PATH}" ${name}`, {
29
+ stdio: "inherit",
30
+ shell: true
31
+ })
32
+ })
33
+
34
+ program
35
+ .command("setup-e2e-theme")
36
+ .description("Creates a new project for e2e tests")
37
+ .action(name => {
38
+ spawn(`node "${__dirname}/../${PROJECT_SETUP_E2E_PATH}" ${name}`, {
39
+ stdio: "inherit",
40
+ shell: true
41
+ })
42
+ })
43
+
44
+ program
45
+ .command("config-setup [projname] [themename]")
46
+ .description("Creates the config files for a new project")
47
+ .action((projname, themename) => {
48
+ spawn(
49
+ `node "${__dirname}/../${PROJECT_CONFIG_SETUP_PATH}" ${projname} ${themename}`,
50
+ {
51
+ stdio: "inherit",
52
+ shell: true
53
+ }
54
+ )
55
+ })
56
+
57
+ program
58
+ .command("start")
59
+ .description("Starts the Theme Web Server")
60
+ .option(
61
+ "-c, --withLocalComponents",
62
+ "Use components from node-modules",
63
+ true,
64
+ 0
65
+ )
66
+ .on("option:withLocalComponents", () => {
67
+ process.env.withLocalComponents = "true"
68
+ })
69
+ .option("-v, --verbose", "Enable all logs in console", true, 0)
70
+ .on("option:verbose", () => {
71
+ process.env.verboseToolkitOutput = "true"
72
+ })
73
+ .action(() => {
74
+ spawn(`node "${__dirname}/../${SERVER_START_PATH}"`, {
75
+ stdio: "inherit",
76
+ shell: true
77
+ })
78
+ })
79
+
80
+ program
81
+ .command("about")
82
+ .description("Lists existing themes")
83
+ .action(name => {
84
+ spawn(`node "${__dirname}/../${ABOUT_PATH}" ${name}`, {
85
+ stdio: "inherit",
86
+ shell: true
87
+ })
88
+ })
89
+
90
+ program
91
+ .command("status")
92
+ .description("Gives information about the current config")
93
+ .action(() => {
94
+ spawn(`node "${__dirname}/../${STATUS_PATH}"`, {
95
+ stdio: "inherit",
96
+ shell: true
97
+ })
98
+ })
99
+
100
+ program
101
+ .command("create [name]")
102
+ .description("Creates a new theme")
103
+ .action(name => {
104
+ spawn(`node "${__dirname}/../${NEW_THEME_PATH}" ${name}`, {
105
+ stdio: "inherit",
106
+ shell: true
107
+ })
108
+ })
109
+
110
+ program
111
+ .command("checkout [name]")
112
+ .description("Changes context to theme")
113
+ .action(name => {
114
+ spawn(`node "${__dirname}/../${CHECKOUT_PATH}" ${name}`, {
115
+ stdio: "inherit",
116
+ shell: true
117
+ })
118
+ })
119
+
120
+ program
121
+ .command("update")
122
+ .description("Updates current theme configuration")
123
+ .action(name => {
124
+ spawn(`node "${__dirname}/../${UPDATE_PATH}" ${name}`, {
125
+ stdio: "inherit",
126
+ shell: true
127
+ })
128
+ })
129
+
130
+ program
131
+ .command("package")
132
+ .description("Creates a .zip file with the current theme files")
133
+ .option("-a, --all", "Pack everything", true, 0)
134
+ .on("option:all", () => {
135
+ process.env.PACK_ALL = "true"
136
+ })
137
+ .action(() => {
138
+ spawn(`node "${__dirname}/../${PACKAGE_PATH}"`, {
139
+ stdio: "inherit",
140
+ shell: true
141
+ })
142
+ })
143
+
144
+ program
145
+ .command("test")
146
+ .description("Execute tests for current theme")
147
+ .option("-h, --headless", "test in headless mode", true, 0)
148
+ .on("option:headless", () => {
149
+ process.env.HEADLESS = "true"
150
+ })
151
+ .action(name => {
152
+ spawn(`node "${__dirname}/../${TESTS_PATH}"`, {
153
+ stdio: "inherit",
154
+ shell: true
155
+ })
156
+ })
157
+
158
+ program
159
+ .command("storybook")
160
+ .description("Start storybook for the currently selected theme.")
161
+ .action(() => {
162
+ spawn(`node "${__dirname}/../${STORYBOOK}"`, {
163
+ stdio: "inherit",
164
+ shell: true
165
+ })
166
+ })
167
+
168
+ program
169
+ .command("install [module]")
170
+ .description("Installs npm module in the currently selected theme.")
171
+ .action(module => {
172
+ spawn(`node "${__dirname}/../${INSTALL}" ${module}`, {
173
+ stdio: "inherit",
174
+ shell: true
175
+ })
176
+ })
177
+
178
+ program
179
+ .command("components")
180
+ .description("Setup custom components")
181
+ .action(() => {
182
+ spawn(`node "${__dirname}/../${COMPONENTS}"`, {
183
+ stdio: "inherit",
184
+ shell: true
185
+ })
186
+ })
187
+
188
+ program
189
+ .command("use-local-sfb-components")
190
+ .description("Setup theme to use local sfb-components bundles for e2e")
191
+ .action(() => {
192
+ spawn(`node "${__dirname}/../${DEV_E2E}"`, {
193
+ stdio: "inherit",
194
+ shell: true
195
+ })
196
+ })
197
+
198
+ program
199
+ .command("version")
200
+ .alias("v")
201
+ .description("Shows version of sfb-toolkit\n")
202
+ .action(() => {
203
+ spawn(`node "${__dirname}/../${VERSION_PATH}"`, {
204
+ stdio: "inherit",
205
+ shell: true
206
+ })
207
+ })
206
208
 
207
209
  program.parse(process.argv)
208
210
 
209
211
  // check if there were no args specified
210
212
  if (program.args.length === 0) {
211
- program.help();
213
+ program.help()
212
214
  }
package/commands.sh ADDED
@@ -0,0 +1,2 @@
1
+ #!/bin/bash
2
+ /app/bin/index.js start