@wp-playground/blueprints 0.1.61 → 0.3.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/blueprint-schema.json +1205 -0
- package/index.cjs +359 -34
- package/index.js +7298 -880
- package/lib/blueprint.d.ts +5 -1
- package/lib/compile.d.ts +11 -5
- package/lib/steps/activate-plugin.d.ts +15 -1
- package/lib/steps/activate-theme.d.ts +16 -1
- package/lib/steps/apply-wordpress-patches/index.d.ts +36 -0
- package/lib/steps/cp.d.ts +26 -0
- package/lib/steps/define-site-url.d.ts +14 -1
- package/lib/steps/define-wp-config-consts.d.ts +15 -4
- package/lib/steps/handlers.d.ts +10 -1
- package/lib/steps/import-export.d.ts +41 -1
- package/lib/steps/index.d.ts +10 -1
- package/lib/steps/mkdir.d.ts +22 -0
- package/lib/steps/mv.d.ts +26 -0
- package/lib/steps/request.d.ts +33 -0
- package/lib/steps/rm.d.ts +23 -0
- package/lib/steps/rmdir.d.ts +23 -0
- package/lib/steps/run-php-with-options.d.ts +30 -0
- package/lib/steps/run-php.d.ts +23 -0
- package/lib/steps/run-wp-installation-wizard.d.ts +3 -0
- package/lib/steps/set-php-ini-entry.d.ts +25 -0
- package/lib/steps/site-data.d.ts +2 -0
- package/lib/steps/write-file.d.ts +26 -0
- package/package.json +6 -2
- package/schema-readme.md +9 -0
- package/lib/steps/client-methods.d.ts +0 -230
package/lib/blueprint.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SupportedPHPVersion } from '@php-wasm/universal';
|
|
1
|
+
import { SupportedPHPExtensionBundle, SupportedPHPVersion } from '@php-wasm/universal';
|
|
2
2
|
import { StepDefinition } from './steps';
|
|
3
3
|
export interface Blueprint {
|
|
4
4
|
/**
|
|
@@ -20,6 +20,10 @@ export interface Blueprint {
|
|
|
20
20
|
*/
|
|
21
21
|
wp: string | 'latest';
|
|
22
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* The PHP extensions to use.
|
|
25
|
+
*/
|
|
26
|
+
phpExtensionBundles?: SupportedPHPExtensionBundle[];
|
|
23
27
|
/**
|
|
24
28
|
* The steps to run.
|
|
25
29
|
*/
|
package/lib/compile.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { ProgressTracker } from '@php-wasm/progress';
|
|
2
2
|
import { Semaphore } from '@php-wasm/util';
|
|
3
|
-
import { SupportedPHPVersion, UniversalPHP } from '@php-wasm/universal';
|
|
3
|
+
import { SupportedPHPExtension, SupportedPHPVersion, UniversalPHP } from '@php-wasm/universal';
|
|
4
4
|
import { StepDefinition } from './steps';
|
|
5
5
|
import { Blueprint } from './blueprint';
|
|
6
6
|
export type CompiledStep = (php: UniversalPHP) => Promise<void> | void;
|
|
7
|
-
declare const supportedWordPressVersions: readonly ["6.2", "6.1", "6.0", "5.9"];
|
|
8
|
-
type supportedWordPressVersion = (typeof supportedWordPressVersions)[number];
|
|
9
7
|
export interface CompiledBlueprint {
|
|
10
8
|
/** The requested versions of PHP and WordPress for the blueprint */
|
|
11
9
|
versions: {
|
|
12
10
|
php: SupportedPHPVersion;
|
|
13
|
-
wp:
|
|
11
|
+
wp: string;
|
|
14
12
|
};
|
|
13
|
+
/** The requested PHP extensions to load */
|
|
14
|
+
phpExtensions: SupportedPHPExtension[];
|
|
15
15
|
/** The compiled steps for the blueprint */
|
|
16
16
|
run: (playground: UniversalPHP) => Promise<void>;
|
|
17
17
|
}
|
|
@@ -33,5 +33,11 @@ export interface CompileBlueprintOptions {
|
|
|
33
33
|
* @returns The compiled blueprint
|
|
34
34
|
*/
|
|
35
35
|
export declare function compileBlueprint(blueprint: Blueprint, { progress, semaphore, onStepCompleted, }?: CompileBlueprintOptions): CompiledBlueprint;
|
|
36
|
+
export declare function validateBlueprint(blueprintMaybe: object): {
|
|
37
|
+
valid: true;
|
|
38
|
+
errors?: undefined;
|
|
39
|
+
} | {
|
|
40
|
+
valid: false;
|
|
41
|
+
errors: import("ajv").ErrorObject<string, Record<string, any>, unknown>[] | undefined;
|
|
42
|
+
};
|
|
36
43
|
export declare function runBlueprintSteps(compiledBlueprint: CompiledBlueprint, playground: UniversalPHP): Promise<void>;
|
|
37
|
-
export {};
|
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
import { StepHandler } from '.';
|
|
2
|
+
/**
|
|
3
|
+
* @inheritDoc activatePlugin
|
|
4
|
+
* @example
|
|
5
|
+
*
|
|
6
|
+
* <code>
|
|
7
|
+
* {
|
|
8
|
+
* "step": "activatePlugin",
|
|
9
|
+
* "pluginName": "Gutenberg",
|
|
10
|
+
* "pluginPath": "/wordpress/wp-content/plugins/gutenberg"
|
|
11
|
+
* }
|
|
12
|
+
* </code>
|
|
13
|
+
*/
|
|
2
14
|
export interface ActivatePluginStep {
|
|
3
15
|
step: 'activatePlugin';
|
|
16
|
+
/** Path to the plugin directory as absolute path (/wordpress/wp-content/plugins/plugin-name); or the plugin entry file relative to the plugins directory (plugin-name/plugin-name.php). */
|
|
4
17
|
pluginPath: string;
|
|
18
|
+
/** Optional. Plugin name to display in the progress bar. */
|
|
5
19
|
pluginName?: string;
|
|
6
20
|
}
|
|
7
21
|
/**
|
|
8
|
-
* Activates a WordPress plugin
|
|
22
|
+
* Activates a WordPress plugin (if it's installed).
|
|
9
23
|
*
|
|
10
24
|
* @param playground The playground client.
|
|
11
25
|
*/
|
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
import { StepHandler } from '.';
|
|
2
|
+
/**
|
|
3
|
+
* @inheritDoc activateTheme
|
|
4
|
+
* @example
|
|
5
|
+
*
|
|
6
|
+
* <code>
|
|
7
|
+
* {
|
|
8
|
+
* "step": "activateTheme",
|
|
9
|
+
* "pluginName": "Storefront",
|
|
10
|
+
* "pluginPath": "/wordpress/wp-content/themes/storefront"
|
|
11
|
+
* }
|
|
12
|
+
* </code>
|
|
13
|
+
*/
|
|
2
14
|
export interface ActivateThemeStep {
|
|
3
15
|
step: 'activateTheme';
|
|
16
|
+
/**
|
|
17
|
+
* The name of the theme folder inside wp-content/themes/
|
|
18
|
+
*/
|
|
4
19
|
themeFolderName: string;
|
|
5
20
|
}
|
|
6
21
|
/**
|
|
7
|
-
* Activates a WordPress theme
|
|
22
|
+
* Activates a WordPress theme (if it's installed).
|
|
8
23
|
*
|
|
9
24
|
* @param playground The playground client.
|
|
10
25
|
* @param themeFolderName The theme folder name.
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import { UniversalPHP } from '@php-wasm/universal';
|
|
1
2
|
import { StepHandler } from '..';
|
|
3
|
+
/**
|
|
4
|
+
* @private
|
|
5
|
+
*/
|
|
2
6
|
export interface ApplyWordPressPatchesStep {
|
|
3
7
|
step: 'applyWordPressPatches';
|
|
4
8
|
siteUrl?: string;
|
|
@@ -7,5 +11,37 @@ export interface ApplyWordPressPatchesStep {
|
|
|
7
11
|
patchSecrets?: boolean;
|
|
8
12
|
disableSiteHealth?: boolean;
|
|
9
13
|
disableWpNewBlogNotification?: boolean;
|
|
14
|
+
makeEditorFrameControlled?: boolean;
|
|
15
|
+
prepareForRunningInsideWebBrowser?: boolean;
|
|
10
16
|
}
|
|
11
17
|
export declare const applyWordPressPatches: StepHandler<ApplyWordPressPatchesStep>;
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* Pair the site editor's nested iframe to the Service Worker.
|
|
21
|
+
*
|
|
22
|
+
* Without the patch below, the site editor initiates network requests that
|
|
23
|
+
* aren't routed through the service worker. That's a known browser issue:
|
|
24
|
+
*
|
|
25
|
+
* * https://bugs.chromium.org/p/chromium/issues/detail?id=880768
|
|
26
|
+
* * https://bugzilla.mozilla.org/show_bug.cgi?id=1293277
|
|
27
|
+
* * https://github.com/w3c/ServiceWorker/issues/765
|
|
28
|
+
*
|
|
29
|
+
* The problem with iframes using srcDoc and src="about:blank" as they
|
|
30
|
+
* fail to inherit the root site's service worker.
|
|
31
|
+
*
|
|
32
|
+
* Gutenberg loads the site editor using <iframe srcDoc="<!doctype html">
|
|
33
|
+
* to force the standards mode and not the quirks mode:
|
|
34
|
+
*
|
|
35
|
+
* https://github.com/WordPress/gutenberg/pull/38855
|
|
36
|
+
*
|
|
37
|
+
* This commit patches the site editor to achieve the same result via
|
|
38
|
+
* <iframe src="/doctype.html"> and a doctype.html file containing just
|
|
39
|
+
* `<!doctype html>`. This allows the iframe to inherit the service worker
|
|
40
|
+
* and correctly load all the css, js, fonts, images, and other assets.
|
|
41
|
+
*
|
|
42
|
+
* Ideally this issue would be fixed directly in Gutenberg and the patch
|
|
43
|
+
* below would be removed.
|
|
44
|
+
*
|
|
45
|
+
* See https://github.com/WordPress/wordpress-playground/issues/42 for more details
|
|
46
|
+
*/
|
|
47
|
+
export declare function makeEditorFrameControlled(php: UniversalPHP, wordpressPath: string, blockEditorScripts: string[]): Promise<void>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { StepHandler } from '.';
|
|
2
|
+
/**
|
|
3
|
+
* @inheritDoc cp
|
|
4
|
+
* @hasRunnableExample
|
|
5
|
+
* @landingPage /index2.php
|
|
6
|
+
* @example
|
|
7
|
+
*
|
|
8
|
+
* <code>
|
|
9
|
+
* {
|
|
10
|
+
* "step": "cp",
|
|
11
|
+
* "fromPath": "/wordpress/index.php",
|
|
12
|
+
* "toPath": "/wordpress/index2.php"
|
|
13
|
+
* }
|
|
14
|
+
* </code>
|
|
15
|
+
*/
|
|
16
|
+
export interface CpStep {
|
|
17
|
+
step: 'cp';
|
|
18
|
+
/** Source path */
|
|
19
|
+
fromPath: string;
|
|
20
|
+
/** Target path */
|
|
21
|
+
toPath: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Copies a file from one path to another.
|
|
25
|
+
*/
|
|
26
|
+
export declare const cp: StepHandler<CpStep>;
|
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
import { StepHandler } from '.';
|
|
2
|
+
/**
|
|
3
|
+
* @inheritDoc defineSiteUrl
|
|
4
|
+
* @hasRunnableExample
|
|
5
|
+
* @example
|
|
6
|
+
*
|
|
7
|
+
* <code>
|
|
8
|
+
* {
|
|
9
|
+
* "step": "defineSiteUrl",
|
|
10
|
+
* "siteUrl": "https://playground.wordpress.net"
|
|
11
|
+
* }
|
|
12
|
+
* </code>
|
|
13
|
+
*/
|
|
2
14
|
export interface DefineSiteUrlStep {
|
|
3
15
|
step: 'defineSiteUrl';
|
|
16
|
+
/** The URL */
|
|
4
17
|
siteUrl: string;
|
|
5
18
|
}
|
|
6
19
|
/**
|
|
7
|
-
* Sets
|
|
20
|
+
* Sets WP_HOME and WP_SITEURL constants for the WordPress installation.
|
|
8
21
|
*
|
|
9
22
|
* @param playground The playground client.
|
|
10
23
|
* @param siteUrl
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import { StepHandler } from '.';
|
|
2
2
|
export declare const VFS_TMP_DIRECTORY = "/vfs-blueprints";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* @inheritDoc defineWpConfigConsts
|
|
5
|
+
* @hasRunnableExample
|
|
6
|
+
* @example
|
|
7
|
+
*
|
|
8
|
+
* <code>
|
|
9
|
+
* {
|
|
10
|
+
* "step": "defineWpConfigConsts",
|
|
11
|
+
* "consts": {
|
|
12
|
+
* "WP_DEBUG": true
|
|
13
|
+
* },
|
|
14
|
+
* "virtualize": true
|
|
15
|
+
* }
|
|
16
|
+
* </code>
|
|
5
17
|
*/
|
|
6
18
|
export interface DefineWpConfigConstsStep {
|
|
7
19
|
step: 'defineWpConfigConsts';
|
|
@@ -16,10 +28,9 @@ export interface DefineWpConfigConstsStep {
|
|
|
16
28
|
virtualize?: boolean;
|
|
17
29
|
}
|
|
18
30
|
/**
|
|
19
|
-
*
|
|
31
|
+
* Defines the wp-config.php constants
|
|
20
32
|
*
|
|
21
33
|
* @param playground The playground client.
|
|
22
|
-
* @param wpConfigConst
|
|
23
|
-
* @returns Returns the virtual file system configuration file path.
|
|
34
|
+
* @param wpConfigConst
|
|
24
35
|
*/
|
|
25
36
|
export declare const defineWpConfigConsts: StepHandler<DefineWpConfigConstsStep>;
|
package/lib/steps/handlers.d.ts
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
export { activatePlugin } from './activate-plugin';
|
|
2
2
|
export { activateTheme } from './activate-theme';
|
|
3
3
|
export { applyWordPressPatches } from './apply-wordpress-patches';
|
|
4
|
-
export {
|
|
4
|
+
export { runPHP } from './run-php';
|
|
5
|
+
export { runPHPWithOptions } from './run-php-with-options';
|
|
6
|
+
export { setPhpIniEntry } from './set-php-ini-entry';
|
|
7
|
+
export { request } from './request';
|
|
8
|
+
export { cp } from './cp';
|
|
9
|
+
export { mv } from './mv';
|
|
10
|
+
export { rm } from './rm';
|
|
11
|
+
export { mkdir } from './mkdir';
|
|
12
|
+
export { rmdir } from './rmdir';
|
|
13
|
+
export { writeFile } from './write-file';
|
|
5
14
|
export { defineSiteUrl } from './define-site-url';
|
|
6
15
|
export { importFile, unzip, replaceSite, zipEntireSite } from './import-export';
|
|
7
16
|
export { installPlugin } from './install-plugin';
|
|
@@ -9,20 +9,48 @@ import { StepHandler } from '.';
|
|
|
9
9
|
* @param playground Playground client.
|
|
10
10
|
*/
|
|
11
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
|
+
*/
|
|
12
23
|
export interface ReplaceSiteStep<ResourceType> {
|
|
13
24
|
step: 'replaceSite';
|
|
25
|
+
/** The zip file containing the new WordPress site */
|
|
14
26
|
fullSiteZip: ResourceType;
|
|
15
27
|
}
|
|
16
28
|
/**
|
|
17
|
-
* Replace the current site with
|
|
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.
|
|
18
32
|
*
|
|
19
33
|
* @param playground Playground client.
|
|
20
34
|
* @param fullSiteZip Zipped WordPress site.
|
|
21
35
|
*/
|
|
22
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
|
+
*/
|
|
23
49
|
export interface UnzipStep {
|
|
24
50
|
step: 'unzip';
|
|
51
|
+
/** The zip file to extract */
|
|
25
52
|
zipPath: string;
|
|
53
|
+
/** The path to extract the zip file to */
|
|
26
54
|
extractToPath: string;
|
|
27
55
|
}
|
|
28
56
|
/**
|
|
@@ -52,8 +80,20 @@ export declare function exportWXR(playground: UniversalPHP): Promise<File>;
|
|
|
52
80
|
* @returns WXZ file
|
|
53
81
|
*/
|
|
54
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
|
+
*/
|
|
55
94
|
export interface ImportFileStep<ResourceType> {
|
|
56
95
|
step: 'importFile';
|
|
96
|
+
/** The file to import */
|
|
57
97
|
file: ResourceType;
|
|
58
98
|
}
|
|
59
99
|
/**
|
package/lib/steps/index.d.ts
CHANGED
|
@@ -10,7 +10,16 @@ import { InstallThemeStep, InstallThemeOptions } from './install-theme';
|
|
|
10
10
|
import { LoginStep } from './login';
|
|
11
11
|
import { RunWpInstallationWizardStep, WordPressInstallationOptions } from './run-wp-installation-wizard';
|
|
12
12
|
import { SetSiteOptionsStep, UpdateUserMetaStep } from './site-data';
|
|
13
|
-
import { RmStep
|
|
13
|
+
import { RmStep } from './rm';
|
|
14
|
+
import { CpStep } from './cp';
|
|
15
|
+
import { RmdirStep } from './rmdir';
|
|
16
|
+
import { MkdirStep } from './mkdir';
|
|
17
|
+
import { MvStep } from './mv';
|
|
18
|
+
import { SetPhpIniEntryStep } from './set-php-ini-entry';
|
|
19
|
+
import { RunPHPStep } from './run-php';
|
|
20
|
+
import { RunPHPWithOptionsStep } from './run-php-with-options';
|
|
21
|
+
import { RequestStep } from './request';
|
|
22
|
+
import { WriteFileStep } from './write-file';
|
|
14
23
|
import { DefineWpConfigConstsStep } from './define-wp-config-consts';
|
|
15
24
|
import { ActivateThemeStep } from './activate-theme';
|
|
16
25
|
export type Step = GenericStep<FileReference>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { StepHandler } from '.';
|
|
2
|
+
/**
|
|
3
|
+
* @inheritDoc mkdir
|
|
4
|
+
* @hasRunnableExample
|
|
5
|
+
* @example
|
|
6
|
+
*
|
|
7
|
+
* <code>
|
|
8
|
+
* {
|
|
9
|
+
* "step": "mkdir",
|
|
10
|
+
* "path": "/wordpress/my-new-folder"
|
|
11
|
+
* }
|
|
12
|
+
* </code>
|
|
13
|
+
*/
|
|
14
|
+
export interface MkdirStep {
|
|
15
|
+
step: 'mkdir';
|
|
16
|
+
/** The path of the directory you want to create */
|
|
17
|
+
path: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Creates a directory at the specified path.
|
|
21
|
+
*/
|
|
22
|
+
export declare const mkdir: StepHandler<MkdirStep>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { StepHandler } from '.';
|
|
2
|
+
/**
|
|
3
|
+
* @inheritDoc mv
|
|
4
|
+
* @hasRunnableExample
|
|
5
|
+
* @landingPage /index2.php
|
|
6
|
+
* @example
|
|
7
|
+
*
|
|
8
|
+
* <code>
|
|
9
|
+
* {
|
|
10
|
+
* "step": "mv",
|
|
11
|
+
* "fromPath": "/wordpress/index.php",
|
|
12
|
+
* "toPath": "/wordpress/index2.php"
|
|
13
|
+
* }
|
|
14
|
+
* </code>
|
|
15
|
+
*/
|
|
16
|
+
export interface MvStep {
|
|
17
|
+
step: 'mv';
|
|
18
|
+
/** Source path */
|
|
19
|
+
fromPath: string;
|
|
20
|
+
/** Target path */
|
|
21
|
+
toPath: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Moves a file or directory from one path to another.
|
|
25
|
+
*/
|
|
26
|
+
export declare const mv: StepHandler<MvStep>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { PHPRequest } from '@php-wasm/universal';
|
|
2
|
+
import { StepHandler } from '.';
|
|
3
|
+
/**
|
|
4
|
+
* @inheritDoc request
|
|
5
|
+
* @needsLogin
|
|
6
|
+
* @hasRunnableExample
|
|
7
|
+
* @example
|
|
8
|
+
*
|
|
9
|
+
* <code>
|
|
10
|
+
* {
|
|
11
|
+
* "step": "request",
|
|
12
|
+
* "request": {
|
|
13
|
+
* "method": "POST",
|
|
14
|
+
* "url": "/wp-admin/admin-ajax.php",
|
|
15
|
+
* "formData": {
|
|
16
|
+
* "action": "my_action",
|
|
17
|
+
* "foo": "bar"
|
|
18
|
+
* }
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
* </code>
|
|
22
|
+
*/
|
|
23
|
+
export interface RequestStep {
|
|
24
|
+
step: 'request';
|
|
25
|
+
/**
|
|
26
|
+
* Request details (See /wordpress-playground/api/universal/interface/PHPRequest)
|
|
27
|
+
*/
|
|
28
|
+
request: PHPRequest;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Sends a HTTP request to the Playground.
|
|
32
|
+
*/
|
|
33
|
+
export declare const request: StepHandler<RequestStep>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { StepHandler } from '.';
|
|
2
|
+
/**
|
|
3
|
+
* @inheritDoc rm
|
|
4
|
+
* @hasRunnableExample
|
|
5
|
+
* @landingPage /index.php
|
|
6
|
+
* @example
|
|
7
|
+
*
|
|
8
|
+
* <code>
|
|
9
|
+
* {
|
|
10
|
+
* "step": "rm",
|
|
11
|
+
* "path": "/wordpress/index.php"
|
|
12
|
+
* }
|
|
13
|
+
* </code>
|
|
14
|
+
*/
|
|
15
|
+
export interface RmStep {
|
|
16
|
+
step: 'rm';
|
|
17
|
+
/** The path to remove */
|
|
18
|
+
path: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Removes a file at the specified path.
|
|
22
|
+
*/
|
|
23
|
+
export declare const rm: StepHandler<RmStep>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { StepHandler } from '.';
|
|
2
|
+
/**
|
|
3
|
+
* @inheritDoc rmdir
|
|
4
|
+
* @hasRunnableExample
|
|
5
|
+
* @landingPage /wp-admin/
|
|
6
|
+
* @example
|
|
7
|
+
*
|
|
8
|
+
* <code>
|
|
9
|
+
* {
|
|
10
|
+
* "step": "rmdir",
|
|
11
|
+
* "path": "/wordpress/wp-admin"
|
|
12
|
+
* }
|
|
13
|
+
* </code>
|
|
14
|
+
*/
|
|
15
|
+
export interface RmdirStep {
|
|
16
|
+
step: 'rmdir';
|
|
17
|
+
/** The path to remove */
|
|
18
|
+
path: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Removes a directory at the specified path.
|
|
22
|
+
*/
|
|
23
|
+
export declare const rmdir: StepHandler<RmdirStep>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { StepHandler } from '.';
|
|
2
|
+
import { PHPRunOptions } from '@php-wasm/universal';
|
|
3
|
+
/**
|
|
4
|
+
* @inheritDoc runPHP
|
|
5
|
+
* @hasRunnableExample
|
|
6
|
+
* @example
|
|
7
|
+
*
|
|
8
|
+
* <code>
|
|
9
|
+
* {
|
|
10
|
+
* "step": "runPHP",
|
|
11
|
+
* "options": {
|
|
12
|
+
* "code": "<?php echo $_SERVER['CONTENT_TYPE']; ?>",
|
|
13
|
+
* "headers": {
|
|
14
|
+
* "Content-type": "text/plain"
|
|
15
|
+
* }
|
|
16
|
+
* }
|
|
17
|
+
* }
|
|
18
|
+
* </code>
|
|
19
|
+
*/
|
|
20
|
+
export interface RunPHPWithOptionsStep {
|
|
21
|
+
step: 'runPHPWithOptions';
|
|
22
|
+
/**
|
|
23
|
+
* Run options (See /wordpress-playground/api/universal/interface/PHPRunOptions)
|
|
24
|
+
*/
|
|
25
|
+
options: PHPRunOptions;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Runs PHP code with the given options.
|
|
29
|
+
*/
|
|
30
|
+
export declare const runPHPWithOptions: StepHandler<RunPHPWithOptionsStep>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { StepHandler } from '.';
|
|
2
|
+
/**
|
|
3
|
+
* @inheritDoc runPHP
|
|
4
|
+
* @hasRunnableExample
|
|
5
|
+
* @example
|
|
6
|
+
*
|
|
7
|
+
* <code>
|
|
8
|
+
* {
|
|
9
|
+
* "step": "runPHP",
|
|
10
|
+
* "code": "<?php require_once 'wordpress/wp-load.php'; wp_insert_post(array('post_title' => 'wp-load.php required for WP functionality', 'post_status' => 'publish')); ?>"
|
|
11
|
+
* }
|
|
12
|
+
* </code>
|
|
13
|
+
*/
|
|
14
|
+
export interface RunPHPStep {
|
|
15
|
+
/** The step identifier. */
|
|
16
|
+
step: 'runPHP';
|
|
17
|
+
/** The PHP code to run. */
|
|
18
|
+
code: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Runs PHP code.
|
|
22
|
+
*/
|
|
23
|
+
export declare const runPHP: StepHandler<RunPHPStep>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { StepHandler } from '.';
|
|
2
|
+
/**
|
|
3
|
+
* @inheritDoc setPhpIniEntry
|
|
4
|
+
* @hasRunnableExample
|
|
5
|
+
* @example
|
|
6
|
+
*
|
|
7
|
+
* <code>
|
|
8
|
+
* {
|
|
9
|
+
* "step": "setPhpIniEntry",
|
|
10
|
+
* "key": "display_errors",
|
|
11
|
+
* "value": "1"
|
|
12
|
+
* }
|
|
13
|
+
* </code>
|
|
14
|
+
*/
|
|
15
|
+
export interface SetPhpIniEntryStep {
|
|
16
|
+
step: 'setPhpIniEntry';
|
|
17
|
+
/** Entry name e.g. "display_errors" */
|
|
18
|
+
key: string;
|
|
19
|
+
/** Entry value as a string e.g. "1" */
|
|
20
|
+
value: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Sets a PHP ini entry.
|
|
24
|
+
*/
|
|
25
|
+
export declare const setPhpIniEntry: StepHandler<SetPhpIniEntryStep>;
|
package/lib/steps/site-data.d.ts
CHANGED
|
@@ -45,7 +45,9 @@ export declare const setSiteOptions: StepHandler<SetSiteOptionsStep>;
|
|
|
45
45
|
*/
|
|
46
46
|
export interface UpdateUserMetaStep {
|
|
47
47
|
step: 'updateUserMeta';
|
|
48
|
+
/** An object of user meta values to set, e.g. { "first_name": "John" } */
|
|
48
49
|
meta: Record<string, unknown>;
|
|
50
|
+
/** User ID */
|
|
49
51
|
userId: number;
|
|
50
52
|
}
|
|
51
53
|
/**
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { StepHandler } from '.';
|
|
2
|
+
/**
|
|
3
|
+
* @inheritDoc writeFile
|
|
4
|
+
* @hasRunnableExample
|
|
5
|
+
* @landingPage /test.php
|
|
6
|
+
* @example
|
|
7
|
+
*
|
|
8
|
+
* <code>
|
|
9
|
+
* {
|
|
10
|
+
* "step": "writeFile",
|
|
11
|
+
* "path": "/wordpress/test.php",
|
|
12
|
+
* "data": "<?php echo 'Hello World!'; ?>"
|
|
13
|
+
* }
|
|
14
|
+
* </code>
|
|
15
|
+
*/
|
|
16
|
+
export interface WriteFileStep<ResourceType> {
|
|
17
|
+
step: 'writeFile';
|
|
18
|
+
/** The path of the file to write to */
|
|
19
|
+
path: string;
|
|
20
|
+
/** The data to write */
|
|
21
|
+
data: ResourceType | string | Uint8Array;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Writes data to a file at the specified path.
|
|
25
|
+
*/
|
|
26
|
+
export declare const writeFile: StepHandler<WriteFileStep<File>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wp-playground/blueprints",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": {
|
|
6
6
|
"import": "./index.js",
|
|
@@ -21,5 +21,9 @@
|
|
|
21
21
|
"access": "public",
|
|
22
22
|
"directory": "../../../dist/packages/playground/blueprints"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "6890ff9243f9a10f0b86755fead101647a8c8535",
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=16.15.1",
|
|
27
|
+
"npm": ">=8.11.0"
|
|
28
|
+
}
|
|
25
29
|
}
|
package/schema-readme.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
The JSON schema stored in this directory is used to validate the Blueprints
|
|
2
|
+
and is autogenerated from the Blueprints TypeScript types.
|
|
3
|
+
|
|
4
|
+
Whenever the types are modified, the schema needs to be rebuilt using
|
|
5
|
+
`nx build playground-blueprints` and then committed to the repository.
|
|
6
|
+
|
|
7
|
+
Unfortunately, it is not auto-rebuilt in `npm run dev` mode as the
|
|
8
|
+
`dts-bundle-generator` utility we use for type rollyps does not support
|
|
9
|
+
watching for changes.
|