Skip to content

Commit e1dbe90

Browse files
authored
Merge pull request #311 from craquet/react-wrapper
Restructure as monorepo and automatically generate react-wrapper
2 parents 3f95fd6 + c58c009 commit e1dbe90

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+11390
-5591
lines changed

.github/workflows/deploy-storybook.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ jobs:
2020
run: npm ci
2121
- name: Build component
2222
run: npm run build
23+
working-directory: packages/stencil-library
2324
- name: Build Storybook
2425
run: npm run build-storybook
26+
working-directory: packages/stencil-library
2527
- name: Upload Storybook to GitHub Pages
2628
uses: actions/upload-pages-artifact@v3
2729
with:
28-
path: "storybook-static"
30+
path: "packages/stencil-library/storybook-static"
2931

3032
- name: Deploy to GitHub Pages
3133
uses: actions/deploy-pages@v4

.github/workflows/github-npm-publish.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030
node-version: 20
3131
registry-url: https://npm.pkg.github.com/
3232
- run: npm ci
33-
- run: npm publish
33+
- run: npx lerna run build
34+
- run: npx lerna publish from-package
3435
env:
3536
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

.github/workflows/npm-ci.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: NPM Clean Install
2+
3+
on:
4+
push:
5+
branches: [ main, dev ]
6+
pull_request:
7+
branches: [ main, dev ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
# Use both LTS releases and latest one for tests
15+
node: [ 16, 18, 20 ]
16+
steps:
17+
- uses: actions/[email protected]
18+
- uses: actions/setup-node@v4
19+
with:
20+
node-version: ${{ matrix.node }}
21+
- run: npm ci
22+
- run: npx lerna run build

.github/workflows/real-npm-publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
node-version: 20
1515
registry-url: https://registry.npmjs.org/
1616
- run: npm clean-install
17-
- run: npm run build
18-
- run: npm publish --access public
17+
- run: npx lerna run build
18+
- run: npx lerna publish from-package
1919
env:
2020
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
hydrate/
12
dist/
23
www/
34
loader/
@@ -155,3 +156,5 @@ fabric.properties
155156
!.idea/runConfigurations
156157

157158
# End of https://www.toptal.com/developers/gitignore/api/macos,webstorm+all,storybookjs
159+
160+
.nx

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ repos:
77
- id: trailing-whitespace
88
- id: check-yaml
99
- id: check-added-large-files
10-
- repo: https://github.com/Materials-Data-Science-and-Informatics/somesy
11-
rev: "v0.4.2"
12-
hooks:
13-
- id: somesy
10+
# - repo: https://github.com/Materials-Data-Science-and-Informatics/somesy
11+
# rev: "v0.4.2"
12+
# hooks:
13+
# - id: somesy

README.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ The `pid-component` is an easily extensible web component that can be used to di
66
identifiers in a user-friendly way.
77
It is easily extensible to support other identifier types.
88

9+
> A [React wrapper]() is also available
10+
911
The `pid-component` dynamically renders a component based on the value of the `value` property.
1012
Depending on the value, it decides which component to render, what priority to give it, and what props to pass to it.
1113
It also renders itself recursively for all its children when unfolded.
@@ -42,24 +44,41 @@ You can try this web component in the [demo](https://kit-data-manager.github.io/
4244

4345
There are detailed docs for the `pid-component` component
4446
available [in the Storybook](https://kit-data-manager.github.io/pid-component) and in
45-
the [source code](src/components/pid-component/readme.md).
47+
the [source code](packages/stencil-library/src/components/pid-component/readme.md).
4648

4749
**Please notice that you must use the hyphenated version of an attribute when using the component directly in HTML (
4850
e.g. `currentLevelOfSubcomponents` -> `current-level-of-subcomponents`).
4951
When using inside Stencil or with JSX/TSX syntax, you must use the camelCase version.**
5052

53+
## Monorepo
54+
55+
This is a monorepo containing the following packages:
56+
57+
- stencil-library (@kit-data-manager/pid-component)
58+
- react-library (@kit-data-manager/react-pid-component)
59+
60+
[Lerna](https://lerna.js.org) is used for managing and building the packages (but you can also do it manually). To use, install Lerna:
61+
62+
npm install --global lerna
63+
64+
and then use it to build the packages:
65+
66+
lerna run build
67+
68+
It will make sure to build the packages in the correct order.
69+
5170
## How to run when developing
5271

5372
1. Clone the repo
5473
2. Run `npm install`
5574

56-
For running storybook in dev mode, run these commands in separate terminals:
75+
For running storybook in dev mode, navigate to `packages/stencil-library` and run these commands in separate terminals:
5776

5877
- `npm run buildWatch`
5978
- `npm run storybook`
6079

6180
Attention: Do **NOT** run `npm run start`. It will cause the storybook to not work properly.
62-
If you did run `npm run start`, delete the following folders and run `npm install` again:
81+
If you did run `npm run start`, delete the following folders (in `packages/stencil-library`) and run `npm install` again:
6382

6483
- `node_modules`
6584
- `www`

lerna.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
3+
"version": "independent"
4+
}

0 commit comments

Comments
 (0)