spyne-cli 0.6.8 → 0.7.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 (93) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +80 -30
  3. package/index.js +123 -21
  4. package/package.json +24 -6
  5. package/src/cli/args.js +197 -0
  6. package/src/cli/render.js +184 -0
  7. package/src/core/create-app.js +232 -0
  8. package/src/core/generate-module.js +146 -0
  9. package/src/registry.js +174 -0
  10. package/src/spyne-file-prompt.js +77 -30
  11. package/src/templates/generate-prompt-input-fields.js +1 -1
  12. package/src/ui.js +5 -1
  13. package/lib/ansi.js +0 -116
  14. package/lib/combos.js +0 -75
  15. package/lib/completer.js +0 -52
  16. package/lib/interpolate.js +0 -266
  17. package/lib/keypress.js +0 -243
  18. package/lib/placeholder.js +0 -63
  19. package/lib/prompt.js +0 -485
  20. package/lib/prompts/autocomplete.js +0 -113
  21. package/lib/prompts/basicauth.js +0 -41
  22. package/lib/prompts/confirm.js +0 -13
  23. package/lib/prompts/editable.js +0 -136
  24. package/lib/prompts/form.js +0 -196
  25. package/lib/prompts/index.js +0 -28
  26. package/lib/prompts/input.js +0 -55
  27. package/lib/prompts/invisible.js +0 -11
  28. package/lib/prompts/list.js +0 -36
  29. package/lib/prompts/multiselect.js +0 -11
  30. package/lib/prompts/numeral.js +0 -1
  31. package/lib/prompts/password.js +0 -18
  32. package/lib/prompts/quiz.js +0 -37
  33. package/lib/prompts/scale.js +0 -237
  34. package/lib/prompts/select.js +0 -139
  35. package/lib/prompts/snippet.js +0 -185
  36. package/lib/prompts/sort.js +0 -37
  37. package/lib/prompts/survey.js +0 -163
  38. package/lib/prompts/text.js +0 -1
  39. package/lib/prompts/toggle.js +0 -109
  40. package/lib/render.js +0 -33
  41. package/lib/roles.js +0 -46
  42. package/lib/state.js +0 -69
  43. package/lib/styles.js +0 -144
  44. package/lib/symbols.js +0 -66
  45. package/lib/theme.js +0 -11
  46. package/lib/timer.js +0 -38
  47. package/lib/types/array.js +0 -658
  48. package/lib/types/auth.js +0 -29
  49. package/lib/types/boolean.js +0 -88
  50. package/lib/types/index.js +0 -7
  51. package/lib/types/number.js +0 -86
  52. package/lib/types/string.js +0 -185
  53. package/lib/utils.js +0 -268
  54. package/mocha.conf.cjs +0 -16
  55. package/src/app/channels/.gitkeep +0 -0
  56. package/src/app/channels/channel-custom.js +0 -1
  57. package/src/app/components/.gitkeep +0 -0
  58. package/src/app/traits/.gitkeep +0 -0
  59. package/src/hello-world-app-source/README.md +0 -15
  60. package/src/hello-world-app-source/apache-htaccess +0 -20
  61. package/src/hello-world-app-source/karma.conf.js +0 -75
  62. package/src/hello-world-app-source/package.json +0 -50
  63. package/src/hello-world-app-source/src/app/app-view.js +0 -38
  64. package/src/hello-world-app-source/src/app/channels/.gitkeep +0 -0
  65. package/src/hello-world-app-source/src/app/components/.gitkeep +0 -0
  66. package/src/hello-world-app-source/src/app/traits/.gitkeep +0 -0
  67. package/src/hello-world-app-source/src/index.js +0 -16
  68. package/src/hello-world-app-source/src/index.tmpl.html +0 -12
  69. package/src/hello-world-app-source/src/scss/01-vendors/normalize.css +0 -349
  70. package/src/hello-world-app-source/src/scss/02-variables/mixins.scss +0 -0
  71. package/src/hello-world-app-source/src/scss/03-components/.gitkeep +0 -0
  72. package/src/hello-world-app-source/src/scss/main.scss +0 -15
  73. package/src/hello-world-app-source/src/static/data/.gitkeep +0 -0
  74. package/src/hello-world-app-source/src/static/fonts/.gitkeep +0 -0
  75. package/src/hello-world-app-source/src/static/imgs/.gitkeep +0 -0
  76. package/src/hello-world-app-source/src/tests/unit-tests/index.test.js +0 -10
  77. package/src/hello-world-app-source/webpack.config.js +0 -178
  78. package/src/spyne-app-create.js +0 -209
  79. package/src/spyne-app-creator.js +0 -119
  80. package/src/spyne-starter-app-create.js +0 -147
  81. package/tests/create-spyne-app.test.js +0 -63
  82. package/tests/generate-file-prompt.test.js +0 -45
  83. package/tests/generate-file-string.test.js +0 -66
  84. package/tests/generate-prompt-input-fields-methods.test.js +0 -177
  85. package/tests/generate-prompt-input-fields.test.js +0 -179
  86. package/tests/generate-prompt-input-object.test.js +0 -39
  87. package/tests/generate-prompt-output.test.js +0 -58
  88. package/tests/index.test.js +0 -11
  89. package/tests/mocks/answers.js +0 -33
  90. package/tests/mocks/answers.json +0 -33
  91. package/tests/mocks/enquirer-data.js +0 -411
  92. package/tests/mocks/enquirer-data.json +0 -409
  93. package/tests/utils/file-utils.test.js +0 -84
@@ -1,75 +0,0 @@
1
- const webpackConfigFn = require('./webpack.config');
2
- const webpackConfig = webpackConfigFn();
3
-
4
- webpackConfig.entry = undefined;
5
- webpackConfig.output = undefined;
6
- webpackConfig.stats = "normal";
7
- webpackConfig.watch = true;
8
-
9
-
10
- module.exports = function(config) {
11
- config.set({
12
-
13
- // base path that will be used to resolve all patterns (eg. files, exclude)
14
- basePath: '',
15
-
16
- // frameworks to use
17
- // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
18
- frameworks: ['webpack', 'mocha', 'chai'],
19
-
20
- // list of files / patterns to load in the browser
21
- files: [
22
-
23
- { pattern: './node_modules/ramda/dist/ramda.min.js', watched: false},
24
- { pattern: './node_modules/rxjs/**/*.js', included:false, watched: false},
25
- { pattern: './src/tests/unit-tests/**/*.test.js', watched: true}
26
-
27
- ],
28
-
29
- // list of files / patterns to exclude
30
- exclude: [],
31
-
32
- // preprocess matching files before serving them to the browser
33
- // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
34
- preprocessors: {
35
- './src/tests/unit-tests/**/*.test.js': ['webpack']
36
- },
37
-
38
- webpack: webpackConfig,
39
- webpackMiddleware: {noInfo:true},
40
-
41
- // test results reporter to use
42
- // possible values: 'dots', 'progress'
43
- // available reporters: https://npmjs.org/browse/keyword/karma-reporter
44
- reporters: ['progress'],
45
-
46
- // web server port
47
- port: 9876,
48
-
49
- // enable / disable colors in the output (reporters and logs)
50
- colors: true,
51
-
52
-
53
- // level of logging
54
- // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
55
- logLevel: config.LOG_INFO,
56
-
57
-
58
- // enable / disable watching file and executing tests whenever any file changes
59
- autoWatch: true,
60
-
61
-
62
- // start these browsers
63
- // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
64
- browsers: ['Chrome'],
65
-
66
-
67
- // Continuous Integration mode
68
- // if true, Karma captures browsers, runs the tests and exits
69
- singleRun: true,
70
-
71
- // Concurrency level
72
- // how many browser should be started simultaneous
73
- concurrency: Infinity
74
- })
75
- }
@@ -1,50 +0,0 @@
1
- {
2
- "name": "spyne-hello-world-app",
3
- "version": "0.0.5",
4
- "description": "Bare bones spyne application.",
5
- "main": "src/index.js",
6
- "scripts": {
7
- "init": "npm install && npm i -D mocha-loader --force",
8
- "start": "webpack serve --open",
9
- "build": "webpack --mode production --env build",
10
- "build:apache": "buildType=apache webpack --mode production --env build",
11
- "test": "karma start"
12
- },
13
- "dependencies": {
14
- "spyne": "^0.18.3",
15
- "spyne-plugin-console": "^0.3.3"
16
- },
17
- "devDependencies": {
18
- "chai": "^4.3.4",
19
- "clean-webpack-plugin": "^4.0.0",
20
- "copy-webpack-plugin": "^10.2.0",
21
- "css-loader": "^6.5.1",
22
- "eslint": "^8.6.0",
23
- "file-loader": "^6.2.0",
24
- "html-loader": "^3.1.0",
25
- "html-webpack-plugin": "^5.5.0",
26
- "karma": "^6.3.10",
27
- "karma-chai": "^0.1.0",
28
- "karma-chrome-launcher": "^3.1.0",
29
- "karma-coverage": "^2.1.0",
30
- "karma-mocha": "^2.0.1",
31
- "karma-webpack": "^5.0.0",
32
- "mini-css-extract-plugin": "^2.4.6",
33
- "mocha-loader": "^5.1.5",
34
- "requirejs": "^2.3.6",
35
- "resolve-url-loader": "^4.0.0",
36
- "sass": "^1.47.0",
37
- "sass-loader": "^12.4.0",
38
- "style-loader": "^3.3.1",
39
- "webpack": "^5.65.0",
40
- "webpack-cli": "^4.9.1",
41
- "webpack-dev-server": "^4.7.2"
42
- },
43
- "repository": {
44
- "type": "git",
45
- "url": ""
46
- },
47
- "author": "",
48
- "license": "MIT",
49
- "homepage": ""
50
- }
@@ -1,38 +0,0 @@
1
- import {ViewStream} from 'spyne';
2
-
3
- export class AppView extends ViewStream {
4
-
5
- constructor(props = {}) {
6
- props.tagName='main';
7
- props.id='app-main';
8
- props.class='main';
9
- super(props);
10
- }
11
-
12
- addActionListeners() {
13
- // return nexted array(s)
14
- return [];
15
- }
16
-
17
-
18
- broadcastEvents() {
19
- // return nexted array(s)
20
- return [];
21
- }
22
-
23
- addHelloWorld(e){
24
- const helloWorldView = new ViewStream({
25
- tagName: 'h2',
26
- "style": "color:#1F2933; padding: 2rem; font-family:sans-serif;",
27
- data: "Hello World"
28
- });
29
-
30
- this.appendView(helloWorldView);
31
- }
32
-
33
-
34
- onRendered() {
35
- this.addHelloWorld();
36
- }
37
-
38
- }
@@ -1,16 +0,0 @@
1
- import'./scss/main.scss';
2
- import {SpyneApp} from 'spyne';
3
- import {AppView} from './app/app-view';
4
-
5
- const config = {
6
- debug:true
7
- };
8
-
9
- SpyneApp.init(config);
10
-
11
- if (process.env.NODE_ENV === 'development') {
12
- const {SpynePluginConsole} = require('spyne-plugin-console');
13
- new SpynePluginConsole({position: ['bottom', 'right'], minimize: true});
14
- }
15
-
16
- new AppView().prependToDom(document.body);
@@ -1,12 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <title>Spynejs - Hello World App</title>
5
- <meta charset="utf-8">
6
- <meta name="viewport" content="width=device-width, initial-scale=1">
7
- </head>
8
- <body>
9
-
10
-
11
- </body>
12
- </html>
@@ -1,349 +0,0 @@
1
- /*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
2
-
3
- /* Document
4
- ========================================================================== */
5
-
6
- /**
7
- * 1. Correct the line height in all browsers.
8
- * 2. Prevent adjustments of font size after orientation changes in iOS.
9
- */
10
-
11
- html {
12
- line-height: 1.15; /* 1 */
13
- -webkit-text-size-adjust: 100%; /* 2 */
14
- }
15
-
16
- /* Sections
17
- ========================================================================== */
18
-
19
- /**
20
- * Remove the margin in all browsers.
21
- */
22
-
23
- body {
24
- margin: 0;
25
- }
26
-
27
- /**
28
- * Render the `main` element consistently in IE.
29
- */
30
-
31
- main {
32
- display: block;
33
- }
34
-
35
- /**
36
- * Correct the font size and margin on `h1` elements within `section` and
37
- * `article` contexts in Chrome, Firefox, and Safari.
38
- */
39
-
40
- h1 {
41
- font-size: 2em;
42
- margin: 0.67em 0;
43
- }
44
-
45
- /* Grouping content
46
- ========================================================================== */
47
-
48
- /**
49
- * 1. Add the correct box sizing in Firefox.
50
- * 2. Show the overflow in Edge and IE.
51
- */
52
-
53
- hr {
54
- box-sizing: content-box; /* 1 */
55
- height: 0; /* 1 */
56
- overflow: visible; /* 2 */
57
- }
58
-
59
- /**
60
- * 1. Correct the inheritance and scaling of font size in all browsers.
61
- * 2. Correct the odd `em` font sizing in all browsers.
62
- */
63
-
64
- pre {
65
- font-family: monospace, monospace; /* 1 */
66
- font-size: 1em; /* 2 */
67
- }
68
-
69
- /* Text-level semantics
70
- ========================================================================== */
71
-
72
- /**
73
- * Remove the gray background on active links in IE 10.
74
- */
75
-
76
- a {
77
- background-color: transparent;
78
- }
79
-
80
- /**
81
- * 1. Remove the bottom border in Chrome 57-
82
- * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
83
- */
84
-
85
- abbr[title] {
86
- border-bottom: none; /* 1 */
87
- text-decoration: underline; /* 2 */
88
- text-decoration: underline dotted; /* 2 */
89
- }
90
-
91
- /**
92
- * Add the correct font weight in Chrome, Edge, and Safari.
93
- */
94
-
95
- b,
96
- strong {
97
- font-weight: bolder;
98
- }
99
-
100
- /**
101
- * 1. Correct the inheritance and scaling of font size in all browsers.
102
- * 2. Correct the odd `em` font sizing in all browsers.
103
- */
104
-
105
- code,
106
- kbd,
107
- samp {
108
- font-family: monospace, monospace; /* 1 */
109
- font-size: 1em; /* 2 */
110
- }
111
-
112
- /**
113
- * Add the correct font size in all browsers.
114
- */
115
-
116
- small {
117
- font-size: 80%;
118
- }
119
-
120
- /**
121
- * Prevent `sub` and `sup` elements from affecting the line height in
122
- * all browsers.
123
- */
124
-
125
- sub,
126
- sup {
127
- font-size: 75%;
128
- line-height: 0;
129
- position: relative;
130
- vertical-align: baseline;
131
- }
132
-
133
- sub {
134
- bottom: -0.25em;
135
- }
136
-
137
- sup {
138
- top: -0.5em;
139
- }
140
-
141
- /* Embedded content
142
- ========================================================================== */
143
-
144
- /**
145
- * Remove the border on images inside links in IE 10.
146
- */
147
-
148
- img {
149
- border-style: none;
150
- }
151
-
152
- /* Forms
153
- ========================================================================== */
154
-
155
- /**
156
- * 1. Change the font styles in all browsers.
157
- * 2. Remove the margin in Firefox and Safari.
158
- */
159
-
160
- button,
161
- input,
162
- optgroup,
163
- select,
164
- textarea {
165
- font-family: inherit; /* 1 */
166
- font-size: 100%; /* 1 */
167
- line-height: 1.15; /* 1 */
168
- margin: 0; /* 2 */
169
- }
170
-
171
- /**
172
- * Show the overflow in IE.
173
- * 1. Show the overflow in Edge.
174
- */
175
-
176
- button,
177
- input { /* 1 */
178
- overflow: visible;
179
- }
180
-
181
- /**
182
- * Remove the inheritance of text transform in Edge, Firefox, and IE.
183
- * 1. Remove the inheritance of text transform in Firefox.
184
- */
185
-
186
- button,
187
- select { /* 1 */
188
- text-transform: none;
189
- }
190
-
191
- /**
192
- * Correct the inability to style clickable types in iOS and Safari.
193
- */
194
-
195
- button,
196
- [type="button"],
197
- [type="reset"],
198
- [type="submit"] {
199
- -webkit-appearance: button;
200
- }
201
-
202
- /**
203
- * Remove the inner border and padding in Firefox.
204
- */
205
-
206
- button::-moz-focus-inner,
207
- [type="button"]::-moz-focus-inner,
208
- [type="reset"]::-moz-focus-inner,
209
- [type="submit"]::-moz-focus-inner {
210
- border-style: none;
211
- padding: 0;
212
- }
213
-
214
- /**
215
- * Restore the focus styles unset by the previous rule.
216
- */
217
-
218
- button:-moz-focusring,
219
- [type="button"]:-moz-focusring,
220
- [type="reset"]:-moz-focusring,
221
- [type="submit"]:-moz-focusring {
222
- outline: 1px dotted ButtonText;
223
- }
224
-
225
- /**
226
- * Correct the padding in Firefox.
227
- */
228
-
229
- fieldset {
230
- padding: 0.35em 0.75em 0.625em;
231
- }
232
-
233
- /**
234
- * 1. Correct the text wrapping in Edge and IE.
235
- * 2. Correct the color inheritance from `fieldset` elements in IE.
236
- * 3. Remove the padding so developers are not caught out when they zero out
237
- * `fieldset` elements in all browsers.
238
- */
239
-
240
- legend {
241
- box-sizing: border-box; /* 1 */
242
- color: inherit; /* 2 */
243
- display: table; /* 1 */
244
- max-width: 100%; /* 1 */
245
- padding: 0; /* 3 */
246
- white-space: normal; /* 1 */
247
- }
248
-
249
- /**
250
- * Add the correct vertical alignment in Chrome, Firefox, and Opera.
251
- */
252
-
253
- progress {
254
- vertical-align: baseline;
255
- }
256
-
257
- /**
258
- * Remove the default vertical scrollbar in IE 10+.
259
- */
260
-
261
- textarea {
262
- overflow: auto;
263
- }
264
-
265
- /**
266
- * 1. Add the correct box sizing in IE 10.
267
- * 2. Remove the padding in IE 10.
268
- */
269
-
270
- [type="checkbox"],
271
- [type="radio"] {
272
- box-sizing: border-box; /* 1 */
273
- padding: 0; /* 2 */
274
- }
275
-
276
- /**
277
- * Correct the cursor style of increment and decrement buttons in Chrome.
278
- */
279
-
280
- [type="number"]::-webkit-inner-spin-button,
281
- [type="number"]::-webkit-outer-spin-button {
282
- height: auto;
283
- }
284
-
285
- /**
286
- * 1. Correct the odd appearance in Chrome and Safari.
287
- * 2. Correct the outline style in Safari.
288
- */
289
-
290
- [type="search"] {
291
- -webkit-appearance: textfield; /* 1 */
292
- outline-offset: -2px; /* 2 */
293
- }
294
-
295
- /**
296
- * Remove the inner padding in Chrome and Safari on macOS.
297
- */
298
-
299
- [type="search"]::-webkit-search-decoration {
300
- -webkit-appearance: none;
301
- }
302
-
303
- /**
304
- * 1. Correct the inability to style clickable types in iOS and Safari.
305
- * 2. Change font properties to `inherit` in Safari.
306
- */
307
-
308
- ::-webkit-file-upload-button {
309
- -webkit-appearance: button; /* 1 */
310
- font: inherit; /* 2 */
311
- }
312
-
313
- /* Interactive
314
- ========================================================================== */
315
-
316
- /*
317
- * Add the correct display in Edge, IE 10+, and Firefox.
318
- */
319
-
320
- details {
321
- display: block;
322
- }
323
-
324
- /*
325
- * Add the correct display in all browsers.
326
- */
327
-
328
- summary {
329
- display: list-item;
330
- }
331
-
332
- /* Misc
333
- ========================================================================== */
334
-
335
- /**
336
- * Add the correct display in IE 10+.
337
- */
338
-
339
- template {
340
- display: none;
341
- }
342
-
343
- /**
344
- * Add the correct display in IE 10.
345
- */
346
-
347
- [hidden] {
348
- display: none;
349
- }
@@ -1,15 +0,0 @@
1
- @import "01-vendors/normalize.css";
2
- @import "02-variables/mixins.scss";
3
-
4
- body {
5
- font-family: sans-serif;
6
- background: #CBD2D9;
7
- display: flex;
8
- position: relative;
9
- width: 100%;
10
- height: 100%;
11
- flex-direction: column;
12
- margin: 0;
13
- padding: 0;
14
-
15
- }
@@ -1,10 +0,0 @@
1
- const {expect, assert} = require('chai');
2
- const {SpyneApp, SpyneAppProperties} = require('spyne');
3
-
4
- describe('should initialize spyne', () => {
5
- it('should be show that spyne has initialized', () => {
6
- SpyneApp.init();
7
- expect(SpyneAppProperties.initialized).to.be.true;
8
- });
9
-
10
- });