Compare commits

...

10 Commits

Author SHA1 Message Date
Platane
cd3320efff 📦 1.1.1 2022-03-24 12:05:22 +00:00
platane
553d8d8efa 📓 2022-03-24 13:00:13 +01:00
platane
e80a44ca5f 🔨 fix svg rounded square 2022-03-24 12:56:26 +01:00
platane
4ced502e11 📓 update readme 2022-03-24 12:43:09 +01:00
Platane
0374e20a50 📦 1.1.0 2022-03-24 11:25:21 +00:00
platane
7ba88d1fbd 📓 2022-03-24 12:21:27 +01:00
Platane
909a9c7fce 📦 1.0.2-rc.6 2022-03-24 11:03:14 +00:00
platane
e1dcae75b9 👷 2022-03-24 11:58:31 +01:00
Platane
5df41911e6 📦 1.0.2-rc.5 2022-03-24 10:53:45 +00:00
platane
c9b130d9da 🔨 try async import 2022-03-24 11:51:16 +01:00
12 changed files with 654 additions and 620 deletions

View File

@@ -36,7 +36,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: update action.yml
- name: update action.yml to use image from local Dockerfile
run: |
sed -i "s/image: .*/image: Dockerfile/" action.yml

View File

@@ -32,7 +32,8 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/build-push-action@v2
- name: build and publish the docker image
uses: docker/build-push-action@v2
id: docker-build
with:
push: true
@@ -40,7 +41,7 @@ jobs:
platane/snk:${{ github.sha }}
platane/snk:${{ github.event.inputs.version }}
- name: update action.yml
- name: update action.yml to point to the newly created docker image
run: |
sed -i "s/image: .*/image: docker:\/\/platane\/snk@${{ steps.docker-build.outputs.digest }}/" action.yml
@@ -49,19 +50,19 @@ jobs:
cache: yarn
node-version: 16
- name: bump version
run: yarn version --no-git-tag-version --new-version ${{ github.event.inputs.version }}
- name: build svg-only action
run: |
yarn install --frozen-lockfile
yarn build:action
mv packages/action/dist/* svg-only/
mv packages/action/dist svg-only/dist
- name: bump package version
run: yarn version --no-git-tag-version --new-version ${{ github.event.inputs.version }}
- name: push new commit
uses: EndBug/add-and-commit@v7
with:
add: package.json svg-only action.yml
add: package.json svg-only/dist action.yml
message: 📦 ${{ github.event.inputs.version }}
tag: v${{ github.event.inputs.version }}

1
.gitignore vendored
View File

@@ -2,4 +2,5 @@ node_modules
npm-debug.log*
yarn-error.log*
dist
!svg-only/dist
build

View File

@@ -1,6 +1,6 @@
# snk
[![GitHub marketplace](https://img.shields.io/badge/marketplace-snake-blue?logo=github&style=flat-square)](https://github.com/marketplace/actions/generate-snake-game-from-github-contribution-grid)
[![GitHub marketplace](https://img.shields.io/github/v/tag/platane/snk?label=marketplace&logo=github&sort=semver&style=flat-square)](https://github.com/marketplace/actions/generate-snake-game-from-github-contribution-grid)
![type definitions](https://img.shields.io/npm/types/typescript?style=flat-square)
![code style](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)
@@ -20,7 +20,7 @@ Available as github action. Automatically generate a new image at the end of the
**github action**
```yaml
- uses: Platane/snk@master
- uses: Platane/snk@v1.1.0
with:
# github user name to read the contribution graph from (**required**)
# using action context var `github.repository_owner` or specified user
@@ -35,7 +35,9 @@ Available as github action. Automatically generate a new image at the end of the
svg_out_path: dist/github-snake.svg
```
> [example with cron job](https://github.com/Platane/Platane/blob/master/.github/workflows/main.yml#L24-L29)
[example with cron job](https://github.com/Platane/Platane/blob/master/.github/workflows/main.yml#L24-L29)
If you are only interested in generating a svg, you can use this other faster action: `uses: Platane/snk/svg-only@v1.1.0`
**interactive demo**

View File

@@ -4,7 +4,7 @@ author: "platane"
runs:
using: docker
image: docker://platane/snk@sha256:c0130b001a33f4781baf5d182701b82a483513da2886ab694de8fd00d51272f9
image: docker://platane/snk@sha256:368d5c159c47ebfe2c8afa2e2029fe4820e5fdfb80d69e499f327f895c5c2a00
inputs:
github_user_name:

View File

@@ -1,7 +1,7 @@
{
"name": "snk",
"description": "Generates a snake game from a github user contributions grid",
"version": "v1.0.2-rc.4",
"version": "1.1.1",
"private": true,
"repository": "github:platane/snk",
"devDependencies": {
@@ -17,7 +17,7 @@
],
"scripts": {
"type": "tsc --noEmit",
"lint": "yarn prettier -c '**/*.{ts,js,json,md,yml,yaml}' '!packages/*/dist/**'",
"lint": "yarn prettier -c '**/*.{ts,js,json,md,yml,yaml}' '!packages/*/dist/**' '!svg-only/dist/**'",
"test": "jest --verbose --passWithNoTests --no-cache",
"dev:demo": "( cd packages/demo ; yarn dev )",
"build:demo": "( cd packages/demo ; yarn build )",

View File

@@ -1,8 +1,6 @@
import { getGithubUserContribution } from "@snk/github-user-contribution";
import { userContributionToGrid } from "./userContributionToGrid";
import { getBestRoute } from "@snk/solver/getBestRoute";
import { createGif } from "@snk/gif-creator";
import { createSvg } from "../svg-creator";
import { snake4 } from "@snk/types/__fixtures__/snake";
import { getPathToPose } from "@snk/solver/getPathToPose";
@@ -41,11 +39,13 @@ export const generateContributionSnake = async (
if (format.gif) {
console.log("📹 creating gif");
const { createGif } = await import("@snk/gif-creator");
output.gif = await createGif(grid, chain, drawOptions, gifOptions);
}
if (format.svg) {
console.log("🖌 creating svg");
const { createSvg } = await import("@snk/svg-creator");
output.svg = createSvg(grid, chain, drawOptions, gifOptions);
}

View File

@@ -4,7 +4,10 @@
"dependencies": {
"@actions/core": "1.6.0",
"@snk/gif-creator": "1.0.0",
"@snk/github-user-contribution": "1.0.0"
"@snk/github-user-contribution": "1.0.0",
"@snk/solver": "1.0.0",
"@snk/svg-creator": "1.0.0",
"@snk/types": "1.0.0"
},
"devDependencies": {
"@zeit/ncc": "0.22.3",

View File

@@ -22,8 +22,6 @@ export const createGrid = (
const styles = [
`.c{
shape-rendering: geometricPrecision;
rx: ${sizeBorderRadius};
ry: ${sizeBorderRadius};
fill: var(--ce);
stroke-width: 1px;
stroke: var(--cb);
@@ -56,6 +54,8 @@ export const createGrid = (
class: ["c", id].filter(Boolean).join(" "),
x: x * s + m,
y: y * s + m,
rx: sizeBorderRadius,
ry: sizeBorderRadius,
width: d,
height: d,
})

View File

@@ -6,4 +6,4 @@ As a drawback, it can not generate gif image.
## Build process
file is built and push on release, by the release action.
dist file are built and push on release, by the release action.

View File

@@ -4,7 +4,7 @@ author: "platane"
runs:
using: node16
main: index.js
main: dist/index.js
inputs:
github_user_name:

File diff suppressed because it is too large Load Diff