@wp-operations/wp-ide 0.3.1 → 0.4.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 (3) hide show
  1. package/README.md +1 -1
  2. package/dist/index.js +16 -14
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -16,7 +16,7 @@ It opens on `http://127.0.0.1:4500/#token=…` with:
16
16
 
17
17
  It listens on 127.0.0.1 only, and every request needs the token from the printed URL. It never touches `.git/`, `vendor/`, `node_modules/` or `.local/`, stays inside the repository, and limits files to 400 KB.
18
18
 
19
- wp-ops and wp-code also use it as a library: it reads the platform repository (`.github/platform.json`, the app manifests, apps and plugins) and makes the same composer.json edits the platform makes.
19
+ wp-ops and wp-code also use it as a library: it reads the platform repository (`.github/app.json`, the app manifests, apps and plugins) and makes the same composer.json edits the platform makes.
20
20
 
21
21
  ## License
22
22
 
package/dist/index.js CHANGED
@@ -137,22 +137,18 @@ async function runBlueprint(php, blueprint) {
137
137
  // src/platform.ts
138
138
  import fs3 from "fs";
139
139
  import path4 from "path";
140
- var LAYOUT_FILE = ".github/platform.json";
140
+ var LAYOUT_FILE = ".github/app.json";
141
+ var LEGACY_LAYOUT_FILE = ".github/platform.json";
142
+ var RESERVED_KINDS = ["app"];
141
143
  var PLUGIN_TYPE = "psr4-plugin";
142
144
  var APP_TYPE = "wp-app";
143
145
  var COMPOSER_ACTIONS = ["add", "remove", "update"];
144
146
  var DEFAULT_KINDS = [
145
147
  {
146
- key: "service-apps",
147
- label: "Service apps",
148
- folder: "service-apps",
149
- manifest: ".github/service-apps.json"
150
- },
151
- {
152
- key: "homepages",
153
- label: "Homepages",
154
- folder: "homepages",
155
- manifest: ".github/homepages.json"
148
+ key: "apps",
149
+ label: "Apps",
150
+ folder: "apps",
151
+ manifest: ".github/apps.json"
156
152
  }
157
153
  ];
158
154
  function slug(value) {
@@ -209,11 +205,14 @@ function normalizeLayout(data) {
209
205
  kinds
210
206
  };
211
207
  }
208
+ function layoutFile(rootDir) {
209
+ return fs3.existsSync(path4.join(rootDir, LAYOUT_FILE)) || !fs3.existsSync(path4.join(rootDir, LEGACY_LAYOUT_FILE)) ? LAYOUT_FILE : LEGACY_LAYOUT_FILE;
210
+ }
212
211
  function hasLayout(rootDir) {
213
- return fs3.existsSync(path4.join(rootDir, LAYOUT_FILE));
212
+ return fs3.existsSync(path4.join(rootDir, layoutFile(rootDir)));
214
213
  }
215
214
  function readLayout(rootDir) {
216
- const data = readJson(path4.join(rootDir, LAYOUT_FILE));
215
+ const data = readJson(path4.join(rootDir, layoutFile(rootDir)));
217
216
  if (data === null) {
218
217
  throw new Error(
219
218
  `${LAYOUT_FILE} was not found in ${rootDir}. Run "wp-ops init" first.`
@@ -468,7 +467,7 @@ iframe { width:100%; height:100%; border:0; background:#fff; }
468
467
  nav.appendChild(item(p.name, p.version, p.warnings.join('; '), function () { open({ dir: p.path }); }));
469
468
  });
470
469
  } else {
471
- nav.appendChild(el('div', 'empty', 'No .github/platform.json here. Run "wp-ops init" to make this a platform repository.'));
470
+ nav.appendChild(el('div', 'empty', 'No .github/app.json here. Run "wp-ops init" to make this a platform repository.'));
472
471
  }
473
472
  nav.appendChild(el('h4', '', 'Repository'));
474
473
  nav.appendChild(item('All files', '', '', function () { open({ dir: '' }); }));
@@ -793,10 +792,12 @@ export {
793
792
  CONFIG_FILENAME,
794
793
  DEFAULT_KINDS,
795
794
  LAYOUT_FILE,
795
+ LEGACY_LAYOUT_FILE,
796
796
  LOCAL_DIR,
797
797
  MAX_FILE_BYTES,
798
798
  PACKAGE_NAME,
799
799
  PLUGIN_TYPE,
800
+ RESERVED_KINDS,
800
801
  ROOT_MARKERS,
801
802
  appServerOptions,
802
803
  editComposer,
@@ -806,6 +807,7 @@ export {
806
807
  findRootDir,
807
808
  folder,
808
809
  hasLayout,
810
+ layoutFile,
809
811
  layoutJson,
810
812
  listApps,
811
813
  listPlugins,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wp-operations/wp-ide",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "A simple WordPress-first browser editor with live preview, and the platform repository library used by wp-ops and wp-code. Comes with @wp-operations/wp-ops.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",