Compare commits

...

11 Commits
v3.0 ... v0.0.6

Author SHA1 Message Date
platane
e5fbdf8cfe aaaaaa 2020-07-19 21:09:33 +02:00
platane
f2452ed852 aaaaaa 2020-07-19 20:37:57 +02:00
platane
c4d7bdf2bd aaaaaa 2020-07-19 20:35:32 +02:00
platane
9b05b7fdaa aaaaaa 2020-07-19 20:20:48 +02:00
platane
ccbe4e530c aaaa 2020-07-19 20:04:40 +02:00
platane
bc6405aca3 aaaa 2020-07-19 20:03:12 +02:00
platane
fc4e8d4436 aaaa 2020-07-19 19:42:37 +02:00
platane
978ec843d3 aaaa 2020-07-19 19:37:54 +02:00
platane
c713fd8dd3 aaaabbb 2020-07-19 19:26:56 +02:00
platane
c14ae566e0 build 2020-07-19 19:26:56 +02:00
platane
724bc749a2 aaaaa 2020-07-19 19:26:56 +02:00
37 changed files with 174324 additions and 20 deletions

View File

@@ -6,22 +6,22 @@ on:
- master
jobs:
test:
deploy-demo:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
- uses: actions/setup-node@v1.4.2
with:
node-version: 14
- uses: bahmutov/npm-install@v1
- uses: bahmutov/npm-install@v1.4.1
- run: yarn build:demo
env:
BASE_PATHNAME: "snk"
- uses: crazy-max/ghaction-github-pages@068e494
- uses: crazy-max/ghaction-github-pages@v2.1.1
with:
target_branch: gh-pages
build_dir: packages/demo/dist

View File

@@ -7,14 +7,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- run: sudo apt-get install gifsicle graphicsmagick
# - run: sudo apt-get install gifsicle graphicsmagick
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
- uses: actions/setup-node@v1.4.2
with:
node-version: 14
- uses: bahmutov/npm-install@v1
- uses: bahmutov/npm-install@v1.4.1
- run: yarn type
- run: yarn lint
- run: yarn test --ci
# - run: yarn type
# - run: yarn lint
# - run: yarn test --ci
# - run: yarn build:lib
- name: generate-snake-game-from-github-contribution-grid
uses: Platane/snk@master
with:
github_user_name: platane
- run: ls
- run: ls

View File

@@ -4,7 +4,13 @@ RUN apt-get update \
&& apt-get install -y --no-install-recommends gifsicle graphicsmagick \
&& rm -rf /var/lib/apt/lists/*
COPY packages/action/dist/* ./github-contribution-grid-snake
COPY tsconfig.json package.json yarn.lock ./generate-snake-game-from-github-contribution-grid/
COPY packages ./generate-snake-game-from-github-contribution-grid/packages/
CMD ["node", "github-contribution-grid-snake/index.js"]
RUN ( cd ./generate-snake-game-from-github-contribution-grid ; yarn install --frozen-lockfile )
RUN ( cd ./generate-snake-game-from-github-contribution-grid ; yarn build:action )
CMD ["find", "./generate-snake-game-from-github-contribution-grid"]
# CMD ["node", "./generate-snake-game-from-github-contribution-grid/packages/action/dist/index.js"]

3
README.md Normal file
View File

@@ -0,0 +1,3 @@
# snk
Generates a snake game from a github user contributions grid and output a screen capture as gif

View File

@@ -1,23 +1,23 @@
name: "github-contribution-grid-snake"
description: ""
name: "generate-snake-game-from-github-contribution-grid"
description: "Generates a snake game from a github user contributions grid and output a screen capture as gif"
author: "platane"
outputs:
gif_out_path:
description: ""
description: "path of the generated gif"
runs:
using: "docker"
image: "Dockerfile"
args:
- ${{ inputs.github_user_name }}
- ${{ inputs.gif_out_path }}
# args:
# - ${{ inputs.github_user_name }}
# - ${{ inputs.gif_out_path }}
inputs:
github_user_name:
description: ""
description: "github user name"
required: true
gif_out_path:
description: ""
description: "path of the generated gif"
required: false
default: "./github-contribution-grid-snake.gif"

View File

@@ -1,5 +1,6 @@
{
"name": "snk",
"description": "Generates a snake game from a github user contributions grid and output a screen capture as gif",
"version": "1.0.0",
"private": true,
"repository": "github:platane/snk",

BIN
packages/action/dist/build/Release/canvas.node vendored Executable file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

174133
packages/action/dist/index.js vendored Normal file

File diff suppressed because one or more lines are too long

84
packages/action/dist/index1.js vendored Normal file
View File

@@ -0,0 +1,84 @@
const Canvas = require('./lib/canvas')
const Image = require('./lib/image')
const CanvasRenderingContext2D = require('./lib/context2d')
const parseFont = require('./lib/parse-font')
const packageJson = require('./package.json')
const bindings = require('./lib/bindings')
const fs = require('fs')
const PNGStream = require('./lib/pngstream')
const PDFStream = require('./lib/pdfstream')
const JPEGStream = require('./lib/jpegstream')
const DOMMatrix = require('./lib/DOMMatrix').DOMMatrix
const DOMPoint = require('./lib/DOMMatrix').DOMPoint
function createCanvas (width, height, type) {
return new Canvas(width, height, type)
}
function createImageData (array, width, height) {
return new bindings.ImageData(array, width, height)
}
function loadImage (src) {
return new Promise((resolve, reject) => {
const image = new Image()
function cleanup () {
image.onload = null
image.onerror = null
}
image.onload = () => { cleanup(); resolve(image) }
image.onerror = (err) => { cleanup(); reject(err) }
image.src = src
})
}
/**
* Resolve paths for registerFont. Must be called *before* creating a Canvas
* instance.
* @param src {string} Path to font file.
* @param fontFace {{family: string, weight?: string, style?: string}} Object
* specifying font information. `weight` and `style` default to `"normal"`.
*/
function registerFont (src, fontFace) {
// TODO this doesn't need to be on Canvas; it should just be a static method
// of `bindings`.
return Canvas._registerFont(fs.realpathSync(src), fontFace)
}
module.exports = {
Canvas,
Context2d: CanvasRenderingContext2D, // Legacy/compat export
CanvasRenderingContext2D,
CanvasGradient: bindings.CanvasGradient,
CanvasPattern: bindings.CanvasPattern,
Image,
ImageData: bindings.ImageData,
PNGStream,
PDFStream,
JPEGStream,
DOMMatrix,
DOMPoint,
registerFont,
parseFont,
createCanvas,
createImageData,
loadImage,
backends: bindings.Backends,
/** Library version. */
version: packageJson.version,
/** Cairo version. */
cairoVersion: bindings.cairoVersion,
/** jpeglib version. */
jpegVersion: bindings.jpegVersion,
/** gif_lib version. */
gifVersion: bindings.gifVersion ? bindings.gifVersion.replace(/[^.\d]/g, '') : undefined,
/** freetype version. */
freetypeVersion: bindings.freetypeVersion
}

60
packages/action/dist/xhr-sync-worker.js vendored Normal file
View File

@@ -0,0 +1,60 @@
"use strict";
/* eslint-disable no-process-exit */
const util = require("util");
const { JSDOM } = require("../../../..");
const { READY_STATES } = require("./xhr-utils");
const idlUtils = require("../generated/utils");
const tough = require("tough-cookie");
const dom = new JSDOM();
const xhr = new dom.window.XMLHttpRequest();
const xhrImpl = idlUtils.implForWrapper(xhr);
const chunks = [];
process.stdin.on("data", chunk => {
chunks.push(chunk);
});
process.stdin.on("end", () => {
const buffer = Buffer.concat(chunks);
const flag = JSON.parse(buffer.toString());
if (flag.body && flag.body.type === "Buffer" && flag.body.data) {
flag.body = Buffer.from(flag.body.data);
}
if (flag.cookieJar) {
flag.cookieJar = tough.CookieJar.fromJSON(flag.cookieJar);
}
flag.synchronous = false;
Object.assign(xhrImpl.flag, flag);
const { properties } = xhrImpl;
xhrImpl.readyState = READY_STATES.OPENED;
try {
xhr.addEventListener("loadend", () => {
if (properties.error) {
properties.error = properties.error.stack || util.inspect(properties.error);
}
process.stdout.write(JSON.stringify({
responseURL: xhrImpl.responseURL,
status: xhrImpl.status,
statusText: xhrImpl.statusText,
properties
}), () => {
process.exit(0);
});
}, false);
xhr.send(flag.body);
} catch (error) {
properties.error += error.stack || util.inspect(error);
process.stdout.write(JSON.stringify({
responseURL: xhrImpl.responseURL,
status: xhrImpl.status,
statusText: xhrImpl.statusText,
properties
}), () => {
process.exit(0);
});
}
});

View File

@@ -4,12 +4,20 @@ import { generateContributionSnake } from "./generateContributionSnake";
(async () => {
try {
console.log("argv", process.argv);
console.log(core.getInput("user_name"));
console.log(core.getInput("gif_out_path"));
console.log("--");
console.log("--");
console.log(process.cwd());
console.log("--");
console.log(fs.readdirSync(process.cwd()));
console.log("--");
console.log("--");
console.log(process.env.GITHUB_WORKSPACE);
console.log("--");
console.log(fs.readdirSync(process.cwd()));
const buffer = await generateContributionSnake(core.getInput("user_name"));
fs.writeFileSync(core.getInput("gif_out_path"), buffer);