pacman-contribution-graph 1.0.14 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +59 -9
  2. package/dist/pacman-contribution-graph.min.js +1 -1
  3. package/package.json +44 -26
  4. package/.prettierrc +0 -8
  5. package/.vscode/extensions.json +0 -5
  6. package/.vscode/settings.json +0 -6
  7. package/assets/packman-demo.png +0 -0
  8. package/dist/pacman-contribution-graph.js +0 -1776
  9. package/dist/pacman-contribution-graph.js.map +0 -1
  10. package/embeded/canvas.html +0 -41
  11. package/github-action/action.yml +0 -16
  12. package/github-action/dist/index.js +0 -26901
  13. package/github-action/package.json +0 -14
  14. package/github-action/pnpm-lock.yaml +0 -77
  15. package/github-action/src/index.js +0 -47
  16. package/index.html +0 -528
  17. package/pacman.abozanona.me/index.js +0 -47
  18. package/pacman.abozanona.me/package.json +0 -8
  19. package/server/api/contributions/route.ts.z +0 -31
  20. package/server/page.zts.z +0 -13
  21. package/src/assets/images/ghosts/blinky.png +0 -0
  22. package/src/assets/images/ghosts/clyde.png +0 -0
  23. package/src/assets/images/ghosts/inky.png +0 -0
  24. package/src/assets/images/ghosts/pinky.png +0 -0
  25. package/src/assets/images/ghosts/scared.png +0 -0
  26. package/src/assets/sounds/pacman_beginning.wav +0 -0
  27. package/src/assets/sounds/pacman_chomp.wav +0 -0
  28. package/src/assets/sounds/pacman_death.wav +0 -0
  29. package/src/assets/sounds/pacman_eatghost.wav +0 -0
  30. package/src/canvas.ts +0 -244
  31. package/src/constants.ts +0 -102
  32. package/src/game.ts +0 -231
  33. package/src/grid.ts +0 -127
  34. package/src/index.ts +0 -48
  35. package/src/movement/ghosts-movement.ts +0 -183
  36. package/src/movement/movement-utils.ts +0 -40
  37. package/src/movement/pacman-movement.ts +0 -230
  38. package/src/music-player.ts +0 -119
  39. package/src/store.ts +0 -23
  40. package/src/svg.ts +0 -254
  41. package/src/types.ts +0 -78
  42. package/src/utils.ts +0 -81
  43. package/tsconfig.json +0 -11
  44. package/webpack.common.js +0 -19
  45. package/webpack.dev.js +0 -23
  46. package/webpack.prod.js +0 -18
package/src/utils.ts DELETED
@@ -1,81 +0,0 @@
1
- import { GAME_THEMES } from './constants';
2
- import type { Contribution, GameTheme, StoreType } from './types';
3
-
4
- const getGitlabContribution = async (store: StoreType): Promise<Contribution[]> => {
5
- // const response = await fetch(`https://gitlab.com/users/${username}/calendar.json`);
6
- const response = await fetch(
7
- `https://v0-new-project-q1hhrdodoye-abozanona-gmailcoms-projects.vercel.app/api/contributions?username=${store.config.username}`
8
- );
9
- const contributionsList = await response.json();
10
- return Object.entries(contributionsList).map(([date, count]) => ({
11
- date: new Date(date),
12
- count: Number(count)
13
- }));
14
- };
15
-
16
- const getGithubContribution = async (store: StoreType): Promise<Contribution[]> => {
17
- const commits = [];
18
- let isComplete: boolean = false;
19
- let page = 1;
20
- // TODO: Consider using GraphQL endpoint when user has an access token?
21
- do {
22
- try {
23
- const headers: HeadersInit = {};
24
- if (store.config.githubSettings?.accessToken) {
25
- headers['Authorization'] = 'Bearer ' + store.config.githubSettings.accessToken;
26
- }
27
- const response = await fetch(
28
- `https://api.github.com/search/commits?q=author:${store.config.username}&sort=author-date&order=desc&page=${page}&per_page=1000`,
29
- {
30
- headers
31
- }
32
- );
33
- const contributionsList = await response.json();
34
- isComplete = contributionsList.items.length === 0;
35
- commits.push(...contributionsList.items);
36
- page++;
37
- } catch (ex) {
38
- isComplete = true;
39
- }
40
- } while (!isComplete);
41
- return Array.from(
42
- commits
43
- .reduce((map: any, item: any) => {
44
- const dateString = item.commit.committer.date.split('T')[0];
45
- const date = new Date(dateString);
46
- const count = (map.get(dateString) || { count: 0 }).count + 1;
47
- return map.set(dateString, { date, count });
48
- }, new Map())
49
- .values()
50
- );
51
- };
52
-
53
- const getCurrentTheme = (store: StoreType): GameTheme => {
54
- return GAME_THEMES[store.config.gameTheme] ?? GAME_THEMES['github'];
55
- };
56
-
57
- const hexToRGBA = (hex: string, alpha: number): string => {
58
- const r = parseInt(hex.slice(1, 3), 16);
59
- const g = parseInt(hex.slice(3, 5), 16);
60
- const b = parseInt(hex.slice(5, 7), 16);
61
- return `rgba(${r}, ${g}, ${b}, ${alpha})`;
62
- };
63
-
64
- const hexToHexAlpha = (hex: string, alpha: number): string => {
65
- hex = hex.replace(/^#/, '');
66
- if (hex.length === 3) {
67
- hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
68
- }
69
- const alphaHex = Math.round(alpha * 255)
70
- .toString(16)
71
- .padStart(2, '0');
72
- return `#${hex}${alphaHex}`;
73
- };
74
-
75
- export const Utils = {
76
- getGitlabContribution,
77
- getGithubContribution,
78
- getCurrentTheme,
79
- hexToRGBA,
80
- hexToHexAlpha
81
- };
package/tsconfig.json DELETED
@@ -1,11 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES6",
4
- "module": "ESNext",
5
- "strict": true,
6
- "esModuleInterop": true,
7
- "outDir": "dist",
8
- "sourceMap": true,
9
- "lib": ["ES2017", "DOM"]
10
- }
11
- }
package/webpack.common.js DELETED
@@ -1,19 +0,0 @@
1
- export default {
2
- mode: "production",
3
- entry: './src/index.ts',
4
- experiments: {
5
- outputModule: true,
6
- },
7
- module: {
8
- rules: [
9
- {
10
- test: /\.ts?$/,
11
- use: 'ts-loader',
12
- exclude: /node_modules/,
13
- },
14
- ],
15
- },
16
- resolve: {
17
- extensions: ['.ts', '.js'],
18
- },
19
- };
package/webpack.dev.js DELETED
@@ -1,23 +0,0 @@
1
- import path from 'path';
2
- import { fileURLToPath } from 'url';
3
- import { merge } from 'webpack-merge';
4
- import common from './webpack.common.js';
5
-
6
- const __filename = fileURLToPath(import.meta.url);
7
- const __dirname = path.dirname(__filename);
8
-
9
- export default merge(common, {
10
- mode: 'development',
11
- output: {
12
- filename: 'pacman-contribution-graph.js',
13
- path: path.resolve(__dirname, 'dist'),
14
- library: {
15
- type: 'module',
16
- },
17
- },
18
- devtool: 'source-map',
19
- optimization: {
20
- minimize: false,
21
- },
22
- watch: true,
23
- });
package/webpack.prod.js DELETED
@@ -1,18 +0,0 @@
1
- import path from 'path';
2
- import { fileURLToPath } from 'url';
3
- import { merge } from 'webpack-merge';
4
- import common from './webpack.common.js';
5
-
6
- const __filename = fileURLToPath(import.meta.url);
7
- const __dirname = path.dirname(__filename);
8
-
9
- export default merge(common, {
10
- mode: 'production',
11
- output: {
12
- filename: 'pacman-contribution-graph.min.js',
13
- path: path.resolve(__dirname, 'dist'),
14
- library: {
15
- type: 'module',
16
- },
17
- },
18
- });