@wp-playground/blueprints 0.1.61 → 0.2.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/lib/compile.d.ts CHANGED
@@ -4,7 +4,7 @@ import { 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"];
7
+ declare const supportedWordPressVersions: readonly ["6.2", "6.1", "6.0", "5.9", "nightly"];
8
8
  type supportedWordPressVersion = (typeof supportedWordPressVersions)[number];
9
9
  export interface CompiledBlueprint {
10
10
  /** The requested versions of PHP and WordPress for the blueprint */
@@ -33,5 +33,12 @@ 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
44
  export {};
@@ -1,11 +1,16 @@
1
1
  import { StepHandler } from '.';
2
+ /**
3
+ * @inheritDoc activatePlugin
4
+ */
2
5
  export interface ActivatePluginStep {
3
6
  step: 'activatePlugin';
7
+ /** 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
8
  pluginPath: string;
9
+ /** Optional. Plugin name to display in the progress bar. */
5
10
  pluginName?: string;
6
11
  }
7
12
  /**
8
- * Activates a WordPress plugin in the Playground.
13
+ * Activates a WordPress plugin (if it's installed).
9
14
  *
10
15
  * @param playground The playground client.
11
16
  */
@@ -1,10 +1,16 @@
1
1
  import { StepHandler } from '.';
2
+ /**
3
+ * @inheritDoc activateTheme
4
+ */
2
5
  export interface ActivateThemeStep {
3
6
  step: 'activateTheme';
7
+ /**
8
+ * The name of the theme folder inside wp-content/themes/
9
+ */
4
10
  themeFolderName: string;
5
11
  }
6
12
  /**
7
- * Activates a WordPress theme in the Playground.
13
+ * Activates a WordPress theme (if it's installed).
8
14
  *
9
15
  * @param playground The playground client.
10
16
  * @param themeFolderName The theme folder name.
@@ -1,4 +1,7 @@
1
1
  import { StepHandler } from '..';
2
+ /**
3
+ * @private
4
+ */
2
5
  export interface ApplyWordPressPatchesStep {
3
6
  step: 'applyWordPressPatches';
4
7
  siteUrl?: string;
@@ -41,6 +41,9 @@ export declare const runPHP: StepHandler<RunPHPStep>;
41
41
  */
42
42
  export interface RunPHPWithOptionsStep {
43
43
  step: 'runPHPWithOptions';
44
+ /**
45
+ * Run options (See /wordpress-playground/api/universal/interface/PHPRunOptions)
46
+ */
44
47
  options: PHPRunOptions;
45
48
  }
46
49
  /**
@@ -62,7 +65,9 @@ export declare const runPHPWithOptions: StepHandler<RunPHPWithOptionsStep>;
62
65
  */
63
66
  export interface SetPhpIniEntryStep {
64
67
  step: 'setPhpIniEntry';
68
+ /** Entry name e.g. "display_errors" */
65
69
  key: string;
70
+ /** Entry value as a string e.g. "1" */
66
71
  value: string;
67
72
  }
68
73
  /**
@@ -91,6 +96,9 @@ export declare const setPhpIniEntry: StepHandler<SetPhpIniEntryStep>;
91
96
  */
92
97
  export interface RequestStep {
93
98
  step: 'request';
99
+ /**
100
+ * Request details (See /wordpress-playground/api/universal/interface/PHPRequest)
101
+ */
94
102
  request: PHPRequest;
95
103
  }
96
104
  /**
@@ -113,7 +121,9 @@ export declare const request: StepHandler<RequestStep>;
113
121
  */
114
122
  export interface CpStep {
115
123
  step: 'cp';
124
+ /** Source path */
116
125
  fromPath: string;
126
+ /** Target path */
117
127
  toPath: string;
118
128
  }
119
129
  /**
@@ -136,7 +146,9 @@ export declare const cp: StepHandler<CpStep>;
136
146
  */
137
147
  export interface MvStep {
138
148
  step: 'mv';
149
+ /** Source path */
139
150
  fromPath: string;
151
+ /** Target path */
140
152
  toPath: string;
141
153
  }
142
154
  /**
@@ -157,6 +169,7 @@ export declare const mv: StepHandler<MvStep>;
157
169
  */
158
170
  export interface MkdirStep {
159
171
  step: 'mkdir';
172
+ /** The path of the directory you want to create */
160
173
  path: string;
161
174
  }
162
175
  /**
@@ -178,6 +191,7 @@ export declare const mkdir: StepHandler<MkdirStep>;
178
191
  */
179
192
  export interface RmStep {
180
193
  step: 'rm';
194
+ /** The path to remove */
181
195
  path: string;
182
196
  }
183
197
  /**
@@ -199,6 +213,7 @@ export declare const rm: StepHandler<RmStep>;
199
213
  */
200
214
  export interface RmdirStep {
201
215
  step: 'rmdir';
216
+ /** The path to remove */
202
217
  path: string;
203
218
  }
204
219
  /**
@@ -221,7 +236,9 @@ export declare const rmdir: StepHandler<RmdirStep>;
221
236
  */
222
237
  export interface WriteFileStep<ResourceType> {
223
238
  step: 'writeFile';
239
+ /** The path of the file to write to */
224
240
  path: string;
241
+ /** The data to write */
225
242
  data: ResourceType | string | Uint8Array;
226
243
  }
227
244
  /**
@@ -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 site URL of the WordPress installation.
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
- * The step object for defining constants in the wp-config.php file of a WordPress installation.
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
- * Sets site URL of the WordPress installation.
31
+ * Defines the wp-config.php constants
20
32
  *
21
33
  * @param playground The playground client.
22
- * @param wpConfigConst An object containing the constants to be defined and the optional virtual file system configuration file path.
23
- * @returns Returns the virtual file system configuration file path.
34
+ * @param wpConfigConst
24
35
  */
25
36
  export declare const defineWpConfigConsts: StepHandler<DefineWpConfigConstsStep>;
@@ -9,20 +9,31 @@ 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
+ */
12
15
  export interface ReplaceSiteStep<ResourceType> {
13
16
  step: 'replaceSite';
17
+ /** The zip file containing the new WordPress site */
14
18
  fullSiteZip: ResourceType;
15
19
  }
16
20
  /**
17
- * Replace the current site with the contents of a full site zip file.
21
+ * Replace the current site with a site from the provided zip file.
22
+ * Remember to install the SQLite integration plugin in the zipped site:
23
+ * https://wordpress.org/plugins/sqlite-database-integration.
18
24
  *
19
25
  * @param playground Playground client.
20
26
  * @param fullSiteZip Zipped WordPress site.
21
27
  */
22
28
  export declare const replaceSite: StepHandler<ReplaceSiteStep<File>>;
29
+ /**
30
+ * @inheritDoc unzip
31
+ */
23
32
  export interface UnzipStep {
24
33
  step: 'unzip';
34
+ /** The zip file to extract */
25
35
  zipPath: string;
36
+ /** The path to extract the zip file to */
26
37
  extractToPath: string;
27
38
  }
28
39
  /**
@@ -52,8 +63,12 @@ export declare function exportWXR(playground: UniversalPHP): Promise<File>;
52
63
  * @returns WXZ file
53
64
  */
54
65
  export declare function exportWXZ(playground: UniversalPHP): Promise<File>;
66
+ /**
67
+ * @inheritDoc importFile
68
+ */
55
69
  export interface ImportFileStep<ResourceType> {
56
70
  step: 'importFile';
71
+ /** The file to import */
57
72
  file: ResourceType;
58
73
  }
59
74
  /**
@@ -1,4 +1,7 @@
1
1
  import { StepHandler } from '.';
2
+ /**
3
+ * @private
4
+ */
2
5
  export interface RunWpInstallationWizardStep {
3
6
  step: 'runWpInstallationWizard';
4
7
  options: WordPressInstallationOptions;
@@ -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
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wp-playground/blueprints",
3
- "version": "0.1.61",
3
+ "version": "0.2.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": "f2cd7382004f7b003904b5db1d33d37fd2b1bfab"
24
+ "gitHead": "cd4062de74f7f18058d3f962e124d0fdff78b5a7",
25
+ "engines": {
26
+ "node": ">=16.15.1",
27
+ "npm": ">=8.11.0"
28
+ }
25
29
  }
@@ -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.