Skip to content

Commit

Permalink
Merge pull request #9 from revolunet/fix-publish
Browse files Browse the repository at this point in the history
fix: publish
  • Loading branch information
EmileRolley authored Aug 22, 2024
2 parents b163c15 + acf8daf commit 5f782dc
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 291 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,16 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v4
with:
cache: yarn
- name: Install dependencies
- name: Build demo
run: |
cd demo
yarn install --immutable
- name: Publish to GH Pages
run: |
cd demo
yarn publish-to-gh-pages
yarn build
touch dist/.nojekyll
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: demo/dist
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ with the components from
> If you want to use this library, please [open an
> issue](https://github.com/codegouvfr/rjsf-dsfr/issues) to discuss your needs!
👉 See a demo at : https://codegouvfr.github.io/rjsf-dsfr

## Installation

```bash
Expand Down
2 changes: 0 additions & 2 deletions demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"cs-check": "prettier -l \"src/**/*.ts?(x)\"",
"cs-format": "prettier \"src/**/*.ts?(x)\" --write",
"build": "rimraf build && cross-env NODE_ENV=production vite build",
"publish-to-gh-pages": "npm run build && gh-pages --dist dist/",
"start": "vite --force",
"preview": "vite preview",
"postinstall": "copy-dsfr-to-public",
Expand Down Expand Up @@ -64,7 +63,6 @@
"@vitejs/plugin-react": "^4.2.1",
"cross-env": "^7.0.3",
"esbuild": "^0.18.20",
"gh-pages": "^5.0.0",
"html": "^1.0.0",
"html-webpack-plugin": "^5.6.0",
"loader-utils": "^3.2.1",
Expand Down
2 changes: 1 addition & 1 deletion demo/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const validators: PlaygroundProps['validators'] = {

const themes: PlaygroundProps['themes'] = {
dsfr: {
stylesheets: ['/dsfr/dsfr.main.css', '/dsfr/utility/icons/icons.css'],
stylesheets: ['./dsfr/dsfr.main.css', './dsfr/utility/icons/icons.css'],
theme: DSFRTheme,
},
'bootstrap-4': {
Expand Down
11 changes: 6 additions & 5 deletions demo/src/layout/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import Footer from './Footer';
import { PropsWithChildren } from 'react'
import Footer from './Footer'

export const Layout: React.FC = ({ children }) => {
export const Layout: React.FC<PropsWithChildren> = ({ children }) => {
return (
<div className='container-fluid'>
<div className="container-fluid">
{children}
<Footer />
</div>
);
};
)
}
2 changes: 1 addition & 1 deletion demo/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
"types": ["vite/client", "jest", "node"]
"types": ["vite/client", "node"]
},
"references": [

Expand Down
35 changes: 12 additions & 23 deletions demo/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ import react from '@vitejs/plugin-react'
import * as path from 'path'
import { nodeResolve } from '@rollup/plugin-node-resolve'

const alias: Record<string, string> = {}

// add local path in development to make vite use sources directly avoiding build step
if (process.env.NODE_ENV !== 'production') {
alias['@codegouvfr/rjsf-dsfr'] = path.resolve(__dirname, '../src')
}

// https://vitejs.dev/config/
export default defineConfig({
// base needs to be changed for links to work in GitHub pages
Expand All @@ -15,34 +22,16 @@ export default defineConfig({
build: {
rollupOptions: {
external: [
'@rjsf/core',
'@rjsf/utils',
'@rjsf/validator-ajv8',
'@rjsf/bootstrap-4',
// '@rjsf/core',
// '@rjsf/utils',
// '@rjsf/validator-ajv8',
// '@rjsf/bootstrap-4',
],
plugins: [nodeResolve()],
},
},
resolve: {
preserveSymlinks: true, // Fixes https://github.com/rjsf-team/react-jsonschema-form/issues/3228
alias: {
// mapping packages in monorepo to make vite use sources directly avoiding build step
'@codegouvfr/rjsf-dsfr': path.resolve(__dirname, '../src'),
// '@rjsf/bootstrap-4': path.resolve(__dirname, '../bootstrap-4/src'),
// '@rjsf/chakra-ui': path.resolve(__dirname, '../chakra-ui/src'),
// '@rjsf/core': path.resolve(__dirname, '../core/src'),
// '@rjsf/fluent-ui': path.resolve(__dirname, '../fluent-ui/src'),
// '@rjsf/fluentui-rc': path.resolve(__dirname, '../fluentui-rc/src'),
// '@rjsf/material-ui': path.resolve(__dirname, '../material-ui/src'),
// '@rjsf/mui': path.resolve(__dirname, '../mui/src'),
// '@rjsf/semantic-ui': path.resolve(__dirname, '../semantic-ui/src'),
// '@rjsf/utils': path.resolve(__dirname, '../utils/src'),
// '@rjsf/validator-ajv8': path.resolve(__dirname, '../validator-ajv8/src'),
// validator-ajv6 can not be mapped directly to the sources, because that causes wrong ajv version resolution
// which looks related to: https://github.com/vitejs/vite/issues/12618
//
// the difference when mapping directly vs mapping to src folder - @vitejs/plugin-react can not be applied in the 2nd case
// '@rjsf/validator-ajv6': '@rjsf/validator-ajv6/src',
},
alias,
},
})
Loading

0 comments on commit 5f782dc

Please sign in to comment.