@wp-playground/blueprints 0.3.1 → 0.5.1
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/blueprint-schema.json +282 -176
- package/index.cjs +257 -201
- package/index.d.ts +1766 -6
- package/index.js +3928 -3505
- package/lib/steps/apply-wordpress-patches/index.d.ts +2 -1
- package/lib/steps/common.d.ts +9 -6
- package/lib/steps/define-wp-config-consts.d.ts +7 -8
- package/lib/steps/export-wxr.d.ts +9 -0
- package/lib/steps/export-wxz.d.ts +9 -0
- package/lib/steps/handlers.d.ts +7 -1
- package/lib/steps/import-file.d.ts +29 -0
- package/lib/steps/import-wp-content.d.ts +41 -0
- package/lib/steps/index.d.ts +9 -5
- package/lib/steps/install-asset.d.ts +1 -1
- package/lib/steps/request.d.ts +1 -1
- package/lib/steps/run-php-with-options.d.ts +1 -1
- package/lib/steps/run-sql.d.ts +35 -0
- package/lib/steps/unzip.d.ts +28 -0
- package/lib/steps/zip-wp-content.d.ts +17 -0
- package/package.json +2 -2
- package/lib/blueprint.d.ts +0 -31
- package/lib/compile.d.ts +0 -43
- package/lib/resources.d.ts +0 -210
- package/lib/steps/import-export.d.ts +0 -107
- package/lib/steps/migration.d.ts +0 -2
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { UniversalPHP } from '@php-wasm/universal';
|
|
2
|
-
import { StepHandler } from '.';
|
|
3
|
-
/**
|
|
4
|
-
* Full site export support:
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Export the current site as a zip file.
|
|
8
|
-
*
|
|
9
|
-
* @param playground Playground client.
|
|
10
|
-
*/
|
|
11
|
-
export declare function zipEntireSite(playground: UniversalPHP): Promise<File>;
|
|
12
|
-
/**
|
|
13
|
-
* @inheritDoc replaceSite
|
|
14
|
-
* @example
|
|
15
|
-
*
|
|
16
|
-
* <code>
|
|
17
|
-
* {
|
|
18
|
-
* "step": "replaceSite",
|
|
19
|
-
* "fullSiteZip": "https://mysite.com/import.zip"
|
|
20
|
-
* }
|
|
21
|
-
* </code>
|
|
22
|
-
*/
|
|
23
|
-
export interface ReplaceSiteStep<ResourceType> {
|
|
24
|
-
step: 'replaceSite';
|
|
25
|
-
/** The zip file containing the new WordPress site */
|
|
26
|
-
fullSiteZip: ResourceType;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Replace the current site with a site from the provided zip file.
|
|
30
|
-
* Remember to install the SQLite integration plugin in the zipped site:
|
|
31
|
-
* https://wordpress.org/plugins/sqlite-database-integration.
|
|
32
|
-
*
|
|
33
|
-
* @param playground Playground client.
|
|
34
|
-
* @param fullSiteZip Zipped WordPress site.
|
|
35
|
-
*/
|
|
36
|
-
export declare const replaceSite: StepHandler<ReplaceSiteStep<File>>;
|
|
37
|
-
/**
|
|
38
|
-
* @inheritDoc unzip
|
|
39
|
-
* @example
|
|
40
|
-
*
|
|
41
|
-
* <code>
|
|
42
|
-
* {
|
|
43
|
-
* "step": "unzip",
|
|
44
|
-
* "zipPath": "/wordpress/data.zip",
|
|
45
|
-
* "extractToPath": "/wordpress"
|
|
46
|
-
* }
|
|
47
|
-
* </code>
|
|
48
|
-
*/
|
|
49
|
-
export interface UnzipStep {
|
|
50
|
-
step: 'unzip';
|
|
51
|
-
/** The zip file to extract */
|
|
52
|
-
zipPath: string;
|
|
53
|
-
/** The path to extract the zip file to */
|
|
54
|
-
extractToPath: string;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Unzip a zip file.
|
|
58
|
-
*
|
|
59
|
-
* @param playground Playground client.
|
|
60
|
-
* @param zipPath The zip file to unzip.
|
|
61
|
-
* @param extractTo The directory to extract the zip file to.
|
|
62
|
-
*/
|
|
63
|
-
export declare const unzip: StepHandler<UnzipStep>;
|
|
64
|
-
/**
|
|
65
|
-
* WXR and WXZ files support:
|
|
66
|
-
*/
|
|
67
|
-
/**
|
|
68
|
-
* Exports the WordPress database as a WXR file using
|
|
69
|
-
* the core WordPress export tool.
|
|
70
|
-
*
|
|
71
|
-
* @param playground Playground client
|
|
72
|
-
* @returns WXR file
|
|
73
|
-
*/
|
|
74
|
-
export declare function exportWXR(playground: UniversalPHP): Promise<File>;
|
|
75
|
-
/**
|
|
76
|
-
* Exports the WordPress database as a WXZ file using
|
|
77
|
-
* the export-wxz plugin from https://github.com/akirk/export-wxz.
|
|
78
|
-
*
|
|
79
|
-
* @param playground Playground client
|
|
80
|
-
* @returns WXZ file
|
|
81
|
-
*/
|
|
82
|
-
export declare function exportWXZ(playground: UniversalPHP): Promise<File>;
|
|
83
|
-
/**
|
|
84
|
-
* @inheritDoc importFile
|
|
85
|
-
* @example
|
|
86
|
-
*
|
|
87
|
-
* <code>
|
|
88
|
-
* {
|
|
89
|
-
* "step": "importFile",
|
|
90
|
-
* "file": "https://mysite.com/import.WXR"
|
|
91
|
-
* }
|
|
92
|
-
* </code>
|
|
93
|
-
*/
|
|
94
|
-
export interface ImportFileStep<ResourceType> {
|
|
95
|
-
step: 'importFile';
|
|
96
|
-
/** The file to import */
|
|
97
|
-
file: ResourceType;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Uploads a file to the WordPress importer and returns the response.
|
|
101
|
-
* Supports both WXR and WXZ files.
|
|
102
|
-
*
|
|
103
|
-
* @see https://github.com/WordPress/wordpress-importer/compare/master...akirk:wordpress-importer:import-wxz.patch
|
|
104
|
-
* @param playground Playground client.
|
|
105
|
-
* @param file The file to import.
|
|
106
|
-
*/
|
|
107
|
-
export declare const importFile: StepHandler<ImportFileStep<File>>;
|
package/lib/steps/migration.d.ts
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
declare const _default: "<?php\n\nfunction zipDir($dir, $output, $additionalFiles = array())\n{\n $zip = new ZipArchive;\n $res = $zip->open($output, ZipArchive::CREATE);\n if ($res === TRUE) {\n foreach ($additionalFiles as $file) {\n $zip->addFile($file);\n }\n $directories = array(\n rtrim($dir, '/') . '/'\n );\n while (sizeof($directories)) {\n $dir = array_pop($directories);\n\n if ($handle = opendir($dir)) {\n while (false !== ($entry = readdir($handle))) {\n if ($entry == '.' || $entry == '..') {\n continue;\n }\n\n $entry = $dir . $entry;\n\n if (is_dir($entry)) {\n $directory_path = $entry . '/';\n array_push($directories, $directory_path);\n } else if (is_file($entry)) {\n $zip->addFile($entry);\n }\n }\n closedir($handle);\n }\n }\n $zip->close();\n chmod($output, 0777);\n }\n}\n\nfunction unzip($zipPath, $extractTo, $overwrite = true)\n{\n if(!is_dir($extractTo)) {\n mkdir($extractTo, 0777, true);\n }\n $zip = new ZipArchive;\n $res = $zip->open($zipPath);\n if ($res === TRUE) {\n $zip->extractTo($extractTo);\n $zip->close();\n chmod($extractTo, 0777);\n }\n}\n\n\nfunction delTree($dir)\n{\n $files = array_diff(scandir($dir), array('.', '..'));\n foreach ($files as $file) {\n (is_dir(\"$dir/$file\")) ? delTree(\"$dir/$file\") : unlink(\"$dir/$file\");\n }\n return rmdir($dir);\n}\n";
|
|
2
|
-
export default _default;
|