Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
34d2f9d
Add github pages preview
jbuckner Jan 14, 2026
a9da28a
Update ghpages scripts
jbuckner Jan 14, 2026
9ac7d1d
Update pages command
jbuckner Jan 15, 2026
ed03222
Update branch name
jbuckner Jan 21, 2026
5b20757
Update ghpages build config
jbuckner Jan 21, 2026
bcf6df7
Remove type reference
jbuckner Jan 21, 2026
aa11afb
Bump
jbuckner Jan 21, 2026
ae87184
Bump
jbuckner Jan 21, 2026
87ce860
Move workflows
jbuckner Jan 21, 2026
036c56f
Update ghpages scripts
jbuckner Jan 22, 2026
131cb48
Test ghpages build without wireit
jbuckner Jan 22, 2026
fcdba50
Revert "Test ghpages build without wireit"
jbuckner Jan 22, 2026
59b5bec
Reapply "Test ghpages build without wireit"
jbuckner Jan 26, 2026
f054924
Revert "Reapply "Test ghpages build without wireit""
jbuckner Jan 26, 2026
b1ed4aa
Add permissions
jbuckner Jan 27, 2026
0106dbe
Try using npm run build
jbuckner Jan 27, 2026
b968a7b
Try just running vite build
jbuckner Jan 27, 2026
9d85a6d
Update base path
jbuckner Jan 27, 2026
b97b99b
Use ghpages:publish
jbuckner Jan 27, 2026
da2d069
Set up git
jbuckner Jan 27, 2026
dd7a89a
Merge branch 'main' into github-pages
jbuckner Jan 27, 2026
6d79b3a
Remove unused npm scripts
jbuckner Jan 27, 2026
f99c48d
Combine build/no-jekyl step
jbuckner Jan 27, 2026
e2576ad
Update workflows
jbuckner Jan 27, 2026
86033ca
Fix class names
jbuckner Jan 27, 2026
6b41a87
Remove unused package
jbuckner Jan 27, 2026
bdb6930
Linting
jbuckner Jan 27, 2026
7abdc3b
Move tslib to devDependencies
jbuckner Jan 27, 2026
6727556
Revert tslib change
jbuckner Jan 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/gh-pages-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This workflow will generate the static page under `main` subdirectory inside the `ghpages` branch

# This workflow will run every time new changes were pushed to the `main` branch

name: App build CI/CD to main branch
permissions:
contents: write

on:
push:
branches: [ main ]

jobs:
build-and-deploy:
concurrency: ci-${{ github.ref }}
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v6
with:
persist-credentials: false

- name: Set up Git
run: |
git config --global user.name "Github Actions"
git config --global user.email "actions@github.com"

- name: Install and Build 🔧
run: |
npm ci
npm run ghpages:build

- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: ghpages
folder: ghpages
clean-exclude: pr/
force: false
target-folder: main
65 changes: 65 additions & 0 deletions .github/workflows/pr-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# This workflow will generate the static page under `pr` subdirectory inside the `ghpages` branch

# This workflow will run every time there's a PR opened, reopened, synchronize, or closed

name: Deploy PR previews

on:
pull_request:
types:
- opened
- reopened
- synchronize
- closed

concurrency: preview-${{ github.ref }}

env:
PREVIEW_BRANCH: ghpages
jobs:
deploy-preview:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- uses: actions/setup-node@v4

- name: Set up Git
run: |
git config --global user.name "Github Actions"
git config --global user.email "actions@github.com"

- name: Install and Build
run: |
npm install
npm run ghpages:build

# Reference: https://github.com/rossjrw/pr-preview-action
- name: Deploy preview
uses: rossjrw/pr-preview-action@v1
id: preview-step
with:
source-dir: ./ghpages/
umbrella-dir: pr
preview-branch: ${{ env.PREVIEW_BRANCH }}
comment: false

- uses: marocchino/sticky-pull-request-comment@v2
if: steps.preview-step.outputs.deployment-action == 'deploy'
with:
header: pr-preview
message: |
[PR Preview Action](https://github.com/rossjrw/pr-preview-action) ${{ steps.preview-step.outputs.action-version }}
:---:
| <p></p> :rocket: View preview at <br> ${{ steps.preview-step.outputs.preview-url }}demo/ <br><br>
| <h6>Built to branch [`${{ env.PREVIEW_BRANCH }}`](${{ github.server_url }}/${{ github.repository }}/tree/${{ env.PREVIEW_BRANCH }}) at ${{ steps.preview-step.outputs.action-start-time }}. <br> Preview will be ready when the [GitHub Pages deployment](${{ github.server_url }}/${{ github.repository }}/deployments) is complete. <br><br> </h6>

- uses: marocchino/sticky-pull-request-comment@v2
if: steps.preview-step.outputs.deployment-action == 'remove'
with:
header: pr-preview
message: |
[PR Preview Action](https://github.com/rossjrw/pr-preview-action) ${{ steps.preview-step.outputs.action-version }}
:---:
Preview removed because the pull request was closed.
${{ steps.preview-step.outputs.action-start-time }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ node_modules/
dist
coverage
__screenshots__
ghpages
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ import '@demo/story-template';
...
render() {
return html`
<story-template elementTag="ia-button" .exampleUsage=${this.exampleUsage}>
<story-template elementTag="ia-button" elementClassName="IAButton" .exampleUsage=${this.exampleUsage}>
<div slot="demo">
<ia-button @click=${() => alert('Button clicked!')}
>Click Me</ia-button
Expand Down
16 changes: 10 additions & 6 deletions demo/story-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ export type StyleInputData = {
export class StoryTemplate extends LitElement {
@property({ type: String }) elementTag = '';

@property({ type: String }) elementClassName = '';

@property({ type: String }) exampleUsage = '';

@property({ type: Object }) styleInputData?: StyleInputData;
Expand Down Expand Up @@ -135,26 +137,28 @@ export class StoryTemplate extends LitElement {
}

private get importCode(): string {
return `
if (this.elementClassName) {
return `
import '${this.modulePath}';
import { ${this.elementClassName} } from '${this.modulePath}';
`;
} else {
return `
import '${this.modulePath}';
`;
}
}

private get cssCode(): string {
if (!this.appliedStyles) return '';
return `

${this.elementTag} {
${this.appliedStyles}
${this.appliedStyles}
}
`;
}

private get elementClassName(): string | undefined {
return customElements.get(this.elementTag)?.name;
}

private get modulePath(): string {
return this.labs
? `@internetarchive/elements/labs/${this.elementTag}/${this.elementTag}`
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Internet Archive Elements</title>
<link rel="stylesheet" href="./demo/index.css" />
<script type="module" src="/demo/app-root.ts"></script>
<script type="module" src="./demo/app-root.ts"></script>
</head>

<body>
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"format": "wireit",
"circular": "wireit",
"prepare": "wireit",
"test": "wireit"
"test": "wireit",
"ghpages:build": "wireit"
},
"dependencies": {
"@lit/localize": "^0.12.2",
Expand Down Expand Up @@ -109,6 +110,9 @@
"dependencies": [
"circular"
]
},
"ghpages:build": {
"command": "vite build --config vite.config.ghpages.ts && touch ./ghpages/.nojekyll"
}
}
}
1 change: 1 addition & 0 deletions src/elements/ia-button/ia-button-story.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export class IAButtonStory extends LitElement {
return html`
<story-template
elementTag="ia-button"
elementClassName="IAButton"
.exampleUsage=${this.exampleUsage}
.styleInputData=${{ settings: styleInputSettings }}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export class IAStatusIndicatorStory extends LitElement {
return html`
<story-template
elementTag="ia-status-indicator"
elementClassName="IAStatusIndicator"
.exampleUsage=${this.exampleUsage}
.styleInputData=${{ settings: styleInputSettings }}
>
Expand Down
1 change: 1 addition & 0 deletions src/labs/ia-snow/ia-snow-story.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export class IASnowStory extends LitElement {
return html`
<story-template
elementTag="ia-snow"
elementClassName="IASnow"
.exampleUsage=${this.exampleUsage}
labs
>
Expand Down
18 changes: 18 additions & 0 deletions vite.config.ghpages.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { defineConfig } from 'vitest/config';
import path from 'path';

// https://vitejs.dev/config/
export default defineConfig({
base: './',
resolve: {
alias: {
'@src': path.resolve(__dirname, './src'),
'@demo': path.resolve(__dirname, './demo'),
},
},
build: {
outDir: './ghpages/demo',
emptyOutDir: true,
manifest: true,
},
});