Skip to content

Commit

Permalink
Merge pull request #19 from dpc-sdp/chore/update-readme
Browse files Browse the repository at this point in the history
docs: 📝 update readme
  • Loading branch information
waitingallday authored Feb 22, 2024
2 parents 0a68a1f + ff707da commit cae9b9d
Showing 1 changed file with 46 additions and 33 deletions.
79 changes: 46 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,62 +4,75 @@ A layer is just like a regular Nuxt project, for more information on layers see:

## Setup

Note: Ripple 2 packages are all hosted on Github Packages, any packages published to npm are either pre-release or deprecated, and should not be used! Please see the section [Access to Github Packages repos](https://ripple.sdp.vic.gov.au/design-system/develop/usage/access-to-github-packages) for instructions on how to set up a personal access token, and where to use it.

Install all dependencies:

```bash
npm install
npm i
```

## Development

The `.playground` directory should help you to develop your layer.

Running `npm run dev` will prepare and boot `.playground` directory, which imports your layer itself.

## Publishing
Set up a `.env` file [like this one](https://github.com/dpc-sdp/ripple-framework/blob/develop/examples/nuxt-app/.example.env) under `.playground` to change the backend API, site ID and search details.

To publish, you only have to check if `files` in `package.json` are valid, then run:
To run dev mode in the `.playground` directory, which imports your layer itself:

```bash
npm publish --access public
npm run dev
```

Once done, you will only have to run:
## Publishing

```bash
npm install --save ripple-lib-starter
```
To publish a release, prepare all changes in the `main` branch.

Then add the dependency to into the main Nuxt apps `extends` in `nuxt.config`:
Using the Github interface, **Draft a new release**. Under **Choose a tag**, then create a new tag using semver (typically the first release will be `v0.1.0`), using **Target: main**.

```ts
defineNuxtConfig({
extends: [
'ripple-lib-starter'
]
})
```
Use the tag name as the release title (e.g. `v0.1.0`).

## Development Server
**Generate release notes** can automatically write a changelog of PRs from the last release.

Start the development server on http://localhost:3000
Make sure **Set as the latest release** is ticked then **Publish release**. A Github action will then publish the package [on our org](https://github.com/orgs/dpc-sdp/packages).

```bash
npm run dev
```
## Using the published package

## Production
Add to the site app via `package.json` e.g.

Build the production application:

```bash
npm run build
```json
dependencies: {
...
"@dpc-sdp/ripple-lib-starter": "v0.1.0",
...
}
```

Locally preview production build:
Finally, the site app will need to add this custom later in its own `nuxt.config.ts` e.g.

```bash
npm run preview
```json
export default defineNuxtConfig({
// See https://nuxt.com/docs/getting-started/layers - please add custom layers after the //custom layers comment
extends: [
// Core layers
'@dpc-sdp/nuxt-ripple',
'@dpc-sdp/nuxt-ripple-analytics',
'@dpc-sdp/nuxt-ripple-preview',

// Custom layers
'@dpc-sdp/ripple-lib-starter',

// Content types
'@dpc-sdp/ripple-tide-event',
'@dpc-sdp/ripple-tide-topic',
'@dpc-sdp/ripple-tide-landing-page',
'@dpc-sdp/ripple-tide-grant',
'@dpc-sdp/ripple-tide-publication',
'@dpc-sdp/ripple-tide-media',
'@dpc-sdp/ripple-tide-news',
'@dpc-sdp/ripple-tide-search',

// Local layers
]
})
```

Checkout the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.

0 comments on commit cae9b9d

Please sign in to comment.