Skip to content

Commit a370f66

Browse files
✨ Add initial React package from SDK (#2649)
* ✨ Add initial React package from SDK * ✅ Fix testing and add to workspaces * 👷 Add main path for exports * 📝 Update README with more info * 📝 Update package name and version to align with previous * ✅ Add testing run for packages * ✅ Add missing js build step * Consolidate build and test:ci scripts * Remove redundancy --------- Co-authored-by: Robert Wagner <rwwagner90@gmail.com>
1 parent c34772b commit a370f66

File tree

15 files changed

+1247
-74
lines changed

15 files changed

+1247
-74
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -42,31 +42,8 @@ jobs:
4242
- name: Check types
4343
run: pnpm types:check
4444

45-
test-unit:
46-
name: Run Unit Tests
47-
runs-on: ubuntu-latest
48-
49-
steps:
50-
- name: Checkout Repo
51-
uses: actions/checkout@v4
52-
53-
- name: Setup pnpm
54-
uses: wyvox/action-setup-pnpm@v3
55-
56-
- name: Install Dependencies
57-
run: pnpm install
58-
59-
# Run Jest
60-
- name: Run Unit Tests
61-
run: pnpm test:unit:ci
62-
63-
# - name: Publish code coverage
64-
# uses: paambaati/codeclimate-action@v2.7.4
65-
# env:
66-
# CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
67-
68-
test-integration:
69-
name: Run Integration Chrome Tests
45+
test:
46+
name: Tests
7047
runs-on: ubuntu-latest
7148

7249
steps:
@@ -82,11 +59,8 @@ jobs:
8259
- name: Install Cypress Binary
8360
run: pnpm cypress install
8461

85-
- name: Build
86-
run: pnpm build
87-
8862
- name: Install dependencies and setup Cypress
8963
uses: cypress-io/github-action@v6
9064
with:
91-
command: pnpm test:cy:ci:chrome
65+
command: pnpm test:ci
9266
install: false

package.json

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,20 @@
88
"url": "git+https://github.com/shepherd-pro/shepherd.git"
99
},
1010
"license": "MIT",
11-
"maintainers": [
11+
"authors": [
1212
"Robbie Wagner <rwwagner90@gmail.com>",
1313
"Chuck Carpenter <chuck@shipshape.io>"
1414
],
1515
"scripts": {
16-
"build": "pnpm -F shepherd.js build && pnpm build:landing",
16+
"build": "pnpm -F '*' build",
1717
"dev": "pnpm watch",
1818
"docs": "node_modules/.bin/jsdoc -c .jsdoc.js --verbose",
19-
"build:landing": "pnpm -F landing build",
2019
"lint": "pnpm -F '*' lint",
2120
"lint:fix": "pnpm -F '*' lint:fix",
2221
"lint:js": "pnpm -F '*' lint:js",
2322
"start": "pnpm watch",
24-
"test:ci": "pnpm build && pnpm test:unit:ci && pnpm test:cy:ci:chrome",
25-
"test:cy:ci:chrome": "pnpm -F cypress-tests test:ci:chrome",
23+
"test:ci": "pnpm build && pnpm -F '*' test:ci",
2624
"test:cy:watch": "pnpm -F cypress-tests test:watch",
27-
"test:unit:ci": "pnpm -F unit-tests test:ci",
2825
"test:unit:watch": "pnpm -F unit-tests test:watch",
2926
"types:check": "pnpm -F shepherd.js types:check",
3027
"view-coverage": "pnpm -F unit-tests view-coverage",
@@ -62,9 +59,5 @@
6259
"packageManager": "pnpm@8.15.4",
6360
"engines": {
6461
"node": "18.* || >= 20"
65-
},
66-
"authors": [
67-
"Adam Schwartz <adam.flynn.schwartz@gmail.com>",
68-
"Zack Bloom <zackbloom@gmail.com>"
69-
]
62+
}
7063
}

packages/react/.gitignore

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
# Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore
2+
3+
# Logs
4+
5+
logs
6+
_.log
7+
npm-debug.log_
8+
yarn-debug.log*
9+
yarn-error.log*
10+
lerna-debug.log*
11+
.pnpm-debug.log*
12+
13+
# Caches
14+
15+
.cache
16+
17+
# Diagnostic reports (https://nodejs.org/api/report.html)
18+
19+
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
20+
21+
# Runtime data
22+
23+
pids
24+
_.pid
25+
_.seed
26+
*.pid.lock
27+
28+
# Directory for instrumented libs generated by jscoverage/JSCover
29+
30+
lib-cov
31+
32+
# Coverage directory used by tools like istanbul
33+
34+
coverage
35+
*.lcov
36+
37+
# nyc test coverage
38+
39+
.nyc_output
40+
41+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
42+
43+
.grunt
44+
45+
# Bower dependency directory (https://bower.io/)
46+
47+
bower_components
48+
49+
# node-waf configuration
50+
51+
.lock-wscript
52+
53+
# Compiled binary addons (https://nodejs.org/api/addons.html)
54+
55+
build/Release
56+
57+
# Dependency directories
58+
59+
node_modules/
60+
jspm_packages/
61+
62+
# Snowpack dependency directory (https://snowpack.dev/)
63+
64+
web_modules/
65+
66+
# TypeScript cache
67+
68+
*.tsbuildinfo
69+
70+
# Optional npm cache directory
71+
72+
.npm
73+
74+
# Optional eslint cache
75+
76+
.eslintcache
77+
78+
# Optional stylelint cache
79+
80+
.stylelintcache
81+
82+
# Microbundle cache
83+
84+
.rpt2_cache/
85+
.rts2_cache_cjs/
86+
.rts2_cache_es/
87+
.rts2_cache_umd/
88+
89+
# Optional REPL history
90+
91+
.node_repl_history
92+
93+
# Output of 'npm pack'
94+
95+
*.tgz
96+
97+
# Yarn Integrity file
98+
99+
.yarn-integrity
100+
101+
# dotenv environment variable files
102+
103+
.env
104+
.env.development.local
105+
.env.test.local
106+
.env.production.local
107+
.env.local
108+
109+
# parcel-bundler cache (https://parceljs.org/)
110+
111+
.parcel-cache
112+
113+
# Next.js build output
114+
115+
.next
116+
out
117+
118+
# Nuxt.js build / generate output
119+
120+
.nuxt
121+
dist
122+
123+
# Gatsby files
124+
125+
# Comment in the public line in if your project uses Gatsby and not Next.js
126+
127+
# https://nextjs.org/blog/next-9-1#public-directory-support
128+
129+
# public
130+
131+
# vuepress build output
132+
133+
.vuepress/dist
134+
135+
# vuepress v2.x temp and cache directory
136+
137+
.temp
138+
139+
# Docusaurus cache and generated files
140+
141+
.docusaurus
142+
143+
# Serverless directories
144+
145+
.serverless/
146+
147+
# FuseBox cache
148+
149+
.fusebox/
150+
151+
# DynamoDB Local files
152+
153+
.dynamodb/
154+
155+
# TernJS port file
156+
157+
.tern-port
158+
159+
# Stores VSCode versions used for testing VSCode extensions
160+
161+
.vscode-test
162+
163+
# yarn v2
164+
165+
.yarn/cache
166+
.yarn/unplugged
167+
.yarn/build-state.yml
168+
.yarn/install-state.gz
169+
.pnp.*
170+
171+
# IntelliJ based IDEs
172+
.idea
173+
174+
# Finder (MacOS) folder config
175+
.DS_Store

packages/react/CHANGELOG.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
## v4.3.0 (2024-01-21)
2+
3+
## v4.0.1 (2022-07-06)
4+
5+
#### :bug: Bug Fix
6+
7+
- `lib`
8+
- [#637](https://github.com/shipshapecode/react-shepherd/pull/637) Add children field for React 18 ([@andersaamodt](https://github.com/andersaamodt))
9+
10+
#### Committers: 2
11+
12+
- Anders ([@andersaamodt](https://github.com/andersaamodt))
13+
- Chuck Carpenter ([@chuckcarpenter](https://github.com/chuckcarpenter))
14+
15+
## v3.3.1 (2020-11-13)
16+
17+
#### :rocket: Enhancement
18+
19+
- [#439](https://github.com/shipshapecode/react-shepherd/pull/439) ✨ Shepmaster expose more types ([@chuckcarpenter](https://github.com/chuckcarpenter))
20+
- [#391](https://github.com/shipshapecode/react-shepherd/pull/391) Manage secondary property on Step button ([@linsolas](https://github.com/linsolas))
21+
22+
#### :bug: Bug Fix
23+
24+
- [#528](https://github.com/shipshapecode/react-shepherd/pull/528) 🐛 Remove check for current action assignment ([@chuckcarpenter](https://github.com/chuckcarpenter))
25+
26+
#### Committers: 4
27+
28+
- Chuck Carpenter ([@chuckcarpenter](https://github.com/chuckcarpenter))
29+
- Hakeem Almidan ([@Hakeemmidan](https://github.com/Hakeemmidan))
30+
- Romain Linsolas ([@linsolas](https://github.com/linsolas))
31+
- [@cyremur](https://github.com/cyremur)
32+
33+
## v2.0.0 (2019-08-29)
34+
35+
#### :bug: Bug Fix
36+
37+
- [#36](https://github.com/shipshapecode/react-shepherd/pull/36) Make custom button actions work, if specified ([@jmfirth](https://github.com/jmfirth))
38+
- [#38](https://github.com/shipshapecode/react-shepherd/pull/38) Fix adding steps ([@jmfirth](https://github.com/jmfirth))
39+
40+
#### Committers: 1
41+
42+
- Justin Firth ([@jmfirth](https://github.com/jmfirth))

packages/react/README.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# react
2+
3+
[![NPM](https://img.shields.io/npm/v/@shepherdpro/react.svg)](https://www.npmjs.com/package/@shepherdpro/react)
4+
5+
This is a React wrapper for the [Shepherd](https://github.com/@shepherdpro/react) tour library.
6+
It's mainly a wrapper around the Shepherd library that exposes the tour object and methods to the context object
7+
that can be passed into props for dynamic interactivity.
8+
9+
## Install
10+
11+
Use this simple NPM command or whatever package manager is your favorite.
12+
13+
```bash
14+
npm install --save @shepherdpro/react
15+
```
16+
17+
## Usage
18+
19+
### Via Provider/Context
20+
21+
```tsx
22+
import { Component, useContext } from 'react';
23+
import { ShepherdJourneyProvider, useShepherd } from '@shepherdpro/react';
24+
import newSteps from './steps';
25+
26+
const tourOptions = {
27+
defaultStepOptions: {
28+
cancelIcon: {
29+
enabled: true
30+
}
31+
},
32+
useModalOverlay: true
33+
};
34+
35+
function Button() {
36+
const shepherd = useShepherd(ShepherdTourContext);
37+
const tour = shepherd.Tour({
38+
...tourOptions,
39+
steps: newSteps
40+
});
41+
42+
return (
43+
<button className="button dark" onClick={tour.start}>
44+
Start Tour
45+
</button>
46+
);
47+
}
48+
49+
export default function App() {
50+
return (
51+
<div>
52+
<ShepherdJourneyProvider>
53+
<Button />
54+
</ShepherdJourneyProvider>
55+
</div>
56+
);
57+
}
58+
```
59+
60+
## Configuration
61+
62+
The following configuration options for a tour can be set on the `useShepherd` hook to control the way that Shepherd is used. This is simply a POJO passed to Shepherd to use the options noted in the Shepherd Tour [options](https://shepherdjs.dev/docs/Tour.html). You can also pass an API Key to use [Shepherd Pro](https://shepherdpro.com) features for analytics related events tracking.
63+
64+
### apiKey
65+
66+
`PropTypes.string`
67+
Used to connect your tours to a Pro instance to get additional user information and feedback.
68+
69+
## Steps
70+
71+
The options are the same as Shepherd [options](https://shepherdjs.dev/docs/Step.html).
72+
73+
## License
74+
75+
MIT

0 commit comments

Comments
 (0)