Skip to content

Commit 5f782dc

Browse files
authored
Merge pull request #9 from revolunet/fix-publish
fix: publish
2 parents b163c15 + acf8daf commit 5f782dc

File tree

8 files changed

+36
-291
lines changed

8 files changed

+36
-291
lines changed

.github/workflows/publish.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,16 @@ jobs:
9797
with:
9898
ref: ${{ github.ref }}
9999
- uses: actions/setup-node@v4
100-
with:
101-
cache: yarn
102-
- name: Install dependencies
100+
- name: Build demo
103101
run: |
104102
cd demo
105103
yarn install --immutable
106-
- name: Publish to GH Pages
107-
run: |
108-
cd demo
109-
yarn publish-to-gh-pages
104+
yarn build
105+
touch dist/.nojekyll
110106
env:
111-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
107+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
108+
- name: Deploy 🚀
109+
uses: JamesIves/github-pages-deploy-action@v4
110+
with:
111+
branch: gh-pages
112+
folder: demo/dist

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ with the components from
1414
> If you want to use this library, please [open an
1515
> issue](https://github.com/codegouvfr/rjsf-dsfr/issues) to discuss your needs!
1616
17+
👉 See a demo at : https://codegouvfr.github.io/rjsf-dsfr
18+
1719
## Installation
1820

1921
```bash

demo/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"cs-check": "prettier -l \"src/**/*.ts?(x)\"",
99
"cs-format": "prettier \"src/**/*.ts?(x)\" --write",
1010
"build": "rimraf build && cross-env NODE_ENV=production vite build",
11-
"publish-to-gh-pages": "npm run build && gh-pages --dist dist/",
1211
"start": "vite --force",
1312
"preview": "vite preview",
1413
"postinstall": "copy-dsfr-to-public",
@@ -64,7 +63,6 @@
6463
"@vitejs/plugin-react": "^4.2.1",
6564
"cross-env": "^7.0.3",
6665
"esbuild": "^0.18.20",
67-
"gh-pages": "^5.0.0",
6866
"html": "^1.0.0",
6967
"html-webpack-plugin": "^5.6.0",
7068
"loader-utils": "^3.2.1",

demo/src/app.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const validators: PlaygroundProps['validators'] = {
1919

2020
const themes: PlaygroundProps['themes'] = {
2121
dsfr: {
22-
stylesheets: ['/dsfr/dsfr.main.css', '/dsfr/utility/icons/icons.css'],
22+
stylesheets: ['./dsfr/dsfr.main.css', './dsfr/utility/icons/icons.css'],
2323
theme: DSFRTheme,
2424
},
2525
'bootstrap-4': {

demo/src/layout/Layout.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import Footer from './Footer';
1+
import { PropsWithChildren } from 'react'
2+
import Footer from './Footer'
23

3-
export const Layout: React.FC = ({ children }) => {
4+
export const Layout: React.FC<PropsWithChildren> = ({ children }) => {
45
return (
5-
<div className='container-fluid'>
6+
<div className="container-fluid">
67
{children}
78
<Footer />
89
</div>
9-
);
10-
};
10+
)
11+
}

demo/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"isolatedModules": true,
1919
"noEmit": true,
2020
"jsx": "react-jsx",
21-
"types": ["vite/client", "jest", "node"]
21+
"types": ["vite/client", "node"]
2222
},
2323
"references": [
2424

demo/vite.config.ts

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ import react from '@vitejs/plugin-react'
33
import * as path from 'path'
44
import { nodeResolve } from '@rollup/plugin-node-resolve'
55

6+
const alias: Record<string, string> = {}
7+
8+
// add local path in development to make vite use sources directly avoiding build step
9+
if (process.env.NODE_ENV !== 'production') {
10+
alias['@codegouvfr/rjsf-dsfr'] = path.resolve(__dirname, '../src')
11+
}
12+
613
// https://vitejs.dev/config/
714
export default defineConfig({
815
// base needs to be changed for links to work in GitHub pages
@@ -15,34 +22,16 @@ export default defineConfig({
1522
build: {
1623
rollupOptions: {
1724
external: [
18-
'@rjsf/core',
19-
'@rjsf/utils',
20-
'@rjsf/validator-ajv8',
21-
'@rjsf/bootstrap-4',
25+
// '@rjsf/core',
26+
// '@rjsf/utils',
27+
// '@rjsf/validator-ajv8',
28+
// '@rjsf/bootstrap-4',
2229
],
2330
plugins: [nodeResolve()],
2431
},
2532
},
2633
resolve: {
2734
preserveSymlinks: true, // Fixes https://github.com/rjsf-team/react-jsonschema-form/issues/3228
28-
alias: {
29-
// mapping packages in monorepo to make vite use sources directly avoiding build step
30-
'@codegouvfr/rjsf-dsfr': path.resolve(__dirname, '../src'),
31-
// '@rjsf/bootstrap-4': path.resolve(__dirname, '../bootstrap-4/src'),
32-
// '@rjsf/chakra-ui': path.resolve(__dirname, '../chakra-ui/src'),
33-
// '@rjsf/core': path.resolve(__dirname, '../core/src'),
34-
// '@rjsf/fluent-ui': path.resolve(__dirname, '../fluent-ui/src'),
35-
// '@rjsf/fluentui-rc': path.resolve(__dirname, '../fluentui-rc/src'),
36-
// '@rjsf/material-ui': path.resolve(__dirname, '../material-ui/src'),
37-
// '@rjsf/mui': path.resolve(__dirname, '../mui/src'),
38-
// '@rjsf/semantic-ui': path.resolve(__dirname, '../semantic-ui/src'),
39-
// '@rjsf/utils': path.resolve(__dirname, '../utils/src'),
40-
// '@rjsf/validator-ajv8': path.resolve(__dirname, '../validator-ajv8/src'),
41-
// validator-ajv6 can not be mapped directly to the sources, because that causes wrong ajv version resolution
42-
// which looks related to: https://github.com/vitejs/vite/issues/12618
43-
//
44-
// the difference when mapping directly vs mapping to src folder - @vitejs/plugin-react can not be applied in the 2nd case
45-
// '@rjsf/validator-ajv6': '@rjsf/validator-ajv6/src',
46-
},
35+
alias,
4736
},
4837
})

0 commit comments

Comments
 (0)