@simplysm/sd-cli 7.0.80 → 7.0.145
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/dist/bin/sd-cli.mjs +36 -6
- package/dist/build-tool/SdCliCordova.d.ts +4 -4
- package/dist/build-tool/SdCliCordova.mjs +108 -107
- package/dist/build-tool/SdCliElectron.d.ts +9 -0
- package/dist/build-tool/SdCliElectron.mjs +66 -0
- package/dist/build-tool/SdCliGithubApi.d.ts +14 -0
- package/dist/build-tool/SdCliGithubApi.mjs +96 -0
- package/dist/builder/SdCliClientBuilder.mjs +151 -65
- package/dist/builder/SdCliJsLibBuilder.mjs +4 -4
- package/dist/builder/SdCliServerBuilder.mjs +6 -7
- package/dist/builder/SdCliTsLibBuilder.mjs +4 -4
- package/dist/commons.d.ts +38 -11
- package/dist/entry-points/SdCliLocalUpdate.mjs +3 -3
- package/dist/entry-points/SdCliWorkspace.mjs +48 -6
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +3 -1
- package/dist/ng-tools/babel/SdCliBbFileMetadata.mjs +2 -2
- package/dist/ng-tools/babel/SdCliBbRootMetadata.d.ts +1 -0
- package/dist/ng-tools/babel/SdCliBbRootMetadata.mjs +29 -3
- package/dist/packages/SdCliPackage.mjs +13 -2
- package/package.json +13 -7
- package/src/bin/sd-cli.ts +46 -7
- package/src/build-tool/SdCliCordova.ts +133 -141
- package/src/build-tool/SdCliElectron.ts +76 -0
- package/src/build-tool/SdCliGithubApi.ts +117 -0
- package/src/builder/SdCliClientBuilder.ts +165 -65
- package/src/builder/SdCliJsLibBuilder.ts +3 -3
- package/src/builder/SdCliServerBuilder.ts +6 -7
- package/src/builder/SdCliTsLibBuilder.ts +3 -3
- package/src/commons.ts +35 -11
- package/src/entry-points/SdCliLocalUpdate.ts +2 -2
- package/src/entry-points/SdCliWorkspace.ts +47 -6
- package/src/index.ts +2 -0
- package/src/ng-tools/babel/SdCliBbFileMetadata.ts +1 -1
- package/src/ng-tools/babel/SdCliBbRootMetadata.ts +30 -2
- package/src/packages/SdCliPackage.ts +18 -1
- package/tsconfig.json +3 -0
|
@@ -46,7 +46,7 @@ export class SdCliBbFileMetadata {
|
|
|
46
46
|
|
|
47
47
|
public constructor(public readonly filePath: string) {
|
|
48
48
|
let realFilePath: string | undefined;
|
|
49
|
-
for (const ext of ["", ".mjs", ".cjs", ".js"]) {
|
|
49
|
+
for (const ext of ["", ".mjs", ".cjs", ".js"/*, "/index.mjs", "/index.cjs", "/index.js"*/]) {
|
|
50
50
|
if (FsUtil.exists(filePath + ext) && !FsUtil.stat(filePath + ext).isDirectory()) {
|
|
51
51
|
realFilePath = filePath + ext;
|
|
52
52
|
break;
|
|
@@ -144,7 +144,10 @@ export class SdCliBbRootMetadata {
|
|
|
144
144
|
|
|
145
145
|
const entryFilePath = npmConfig["es2015"] ?? npmConfig["browser"] ?? npmConfig["module"] ?? npmConfig["main"] ?? npmConfig["default"];
|
|
146
146
|
if (typeof entryFilePath === "string") {
|
|
147
|
-
|
|
147
|
+
const realPath = this._getRealFilePath(path.resolve(ngDepPath, entryFilePath));
|
|
148
|
+
if (realPath != null) {
|
|
149
|
+
entryMap.set(npmConfig.name, realPath);
|
|
150
|
+
}
|
|
148
151
|
}
|
|
149
152
|
|
|
150
153
|
if (npmConfig.exports) {
|
|
@@ -168,7 +171,10 @@ export class SdCliBbRootMetadata {
|
|
|
168
171
|
const exportPath = path.resolve(ngDepPath, expEntryFilePath);
|
|
169
172
|
const exportResult = this._getGlobExportResult(PathUtil.posix(npmConfig.name, exportKey), exportPath);
|
|
170
173
|
for (const exportResultItem of exportResult) {
|
|
171
|
-
|
|
174
|
+
const realPath = this._getRealFilePath(exportResultItem.target);
|
|
175
|
+
if (realPath != null) {
|
|
176
|
+
entryMap.set(exportResultItem.name, realPath);
|
|
177
|
+
}
|
|
172
178
|
}
|
|
173
179
|
}
|
|
174
180
|
}
|
|
@@ -178,6 +184,28 @@ export class SdCliBbRootMetadata {
|
|
|
178
184
|
return entryMap;
|
|
179
185
|
}
|
|
180
186
|
|
|
187
|
+
private _getRealFilePath(itemPath: string): string | undefined {
|
|
188
|
+
if (!FsUtil.exists(itemPath)) {
|
|
189
|
+
for (const ext of [".mjs", ".cjs", ".js"]) {
|
|
190
|
+
if (FsUtil.exists(itemPath + ext)) {
|
|
191
|
+
return itemPath + ext;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
else if (FsUtil.stat(itemPath).isFile()) {
|
|
196
|
+
return itemPath;
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
for (const fileName of ["index.mjs", "index.cjs", "index.js"]) {
|
|
200
|
+
if (FsUtil.exists(path.resolve(itemPath, fileName))) {
|
|
201
|
+
return path.resolve(itemPath, fileName);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return undefined;
|
|
207
|
+
}
|
|
208
|
+
|
|
181
209
|
private _getGlobExportResult(globName: string, globTarget: string): { name: string; target: string }[] {
|
|
182
210
|
if (globName.includes("*") && globTarget.includes("*")) {
|
|
183
211
|
const result: { name: string; target: string }[] = [];
|
|
@@ -11,6 +11,7 @@ import { SdCliClientBuilder } from "../builder/SdCliClientBuilder";
|
|
|
11
11
|
import { NextHandleFunction } from "connect";
|
|
12
12
|
import { SdStorage } from "@simplysm/sd-storage";
|
|
13
13
|
import ts from "typescript";
|
|
14
|
+
import { SdCliGithubApi } from "../build-tool/SdCliGithubApi";
|
|
14
15
|
|
|
15
16
|
export class SdCliPackage extends EventEmitter {
|
|
16
17
|
private readonly _npmConfig: INpmConfig;
|
|
@@ -96,7 +97,23 @@ export class SdCliPackage extends EventEmitter {
|
|
|
96
97
|
}
|
|
97
98
|
}
|
|
98
99
|
else {
|
|
99
|
-
if (this.config.publish.type === "
|
|
100
|
+
if (this.config.publish.type === "github") {
|
|
101
|
+
const repoUrl = typeof this._npmConfig.repository === "string" ? this._npmConfig.repository : this._npmConfig.repository.url;
|
|
102
|
+
const repoOwner = repoUrl.split("/").slice(-2)[0];
|
|
103
|
+
const repoName = repoUrl.split("/").slice(-2)[1].replace(/\..*/g, "");
|
|
104
|
+
|
|
105
|
+
const github = new SdCliGithubApi(
|
|
106
|
+
this.config.publish.apiKey,
|
|
107
|
+
repoOwner,
|
|
108
|
+
repoName
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
await github.uploadAsync(this._npmConfig.version, this.config.publish.files.map((item) => ({
|
|
112
|
+
buffer: FsUtil.readFileBuffer(path.resolve(this.rootPath, "dist", item.from)),
|
|
113
|
+
name: item.to
|
|
114
|
+
})));
|
|
115
|
+
}
|
|
116
|
+
else if (this.config.publish.type === "ftp" || this.config.publish.type === "ftps" || this.config.publish.type === "sftp") {
|
|
100
117
|
const tsconfigPath = path.resolve(this.rootPath, "tsconfig-build.json");
|
|
101
118
|
const tsconfig = FsUtil.readJson(tsconfigPath);
|
|
102
119
|
const parsedTsconfig = ts.parseJsonConfigFileContent(tsconfig, ts.sys, this.rootPath, tsconfig.angularCompilerOptions);
|