@newfold/wp-module-runtime 1.1.0 → 1.1.3
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/README.md +7 -9
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -130,14 +130,12 @@ Runtime for Newfold WP modules and plugins
|
|
|
130
130
|
|
|
131
131
|
## Installation
|
|
132
132
|
|
|
133
|
-
|
|
133
|
+
Previously, this module's package was hosted at github and these instructions were required [GH Packages Setup](https://gist.github.com/aulisius/1a6e4961f17039d82275a6941331b021). Now the package is hosted at npmjs and this referenced setup is no longer relevant. Find the npmjs package at https://www.npmjs.com/package/@newfold/wp-module-runtime and install just as any other public package. Note the `newfold` org namespace for npmjs and the `newfold-labs` org namespace for github and satis.
|
|
134
134
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
### 2. Install the `@newfold-labs/wp-module-runtime` npm package.
|
|
135
|
+
### 1. Install the `@newfold/wp-module-runtime` npm package.
|
|
138
136
|
|
|
139
137
|
```bash
|
|
140
|
-
npm install @newfold
|
|
138
|
+
npm install @newfold/wp-module-runtime
|
|
141
139
|
```
|
|
142
140
|
|
|
143
141
|
## PHP Module
|
|
@@ -150,10 +148,10 @@ The PHP module can be installed only on the Brand plugin.
|
|
|
150
148
|
composer config repositories.newfold composer https://newfold-labs.github.io/satis
|
|
151
149
|
```
|
|
152
150
|
|
|
153
|
-
### 2. Require the `newfold
|
|
151
|
+
### 2. Require the `newfold/wp-module-runtime` package.
|
|
154
152
|
|
|
155
153
|
```bash
|
|
156
|
-
composer require newfold
|
|
154
|
+
composer require newfold/wp-module-runtime
|
|
157
155
|
```
|
|
158
156
|
|
|
159
157
|
## Usage
|
|
@@ -161,7 +159,7 @@ composer require newfold-labs/wp-module-runtime
|
|
|
161
159
|
In your React component you can import the runtime module as so,
|
|
162
160
|
|
|
163
161
|
```js
|
|
164
|
-
import { NewfoldRuntime } from "@newfold
|
|
162
|
+
import { NewfoldRuntime } from "@newfold/wp-module-runtime";
|
|
165
163
|
|
|
166
164
|
function Component(props) {
|
|
167
165
|
if (NewfoldRuntime.hasCapability("hasYithExtended")) {
|
|
@@ -193,7 +191,7 @@ Now when you use `NewfoldRuntime.sdk.my_field`, you'll see the value as `'custom
|
|
|
193
191
|
As the runtime can be extended via the `newfold-runtime` filter, you can also configure the type definitions to make sure you safely access the extended values. Since `sdk` is an TS interface, it can be easily extended in the following manner.
|
|
194
192
|
|
|
195
193
|
```ts
|
|
196
|
-
declare module "@newfold
|
|
194
|
+
declare module "@newfold/wp-module-runtime" {
|
|
197
195
|
export interface DefaultSdk {
|
|
198
196
|
my_field: string;
|
|
199
197
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@newfold/wp-module-runtime",
|
|
3
3
|
"description": "Runtime for Newfold WP modules and plugins",
|
|
4
4
|
"license": "GPL-2.0-or-later",
|
|
5
|
-
"version": "1.1.
|
|
5
|
+
"version": "1.1.3",
|
|
6
6
|
"main": "build/index.js",
|
|
7
7
|
"files": [
|
|
8
8
|
"build/index.js",
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
],
|
|
11
11
|
"types": "index.d.ts",
|
|
12
12
|
"scripts": {
|
|
13
|
-
"prepublishOnly": "npm run build",
|
|
14
13
|
"build": "wp-scripts build ./src/index.js --config ./scripts/webpack.config.js",
|
|
15
14
|
"lint": "wp-scripts lint-js ./src/index.js",
|
|
16
15
|
"start": "wp-scripts start ./src/index.js --config ./scripts/webpack.config.js",
|
|
@@ -21,6 +20,7 @@
|
|
|
21
20
|
"@wordpress/url": "4.15.0"
|
|
22
21
|
},
|
|
23
22
|
"devDependencies": {
|
|
24
|
-
"@wordpress/scripts": "^30.8.
|
|
23
|
+
"@wordpress/scripts": "^30.8.1",
|
|
24
|
+
"ajv": "^8.17.1"
|
|
25
25
|
}
|
|
26
26
|
}
|