Skip to content

Commit 7ff42bb

Browse files
committed
init commit part 2
1 parent ffd4706 commit 7ff42bb

23 files changed

Lines changed: 2786 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-node@v4
13+
with:
14+
node-version-file: ".nvmrc"
15+
cache: "yarn"
16+
- name: Set up corepack
17+
run: corepack enable && corepack install
18+
- name: Install dependencies
19+
run: yarn install --immutable
20+
- name: Build
21+
run: yarn run build
22+
# - name: Create Release
23+
# if: github.event_name == 'push' && github.ref == 'refs/heads/main'
24+
# run: |
25+
# git config --global user.name "GitHub Actions"
26+
# git config --global user.email "actions@github.com"
27+
# yarn changeset version
28+
# git add .
29+
# git commit -m "chore: version packages"
30+
# git push
31+
# yarn changeset publish

.gitignore

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,53 @@ dist
134134
.yarn/build-state.yml
135135
.yarn/install-state.gz
136136
.pnp.*
137+
138+
# Dependencies
139+
node_modules/
140+
.pnp/
141+
.pnp.js
142+
143+
# Testing
144+
coverage/
145+
146+
# Production
147+
dist/
148+
build/
149+
150+
# Misc
151+
.DS_Store
152+
.env
153+
.env.local
154+
.env.development.local
155+
.env.test.local
156+
.env.production.local
157+
158+
# Debug
159+
npm-debug.log*
160+
yarn-debug.log*
161+
yarn-error.log*
162+
163+
# IDE
164+
.idea/
165+
.vscode/
166+
*.swp
167+
*.swo
168+
169+
# NX
170+
.nx/
171+
.nx/cache/
172+
.nx/daemon/
173+
174+
# Changesets
175+
.changeset/pre.json
176+
177+
# Yarn
178+
.yarn/*
179+
!.yarn/patches
180+
!.yarn/plugins
181+
!.yarn/releases
182+
!.yarn/sdks
183+
!.yarn/versions
184+
.pnp.*
185+
186+
.nx/workspace-data

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20

.oxlintrc.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
rules: {
3+
recommended: true,
4+
typescript: true,
5+
},
6+
ignore: ["**/dist/**", "**/node_modules/**"],
7+
};
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* eslint-disable */
2+
//prettier-ignore
3+
module.exports = {
4+
name: "@yarnpkg/plugin-engines",
5+
factory: function (require) {
6+
var plugin=(()=>{var m=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var P=Object.prototype.hasOwnProperty;var s=(o=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(o,{get:(r,t)=>(typeof require<"u"?require:r)[t]}):o)(function(o){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+o+'" is not supported')});var k=(o,r)=>{for(var t in r)m(o,t,{get:r[t],enumerable:!0})},j=(o,r,t,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of N(r))!P.call(o,n)&&n!==t&&m(o,n,{get:()=>r[n],enumerable:!(e=C(r,n))||e.enumerable});return o};var V=o=>j(m({},"__esModule",{value:!0}),o);var T={};k(T,{default:()=>S});var i=s("@yarnpkg/core");var p=class{constructor(r){this.throwWrongEngineError=(r,t)=>{let e=this.formatErrorMessage(r,t);this.throwError(e)};this.throwError=r=>{switch(this.errorReporter){case"Yarn":this.reportYarnError(r);break;case"Console":default:this.reportConsoleError(r);break}};this.reportYarnError=r=>{throw new i.ReportError(i.MessageName.UNNAMED,r)};this.reportConsoleError=r=>{console.error(r),process.exit(1)};this.formatErrorMessage=(r,t)=>{let{configuration:e}=this.project,n=i.formatUtils.applyStyle(e,i.formatUtils.pretty(e,this.engine,"green"),2),c=i.formatUtils.pretty(e,r,"cyan"),g=i.formatUtils.pretty(e,t,"cyan"),l=`The current ${n} version ${c} does not satisfy the required version ${g}.`;return i.formatUtils.pretty(e,l,"red")};this.project=r.project,this.errorReporter=r.errorReporter}};var f=s("fs"),v=s("path"),h=s("semver"),y=s("@yarnpkg/fslib"),a=s("@yarnpkg/core");var Y=".nvmrc",b=".node-version",d=class extends p{constructor(){super(...arguments);this.resolveNodeFromFileRequiredVersion=t=>{let{configuration:e,cwd:n}=this.project,c=(0,v.resolve)(y.npath.fromPortablePath(n),t),g=a.formatUtils.applyStyle(e,a.formatUtils.pretty(e,this.engine,"green"),2);if(!(0,f.existsSync)(c)){this.throwError(a.formatUtils.pretty(e,`Unable to verify the ${g} version. The ${t} file does not exist.`,"red"));return}let l=(0,f.readFileSync)(c,"utf-8").trim();if((0,h.validRange)(l))return l;let w=a.formatUtils.pretty(e,t,"yellow");this.throwError(a.formatUtils.pretty(e,`Unable to verify the ${g} version. The ${w} file contains an invalid semver range.`,"red"))}}get engine(){return"Node"}verifyEngine(t){let e=t.node;e!=null&&([Y,b].forEach(n=>{e===n&&(e=this.resolveNodeFromFileRequiredVersion(n))}),(0,h.satisfies)(process.version,e,{includePrerelease:!0})||this.throwWrongEngineError(process.version.replace(/^v/i,""),e.replace(/^v/i,"")))}};var R=s("semver"),u=s("@yarnpkg/core");var E=class extends p{get engine(){return"Yarn"}verifyEngine(r){let t=r.yarn;t!=null&&((0,R.satisfies)(u.YarnVersion,t,{includePrerelease:!0})||this.throwWrongEngineError(u.YarnVersion,t))}};var x=o=>r=>{if(process.env.PLUGIN_YARN_ENGINES_DISABLE!=null)return;let{engines:t={}}=r.getWorkspaceByCwd(r.cwd).manifest.raw,e={project:r,errorReporter:o};[new d(e),new E(e)].forEach(c=>c.verifyEngine(t))},F={hooks:{validateProject:x("Yarn"),setupScriptEnvironment:x("Console")}},S=F;return V(T);})();
7+
return plugin;
8+
}
9+
};

.yarnrc.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
nodeLinker: node-modules
2+
3+
enableGlobalCache: true
4+
enableConstraintsChecks: true
5+
enableTelemetry: false
6+
7+
compressionLevel: mixed
8+
9+
# ^ means latest patch version
10+
# ~ means latest minor version
11+
defaultSemverRangePrefix: "~"
12+
13+
supportedArchitectures:
14+
os:
15+
- current
16+
- darwin
17+
- linux
18+
- win32
19+
cpu:
20+
- current
21+
- x64
22+
- arm64
23+
24+
plugins:
25+
- path: .yarn/plugins/@yarnpkg/plugin-engines.cjs
26+
spec: "https://raw.githubusercontent.com/devoto13/yarn-plugin-engines/main/bundles/%40yarnpkg/plugin-engines.js"

README.md

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,55 @@
1-
# greasemonkey-scripts
2-
Monorepo for Greasy Fork userscripts
1+
# Greasemonkey Scripts
2+
3+
A collection of user scripts for various websites, built with TypeScript and managed as a monorepo.
4+
5+
## Project Structure
6+
7+
This repository uses a monorepo structure with the following setup:
8+
9+
- Yarn workspaces for package management
10+
- NX for build orchestration
11+
- TypeScript for development
12+
- Changesets for version management
13+
- oxlint for linting
14+
- GitHub Actions for CI/CD
15+
16+
## Getting Started
17+
18+
1. Install Node.js using nvm:
19+
20+
```bash
21+
nvm install
22+
nvm use
23+
```
24+
25+
2. Enable corepack for package manager management:
26+
27+
```bash
28+
corepack enable
29+
```
30+
31+
3. Install dependencies:
32+
33+
```bash
34+
yarn install
35+
```
36+
37+
4. Build the project:
38+
```bash
39+
yarn build
40+
```
41+
42+
## Development
43+
44+
- Each script is a separate package in the `packages/` directory
45+
- Use `yarn changeset` to create a new changeset
46+
- Use `yarn changeset version` to version packages
47+
- Use `yarn changeset publish` to publish packages
48+
49+
## Scripts
50+
51+
Each script is published to [GreasyFork](https://greasyfork.org/en/scripts?by=1372068) automatically when a new release is created.
52+
53+
## License
54+
55+
MIT

nx.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"$schema": "./node_modules/nx/schemas/nx-schema.json",
3+
"affected": {
4+
"defaultBase": "main"
5+
},
6+
"tasksRunnerOptions": {
7+
"default": {
8+
"runner": "nx/tasks-runners/default",
9+
"options": {
10+
"cacheableOperations": [
11+
"build",
12+
"lint",
13+
"test"
14+
]
15+
}
16+
}
17+
},
18+
"targetDefaults": {
19+
"build": {
20+
"dependsOn": [
21+
"^build"
22+
],
23+
"inputs": [
24+
"production",
25+
"^production"
26+
],
27+
"outputs": [
28+
"{projectRoot}/dist"
29+
],
30+
"cache": true
31+
},
32+
"lint": {
33+
"inputs": [
34+
"default",
35+
"{workspaceRoot}/.oxlintrc.js"
36+
],
37+
"cache": true
38+
},
39+
"test": {
40+
"outputs": [
41+
"{projectRoot}/coverage"
42+
],
43+
"cache": true
44+
}
45+
}
46+
}

package.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "greasemonkey-scripts",
3+
"private": true,
4+
"workspaces": [
5+
"packages/*"
6+
],
7+
"scripts": {
8+
"build": "nx run-many --target=build --all",
9+
"lint": "nx run-many --target=lint --all",
10+
"test": "nx run-many --target=test --all",
11+
"changeset": "changeset",
12+
"version-packages": "changeset version",
13+
"release": "changeset publish"
14+
},
15+
"devDependencies": {
16+
"@changesets/cli": "~2.29.2",
17+
"nx": "~20.8.1",
18+
"oxlint": "~0.16.8",
19+
"typescript": "~5.8.3"
20+
},
21+
"packageManager": "yarn@4.9.1+sha512.f95ce356460e05be48d66401c1ae64ef84d163dd689964962c6888a9810865e39097a5e9de748876c2e0bf89b232d583c33982773e9903ae7a76257270986538",
22+
"engines": {
23+
"node": ">=18.0.0"
24+
}
25+
}

packages/_template/package.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "@greasemonkey-scripts/_template",
3+
"version": "0.0.0",
4+
"private": true,
5+
"scripts": {
6+
"build": "tsc --build",
7+
"lint": "oxlint"
8+
},
9+
"devDependencies": {
10+
"@types/greasemonkey": "~4.0.7",
11+
"typescript": "~5.8.3"
12+
}
13+
}

0 commit comments

Comments
 (0)