@speedkit/cli 2.12.0 → 2.14.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.
- package/CHANGELOG.md +15 -0
- package/README.md +1 -1
- package/dist/commands/document-handler.d.ts +1 -1
- package/dist/commands/document-handler.js +4 -4
- package/dist/commands/find-pops.d.ts +1 -1
- package/dist/commands/find-pops.js +21 -18
- package/dist/commands/login.d.ts +1 -1
- package/dist/commands/login.js +4 -4
- package/dist/commands/onboarding.d.ts +1 -1
- package/dist/commands/onboarding.js +12 -4
- package/dist/commands/param-diff.d.ts +2 -2
- package/dist/commands/param-diff.js +16 -16
- package/dist/commands/pop-prewarm.d.ts +2 -2
- package/dist/commands/pop-prewarm.js +20 -13
- package/dist/commands/prewarm.d.ts +2 -2
- package/dist/commands/prewarm.js +35 -19
- package/dist/commands/pull.d.ts +1 -1
- package/dist/commands/pull.js +2 -2
- package/dist/commands/wpt-launcher.d.ts +2 -2
- package/dist/commands/wpt-launcher.js +35 -19
- package/dist/helpers/CustomerConfig.d.ts +1 -1
- package/dist/helpers/CustomerConfig.js +36 -35
- package/dist/helpers/file-helper.js +6 -6
- package/dist/services/athena-service.js +16 -12
- package/dist/services/config-api-service.d.ts +3 -3
- package/dist/services/config-api-service.js +29 -17
- package/dist/services/diff/diff-service.js +26 -18
- package/dist/services/diff/index.d.ts +3 -3
- package/dist/services/diff-service.d.ts +1 -1
- package/dist/services/diff-service.js +12 -12
- package/dist/services/onboarding/config-renderer/speed-kit-install-context.d.ts +1 -1
- package/dist/services/onboarding/config-renderer/speed-kit-install-context.js +20 -20
- package/dist/services/pull/index.d.ts +3 -3
- package/dist/services/pull/pull-service-model.js +13 -10
- package/dist/services/pull/pull-service.js +12 -6
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
|
@@ -21,17 +21,17 @@ class DiffService {
|
|
|
21
21
|
this.tempPath = await (0, file_helper_1.createTemporalDir)();
|
|
22
22
|
}
|
|
23
23
|
if (!this.tempPath) {
|
|
24
|
-
this.cli.writeError(
|
|
24
|
+
this.cli.writeError("No temporary Directory found and unable to create a new temporary Directory");
|
|
25
25
|
this.cli.exit(1);
|
|
26
26
|
}
|
|
27
27
|
return this.tempPath;
|
|
28
28
|
}
|
|
29
29
|
async writeContentToTemporalFile(tempFileName, content) {
|
|
30
30
|
if (!content) {
|
|
31
|
-
content =
|
|
31
|
+
content = "No file was found";
|
|
32
32
|
}
|
|
33
|
-
const resolveFilePath = path_1.default.join(await this.getTemporalDirectoryPath() + `/${tempFileName}`);
|
|
34
|
-
await fs.writeFile(resolveFilePath, content.replace(/\r?\n/gm,
|
|
33
|
+
const resolveFilePath = path_1.default.join((await this.getTemporalDirectoryPath()) + `/${tempFileName}`);
|
|
34
|
+
await fs.writeFile(resolveFilePath, content.replace(/\r?\n/gm, "\n"));
|
|
35
35
|
return resolveFilePath;
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
@@ -39,14 +39,14 @@ class DiffService {
|
|
|
39
39
|
* @param content
|
|
40
40
|
*/
|
|
41
41
|
trimContent(content) {
|
|
42
|
-
return content.replace(/[\n\r\s]/g,
|
|
42
|
+
return content.replace(/[\n\r\s]/g, "");
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
45
|
* @param content1
|
|
46
46
|
* @param content2
|
|
47
47
|
* @return returns true if both contents are equal otherwise returns false.
|
|
48
48
|
*/
|
|
49
|
-
isContentEqual(content1 =
|
|
49
|
+
isContentEqual(content1 = "", content2 = "") {
|
|
50
50
|
return this.trimContent(content1) === this.trimContent(content2);
|
|
51
51
|
}
|
|
52
52
|
async shouldDeployModule(moduleName, remoteModule, localFilePath) {
|
|
@@ -63,14 +63,14 @@ class DiffService {
|
|
|
63
63
|
let content1;
|
|
64
64
|
let content2;
|
|
65
65
|
try {
|
|
66
|
-
content1 = await fs.readFile(filePath1, { encoding:
|
|
66
|
+
content1 = await fs.readFile(filePath1, { encoding: "utf8", flag: "r" });
|
|
67
67
|
}
|
|
68
68
|
catch (error) {
|
|
69
69
|
this.cli.writeError(`Error reading ${path_1.default.basename(filePath1)}: ${error.message}`);
|
|
70
70
|
this.cli.exit(1);
|
|
71
71
|
}
|
|
72
72
|
try {
|
|
73
|
-
content2 = await fs.readFile(filePath2, { encoding:
|
|
73
|
+
content2 = await fs.readFile(filePath2, { encoding: "utf8", flag: "r" });
|
|
74
74
|
}
|
|
75
75
|
catch (error) {
|
|
76
76
|
this.cli.writeError(`Error reading ${path_1.default.basename(filePath2)}: ${error.message}`);
|
|
@@ -83,10 +83,10 @@ class DiffService {
|
|
|
83
83
|
else if (hide) {
|
|
84
84
|
return true;
|
|
85
85
|
}
|
|
86
|
-
|
|
86
|
+
const isWindows = process.platform.startsWith("win");
|
|
87
87
|
let ideaCommandAvailable;
|
|
88
88
|
try {
|
|
89
|
-
(0, child_process_1.execSync)(`idea diff "${filePath1}" "${filePath2}"`, { stdio:
|
|
89
|
+
(0, child_process_1.execSync)(`idea diff "${filePath1}" "${filePath2}"`, { stdio: "pipe" });
|
|
90
90
|
ideaCommandAvailable = true;
|
|
91
91
|
}
|
|
92
92
|
catch {
|
|
@@ -95,10 +95,10 @@ class DiffService {
|
|
|
95
95
|
try {
|
|
96
96
|
if (!ideaCommandAvailable) {
|
|
97
97
|
if (isWindows) {
|
|
98
|
-
(0, child_process_1.execSync)(`"%IDEA_INITIAL_DIRECTORY%\\idea" diff ${filePath1} ${filePath2}`, { stdio:
|
|
98
|
+
(0, child_process_1.execSync)(`"%IDEA_INITIAL_DIRECTORY%\\idea" diff ${filePath1} ${filePath2}`, { stdio: "pipe" });
|
|
99
99
|
}
|
|
100
100
|
else {
|
|
101
|
-
(0, child_process_1.execSync)(`"$IDEA_INITIAL_DIRECTORY/idea" diff ${filePath1} ${filePath2}`, { stdio:
|
|
101
|
+
(0, child_process_1.execSync)(`"$IDEA_INITIAL_DIRECTORY/idea" diff ${filePath1} ${filePath2}`, { stdio: "pipe" });
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
}
|
|
@@ -17,6 +17,6 @@ export declare class SpeedKitInstallContext {
|
|
|
17
17
|
* @returns {Promise<string>} a Promise which resolves to the latest dynamic fetcher
|
|
18
18
|
*/
|
|
19
19
|
bundleDynamicFetcher(): Promise<string>;
|
|
20
|
-
getSpeedKitInstallJs(): Promise<string>;
|
|
21
20
|
private getConfigSpeedKit;
|
|
21
|
+
getSpeedKitInstallJs(): Promise<string>;
|
|
22
22
|
}
|
|
@@ -42,16 +42,32 @@ class SpeedKitInstallContext {
|
|
|
42
42
|
target: "es6",
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
+
getConfigSpeedKit() {
|
|
46
|
+
const configString = this.files
|
|
47
|
+
.getByName(files_1.INTEGRATION_FILES.CONFIG.SPEED_KIT)
|
|
48
|
+
.getContent();
|
|
49
|
+
if (!this.isLocalRuntime) {
|
|
50
|
+
return configString;
|
|
51
|
+
}
|
|
52
|
+
if (configString.includes("delayRacedOrigin")) {
|
|
53
|
+
return configString.replace(/delayRacedOrigin:[^\d,|](\d*)[^,]*,/, (config, value) => {
|
|
54
|
+
return config.replace(value, "100");
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return configString.replace(/window\.speedKit[^{]*=[^{]*{/, (configOpenTag) => {
|
|
58
|
+
return configOpenTag + `\n delayRacedOrigin: 100,\n`;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
45
61
|
async getSpeedKitInstallJs() {
|
|
46
62
|
const configJs = this.skTemplate.render({
|
|
47
63
|
config: this.getConfigSpeedKit(),
|
|
64
|
+
forceInstall: this.customerConfig.forceInstall,
|
|
65
|
+
installPath: this.customerConfig.installPath,
|
|
66
|
+
installParams: this.customerConfig.installParams,
|
|
67
|
+
domain: this.customerConfig.domain,
|
|
48
68
|
df: this.files
|
|
49
69
|
.getByName(files_1.INTEGRATION_FILES.CUSTOM.DYNAMIC_FETCHER)
|
|
50
70
|
.getContent(),
|
|
51
|
-
domain: this.customerConfig.domain,
|
|
52
|
-
forceInstall: this.customerConfig.forceInstall,
|
|
53
|
-
installParams: this.customerConfig.installParams,
|
|
54
|
-
installPath: this.customerConfig.installPath,
|
|
55
71
|
});
|
|
56
72
|
return this.bundler.bundle({
|
|
57
73
|
basePaths: IMPORT_PATHS,
|
|
@@ -70,21 +86,5 @@ class SpeedKitInstallContext {
|
|
|
70
86
|
logLevel: "error",
|
|
71
87
|
});
|
|
72
88
|
}
|
|
73
|
-
getConfigSpeedKit() {
|
|
74
|
-
const configString = this.files
|
|
75
|
-
.getByName(files_1.INTEGRATION_FILES.CONFIG.SPEED_KIT)
|
|
76
|
-
.getContent();
|
|
77
|
-
if (!this.isLocalRuntime) {
|
|
78
|
-
return configString;
|
|
79
|
-
}
|
|
80
|
-
if (configString.includes("delayRacedOrigin")) {
|
|
81
|
-
return configString.replace(/delayRacedOrigin:[^\d,|](\d*)[^,]*,/, (config, value) => {
|
|
82
|
-
return config.replace(value, "100");
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
return configString.replace(/window\.speedKit[^{]*=[^{]*{/, (configOpenTag) => {
|
|
86
|
-
return configOpenTag + `\n delayRacedOrigin: 100,\n`;
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
89
|
}
|
|
90
90
|
exports.SpeedKitInstallContext = SpeedKitInstallContext;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export * from "./pull-service-model";
|
|
2
|
+
export * from "./pull-service-factory";
|
|
3
|
+
export * from "./pull-service";
|
|
@@ -4,7 +4,7 @@ exports.InstallResourceToFileMapping = exports.PullContext = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const dotenv = tslib_1.__importStar(require("dotenv"));
|
|
6
6
|
dotenv.config();
|
|
7
|
-
const DEFAULT_CONFIG_NAME =
|
|
7
|
+
const DEFAULT_CONFIG_NAME = "production";
|
|
8
8
|
class PullContext {
|
|
9
9
|
customerPath;
|
|
10
10
|
configName;
|
|
@@ -15,13 +15,16 @@ class PullContext {
|
|
|
15
15
|
}
|
|
16
16
|
exports.PullContext = PullContext;
|
|
17
17
|
exports.InstallResourceToFileMapping = {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
config: { fileName: "config_SpeedKit", extension: "js" },
|
|
19
|
+
documentHandlerConfig: {
|
|
20
|
+
fileName: "config_documentHandler",
|
|
21
|
+
extension: "js",
|
|
22
|
+
},
|
|
23
|
+
dynamicFetcherConfig: { fileName: "config_dynamicBlocks", extension: "es6" },
|
|
24
|
+
custom: { fileName: "config_loadHandler", extension: "js" },
|
|
25
|
+
loader: { fileName: "custom_loader", extension: "js" },
|
|
26
|
+
sw: { fileName: "custom_sw", extension: "js" },
|
|
27
|
+
documentHandler: { fileName: "custom_documentHandler", extension: "js" },
|
|
28
|
+
dynamicFetcher: { fileName: "custom_dynamicFetcher", extension: "js" },
|
|
29
|
+
customStyle: { fileName: "config_dynamicStyles", extension: "css" },
|
|
27
30
|
};
|
|
@@ -44,22 +44,25 @@ class PullService {
|
|
|
44
44
|
}
|
|
45
45
|
async updateLocalFileByInstallResource(installResource, key) {
|
|
46
46
|
const installResourceContent = installResource[key];
|
|
47
|
-
const fileName = _1.InstallResourceToFileMapping[key][
|
|
48
|
-
const extension = _1.InstallResourceToFileMapping[key][
|
|
47
|
+
const fileName = _1.InstallResourceToFileMapping[key]["fileName"];
|
|
48
|
+
const extension = _1.InstallResourceToFileMapping[key]["extension"];
|
|
49
49
|
// local and remote are empty. skip
|
|
50
|
-
if (this.isEmpty(installResourceContent) &&
|
|
50
|
+
if (this.isEmpty(installResourceContent) &&
|
|
51
|
+
!this.fileList.hasFile(fileName)) {
|
|
51
52
|
this.cli.writeSuccess(`empty, skip: ${fileName}`);
|
|
52
53
|
return;
|
|
53
54
|
}
|
|
54
55
|
// local file doesn't exist. create it
|
|
55
|
-
if (!this.isEmpty(installResourceContent) &&
|
|
56
|
+
if (!this.isEmpty(installResourceContent) &&
|
|
57
|
+
!this.fileList.hasFile(fileName)) {
|
|
56
58
|
this.cli.writeSuccess(`create: ${fileName}`);
|
|
57
59
|
await this.createFile(fileName, extension, installResourceContent, key);
|
|
58
60
|
return;
|
|
59
61
|
}
|
|
60
62
|
const file = this.readLocalFile(fileName);
|
|
61
63
|
// local file exists but remote is empty. delete
|
|
62
|
-
if (this.isEmpty(installResourceContent) &&
|
|
64
|
+
if (this.isEmpty(installResourceContent) &&
|
|
65
|
+
this.fileList.hasFile(fileName)) {
|
|
63
66
|
this.cli.writeError(`delete: ${fileName}`);
|
|
64
67
|
await file.delete();
|
|
65
68
|
return;
|
|
@@ -89,7 +92,10 @@ class PullService {
|
|
|
89
92
|
await resourceFile.updateFile();
|
|
90
93
|
}
|
|
91
94
|
hasGitChanges() {
|
|
92
|
-
const customerName = this.basePath
|
|
95
|
+
const customerName = this.basePath
|
|
96
|
+
.split("/")
|
|
97
|
+
.filter((value) => value.length > 0)
|
|
98
|
+
.pop();
|
|
93
99
|
try {
|
|
94
100
|
const stdoutBuffer = (0, child_process_1.execSync)("git diff --name-status");
|
|
95
101
|
const stdout = stdoutBuffer.toString("utf8");
|
package/oclif.manifest.json
CHANGED