Skip to content

Commit

Permalink
Merge pull request #21 from zendesk/melreal/automate-deployments
Browse files Browse the repository at this point in the history
Use NPMJS workflow for publishing packages
  • Loading branch information
melzreal authored Sep 10, 2024
2 parents dd053b7 + 8c770ed commit 62bbdb1
Show file tree
Hide file tree
Showing 7 changed files with 773 additions and 20 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
14 changes: 14 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": [
"@changesets/cli/changelog",
{ "repo": "zendesk/help-center-wysiwyg" }
],
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
5 changes: 5 additions & 0 deletions .changeset/long-walls-peel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@zendesk/help-center-wysiwyg": patch
---

Added package publishing and changelog generation. No code changes
42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Release

on:
push:
branches:
- main

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release: # action to create changesets
name: Create Changeset PR
runs-on: ubuntu-latest
outputs:
changeset: ${{ steps.changeset.outputs.hasChangesets }}

steps:
- name: Checkout Repo
uses: actions/checkout@v3

- name: Setup Node.js 20
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"

- name: Install Dependencies
run: yarn --frozen-lockfile

- name: Create Release Pull Request
uses: changesets/action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

npm-publish:
uses: zendesk/gw/.github/workflows/npm-publication.yml@main
needs: release
if: ${{ needs.release.outputs.changeset == 'false' }}
with:
node_version: "20"
secrets:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
NPM_TOTP_DEVICE: ${{secrets.NPM_TOTP_DEVICE}}
28 changes: 17 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# help-center-wysiwyg

Wysiwyg editor used in Zendesk Help Center

> [!IMPORTANT]
Expand All @@ -18,14 +19,14 @@ The easiest way to initialize the editor is using `createEditor`:
#### createEditor

```js
import { createEditor } from "@zendesk/help-center-wysiwyg"
import { createEditor } from "@zendesk/help-center-wysiwyg";

const editor = await createEditor(target, {
editorType: "supportRequests", // "comments" | "communityPosts" | "supportRequests"
hasAtMentions: true,
userRole: "admin",
brandId: 123,
baseLocale: "en-us"
baseLocale: "en-us",
});
```

Expand All @@ -46,7 +47,7 @@ render(
hasAtMentions: true,
userRole: "admin",
brandId: 123,
baseLocale: "en-us"
baseLocale: "en-us",
})}
/>,
target
Expand All @@ -60,14 +61,15 @@ _Not available when the `editorType` is `"supportRequests"`._
Handling notifications can be done by directly accessing the `Notification` plugin:

```js
const notifications = editor.plugins.get("Notification");

notifications.on("show", (event, data) => {
const message = data.message instanceof Error ? data.message.message : data.message;
const { type, title } = data;
// Log to the console or use your own notification dispatcher:
console.log({ type, title, message });
});
const notifications = editor.plugins.get("Notification");

notifications.on("show", (event, data) => {
const message =
data.message instanceof Error ? data.message.message : data.message;
const { type, title } = data;
// Log to the console or use your own notification dispatcher:
console.log({ type, title, message });
});
```

## Development
Expand All @@ -83,3 +85,7 @@ You should then be able to access it in your browser:
```
open http://localhost:8080/
```

## Making changes

When you're done with your changes, we use [changesets](https://github.com/changesets/changesets) to manage release notes. Please run `changeset` to autogenerate notes to be appended to your pull request.
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"name": "@zendesk/help-center-wysiwyg",
"version": "0.0.5",
"version": "0.0.6",
"description": "Wysiwyg editor used in Zendesk Help Center",
"license": "SEE LICENSE IN LICENSE.md",
"main": "dist/main.js",
"scripts": {
"start": "webpack serve --mode=development",
"build": "webpack --mode=production",
"lint": "eslint . --max-warnings=0"
"lint": "eslint . --max-warnings=0",
"changeset": "changeset"
},
"dependencies": {
"@ckeditor/ckeditor5-basic-styles": "41.3.0",
Expand All @@ -30,6 +31,7 @@
"lodash.debounce": "4.0.8"
},
"devDependencies": {
"@changesets/cli": "2.27.7",
"@ckeditor/ckeditor5-dev-utils": "37.0.1",
"copy-webpack-plugin": "12.0.2",
"css-loader": "6.10.0",
Expand All @@ -45,7 +47,7 @@
"webpack-cli": "5.1.4",
"webpack-dev-server": "5.0.2"
},
"packageManager": "yarn@4.1.1",
"packageManager": "yarn@4.4.1",
"publishConfig": {
"access": "public"
},
Expand Down
Loading

0 comments on commit 62bbdb1

Please sign in to comment.