Skip to content

Commit

Permalink
update readme to reference npmjs package
Browse files Browse the repository at this point in the history
  • Loading branch information
circlecube committed Jan 13, 2025
1 parent b506a0e commit 8a8a7bc
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,12 @@ Runtime for Newfold WP modules and plugins

## Installation

### 1. Setup GitHub registry
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.

Follow instructions at [GH Packages Setup](https://gist.github.com/aulisius/1a6e4961f17039d82275a6941331b021).

### 2. Install the `@newfold-labs/wp-module-runtime` npm package.
### 1. Install the `@newfold/wp-module-runtime` npm package.

```bash
npm install @newfold-labs/wp-module-runtime
npm install @newfold/wp-module-runtime
```

## PHP Module
Expand All @@ -150,18 +148,18 @@ The PHP module can be installed only on the Brand plugin.
composer config repositories.newfold composer https://newfold-labs.github.io/satis
```

### 2. Require the `newfold-labs/wp-module-runtime` package.
### 2. Require the `newfold/wp-module-runtime` package.

```bash
composer require newfold-labs/wp-module-runtime
composer require newfold/wp-module-runtime
```

## Usage

In your React component you can import the runtime module as so,

```js
import { NewfoldRuntime } from "@newfold-labs/wp-module-runtime";
import { NewfoldRuntime } from "@newfold/wp-module-runtime";

function Component(props) {
if (NewfoldRuntime.hasCapability("hasYithExtended")) {
Expand Down Expand Up @@ -193,7 +191,7 @@ Now when you use `NewfoldRuntime.sdk.my_field`, you'll see the value as `'custom
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.

```ts
declare module "@newfold-labs/wp-module-runtime" {
declare module "@newfold/wp-module-runtime" {
export interface DefaultSdk {
my_field: string;
}
Expand Down

0 comments on commit 8a8a7bc

Please sign in to comment.