Skip to content

Commit d361ca9

Browse files
committed
Fix build configs to use the pagoda-core module appropriate on custom view side
1 parent d84e76c commit d361ca9

File tree

5 files changed

+60
-5
lines changed

5 files changed

+60
-5
lines changed

.github/workflows/build-frontend.yml

+2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ jobs:
5151
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
5252
- name: build
5353
run: npm run build:development
54+
- name: build(library)
55+
run: npm run build:lib
5456
test:
5557
runs-on: ubuntu-latest
5658
permissions:
+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Release pagoda-core npm package for custom views to GitHub npm Registry
2+
3+
on:
4+
push:
5+
tags:
6+
# NOTE it should be pagoda-core-<major>.<minor>.<patch>
7+
- 'pagoda-core-*'
8+
9+
jobs:
10+
release:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
packages: write
15+
steps:
16+
- uses: actions/checkout@v3
17+
- uses: actions/setup-node@v3
18+
with:
19+
node-version: 16
20+
registry-url: https://npm.pkg.github.com/
21+
scope: "@dmm-com"
22+
- name: Get tag name
23+
id: get_tag
24+
run: echo "tag=${GITHUB_REF#refs/tags/pagoda-core-}" >> $GITHUB_OUTPUT
25+
- name: Set version
26+
run: |
27+
npm version "${GITHUB_REF#refs/tags/pagoda-core-}" --no-git-tag-version
28+
- name: Install dependencies
29+
run: npm ci
30+
env:
31+
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
32+
- name: Build library
33+
run: npm run build:lib
34+
- name: Publish package
35+
run: npm publish
36+
env:
37+
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

docs/content/getting_started/development.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ user@hostname:~/airone$ source virtualenv/bin/activate
264264
(virtualenv) user@hostname:~/airone$ celery -A airone worker -l info
265265
```
266266

267-
## [Experimental] Build the new UI with React
267+
## Build the new UI with React
268268

269269
`/ui/` serves React-based new UI. Before you try it, you need to build `ui.js`:
270270

@@ -366,3 +366,14 @@ When you want to run individual test (e.g. frontend/src/components/user/UserList
366366
```
367367
user@hostname:~/airone$ npx jest -u frontend/src/components/user/UserList.test.tsx
368368
```
369+
370+
## Release pagoda-core package for custom views
371+
372+
We publish the `pagoda-core` package to GitHub npm Registry for custom views.
373+
When you want to release a new version of the package, create a tag with the format `pagoda-core-x.y.z` (e.g. `pagoda-core-0.0.1`). The GitHub Actions workflow will automatically build and publish the package.
374+
375+
If you hope to try building the module:
376+
377+
```sh
378+
$ npm run build:lib
379+
```

package.json

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@syucream/pagoda-core",
2+
"name": "@dmm-com/pagoda-core",
33
"version": "1.0.0",
44
"description": "[![CircleCI](https://circleci.com/gh/dmm-com/airone.svg?style=svg&circle-token=2e12c068b0ed1bab9d0c2d72529d5ee1da9b53b4)](https://circleci.com/gh/dmm-com/airone)",
55
"main": "frontend/dist/pagoda-core.js",
@@ -33,7 +33,7 @@
3333
},
3434
"repository": {
3535
"type": "git",
36-
"url": "git+https://github.com/syucream/airone.git"
36+
"url": "git+https://github.com/dmm-com/airone.git"
3737
},
3838
"publishConfig": {
3939
"registry": "https://npm.pkg.github.com/"
@@ -45,9 +45,9 @@
4545
"author": "Hiroyasu OHYAMA",
4646
"license": "GPLv2",
4747
"bugs": {
48-
"url": "https://github.com/userlocalhost/airone/issues"
48+
"url": "https://github.com/dmm-com/pagoda/issues"
4949
},
50-
"homepage": "https://github.com/userlocalhost/airone#readme",
50+
"homepage": "https://github.com/dmm-com/pagoda#readme",
5151
"devDependencies": {
5252
"@babel/core": "^7.12.10",
5353
"@babel/plugin-transform-runtime": "^7.14.5",
@@ -117,5 +117,9 @@
117117
"webpack-bundle-analyzer": "^4.9.0",
118118
"webpack-cli": "^4.4.0",
119119
"zod": "^3.22.4"
120+
},
121+
"peerDependencies": {
122+
"react": "^18.0.0",
123+
"react-dom": "^18.0.0"
120124
}
121125
}

webpack.library.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,5 @@ module.exports = {
3939
'node_modules',
4040
],
4141
},
42+
externals: ['react', 'react-dom'],
4243
}

0 commit comments

Comments
 (0)