Skip to content

Commit a77fac2

Browse files
authored
Initial commit
0 parents  commit a77fac2

23 files changed

+1867
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Deploy to GitHub Pages with Yarn
2+
3+
# Run this workflow on pushes to the 'main' branch
4+
on:
5+
push:
6+
branches:
7+
- main
8+
9+
# Give the workflow permissions to write to the repository
10+
permissions:
11+
contents: write
12+
13+
# Define the job that will run
14+
jobs:
15+
deploy:
16+
runs-on: ubuntu-latest # Use the latest version of Ubuntu
17+
steps:
18+
# 1. Check out your repository's code
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
# 2. Set up Node.js for the build process
23+
- name: Set up Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: "24" # Specify your Node.js version
27+
cache: "yarn" # Set the cache to use yarn
28+
29+
# 3. Install dependencies and build the app
30+
- name: Install and Build
31+
run: |
32+
yarn install --frozen-lockfile
33+
yarn run build
34+
env:
35+
# Dynamically set the public path using the repository name
36+
# The ${{ github.event.repository.name }} variable is automatically
37+
# provided by GitHub Actions and contains the name of the repo.
38+
PUBLIC_URL: /${{ github.event.repository.name }}
39+
40+
# 4. Deploy the dist folder to the gh-pages branch
41+
- name: Deploy to gh-pages
42+
uses: peaceiris/actions-gh-pages@v4
43+
with:
44+
github_token: ${{ secrets.GITHUB_TOKEN }}
45+
publish_dir: ./dist # The directory to deploy

.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?

README.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Sigma Plugin Template (React + TypeScript + Vite)
2+
3+
This template provides a starting point for developing custom data visualizations for the Sigma platform using React, TypeScript, and Vite. It includes a minimal setup with the necessary dependencies and project structure to get you started quickly.
4+
5+
## Getting Started
6+
7+
Follow these instructions to get the development environment up and running.
8+
9+
### Prerequisites
10+
11+
- Node.js (v24 or later recommended)
12+
- yarn
13+
14+
### Installation
15+
16+
1. **Create a new repository from this template:**
17+
Click the "Use this template" button at the top of the repository page to create a new repository with the same structure and files.
18+
19+
2. **Install dependencies:**
20+
```bash
21+
yarn install
22+
```
23+
24+
### Running the Development Server
25+
26+
To start the Vite development server, run the following command:
27+
28+
```bash
29+
yarn dev
30+
```
31+
32+
This will start the development server, and you can view your plugin in the browser at the URL provided. The server supports Hot Module Replacement (HMR), so changes you make to the code will be reflected in the browser instantly.
33+
34+
## Project Structure
35+
36+
Here is an overview of the key files and directories in this template:
37+
38+
- **`public/`**: Contains the static assets for the plugin, such as images and fonts.
39+
- **`src/`**: The main source code directory for the plugin.
40+
- **`components/`**: Contains reusable React components.
41+
- **`assets/`**: Contains assets that are imported directly into the source code.
42+
- **`App.tsx`**: The main application component.
43+
- **`main.tsx`**: The entry point of the application.
44+
- **`vite.config.ts`**: The configuration file for Vite.
45+
- **`package.json`**: The project manifest, containing dependencies and scripts.
46+
- **`README.md`**: This file.
47+
48+
## Deployment
49+
50+
This template includes a GitHub Actions workflow to automatically build and deploy the plugin to GitHub Pages. You will need to configure your repo to [deploy from the `gh-pages` branch](https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#publishing-from-a-branch).
51+
52+
Alternatively, you can deploy to any cloud provider of your choice.
53+
54+
### Manual Build
55+
56+
To build the plugin for production, run the following command:
57+
58+
```bash
59+
yarn build
60+
```
61+
62+
This will create a `dist/` directory with the production-ready files.
63+
64+
### Automated Deployment with GitHub Pages
65+
66+
The repository is configured with a GitHub Actions workflow that automatically deploys the plugin to GitHub Pages whenever you push to the `main` branch. The deployment will be available at `https://<your-username>.github.io/<your-repo-name>/`.
67+
68+
- Select the `gh-pages` branch to be the deploy target ( it may not exist until the first push )
69+
- Github Pages require either an Enterprise Github account, or the repository to be public.
70+
71+
## Further Information
72+
73+
For more detailed information on developing Sigma plugins, please refer to the official documentation:
74+
75+
- [Sigma Plugin Development API](https://help.sigmacomputing.com/docs/plugin-development-api)

eslint.config.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import js from '@eslint/js'
2+
import globals from 'globals'
3+
import reactHooks from 'eslint-plugin-react-hooks'
4+
import reactRefresh from 'eslint-plugin-react-refresh'
5+
import tseslint from 'typescript-eslint'
6+
import { globalIgnores } from 'eslint/config'
7+
8+
export default tseslint.config([
9+
globalIgnores(['dist']),
10+
{
11+
files: ['**/*.{ts,tsx}'],
12+
extends: [
13+
js.configs.recommended,
14+
tseslint.configs.recommended,
15+
reactHooks.configs['recommended-latest'],
16+
reactRefresh.configs.vite,
17+
],
18+
languageOptions: {
19+
ecmaVersion: 2020,
20+
globals: globals.browser,
21+
},
22+
},
23+
])

index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>Sigma Plugin Starter</title>
7+
</head>
8+
<body>
9+
<div id="root"></div>
10+
<script type="module" src="/src/main.tsx"></script>
11+
</body>
12+
</html>

package.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "sigma-plugin-template",
3+
"private": true,
4+
"version": "0.0.0",
5+
"type": "module",
6+
"scripts": {
7+
"dev": "vite",
8+
"build": "tsc -b && vite build",
9+
"lint": "eslint .",
10+
"preview": "vite preview"
11+
},
12+
"dependencies": {
13+
"@sigmacomputing/plugin": "^1.0.9",
14+
"react": "^19.1.1",
15+
"react-dom": "^19.1.1"
16+
},
17+
"devDependencies": {
18+
"@eslint/js": "^9.33.0",
19+
"@types/node": "^24.3.1",
20+
"@types/react": "^19.1.10",
21+
"@types/react-dom": "^19.1.7",
22+
"@vitejs/plugin-react-swc": "^4.0.0",
23+
"eslint": "^9.33.0",
24+
"eslint-plugin-react-hooks": "^5.2.0",
25+
"eslint-plugin-react-refresh": "^0.4.20",
26+
"globals": "^16.3.0",
27+
"typescript": "~5.8.3",
28+
"typescript-eslint": "^8.39.1",
29+
"vite": "^7.1.2"
30+
}
31+
}

public/vite.svg

Lines changed: 1 addition & 0 deletions
Loading

src/App.css

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#root {
2+
max-width: 1280px;
3+
margin: 0 auto;
4+
padding: 2rem;
5+
text-align: center;
6+
}
7+
8+
.logo {
9+
height: 4em;
10+
padding: 1.5em;
11+
}
12+
13+
.card {
14+
padding: 2em;
15+
}
16+
17+
.connection-status {
18+
font-size: 2rem;
19+
margin-top: 1rem;
20+
}

src/App.tsx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { client, SigmaClientProvider, useConfig } from "@sigmacomputing/plugin";
2+
import SigmaLogo from "./assets/sigma-black.svg";
3+
import "./App.css";
4+
import ConnectionStatus from "./components/ConnectionStatus";
5+
import DataTable from "./components/DataTable/DataTable";
6+
7+
const TABLE_SOURCE_ID = "source";
8+
9+
client.config.configureEditorPanel([
10+
{ name: TABLE_SOURCE_ID, type: "element" },
11+
{
12+
type: "column",
13+
name: "Column Names",
14+
allowMultiple: true,
15+
source: TABLE_SOURCE_ID,
16+
},
17+
]);
18+
19+
function App() {
20+
const config = useConfig();
21+
return (
22+
<SigmaClientProvider client={client}>
23+
<div>
24+
<a href="https://sigmacomputing.com" target="_blank">
25+
<img src={SigmaLogo} className="logo" alt="Sigma logo" />
26+
</a>
27+
</div>
28+
<h1>Plugin Starter</h1>
29+
<ConnectionStatus />
30+
{config.source && <DataTable configId={config.source} />}
31+
</SigmaClientProvider>
32+
);
33+
}
34+
35+
export default App;

src/assets/sigma-black.svg

Lines changed: 13 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)