@pwrdrvr/microapps-publish 0.4.0-alpha.8 → 1.0.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/README.md +30 -36
- package/package.json +5 -52
- package/bin/run +0 -5
- package/dist/commands/delete.d.ts +0 -18
- package/dist/commands/delete.d.ts.map +0 -1
- package/dist/commands/delete.js +0 -125
- package/dist/commands/delete.js.map +0 -1
- package/dist/commands/nextjs-version-restore.d.ts +0 -14
- package/dist/commands/nextjs-version-restore.d.ts.map +0 -1
- package/dist/commands/nextjs-version-restore.js +0 -53
- package/dist/commands/nextjs-version-restore.js.map +0 -1
- package/dist/commands/nextjs-version.d.ts +0 -18
- package/dist/commands/nextjs-version.d.ts.map +0 -1
- package/dist/commands/nextjs-version.js +0 -103
- package/dist/commands/nextjs-version.js.map +0 -1
- package/dist/commands/preflight.d.ts +0 -19
- package/dist/commands/preflight.d.ts.map +0 -1
- package/dist/commands/preflight.js +0 -135
- package/dist/commands/preflight.js.map +0 -1
- package/dist/commands/publish-static.d.ts +0 -25
- package/dist/commands/publish-static.d.ts.map +0 -1
- package/dist/commands/publish-static.js +0 -361
- package/dist/commands/publish-static.js.map +0 -1
- package/dist/commands/publish.d.ts +0 -39
- package/dist/commands/publish.d.ts.map +0 -1
- package/dist/commands/publish.js +0 -565
- package/dist/commands/publish.js.map +0 -1
- package/dist/config/Application.d.ts +0 -26
- package/dist/config/Application.d.ts.map +0 -1
- package/dist/config/Application.js +0 -99
- package/dist/config/Application.js.map +0 -1
- package/dist/config/Config.d.ts +0 -18
- package/dist/config/Config.d.ts.map +0 -1
- package/dist/config/Config.js +0 -71
- package/dist/config/Config.js.map +0 -1
- package/dist/config/Deployer.d.ts +0 -10
- package/dist/config/Deployer.d.ts.map +0 -1
- package/dist/config/Deployer.js +0 -17
- package/dist/config/Deployer.js.map +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -6
- package/dist/index.js.map +0 -1
- package/dist/lib/DeployClient.d.ts +0 -102
- package/dist/lib/DeployClient.d.ts.map +0 -1
- package/dist/lib/DeployClient.js +0 -233
- package/dist/lib/DeployClient.js.map +0 -1
- package/dist/lib/FilesExist.d.ts +0 -5
- package/dist/lib/FilesExist.d.ts.map +0 -1
- package/dist/lib/FilesExist.js +0 -26
- package/dist/lib/FilesExist.js.map +0 -1
- package/dist/lib/S3TransferUtility.d.ts +0 -19
- package/dist/lib/S3TransferUtility.d.ts.map +0 -1
- package/dist/lib/S3TransferUtility.js +0 -94
- package/dist/lib/S3TransferUtility.js.map +0 -1
- package/dist/lib/S3Uploader.d.ts +0 -27
- package/dist/lib/S3Uploader.d.ts.map +0 -1
- package/dist/lib/S3Uploader.js +0 -77
- package/dist/lib/S3Uploader.js.map +0 -1
- package/dist/lib/Versions.d.ts +0 -33
- package/dist/lib/Versions.d.ts.map +0 -1
- package/dist/lib/Versions.js +0 -76
- package/dist/lib/Versions.js.map +0 -1
- package/src/commands/delete.ts +0 -135
- package/src/commands/nextjs-version-restore.ts +0 -70
- package/src/commands/nextjs-version.ts +0 -123
- package/src/commands/preflight.ts +0 -148
- package/src/commands/publish-static.ts +0 -416
- package/src/commands/publish.ts +0 -662
- package/src/commands-deprecated/nextjs-docker-auto.skip +0 -590
- package/src/config/Application.ts +0 -98
- package/src/config/Config.ts +0 -81
- package/src/config/Deployer.ts +0 -17
- package/src/index.ts +0 -1
- package/src/lib/DeployClient.ts +0 -334
- package/src/lib/FilesExist.ts +0 -25
- package/src/lib/S3TransferUtility.spec.ts +0 -15
- package/src/lib/S3TransferUtility.ts +0 -113
- package/src/lib/S3Uploader.ts +0 -94
- package/src/lib/Versions.ts +0 -101
- package/src/lib/__snapshots__/S3TransferUtility.spec.ts.snap +0 -12
package/src/lib/Versions.ts
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { promises as fs } from 'fs-extra';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Represents a File To Modify
|
|
5
|
-
*/
|
|
6
|
-
export interface IFileToModify {
|
|
7
|
-
path: string;
|
|
8
|
-
versions: IVersions;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping
|
|
12
|
-
function escapeRegExp(value: string): string {
|
|
13
|
-
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Write new versions into specified config file
|
|
18
|
-
* @param path
|
|
19
|
-
* @param requiredVersions
|
|
20
|
-
* @param leaveFiles
|
|
21
|
-
* @returns
|
|
22
|
-
*/
|
|
23
|
-
export async function writeNewVersions(
|
|
24
|
-
path: string,
|
|
25
|
-
requiredVersions: IVersions,
|
|
26
|
-
leaveFiles: boolean,
|
|
27
|
-
): Promise<boolean> {
|
|
28
|
-
const stats = await fs.stat(path);
|
|
29
|
-
if (!stats.isFile) {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Make a backup of the file
|
|
34
|
-
await fs.copyFile(path, `${path}.original`);
|
|
35
|
-
|
|
36
|
-
// File exists, check that it has the required version strings
|
|
37
|
-
let fileText = await fs.readFile(path, 'utf8');
|
|
38
|
-
|
|
39
|
-
for (const key of Object.keys(requiredVersions)) {
|
|
40
|
-
const placeHolder = key === 'version' ? '0.0.0' : 'v0_0_0';
|
|
41
|
-
if (fileText.indexOf(placeHolder) === -1) {
|
|
42
|
-
// The required placeholder is missing
|
|
43
|
-
return false;
|
|
44
|
-
} else {
|
|
45
|
-
const regExp = new RegExp(escapeRegExp(placeHolder), 'g');
|
|
46
|
-
fileText = fileText.replace(
|
|
47
|
-
regExp,
|
|
48
|
-
key === 'version' ? requiredVersions.version : (requiredVersions.alias as string),
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// Write the updated file contents
|
|
54
|
-
await fs.writeFile(path, fileText, 'utf8');
|
|
55
|
-
|
|
56
|
-
// Leave a copy of the modified file if requested
|
|
57
|
-
if (leaveFiles) {
|
|
58
|
-
// This copy will overwrite an existing file
|
|
59
|
-
await fs.copyFile(path, `${path}.modified`);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return true;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Restore files that the version was patched into
|
|
67
|
-
*/
|
|
68
|
-
export async function restoreFiles(filesToModify: IFileToModify[]): Promise<void> {
|
|
69
|
-
// Put the old files back when succeeded or failed
|
|
70
|
-
for (const fileToModify of filesToModify) {
|
|
71
|
-
try {
|
|
72
|
-
const stats = await fs.stat(`${fileToModify.path}.original`);
|
|
73
|
-
if (stats.isFile()) {
|
|
74
|
-
// Remove the possibly modified file
|
|
75
|
-
await fs.unlink(fileToModify.path);
|
|
76
|
-
|
|
77
|
-
// Move the original file back
|
|
78
|
-
await fs.rename(`${fileToModify.path}.original`, fileToModify.path);
|
|
79
|
-
}
|
|
80
|
-
} catch {
|
|
81
|
-
// don't care... if the file doesn't exist we can't do anything
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Represents a Versions
|
|
88
|
-
*/
|
|
89
|
-
export interface IVersions {
|
|
90
|
-
version: string;
|
|
91
|
-
alias?: string;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Setup version and alias strings
|
|
96
|
-
* @param version
|
|
97
|
-
* @returns
|
|
98
|
-
*/
|
|
99
|
-
export function createVersions(version: string): Required<IVersions> {
|
|
100
|
-
return { version, alias: `v${version.replace(/\./g, '_')}` };
|
|
101
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`S3TransferUtility collects the files 1`] = `
|
|
4
|
-
[
|
|
5
|
-
"dir1/.touch",
|
|
6
|
-
"dir2/dir21/dir211/some211-1.json",
|
|
7
|
-
"dir2/dir21/dir211/some211-2.json",
|
|
8
|
-
"dir2/dir21/some21.json",
|
|
9
|
-
"dir2/dir22/some22.json",
|
|
10
|
-
"some.json",
|
|
11
|
-
]
|
|
12
|
-
`;
|