🚀 add emojis
This commit is contained in:
2
packages/action/__tests__/__snapshots__/.gitignore
vendored
Normal file
2
packages/action/__tests__/__snapshots__/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
||||||
@@ -1,5 +1,17 @@
|
|||||||
|
import * as fs from "fs";
|
||||||
|
import * as path from "path";
|
||||||
import { generateContributionSnake } from "../generateContributionSnake";
|
import { generateContributionSnake } from "../generateContributionSnake";
|
||||||
|
|
||||||
generateContributionSnake("platane").then((buffer) => {
|
const dir = path.resolve(process.cwd(), "__tests__", "__snapshots__");
|
||||||
process.stdout.write(buffer);
|
|
||||||
});
|
try {
|
||||||
|
fs.mkdirSync(dir);
|
||||||
|
} catch (err) {}
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
const output = path.join(dir, "out.gif");
|
||||||
|
const buffer = await generateContributionSnake("platane");
|
||||||
|
|
||||||
|
console.log("💾 writing to", dir);
|
||||||
|
fs.writeFileSync(output, buffer);
|
||||||
|
})();
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { getBestRoute } from "@snk/compute/getBestRoute";
|
|||||||
import { userContributionToGrid } from "./userContributionToGrid";
|
import { userContributionToGrid } from "./userContributionToGrid";
|
||||||
|
|
||||||
export const generateContributionSnake = async (userName: string) => {
|
export const generateContributionSnake = async (userName: string) => {
|
||||||
|
console.log("🎣 fetching github user contribution");
|
||||||
const { cells, colorScheme } = await getGithubUserContribution(userName);
|
const { cells, colorScheme } = await getGithubUserContribution(userName);
|
||||||
|
|
||||||
const grid0 = userContributionToGrid(cells);
|
const grid0 = userContributionToGrid(cells);
|
||||||
@@ -29,8 +30,10 @@ export const generateContributionSnake = async (userName: string) => {
|
|||||||
|
|
||||||
const gifOptions = { frameDuration: 100, step: 1 };
|
const gifOptions = { frameDuration: 100, step: 1 };
|
||||||
|
|
||||||
|
console.log("📡 computing best route");
|
||||||
const chain = getBestRoute(grid0, snake0)!;
|
const chain = getBestRoute(grid0, snake0)!;
|
||||||
|
|
||||||
|
console.log("📹 creating gif");
|
||||||
const buffer = await createGif(grid0, chain, drawOptions, gifOptions);
|
const buffer = await createGif(grid0, chain, drawOptions, gifOptions);
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
|
|||||||
@@ -11,6 +11,6 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "ncc build --external canvas --out dist ./index.ts ",
|
"build": "ncc build --external canvas --out dist ./index.ts ",
|
||||||
"dev": "ncc run __tests__/dev.ts --quiet | tail -n +2 > out.gif "
|
"dev": "ncc run __tests__/dev.ts --quiet"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
2
packages/gif-creator/__tests__/__snapshots__/.gitignore
vendored
Normal file
2
packages/gif-creator/__tests__/__snapshots__/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
||||||
Reference in New Issue
Block a user