qcobjects-cli 2.3.34 → 2.3.42

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.
package/.gitlab-ci.yml ADDED
@@ -0,0 +1,15 @@
1
+ image: node:latest
2
+
3
+ stages:
4
+ - deploy
5
+
6
+ deploy:
7
+ stage: deploy
8
+ rules:
9
+ - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_REF_NAME =~ /^v\d+\.\d+\.\d+.*$/
10
+ changes:
11
+ - package.json
12
+ script:
13
+ - echo "registry=https://registry.npmjs.org/:_authToken=${NPM_TOKEN}">.npmrc
14
+ - npm ci
15
+ - npm publish
package/VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.34
1
+ 2.3.42
@@ -180,11 +180,13 @@ Package("org.quickcorp.qcobjects.cli",[
180
180
  var _dirnames = function (pathname){
181
181
  fs.readdir(pathname,{withFileTypes:true},function (err,files){
182
182
  var _pathnames = [];
183
- files.filter((f)=>{return f.isDirectory();}).map((d)=>{
183
+ if (typeof files !== "undefined"){
184
+ files.filter((f)=>{return f.isDirectory();}).map((d)=>{
184
185
  _pathnames.push(pathname+"/"+d.name);
185
186
  callback(pathname+"/"+d.name);
186
187
  _dirnames(pathname+"/"+d.name);
187
188
  });
189
+ }
188
190
  _main_pathnames = _main_pathnames.concat(_pathnames);
189
191
  });
190
192
  return _main_pathnames;
@@ -244,119 +246,222 @@ Package("org.quickcorp.qcobjects.cli",[
244
246
  rl.close();
245
247
  let giturl = answer;
246
248
 
247
- let createAppCommandCustom = "echo \
248
- { \
249
- \"name\": \""+appName.toLowerCase()+"\", \
250
- \"repository\": { \
251
- \"type\": \"git\", \
252
- \"url\": \""+giturl+`" \
253
- }, \
254
- "description": "This is a custom NPM template app from ${options.createCustom} generated with QCObjects.", \
255
- "main": "js/init.js", \
256
- "license": "LGPL-3.0-or-later", \
257
- "dependencies": { \
258
- "${options.createCustom}": "latest", \
259
- "qcobjects": "latest" \
260
- } \
261
- } > package.json`;
262
-
249
+ let createAppCommandCustom = `
250
+ {
251
+ "name": "${appName.toLowerCase()}",
252
+ "version": "0.0.1",
253
+ "repository": {
254
+ "type": "git",
255
+ "url": "${giturl}"
256
+ },
257
+ "description": "This is a custom NPM template app from ${options.createCustom} generated with QCObjects.",
258
+ "main": "js/init.js",
259
+ "license": "LGPL-3.0-or-later",
260
+ "scripts": {
261
+ "test": "(npx eslint *.js js/*.js js/packages/*.js --fix) && (npx jasmine)",
262
+ "sync": "git add . && git commit -am ",
263
+ "preversion": "npm i --upgrade && npm test",
264
+ "postversion": "git push && git push --tags",
265
+ "coverage": "nyc --reporter=lcov --reporter=text-summary npm run test",
266
+ "start": "node app.js",
267
+ "build": "exit 0"
268
+ },
269
+ "dependencies": {
270
+ "${options.createCustom}": "latest",
271
+ "qcobjects": "latest",
272
+ "qcobjects-sdk": "latest"
273
+ },
274
+ "devDependencies":
275
+ "eslint": "^8.2.0",
276
+ "eslint-config-qcobjects": "latest",
277
+ "jasmine": "latest",
278
+ "qcobjects-cli": "latest",
279
+ "grunt": "^1.4.1",
280
+ "grunt-contrib-jasmine": "^2.0.2",
281
+ "nyc": "^15.1.0"
282
+ }
283
+ }`;
263
284
 
264
- let createAppCommandPWA = "echo \
265
- { \
266
- \"name\": \""+appName.toLowerCase()+"\", \
267
- \"repository\": { \
268
- \"type\": \"git\", \
269
- \"url\": \""+giturl+"\" \
270
- }, \
271
- \"description\": \"Awesome PWA application that will help you achieve your dreams.\", \
272
- \"main\": \"js/init.js\", \
273
- \"license\": \"LGPL-3.0-or-later\", \
274
- \"dependencies\": { \
275
- \"qcobjectsnewapp\": \"latest\", \
276
- \"qcobjects\": \"latest\" \
277
- } \
278
- } > package.json";
285
+ let createAppCommandPWA = `
286
+ {
287
+ "name": "${appName.toLowerCase()}",
288
+ "version": "0.0.1",
289
+ "repository": {
290
+ "type": "git",
291
+ "url": "${giturl}"
292
+ },
293
+ "description": "Awesome PWA application that will help you achieve your dreams.",
294
+ "main": "js/init.js",
295
+ "license": "LGPL-3.0-or-later",
296
+ "scripts": {
297
+ "test": "(npx eslint *.js js/*.js js/packages/*.js --fix) && (npx jasmine)",
298
+ "sync": "git add . && git commit -am ",
299
+ "preversion": "npm i --upgrade && npm test",
300
+ "postversion": "git push && git push --tags",
301
+ "coverage": "nyc --reporter=lcov --reporter=text-summary npm run test",
302
+ "start": "node app.js",
303
+ "build": "exit 0"
304
+ },
305
+ "dependencies": {
306
+ "qcobjectsnewapp": "latest",
307
+ "qcobjects": "latest",
308
+ "qcobjects-sdk": "latest"
309
+ },
310
+ "devDependencies": {
311
+ "eslint": "^8.2.0",
312
+ "eslint-config-qcobjects": "latest",
313
+ "jasmine": "latest",
314
+ "qcobjects-cli": "latest",
315
+ "grunt": "^1.4.1",
316
+ "grunt-contrib-jasmine": "^2.0.2",
317
+ "nyc": "^15.1.0"
318
+ }
319
+ }`;
279
320
 
280
- let createAppCommandAMP = "echo \
281
- { \
282
- \"name\": \""+appName.toLowerCase()+"\", \
283
- \"repository\": { \
284
- \"type\": \"git\", \
285
- \"url\": \""+giturl+"\" \
286
- }, \
287
- \"description\": \"Awesome AMP application that will help you achieve your dreams.\", \
288
- \"main\": \"js/init.js\", \
289
- \"license\": \"LGPL-3.0-or-later\", \
290
- \"dependencies\": { \
291
- \"qcobjects-ecommerce-amp\": \"latest\", \
292
- \"qcobjects\": \"latest\" \
293
- } \
294
- } > package.json";
321
+ let createAppCommandAMP = `echo
322
+ {
323
+ "name": "${appName.toLowerCase()}",
324
+ "version": "0.0.1",
325
+ "repository": {
326
+ "type": "git",
327
+ "url": "${giturl}"
328
+ },
329
+ "description": "Awesome AMP application that will help you achieve your dreams.",
330
+ "main": "js/init.js",
331
+ "license": "LGPL-3.0-or-later",
332
+ "scripts": {
333
+ "test": "(npx eslint *.js js/*.js js/packages/*.js --fix) && (npx jasmine)",
334
+ "sync": "git add . && git commit -am ",
335
+ "preversion": "npm i --upgrade && npm test",
336
+ "postversion": "git push && git push --tags",
337
+ "coverage": "nyc --reporter=lcov --reporter=text-summary npm run test",
338
+ "start": "node app.js",
339
+ "build": "exit 0"
340
+ },
341
+ "dependencies": {
342
+ "qcobjects-ecommerce-amp": "latest",
343
+ "qcobjects": "latest",
344
+ "qcobjects-sdk": "latest"
345
+ },
346
+ "devDependencies": {
347
+ "eslint": "^8.2.0",
348
+ "eslint-config-qcobjects": "latest",
349
+ "jasmine": "latest",
350
+ "qcobjects-cli": "latest",
351
+ "grunt": "^1.4.1",
352
+ "grunt-contrib-jasmine": "^2.0.2",
353
+ "nyc": "^15.1.0"
354
+ }
355
+ }`;
295
356
 
296
- let createAppCommandPHP = `echo \
297
- { \
298
- "name": "${appName.toLowerCase()}", \
299
- "repository": {\
300
- "type": "git",\
301
- "url": "${giturl}"\
302
- },\
303
- "description": "Awesome PHP application that will help you achieve your dreams.",\
304
- "main": "js/init.js",\
305
- "license": "LGPL-3.0-or-later",\
306
- "devDependencies": {\
307
- "jasmine": "latest",\
308
- "qcobjects-cli": "latest"\
309
- },\
310
- "dependencies": {\
311
- "qcobjectsnewphp": "latest",\
312
- "qcobjects": "latest",\
313
- "qcobjects-sdk": "latest"\
314
- }\
315
- } > package.json`;
357
+ let createAppCommandPHP = `
358
+ {
359
+ "name": "${appName.toLowerCase()}",
360
+ "version": "0.0.1",
361
+ "repository": {
362
+ "type": "git",
363
+ "url": "${giturl}"
364
+ },
365
+ "description": "Awesome PHP application that will help you achieve your dreams.",
366
+ "main": "js/init.js",
367
+ "license": "LGPL-3.0-or-later",
368
+ "scripts": {
369
+ "test": "(npx eslint *.js js/*.js js/packages/*.js --fix) && (npx jasmine)",
370
+ "sync": "git add . && git commit -am ",
371
+ "preversion": "npm i --upgrade && npm test",
372
+ "postversion": "git push && git push --tags",
373
+ "coverage": "nyc --reporter=lcov --reporter=text-summary npm run test",
374
+ "start": "node app.js",
375
+ "build": "exit 0"
376
+ },
377
+ "dependencies": {
378
+ "qcobjectsnewphp": "latest",
379
+ "qcobjects": "latest",
380
+ "qcobjects-sdk": "latest"
381
+ },
382
+ "devDependencies": {
383
+ "eslint": "^8.2.0",
384
+ "eslint-config-qcobjects": "latest",
385
+ "jasmine": "latest",
386
+ "qcobjects-cli": "latest",
387
+ "grunt": "^1.4.1",
388
+ "grunt-contrib-jasmine": "^2.0.2",
389
+ "nyc": "^15.1.0"
390
+ }
391
+ }`;
316
392
 
317
393
  let createAppCommand;
318
394
  let appTemplateName;
395
+ let _package_json_content;
319
396
 
320
397
  if (options.createAmp){
321
398
  appTemplateName = "qcobjects-ecommerce-amp";
322
- createAppCommand = createAppCommandAMP;
399
+ _package_json_content = createAppCommandAMP;
323
400
  } else if (options.createPwa){
324
401
  appTemplateName = "qcobjectsnewapp";
325
- createAppCommand = createAppCommandPWA;
402
+ _package_json_content = createAppCommandPWA;
326
403
  } else if (options.createPhp){
327
404
  appTemplateName = "qcobjectsnewphp";
328
- createAppCommand = createAppCommandPHP;
405
+ _package_json_content = createAppCommandPHP;
329
406
  } else if (options.createCustom){
330
407
  appTemplateName = options.createCustom;
331
- createAppCommand = createAppCommandCustom;
408
+ _package_json_content = createAppCommandCustom;
332
409
  } else {
333
410
  appTemplateName = "qcobjectsnewapp";
334
- createAppCommand = createAppCommandPWA;
411
+ _package_json_content = createAppCommandPWA;
335
412
  }
336
413
  CONFIG.set("qcobjectsnewapp_path",CONFIG.get("node_modules_path")+"/"+appTemplateName);
337
- if (!process.platform.toLowerCase().startsWith("win")){
338
- createAppCommand = createAppCommand.replace(/(")/g, String.fromCharCode(92)+"\"");
339
- }
414
+ /* if (!process.platform.toLowerCase().startsWith("win")){
415
+ _package_json_content = _package_json_content.replace(/(")/g, String.fromCharCode(92)+"\"");
416
+ }*/
417
+ createAppCommand = "npm init -y";
418
+ let _package_json_file = path.resolve(CONFIG.get("projectPath"),"./package.json");
419
+ logger.debug("_package_json_file: "+_package_json_file);
340
420
  logger.debug(createAppCommand);
421
+
341
422
  exec(createAppCommand, (err, stdout, stderr) => {
342
- exec("npm cache verify && npm i --save-dev ", (err, stdout, stderr) => {
343
- Promise.resolve(switchCommander.copyTemplate()).then(()=>{
344
- logger.info("Good! Your application is getting done. You can play with QCObjects now!");
345
- logger.info("In about five seconds your server will start...");
346
- exec("qcobjects-createcert",(err,stdout,stderr)=>{
347
- logger.info("Test certificates generated");
348
- exec("npm uninstall "+appTemplateName+" --save && npm cache verify",(err,stdout,stderr)=>{
349
- switchCommander.generateServiceWorker(appName);
423
+ if (err) {
424
+ logger.warn(err);
425
+ process.exit(1);
426
+ return;
427
+ }
428
+ fs.writeFile(_package_json_file, _package_json_content, err => {
429
+ if (err) {
430
+ logger.warn(err);
431
+ process.exit(1);
432
+ return;
433
+ }
434
+
435
+ exec("npm cache verify && npm i --save-dev ", (err, stdout, stderr) => {
436
+ if (err) {
437
+ logger.warn(err);
438
+ process.exit(1);
439
+ return;
440
+ }
441
+
442
+ Promise.resolve(switchCommander.copyTemplate())
443
+ .then(()=>{
444
+ logger.info("Good! Your application is getting done. You can play with QCObjects now!");
445
+ logger.info("In about five seconds your server will start...");
446
+ exec("qcobjects-createcert",(err,stdout,stderr)=>{
447
+ logger.info("Test certificates generated");
448
+
449
+ exec("npm uninstall "+appTemplateName+" --save && npm cache verify",(err,stdout,stderr)=>{
450
+ switchCommander.generateServiceWorker(appName);
451
+ });
452
+
453
+ }).stdout.on("data", function(data) {
454
+ console.log(data);
350
455
  });
351
- }).stdout.on("data", function(data) {
352
- console.log(data);
353
456
  });
457
+ }).stdout.on("data", function(data) {
458
+ console.log(data);
354
459
  });
355
- }).stdout.on("data", function(data) {
356
- console.log(data);
460
+
357
461
  });
462
+
358
463
  }).stdout.on("data", function(data) {
359
- console.log(data);
464
+ console.log("App generation started...");
360
465
  });
361
466
 
362
467
  });
package/package.json CHANGED
@@ -1,20 +1,27 @@
1
1
  {
2
2
  "name": "qcobjects-cli",
3
- "version": "2.3.34",
3
+ "version": "2.3.42",
4
4
  "description": "qcobjects cli command line tool",
5
5
  "main": "qcobjects-cli.js",
6
6
  "scripts": {
7
7
  "sync": "git add . && git commit -am ",
8
8
  "test": "npx eslint **/*.js --fix && $(npm bin)/jasmine",
9
9
  "preversion": "npm i --upgrade && npm test",
10
- "postversion": "git push && git push --tags && npm publish"
10
+ "postversion": "git push && git push --tags"
11
11
  },
12
12
  "dependencies": {
13
13
  "commander": "^2.20.3",
14
14
  "mime": "^2.4.7",
15
- "qcobjects": "latest",
15
+ "qcobjects": "^2.3.66-lts",
16
16
  "qcobjects-sdk": "latest",
17
- "yaml": "^1.8.0"
17
+ "yaml": "^1.10.2"
18
+ },
19
+ "devDependencies": {
20
+ "eslint": "^8.2.0",
21
+ "eslint-config-qcobjects": "^0.0.13",
22
+ "jasmine": "^3.7.0",
23
+ "qcobjects": "^2.3.66-lts",
24
+ "qcobjects-cli": "latest"
18
25
  },
19
26
  "repository": {
20
27
  "type": "file",
@@ -54,10 +61,5 @@
54
61
  "qcobjects-gae-server": "./qcobjects-gae-http-server.js",
55
62
  "qcobjects-http-server": "./qcobjects-http-server.js",
56
63
  "qcobjects-collab": "./qcobjects-collab.js"
57
- },
58
- "devDependencies": {
59
- "eslint": "^6.8.0",
60
- "eslint-config-qcobjects": "0.0.6",
61
- "jasmine": "^3.7.0"
62
64
  }
63
65
  }