pacman-contribution-graph 2.1.1 → 2.2.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.
package/README.md CHANGED
@@ -134,6 +134,102 @@ To showcase the Pac-Man game on your GitHub profile, follow these steps:
134
134
 
135
135
  For a detailed guide, refer to the blog post: [Integrate Pac-Man Contribution Graph into Your GitHub Profile](https://abozanona.me/integrate-pacman-contribution-graph-into-github/)
136
136
 
137
+ ## Integrate into Your GitLab Profile
138
+
139
+ To showcase the Pac-Man game on your GitLab profile, follow these steps:
140
+
141
+ 1. **Create a Special Repository**:
142
+
143
+ - Name a new repository exactly as your GitHub username (e.g., `username/username`).
144
+ - This repository powers your GitHub profile page.
145
+
146
+ 2. **Generate & Setup Push Token**:
147
+
148
+ - Open the repository, and from left sidebar navigate to settings => Access Token tab.
149
+ - Generate a new Access Token with the name `CI/CD Push Token` & scope `write_repository`. Access tokens are only valid for 1 year maximum.
150
+ - From left sidebar navigate to settings => CI/CD.
151
+ - In Variables section, add a new variable with the name `CI_PUSH_TOKEN` and the value of the Access Token. Make sure that the variable is `Masked` & `Protect`.
152
+
153
+ 3. **Set Up `gitlab-ci` File**:
154
+
155
+ - In the repository, create a `.gitlab-ci.yml` file with the following content.
156
+
157
+ ```yaml
158
+ stages:
159
+ - generate
160
+ - deploy
161
+
162
+ variables:
163
+ GIT_SUBMODULE_STRATEGY: recursive
164
+
165
+ generate_pacman_graph:
166
+ stage: generate
167
+ image: node:20
168
+ script:
169
+ - mkdir -p dist
170
+ - npm install -g pacman-contribution-graph
171
+ - pacman-contribution-graph --platform gitlab --username "$CI_PROJECT_NAMESPACE" --gameTheme gitlab --output pacman-contribution-graph-light.svg
172
+ - mv pacman-contribution-graph-light.svg dist/pacman-contribution-graph-light.svg
173
+ - pacman-contribution-graph --platform gitlab --username "$CI_PROJECT_NAMESPACE" --gameTheme gitlab-dark --output pacman-contribution-graph-dark.svg
174
+ - mv pacman-contribution-graph-dark.svg dist/pacman-contribution-graph-dark.svg
175
+ artifacts:
176
+ paths:
177
+ - dist/pacman-contribution-graph-light.svg
178
+ - dist/pacman-contribution-graph-dark.svg
179
+ expire_in: 1 hour
180
+ rules:
181
+ - if: '$CI_PIPELINE_SOURCE == "schedule"'
182
+ - if: '$CI_PIPELINE_SOURCE == "push"'
183
+
184
+ deploy_to_readme:
185
+ stage: deploy
186
+ image: alpine:latest
187
+ script:
188
+ - apk add --no-cache git
189
+ - mkdir -p output
190
+ - cp dist/pacman-contribution-graph-light.svg output/
191
+ - cp dist/pacman-contribution-graph-dark.svg output/
192
+ - git remote set-url origin https://gitlab-ci-token:${CI_PUSH_TOKEN}@gitlab.com/${CI_PROJECT_PATH}.git
193
+ - git config --global user.email "pacman-bot@example.com"
194
+ - git config --global user.name "Pacman Bot"
195
+ - git add output/pacman-contribution-graph-light.svg output/pacman-contribution-graph-dark.svg
196
+ - git commit -m "Update Pac-Man contribution graph [ci skip]" || echo "No changes"
197
+ - git push origin HEAD:main
198
+ rules:
199
+ - if: '$CI_PIPELINE_SOURCE == "schedule"'
200
+ - if: '$CI_PIPELINE_SOURCE == "push"'
201
+ ```
202
+
203
+ 4. **Add to Profile README**:
204
+
205
+ - In your repository, create or edit the `README.md` file to include:
206
+
207
+ ```markdown
208
+ ## My Contribution Graph
209
+
210
+ <picture>
211
+ <source media="(prefers-color-scheme: dark)" srcset="https://gitlab.com/[USERNAME]/[USERNAME]/-/raw/main/output/pacman-contribution-graph-dark.svg">
212
+ <source media="(prefers-color-scheme: light)" srcset="https://gitlab.com/[USERNAME]/[USERNAME]/-/raw/main/output/pacman-contribution-graph-light.svg">
213
+ <img alt="pacman contribution graph" src="https://gitlab.com/[USERNAME]/[USERNAME]/-/raw/main/output/pacman-contribution-graph-light.svg">
214
+ </picture>
215
+ ```
216
+
217
+ 5. **Commit and Push**:
218
+
219
+ - Push the changes to GitHub. The Gitlab pipeline will work once, updating the Pac-Man game on your profile.
220
+
221
+ 6. **Schedule pipeline running**
222
+ - Go to your project in GitLab
223
+ - In the left sidebar, navigate to Build > Pipeline schedules (sometimes under CI/CD > Schedules)
224
+ - Click New schedule
225
+ - In the form:
226
+ - Interval pattern: Enter a cron expression for daily runs. For example, `0 2 \* \* \*` to run every day at 2:00 AM (UTC).
227
+ - Timezone: Select your preferred timezone.
228
+ - Target branch: Choose the main branch.
229
+ - Click Save pipeline schedule (or Create pipeline schedule).
230
+
231
+ Your pacman picture will now be generated automatically every day at the same time.
232
+
137
233
  ## ⏳ Run the Workflow Manually
138
234
 
139
235
  Once you have everything set up:
package/cli/cli.js CHANGED
@@ -4,7 +4,7 @@
4
4
  import fs from 'fs';
5
5
  import { hideBin } from 'yargs/helpers';
6
6
  import yargs from 'yargs/yargs';
7
- import { PacmanRenderer } from '../dist/pacman-contribution-graph.js'; // Adjust path as needed
7
+ import { PacmanRenderer } from '../dist/pacman-contribution-graph.min.js';
8
8
 
9
9
  const argv = yargs(hideBin(process.argv))
10
10
  .option('platform', {
@@ -0,0 +1,8 @@
1
+ import { Config, StoreType } from './types';
2
+ export declare class PacmanRenderer {
3
+ store: StoreType;
4
+ conf: Config;
5
+ constructor(conf: Config);
6
+ start(): Promise<StoreType>;
7
+ stop(): void;
8
+ }
package/package.json CHANGED
@@ -1,51 +1,53 @@
1
1
  {
2
- "name": "pacman-contribution-graph",
3
- "version": "2.1.1",
4
- "description": "Generates a pacman game from a github or gitlab user contributions grid",
5
- "repository": "github:abozanona/pacman-contribution-graph",
6
- "homepage": "https://abozanona.github.io/pacman-contribution-graph/",
7
- "type": "module",
8
- "main": "dist/pacman-contribution-graph.min.js",
9
- "types": "dist/index.d.ts",
10
- "exports": {
11
- ".": {
12
- "import": "./dist/pacman-contribution-graph.min.js",
13
- "types": "./dist/index.d.ts"
14
- }
15
- },
16
- "files": [
17
- "dist/pacman-contribution-graph.min.js",
18
- "dist/index.d.ts",
19
- "action.yml"
20
- ],
21
- "keywords": [
22
- "github",
23
- "pacman",
24
- "svg",
25
- "contribution-graph",
26
- "animation",
27
- "game",
28
- "actions"
29
- ],
30
- "devDependencies": {
31
- "prettier": "^3.4.2",
32
- "terser": "^5.37.0",
33
- "ts-loader": "^9.5.2",
34
- "typescript": "^4.9.5",
35
- "webpack": "^5.97.1",
36
- "webpack-cli": "^6.0.1",
37
- "webpack-merge": "^6.0.1"
38
- },
39
- "author": "abozanona",
40
- "dependencies": {
41
- "yargs": "^18.0.0"
42
- },
43
- "bin": {
44
- "pacman-contribution-graph": "./cli/cli.js"
45
- },
46
- "scripts": {
47
- "build": "webpack --config webpack.prod.js",
48
- "dev": "webpack --progress --config webpack.dev.js",
49
- "build-action": "pnpm run --prefix ./github-action build"
50
- }
51
- }
2
+ "name": "pacman-contribution-graph",
3
+ "version": "2.2.0",
4
+ "description": "Generates a pacman game from a github or gitlab user contributions grid",
5
+ "repository": "github:abozanona/pacman-contribution-graph",
6
+ "homepage": "https://abozanona.github.io/pacman-contribution-graph/",
7
+ "type": "module",
8
+ "main": "dist/pacman-contribution-graph.min.js",
9
+ "types": "dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "import": "./dist/pacman-contribution-graph.min.js",
13
+ "types": "./dist/index.d.ts"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist/pacman-contribution-graph.min.js",
18
+ "dist/index.d.ts",
19
+ "action.yml"
20
+ ],
21
+ "keywords": [
22
+ "github",
23
+ "pacman",
24
+ "svg",
25
+ "contribution-graph",
26
+ "animation",
27
+ "game",
28
+ "actions"
29
+ ],
30
+ "scripts": {
31
+ "build": "webpack --config webpack.prod.js",
32
+ "dev": "webpack --progress --config webpack.dev.js",
33
+ "prepublishOnly": "npm run build",
34
+ "build-action": "pnpm run --prefix ./github-action build"
35
+ },
36
+ "devDependencies": {
37
+ "prettier": "^3.4.2",
38
+ "terser": "^5.37.0",
39
+ "ts-loader": "^9.5.2",
40
+ "typescript": "^4.9.5",
41
+ "webpack": "^5.97.1",
42
+ "webpack-cli": "^6.0.1",
43
+ "webpack-merge": "^6.0.1"
44
+ },
45
+ "author": "abozanona",
46
+ "packageManager": "pnpm@9.15.4",
47
+ "dependencies": {
48
+ "yargs": "^18.0.0"
49
+ },
50
+ "bin": {
51
+ "pacman-contribution-graph": "./cli/cli.js"
52
+ }
53
+ }