Skip to content

Commit

Permalink
Create dist directory if it does not exist yet
Browse files Browse the repository at this point in the history
  • Loading branch information
unstubbable committed Oct 11, 2023
1 parent ff2870f commit e9c8717
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: 'public'
path: 'dist'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
node_modules
public
dist
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<link rel="modulepreload" href="https://esm.sh/react@18.2.0?dev" />

<script src="js/integrator.js" type="module" defer></script>
<script src="integrator.js" type="module" defer></script>
</head>

<body>
Expand Down
2 changes: 1 addition & 1 deletion scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const dirname = path.dirname(url.fileURLToPath(import.meta.url));
export const options = {
absWorkingDir: path.join(dirname, '..'),
entryPoints: ['src/integrator.tsx', 'src/feature-app.tsx'],
outdir: 'public/js',
outdir: 'dist',
bundle: true,
format: 'esm',
external: ['react'],
Expand Down
5 changes: 4 additions & 1 deletion scripts/prepare.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ const finalHtml =
? originalHtml.replace(/\?dev/g, '')
: originalHtml;

await fs.writeFile(path.join(dirname, '../public/index.html'), finalHtml);
const distDirname = path.join(dirname, '../dist');

await fs.mkdir(distDirname, {recursive: true});
await fs.writeFile(path.join(distDirname, 'index.html'), finalHtml);
2 changes: 1 addition & 1 deletion scripts/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import url from 'url';
import {options} from './build.js';

const dirname = path.dirname(url.fileURLToPath(import.meta.url));
const servedir = path.join(dirname, '../public');
const servedir = path.join(dirname, '../dist');

let ctx = await esbuild.context(options);

Expand Down

0 comments on commit e9c8717

Please sign in to comment.