Skip to content

Commit 4093581

Browse files
committed
docs: add documentation
1 parent 3016032 commit 4093581

24 files changed

+1913
-10
lines changed

docs/API.md

+1,784-9
Large diffs are not rendered by default.

docs/NPM-Publishing.md

+125-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,125 @@
1-
TODO - pull from ChatJS
1+
# Npm Package Publish
2+
3+
## [AUTOMATED] GitHub Action Npm Publish Workflow
4+
5+
Steps to configure/update the `npm publish` [workflow](https://github.com/spencerlepine/printify-sdk-js/blob/main/.github/workflows/npm-publish.yml) for automated `npm publish`.
6+
7+
### Setup ⚙️
8+
9+
> Note: must have NPM_TOKEN set in GitHub Secrets, with `automation` permissions
10+
11+
By creating a GitHub deployment environment, you can set environment variables and specify users to approve.
12+
13+
<kbd>
14+
<img width="500" alt="Edit the secrets" src="./images/npm-publishing-repo-secrets.png">
15+
</kbd>
16+
17+
- [npmjs.org] Become admin of the npm package
18+
- [npmjs.org] Create a granular NPM_TOKEN to publish `amazon-connect-chatjs` [[docs](https://docs.npmjs.com/creating-and-viewing-access-tokens)]
19+
- [github.com] Become admin of the GitHub repository
20+
- [github.com] Create/update `release` environment, with required reviewers in repository settings
21+
[[docs](https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment)]
22+
- [github.com] Add `NPM_TOKEN` under the secrets for the `release` environment.
23+
- [github.com] Add/remove admin users to the environment (eg. /settings/environments/873739246/edit)
24+
25+
### Usage
26+
27+
Creating a release and triggering the `npm publish` [workflow](https://github.com/spencerlepine/printify-sdk-js/blob/main/.github/workflows/npm-publish.yml).
28+
29+
1. Create a GitHub release: <https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository>
30+
31+
- Head to <https://github.com/spencerlepine/printify-sdk-js/releases>
32+
- Draft new release
33+
- Choose tag, enter new semver
34+
- Click, "create tag on publish"
35+
- Edit the title/description
36+
- Publish the release
37+
38+
<kbd>
39+
<img width="500" alt="AdminDraftsARelease" src="./images/npm-publishing-create-release.png">
40+
</kbd>
41+
42+
2. Workflow is triggered on release (or you can trigger with manual `workflow_dispatch`):
43+
44+
- Head to <https://github.com/spencerlepine/printify-sdk-js/actions>
45+
- Expand the pending Npm Publish workflow
46+
47+
<kbd>
48+
<img width="500" alt="View_Actions" src="./images/npm-publishing-trigger-workflow.png">
49+
</kbd>
50+
51+
- Review the workflow
52+
53+
<kdb>
54+
<img width="500" alt="AdminEnabledDryRunAccessingEnvironment" src="./images/npm-publishing-execute-dry-run.png">
55+
</kbd>
56+
57+
3. Run the dry-run workflow:
58+
59+
- Approve the workflow
60+
61+
<kbd>
62+
<img width="500" alt="AdminApprovesDryRun" src="./images/npm-publishing-approve-dry-run.png">
63+
</kdb>
64+
65+
- View Dry-run workflow results
66+
67+
<kdb>
68+
<img width="500" alt="DryRunComplete" src="./images/npm-publishing-view-dry-run.png">
69+
</kbd>
70+
71+
4. Run the publish workflow:
72+
73+
- Approve the publish workflow
74+
75+
<kdb>
76+
<img width="500" alt="PublishLiveIsPending" src="./images/npm-publishing-execute-publish.png">
77+
</kbd>
78+
79+
<kdb>
80+
<img width="500" alt="AdminApprovesPublishLive" src="./images/npm-publishing-approve-publish.png">
81+
</kbd>
82+
83+
- View publish workflow results
84+
85+
<kdb>
86+
<img width="500" alt="NpmPublishSuceeds" src="./images/npm-publishing-publish-succeeded.png">
87+
</kbd>
88+
89+
5. View the live updated npm package
90+
91+
<kbd>
92+
<img width="500" alt="Published" src="./images/npm-publishing-view-npm-release.png">
93+
</kbd>
94+
95+
<kbd>
96+
<img width="500" alt="Release is live" src="./images/npm-publishing-view-github-release.png">
97+
</kbd>
98+
99+
## [MANUAL] Publish with npm cli commands
100+
101+
> Documentation for publishing to npmjs.org: <https://docs.npmjs.com/creating-and-publishing-scoped-public-packages>
102+
103+
1. Create a GitHub release: <https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository>
104+
105+
- Head to <https://github.com/spencerlepine/printify-sdk-js/releases>
106+
- Draft new release
107+
- Choose tag, enter new semver
108+
- Click, "create tag on publish"
109+
- Publish the release
110+
111+
2. Publish the package to npm
112+
113+
```sh
114+
git clone https://github.com/spencerlepine/printify-sdk-js.git
115+
cd printify-sdk-js
116+
yarn
117+
yarn build
118+
git status
119+
120+
npm login
121+
npm publish --dry-run
122+
npm publish --access=public
123+
```
124+
125+
3. View release: <https://www.npmjs.com/package/printify-sdk-js>
322 KB
Loading
80.4 KB
Loading
225 KB
Loading
308 KB
Loading
297 KB
Loading
Loading
408 KB
Loading
Loading
398 KB
Loading
Loading
Loading
493 KB
Loading
Loading
Loading
Loading
Loading
60.4 KB
Loading
Loading

docs/images/printify-making-order.jpg

351 KB
Loading
350 KB
Loading
472 KB
Loading

docs/index.md

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
layout: redirect
3+
redirect_to: /docs/API.md
4+
---

0 commit comments

Comments
 (0)