Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 1 addition & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
node_modules
**/node_modules
Dockerfile
action.yml
LICENSE
Makefile
readme.md
.gitignore
.github
30 changes: 29 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,33 @@ jobs:

steps:
- name: checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v4
- run: make image

test:
runs-on: ubuntu-latest
env:
METABLOCK_API_TOKEN: ${{ secrets.METABLOCK_API_TOKEN }}
METABLOCK_BLOCK_ID: 85ef26bff9f0454aa6ff0516b6d52420

steps:
- name: checkout repo
uses: actions/checkout@v4
- name: build example
uses: actions/setup-node@v4
with:
node-version: 22
- name: build example
run: make build-example
- name: stage deployment
uses: ./
if: github.ref != 'refs/heads/main'
with:
env: stage
bundle: example/dist
- name: prod deployment
uses: ./
if: github.ref == 'refs/heads/main'
with:
env: prod
bundle: example/dist
32 changes: 0 additions & 32 deletions .github/workflows/test.yml

This file was deleted.

13 changes: 0 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
#
# javascript
node_modules
bin
dist
package-lock.json

# directories
coverage
dist
example/public
.tmp

#
# files
.DS_Store
Expand Down
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
FROM node:18-slim
FROM python:3.13-slim

WORKDIR /action

ENV DOCKER=yes NODE_ENV=production
RUN npm i --global @metablock/cli@0.23.2
RUN pip install metablock
14 changes: 4 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,11 @@ image: ## Build image

.PHONY: terminal
terminal: ## Terminal
@docker run -it --rm metablock-action bash
@docker run -it --rm \
-v $(PWD):/action \
metablock-action bash


.PHONY: build-example
build-example: ## Build example
@cd example && yarn && yarn build

.PHONY: outdated-example
outdated-example: ## Outdated example dependencies
@cd example && yarn outdated

.PHONY: update-example
update-example: ## Update example dependencies
@cd example && yarn upgrade --latest
@cd example && npm i && npm run build
11 changes: 5 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,25 @@ name: "Metablock Action"
description: "Make a new deployment into metablock cloud"
inputs:
token:
description: "Metablock API token - can be set as METABLOCK_API_TOKEN env variable"
description: "Metablock API token - can be set via the METABLOCK_API_TOKEN env variable"
block:
description: "Metablock Block ID - can be set as METABLOCK_BLOCK_ID env variable"
description: "Metablock Block ID - can be set via the METABLOCK_BLOCK_ID env variable"
bundle:
description: "Filesystem location of the bundle to deploy"
default: "./dist"
env:
description: "Metablock environment to deploy"
description: "Metablock environment - can be set via the METABLOCK_ENV env variable"
default: "stage"
runs:
using: "docker"
image: "Dockerfile"
args:
- metablock
- ship
- ${{ inputs.bundle }}
- "--token"
- ${{ inputs.token }}
- "--block"
- "--block-id"
- ${{ inputs.block }}
- "--bundle"
- ${{ inputs.bundle }}
- "--env"
- ${{ inputs.env }}
14 changes: 0 additions & 14 deletions example/.eslintrc.cjs

This file was deleted.

24 changes: 24 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
54 changes: 54 additions & 0 deletions example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# React + TypeScript + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh

## Expanding the ESLint configuration

If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:

```js
export default tseslint.config({
extends: [
// Remove ...tseslint.configs.recommended and replace with this
...tseslint.configs.recommendedTypeChecked,
// Alternatively, use this for stricter rules
...tseslint.configs.strictTypeChecked,
// Optionally, add this for stylistic rules
...tseslint.configs.stylisticTypeChecked,
],
languageOptions: {
// other options...
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
},
})
```

You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:

```js
// eslint.config.js
import reactX from 'eslint-plugin-react-x'
import reactDom from 'eslint-plugin-react-dom'

export default tseslint.config({
plugins: {
// Add the react-x and react-dom plugins
'react-x': reactX,
'react-dom': reactDom,
},
rules: {
// other rules...
// Enable its recommended typescript rules
...reactX.configs['recommended-typescript'].rules,
...reactDom.configs.recommended.rules,
},
})
```
13 changes: 0 additions & 13 deletions example/app/App.tsx

This file was deleted.

24 changes: 0 additions & 24 deletions example/app/Info.tsx

This file was deleted.

7 changes: 0 additions & 7 deletions example/app/main.tsx

This file was deleted.

28 changes: 28 additions & 0 deletions example/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'

export default tseslint.config(
{ ignores: ['dist'] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ['**/*.{ts,tsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
plugins: {
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
},
)
13 changes: 13 additions & 0 deletions example/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Loading