A single page application using @demee/anigraph-ui, built with webpack and ready for GitHub Pages deployment.
- Node.js (v14 or higher)
- npm
- GitHub personal access token with
read:packagespermission
Create or update .npmrc file in the project root with your GitHub token:
echo "//npm.pkg.github.com/:_authToken=YOUR_GITHUB_TOKEN" >> .npmrcReplace YOUR_GITHUB_TOKEN with your actual GitHub personal access token.
npm installThis will install:
- Webpack and related build tools
- @demee/[email protected]
npm run serveThis will start a development server at http://localhost:9000 with hot module replacement.
npm run devThis will watch for file changes and rebuild automatically.
Build the application for production:
npm run buildThis creates an optimized bundle in the dist/ directory.
-
Build the project:
npm run build
-
Push the
distfolder to thegh-pagesbranch:git subtree push --prefix dist origin gh-pages
Create .github/workflows/deploy.yml:
name: Deploy to GitHub Pages
on:
push:
branches: [ main ]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Configure npm for GitHub Packages
run: |
echo "@demee:registry=https://npm.pkg.github.com" >> .npmrc
echo "//npm.pkg.github.com/:_authToken=\${{ secrets.GITHUB_TOKEN }}" >> .npmrc
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: \${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist- Go to your repository settings
- Navigate to "Pages" section
- Set source to "gh-pages" branch
- Your site will be available at
https://<username>.github.io/<repository>/
.
├── src/
│ ├── index.html # HTML template
│ ├── index.js # Main entry point
│ └── styles.css # Global styles
├── dist/ # Production build output (generated)
├── webpack.config.js # Webpack configuration
├── package.json # Project dependencies and scripts
└── .npmrc # npm registry configuration
- Authenticate with GitHub npm registry (see Setup section)
- Install @demee/anigraph-ui package
- Uncomment the import statement in
src/index.js - Implement your application using Anigraph UI components
- Build and deploy to GitHub Pages
MIT