qcobjects-cli 2.5.143-beta → 2.5.144-beta
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/.cursor/rules/collaboration-features.mdc +25 -0
- package/.cursor/rules/development-guidelines.mdc +37 -0
- package/.cursor/rules/project-structure.mdc +36 -0
- package/.dockerignore +0 -0
- package/.github/FUNDING.yml +0 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- package/.github/ISSUE_TEMPLATE/custom.md +0 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- package/.github/ISSUE_TEMPLATE/issue-template.md +0 -0
- package/.github/workflows/ci.yml +26 -0
- package/.github/workflows/codeql-analysis.yml +0 -0
- package/.github/workflows/main-pr-source.yml +26 -0
- package/.github/workflows/npmpublish-beta.yml +20 -13
- package/.github/workflows/npmpublish-lts.yml +20 -13
- package/.github/workflows/npmpublish-main.yml +19 -12
- package/.github/workflows/open-pr-to-development.yml +70 -0
- package/.gitlab-ci.yml +0 -0
- package/.opencode/instructions/git-workflow.md +46 -0
- package/.pre-commit-config.yaml +9 -0
- package/AGENTS.md +59 -0
- package/CHANGELOG.md +0 -0
- package/README.md +75 -0
- package/VERSION +1 -1
- package/build-esbuild-esm.js +180 -0
- package/build-esbuild.js +182 -208
- package/deno.json +0 -0
- package/dev-requirements.txt +5 -0
- package/eslint.config.mjs +0 -0
- package/mod.ts +0 -0
- package/package.json +45 -44
- package/public/browser/api-client_services.js.map +1 -1
- package/public/browser/backend/backend-microservice-static.js +211 -219
- package/public/browser/backend/backend-microservice-static.js.map +2 -2
- package/public/browser/backend/backend-php.js +227 -231
- package/public/browser/backend/backend-php.js.map +3 -3
- package/public/browser/cli-commands-build-esbuild.js +326 -0
- package/public/browser/cli-commands-build-esbuild.js.map +7 -0
- package/public/browser/cli-commands-build-typescript.js +114 -0
- package/public/browser/cli-commands-build-typescript.js.map +7 -0
- package/public/browser/cli-commands-jira.js.map +1 -1
- package/public/browser/cli-commands-version.js.map +1 -1
- package/public/browser/cli-commands.js +4 -0
- package/public/browser/cli-commands.js.map +2 -2
- package/public/browser/cli-main.js.map +1 -1
- package/public/browser/client_services.js.map +1 -1
- package/public/browser/collab-server.js.map +1 -1
- package/public/browser/common-pipelog.js.map +1 -1
- package/public/browser/defaultsettings.js +68 -27
- package/public/browser/defaultsettings.js.map +3 -3
- package/public/browser/enterprise-commands.js.map +1 -1
- package/public/browser/main-file.js.map +1 -1
- package/public/browser/main-http-gae-server.js.map +1 -1
- package/public/browser/main-http-server.js.map +1 -1
- package/public/browser/main-http2-server.js.map +1 -1
- package/public/browser/qcobjects-cli.js.map +1 -1
- package/public/browser/qcobjects-collab.js +16 -24
- package/public/browser/qcobjects-collab.js.map +2 -2
- package/public/browser/qcobjects-createcert.js +46 -54
- package/public/browser/qcobjects-createcert.js.map +2 -2
- package/public/browser/qcobjects-gae-http-server.js +16 -24
- package/public/browser/qcobjects-gae-http-server.js.map +2 -2
- package/public/browser/qcobjects-http-server.js +16 -24
- package/public/browser/qcobjects-http-server.js.map +2 -2
- package/public/browser/qcobjects-http2-server.js +21 -30
- package/public/browser/qcobjects-http2-server.js.map +2 -2
- package/public/browser/qcobjects-shell.js.map +1 -1
- package/public/browser/templates/apps/spa-local.html +0 -0
- package/public/browser/templates/apps/spa-local.js +0 -0
- package/public/browser/templates/pwa/sw.js +0 -0
- package/public/browser/types/global/index.d.js +0 -9
- package/public/browser/types/global/index.d.js.map +3 -3
- package/public/cjs/api-client_services.js +74 -0
- package/public/cjs/api-client_services.js.map +1 -0
- package/public/cjs/backend/backend-microservice-static.js +255 -0
- package/public/cjs/backend/backend-microservice-static.js.map +1 -0
- package/public/cjs/backend/backend-php.js +317 -0
- package/public/cjs/backend/backend-php.js.map +1 -0
- package/public/cjs/cli-commands-build-esbuild.js +341 -0
- package/public/cjs/cli-commands-build-esbuild.js.map +1 -0
- package/public/cjs/cli-commands-build-typescript.js +127 -0
- package/public/cjs/cli-commands-build-typescript.js.map +1 -0
- package/public/cjs/cli-commands-jira.js +115 -0
- package/public/cjs/cli-commands-jira.js.map +1 -0
- package/public/cjs/cli-commands-publish-static.js +108 -0
- package/public/cjs/cli-commands-publish-static.js.map +1 -0
- package/public/cjs/cli-commands-version.js +250 -0
- package/public/cjs/cli-commands-version.js.map +1 -0
- package/public/cjs/cli-commands.js +73 -0
- package/public/cjs/cli-commands.js.map +1 -0
- package/public/cjs/cli-main.js +487 -0
- package/public/cjs/cli-main.js.map +1 -0
- package/public/cjs/client_services.js +80 -0
- package/public/cjs/client_services.js.map +1 -0
- package/public/cjs/collab-server.js +404 -0
- package/public/cjs/collab-server.js.map +1 -0
- package/public/cjs/common-pipelog.js +57 -0
- package/public/cjs/common-pipelog.js.map +1 -0
- package/public/cjs/defaultsettings.js +496 -0
- package/public/cjs/defaultsettings.js.map +1 -0
- package/public/cjs/enterprise-commands.js +173 -0
- package/public/cjs/enterprise-commands.js.map +1 -0
- package/public/cjs/index.js +38 -0
- package/public/cjs/index.js.map +1 -0
- package/public/cjs/main-file.js +161 -0
- package/public/cjs/main-file.js.map +1 -0
- package/public/cjs/main-http-gae-server.js +498 -0
- package/public/cjs/main-http-gae-server.js.map +1 -0
- package/public/cjs/main-http-server.js +540 -0
- package/public/cjs/main-http-server.js.map +1 -0
- package/public/cjs/main-http2-server.js +398 -0
- package/public/cjs/main-http2-server.js.map +1 -0
- package/public/cjs/qcobjects-cli.js +105 -0
- package/public/cjs/qcobjects-cli.js.map +1 -0
- package/public/cjs/qcobjects-collab.js +51 -0
- package/public/cjs/qcobjects-collab.js.map +1 -0
- package/public/cjs/qcobjects-createcert.js +89 -0
- package/public/cjs/qcobjects-createcert.js.map +1 -0
- package/public/cjs/qcobjects-gae-http-server.js +51 -0
- package/public/cjs/qcobjects-gae-http-server.js.map +1 -0
- package/public/cjs/qcobjects-http-server.js +51 -0
- package/public/cjs/qcobjects-http-server.js.map +1 -0
- package/public/cjs/qcobjects-http2-server.js +54 -0
- package/public/cjs/qcobjects-http2-server.js.map +1 -0
- package/public/cjs/qcobjects-shell.js +145 -0
- package/public/cjs/qcobjects-shell.js.map +1 -0
- package/public/cjs/templates/apps/spa-local.html +0 -0
- package/public/cjs/templates/apps/spa-local.js +0 -0
- package/public/cjs/templates/pwa/sw.js +0 -0
- package/public/esm/api-client_services.mjs.map +1 -1
- package/public/esm/backend/backend-microservice-static.mjs +207 -216
- package/public/esm/backend/backend-microservice-static.mjs.map +2 -2
- package/public/esm/backend/backend-php.mjs +228 -232
- package/public/esm/backend/backend-php.mjs.map +2 -2
- package/public/esm/cli-commands-build-esbuild.mjs +295 -0
- package/public/esm/cli-commands-build-esbuild.mjs.map +7 -0
- package/public/esm/cli-commands-build-typescript.mjs +83 -0
- package/public/esm/cli-commands-build-typescript.mjs.map +7 -0
- package/public/esm/cli-commands-jira.mjs +1 -1
- package/public/esm/cli-commands-jira.mjs.map +1 -1
- package/public/esm/cli-commands-version.mjs.map +1 -1
- package/public/esm/cli-commands.mjs +7 -3
- package/public/esm/cli-commands.mjs.map +2 -2
- package/public/esm/cli-main.mjs +6 -6
- package/public/esm/cli-main.mjs.map +1 -1
- package/public/esm/client_services.mjs.map +1 -1
- package/public/esm/collab-server.mjs.map +1 -1
- package/public/esm/common-pipelog.mjs.map +1 -1
- package/public/esm/defaultsettings.mjs +68 -27
- package/public/esm/defaultsettings.mjs.map +3 -3
- package/public/esm/enterprise-commands.mjs.map +1 -1
- package/public/esm/index.mjs +1 -1
- package/public/esm/main-file.mjs.map +1 -1
- package/public/esm/main-http-gae-server.mjs +2 -2
- package/public/esm/main-http-gae-server.mjs.map +1 -1
- package/public/esm/main-http-server.mjs +2 -2
- package/public/esm/main-http-server.mjs.map +1 -1
- package/public/esm/main-http2-server.mjs +2 -2
- package/public/esm/main-http2-server.mjs.map +1 -1
- package/public/esm/qcobjects-cli.mjs +2 -2
- package/public/esm/qcobjects-cli.mjs.map +1 -1
- package/public/esm/qcobjects-collab.mjs +14 -23
- package/public/esm/qcobjects-collab.mjs.map +2 -2
- package/public/esm/qcobjects-createcert.mjs +43 -52
- package/public/esm/qcobjects-createcert.mjs.map +2 -2
- package/public/esm/qcobjects-gae-http-server.mjs +14 -23
- package/public/esm/qcobjects-gae-http-server.mjs.map +2 -2
- package/public/esm/qcobjects-http-server.mjs +14 -23
- package/public/esm/qcobjects-http-server.mjs.map +2 -2
- package/public/esm/qcobjects-http2-server.mjs +21 -31
- package/public/esm/qcobjects-http2-server.mjs.map +2 -2
- package/public/esm/qcobjects-shell.mjs +1 -1
- package/public/esm/qcobjects-shell.mjs.map +1 -1
- package/public/esm/templates/apps/spa-local.html +0 -0
- package/public/esm/templates/apps/spa-local.js +0 -0
- package/public/esm/templates/pwa/sw.js +0 -0
- package/public/esm/types/global/index.d.mjs +0 -9
- package/public/esm/types/global/index.d.mjs.map +3 -3
- package/public/types/index.d.ts +29 -3
- package/spec/support/jasmine.json +0 -0
- package/spec/testsSpec.ts +0 -0
- package/src/api-client_services.ts +1 -1
- package/src/backend/backend-microservice-static.ts +196 -196
- package/src/backend/backend-php.ts +240 -245
- package/src/cli-commands-build-esbuild.ts +375 -0
- package/src/cli-commands-build-typescript.ts +139 -0
- package/src/cli-commands-jira.ts +1 -1
- package/src/cli-commands-publish-static.ts +0 -0
- package/src/cli-commands-version.ts +1 -1
- package/src/cli-commands.ts +3 -1
- package/src/cli-main.ts +1 -1
- package/src/client_services.ts +1 -1
- package/src/collab-server.ts +1 -1
- package/src/common-pipelog.ts +1 -1
- package/src/defaultsettings.ts +65 -19
- package/src/enterprise-commands.ts +1 -1
- package/src/index.ts +0 -0
- package/src/main-file.ts +1 -1
- package/src/main-http-gae-server.ts +1 -1
- package/src/main-http-server.ts +1 -1
- package/src/main-http2-server.ts +1 -1
- package/src/qcobjects-cli.ts +1 -1
- package/src/qcobjects-collab.ts +1 -1
- package/src/qcobjects-createcert.ts +1 -1
- package/src/qcobjects-gae-http-server.ts +1 -1
- package/src/qcobjects-http-server.ts +1 -1
- package/src/qcobjects-http2-server.ts +4 -5
- package/src/qcobjects-shell.ts +1 -1
- package/src/templates/apps/spa-local.html +0 -0
- package/src/templates/apps/spa-local.js +0 -0
- package/src/templates/pwa/sw.js +0 -0
- package/src/types/global/index.d.ts +0 -0
- package/transpile.js +0 -0
- package/tsconfig.d.json +0 -0
- package/tsconfig.jasmine.json +0 -0
- package/tsconfig.json +3 -3
- package/public/cjs/api-client_services.cjs +0 -79
- package/public/cjs/api-client_services.cjs.map +0 -7
- package/public/cjs/backend/backend-microservice-static.cjs +0 -245
- package/public/cjs/backend/backend-microservice-static.cjs.map +0 -7
- package/public/cjs/backend/backend-php.cjs +0 -301
- package/public/cjs/backend/backend-php.cjs.map +0 -7
- package/public/cjs/cli-commands-jira.cjs +0 -112
- package/public/cjs/cli-commands-jira.cjs.map +0 -7
- package/public/cjs/cli-commands-publish-static.cjs +0 -109
- package/public/cjs/cli-commands-publish-static.cjs.map +0 -7
- package/public/cjs/cli-commands-version.cjs +0 -252
- package/public/cjs/cli-commands-version.cjs.map +0 -7
- package/public/cjs/cli-commands.cjs +0 -45
- package/public/cjs/cli-commands.cjs.map +0 -7
- package/public/cjs/cli-main.cjs +0 -417
- package/public/cjs/cli-main.cjs.map +0 -7
- package/public/cjs/client_services.cjs +0 -86
- package/public/cjs/client_services.cjs.map +0 -7
- package/public/cjs/collab-server.cjs +0 -444
- package/public/cjs/collab-server.cjs.map +0 -7
- package/public/cjs/common-pipelog.cjs +0 -50
- package/public/cjs/common-pipelog.cjs.map +0 -7
- package/public/cjs/defaultsettings.cjs +0 -432
- package/public/cjs/defaultsettings.cjs.map +0 -7
- package/public/cjs/enterprise-commands.cjs +0 -175
- package/public/cjs/enterprise-commands.cjs.map +0 -7
- package/public/cjs/index.cjs +0 -36
- package/public/cjs/index.cjs.map +0 -7
- package/public/cjs/main-file.cjs +0 -194
- package/public/cjs/main-file.cjs.map +0 -7
- package/public/cjs/main-http-gae-server.cjs +0 -522
- package/public/cjs/main-http-gae-server.cjs.map +0 -7
- package/public/cjs/main-http-server.cjs +0 -588
- package/public/cjs/main-http-server.cjs.map +0 -7
- package/public/cjs/main-http2-server.cjs +0 -431
- package/public/cjs/main-http2-server.cjs.map +0 -7
- package/public/cjs/qcobjects-cli.cjs +0 -92
- package/public/cjs/qcobjects-cli.cjs.map +0 -7
- package/public/cjs/qcobjects-collab.cjs +0 -43
- package/public/cjs/qcobjects-collab.cjs.map +0 -7
- package/public/cjs/qcobjects-createcert.cjs +0 -75
- package/public/cjs/qcobjects-createcert.cjs.map +0 -7
- package/public/cjs/qcobjects-gae-http-server.cjs +0 -43
- package/public/cjs/qcobjects-gae-http-server.cjs.map +0 -7
- package/public/cjs/qcobjects-http-server.cjs +0 -43
- package/public/cjs/qcobjects-http-server.cjs.map +0 -7
- package/public/cjs/qcobjects-http2-server.cjs +0 -49
- package/public/cjs/qcobjects-http2-server.cjs.map +0 -7
- package/public/cjs/qcobjects-shell.cjs +0 -185
- package/public/cjs/qcobjects-shell.cjs.map +0 -7
- package/public/cjs/types/global/index.d.cjs +0 -2
- package/public/cjs/types/global/index.d.cjs.map +0 -7
- package/public/types/index.d.ts.map +0 -1
- package/src/index.cts +0 -2
- package/src/index.mts +0 -2
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QCObjects CLI 2.5
|
|
3
|
+
* ________________
|
|
4
|
+
*
|
|
5
|
+
* Author: Jean Machuca <correojean@gmail.com>
|
|
6
|
+
*
|
|
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.
|
|
19
|
+
*
|
|
20
|
+
* Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>
|
|
21
|
+
*
|
|
22
|
+
* Everyone is permitted to copy and distribute verbatim copies of this
|
|
23
|
+
* license document, but changing it is not allowed.
|
|
24
|
+
*/
|
|
25
|
+
/*eslint no-unused-vars: "off"*/
|
|
26
|
+
/*eslint no-redeclare: "off"*/
|
|
27
|
+
/*eslint no-empty: "off"*/
|
|
28
|
+
/*eslint strict: "off"*/
|
|
29
|
+
/*eslint no-mixed-operators: "off"*/
|
|
30
|
+
/*eslint no-undef: "off"*/
|
|
31
|
+
"use strict";
|
|
32
|
+
import path from "node:path";
|
|
33
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
34
|
+
import fs from "node:fs/promises";
|
|
35
|
+
import glob from "glob";
|
|
36
|
+
import esbuild, { BuildOptions, Format } from "esbuild";
|
|
37
|
+
import alias from "esbuild-plugin-alias";
|
|
38
|
+
import { Package, InheritClass, logger } from "qcobjects";
|
|
39
|
+
|
|
40
|
+
const externalPackages = [
|
|
41
|
+
"node:fs", "node:path", "node:os", "node:util", "node:events",
|
|
42
|
+
"node:stream", "node:http", "node:https", "node:crypto", "node:zlib",
|
|
43
|
+
"node:buffer", "node:url", "node:querystring", "node:child_process",
|
|
44
|
+
"node:cluster", "node:dgram", "node:dns", "node:net", "node:readline",
|
|
45
|
+
"node:repl", "node:tls", "node:tty", "node:vm", "node:worker_threads"
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
// Function to detect and add the extension
|
|
49
|
+
const nameToExtension = (name: string, ext: string, settings: BuildOptions): string => {
|
|
50
|
+
function isPackage(name: string): boolean {
|
|
51
|
+
return !name.startsWith(".") && !name.startsWith("/") && !name.includes("/");
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const hasExtension = /\.[^/\\]+$/.test(name);
|
|
55
|
+
const isExternalPackage = name.startsWith("qcobjects") ||
|
|
56
|
+
name.startsWith("qcobjects-sdk") ||
|
|
57
|
+
name.startsWith("node:") ||
|
|
58
|
+
name.startsWith("fs") ||
|
|
59
|
+
name.startsWith("path") ||
|
|
60
|
+
name.startsWith("os") ||
|
|
61
|
+
name.startsWith("util") ||
|
|
62
|
+
name.startsWith("events") ||
|
|
63
|
+
name.startsWith("stream") ||
|
|
64
|
+
name.startsWith("http") ||
|
|
65
|
+
name.startsWith("https") ||
|
|
66
|
+
name.startsWith("crypto") ||
|
|
67
|
+
name.startsWith("zlib") ||
|
|
68
|
+
name.startsWith("buffer") ||
|
|
69
|
+
name.startsWith("url") ||
|
|
70
|
+
name.startsWith("querystring") ||
|
|
71
|
+
name.startsWith("child_process") ||
|
|
72
|
+
name.startsWith("cluster") ||
|
|
73
|
+
name.startsWith("dgram") ||
|
|
74
|
+
name.startsWith("dns") ||
|
|
75
|
+
name.startsWith("net") ||
|
|
76
|
+
name.startsWith("readline") ||
|
|
77
|
+
name.startsWith("repl") ||
|
|
78
|
+
name.startsWith("tls") ||
|
|
79
|
+
name.startsWith("tty") ||
|
|
80
|
+
name.startsWith("vm") ||
|
|
81
|
+
name.startsWith("worker_threads")
|
|
82
|
+
|| externalPackages.includes(name);
|
|
83
|
+
|
|
84
|
+
if (!hasExtension && !isPackage(name) && !isExternalPackage) {
|
|
85
|
+
name += ext;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return name;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
// Function to add .cjs and .mjs extensions to import/export/require statements
|
|
92
|
+
const addExtensions = (filePath: string, toExt: string, settings: BuildOptions): void => {
|
|
93
|
+
const content = readFileSync(filePath, "utf8");
|
|
94
|
+
const updatedContent = content
|
|
95
|
+
.replace(/(from\s+['"])(.*?)(['"])/g, (match, p1, p2, p3) => {
|
|
96
|
+
return `${p1}${nameToExtension(p2, toExt, settings)}${p3}`;
|
|
97
|
+
})
|
|
98
|
+
.replace(/(import\s+['"])(.*?)(['"])/g, (match, p1, p2, p3) => {
|
|
99
|
+
return `${p1}${nameToExtension(p2, toExt, settings)}${p3}`;
|
|
100
|
+
})
|
|
101
|
+
.replace(/(export\s+['"])(.*?)(['"])/g, (match, p1, p2, p3) => {
|
|
102
|
+
return `${p1}${nameToExtension(p2, toExt, settings)}${p3}`;
|
|
103
|
+
})
|
|
104
|
+
.replace(/(require\s*\(\s*['"])(.*?)(['"]\s*\))/g, (match, p1, p2, p3) => {
|
|
105
|
+
return `${p1}${nameToExtension(p2, toExt, settings)}${p3}`;
|
|
106
|
+
});
|
|
107
|
+
writeFileSync(filePath, updatedContent, "utf8");
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const copyDir = async (source: string, dest: string, exclude: string[]): Promise<void> => {
|
|
111
|
+
source = path.resolve(source);
|
|
112
|
+
dest = path.resolve(dest);
|
|
113
|
+
const dname = path.basename(source);
|
|
114
|
+
const dirExcluded = exclude.includes(dname);
|
|
115
|
+
|
|
116
|
+
const isDir = async (d: string): Promise<boolean> => {
|
|
117
|
+
try {
|
|
118
|
+
const stat = await fs.stat(d);
|
|
119
|
+
return stat.isDirectory();
|
|
120
|
+
} catch {
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
const isFile = async (d: string): Promise<boolean> => {
|
|
126
|
+
try {
|
|
127
|
+
const stat = await fs.stat(d);
|
|
128
|
+
return stat.isFile();
|
|
129
|
+
} catch {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
if (await isDir(source) && !dirExcluded) {
|
|
135
|
+
await fs.mkdir(dest, { recursive: true });
|
|
136
|
+
const paths = await fs.readdir(source, { withFileTypes: true });
|
|
137
|
+
const dirs = paths.filter(d => d.isDirectory());
|
|
138
|
+
const files = paths.filter(f => f.isFile());
|
|
139
|
+
|
|
140
|
+
for (const f of files) {
|
|
141
|
+
const sourceFile = path.resolve(source, f.name);
|
|
142
|
+
const destFile = path.resolve(dest, f.name);
|
|
143
|
+
const fileExcluded = exclude.includes(f.name);
|
|
144
|
+
if (await isFile(sourceFile) && !fileExcluded) {
|
|
145
|
+
logger.debug(`[build:esbuild] Copying files from ${sourceFile} to ${destFile} excluding ${exclude}...`);
|
|
146
|
+
await fs.copyFile(sourceFile, destFile);
|
|
147
|
+
logger.debug(`[build:esbuild] Copying files from ${sourceFile} to ${destFile} excluding ${exclude}...DONE!`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
for (const d of dirs) {
|
|
152
|
+
const sourceDir = path.resolve(source, d.name);
|
|
153
|
+
const destDir = path.resolve(dest, d.name);
|
|
154
|
+
await copyDir(sourceDir, destDir, exclude);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
const ignorePlugin = {
|
|
160
|
+
name: "transform-qcobjects-imports",
|
|
161
|
+
setup(build: any) {
|
|
162
|
+
build.onResolve({ filter: /^(qcobjects|qcobjects-sdk)$/ }, (args: any) => {
|
|
163
|
+
if (args.kind === "dynamic-import") {
|
|
164
|
+
return {
|
|
165
|
+
path: args.path,
|
|
166
|
+
namespace: "qcobjects-transform"
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
return {
|
|
170
|
+
external: true,
|
|
171
|
+
path: args.path
|
|
172
|
+
};
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
build.onResolve({ filter: /.*/, namespace: "file" }, (args: any) => {
|
|
176
|
+
if (args.kind === "dynamic-import") {
|
|
177
|
+
return {
|
|
178
|
+
external: true,
|
|
179
|
+
path: args.path
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
return null;
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
build.onLoad({ filter: /.*/, namespace: "qcobjects-transform" }, (args: any) => {
|
|
186
|
+
return {
|
|
187
|
+
contents: `
|
|
188
|
+
module.exports = __toESM(require("${args.path}"), true);
|
|
189
|
+
`,
|
|
190
|
+
loader: "js"
|
|
191
|
+
};
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
export class CommandHandler extends InheritClass {
|
|
197
|
+
choiceOption: {
|
|
198
|
+
[x: string]: any;
|
|
199
|
+
build_esbuild: () => Promise<void>;
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
constructor({
|
|
203
|
+
switchCommander
|
|
204
|
+
}: { switchCommander: any }) {
|
|
205
|
+
super({ switchCommander });
|
|
206
|
+
this.choiceOption = {
|
|
207
|
+
async build_esbuild() {
|
|
208
|
+
try {
|
|
209
|
+
logger.info("[build:esbuild] Starting esbuild process...");
|
|
210
|
+
|
|
211
|
+
// Get all TypeScript entry points
|
|
212
|
+
const entryPoints = glob.sync("src/**/*.ts");
|
|
213
|
+
|
|
214
|
+
// Copy templates
|
|
215
|
+
await copyDir("./src/templates", "./build/templates", []);
|
|
216
|
+
await copyDir("./src/templates", "./public/cjs/templates", []);
|
|
217
|
+
await copyDir("./src/templates", "./public/esm/templates", []);
|
|
218
|
+
await copyDir("./src/templates", "./public/browser/templates", []);
|
|
219
|
+
|
|
220
|
+
const baseSettings: BuildOptions = {
|
|
221
|
+
entryPoints,
|
|
222
|
+
bundle: false,
|
|
223
|
+
outdir: "public/cjs",
|
|
224
|
+
format: "cjs" as Format,
|
|
225
|
+
target: ["node22"],
|
|
226
|
+
tsconfig: "tsconfig.json",
|
|
227
|
+
globalName: "global",
|
|
228
|
+
minify: false,
|
|
229
|
+
keepNames: true,
|
|
230
|
+
sourcemap: true,
|
|
231
|
+
splitting: false,
|
|
232
|
+
chunkNames: "chunks/[name]-[hash]",
|
|
233
|
+
plugins: [
|
|
234
|
+
ignorePlugin,
|
|
235
|
+
alias({
|
|
236
|
+
"types": path.join(process.cwd(), "src/types/global/index.d.ts")
|
|
237
|
+
})
|
|
238
|
+
]
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
const cjsSettings: BuildOptions = {
|
|
242
|
+
...baseSettings,
|
|
243
|
+
outdir: "public/cjs",
|
|
244
|
+
format: "cjs" as Format,
|
|
245
|
+
platform: "node",
|
|
246
|
+
outExtension: {
|
|
247
|
+
".js": ".cjs"
|
|
248
|
+
},
|
|
249
|
+
plugins: [
|
|
250
|
+
ignorePlugin,
|
|
251
|
+
{
|
|
252
|
+
name: "transform-dynamic-imports",
|
|
253
|
+
setup(build: any) {
|
|
254
|
+
build.onEnd(() => {
|
|
255
|
+
const files = glob.sync("public/cjs/**/*.cjs");
|
|
256
|
+
for (const file of files) {
|
|
257
|
+
let content = readFileSync(file, "utf8");
|
|
258
|
+
content = content.replace(
|
|
259
|
+
/await\s+import\(['"]([^'"]+)['"]\)/g,
|
|
260
|
+
"__toESM(require(\"$1\"), true)"
|
|
261
|
+
);
|
|
262
|
+
writeFileSync(file, content, "utf8");
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
name: "add-extensions",
|
|
269
|
+
setup(build: any) {
|
|
270
|
+
build.onEnd(() => {
|
|
271
|
+
entryPoints.forEach((entry: string) => {
|
|
272
|
+
const outputFilePath = path.join("./public/cjs", entry.replace("src/", "").replace(".ts", ".cjs"));
|
|
273
|
+
addExtensions(outputFilePath, ".cjs", cjsSettings);
|
|
274
|
+
});
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
]
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
const esmSettings: BuildOptions = {
|
|
282
|
+
...baseSettings,
|
|
283
|
+
outdir: "public/esm",
|
|
284
|
+
format: "esm" as Format,
|
|
285
|
+
platform: "browser",
|
|
286
|
+
outExtension: {
|
|
287
|
+
".js": ".mjs"
|
|
288
|
+
},
|
|
289
|
+
plugins: [
|
|
290
|
+
{
|
|
291
|
+
name: "transform-requires",
|
|
292
|
+
setup(build: any) {
|
|
293
|
+
build.onEnd(() => {
|
|
294
|
+
const files = glob.sync("public/esm/**/*.mjs");
|
|
295
|
+
for (const file of files) {
|
|
296
|
+
let content = readFileSync(file, "utf8");
|
|
297
|
+
// Transform require statements to dynamic imports
|
|
298
|
+
content = content.replace(
|
|
299
|
+
/const\s+{([^}]+)}\s*=\s*require\(['"]([^'"]+)['"]\)/g,
|
|
300
|
+
"import { $1 } from \"$2\""
|
|
301
|
+
);
|
|
302
|
+
content = content.replace(
|
|
303
|
+
/const\s+([^=]+)\s*=\s*require\(['"]([^'"]+)['"]\)/g,
|
|
304
|
+
"import $1 from \"$2\""
|
|
305
|
+
);
|
|
306
|
+
writeFileSync(file, content, "utf8");
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
name: "add-extensions",
|
|
313
|
+
setup(build: any) {
|
|
314
|
+
build.onEnd(() => {
|
|
315
|
+
entryPoints.forEach((entry: string) => {
|
|
316
|
+
const outputFilePath = path.join("./public/esm", entry.replace("src/", "").replace(".ts", ".mjs"));
|
|
317
|
+
addExtensions(outputFilePath, ".mjs", esmSettings);
|
|
318
|
+
});
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
]
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
const browserSettings: BuildOptions = {
|
|
326
|
+
...baseSettings,
|
|
327
|
+
outdir: "public/browser",
|
|
328
|
+
format: "iife" as Format,
|
|
329
|
+
platform: "browser",
|
|
330
|
+
outExtension: {
|
|
331
|
+
".js": ".js"
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
// Build all formats
|
|
336
|
+
await Promise.all([
|
|
337
|
+
esbuild.build(cjsSettings),
|
|
338
|
+
esbuild.build(esmSettings),
|
|
339
|
+
esbuild.build(browserSettings)
|
|
340
|
+
]);
|
|
341
|
+
|
|
342
|
+
logger.info("[build:esbuild] Build process completed successfully!");
|
|
343
|
+
} catch (e: any) {
|
|
344
|
+
logger.error(`[build:esbuild] Build process failed: ${e.message}`);
|
|
345
|
+
process.exit(1);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
const commandHandler = this;
|
|
351
|
+
logger.debug("Loading command build:esbuild...");
|
|
352
|
+
|
|
353
|
+
// Register both commands
|
|
354
|
+
switchCommander.program.command("build:esbuild")
|
|
355
|
+
.allowExcessArguments(false)
|
|
356
|
+
.description("Builds the project using esbuild for CJS, ESM, and browser formats")
|
|
357
|
+
.action(function () {
|
|
358
|
+
commandHandler.choiceOption.build_esbuild.call(commandHandler);
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
// Add alias
|
|
362
|
+
switchCommander.program.command("build:esb")
|
|
363
|
+
.allowExcessArguments(false)
|
|
364
|
+
.description("Alias for build:esbuild - Builds the project using esbuild")
|
|
365
|
+
.action(function () {
|
|
366
|
+
commandHandler.choiceOption.build_esbuild.call(commandHandler);
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
logger.debug("Loading command build:esbuild... DONE.");
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
Package("com.qcobjects.cli.commands.build.esbuild", [
|
|
374
|
+
CommandHandler
|
|
375
|
+
]);
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QCObjects CLI 2.5
|
|
3
|
+
* ________________
|
|
4
|
+
*
|
|
5
|
+
* Author: Jean Machuca <correojean@gmail.com>
|
|
6
|
+
*
|
|
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.
|
|
19
|
+
*
|
|
20
|
+
* Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>
|
|
21
|
+
*
|
|
22
|
+
* Everyone is permitted to copy and distribute verbatim copies of this
|
|
23
|
+
* license document, but changing it is not allowed.
|
|
24
|
+
*/
|
|
25
|
+
/*eslint no-unused-vars: "off"*/
|
|
26
|
+
/*eslint no-redeclare: "off"*/
|
|
27
|
+
/*eslint no-empty: "off"*/
|
|
28
|
+
/*eslint strict: "off"*/
|
|
29
|
+
/*eslint no-mixed-operators: "off"*/
|
|
30
|
+
/*eslint no-undef: "off"*/
|
|
31
|
+
"use strict";
|
|
32
|
+
import path from "node:path";
|
|
33
|
+
import ts from "typescript";
|
|
34
|
+
import { Package, InheritClass, logger } from "qcobjects";
|
|
35
|
+
|
|
36
|
+
export class CommandHandler extends InheritClass {
|
|
37
|
+
choiceOption: {
|
|
38
|
+
[x: string]: any;
|
|
39
|
+
build_typescript: (configFile: string) => void;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
constructor({
|
|
43
|
+
switchCommander
|
|
44
|
+
}: { switchCommander: any }) {
|
|
45
|
+
super({ switchCommander });
|
|
46
|
+
this.choiceOption = {
|
|
47
|
+
build_typescript(configFile) {
|
|
48
|
+
try {
|
|
49
|
+
logger.info(`[build:typescript] Building TypeScript with config file: ${configFile}...`);
|
|
50
|
+
|
|
51
|
+
// Resolve the path to the tsconfig file
|
|
52
|
+
const configPath = path.resolve(process.cwd(), configFile);
|
|
53
|
+
|
|
54
|
+
// Parse the tsconfig file
|
|
55
|
+
const parsedCommandLine = ts.getParsedCommandLineOfConfigFile(configPath, {}, {
|
|
56
|
+
...ts.sys,
|
|
57
|
+
onUnRecoverableConfigFileDiagnostic: diagnostic => {
|
|
58
|
+
logger.warn(ts.formatDiagnostic(diagnostic, {
|
|
59
|
+
getCanonicalFileName: (fileName) => fileName,
|
|
60
|
+
getCurrentDirectory: ts.sys.getCurrentDirectory,
|
|
61
|
+
getNewLine: () => ts.sys.newLine,
|
|
62
|
+
}));
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
if (!parsedCommandLine) {
|
|
68
|
+
logger.warn('Failed to parse tsconfig file');
|
|
69
|
+
process.exit(1);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Create a program with the parsed settings
|
|
73
|
+
const program = ts.createProgram({
|
|
74
|
+
rootNames: parsedCommandLine.fileNames,
|
|
75
|
+
options: parsedCommandLine.options,
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// Emit the compiled files
|
|
79
|
+
const emitResult = program.emit();
|
|
80
|
+
|
|
81
|
+
// Report any diagnostics (errors or warnings)
|
|
82
|
+
const allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
|
|
83
|
+
|
|
84
|
+
allDiagnostics.forEach(diagnostic => {
|
|
85
|
+
if (diagnostic.file && diagnostic.start) {
|
|
86
|
+
const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
|
87
|
+
const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
|
|
88
|
+
logger.warn(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
|
|
89
|
+
} else {
|
|
90
|
+
logger.warn(ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'));
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
// Check if any files were emitted
|
|
95
|
+
const emittedFiles = emitResult.emittedFiles || [];
|
|
96
|
+
if (emittedFiles.length > 0) {
|
|
97
|
+
logger.info('Emitted files:');
|
|
98
|
+
emittedFiles.forEach(file => logger.info(file));
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Exit with an appropriate code
|
|
102
|
+
const exitCode = emitResult.emitSkipped ? 1 : 0;
|
|
103
|
+
logger.info(`Process completed with code '${exitCode}'.`);
|
|
104
|
+
if (exitCode !== 0) {
|
|
105
|
+
process.exit(exitCode);
|
|
106
|
+
}
|
|
107
|
+
} catch (e: any) {
|
|
108
|
+
logger.warn(`Something went wrong trying to build TypeScript: ${e.message}`);
|
|
109
|
+
process.exit(1);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const commandHandler = this;
|
|
115
|
+
logger.debug("Loading command build:typescript...");
|
|
116
|
+
|
|
117
|
+
// Register both commands
|
|
118
|
+
const buildCommand = switchCommander.program.command("build:typescript <configFile>")
|
|
119
|
+
.allowExcessArguments(false)
|
|
120
|
+
.description("Builds TypeScript files using the specified config file")
|
|
121
|
+
.action(function (configFile: string) {
|
|
122
|
+
commandHandler.choiceOption.build_typescript.call(commandHandler, configFile);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
// Add alias
|
|
126
|
+
switchCommander.program.command("build:ts <configFile>")
|
|
127
|
+
.allowExcessArguments(false)
|
|
128
|
+
.description("Alias for build:typescript - Builds TypeScript files using the specified config file")
|
|
129
|
+
.action(function (configFile: string) {
|
|
130
|
+
commandHandler.choiceOption.build_typescript.call(commandHandler, configFile);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
logger.debug("Loading command build:typescript... DONE.");
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
Package("com.qcobjects.cli.commands.build.typescript", [
|
|
138
|
+
CommandHandler
|
|
139
|
+
]);
|
package/src/cli-commands-jira.ts
CHANGED
|
File without changes
|
package/src/cli-commands.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* QCObjects CLI 2.
|
|
2
|
+
* QCObjects CLI 2.5
|
|
3
3
|
* ________________
|
|
4
4
|
*
|
|
5
5
|
* Author: Jean Machuca <correojean@gmail.com>
|
|
@@ -35,3 +35,5 @@
|
|
|
35
35
|
export * as versionCommand from "./cli-commands-version";
|
|
36
36
|
export * as jiraCommand from "./cli-commands-jira";
|
|
37
37
|
export * as publishStatic from "./cli-commands-publish-static";
|
|
38
|
+
export * as buildTypescript from "./cli-commands-build-typescript";
|
|
39
|
+
export * as buildEsbuild from "./cli-commands-build-esbuild";
|
package/src/cli-main.ts
CHANGED
package/src/client_services.ts
CHANGED
package/src/collab-server.ts
CHANGED
package/src/common-pipelog.ts
CHANGED