@wpelevator/wp-release 0.15.0 → 0.16.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.
Files changed (49) hide show
  1. package/README.md +246 -37
  2. package/dist/changeset-config.d.ts +3 -0
  3. package/dist/changeset-release.d.ts +9 -3
  4. package/dist/changeset-release.js +23 -14
  5. package/dist/cli.d.ts +1 -0
  6. package/dist/cli.js +2 -0
  7. package/dist/commands/artifact-signing.d.ts +20 -0
  8. package/dist/commands/artifact-signing.js +42 -0
  9. package/dist/commands/build.d.ts +32 -0
  10. package/dist/commands/build.js +91 -0
  11. package/dist/commands/changeset-add.d.ts +55 -6
  12. package/dist/commands/changeset-add.js +12 -3
  13. package/dist/commands/changeset-args.js +2 -2
  14. package/dist/commands/changeset-project-args.d.ts +63 -0
  15. package/dist/commands/changeset-project-args.js +114 -0
  16. package/dist/commands/changeset-status.d.ts +50 -1
  17. package/dist/commands/changeset-status.js +4 -2
  18. package/dist/commands/changeset-tag.d.ts +55 -6
  19. package/dist/commands/changeset-tag.js +7 -4
  20. package/dist/commands/changeset-version.d.ts +55 -6
  21. package/dist/commands/changeset-version.js +4 -2
  22. package/dist/commands/checksums.d.ts +4 -1
  23. package/dist/commands/checksums.js +27 -6
  24. package/dist/commands/package-source.d.ts +43 -0
  25. package/dist/commands/package-source.js +101 -0
  26. package/dist/commands/verify.d.ts +7 -1
  27. package/dist/commands/verify.js +53 -17
  28. package/dist/commands/zip.d.ts +20 -8
  29. package/dist/commands/zip.js +109 -124
  30. package/dist/index.d.ts +6 -0
  31. package/dist/index.js +2 -0
  32. package/dist/integrity.d.ts +33 -0
  33. package/dist/integrity.js +115 -0
  34. package/dist/output-files.d.ts +7 -0
  35. package/dist/output-files.js +25 -0
  36. package/dist/package-build.d.ts +33 -0
  37. package/dist/package-build.js +112 -0
  38. package/dist/package-files.d.ts +25 -0
  39. package/dist/package-files.js +24 -0
  40. package/dist/package-zip.d.ts +14 -2
  41. package/dist/package-zip.js +129 -38
  42. package/dist/release-tags.js +6 -0
  43. package/dist/single-project.d.ts +32 -0
  44. package/dist/single-project.js +144 -0
  45. package/dist/summary.d.ts +9 -0
  46. package/dist/summary.js +25 -0
  47. package/dist/zip.d.ts +3 -0
  48. package/dist/zip.js +16 -6
  49. package/package.json +6 -1
package/dist/summary.js CHANGED
@@ -99,6 +99,26 @@ function formatDetails(title, content) {
99
99
  function joinBlocks(blocks) {
100
100
  return `${blocks.filter(Boolean).join('\n\n')}\n`;
101
101
  }
102
+ /**
103
+ * Get the summary of a directory build.
104
+ *
105
+ * @param context Workspace directory.
106
+ * @param result Output directory and number of copied files.
107
+ * @return Markdown summary.
108
+ */
109
+ export function getBuildSummary(context, result) {
110
+ return joinBlocks([
111
+ '### Build',
112
+ formatList([
113
+ `**Directory:** ${formatFile(context, result.outputDir)}, ${result.files} files`,
114
+ ...(result.checksumsPath
115
+ ? [
116
+ `**Checksums:** ${formatFile(context, result.checksumsPath)}`,
117
+ ]
118
+ : []),
119
+ ]),
120
+ ]);
121
+ }
102
122
  /**
103
123
  * Get the summary of a ZIP.
104
124
  *
@@ -111,6 +131,11 @@ export function getZipSummary(context, result) {
111
131
  '### ZIP',
112
132
  formatList([
113
133
  `**ZIP:** ${formatFile(context, result.zipPath)}, ${result.files} files`,
134
+ ...(result.checksumsEmbedded
135
+ ? [
136
+ `**Embedded checksums:** ${formatCode(result.checksumsEmbedded)}`,
137
+ ]
138
+ : []),
114
139
  ...(result.checksumsPath
115
140
  ? [
116
141
  `**Checksums:** ${formatFile(context, result.checksumsPath)}`,
package/dist/zip.d.ts CHANGED
@@ -14,6 +14,8 @@ export interface CreateZipInput {
14
14
  sourceDir: string;
15
15
  /** Relative file paths with forward slashes, from selectFiles(). */
16
16
  files: string[];
17
+ /** Generated entries, keyed by relative archive path. */
18
+ entries?: Record<string, Buffer>;
17
19
  /** Archive path. */
18
20
  zipPath: string;
19
21
  /** Folder to put the files in inside the archive, or null for the root. */
@@ -30,3 +32,4 @@ export interface CreateZipInput {
30
32
  * @throws {ValidationError} If the archive exists and force isn't set.
31
33
  */
32
34
  export declare function createZip(input: CreateZipInput): Promise<void>;
35
+ export declare function isValidRootFolder(name: string): boolean;
package/dist/zip.js CHANGED
@@ -31,11 +31,21 @@ export async function createZip(input) {
31
31
  }
32
32
  const zip = new yazl.ZipFile();
33
33
  const output = createWriteStream(zipPath, { flags: force ? 'w' : 'wx' });
34
- [...files].sort().forEach((file) => zip.addFile(join(sourceDir, file), rootFolder ? posix.join(rootFolder, file) : file, {
35
- mtime: ZIP_MTIME,
36
- mode: ZIP_FILE_MODE,
37
- forceDosTimestamp: true,
38
- }));
34
+ const entries = input.entries ?? {};
35
+ [...files, ...Object.keys(entries)].sort().forEach((file) => {
36
+ const path = rootFolder ? posix.join(rootFolder, file) : file;
37
+ const options = {
38
+ mtime: ZIP_MTIME,
39
+ mode: ZIP_FILE_MODE,
40
+ forceDosTimestamp: true,
41
+ };
42
+ if (Object.hasOwn(entries, file)) {
43
+ zip.addBuffer(entries[file] ?? Buffer.alloc(0), path, options);
44
+ }
45
+ else {
46
+ zip.addFile(join(sourceDir, file), path, options);
47
+ }
48
+ });
39
49
  zip.end();
40
50
  try {
41
51
  await pipeline(zip.outputStream, output);
@@ -48,6 +58,6 @@ export async function createZip(input) {
48
58
  throw error;
49
59
  }
50
60
  }
51
- function isValidRootFolder(name) {
61
+ export function isValidRootFolder(name) {
52
62
  return !/[\\/]/.test(name) && '.' !== name && '..' !== name;
53
63
  }
package/package.json CHANGED
@@ -1,8 +1,13 @@
1
1
  {
2
2
  "name": "@wpelevator/wp-release",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "description": "Package, checksum, sign, verify and version-check WordPress plugins and themes, and deploy plugins to WordPress.org SVN",
5
5
  "license": "MIT",
6
+ "author": "WP Elevator (https://wpelevator.com)",
7
+ "homepage": "https://github.com/wpelevator/basement/tree/main/packages/js/wp-release#readme",
8
+ "bugs": {
9
+ "url": "https://github.com/wpelevator/basement/issues"
10
+ },
6
11
  "repository": {
7
12
  "type": "git",
8
13
  "url": "git+https://github.com/wpelevator/basement.git",