qcobjects-cli 2.5.158 → 2.6.2

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 (132) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  2. package/.github/ISSUE_TEMPLATE/custom.md +0 -0
  3. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  4. package/.github/ISSUE_TEMPLATE/issue-template.md +0 -0
  5. package/.github/workflows/npmpublish.yml +2 -0
  6. package/CHANGELOG.md +16 -0
  7. package/LICENSE.txt +21 -0
  8. package/README.md +6 -1
  9. package/VERSION +1 -1
  10. package/package.json +17 -14
  11. package/public/browser/templates/pwa/sw.js +2 -11
  12. package/public/cjs/api-client_services.js +3 -12
  13. package/public/cjs/api-client_services.js.map +1 -1
  14. package/public/cjs/backend/backend-microservice-static.js +3 -12
  15. package/public/cjs/backend/backend-microservice-static.js.map +1 -1
  16. package/public/cjs/backend/backend-php.js +3 -12
  17. package/public/cjs/backend/backend-php.js.map +1 -1
  18. package/public/cjs/cli-commands-build-esbuild.js +3 -12
  19. package/public/cjs/cli-commands-build-esbuild.js.map +1 -1
  20. package/public/cjs/cli-commands-build-typescript.js +3 -12
  21. package/public/cjs/cli-commands-build-typescript.js.map +1 -1
  22. package/public/cjs/cli-commands-jira.js +3 -12
  23. package/public/cjs/cli-commands-jira.js.map +1 -1
  24. package/public/cjs/cli-commands-lint.js +207 -0
  25. package/public/cjs/cli-commands-lint.js.map +1 -0
  26. package/public/cjs/cli-commands-publish-static.js +3 -12
  27. package/public/cjs/cli-commands-publish-static.js.map +1 -1
  28. package/public/cjs/cli-commands-version.js +3 -12
  29. package/public/cjs/cli-commands-version.js.map +1 -1
  30. package/public/cjs/cli-commands.js +5 -13
  31. package/public/cjs/cli-commands.js.map +1 -1
  32. package/public/cjs/cli-main.js +45 -49
  33. package/public/cjs/cli-main.js.map +1 -1
  34. package/public/cjs/client_services.js +3 -12
  35. package/public/cjs/client_services.js.map +1 -1
  36. package/public/cjs/collab-server.js +3 -12
  37. package/public/cjs/collab-server.js.map +1 -1
  38. package/public/cjs/common-pipelog.js +3 -12
  39. package/public/cjs/common-pipelog.js.map +1 -1
  40. package/public/cjs/defaultsettings.js +3 -12
  41. package/public/cjs/defaultsettings.js.map +1 -1
  42. package/public/cjs/enterprise-commands.js +3 -12
  43. package/public/cjs/enterprise-commands.js.map +1 -1
  44. package/public/cjs/main-file.js +3 -12
  45. package/public/cjs/main-file.js.map +1 -1
  46. package/public/cjs/main-http-gae-server.js +3 -12
  47. package/public/cjs/main-http-gae-server.js.map +1 -1
  48. package/public/cjs/main-http-server.js +3 -12
  49. package/public/cjs/main-http-server.js.map +1 -1
  50. package/public/cjs/main-http2-server.js +3 -12
  51. package/public/cjs/main-http2-server.js.map +1 -1
  52. package/public/cjs/qcobjects-cli.js +3 -12
  53. package/public/cjs/qcobjects-cli.js.map +1 -1
  54. package/public/cjs/qcobjects-collab.js +3 -12
  55. package/public/cjs/qcobjects-collab.js.map +1 -1
  56. package/public/cjs/qcobjects-createcert.js +3 -12
  57. package/public/cjs/qcobjects-createcert.js.map +1 -1
  58. package/public/cjs/qcobjects-gae-http-server.js +3 -12
  59. package/public/cjs/qcobjects-gae-http-server.js.map +1 -1
  60. package/public/cjs/qcobjects-http-server.js +3 -12
  61. package/public/cjs/qcobjects-http-server.js.map +1 -1
  62. package/public/cjs/qcobjects-http2-server.js +3 -12
  63. package/public/cjs/qcobjects-http2-server.js.map +1 -1
  64. package/public/cjs/qcobjects-shell.js +3 -12
  65. package/public/cjs/qcobjects-shell.js.map +1 -1
  66. package/public/cjs/templates/pwa/sw.js +2 -11
  67. package/public/esm/api-client_services.mjs.map +2 -2
  68. package/public/esm/backend/backend-microservice-static.mjs.map +2 -2
  69. package/public/esm/backend/backend-php.mjs +5 -1
  70. package/public/esm/backend/backend-php.mjs.map +2 -2
  71. package/public/esm/cli-commands-build-esbuild.mjs.map +2 -2
  72. package/public/esm/cli-commands-build-typescript.mjs.map +2 -2
  73. package/public/esm/cli-commands-jira.mjs.map +2 -2
  74. package/public/esm/cli-commands-lint.mjs +139 -0
  75. package/public/esm/cli-commands-lint.mjs.map +7 -0
  76. package/public/esm/cli-commands-publish-static.mjs.map +2 -2
  77. package/public/esm/cli-commands-version.mjs +3 -3
  78. package/public/esm/cli-commands-version.mjs.map +2 -2
  79. package/public/esm/cli-commands.mjs +2 -0
  80. package/public/esm/cli-commands.mjs.map +2 -2
  81. package/public/esm/cli-main.mjs +39 -32
  82. package/public/esm/cli-main.mjs.map +2 -2
  83. package/public/esm/client_services.mjs.map +2 -2
  84. package/public/esm/collab-server.mjs.map +2 -2
  85. package/public/esm/common-pipelog.mjs.map +2 -2
  86. package/public/esm/defaultsettings.mjs +25 -11
  87. package/public/esm/defaultsettings.mjs.map +2 -2
  88. package/public/esm/enterprise-commands.mjs.map +2 -2
  89. package/public/esm/main-file.mjs +2 -2
  90. package/public/esm/main-file.mjs.map +2 -2
  91. package/public/esm/main-http-gae-server.mjs.map +2 -2
  92. package/public/esm/main-http-server.mjs.map +2 -2
  93. package/public/esm/main-http2-server.mjs.map +2 -2
  94. package/public/esm/qcobjects-cli.mjs.map +2 -2
  95. package/public/esm/qcobjects-collab.mjs.map +2 -2
  96. package/public/esm/qcobjects-createcert.mjs.map +2 -2
  97. package/public/esm/qcobjects-gae-http-server.mjs.map +2 -2
  98. package/public/esm/qcobjects-http-server.mjs.map +2 -2
  99. package/public/esm/qcobjects-http2-server.mjs.map +2 -2
  100. package/public/esm/qcobjects-shell.mjs +5 -1
  101. package/public/esm/qcobjects-shell.mjs.map +2 -2
  102. package/public/esm/templates/pwa/sw.js +2 -11
  103. package/public/types/index.d.ts +24 -25
  104. package/src/api-client_services.ts +3 -12
  105. package/src/backend/backend-microservice-static.ts +3 -12
  106. package/src/backend/backend-php.ts +3 -12
  107. package/src/cli-commands-build-esbuild.ts +3 -12
  108. package/src/cli-commands-build-typescript.ts +3 -12
  109. package/src/cli-commands-jira.ts +3 -12
  110. package/src/cli-commands-lint.ts +181 -0
  111. package/src/cli-commands-publish-static.ts +3 -12
  112. package/src/cli-commands-version.ts +3 -12
  113. package/src/cli-commands.ts +5 -13
  114. package/src/cli-main.ts +18 -21
  115. package/src/client_services.ts +3 -12
  116. package/src/collab-server.ts +3 -12
  117. package/src/common-pipelog.ts +3 -12
  118. package/src/defaultsettings.ts +3 -12
  119. package/src/enterprise-commands.ts +3 -12
  120. package/src/main-file.ts +3 -12
  121. package/src/main-http-gae-server.ts +3 -12
  122. package/src/main-http-server.ts +3 -12
  123. package/src/main-http2-server.ts +3 -12
  124. package/src/qcobjects-cli.ts +3 -12
  125. package/src/qcobjects-collab.ts +3 -12
  126. package/src/qcobjects-createcert.ts +3 -12
  127. package/src/qcobjects-gae-http-server.ts +3 -12
  128. package/src/qcobjects-http-server.ts +3 -12
  129. package/src/qcobjects-http2-server.ts +3 -12
  130. package/src/qcobjects-shell.ts +3 -12
  131. package/src/templates/pwa/sw.js +2 -11
  132. package/bin/qcobjects-cli.js +0 -39
@@ -92,6 +92,20 @@ declare module "cli-commands-jira" {
92
92
  getIssueList(): Promise<void>;
93
93
  }
94
94
  }
95
+ declare module "cli-commands-lint" {
96
+ import { InheritClass } from "qcobjects";
97
+ export class CommandHandler extends InheritClass {
98
+ choiceOption: {
99
+ lint: (targets: string[], options: {
100
+ fix?: boolean;
101
+ config?: string;
102
+ }) => Promise<void>;
103
+ };
104
+ constructor({ switchCommander }: {
105
+ switchCommander: any;
106
+ });
107
+ }
108
+ }
95
109
  declare module "cli-commands-publish-static" {
96
110
  import { InheritClass } from "qcobjects";
97
111
  export class CommandHandler extends InheritClass {
@@ -118,6 +132,7 @@ declare module "cli-commands" {
118
132
  export * as publishStatic from "cli-commands-publish-static";
119
133
  export * as buildTypescript from "cli-commands-build-typescript";
120
134
  export * as buildEsbuild from "cli-commands-build-esbuild";
135
+ export * as lintCommand from "cli-commands-lint";
121
136
  }
122
137
  declare module "defaultsettings" {
123
138
  import "qcobjects";
@@ -205,23 +220,14 @@ declare module "cli-commands-version" {
205
220
  }
206
221
  declare module "collab-server" {
207
222
  /**
208
- * QCObjects CLI 2.5
223
+ * QCObjects Framework CLI
209
224
  * ________________
210
225
  *
211
226
  * Author: Jean Machuca <correojean@gmail.com>
212
227
  *
213
228
  * Cross Browser Javascript Framework for MVC Patterns
214
- * QuickCorp/QCObjects is licensed under the
215
- * GNU Lesser General Public License v3.0
216
- * [LICENSE] (https://github.com/QuickCorp/QCObjects/blob/master/LICENSE.txt)
217
- *
218
- * Permissions of this copyleft license are conditioned on making available
219
- * complete source code of licensed works and modifications under the same
220
- * license or the GNU GPLv3. Copyright and license notices must be preserved.
221
- * Contributors provide an express grant of patent rights. However, a larger
222
- * work using the licensed work through interfaces provided by the licensed
223
- * work may be distributed under different terms and without source code for
224
- * the larger work.
229
+ * QCObjects is licensed under the MIT License
230
+ * [LICENSE] (https://github.com/QCObjects/qcobjects-cli/blob/main/LICENSE.txt)
225
231
  *
226
232
  * Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>
227
233
  *
@@ -288,13 +294,15 @@ declare module "main-file" {
288
294
  templateURI: string;
289
295
  template: any;
290
296
  body: any;
291
- constructor({ name, template, templateURI, headers, body, filename, done }: {
297
+ constructor({ name, template, templateURI, headers, body, filename, scriptname, pathname, done }: {
292
298
  name: string;
293
299
  template: string;
294
300
  templateURI: string;
295
301
  headers: any;
296
302
  body: string;
297
303
  filename: string;
304
+ scriptname: any;
305
+ pathname: any;
298
306
  done: (headers: any, body: any, templateURI?: string, isTemplate?: boolean) => any;
299
307
  });
300
308
  file_extension(): any;
@@ -375,23 +383,14 @@ declare module "qcobjects-http-server" {
375
383
  }
376
384
  declare module "qcobjects-http2-server" {
377
385
  /**
378
- * QCObjects CLI 2.5
386
+ * QCObjects Framework CLI
379
387
  * ________________
380
388
  *
381
389
  * Author: Jean Machuca <correojean@gmail.com>
382
390
  *
383
391
  * Cross Browser Javascript Framework for MVC Patterns
384
- * QuickCorp/QCObjects is licensed under the
385
- * GNU Lesser General Public License v3.0
386
- * [LICENSE] (https://github.com/QuickCorp/QCObjects/blob/master/LICENSE.txt)
387
- *
388
- * Permissions of this copyleft license are conditioned on making available
389
- * complete source code of licensed works and modifications under the same
390
- * license or the GNU GPLv3. Copyright and license notices must be preserved.
391
- * Contributors provide an express grant of patent rights. However, a larger
392
- * work using the licensed work through interfaces provided by the licensed
393
- * work may be distributed under different terms and without source code for
394
- * the larger work.
392
+ * QCObjects is licensed under the MIT License
393
+ * [LICENSE] (https://github.com/QCObjects/qcobjects-cli/blob/main/LICENSE.txt)
395
394
  *
396
395
  * Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>
397
396
  *
@@ -1,21 +1,12 @@
1
1
  /**
2
- * QCObjects CLI 2.5
2
+ * QCObjects Framework CLI
3
3
  * ________________
4
4
  *
5
5
  * Author: Jean Machuca <correojean@gmail.com>
6
6
  *
7
7
  * Cross Browser Javascript Framework for MVC Patterns
8
- * QuickCorp/QCObjects is licensed under the
9
- * GNU Lesser General Public License v3.0
10
- * [LICENSE] (https://github.com/QuickCorp/QCObjects/blob/master/LICENSE.txt)
11
- *
12
- * Permissions of this copyleft license are conditioned on making available
13
- * complete source code of licensed works and modifications under the same
14
- * license or the GNU GPLv3. Copyright and license notices must be preserved.
15
- * Contributors provide an express grant of patent rights. However, a larger
16
- * work using the licensed work through interfaces provided by the licensed
17
- * work may be distributed under different terms and without source code for
18
- * the larger work.
8
+ * QCObjects is licensed under the MIT License
9
+ * [LICENSE] (https://github.com/QCObjects/qcobjects-cli/blob/main/LICENSE.txt)
19
10
  *
20
11
  * Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>
21
12
  *
@@ -1,21 +1,12 @@
1
1
  /**
2
- * QCObjects CLI 2.3.x
2
+ * QCObjects Framework CLI
3
3
  * ________________
4
4
  *
5
5
  * Author: Jean Machuca <correojean@gmail.com>
6
6
  *
7
7
  * Cross Browser Javascript Framework for MVC Patterns
8
- * QuickCorp/QCObjects is licensed under the
9
- * GNU Lesser General Public License v3.0
10
- * [LICENSE] (https://github.com/QuickCorp/QCObjects/blob/master/LICENSE.txt)
11
- *
12
- * Permissions of this copyleft license are conditioned on making available
13
- * complete source code of licensed works and modifications under the same
14
- * license or the GNU GPLv3. Copyright and license notices must be preserved.
15
- * Contributors provide an express grant of patent rights. However, a larger
16
- * work using the licensed work through interfaces provided by the licensed
17
- * work may be distributed under different terms and without source code for
18
- * the larger work.
8
+ * QCObjects is licensed under the MIT License
9
+ * [LICENSE] (https://github.com/QCObjects/qcobjects-cli/blob/main/LICENSE.txt)
19
10
  *
20
11
  * Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>
21
12
  *
@@ -1,21 +1,12 @@
1
1
  /**
2
- * QCObjects CLI 2.3.x
2
+ * QCObjects Framework CLI
3
3
  * ________________
4
4
  *
5
5
  * Author: Jean Machuca <correojean@gmail.com>
6
6
  *
7
7
  * Cross Browser Javascript Framework for MVC Patterns
8
- * QuickCorp/QCObjects is licensed under the
9
- * GNU Lesser General Public License v3.0
10
- * [LICENSE] (https://github.com/QuickCorp/QCObjects/blob/master/LICENSE.txt)
11
- *
12
- * Permissions of this copyleft license are conditioned on making available
13
- * complete source code of licensed works and modifications under the same
14
- * license or the GNU GPLv3. Copyright and license notices must be preserved.
15
- * Contributors provide an express grant of patent rights. However, a larger
16
- * work using the licensed work through interfaces provided by the licensed
17
- * work may be distributed under different terms and without source code for
18
- * the larger work.
8
+ * QCObjects is licensed under the MIT License
9
+ * [LICENSE] (https://github.com/QCObjects/qcobjects-cli/blob/main/LICENSE.txt)
19
10
  *
20
11
  * Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>
21
12
  *
@@ -1,21 +1,12 @@
1
1
  /**
2
- * QCObjects CLI 2.5
2
+ * QCObjects Framework CLI
3
3
  * ________________
4
4
  *
5
5
  * Author: Jean Machuca <correojean@gmail.com>
6
6
  *
7
7
  * Cross Browser Javascript Framework for MVC Patterns
8
- * QuickCorp/QCObjects is licensed under the
9
- * GNU Lesser General Public License v3.0
10
- * [LICENSE] (https://github.com/QuickCorp/QCObjects/blob/master/LICENSE.txt)
11
- *
12
- * Permissions of this copyleft license are conditioned on making available
13
- * complete source code of licensed works and modifications under the same
14
- * license or the GNU GPLv3. Copyright and license notices must be preserved.
15
- * Contributors provide an express grant of patent rights. However, a larger
16
- * work using the licensed work through interfaces provided by the licensed
17
- * work may be distributed under different terms and without source code for
18
- * the larger work.
8
+ * QCObjects is licensed under the MIT License
9
+ * [LICENSE] (https://github.com/QCObjects/qcobjects-cli/blob/main/LICENSE.txt)
19
10
  *
20
11
  * Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>
21
12
  *
@@ -1,21 +1,12 @@
1
1
  /**
2
- * QCObjects CLI 2.5
2
+ * QCObjects Framework CLI
3
3
  * ________________
4
4
  *
5
5
  * Author: Jean Machuca <correojean@gmail.com>
6
6
  *
7
7
  * Cross Browser Javascript Framework for MVC Patterns
8
- * QuickCorp/QCObjects is licensed under the
9
- * GNU Lesser General Public License v3.0
10
- * [LICENSE] (https://github.com/QuickCorp/QCObjects/blob/master/LICENSE.txt)
11
- *
12
- * Permissions of this copyleft license are conditioned on making available
13
- * complete source code of licensed works and modifications under the same
14
- * license or the GNU GPLv3. Copyright and license notices must be preserved.
15
- * Contributors provide an express grant of patent rights. However, a larger
16
- * work using the licensed work through interfaces provided by the licensed
17
- * work may be distributed under different terms and without source code for
18
- * the larger work.
8
+ * QCObjects is licensed under the MIT License
9
+ * [LICENSE] (https://github.com/QCObjects/qcobjects-cli/blob/main/LICENSE.txt)
19
10
  *
20
11
  * Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>
21
12
  *
@@ -1,21 +1,12 @@
1
1
  /**
2
- * QCObjects CLI 2.5
2
+ * QCObjects Framework CLI
3
3
  * ________________
4
4
  *
5
5
  * Author: Jean Machuca <correojean@gmail.com>
6
6
  *
7
7
  * Cross Browser Javascript Framework for MVC Patterns
8
- * QuickCorp/QCObjects is licensed under the
9
- * GNU Lesser General Public License v3.0
10
- * [LICENSE] (https://github.com/QuickCorp/QCObjects/blob/master/LICENSE.txt)
11
- *
12
- * Permissions of this copyleft license are conditioned on making available
13
- * complete source code of licensed works and modifications under the same
14
- * license or the GNU GPLv3. Copyright and license notices must be preserved.
15
- * Contributors provide an express grant of patent rights. However, a larger
16
- * work using the licensed work through interfaces provided by the licensed
17
- * work may be distributed under different terms and without source code for
18
- * the larger work.
8
+ * QCObjects is licensed under the MIT License
9
+ * [LICENSE] (https://github.com/QCObjects/qcobjects-cli/blob/main/LICENSE.txt)
19
10
  *
20
11
  * Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>
21
12
  *
@@ -0,0 +1,181 @@
1
+ /**
2
+ * QCObjects Framework CLI
3
+ * ________________
4
+ *
5
+ * Author: Jean Machuca <correojean@gmail.com>
6
+ *
7
+ * Cross Browser Javascript Framework for MVC Patterns
8
+ * QCObjects is licensed under the MIT License
9
+ * [LICENSE] (https://github.com/QCObjects/qcobjects-cli/blob/main/LICENSE.txt)
10
+ *
11
+ * Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>
12
+ *
13
+ * Everyone is permitted to copy and distribute verbatim copies of this
14
+ * license document, but changing it is not allowed.
15
+ */
16
+ /*eslint no-unused-vars: "off"*/
17
+ /*eslint no-redeclare: "off"*/
18
+ /*eslint no-empty: "off"*/
19
+ /*eslint strict: "off"*/
20
+ /*eslint no-mixed-operators: "off"*/
21
+ /*eslint no-undef: "off"*/
22
+ "use strict";
23
+ import fs from "node:fs";
24
+ import path from "node:path";
25
+ import { pathToFileURL } from "node:url";
26
+ import glob from "glob";
27
+ import { Linter } from "eslint";
28
+ import globals from "globals";
29
+ import * as tsParserModule from "@typescript-eslint/parser";
30
+ import * as tsPluginModule from "@typescript-eslint/eslint-plugin";
31
+ import { Package, InheritClass } from "qcobjects";
32
+
33
+ const tsParser = (tsParserModule as any).default ?? tsParserModule;
34
+ const tsPlugin = (tsPluginModule as any).default ?? tsPluginModule;
35
+
36
+ const DEFAULT_TARGETS = ["src/**/*.ts"];
37
+
38
+ const DEFAULT_IGNORES = [
39
+ "node_modules/**",
40
+ "build/**",
41
+ "public/**",
42
+ "dist/**",
43
+ "coverage/**",
44
+ ".git/**",
45
+ ];
46
+
47
+ const DEFAULT_FLAT_CONFIG: any[] = [
48
+ {
49
+ files: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.mjs", "**/*.cjs"],
50
+ plugins: {
51
+ "@typescript-eslint": tsPlugin,
52
+ },
53
+ languageOptions: {
54
+ parser: tsParser,
55
+ ecmaVersion: "latest",
56
+ sourceType: "module",
57
+ globals: {
58
+ ...globals.browser,
59
+ ...globals.node,
60
+ ...globals.commonjs,
61
+ },
62
+ },
63
+ rules: {
64
+ "no-undef": "error",
65
+ "no-unused-vars": ["warn", { argsIgnorePattern: "^_", varsIgnorePattern: "^_" }],
66
+ "no-empty": "off",
67
+ "no-constant-condition": "off",
68
+ "no-redeclare": "off",
69
+ "no-var": "off",
70
+ "no-mixed-operators": "off",
71
+ },
72
+ },
73
+ ];
74
+
75
+ export class CommandHandler extends InheritClass {
76
+ choiceOption: {
77
+ lint: (targets: string[], options: { fix?: boolean; config?: string }) => Promise<void>;
78
+ };
79
+
80
+ constructor({
81
+ switchCommander
82
+ }: { switchCommander: any }) {
83
+ super({ switchCommander });
84
+ this.choiceOption = {
85
+ async lint(targets, options) {
86
+ try {
87
+ const cwd = process.cwd();
88
+ const requestedTargets = targets.length > 0 ? targets : DEFAULT_TARGETS;
89
+ const ignoreFlags = DEFAULT_IGNORES.map(ignored => new RegExp(ignored.replace(/\*\*/g, ".*")));
90
+ const files = requestedTargets
91
+ .flatMap(target => glob.sync(target, { cwd, nodir: true }))
92
+ .filter((file: string) => !ignoreFlags.some(flag => flag.test(file)));
93
+
94
+ if (files.length === 0) {
95
+ console.warn(`No files matched: ${requestedTargets.join(", ")}`);
96
+ process.exit(0);
97
+ }
98
+
99
+ let flatConfig = DEFAULT_FLAT_CONFIG;
100
+ const appConfigPath = ["eslint.config.js", "eslint.config.mjs", "eslint.config.cjs"]
101
+ .map(name => path.resolve(cwd, name))
102
+ .find(appConfigPath => fs.existsSync(appConfigPath));
103
+
104
+ if (options.config) {
105
+ const explicitConfigPath = path.resolve(cwd, options.config);
106
+ if (!fs.existsSync(explicitConfigPath)) {
107
+ console.warn(`Config file not found: ${explicitConfigPath}`);
108
+ process.exit(1);
109
+ }
110
+ flatConfig = (await import(pathToFileURL(explicitConfigPath).href)).default;
111
+ console.log(`Using config file: ${explicitConfigPath}`);
112
+ } else if (appConfigPath) {
113
+ flatConfig = (await import(pathToFileURL(appConfigPath).href)).default;
114
+ console.log(`Using app config file: ${appConfigPath}`);
115
+ } else if (fs.existsSync(path.resolve(cwd, ".eslintrc")) || fs.existsSync(path.resolve(cwd, ".eslintrc.js")) || fs.existsSync(path.resolve(cwd, ".eslintrc.cjs")) || fs.existsSync(path.resolve(cwd, ".eslintrc.json"))) {
116
+ console.warn("Legacy .eslintrc config detected but not supported; using built-in QCObjects settings. Migrate to eslint.config.mjs to override defaults.");
117
+ } else {
118
+ console.log("No app eslint config found. Using built-in QCObjects settings (overridable with an eslint.config.mjs in your app).");
119
+ }
120
+
121
+ const linter = new Linter({ cwd, configType: "flat" });
122
+ let errorCount = 0;
123
+ let warningCount = 0;
124
+ let fixedCount = 0;
125
+
126
+ for (const file of files) {
127
+ const absolutePath = path.resolve(cwd, file);
128
+ const source = fs.readFileSync(absolutePath, "utf8");
129
+ const result: { fixed: boolean; output: string; messages: any[] } = options.fix
130
+ ? linter.verifyAndFix(source, flatConfig, absolutePath)
131
+ : { fixed: false, output: source, messages: linter.verify(source, flatConfig, absolutePath) };
132
+ if (result.fixed) {
133
+ fixedCount++;
134
+ fs.writeFileSync(absolutePath, result.output);
135
+ }
136
+ for (const message of result.messages) {
137
+ const severity = message.severity === 2 ? "error" : message.severity === 1 ? "warning" : "info";
138
+ const output = `${file}:${message.line}:${message.column} ${severity} ${message.message} (${message.ruleId ?? "parse"})`;
139
+ if (message.severity === 2) {
140
+ errorCount++;
141
+ console.error(output);
142
+ } else if (message.severity === 1) {
143
+ warningCount++;
144
+ console.warn(output);
145
+ } else {
146
+ console.log(output);
147
+ }
148
+ }
149
+ }
150
+
151
+ const summary = `${files.length} file(s) linted, ${errorCount} error(s), ${warningCount} warning(s), ${fixedCount} file(s) fixed.`;
152
+ if (errorCount > 0) {
153
+ console.error(summary);
154
+ process.exit(1);
155
+ }
156
+ console.log(summary);
157
+ process.exit(0);
158
+ } catch (e: any) {
159
+ console.warn(`Something went wrong trying to lint: ${e.message}`);
160
+ process.exit(1);
161
+ }
162
+ }
163
+ };
164
+
165
+ const commandHandler = this;
166
+
167
+ const lintCommand = switchCommander.program.command("lint [targets...]")
168
+ .allowExcessArguments(false)
169
+ .option("-f, --fix", "Automatically fix problems")
170
+ .option("-c, --config <path>", "Use a specific eslint config file")
171
+ .description("Lints JS/TS files using built-in QCObjects settings. Default target: src/**/*.ts")
172
+ .action(function (targets: string[], options: { fix?: boolean; config?: string }) {
173
+ commandHandler.choiceOption.lint.call(commandHandler, targets ?? [], options);
174
+ });
175
+
176
+ }
177
+ }
178
+
179
+ Package("com.qcobjects.cli.commands.lint", [
180
+ CommandHandler
181
+ ]);
@@ -1,21 +1,12 @@
1
1
  /**
2
- * QCObjects CLI 2.5
2
+ * QCObjects Framework CLI
3
3
  * ________________
4
4
  *
5
5
  * Author: Jean Machuca <correojean@gmail.com>
6
6
  *
7
7
  * Cross Browser Javascript Framework for MVC Patterns
8
- * QuickCorp/QCObjects is licensed under the
9
- * GNU Lesser General Public License v3.0
10
- * [LICENSE] (https://github.com/QuickCorp/QCObjects/blob/master/LICENSE.txt)
11
- *
12
- * Permissions of this copyleft license are conditioned on making available
13
- * complete source code of licensed works and modifications under the same
14
- * license or the GNU GPLv3. Copyright and license notices must be preserved.
15
- * Contributors provide an express grant of patent rights. However, a larger
16
- * work using the licensed work through interfaces provided by the licensed
17
- * work may be distributed under different terms and without source code for
18
- * the larger work.
8
+ * QCObjects is licensed under the MIT License
9
+ * [LICENSE] (https://github.com/QCObjects/qcobjects-cli/blob/main/LICENSE.txt)
19
10
  *
20
11
  * Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>
21
12
  *
@@ -1,21 +1,12 @@
1
1
  /**
2
- * QCObjects CLI 2.5
2
+ * QCObjects Framework CLI
3
3
  * ________________
4
4
  *
5
5
  * Author: Jean Machuca <correojean@gmail.com>
6
6
  *
7
7
  * Cross Browser Javascript Framework for MVC Patterns
8
- * QuickCorp/QCObjects is licensed under the
9
- * GNU Lesser General Public License v3.0
10
- * [LICENSE] (https://github.com/QuickCorp/QCObjects/blob/master/LICENSE.txt)
11
- *
12
- * Permissions of this copyleft license are conditioned on making available
13
- * complete source code of licensed works and modifications under the same
14
- * license or the GNU GPLv3. Copyright and license notices must be preserved.
15
- * Contributors provide an express grant of patent rights. However, a larger
16
- * work using the licensed work through interfaces provided by the licensed
17
- * work may be distributed under different terms and without source code for
18
- * the larger work.
8
+ * QCObjects is licensed under the MIT License
9
+ * [LICENSE] (https://github.com/QCObjects/qcobjects-cli/blob/main/LICENSE.txt)
19
10
  *
20
11
  * Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>
21
12
  *
@@ -1,21 +1,12 @@
1
1
  /**
2
- * QCObjects CLI 2.5
2
+ * QCObjects Framework CLI
3
3
  * ________________
4
4
  *
5
5
  * Author: Jean Machuca <correojean@gmail.com>
6
6
  *
7
7
  * Cross Browser Javascript Framework for MVC Patterns
8
- * QuickCorp/QCObjects is licensed under the
9
- * GNU Lesser General Public License v3.0
10
- * [LICENSE] (https://github.com/QuickCorp/QCObjects/blob/master/LICENSE.txt)
11
- *
12
- * Permissions of this copyleft license are conditioned on making available
13
- * complete source code of licensed works and modifications under the same
14
- * license or the GNU GPLv3. Copyright and license notices must be preserved.
15
- * Contributors provide an express grant of patent rights. However, a larger
16
- * work using the licensed work through interfaces provided by the licensed
17
- * work may be distributed under different terms and without source code for
18
- * the larger work.
8
+ * QCObjects is licensed under the MIT License
9
+ * [LICENSE] (https://github.com/QCObjects/qcobjects-cli/blob/main/LICENSE.txt)
19
10
  *
20
11
  * Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>
21
12
  *
@@ -36,4 +27,5 @@ export * as versionCommand from "./cli-commands-version";
36
27
  export * as jiraCommand from "./cli-commands-jira";
37
28
  export * as publishStatic from "./cli-commands-publish-static";
38
29
  export * as buildTypescript from "./cli-commands-build-typescript";
39
- export * as buildEsbuild from "./cli-commands-build-esbuild";
30
+ export * as buildEsbuild from "./cli-commands-build-esbuild";
31
+ export * as lintCommand from "./cli-commands-lint";
package/src/cli-main.ts CHANGED
@@ -1,21 +1,12 @@
1
1
  /**
2
- * QCObjects CLI 2.5
2
+ * QCObjects Framework CLI
3
3
  * ________________
4
4
  *
5
5
  * Author: Jean Machuca <correojean@gmail.com>
6
6
  *
7
7
  * Cross Browser Javascript Framework for MVC Patterns
8
- * QuickCorp/QCObjects is licensed under the
9
- * GNU Lesser General Public License v3.0
10
- * [LICENSE] (https://github.com/QuickCorp/QCObjects/blob/master/LICENSE.txt)
11
- *
12
- * Permissions of this copyleft license are conditioned on making available
13
- * complete source code of licensed works and modifications under the same
14
- * license or the GNU GPLv3. Copyright and license notices must be preserved.
15
- * Contributors provide an express grant of patent rights. However, a larger
16
- * work using the licensed work through interfaces provided by the licensed
17
- * work may be distributed under different terms and without source code for
18
- * the larger work.
8
+ * QCObjects is licensed under the MIT License
9
+ * [LICENSE] (https://github.com/QCObjects/qcobjects-cli/blob/main/LICENSE.txt)
19
10
  *
20
11
  * Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>
21
12
  *
@@ -117,13 +108,16 @@ export class SwitchCommander extends InheritClass {
117
108
  switchCommander.copyTemplate(path.resolve(findPackageNodePath(appTemplateName), appTemplateName), path.resolve(CONFIG.get("projectPath"), "./"))
118
109
  .then(() => {
119
110
 
120
- exec("npm uninstall " + appTemplateName + " --save && npm cache verify", err => {
111
+ exec("npm uninstall " + appTemplateName + " --save", err => {
121
112
  if (err) {
122
113
  throw Error(err.message);
123
114
  // eslint-disable-next-line no-unreachable
124
115
  process.exit(1);
125
116
  return;
126
117
  }
118
+ exec("npm cache verify", () => {
119
+ // non-fatal — cache verify failures are ignored
120
+ });
127
121
 
128
122
  /*
129
123
  switchCommander.generateServiceWorker(appName)
@@ -134,13 +128,14 @@ export class SwitchCommander extends InheritClass {
134
128
  execSync("npm install --save-dev --legacy-peer-deps qcobjects-cli ");
135
129
  });
136
130
 
137
- exec("npm cache verify && npm i --legacy-peer-deps ", (err) => {
138
- if (err) {
139
- throw Error(err.message);
140
- // eslint-disable-next-line no-unreachable
141
- process.exit(1);
142
- return;
143
- }
131
+ exec("npm cache verify", () => {
132
+ exec("npm i --legacy-peer-deps ", (err) => {
133
+ if (err) {
134
+ throw Error(err.message);
135
+ // eslint-disable-next-line no-unreachable
136
+ process.exit(1);
137
+ return;
138
+ }
144
139
 
145
140
  logger.info("Good! Your application is done. You can play with QCObjects now!");
146
141
 
@@ -149,7 +144,7 @@ export class SwitchCommander extends InheritClass {
149
144
  logger.info("Test certificates generated");
150
145
 
151
146
  const githubService = New(Service);
152
- githubService.url = "https://raw.githubusercontent.com/QuickCorp/QCObjects/main/.gitignore";
147
+ githubService.url = "https://raw.githubusercontent.com/QCObjects/QCObjects/main/.gitignore";
153
148
  githubService.headers = {
154
149
  Accept: "application/vnd.github+json",
155
150
  "X-GitHub-Api-Version": "2022-11-28",
@@ -178,6 +173,8 @@ export class SwitchCommander extends InheritClass {
178
173
  console.log(data);
179
174
  });
180
175
 
176
+ });
177
+
181
178
  })
182
179
  .catch((e: any) => {
183
180
  console.log(e);
@@ -1,21 +1,12 @@
1
1
  /**
2
- * QCObjects CLI 2.5
2
+ * QCObjects Framework CLI
3
3
  * ________________
4
4
  *
5
5
  * Author: Jean Machuca <correojean@gmail.com>
6
6
  *
7
7
  * Cross Browser Javascript Framework for MVC Patterns
8
- * QuickCorp/QCObjects is licensed under the
9
- * GNU Lesser General Public License v3.0
10
- * [LICENSE] (https://github.com/QuickCorp/QCObjects/blob/master/LICENSE.txt)
11
- *
12
- * Permissions of this copyleft license are conditioned on making available
13
- * complete source code of licensed works and modifications under the same
14
- * license or the GNU GPLv3. Copyright and license notices must be preserved.
15
- * Contributors provide an express grant of patent rights. However, a larger
16
- * work using the licensed work through interfaces provided by the licensed
17
- * work may be distributed under different terms and without source code for
18
- * the larger work.
8
+ * QCObjects is licensed under the MIT License
9
+ * [LICENSE] (https://github.com/QCObjects/qcobjects-cli/blob/main/LICENSE.txt)
19
10
  *
20
11
  * Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>
21
12
  *
@@ -1,22 +1,13 @@
1
1
  "use strict";
2
2
  /**
3
- * QCObjects CLI 2.5
3
+ * QCObjects Framework CLI
4
4
  * ________________
5
5
  *
6
6
  * Author: Jean Machuca <correojean@gmail.com>
7
7
  *
8
8
  * Cross Browser Javascript Framework for MVC Patterns
9
- * QuickCorp/QCObjects is licensed under the
10
- * GNU Lesser General Public License v3.0
11
- * [LICENSE] (https://github.com/QuickCorp/QCObjects/blob/master/LICENSE.txt)
12
- *
13
- * Permissions of this copyleft license are conditioned on making available
14
- * complete source code of licensed works and modifications under the same
15
- * license or the GNU GPLv3. Copyright and license notices must be preserved.
16
- * Contributors provide an express grant of patent rights. However, a larger
17
- * work using the licensed work through interfaces provided by the licensed
18
- * work may be distributed under different terms and without source code for
19
- * the larger work.
9
+ * QCObjects is licensed under the MIT License
10
+ * [LICENSE] (https://github.com/QCObjects/qcobjects-cli/blob/main/LICENSE.txt)
20
11
  *
21
12
  * Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>
22
13
  *