Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package-lock.json linguist-generated
pnpm-lock.yaml linguist-generated
public linguist-generated
xcode/iOS-App/Base.lproj/Main.html linguist-generated
public linguist-generated
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ jobs:
- name: Install modules
run: npm install
- name: Run ESLint
run: npm run lint-js
run: npm run lint:js
- name: Run Stylelint
run: npm run lint-css
run: npm run lint:css
37 changes: 22 additions & 15 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Temp/Dist/Built
temp
dist
dist-ssr
build
built
*.local

# Logs
logs
*.log
Expand All @@ -7,11 +24,11 @@ yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

# npm
node_modules
temp
dist
dist-ssr
*.local
#package-lock.json
yarn.lock
pnpm-lock.yaml

# Editor directories and files
.vscode/*
Expand All @@ -25,20 +42,10 @@ dist-ssr
*.sln
*.sw?

# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# xcode
xcuserdata/
*.xcuserstate
*.dev.xcconfig
XCBuildData
xcode/**/build/
xcode/**/dist/
# xcode/Userscripts-iOS/Base.lproj/Main.html
xcode/**/dist/
18 changes: 9 additions & 9 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,30 @@
"version": "2.0.0",
"tasks": [
{
"label": "pnpm: install",
"label": "npm: install",
"detail": "Install dev dependencies",
"type": "shell",
"command": "pnpm install",
"command": "npm install",
"group": "build",
"options": {
"cwd": "./"
}
},
{
"label": "pnpm: dev",
"label": "npm: dev",
"detail": "Run dev server",
"type": "shell",
"command": "pnpm dev",
"command": "npm run dev",
"group": "build",
"options": {
"cwd": "./"
}
},
{
"label": "pnpm: build",
"label": "npm: build",
"detail": "Build to xcode dist path",
"type": "shell",
"command": "pnpm build",
"command": "npm run build",
"group": "build",
"options": {
"cwd": "./"
Expand All @@ -44,14 +44,14 @@
}
},
{
"label": "xcode: rebuild",
"detail": "pnpm build + xcodebuild",
"label": "build all",
"detail": "npm build + xcodebuild",
"presentation": {
"reveal": "silent"
},
"dependsOrder": "sequence",
"dependsOn": [
"pnpm: build",
"npm: build",
"xcode: build"
],
"group": {
Expand Down
20 changes: 11 additions & 9 deletions docs/dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@ The `xcode` directory is the root of the Xcode project where the Safari extensio
For other directory structure instructions, please refer to [structure.md](structure.md).

# Environment
- [`Node.js`](https://nodejs.dev/en/learn/how-to-install-nodejs/)
- [`pnpm`](https://pnpm.io/installation) (optional)
- [`Xcode`](https://geo.itunes.apple.com/app/xcode/id497799835)
- [`Node.js`](https://nodejs.org/)
- [`Xcode`](https://geo.itunes.apple.com/app/id497799835)

# Dev
- `pnpm install`
- `pnpm dev`
- `npm install`[^1]
- `npm run dev`[^1]

# Build
- `pnpm build`
- `npm run build`[^1]
- `cd ./xcode`
- `xcodebuild` or build with Xcode App
- `xcodebuild`[^1][^2] or build with `Xcode` App

[^1]: These commands can also be executed directly through the VSCode Run Task. Please refer to: [/.vscode/tasks.json](../.vscode/tasks.json)
[^2]: Local setup may be required. Please refer to: [Building from the Command Line with Xcode FAQ](https://developer.apple.com/library/archive/technotes/tn2339/_index.html)

# Xcode

Expand All @@ -28,9 +30,9 @@ The Xcode project contains two configurations, which have independent `xcconfig`
- `Release`: A developer account is required, which means it can be used for distribution as well as running on real iOS/iPadOS devices. You will need to override your developer account information in `xcconfig` to complete the build.

### xcconfig
All `xcconfig` files are in the `./xcode/xcconfig/` directory. Each `.xcconfig` file can be overridden by `.dev.xcconfig` in the same path, they will be ignored by `git`, so you can override any build settings locally.
All `xcconfig` files are in the [`/xcode/xcconfig/`](../xcode/xcconfig) directory. Each `.xcconfig` file can be overridden by `.dev.xcconfig` in the same path, they will be ignored by `git`, so you can override any build settings locally.

For example, you can create an `Userscripts-Release.dev.xcconfig` file to override `Userscripts-Release.xcconfig` and fill in your own developer account information there:
For example, you can create an `Userscripts-Release.dev.xcconfig` file to override [`Userscripts-Release.xcconfig`](../xcode/xcconfig/Userscripts-Release.xcconfig) and fill in your own developer account information there:

`Userscripts-Release.dev.xcconfig`
```
Expand Down
14 changes: 9 additions & 5 deletions docs/structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,22 @@ Readme references and project history assets
Project Static Asset
https://vitejs.dev/guide/assets.html#the-public-directory

### `./public/page/jshint.min.js`
### `./public/extension-page/jshint.min.js`
CodeMirror 5 `codemirror/addon/lint/javascript-lint.js` depends on `jshint.js`
https://codemirror.net/5/doc/manual.html#addon_lint
https://github.com/jshint/jshint/blob/main/dist/jshint.js

## `scripts`
Custom build scripts ref in `package.json`
Used to build the source code in `src` below

## `src`
Project Web App Source Code
Build the project from here to extension resources
Project Web App/Ext Source Code
Build the project from here to xcode resources

## `xcode`
Project Native App Source Code
Build the project from here to extension bundle app
Project Bundled App Source Code
Build the project from here to extension bundled app

# About
[Userscripts](https://github.com/quoid/userscripts) @ 2018-2023
14 changes: 14 additions & 0 deletions entry-app-webview.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!-- <meta http-equiv="Content-Security-Policy" content="default-src 'self'"> -->
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta name="color-scheme" content="dark">
<title>Userscripts App</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/app/main.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion entry-popup.html → entry-ext-action-popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
<body>
<noscript>Please enable Javascript to use this app</noscript>
<div id="app"></div>
<script type="module" src="/src/popup/main.js"></script>
<script type="module" src="/src/ext/action-popup/main.js"></script>
</body>
</html>
4 changes: 2 additions & 2 deletions entry-page.html → entry-ext-extension-page.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<body>
<noscript>Please enable Javascript to use this app</noscript>
<div id="app"></div>
<script type="module" src="/src/page/main.js"></script>
<script src="/page/jshint.min.js"></script>
<script type="module" src="/src/ext/extension-page/main.js"></script>
<script src="extension-page/jshint.min.js"></script>
</body>
</html>
Binary file removed etc/App-iOS-WebView.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
<script type="module" src="/src/dev/main.js"></script>
<script>
function notice() {
if (!app.hasChildNodes()) {
Expand Down
Loading