zcatalyst-cli 1.9.0 → 1.11.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 (190) hide show
  1. package/README.md +29 -29
  2. package/docs/client-utils.toml +5 -0
  3. package/docs/command_needs/auth.toml +5 -0
  4. package/docs/commands/iac/export.toml +4 -0
  5. package/docs/commands/iac/import.toml +4 -0
  6. package/docs/commands/iac/status.toml +4 -0
  7. package/docs/commands/project/use.toml +6 -0
  8. package/docs/iac/status/bundle.toml +4 -0
  9. package/docs/plugin-loader.toml +4 -0
  10. package/docs/serve/server/index.toml +4 -0
  11. package/docs/serve/server/lib/web_client/server.toml +4 -0
  12. package/lib/api-timer.js +81 -0
  13. package/lib/apig-utils.js +17 -14
  14. package/lib/archiver.js +83 -45
  15. package/lib/authentication/login.js +4 -2
  16. package/lib/bin/catalyst.js +0 -1
  17. package/lib/client-utils.js +55 -26
  18. package/lib/client.js +0 -3
  19. package/lib/command_needs/auth.js +12 -3
  20. package/lib/command_needs/rc.js +12 -7
  21. package/lib/commands/apig/disable.js +1 -1
  22. package/lib/commands/apig/enable.js +1 -1
  23. package/lib/commands/apig/status.js +7 -5
  24. package/lib/commands/client/delete.js +4 -5
  25. package/lib/commands/client/setup.js +1 -1
  26. package/lib/commands/deploy.js +4 -2
  27. package/lib/commands/ds/export.js +4 -2
  28. package/lib/commands/ds/import.js +4 -2
  29. package/lib/commands/ds/status.js +146 -150
  30. package/lib/commands/event/generate/index.js +5 -14
  31. package/lib/commands/event/generate/integ.js +1 -1
  32. package/lib/commands/functions/add.js +1 -1
  33. package/lib/commands/functions/config.js +1 -1
  34. package/lib/commands/functions/delete.js +1 -1
  35. package/lib/commands/functions/setup.js +1 -1
  36. package/lib/commands/functions/shell.js +1 -1
  37. package/lib/commands/help.js +0 -22
  38. package/lib/commands/iac/export.js +85 -0
  39. package/lib/commands/iac/import.js +189 -0
  40. package/lib/commands/iac/pack.js +129 -0
  41. package/lib/commands/iac/status.js +63 -0
  42. package/lib/commands/index.js +4 -0
  43. package/lib/commands/init.js +35 -28
  44. package/lib/commands/login.js +1 -1
  45. package/lib/commands/logout.js +1 -1
  46. package/lib/commands/project/list.js +11 -7
  47. package/lib/commands/project/reset.js +1 -1
  48. package/lib/commands/project/use.js +42 -25
  49. package/lib/commands/pull.js +2 -2
  50. package/lib/commands/run.js +1 -1
  51. package/lib/commands/serve.js +3 -2
  52. package/lib/commands/token/generate.js +1 -1
  53. package/lib/commands/token/list.js +1 -1
  54. package/lib/commands/token/revoke.js +1 -1
  55. package/lib/commands/whoami.js +1 -1
  56. package/lib/deploy/features/functions/index.js +2 -1
  57. package/lib/deploy/index.js +3 -1
  58. package/lib/endpoints/lib/iac.js +134 -0
  59. package/lib/error.js +33 -3
  60. package/lib/errorOut.js +4 -3
  61. package/lib/fn-utils/lib/common.js +37 -16
  62. package/lib/fn-utils/lib/java.js +7 -9
  63. package/lib/fn-utils/lib/node.js +7 -1
  64. package/lib/iac/status/bundle.js +82 -0
  65. package/lib/iac/status/deploy.js +74 -0
  66. package/lib/iac/status/util/index.js +26 -0
  67. package/lib/index.js +13 -19
  68. package/lib/init/dependencies/npm-install.js +2 -9
  69. package/lib/init/features/client/index.js +47 -0
  70. package/lib/init/features/client/initializers/angular.js +88 -0
  71. package/lib/init/features/client/initializers/basic.js +27 -0
  72. package/lib/init/features/client/initializers/lyte.js +44 -0
  73. package/lib/init/features/client/initializers/react.js +53 -0
  74. package/lib/init/features/functions/languages/java.js +2 -5
  75. package/lib/init/features/functions/languages/node.js +5 -6
  76. package/lib/init/features/index.js +18 -6
  77. package/lib/init/features/project.js +72 -34
  78. package/lib/init/util/client.js +12 -0
  79. package/lib/init/util/functions.js +20 -0
  80. package/lib/init/util/project.js +35 -0
  81. package/lib/internal/api.js +6 -9
  82. package/lib/internal/command.js +6 -3
  83. package/lib/internal/config.js +7 -4
  84. package/lib/migration/index.js +10 -6
  85. package/lib/option-filter.js +4 -1
  86. package/lib/optional-import.js +11 -25
  87. package/lib/plugin-loader.js +8 -2
  88. package/lib/port-resolver.js +20 -16
  89. package/lib/prompt/index.js +92 -0
  90. package/lib/prompt/types/file-path.js +95 -0
  91. package/lib/pull/features/client.js +1 -1
  92. package/lib/pull/features/functions/index.js +5 -7
  93. package/lib/pull/index.js +4 -1
  94. package/lib/serve/features/index.js +3 -1
  95. package/lib/serve/index.js +6 -1
  96. package/lib/serve/server/index.js +74 -29
  97. package/lib/serve/server/lib/master.js +28 -12
  98. package/lib/serve/server/lib/web_client/index.js +30 -0
  99. package/lib/serve/server/lib/web_client/server.js +171 -0
  100. package/lib/serve/server/lib/web_client/utils.js +10 -0
  101. package/lib/shell/dependencies/http-functions.js +1 -1
  102. package/lib/shell/index.js +3 -1
  103. package/lib/track.js +3 -1
  104. package/lib/util_modules/char.js +1 -1
  105. package/lib/util_modules/config/lib/apig.js +2 -1
  106. package/lib/util_modules/constants/index.js +5 -1
  107. package/lib/util_modules/constants/lib/file-names.js +2 -1
  108. package/lib/util_modules/constants/lib/iac.js +8 -0
  109. package/lib/util_modules/constants/lib/placeholders.js +3 -1
  110. package/lib/util_modules/constants/lib/plugin.js +28 -0
  111. package/lib/util_modules/constants/lib/regex.js +2 -1
  112. package/lib/util_modules/constants/lib/scopes.js +5 -0
  113. package/lib/util_modules/constants/lib/template.js +11 -1
  114. package/lib/util_modules/constants/lib/urls.js +8 -0
  115. package/lib/util_modules/constants/project.js +6 -0
  116. package/lib/util_modules/{contextHelp.js → context-help.js} +5 -1
  117. package/lib/util_modules/env.js +14 -16
  118. package/lib/util_modules/fs/index.js +9 -1
  119. package/lib/util_modules/fs/lib/async.js +29 -22
  120. package/lib/util_modules/global-space.js +99 -0
  121. package/lib/util_modules/js.js +6 -0
  122. package/lib/util_modules/option.js +5 -1
  123. package/lib/util_modules/parser/toml.js +5 -1
  124. package/lib/util_modules/project.js +3 -0
  125. package/lib/util_modules/shell.js +9 -8
  126. package/lib/winston.js +1 -1
  127. package/package.json +11 -5
  128. package/templates/iacSuccess.html +391 -0
  129. package/templates/init/.DS_Store +0 -0
  130. package/templates/init/client/.DS_Store +0 -0
  131. package/templates/init/client/{client-package.json → basic/client-package.json} +0 -0
  132. package/templates/init/client/{index.html → basic/index.html} +0 -0
  133. package/templates/init/client/{main.css → basic/main.css} +0 -0
  134. package/templates/init/client/{main.js → basic/main.js} +0 -0
  135. package/templates/init/client/lyte/build/build.js +301 -0
  136. package/templates/init/client/lyte/build/scripts/cliDownloadScript.js +54 -0
  137. package/templates/init/client/lyte/client-package.json +5 -0
  138. package/templates/init/client/lyte/components/javascript/welcome-comp.js +13 -0
  139. package/templates/init/client/lyte/components/styles/welcome-comp.css +0 -0
  140. package/templates/init/client/lyte/components/templates/welcome-comp.html +8 -0
  141. package/templates/init/client/lyte/data-store/adapters/.gitkeep +0 -0
  142. package/templates/init/client/lyte/data-store/models/.gitkeep +0 -0
  143. package/templates/init/client/lyte/data-store/serializers/.gitkeep +0 -0
  144. package/templates/init/client/lyte/index.html +17 -0
  145. package/templates/init/client/lyte/package.json +12 -0
  146. package/templates/init/client/lyte/router.js +14 -0
  147. package/templates/init/client/lyte/routes/index.js +54 -0
  148. package/templates/init/client/react/.DS_Store +0 -0
  149. package/templates/init/client/react/react_js/package.json +11 -0
  150. package/templates/init/client/react/react_js/template/README.md +70 -0
  151. package/templates/init/client/react/react_js/template/client-package.json +5 -0
  152. package/templates/init/client/react/react_js/template/gitignore +23 -0
  153. package/templates/init/client/react/react_js/template/public/favicon.ico +0 -0
  154. package/templates/init/client/react/react_js/template/public/index.html +43 -0
  155. package/templates/init/client/react/react_js/template/public/logo192.png +0 -0
  156. package/templates/init/client/react/react_js/template/public/logo512.png +0 -0
  157. package/templates/init/client/react/react_js/template/public/manifest.json +25 -0
  158. package/templates/init/client/react/react_js/template/public/robots.txt +3 -0
  159. package/templates/init/client/react/react_js/template/src/App.css +38 -0
  160. package/templates/init/client/react/react_js/template/src/App.js +25 -0
  161. package/templates/init/client/react/react_js/template/src/App.test.js +8 -0
  162. package/templates/init/client/react/react_js/template/src/index.css +13 -0
  163. package/templates/init/client/react/react_js/template/src/index.js +17 -0
  164. package/templates/init/client/react/react_js/template/src/logo.svg +1 -0
  165. package/templates/init/client/react/react_js/template/src/reportWebVitals.js +13 -0
  166. package/templates/init/client/react/react_js/template/src/setupTests.js +5 -0
  167. package/templates/init/client/react/react_js/template.json +13 -0
  168. package/templates/init/client/react/react_ts/package.json +11 -0
  169. package/templates/init/client/react/react_ts/template/README.md +46 -0
  170. package/templates/init/client/react/react_ts/template/client-package.json +5 -0
  171. package/templates/init/client/react/react_ts/template/gitignore +23 -0
  172. package/templates/init/client/react/react_ts/template/public/favicon.ico +0 -0
  173. package/templates/init/client/react/react_ts/template/public/index.html +43 -0
  174. package/templates/init/client/react/react_ts/template/public/logo192.png +0 -0
  175. package/templates/init/client/react/react_ts/template/public/logo512.png +0 -0
  176. package/templates/init/client/react/react_ts/template/public/manifest.json +25 -0
  177. package/templates/init/client/react/react_ts/template/public/robots.txt +3 -0
  178. package/templates/init/client/react/react_ts/template/src/App.css +38 -0
  179. package/templates/init/client/react/react_ts/template/src/App.test.tsx +9 -0
  180. package/templates/init/client/react/react_ts/template/src/App.tsx +26 -0
  181. package/templates/init/client/react/react_ts/template/src/index.css +13 -0
  182. package/templates/init/client/react/react_ts/template/src/index.tsx +17 -0
  183. package/templates/init/client/react/react_ts/template/src/logo.svg +1 -0
  184. package/templates/init/client/react/react_ts/template/src/reportWebVitals.ts +15 -0
  185. package/templates/init/client/react/react_ts/template/src/setupTests.ts +5 -0
  186. package/templates/init/client/react/react_ts/template.json +18 -0
  187. package/templates/web-socket.txt +21 -0
  188. package/lib/init/features/client.js +0 -51
  189. package/lib/prompt.js +0 -49
  190. package/lib/serve/server/lib/client.js +0 -30
@@ -0,0 +1,301 @@
1
+ 'use strict';
2
+
3
+ var path,
4
+ includeStyle,
5
+ fs,
6
+ sane,
7
+ buildUtils,
8
+ buildOptions;
9
+
10
+ /**
11
+ buildUtils contains all necessary functions for copying and building files.
12
+ ---------------------------------------------------------------------------------------
13
+ * Available functions :
14
+ ---------------------------------------------------------------------------------------
15
+ * buildUtils.copy.file({options})
16
+ -----options-----
17
+ src : source file
18
+ dist : destination file
19
+ minify : [optional] If file needs to be minified in production mode.
20
+ In development mode file will be copied.(default : false)
21
+ ---------------------------------------------------------------------------------------
22
+ * buildUtils.copy.folder({options});
23
+ -----options-----
24
+ src : source folder
25
+ dist : destination folder
26
+ minify : [optional] If folder needs to be minified in production mode.
27
+ In development mode file will be copied.(default : false)
28
+ ---------------------------------------------------------------------------------------
29
+ * buildUtils.consolidate({options})
30
+ -----options-----
31
+ configPath : path from which, consolidation mapping json can be retrived.(json file)
32
+ (OR)
33
+ config : consolidation mapping(mapping)
34
+ module : consolidating module name(any string). To store consolidation mapping json
35
+ In order to store mapping and reusing it on build watch and build serve
36
+ file : [optional] When a particular file is changed and needs to be re-consolidated.
37
+ ---------------------------------------------------------------------------------------
38
+
39
+ **/
40
+ /**
41
+ For transpiling from es6 to es5 :
42
+ ---------------------------------------------------------------------------------------
43
+ * var transpile = require(path.join(options.cliRoot,'lib','utilities','transpile'));
44
+ transpile({options})
45
+ ----options---
46
+ file : single file path or path of the folder, that to convert from es6 to es5
47
+ (OR)
48
+ content : Content of the file to convert
49
+ dist : destination file or folder
50
+ strict : [[optional]] To enable strict mode (default : false)
51
+
52
+ ---------------------------------------------------------------------------------------
53
+ **/
54
+
55
+ /**
56
+ For compiling the themes :
57
+ ---------------------------------------------------------------------------------------
58
+ * buildUtils.compileThemes(buildOptions,{
59
+ src : Array of src File
60
+ dist : destination file
61
+ themeOptions : {
62
+ // list of less default options
63
+ }
64
+ })
65
+
66
+ ---------------------------------------------------------------------------------------
67
+ **/
68
+
69
+ module.exports = {
70
+ version : 1,
71
+ configureFolders : function(options) {
72
+ path = options.path;
73
+ options.outputFolder = "dist"; /* Folder at which the built files are to be needed. */
74
+ options.autoBundle = true ;/* autoBundle is to bundle all (routes,components,models,mixins,helpers and router.js file)*/
75
+ options.theming = false;
76
+ options.useStrict = false;
77
+ options.eslint = false;
78
+ buildUtils = require(path.join(options.cliRoot,'lib','utilities','buildUtils'));
79
+ var folders = { /* Available modules and its folder structures.*/
80
+ build : 'build',
81
+ routes : 'routes',
82
+ routers : 'router.js',
83
+ components : 'components',
84
+ adapters : path.join('data-store','adapters'),
85
+ models : path.join('data-store','models'),
86
+ serializers :path.join('data-store','serializers'),
87
+ mixins :'mixins',
88
+ javascript : path.join('components','javascript'),
89
+ templates : path.join('components','templates'),
90
+ helpers : path.join('components','helpers'),
91
+ styles : path.join('components','styles'),
92
+ images : path.join('components','images'),
93
+ themes : path.join('css'),
94
+ tests : 'tests'
95
+ };
96
+ options.folders = {};
97
+ options.folders.src = {};
98
+ options.folders.dist = {};
99
+ for(var key in folders) {
100
+ options.folders.src[key] = path.join(options.root,folders[key]) /* Source folder of modules. */
101
+ options.folders.dist[key] = path.join(options.root,options.outputFolder,folders[key]) /* Destination folder of modules,
102
+ can be changed if needed. */
103
+ }
104
+ },
105
+
106
+ /*-----------------------------------------------Build Process Starts-------------------------------------------*/
107
+ build : async function (options,dependencies) {
108
+ fs = dependencies.fs; /* fs-extra */
109
+ sane = dependencies.sane; /* watcher */
110
+ buildOptions = options;
111
+ /*configuration for transpile*/
112
+ options.transpile = false;
113
+ if(options.transpile) {
114
+ options.ignoreFoldersFromTranspile = [
115
+ "bower_components",
116
+ "node_modules"
117
+ ]
118
+ }
119
+ /* Building of modules starts. Custom modules can be added in build function. */
120
+ await buildUtils.init(options); /* Provides options to buildUtils. */
121
+ await buildUtils.build(['copyAppDir','routes','components','models','helpers','mixins','services']);
122
+ },
123
+ /*-----------------------------------------------Build Process ends---------------------------------------------*/
124
+
125
+ builder : {
126
+ /*----------------------------------Copy Task---------------------------------------------------------------*/
127
+ copyAppDir : async function(module) {
128
+ /* Comment folders to skip copying folders from source folder to destination folder. */
129
+ /*By default outputFolder,routes,mixins,data-store,compdonents,build will be ignored from copying */
130
+ /*Given folder should be relative to the root path*/
131
+ var ignoreFolders = [
132
+ 'node_modules'
133
+ ];
134
+ await buildUtils._super(module,ignoreFolders);
135
+ await buildUtils._completed(module);
136
+ },
137
+
138
+ /*-----------------------------------------------------------------------------------------------------------*/
139
+ routes : async function(module) {
140
+
141
+ await buildUtils._super(module);
142
+ /** _super of routes
143
+ ----------------------
144
+ * Copies route files from source folder to destination folder.
145
+ * Minifies route files if build is in production mode.
146
+ **/
147
+ await buildUtils._completed(module) /* Stops the timer and notifies that the module is completed. */
148
+ },
149
+
150
+ /*-----------------------------------------------------------------------------------------------------------*/
151
+ components : async function(module) {
152
+ includeStyle = true /* styles will be included to template by default. If not needed, toggle this property. */
153
+ await buildUtils._super(module,{includeStyle : includeStyle});
154
+ /** _super of components
155
+ -------------------------
156
+ * Compiles lyte files to html.
157
+ * Precompiles html files to get dynamic nodes.
158
+ * Appends style to template, if present. And then to component's javascript file.
159
+ * Copies component's files from source folder to destination folder.
160
+ * Minifies components files if build is in production mode.
161
+ **/
162
+ await buildUtils._completed(module) /* Stops the timer and notifies that the module is completed. */
163
+ },
164
+
165
+ /*-----------------------------------------------------------------------------------------------------------*/
166
+ helpers : async function(module) {
167
+ await buildUtils._super(module);
168
+ /** _super of helpers
169
+ ----------------------
170
+ * Copies file from source folder to destination folder(minifies if build
171
+ is in production mode).
172
+ **/
173
+ await buildUtils._completed(module) /* Stops the timer and notifies that the module is completed. */
174
+ },
175
+
176
+ /*-----------------------------------------------------------------------------------------------------------*/
177
+ models : async function(module) {
178
+ await buildUtils._super(module);
179
+ /** _super of models
180
+ ----------------------
181
+ * Concats model, adapter and serializer to a single file(minifies if build
182
+ is in production mode).
183
+ * Copies file from source folder to destination folder.
184
+ **/
185
+ await buildUtils._completed(module) /* Stops the timer and notifies that the module is completed. */
186
+ },
187
+
188
+ /*-----------------------------------------------------------------------------------------------------------*/
189
+ mixins : async function(module) {
190
+ await buildUtils._super(module);
191
+ /** _super of mixins
192
+ ----------------------
193
+ * Copies mixins files from source folder to destination folder.
194
+ * Minifies mixins files if build is in production mode.
195
+ **/
196
+ await buildUtils._completed(module) /* Stops the timer and notifies that the module is completed. */
197
+ },
198
+ services : async function(module) {
199
+
200
+ await buildUtils._super(module);
201
+ /** _super of services
202
+ ----------------------
203
+ * Copies services files from source folder to destination folder.
204
+ * Minifies services files if build is in production mode.
205
+ **/
206
+ await buildUtils._completed(module) /* Stops the timer and notifies that the module is completed. */
207
+ },
208
+ /*-----------------------------------------------------------------------------------------------------------*/
209
+ },
210
+
211
+ /*------------------------------------------Watch changes and build---------------------------------------------*/
212
+ watcher : {
213
+ copyAppDir : async function(module,file,modification) {
214
+ /* Comment folders to skip copying folders from source folder to destination folder. */
215
+ await buildUtils._super(module,{
216
+ file : file,
217
+ modification : modification
218
+ });
219
+ },
220
+ /*----------------------------------------------------------------------------------------------------------*/
221
+ routes : async function(module,file,modification) {
222
+ await buildUtils._super(module,{
223
+ file :file,
224
+ modification : modification
225
+ });
226
+ /** _super of routes on watcher
227
+ -------------------------------
228
+ * Copies specifed route files from source folder to destination folder.
229
+ * Minifies route files if build is in production mode.
230
+ **/
231
+ },
232
+
233
+ /*----------------------------------------------------------------------------------------------------------*/
234
+ components : async function(module,file,modification) {
235
+ await buildUtils._super(module,{
236
+ file : file,
237
+ modification :modification,
238
+ includeStyle : includeStyle
239
+ });
240
+ /** _super of components on watcher
241
+ -----------------------------------
242
+ * Compiles specified lyte files to html.
243
+ * Precompiles specified html files to get dynamic nodes.
244
+ * Appends style to template, if present. And then to component's javascript file.
245
+ * Copies specified component's files from source folder to destination folder.
246
+ * Minifies specified component files if build is in production mode.
247
+ **/
248
+ },
249
+
250
+ /*----------------------------------------------------------------------------------------------------------*/
251
+ helpers : async function(module,file,modification) {
252
+ await buildUtils._super(module,{
253
+ file : file,
254
+ modification : modification
255
+ });
256
+ /** _super of helpers on watcher
257
+ ---------------------------------
258
+ * Copies modified file from source folder to destination folder(minifies if build is in production mode).
259
+ **/
260
+ },
261
+
262
+ /*----------------------------------------------------------------------------------------------------------*/
263
+ models : async function(module,file,modification) {
264
+ await buildUtils._super(module,{
265
+ file :file,
266
+ modification :modification
267
+ });
268
+ /** _super of models on watcher
269
+ -------------------------------
270
+ * Concats model, adapter and serializer to a single file(minifies if build
271
+ is in production mode).
272
+ * Copies file from source folder to destination folder.
273
+ **/
274
+ },
275
+
276
+ /*----------------------------------------------------------------------------------------------------------*/
277
+ mixins : async function(module,file,modification) {
278
+ await buildUtils._super(module,{
279
+ file : file,
280
+ modification :modification
281
+ });
282
+ /** _super of mixins on watcher
283
+ ---------------------------------
284
+ * Copies modified file from source folder to destination folder(minifies if build is in production mode).
285
+ **/
286
+ },
287
+
288
+ services : async function(module,file,modification) {
289
+ await buildUtils._super(module,{
290
+ file : file,
291
+ modification :modification
292
+ });
293
+ /** _super of services on watcher
294
+ ---------------------------------
295
+ * Copies modified file from source folder to destination folder(minifies if build is in production mode).
296
+ **/
297
+ }
298
+
299
+
300
+ }
301
+ };
@@ -0,0 +1,54 @@
1
+ var production = process.env.production
2
+ if(!production) {
3
+ var execSync = require("child_process").execSync;
4
+ var registry = "http://integ-docker:4873";
5
+ var path = require("path");
6
+ var fs = require("fs");
7
+ var packageJSONPath = path.join(process.cwd(),"package.json");
8
+ var packageJSONContent = JSON.parse(fs.readFileSync(packageJSONPath,'utf-8'));
9
+ var version = packageJSONContent["lyte-cli"];
10
+ console.log("Installing the lyte-cli");
11
+ var installTheVersion = function(folderToCreate,version) {
12
+ var homeDir = process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME'];
13
+ var globalCliLocation = path.join(homeDir,'.lyte',"lyte-cli@"+folderToCreate);
14
+ var globalCliLocationNodeModules = path.join(globalCliLocation,"node_modules");
15
+ fs.mkdirSync(globalCliLocation,{recursive : true});
16
+ if(!fs.existsSync(globalCliLocationNodeModules)) {
17
+ try {
18
+ var str = execSync('cd '+globalCliLocation+' && npm install lyte-cli@'+version+' --registry='+registry+" --puppeteer_skip_chromium_download=true");
19
+ console.log(str.toString());
20
+ } catch(e) {
21
+ console.log(e.message);
22
+ process.exit(2);
23
+ }
24
+ }
25
+ var resolution = packageJSONContent.resolution || {};
26
+ resolution["lyte-cli"] = version;
27
+ packageJSONContent.resolution = resolution;
28
+ fs.writeFileSync(packageJSONPath,JSON.stringify(packageJSONContent,null,' '));
29
+ console.log("\x1b[32mLyte-cli found in the location "+globalCliLocation+'\x1b[0m');
30
+ }
31
+ if(version) {
32
+ let folderToCreate;
33
+ if(version.indexOf("http") != -1) {
34
+ folderToCreate = version.split(path.sep).pop();
35
+ installTheVersion(folderToCreate,version);
36
+ } else {
37
+ let lyteCliVersion;
38
+ var allVersions = execSync('npm view lyte-cli@'+version+' version --json --registry='+registry).toString().trim();
39
+ if(allVersions.length) {
40
+ array = JSON.parse(allVersions);
41
+ if(Array.isArray(array)) {
42
+ lyteCliVersion = array.pop().trim()
43
+ } else {
44
+ lyteCliVersion = array.trim();
45
+ }
46
+ lyteCliVersion = lyteCliVersion.replace(/V|v/g,'');
47
+ installTheVersion(lyteCliVersion,lyteCliVersion);
48
+ } else {
49
+ console.log("\x1b[31mNot an valid version for lyte-cli\x1b[0m");
50
+ process.exit(2);
51
+ }
52
+ }
53
+ }
54
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "{{_NAME_}}",
3
+ "version": "0.0.1",
4
+ "homepage": "index.html"
5
+ }
@@ -0,0 +1,13 @@
1
+ Lyte.Component.register("welcome-comp",{
2
+ data : function(){
3
+ return {
4
+ features : Lyte.attr("array")
5
+ }
6
+ },
7
+ actions : {
8
+ // Functions for event handling
9
+ },
10
+ methods : {
11
+ // Functions which can be used as callback in the component.
12
+ }
13
+ });
@@ -0,0 +1,8 @@
1
+ <template tag-name='welcome-comp'>
2
+ <h1>Available features of LYTE</h1>
3
+ <ul>
4
+ <li lyte-for="{{features}} as item index">
5
+ <a href="{{item.url}}" target="_blank">{{item.module}}</a>
6
+ </li>
7
+ </ul>
8
+ </template>
@@ -0,0 +1,17 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8"/>
5
+ <meta http-equiv="X-UA-Compatible" content="IE=11;IE12;IE=edge" />
6
+ <title>Demo</title>
7
+ <link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
8
+ <script src="vendor/lyte/custom-elements-es5-adapter.js"></script>
9
+ <script src="vendor/lyte/polyfill-bundle.js"></script>
10
+ <script src="vendor/lyte/lyte-es5.min.js"></script>
11
+ <script src="app.js"></script>
12
+ </head>
13
+ <body>
14
+ <h1>Welcome to Lyte framework</h1>
15
+ <div id='outlet'></div>
16
+ </body>
17
+ </html>
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "{{_NAME_}}",
3
+ "version": "1.0.0",
4
+ "description": "Description for {{_NAME_}} goes here",
5
+ "scripts": {
6
+ "test": "echo \"Error: no test specified\" && exit 1"
7
+ },
8
+ "author": "",
9
+ "dependencies" : {
10
+ "lyte" : "3.1.0"
11
+ }{{_DEV_DEPENDENCIES_}}
12
+ }
@@ -0,0 +1,14 @@
1
+ // Lyte.Router.configureDefaults({baseURL:'',history : "html5"});
2
+
3
+ Lyte.Router.configureRoutes(function(){
4
+ this.route('index',{path:'/'});
5
+ });
6
+
7
+ Lyte.Router.beforeRouteTransition = function() {
8
+ //console.log('before Route Change');
9
+ }
10
+
11
+ Lyte.Router.afterRouteTransition = function() {
12
+ //console.log('after Route Change');
13
+ }
14
+
@@ -0,0 +1,54 @@
1
+ Lyte.Router.registerRoute('index',{
2
+ // getResources : function (paramsObject ){
3
+ // /* View related files should be returned as resources(HTML, CSS, components etc). It will be available before 'renderTemplate' hook. */
4
+ // },
5
+ // getDependencies : function (paramsObject ){
6
+ // /* Files returned as dependencies will be downloaded at once and will be available before 'beforeModel' hook. */
7
+ // },
8
+ // beforeModel : function (paramsObject ){
9
+ // /* Pre processing stage where you can decide whether to abort/redirect the current transition(e.g Permission check). */
10
+ // },
11
+ model : function() {
12
+ return {
13
+ features : [
14
+ {module : 'Router',url : 'http://lyte/2.0/doc/route/introduction'},
15
+ {module : 'Components',url : 'http://lyte/2.0/doc/components/introduction'},
16
+ {module : 'Data',url : 'http://lyte/2.0/doc/data/introduction'},
17
+ {module : 'CLI',url : 'http://lyte/2.0/doc/cli/introduction'}
18
+ ]
19
+ }
20
+
21
+ },
22
+ // afterModel : function (model, paramsObject ){
23
+ // /* Manipulating data before returning data to component. */
24
+ // },
25
+ // redirect : function (model, paramsObject ){
26
+ // /* Redirections based on data fetched. */
27
+ // },
28
+ renderTemplate : function() {
29
+ return {outlet : "#outlet",component : "welcome-comp"}
30
+ }
31
+ // afterRender : function (model, paramsObject ){
32
+ // /* Post processing of rendered page. */
33
+ // },
34
+ // beforeExit : function (model, paramsObject ){
35
+ // /* Will be invoked before a route is removed from view. */
36
+ // },
37
+ // didDestroy : function (model, paramsObject ){
38
+ // /* Will be invoked when a route is completly destroyed(remove residues of route. eg: file cache removal). */
39
+ // },
40
+ // actions : {
41
+ // onBeforeLoad : function (paramsObject ){
42
+ // /* Triggered once route transition starts. */
43
+ // },
44
+ // onError : function (error, pausedTrans, paramsObject ){
45
+ // /* Triggered by error on file load or on data request. */
46
+ // },
47
+ // willTransition : function (transition ){
48
+ // /* Triggered before a transition is going to change. */
49
+ // },
50
+ // didTransition : function (paramsObject ){
51
+ // /* Triggered after completion of transition. */
52
+ // },
53
+ // }
54
+ });
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "cra-template-zcatalyst-js",
3
+ "version": "1.0.0",
4
+ "description": "Official create-react-app template for zcatalyst-cli",
5
+ "author": "catalyst",
6
+ "license": "MIT",
7
+ "files": [
8
+ "template/**/*",
9
+ "template.json"
10
+ ]
11
+ }
@@ -0,0 +1,70 @@
1
+ # Getting Started with Create React App
2
+
3
+ This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
4
+
5
+ ## Available Scripts
6
+
7
+ In the project directory, you can run:
8
+
9
+ ### `yarn start`
10
+
11
+ Runs the app in the development mode.\
12
+ Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
13
+
14
+ The page will reload if you make edits.\
15
+ You will also see any lint errors in the console.
16
+
17
+ ### `yarn test`
18
+
19
+ Launches the test runner in the interactive watch mode.\
20
+ See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
21
+
22
+ ### `yarn build`
23
+
24
+ Builds the app for production to the `build` folder.\
25
+ It correctly bundles React in production mode and optimizes the build for the best performance.
26
+
27
+ The build is minified and the filenames include the hashes.\
28
+ Your app is ready to be deployed!
29
+
30
+ See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
31
+
32
+ ### `yarn eject`
33
+
34
+ **Note: this is a one-way operation. Once you `eject`, you can’t go back!**
35
+
36
+ If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
37
+
38
+ Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
39
+
40
+ You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
41
+
42
+ ## Learn More
43
+
44
+ You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
45
+
46
+ To learn React, check out the [React documentation](https://reactjs.org/).
47
+
48
+ ### Code Splitting
49
+
50
+ This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
51
+
52
+ ### Analyzing the Bundle Size
53
+
54
+ This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
55
+
56
+ ### Making a Progressive Web App
57
+
58
+ This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
59
+
60
+ ### Advanced Configuration
61
+
62
+ This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
63
+
64
+ ### Deployment
65
+
66
+ This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
67
+
68
+ ### `yarn build` fails to minify
69
+
70
+ This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "{{_NAME_}}",
3
+ "version": "0.0.1",
4
+ "homepage": "index.html"
5
+ }
@@ -0,0 +1,23 @@
1
+ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2
+
3
+ # dependencies
4
+ /node_modules
5
+ /.pnp
6
+ .pnp.js
7
+
8
+ # testing
9
+ /coverage
10
+
11
+ # production
12
+ /build
13
+
14
+ # misc
15
+ .DS_Store
16
+ .env.local
17
+ .env.development.local
18
+ .env.test.local
19
+ .env.production.local
20
+
21
+ npm-debug.log*
22
+ yarn-debug.log*
23
+ yarn-error.log*
@@ -0,0 +1,43 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
7
+ <meta name="theme-color" content="#000000" />
8
+ <meta
9
+ name="description"
10
+ content="Web site created using create-react-app"
11
+ />
12
+ <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
13
+ <!--
14
+ manifest.json provides metadata used when your web app is installed on a
15
+ user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
16
+ -->
17
+ <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
18
+ <!--
19
+ Notice the use of %PUBLIC_URL% in the tags above.
20
+ It will be replaced with the URL of the `public` folder during the build.
21
+ Only files inside the `public` folder can be referenced from the HTML.
22
+
23
+ Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
24
+ work correctly both with client-side routing and a non-root public URL.
25
+ Learn how to configure a non-root public URL by running `npm run build`.
26
+ -->
27
+ <title>React App</title>
28
+ </head>
29
+ <body>
30
+ <noscript>You need to enable JavaScript to run this app.</noscript>
31
+ <div id="root"></div>
32
+ <!--
33
+ This HTML file is a template.
34
+ If you open it directly in the browser, you will see an empty page.
35
+
36
+ You can add webfonts, meta tags, or analytics to this file.
37
+ The build step will place the bundled scripts into the <body> tag.
38
+
39
+ To begin the development, run `npm start` or `yarn start`.
40
+ To create a production bundle, use `npm run build` or `yarn build`.
41
+ -->
42
+ </body>
43
+ </html>