diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000..43eb59fe9 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,18 @@ +# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.158.0/containers/typescript-node/.devcontainer/base.Dockerfile + +# [Choice] Node.js version: 14, 12, 10 +ARG VARIANT="14-buster" +FROM mcr.microsoft.com/devcontainers/typescript-node:${VARIANT} + +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install --no-install-recommends libx11-dev libxkbfile-dev libsecret-1-dev rsync + +# copied from https://github.com/microsoft/vscode-oniguruma/blob/main/.devcontainer/Dockerfile +RUN mkdir -p /opt/dev \ + && cd /opt/dev \ + && git clone https://github.com/emscripten-core/emsdk.git \ + && cd /opt/dev/emsdk \ + && ./emsdk install 3.1.21 \ + && ./emsdk activate 3.1.21 + +ENV PATH="/opt/dev/emsdk:/opt/dev/emsdk/node/14.18.2_64bit/bin:/opt/dev/emsdk/upstream/emscripten:${PATH}" diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..eef260001 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,31 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.158.0/containers/typescript-node +{ + "name": "Node.js & TypeScript", + "build": { + "dockerfile": "Dockerfile", + // Update 'VARIANT' to pick a Node version: 10, 12, 14 + "args": { + "VARIANT": "20-bullseye" + } + }, + + // Set *default* container specific settings.json values on container create. + "settings": { + "terminal.integrated.shell.linux": "/bin/bash" + }, + + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "dbaeumer.vscode-eslint" + ], + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [8080], + + // Use 'postCreateCommand' to run commands after the container is created. + //"postCreateCommand": "npm install", + + // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "node" +} \ No newline at end of file diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 977df0242..000000000 --- a/.eslintignore +++ /dev/null @@ -1,3 +0,0 @@ -**/node_modules/** -**/lib/vscode/** -**/dist/** diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 847676303..000000000 --- a/.eslintrc.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "root": true, - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaVersion": 6, - "sourceType": "module" - }, - "plugins": [ - "@typescript-eslint", - "jsdoc" - ], - "rules": { - "constructor-super": "warn", - "curly": "warn", - "eqeqeq": "warn", - "no-buffer-constructor": "warn", - "no-caller": "warn", - "no-debugger": "warn", - "no-duplicate-case": "warn", - "no-duplicate-imports": "warn", - "no-eval": "warn", - "no-extra-semi": "warn", - "no-new-wrappers": "warn", - "no-redeclare": "off", - "no-sparse-arrays": "warn", - "no-throw-literal": "warn", - "no-unsafe-finally": "warn", - "no-unused-labels": "warn", - "no-restricted-globals": [ - "warn", - "name", - "length", - "event", - "closed", - "external", - "status", - "origin", - "orientation", - "context" - ], // non-complete list of globals that are easy to access unintentionally - "no-var": "warn", - "jsdoc/no-types": "warn", - "semi": "off", - "@typescript-eslint/semi": "warn", - "@typescript-eslint/naming-convention": [ - "warn", - { - "selector": "class", - "format": [ - "PascalCase" - ] - } - ] - }, - "overrides": [ - { - "files": [ - "*.js" - ], - "rules": { - "jsdoc/no-types": "off" - } - } - ] -} diff --git a/.github/config.yml b/.github/config.yml new file mode 100644 index 000000000..513c48947 --- /dev/null +++ b/.github/config.yml @@ -0,0 +1,21 @@ +# Configuration for welcome - https://github.com/behaviorbot/welcome + +# Configuration for new-issue-welcome - https://github.com/behaviorbot/new-issue-welcome +# Comment to be posted to on first time issues + +newIssueWelcomeComment: > + Hello there!πŸ‘‹ Welcome to the project!πŸ’– + Thank you and congratsπŸŽ‰for opening your very first issue in this project.Be patient while we get back to you.πŸ˜„ + +# Configuration for new-pr-welcome - https://github.com/behaviorbot/new-pr-welcome +# Comment to be posted to on PRs from first time contributors in your repository + +newPRWelcomeComment: > + Hello there!πŸ‘‹ Welcome to the project!πŸ’– + Thank you and congratsπŸŽ‰ for opening your first pull request✨ πŸ™Œ.We will get back to you as soon as we can.πŸ˜„ + +# Configuration for first-pr-merge - https://github.com/behaviorbot/first-pr-merge +# Comment to be posted to on pull requests merged by a first time user + +firstPRMergeComment: > + Congrats on merging your first pull request! πŸŽ‰πŸŽ‰πŸŽ‰ We here at github1s are proud of you! diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..ed83fe6ef --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,32 @@ +name: Build & Test + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + build: + strategy: + matrix: + os: [macos-14] + node-version: [24.x] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + cache: 'npm' + node-version: ${{ matrix.node-version }} + + - run: npm install + - run: npm run eslint + - run: npm run build + - uses: microsoft/playwright-github-action@v1 + - run: npm run test:ci diff --git a/.github/workflows/codacy-analysis.yaml b/.github/workflows/codacy-analysis.yaml new file mode 100644 index 000000000..7abad0aae --- /dev/null +++ b/.github/workflows/codacy-analysis.yaml @@ -0,0 +1,37 @@ +name: Codacy Security Scan + +on: + push: + branches: ['master', 'main'] + pull_request: + branches: ['master', 'main'] + +jobs: + codacy-security-scan: + name: Codacy Security Scan + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Run Codacy Analysis CLI + uses: codacy/codacy-analysis-cli-action@master + with: + # Run analysis without SARIF output to avoid GitHub Code Scanning integration issues + # See: https://github.com/codacy/codacy-analysis-cli-action/issues/142 + # The Codacy tool generates multiple SARIF runs which is incompatible with + # GitHub's new policy as of July 2025 + verbose: true + # Force 0 exit code to prevent workflow failures + max-allowed-issues: 2147483647 + # only scan the github1s directory + directory: $GITHUB_WORKSPACE/extensions/github1s + + # SARIF upload is temporarily disabled due to incompatibility + # See: https://github.com/codacy/codacy-analysis-cli-action/issues/142 + # TODO: Re-enable when Codacy fixes the multiple runs issue + # - name: Upload SARIF results file + # uses: github/codeql-action/upload-sarif@v4 + # with: + # sarif_file: results.sarif + # category: codacy-security-scan diff --git a/.github/workflows/test-wtih-vscode-build.yml b/.github/workflows/test-wtih-vscode-build.yml new file mode 100644 index 000000000..d04876a72 --- /dev/null +++ b/.github/workflows/test-wtih-vscode-build.yml @@ -0,0 +1,41 @@ +name: Build & Test with VS Code build + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + build-with-vscode-build: + permissions: + contents: read + + strategy: + matrix: + os: [macos-14] + node-version: [24.x] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + cache: 'npm' + node-version: ${{ matrix.node-version }} + + - run: npm install && cd vscode-web && npm install + - name: Build VS Code web + working-directory: vscode-web + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: npm run build + - run: npm run link && npm run build + - uses: microsoft/playwright-github-action@v1 + - run: npm run test:ci diff --git a/.github/workflows/welcome-first-time-contributors.yml b/.github/workflows/welcome-first-time-contributors.yml new file mode 100644 index 000000000..09741ee73 --- /dev/null +++ b/.github/workflows/welcome-first-time-contributors.yml @@ -0,0 +1,37 @@ +name: Welcome first time contributors + +on: + pull_request_target: + types: + - opened + issues: + types: + - opened + +jobs: + welcome: + runs-on: ubuntu-latest + steps: + - uses: actions/first-interaction@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + issue-message: | + Hello there ${{ github.actor }} πŸ‘‹ + + Welcome to github1s !!πŸ’–πŸ₯³ + + Thank you and congratulations πŸŽ‰ for opening your very first issue in this project. github1s fosters an open and welcoming environment for all our contributors.🌸 + + Incase you want to claim this issue, please comment down below! We will try to get back to you as soon as we can.πŸ‘€ + + Feel free to visit [github1s.com](https://github1s.com/). πŸ‘©β€πŸ’» If you have any interesting ideas, just open an issue. We would love to hear you and engage in discussions. + + pr-message: | + Hello there ${{ github.actor }} πŸ‘‹ + + Thank you and congrats πŸŽ‰ for opening your first PR on this project.✨ + + We will review it soon! + + github1s fosters an open and welcoming environment for all our contributors.🌸 + diff --git a/.gitignore b/.gitignore index 9a28bffee..7f61e2ee3 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ lib dist out node_modules +.worktrees/ diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile new file mode 100644 index 000000000..0a913357c --- /dev/null +++ b/.gitpod.Dockerfile @@ -0,0 +1,6 @@ +FROM gitpod/workspace-full + +RUN sudo apt-get update \ + && sudo apt-get install -y \ + g++ gcc make python2.7 pkg-config libx11-dev libxkbfile-dev libsecret-1-dev python-is-python3 rsync \ + && sudo rm -rf /var/lib/apt/lists/* \ No newline at end of file diff --git a/.gitpod.yml b/.gitpod.yml new file mode 100644 index 000000000..f5a3e68c5 --- /dev/null +++ b/.gitpod.yml @@ -0,0 +1,35 @@ +image: + file: .gitpod.Dockerfile +tasks: + - init: | + npm install + npm run build + command: | + echo "=======================" + echo "Please run 'npm run watch'" + echo "=======================" + - command: | + echo "===========================================================================" + echo "Please wait for 'npm run watch' to complete compilation" + echo "===========================================================================" +ports: + - port: 8080 + onOpen: open-browser +github: + prebuilds: + # enable for the master/default branch (defaults to true) + master: true + # enable for all branches in this repo (defaults to false) + branches: true + # enable for pull requests coming from this repo (defaults to true) + pullRequests: true + # enable for pull requests coming from forks (defaults to false) + pullRequestsFromForks: true + # add a check to pull requests (defaults to true) + addCheck: true + # add a "Review in Gitpod" button as a comment to pull requests (defaults to false) + addComment: true + # add a "Review in Gitpod" button to the pull request's description (defaults to false) + addBadge: false + # add a label once the prebuild is ready to pull requests (defaults to false) + addLabel: false diff --git a/.husky/pre-commit b/.husky/pre-commit index d2ae35e84..2312dc587 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" - -yarn lint-staged +npx lint-staged diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..b26157438 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,10 @@ +lib +dist +out +node_modules +vscode-web/src/vs +vscode-web/extensions +htm.module.js +preact.module.js +preact-hooks.module.js +index.html diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 000000000..aa5eda3cd --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,15 @@ +export default { + tabWidth: 2, + useTabs: true, + semi: true, + singleQuote: true, + printWidth: 120, + overrides: [ + { + files: ['*.yml', '*.yaml', '*.json'], + options: { + useTabs: false, + }, + }, + ], +}; diff --git a/README.md b/README.md index 773aee9c1..1f4960174 100644 --- a/README.md +++ b/README.md @@ -1,47 +1,198 @@ -![GitHub1s](https://raw.githubusercontent.com/conwnet/github1s/master/resources/images/logo.png) +![GitHub1s](https://raw.githubusercontent.com/conwnet/github1s/master/resources/images/logo.svg) + # github1s One second to read GitHub code with VS Code. -[Chrome Extension](https://chrome.google.com/webstore/detail/github1s/lodjfmkfbfkpdhnhkcdcoonghhghbkhe/) +## Usage + +Just add `1s` after `github` and press `Enter` in the browser address bar for any repository you want to read. + +For example, try it on the VS Code repo: + +[https://github1s.com/microsoft/vscode](https://github1s.com/microsoft/vscode) + +![VS Code - GitHub1s](https://raw.githubusercontent.com/conwnet/github1s/master/resources/images/vs-code-github1s.png) + +You can also use [https://gitlab1s.com](https://gitlab1s.com) or [https://npmjs1s.com](https://npmjs1s.com) in the same way. -Or Save as a bookmarklet (GitHub markdown doesn't allow js links, just copy it into a bookmark) +For browser extensions, see [Third-party Related Projects](https://github.com/conwnet/github1s#third-party-related-projects). + +Or save the following code snippet as a bookmarklet, you can use it to quickly switch between github.com and github1s.com (GitHub markdown doesn't allow js links, so just copy it into a bookmark). ``` -javascript: window.location.href = window.location.href.replace('github.com', 'github1s.com') +javascript: window.location.href = window.location.href.replace(/github(1s)?.com/, function(match, p1) { return p1 ? 'github.com' : 'github1s.com' }) ``` -## Usage +### Develop in the cloud -Just add `1s` after `github` and press `Enter` in browser address bar for any repository you want to read. +To edit files, run Docker containers, create pull requests and more, click the "Develop your project on [Gitpod](https://www.gitpod.io)" button in the status bar. You can also open the Command Palette (default shortcut `Ctrl+Shift+P`) and choose `GitHub1s: Edit files in Gitpod`. -For Example VS Code: +![Gitpod Status Bar](https://raw.githubusercontent.com/conwnet/github1s/master/resources/images/gitpod-statusbar.png) -[https://github1s.com/microsoft/vscode](https://github1s.com/microsoft/vscode) +## Documentation -![VS Code - GitHub1s](https://raw.githubusercontent.com/conwnet/github1s/master/resources/images/vs-code-github1s.png) +- [How it works](https://github.com/conwnet/github1s/blob/master/docs/guide.md) +- [Roadmap](https://github.com/conwnet/github1s/projects/1) + +## Enabling Private Repositories + +If you want to view non-public repositories, you need to add an OAuth token. The token is stored only in your browser, and only send to GitHub when fetching your repository's files. Click on the icon near the bottom of the left-hand row of icons, and the dialog box will prompt you for it, and even take you to your GitHub settings page to generate one, if needed. + + + +## Screenshots -## Demo +![VS Code - GitHub1s](https://raw.githubusercontent.com/conwnet/github1s/master/resources/images/GitHub1sDemo1.gif) ![VS Code - GitHub1s](https://raw.githubusercontent.com/conwnet/github1s/master/resources/images/demo.png) ## Development -You need [these prerequisites as same as VS Code](https://github.com/microsoft/vscode/wiki/How-to-Contribute#prerequisites) for development. +### Cloud-based development + +You can start an online development environment with [Gitpod](https://www.gitpod.io) by clicking the following button: + +[![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/conwnet/github1s) + +### Local development + +```bash +git clone git@github.com:conwnet/github1s.git +cd github1s +npm install +npm run watch +# The cli will automatically open http://localhost:8080 once the build is completed. +# You can visit http://localhost:8080/conwnet/github1s if it doesn't. +``` + +#### Local development with full VS Code build + +You need [these prerequisites (the same ones as for VS Code)](https://github.com/microsoft/vscode/wiki/How-to-Contribute#prerequisites) for development with full VS Code build. +Please make sure you could build VS Code locally before the watch mode. + +To verify the build: + +```bash +cd github1s +npm run build:vscode +``` + +After the initial successful build, you could use the watch mode: ```bash -$ git clone git@github.com:conwnet/github1s.git -$ cd github1s -$ yarn -$ yarn watch -$ yarn serve # in another shell -$ # Then visit http://localhost:5000 or http://localhost:5000/conwnet/github1s once the build is completed. +cd github1s +npm install +npm run watch-with-vscode +# The cli will automatically open http://localhost:8080 once the build is completed. +# You can visit http://localhost:8080/conwnet/github1s if it doesn't. ``` +### ... or ... VS Code + Docker Development + +You can use the VS Code plugin [Remote-Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) `Dev Container` to use a Docker container as a development environment. + +1. Install the Remote-Containers plugin in VS Code & Docker +2. Open the Command Palette (default shortcut `Ctrl+Shift+P`) and choose `Remote-Containers: Clone Repository in Container Volume...` +3. Enter the repo, in this case `https://github.com/conwnet/github1s.git` or your forked repo +4. Pick either, `Create a unique volume` or `Create a new volume` + + - Now VS Code will create the docker container and connect to the new container so you can use this as a fully setup environment! + +5. Open a new VS Code Terminal, then you can run the `npm install` commands listed above. + +```bash +npm install +npm run watch +# The cli will automatically open http://localhost:8080 once the build is completed. +# You can visit http://localhost:8080/conwnet/github1s if it doesn't. +``` + +### Format all codes + +```bash +npm run format +``` + +It uses `prettier` to format all possible codes. + ## Build ```bash -$ yarn -$ yarn build +npm install +npm run build ``` +## Feedback + +- If something is not working, [create an issue](https://github.com/conwnet/github1s/issues/new) + +## Sponsors + +The continued development and maintenance of GitHub1s is made possible by these generous sponsors: + + + +
+ +
+ +## Partners + +We are partnered with [OSS Insight](https://ossinsight.io/?utm_source=github1s&utm_medium=github&utm_campaign=ghtrending) to get the Trending Repositories & some more Interesting Analytics. [OSS Insight](https://ossinsight.io/?utm_source=github1s&utm_medium=github&utm_campaign=ghtrending) provides deep insights into GitHub repos, developers, and curated repo lists from billions of GitHub events. It’s built with [TiDB Cloud](https://www.pingcap.com/tidb-cloud/?utm_source=github1s&utm_medium=github&utm_campaign=ghtrending). + + + +
+ +
+ +## Maintainers! :blush: + + + + + + + +

netcon

πŸ’» πŸ–‹

xcv58

πŸ’» πŸ–‹

Siddhant Khare

πŸ’» πŸ–‹
+ +## Stargazers over time + +[![Stargazers over time](https://api.star-history.com/svg?repos=conwnet/github1s&type=Date)](https://star-history.com/#conwnet/github1s&Date) + +
+Third-party Related Projects +
+ +### Chrome Extensions + +- [Repositree](https://chrome.google.com/webstore/detail/repositree/lafjldoccjnjlcmdhmniholdpjkbgajo) ([chouglesaud/repositree](https://github.com/chouglesaud/repositree)) +- [github-code-viewer](https://chrome.google.com/webstore/detail/github-code-viewer/ecddapgifccgblebfibdgkagfbdagjfn) ([febaoshan/edge-extensions-github-code-viewer](https://github.com/febaoshan/edge-extensions-github-code-viewer)) +- Github1s Extension ([Darkempire78/GitHub1s-Extension](https://github.com/Darkempire78/GitHub1s-Extension)) +- [Github Web IDE](https://chrome.google.com/webstore/detail/adjiklnjodbiaioggfpbpkhbfcnhgkfe) ([zvizvi/Github-Web-IDE](https://github.com/zvizvi/Github-Web-IDE)) +- [shortcut to github1s](https://chrome.google.com/webstore/detail/shortcut-to-github1s/gfcdbodapcbfckbfpmgeldfkkgjknceo) ([katsuhisa91/github1s-shortcut](https://github.com/katsuhisa91/github1s-shortcut)) +- [Github1s Shortut - Open source](https://github.com/Fauzdar1/Github1s) +- [⚑️ 1s to GitHub1s!](https://github.com/holazz/webext-github1s) +- [github1s Google Chrome Extensions](https://github.com/Lonely-Mr-zhang/github_1s_vscode) + +### Firefox Extensions + +- [Repositree](https://addons.mozilla.org/en-US/firefox/addon/repositree/) ([chouglesaud/repositree](https://github.com/chouglesaud/repositree)) +- [Github1s Extension](https://addons.mozilla.org/firefox/addon/github1s-extension) ([Darkempire78/GitHub1s-Extension](https://github.com/Darkempire78/GitHub1s-Extension)) +- [Github1s](https://addons.mozilla.org/firefox/addon/github1s/) ([mcherifi/github1s-firefox-addon](https://github.com/mcherifi/github1s-firefox-addon)) +- [Github Web IDE](https://addons.mozilla.org/firefox/addon/github-web-ide/) ([zvizvi/Github-Web-IDE](https://github.com/zvizvi/Github-Web-IDE)) + +### Microsoft Edge Extensions + +- [github-code-viewer](https://microsoftedge.microsoft.com/addons/detail/githubcodeviewer/jaaaapanahkknbgdbglnlchbjfhhjlpi) ([febaoshan/edge-extensions-github-code-viewer](https://github.com/febaoshan/edge-extensions-github-code-viewer)) +- [Github Web IDE](https://microsoftedge.microsoft.com/addons/detail/akjbkjciknacicbnkfjbnlaeednpadcf) ([zvizvi/Github-Web-IDE](https://github.com/zvizvi/Github-Web-IDE)) + +### Safari Extension + +- [GitHub1s-For-Safari-Extension](https://apps.apple.com/us/app/readcodeonline/id1569026520?mt=12) ([code4you2021/GitHub1s-For-Safari-Extension](https://github.com/code4you2021/GitHub1s-For-Safari-Extension)) + +### Tampermonkey scripts + +- [Mr-B0b/TamperMonkeyScripts/vscode.js](https://github.com/Mr-B0b/TamperMonkeyScripts/blob/main/vscode.js) +
diff --git a/docs/guide.md b/docs/guide.md new file mode 100644 index 000000000..4c30e8934 --- /dev/null +++ b/docs/guide.md @@ -0,0 +1,86 @@ +# How it works + +GitHub1s is based on [VS Code 1.66.2](https://github.com/microsoft/vscode/tree/1.66.2) now. VS Code can be built for a browser version officially. I also used the code and got inspired by [Code Server](https://github.com/cdr/code-server). + +Thanks to the very powerful and flexible extensibility of VS Code, we can easily implement a VS Code extension that provides the custom File IO ability using [FileSystemProvider API](https://code.visualstudio.com/api/references/vscode-api#FileSystemProvider). There is an official demo named [vscode-web-playground](https://github.com/microsoft/vscode-web-playground) which shows how it is used. + +On the other hand, GitHub provides the powerful [REST API](https://docs.github.com/en/rest) that can be used for a variety of tasks which includes reading directories and files for sure. + +According to the above, obviously, the core concept of GitHub1s is to implement a VS Code Extension (includes FileSystemProvider) using GitHub REST API. + +_We may switch to the GitHub GraphQL API for more friendly user experience in the future, thanks to @xcv58 and @kanhegaonkarsaurabh. See details at [Issue 12](https://github.com/conwnet/github1s/issues/12)._ + +~~GitHub1s is a purely static web app (because it really doesn't need a backend service, does it?). So we just deploy it on [GitHub Pages](https://pages.github.com/) now (the `gh-pages` branch of this repository), and it is free. The service of GitHub1s could be reliable (GitHub is very reliable) because nobody needs to pay the web hosting bills.~~ + +We deploy GitHub1s on [Cloudflare Pages](https://cloudflare.com/) now for minimize delays in loading and better developer experience. Thanks for the wonderful service provide by Cloudflare. + +# Rate Limit + +Another thing that needs attention is [Rate Limit](https://docs.github.com/en/rest/reference/rate-limit): + +> For unauthenticated requests, the rate limit allows for up to 60 requests per hour. Unauthenticated requests are associated with the originating IP address, and not the user making requests. + +> For API requests using Basic Authentication or OAuth, you can make up to 5,000 requests per hour. + +So, if you meet some problems when you use GitHub1s, even if you are using newer browsers, you could try to set a [GitHub OAuth Token](https://docs.github.com/en/rest/overview/resources-in-the-rest-api#oauth2-token-sent-in-a-header). Don't worry, we cannot see your token. It is only stored in your browser [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API) with [VS Code Extension globalState API](https://code.visualstudio.com/api/references/vscode-api#ExtensionContext) (Actually we don't have a server, do we?). + +But this does not mean the token is absolutely safe, **don't forget to clean it while you are using a device that doesn't belong to you**. + +# Sourcegraph API + +Due to the potential RateLimit of the GitHub API, we will prioritize the use of the [Sourcegraph API](https://sourcegraph.com/docs) for public repositories, with the exception of the Read interface, the code search capability is also provided by the Sourcegraph API. + +By default, GitHub1s will only try to use the GitHub API when the Sourcegraph API request fails, and you can adjust this option in the settings. + +# Development + +As you see, running GitHub1s locally is not difficult. After cloning the repository, just run these commands: + +```shell +$ npm install +$ npm run watch +``` + +Then, there will be a new directory named `dist` generated in the project root. The `npm run watch:dev-server` (part of `npm run watch` command) will automatically open http://localhost:8080 in the browser. + +If you get a 404 error for some static files, please wait a minute for the building to complete. + +## Watch Mode + +What happens after you run `npm run watch-with-vscode`? + +1. Copy some necessary resources (`index.html`, `favicons.ico`, etc.) to the `dist` directory. + +2. This command will compile the codes in `src` and generate application entry script (see `webpack.config.js`). This command also compile the custom extensions (for example `github1s`) in `extensions` directory. + +3. Redirect vscode-web static requests (vscode, extensisions, dependencies) to `vscode-web/lib/vscode` which should be generated by vscode compile process. + +You should also compile the vscode manually in another terminal. + +1. Go to `vscode-web` and run `npm install && npm run watch` (the native watch of vscode), it will trigger a new build if something in it has been changed. + +2. This command will alose watch the `vscode-web/src` and `vscode-web/extensions` directory, merge it in to `vscode-web/lib/vscode` if something in it has been changed. (When a new file is merged into `lib/vscode`, it will trigger the watcher that is described in Step 3) + +Note that since we have modified the source code of VS Code, it may get into trouble when merging a newer version VS Code. + +It is a little laborious to complete the watch process, but I didn't think of a better solution. + +What happens after you run `npm run watch`? + +It's the same procedure as `` without the step 3. Instead of the local VS Code, it uses the prebuilt [@github1s/vscode-web](https://www.npmjs.com/package/@github1s/vscode-web) version. + +## Build mode + +Put simply, we build the necessary code and do a minify. The minify script is modified from [Code Server](https://github.com/cdr/code-server). + +## Directory Structure + +- `extensions` - custom VS Code extensions that don't come with VS Code natively. + +- `src` - the code in here will be patched into VS Code source. + +- `vscode-web` - This contains the code to patch VS Code. + +- `scripts` - some scripts for build, watch, package, etc. + +- `resources` - some resource files such as templates, pictures, configuration files, etc. diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 000000000..0cc42d3dd --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,17 @@ +import jsdoc from 'eslint-plugin-jsdoc'; +import tseslint from 'typescript-eslint'; +import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'; + +export default [ + { ignores: ['**/dist', '**/assets', 'vscode-web/lib', '**/vs', '**/vscode.proposed.d.ts'] }, + ...tseslint.configs.recommended, + jsdoc.configs['flat/recommended-typescript'], + eslintPluginPrettierRecommended, + { + rules: { + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-unused-expressions': 'off', + '@typescript-eslint/no-unused-vars': 'off', + }, + }, +]; diff --git a/extensions/dart-web/README.md b/extensions/dart-web/README.md deleted file mode 100644 index 6a9ab8fa6..000000000 --- a/extensions/dart-web/README.md +++ /dev/null @@ -1,92 +0,0 @@ -[![Discord Chat](https://img.shields.io/badge/chat-discord-blue.svg)](https://discord.gg/xSTPEqm) -[![Gitter Chat](https://img.shields.io/badge/chat-gitter-blue.svg)](https://gitter.im/dart-code/Dart-Code) -[![Follow on Twitter](https://img.shields.io/badge/twitter-dartcode-blue.svg)](https://twitter.com/DartCode) -[![Contribute to Dart Code](https://img.shields.io/badge/help-contribute-551A8B.svg)](https://github.com/Dart-Code/Dart-Code/blob/master/CONTRIBUTING.md) -# This extension is a fork from [Dart-Code](https://github.com/Dart-Code/Dart-Code) for github1s. - -# At present only languages features is reserved - -## Introduction - -Dart Code extends [VS Code](https://code.visualstudio.com/) with support for the -[Dart](https://www.dartlang.org/) programming language, and provides tools for -effectively editing, refactoring, running, and reloading [Flutter](https://flutter.dev/) -mobile apps, and [AngularDart](https://angulardart.org) web apps. - - -## Installation - -Dart Code can be [installed from the Visual Studio Code Marketplace](https://marketplace.visualstudio.com/items?itemName=Dart-Code.dart-code) or by [searching within VS Code](https://code.visualstudio.com/docs/editor/extension-gallery#_search-for-an-extension). - - -## Features - -- Edit and Debug Flutter mobile apps (launch using `F5` or the `Debug` menu) -- Edit and Debug Dart command line apps (launch using `F5` or the `Debug` menu) -- [Automatic hot reloads for Flutter](https://dartcode.org/docs/settings/#dartflutterhotreloadonsave) -- [Refactorings and Code fixes (lightbulb)](https://dartcode.org/docs/refactorings-and-code-fixes/) -- [Quickly switch between devices for Flutter](https://dartcode.org/docs/quickly-switching-between-flutter-devices/) -- [Flutter Doctor command](https://dartcode.org/docs/commands/#flutter-run-flutter-doctor) -- [Flutter Get Packages command](https://dartcode.org/docs/commands/#flutter-get-packages) -- [Flutter Upgrade Packages command](https://dartcode.org/docs/commands/#flutter-upgrade-packages) -- [Automatically gets packages when `pubspec.yaml` is saved](https://dartcode.org/docs/settings/#dartrunpubgetonpubspecchanges) -- [Automatically finds SDKs from `PATH`](https://dartcode.org/docs/configuring-path-and-environment-variables/) -- [Notification of new stable Dart SDK releases](https://dartcode.org/docs/settings/#dartcheckforsdkupdates) -- [Sort Members command](https://dartcode.org/docs/commands/#dart-sort-members) -- Support for debugging "just my code" or SDK/libraries too ([`dart.debugSdkLibraries`](https://dartcode.org/docs/settings/#dartdebugsdklibraries) and [`dart.debugExternalLibraries`](https://dartcode.org/docs/settings/#dartdebugexternallibraries)) -- [Prompts to get packages when out of date](https://dartcode.org/docs/settings/#dartprompttogetpackages) -- Syntax highlighting -- Code completion -- Snippets -- Realtime errors/warnings/TODOs -- Documentation in hovers/tooltips -- Go to Definition -- Find References -- Rename refactoring -- Format document -- Support for format-on-save (`editor.formatOnSave`) -- Support for format-on-type (`editor.formatOnType`) -- Workspace symbol search -- Document symbol search -- [Organize Imports command](https://dartcode.org/docs/commands/#dart-organize-imports) -- [Pub Get Packages command](https://dartcode.org/docs/commands/#pub-get-packages) -- [Pub Upgrade Packages command](https://dartcode.org/docs/commands/#pub-upgrade-packages) -- [Type Hierarchy](https://dartcode.org/docs/commands/#dart-show-type-hierarchy) - - -## Extension Settings - -A full list of settings is [available here](https://dartcode.org/docs/settings/). - - -## Frequently Asked Questions - -A list of frequently asked questions is [available here](https://dartcode.org/faq/). - - -## Key Bindings - -A list of useful key bindings is [available here](https://dartcode.org/docs/key-bindings/). - - -## Refactorings and Code Fixes - -A full list of supported refactors is [available here](https://dartcode.org/docs/refactorings-and-code-fixes/). - - -## Analytics - -This extension reports some analytics such as: - -- Extension load and analysis times -- Whether you have disabled some settings (such as showing TODOs in Problems Window or Closing Labels) -- Frequency of use of features like Hot Reload, Hot Restart and Open Observatory -- Crashes in the Dart analysis server -- Platform and Dart/Flutter SDK versions - -Reporting can be disabled via the [`dart.allowAnalytics` setting](https://dartcode.org/docs/settings/#dartallowanalytics). - - -## Release Notes - -For full release notes, see [the changelog](https://dartcode.org/releases/). diff --git a/extensions/dart-web/media/dart.png b/extensions/dart-web/media/dart.png deleted file mode 100755 index d091c28f0..000000000 Binary files a/extensions/dart-web/media/dart.png and /dev/null differ diff --git a/extensions/dart-web/package.json b/extensions/dart-web/package.json deleted file mode 100644 index 38ab4388f..000000000 --- a/extensions/dart-web/package.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "name": "dart-code", - "displayName": "Dart", - "description": "Dart language support and debugger for Visual Studio Code.", - "version": "3.20.0-dev", - "publisher": "Dart-Code", - "engines": { - "vscode": "^1.52.0" - }, - "license": "SEE LICENSE IN LICENSE", - "bugs": { - "url": "https://github.com/Dart-Code/Dart-Code/issues" - }, - "homepage": "https://dartcode.org/", - "repository": { - "type": "git", - "url": "https://github.com/Dart-Code/Dart-Code.git" - }, - "categories": [ - "Programming Languages", - "Snippets", - "Linters", - "Formatters", - "Debuggers" - ], - "keywords": [ - "dart", - "flutter", - "fuchsia", - "multi-root ready" - ], - "icon": "media/dart.png", - "activationEvents": [ - "onLanguage:dart" - ], - "contributes": { - "languages": [ - { - "id": "dart", - "extensions": [ - ".dart" - ], - "aliases": [ - "Dart" - ], - "configuration": "./syntaxes/dart-language-configuration.json" - } - ], - "grammars": [ - { - "language": "dart", - "scopeName": "source.dart", - "path": "./syntaxes/dart.json" - } - ], - "colors": [ - { - "id": "dart.closingLabels", - "description": "The color of the 'closing label' annotations shown against constructor, method invocations and lists that span multiple lines. If not supplied, the color for 'tab.inactiveForeground' will be used.", - "defaults": { - "dark": "tab.inactiveForeground", - "light": "tab.inactiveForeground", - "highContrast": "tab.inactiveForeground" - } - } - ], - "semanticTokenScopes": [ - { - "language": "dart", - "scopes": { - "keyword": [ - "keyword" - ], - "keyword.control": [ - "keyword.control" - ], - "property.declaration": [ - "entity.name.function.member" - ] - } - } - ], - "configurationDefaults": { - "[dart]": { - "editor.tabSize": 2, - "editor.insertSpaces": true, - "editor.detectIndentation": false, - "editor.suggest.insertMode": "replace" - } - } - }, - "scripts": { - "compile": "echo done", - "watch": "echo done" - } -} diff --git a/extensions/dart-web/snippets/dart.json b/extensions/dart-web/snippets/dart.json deleted file mode 100644 index d7924be49..000000000 --- a/extensions/dart-web/snippets/dart.json +++ /dev/null @@ -1,131 +0,0 @@ -{ - ".source.dart": { - "main": { - "prefix": "main", - "description": "Insert a main function, used as an entry point.", - "body": [ - "main(List args) {", - " $0", - "}" - ] - }, - "try": { - "prefix": "try", - "description": "Insert a try/catch block.", - "body": [ - "try {", - " $0", - "} catch (${1:e}) {", - "}" - ] - }, - "if": { - "prefix": "if", - "description": "Insert an if statement.", - "body": [ - "if ($1) {", - " $0", - "}" - ] - }, - "if else": { - "prefix": "ife", - "description": "Insert an if statement with an else block.", - "body": [ - "if ($1) {", - " $0", - "} else {", - "}" - ] - }, - "switch case": { - "prefix": "switch", - "description": "Insert a switch statement.", - "body": [ - "switch ($1) {", - " case $2:", - " $0", - " break;", - " default:", - "}" - ] - }, - "for": { - "prefix": "for", - "description": "Insert a for loop.", - "body": [ - "for (var i = 0; i < ${1:count}; i++) {", - " $0", - "}" - ] - }, - "for in": { - "prefix": "fori", - "description": "Insert a for-in loop.", - "body": [ - "for (var ${1:item} in ${2:items}) {", - " $0", - "}" - ] - }, - "while": { - "prefix": "while", - "description": "Insert a while loop.", - "body": [ - "while ($1) {", - " $0", - "}" - ] - }, - "do while": { - "prefix": "do", - "description": "Insert a do-while loop.", - "body": [ - "do {", - " $0", - "} while ($1);" - ] - }, - "fun": { - "prefix": "fun", - "description": "Insert a function definition.", - "body": [ - "${3:void} ${1:name}(${2:args}) {", - " $0", - "}" - ] - }, - "class": { - "prefix": "class", - "description": "Insert a class definition.", - "body": [ - "class ${1:Name} {", - " $0", - "}" - ] - }, - "typedef": { - "prefix": "typedef", - "description": "Insert a typedef.", - "body": "typedef ${1:Type} ${2:Name}(${3:params});" - }, - "test": { - "prefix": "test", - "description": "Insert a test block.", - "body": [ - "test('$1', () {", - " $0", - "});" - ] - }, - "group": { - "prefix": "group", - "description": "Insert a test group block.", - "body": [ - "group('$1', () {", - " $0", - "});" - ] - } - } -} diff --git a/extensions/dart-web/snippets/flutter.json b/extensions/dart-web/snippets/flutter.json deleted file mode 100644 index 5ed07f973..000000000 --- a/extensions/dart-web/snippets/flutter.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - ".source.dart": { - "Flutter stateless widget": { - "prefix": "stless", - "description": "Insert a StatelessWidget", - "body": [ - "class $1 extends StatelessWidget {", - " @override", - " Widget build(BuildContext context) {", - " return Container(", - " $2", - " );", - " }", - "}" - ] - }, - "Flutter stateful widget": { - "prefix": "stful", - "description": "Insert a StatefulWidget", - "body": [ - "class $1 extends StatefulWidget {", - " @override", - " _$1State createState() => _$1State();", - "}", - "", - "class _$1State extends State<$1> {", - " @override", - " Widget build(BuildContext context) {", - " return Container(", - " $2", - " );", - " }", - "}" - ] - }, - "Flutter widget with AnimationController": { - "prefix": "stanim", - "description": "Insert a StatefulWidget with an AnimationController", - "body": [ - "class $1 extends StatefulWidget {", - " @override", - " _$1State createState() => _$1State();", - "}", - "", - "class _$1State extends State<$1>", - " with SingleTickerProviderStateMixin {", - " AnimationController _controller;", - "", - " @override", - " void initState() {", - " super.initState();", - " _controller = AnimationController(vsync: this);", - " }", - "", - " @override", - " void dispose() {", - " super.dispose();", - " _controller.dispose();", - " }", - "", - " @override", - " Widget build(BuildContext context) {", - " return Container(", - " $2", - " );", - " }", - "}" - ] - } - } -} diff --git a/extensions/dart-web/syntaxes/dart-language-configuration.json b/extensions/dart-web/syntaxes/dart-language-configuration.json deleted file mode 100644 index fbead1c38..000000000 --- a/extensions/dart-web/syntaxes/dart-language-configuration.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "comments": { - "lineComment": "//", - "blockComment": [ "/*", "*/" ] - }, - "brackets": [ - ["{", "}"], - ["[", "]"], - ["(", ")"] - ], - "autoClosingPairs": [ - { "open": "{", "close": "}" }, - { "open": "[", "close": "]" }, - { "open": "(", "close": ")" }, - { "open": "'", "close": "'", "notIn": ["string", "comment"] }, - { "open": "\"", "close": "\"", "notIn": ["string"] }, - { "open": "`", "close": "`", "notIn": ["string", "comment"] }, - { "open": "/**", "close": " */", "notIn": ["string"] } - ], - "surroundingPairs": [ - ["{", "}"], - ["[", "]"], - ["(", ")"], - ["<", ">"], - ["'", "'"], - ["\"", "\""], - ["`", "`"] - ] -} \ No newline at end of file diff --git a/extensions/dart-web/syntaxes/dart.json b/extensions/dart-web/syntaxes/dart.json deleted file mode 100644 index b15067e14..000000000 --- a/extensions/dart-web/syntaxes/dart.json +++ /dev/null @@ -1,438 +0,0 @@ -{ - "fileTypes": [ - "dart" - ], - "foldingStartMarker": "\\{\\s*$", - "foldingStopMarker": "^\\s*\\}", - "name": "Dart", - "patterns": [ - { - "match": "^(#!.*)$", - "name": "meta.preprocessor.script.dart" - }, - { - "begin": "^\\w*\\b(library|import|part of|part|export)\\b", - "beginCaptures": { - "0": { - "name": "keyword.other.import.dart" - } - }, - "end": ";", - "endCaptures": { - "0": { - "name": "punctuation.terminator.dart" - } - }, - "name": "meta.declaration.dart", - "patterns": [ - { - "include": "#strings" - }, - { - "include": "#comments" - }, - { - "match": "\\b(as|show|hide)\\b", - "name": "keyword.other.import.dart" - } - ] - }, - { - "include": "#comments" - }, - { - "include": "#punctuation" - }, - { - "include": "#annotations" - }, - { - "include": "#keywords" - }, - { - "include": "#constants-and-special-vars" - }, - { - "include": "#strings" - } - ], - "repository": { - "dartdoc": { - "patterns": [ - { - "match": "(\\[.*?\\])", - "captures": { - "0": { - "name": "variable.name.source.dart" - } - } - }, - { - "match": "^ {4,}(?![ \\*]).*", - "captures": { - "0": { - "name": "variable.name.source.dart" - } - } - }, - { - "begin": "```.*?$", - "end": "```", - "contentName": "variable.other.source.dart" - }, - { - "match": "(`.*?`)", - "captures": { - "0": { - "name": "variable.other.source.dart" - } - } - }, - { - "match": "(`.*?`)", - "captures": { - "0": { - "name": "variable.other.source.dart" - } - } - }, - { - "match": "(\\* (( ).*))$", - "captures": { - "2": { - "name": "variable.other.source.dart" - } - } - }, - { - "match": "(\\* .*)$" - } - ] - }, - "comments": { - "patterns": [ - { - "captures": { - "0": { - "name": "punctuation.definition.comment.dart" - } - }, - "match": "/\\*\\*/", - "name": "comment.block.empty.dart" - }, - { - "include": "#comments-doc-oldschool" - }, - { - "include": "#comments-doc" - }, - { - "include": "#comments-inline" - } - ] - }, - "comments-doc-oldschool": { - "patterns": [ - { - "begin": "/\\*\\*", - "end": "\\*/", - "name": "comment.block.documentation.dart", - "patterns": [ - { - "include": "#comments-doc-oldschool" - }, - { - "include": "#comments-block" - }, - { - "include": "#dartdoc" - } - ] - } - ] - }, - "comments-doc": { - "patterns": [ - { - "begin": "///", - "while": "^\\s*///", - "patterns": [ - { - "include": "#dartdoc" - } - ], - "name": "comment.block.documentation.dart" - } - ] - }, - "comments-inline": { - "patterns": [ - { - "include": "#comments-block" - }, - { - "captures": { - "1": { - "name": "comment.line.double-slash.dart" - } - }, - "match": "((//).*)$" - } - ] - }, - "comments-block": { - "patterns": [ - { - "begin": "/\\*", - "end": "\\*/", - "name": "comment.block.dart", - "patterns": [ - { - "include": "#comments-block" - } - ] - } - ] - }, - "annotations": { - "patterns": [ - { - "match": "@[a-zA-Z]+", - "name": "storage.type.annotation.dart" - } - ] - }, - "constants-and-special-vars": { - "patterns": [ - { - "match": "(?)", - "captures": { - "1": { - "name": "entity.name.function.dart" - } - } - } - ] - }, - "keywords": { - "patterns": [ - { - "match": "(?>>?|~|\\^|\\||&)", - "name": "keyword.operator.bitwise.dart" - }, - { - "match": "((&|\\^|\\||<<|>>>?)=)", - "name": "keyword.operator.assignment.bitwise.dart" - }, - { - "match": "(=>)", - "name": "keyword.operator.closure.dart" - }, - { - "match": "(==|!=|<=?|>=?)", - "name": "keyword.operator.comparison.dart" - }, - { - "match": "(([+*/%-]|\\~)=)", - "name": "keyword.operator.assignment.arithmetic.dart" - }, - { - "match": "(=)", - "name": "keyword.operator.assignment.dart" - }, - { - "match": "(\\-\\-|\\+\\+)", - "name": "keyword.operator.increment-decrement.dart" - }, - { - "match": "(\\-|\\+|\\*|\\/|\\~\\/|%)", - "name": "keyword.operator.arithmetic.dart" - }, - { - "match": "(!|&&|\\|\\|)", - "name": "keyword.operator.logical.dart" - }, - { - "match": "(?)", + "name": "keyword.operator.arrow.elm" + }, + { + "include": "#infix_op" + }, + { + "match": "(\\=|\\:|\\||\\\\)", + "name": "keyword.other.elm" + }, + { + "match": "\\b(type|as|port|exposing|alias|infixl|infixr|infix)\\s+", + "name": "keyword.other.elm" + }, + { + "match": "\\b(if|then|else|case|of|let|in)\\s+", + "name": "keyword.control.elm" + }, + { + "include": "#record-accessor" + }, + { + "include": "#top_level_value" + }, + { + "include": "#value" + }, + { + "include": "#period" + }, + { + "include": "#square_brackets" + } + ], + "repository": { + "comma": { + "match": "(,)", + "name": "punctuation.separator.comma.elm" + }, + "parens": { + "match": "(\\(|\\))", + "name": "punctuation.parens.elm" + }, + "block_comment": { + "applyEndPatternLast": 1, + "begin": "\\{-(?!#)", + "captures": { + "0": { + "name": "punctuation.definition.comment.elm" + } + }, + "end": "-\\}", + "name": "comment.block.elm", + "patterns": [ + { + "include": "#block_comment" + } + ] + }, + "comments": { + "patterns": [ + { + "captures": { + "1": { + "name": "punctuation.definition.comment.elm" + } + }, + "begin": "--", + "end": "$", + "name": "comment.line.double-dash.elm" + }, + { + "include": "#block_comment" + } + ] + }, + "import": { + "name": "meta.import.elm", + "begin": "^\\b(import)\\s+", + "beginCaptures": { + "1": { + "name": "keyword.control.import.elm" + } + }, + "end": "\\n(?!\\s)", + "patterns": [ + { + "match": "(as|exposing)", + "name": "keyword.control.elm" + }, + { + "include": "#module_chunk" + }, + { + "include": "#period" + }, + { + "match": "\\s+", + "name": "punctuation.spaces.elm" + }, + { + "include": "#module-exports" + } + ] + }, + "module": { + "begin": "^\\b((port |effect )?module)\\s+", + "beginCaptures": { + "1": { + "name": "keyword.other.elm" + } + }, + "end": "\\n(?!\\s)", + "endCaptures": { + "1": { + "name": "keyword.other.elm" + } + }, + "name": "meta.declaration.module.elm", + "patterns": [ + { + "include": "#module_chunk" + }, + { + "include": "#period" + }, + { + "match": "(exposing)", + "name": "keyword.other.elm" + }, + { + "match": "\\s+", + "name": "punctuation.spaces.elm" + }, + { + "include": "#module-exports" + } + ] + }, + "string-triple": { + "name": "string.quoted.triple.elm", + "begin": "\"\"\"", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.elm" + } + }, + "end": "\"\"\"", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.elm" + } + }, + "patterns": [ + { + "match": "\\\\(NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE|DC1|DC2|DC3|DC4|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS|US|SP|DEL|[abfnrtv\\\\\\\"'\\&]|x[0-9a-fA-F]{1,5})", + "name": "constant.character.escape.elm" + }, + { + "match": "\\^[A-Z@\\[\\]\\\\\\^_]", + "name": "constant.character.escape.control.elm" + } + ] + }, + "string-quote": { + "name": "string.quoted.double.elm", + "begin": "\"", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.elm" + } + }, + "end": "\"", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.elm" + } + }, + "patterns": [ + { + "match": "\\\\(NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE|DC1|DC2|DC3|DC4|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS|US|SP|DEL|[abfnrtv\\\\\\\"'\\&]|x[0-9a-fA-F]{1,5})", + "name": "constant.character.escape.elm" + }, + { + "match": "\\^[A-Z@\\[\\]\\\\\\^_]", + "name": "constant.character.escape.control.elm" + } + ] + }, + "char": { + "name": "string.quoted.single.elm", + "begin": "'", + "beginCaptures": { + "0": { + "name": "punctuation.definition.char.begin.elm" + } + }, + "end": "'", + "endCaptures": { + "0": { + "name": "punctuation.definition.char.end.elm" + } + }, + "patterns": [ + { + "match": "\\\\(NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE|DC1|DC2|DC3|DC4|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS|US|SP|DEL|[abfnrtv\\\\\\\"'\\&]|x[0-9a-fA-F]{1,5})", + "name": "constant.character.escape.elm" + }, + { + "match": "\\^[A-Z@\\[\\]\\\\\\^_]", + "name": "constant.character.escape.control.elm" + } + ] + }, + "debug": { + "match": "\\b(Debug)\\b", + "name": "invalid.illegal.debug.elm" + }, + "module-exports": { + "begin": "(\\()", + "beginCaptures": { + "1": { + "name": "punctuation.parens.module-export.elm" + } + }, + "end": "(\\))", + "endCaptures": { + "1": { + "name": "punctuation.parens.module-export.elm" + } + }, + "name": "meta.declaration.exports.elm", + "patterns": [ + { + "match": "\\b[a-z][a-zA-Z_'0-9]*", + "name": "entity.name.function.elm" + }, + { + "match": "\\b[A-Z][A-Za-z_'0-9]*", + "name": "storage.type.elm" + }, + { + "match": ",", + "name": "punctuation.separator.comma.elm" + }, + { + "match": "\\s+", + "name": "punctuation.spaces.elm" + }, + { + "include": "#comma" + }, + { + "match": "\\(\\.\\.\\)", + "name": "punctuation.parens.ellipses.elm" + }, + { + "match": "\\.\\.", + "name": "punctuation.parens.ellipses.elm" + }, + { + "include": "#infix_op" + }, + { + "comment": "So named because I don't know what to call this.", + "match": "\\(.*?\\)", + "name": "meta.other.unknown.elm" + } + ] + }, + "module_chunk": { + "match": "[A-Z][a-zA-Z0-9_]*", + "name": "support.module.elm" + }, + "period": { + "match": "[.]", + "name": "keyword.other.period.elm" + }, + "square_brackets": { + "match": "[\\[\\]]", + "name": "punctuation.definition.list.elm" + }, + "record-prefix": { + "match": "([a-z][a-zA-Z0-9_]*)(\\.)([a-z][a-zA-Z0-9_]*)", + "name": "record.accessor.elm", + "captures": { + "1": { + "name": "record.name.elm" + }, + "2": { + "name": "keyword.other.period.elm" + }, + "3": { + "name": "entity.name.record.field.accessor.elm" + } + } + }, + "module-prefix": { + "match": "([A-Z][a-zA-Z0-9_]*)(\\.)", + "name": "meta.module.name.elm", + "captures": { + "1": { + "name": "support.module.elm" + }, + "2": { + "name": "keyword.other.period.elm" + } + } + }, + "constructor": { + "match": "\\b[A-Z][a-zA-Z0-9_]*\\b", + "name": "constant.type-constructor.elm" + }, + "value": { + "match": "\\b[a-z][a-zA-Z0-9_]*\\b", + "name": "meta.value.elm" + }, + "unit": { + "match": "\\(\\)", + "name": "constant.unit.elm" + }, + "top_level_value": { + "match": "^[a-z][a-zA-Z0-9_]*\\b", + "name": "entity.name.function.top_level.elm" + }, + "record-accessor": { + "match": "(\\.)([a-z][a-zA-Z0-9_]*)", + "name": "meta.record.accessor", + "captures": { + "1": { + "name": "keyword.other.period.elm" + }, + "2": { + "name": "entity.name.record.field.accessor.elm" + } + } + }, + "infix_op": { + "match": "(|<\\?>|<\\||<=|\\|\\||&&|>=|\\|>|\\|=|\\|\\.|\\+\\+|::|/=|==|//|>>|<<|<|>|\\^|\\+|-|/|\\*)", + "name": "keyword.operator.elm" + }, + "type-declaration": { + "begin": "^(type\\s+)([A-Z][a-zA-Z0-9_']*)\\s+", + "beginCaptures": { + "1": { + "name": "keyword.type.elm" + }, + "2": { + "name": "storage.type.elm" + } + }, + "end": "^(?=\\S)", + "name": "meta.function.type-declaration.elm", + "patterns": [ + { + "name": "meta.record.field.elm", + "match": "^\\s*([A-Z][a-zA-Z0-9_]*)\\b", + "captures": { + "1": { + "name": "constant.type-constructor.elm" + } + } + }, + { + "match": "\\s+", + "name": "punctuation.spaces.elm" + }, + { + "name": "meta.record.field.elm", + "match": "(\\=|\\|)\\s+([A-Z][a-zA-Z0-9_]*)\\b", + "captures": { + "1": { + "name": "keyword.operator.assignment.elm" + }, + "2": { + "name": "constant.type-constructor.elm" + } + } + }, + { + "match": "\\=", + "name": "keyword.operator.assignment.elm" + }, + { + "match": "\\-\\>", + "name": "keyword.operator.arrow.elm" + }, + { + "include": "#module-prefix" + }, + { + "match": "\\b[a-z][a-zA-Z0-9_]*\\b", + "name": "variable.type.elm" + }, + { + "match": "\\b[A-Z][a-zA-Z0-9_]*\\b", + "name": "storage.type.elm" + }, + { + "include": "#comments" + }, + { + "include": "#type-record" + } + ] + }, + "type-alias-declaration": { + "begin": "^(type\\s+)(alias\\s+)([A-Z][a-zA-Z0-9_']*)\\s+", + "beginCaptures": { + "1": { + "name": "keyword.type.elm" + }, + "2": { + "name": "keyword.type-alias.elm" + }, + "3": { + "name": "storage.type.elm" + } + }, + "end": "^(?=\\S)", + "name": "meta.function.type-declaration.elm", + "patterns": [ + { + "match": "\\n\\s+", + "name": "punctuation.spaces.elm" + }, + { + "match": "\\=", + "name": "keyword.operator.assignment.elm" + }, + { + "include": "#module-prefix" + }, + { + "match": "\\b[A-Z][a-zA-Z0-9_]*\\b", + "name": "storage.type.elm" + }, + { + "match": "\\b[a-z][a-zA-Z0-9_]*\\b", + "name": "variable.type.elm" + }, + { + "include": "#comments" + }, + { + "include": "#type-record" + } + ] + }, + "type-record": { + "begin": "(\\{)", + "beginCaptures": { + "1": { + "name": "punctuation.section.braces.begin" + } + }, + "end": "(\\})", + "endCaptures": { + "1": { + "name": "punctuation.section.braces.end" + } + }, + "name": "meta.function.type-record.elm", + "patterns": [ + { + "match": "\\s+", + "name": "punctuation.spaces.elm" + }, + { + "match": "->", + "name": "keyword.operator.arrow.elm" + }, + { + "name": "meta.record.field.elm", + "match": "([a-z][a-zA-Z0-9_]*)\\s+(\\:)", + "captures": { + "1": { + "name": "entity.name.record.field.elm" + }, + "2": { + "name": "keyword.other.elm" + } + } + }, + { + "match": "\\,", + "name": "punctuation.separator.comma.elm" + }, + { + "include": "#module-prefix" + }, + { + "match": "\\b[a-z][a-zA-Z0-9_]*\\b", + "name": "variable.type.elm" + }, + { + "match": "\\b[A-Z][a-zA-Z0-9_]*\\b", + "name": "storage.type.elm" + }, + { + "include": "#comments" + }, + { + "include": "#type-record" + } + ] + }, + "type-signature": { + "begin": "^(port\\s+)?([a-z_][a-zA-Z0-9_']*)\\s+(\\:)", + "beginCaptures": { + "1": { + "name": "keyword.other.port.elm" + }, + "2": { + "name": "entity.name.function.elm" + }, + "3": { + "name": "keyword.other.colon.elm" + } + }, + "end": "((^(?=[a-z]))|^$)", + "name": "meta.function.type-declaration.elm", + "patterns": [ + { + "include": "#type-signature-chunk" + } + ] + }, + "type-signature-chunk": { + "patterns": [ + { + "match": "->", + "name": "keyword.operator.arrow.elm" + }, + { + "match": "\\s+", + "name": "punctuation.spaces.elm" + }, + { + "include": "#module-prefix" + }, + { + "match": "\\b[a-z][a-zA-Z0-9_]*\\b", + "name": "variable.type.elm" + }, + { + "match": "\\b[A-Z][a-zA-Z0-9_]*\\b", + "name": "storage.type.elm" + }, + { + "match": "\\(\\)", + "name": "constant.unit.elm" + }, + { + "include": "#comma" + }, + { + "include": "#parens" + }, + { + "include": "#comments" + }, + { + "include": "#type-record" + } + ] + }, + "glsl": { + "begin": "(\\[)(glsl)(\\|)", + "beginCaptures": { + "1": { + "name": "entity.glsl.bracket.elm" + }, + "2": { + "name": "entity.glsl.name.elm" + }, + "3": { + "name": "entity.glsl.bracket.elm" + } + }, + "end": "(\\|\\])", + "endCaptures": { + "1": { + "name": "entity.glsl.bracket.elm" + } + }, + "name": "meta.embedded.block.glsl", + "patterns": [ + { + "include": "source.glsl" + } + ] + } + } +} diff --git a/extensions/github1s/assets/icons/dark/close-blame.svg b/extensions/github1s/assets/icons/dark/close-blame.svg new file mode 100644 index 000000000..b7dc9c026 --- /dev/null +++ b/extensions/github1s/assets/icons/dark/close-blame.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/extensions/github1s/assets/icons/dark/open-blame.svg b/extensions/github1s/assets/icons/dark/open-blame.svg new file mode 100644 index 000000000..4f3790514 --- /dev/null +++ b/extensions/github1s/assets/icons/dark/open-blame.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/extensions/github1s/assets/icons/dark/open-left-file.svg b/extensions/github1s/assets/icons/dark/open-left-file.svg new file mode 100644 index 000000000..025250f20 --- /dev/null +++ b/extensions/github1s/assets/icons/dark/open-left-file.svg @@ -0,0 +1,6 @@ + + + + L + + \ No newline at end of file diff --git a/extensions/github1s/assets/icons/dark/open-right-file.svg b/extensions/github1s/assets/icons/dark/open-right-file.svg new file mode 100644 index 000000000..7c520271d --- /dev/null +++ b/extensions/github1s/assets/icons/dark/open-right-file.svg @@ -0,0 +1,6 @@ + + + + R + + \ No newline at end of file diff --git a/extensions/github1s/assets/icons/light/close-blame.svg b/extensions/github1s/assets/icons/light/close-blame.svg new file mode 100644 index 000000000..b7dc9c026 --- /dev/null +++ b/extensions/github1s/assets/icons/light/close-blame.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/extensions/github1s/assets/icons/light/open-blame.svg b/extensions/github1s/assets/icons/light/open-blame.svg new file mode 100644 index 000000000..00300397b --- /dev/null +++ b/extensions/github1s/assets/icons/light/open-blame.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/extensions/github1s/assets/icons/light/open-left-file.svg b/extensions/github1s/assets/icons/light/open-left-file.svg new file mode 100644 index 000000000..3b22627ce --- /dev/null +++ b/extensions/github1s/assets/icons/light/open-left-file.svg @@ -0,0 +1,6 @@ + + + + L + + \ No newline at end of file diff --git a/extensions/github1s/assets/icons/light/open-right-file.svg b/extensions/github1s/assets/icons/light/open-right-file.svg new file mode 100644 index 000000000..65aa6a53f --- /dev/null +++ b/extensions/github1s/assets/icons/light/open-right-file.svg @@ -0,0 +1,6 @@ + + + + R + + \ No newline at end of file diff --git a/extensions/github1s/assets/pages/assets/github.svg b/extensions/github1s/assets/pages/assets/github.svg new file mode 100644 index 000000000..db1ebe1be --- /dev/null +++ b/extensions/github1s/assets/pages/assets/github.svg @@ -0,0 +1,4 @@ + + diff --git a/extensions/github1s/assets/pages/assets/gitlab.svg b/extensions/github1s/assets/pages/assets/gitlab.svg new file mode 100644 index 000000000..8cca7d76f --- /dev/null +++ b/extensions/github1s/assets/pages/assets/gitlab.svg @@ -0,0 +1,7 @@ + + diff --git a/extensions/github1s/assets/pages/components.css b/extensions/github1s/assets/pages/components.css new file mode 100644 index 000000000..4932fc33d --- /dev/null +++ b/extensions/github1s/assets/pages/components.css @@ -0,0 +1,202 @@ +.vscode-button { + border: none; + display: inline-block; + padding: 0 10px; + height: 26px; + line-height: 26px; + font-size: 14px; + outline: 1px solid transparent; + outline-offset: 2px !important; + color: var(--vscode-button-foreground); + background: var(--vscode-button-background); + cursor: pointer; +} + +.vscode-button.loading { + opacity: .5; +} + +.vscode-button.size-mini { + padding: 0 8px; + height: 22px; + line-height: 22px; + font-size: 12px; +} + +.vscode-button.size-middle { + padding: 0 12px; + height: 30px; + line-height: 30px; + font-size: 14px; +} + +.vscode-button.size-large { + padding: 0 14px; + height: 34px; + line-height: 34px; + font-size: 18px; +} + +.vscode-button:not([disabled]):hover { + background: var(--vscode-button-hoverBackground); +} + +.vscode-button:not([disabled]):focus { + outline-color: var(--vscode-focusBorder); +} + +.vscode-input { + border: none; + display: inline-block; + padding: 0 4px; + height: 26px; + line-height: 26px; + font-size: 13px; + outline: 1px solid transparent; + font-family: var(--vscode-font-family); + color: var(--vscode-input-foreground); + border: 1px solid var(--vscode-input-border, var(--vscode-widget-border)); + background-color: var(--vscode-input-background); +} + +.vscode-input.size-mini { + padding: 0 2px; + height: 22px; + line-height: 22px; + font-size: 12px; +} + +.vscode-input.size-middle { + padding: 0 4px; + height: 30px; + line-height: 30px; + font-size: 13px; +} + +.vscode-input.size-large { + padding: 0 6px; + height: 34px; + line-height: 34px; + font-size: 18px; +} + +.vscode-input:not([disabled]):focus { + outline-color: var(--vscode-focusBorder); + outline: 1px solid -webkit-focus-ring-color; + outline-offset: -1px; +} + +.vscode-textarea { + border: none; + display: inline-block; + outline: 1px solid transparent; + font-family: var(--vscode-font-family); + color: var(--vscode-input-foreground); + border: 1px solid var(--vscode-input-background); + background-color: var(--vscode-input-background); +} + +.vscode-textarea:not([disabled]):focus { + outline-color: var(--vscode-focusBorder); + outline: 1px solid -webkit-focus-ring-color; + outline-offset: -1px; +} + +.vscode-loading { + width: 100%; + text-align: center; + height: 26px; +} + +.vscode-loading.align-left { + text-align: left; +} + +.vscode-loading.align-right { + text-align: right; +} + +.vscode-loading > span { + height: 100%; + width: 5px; + display: inline-block; + margin-right: 4px; + background: var(--vscode-button-background); + animation: vscodeLoading 1.2s infinite ease-in-out; +} + +.vscode-loading > span:nth-child(2) { + animation-delay: -1s; +} + +.vscode-loading > span:nth-child(3) { + animation-delay: -0.9s; +} + +.vscode-loading > span:nth-child(4) { + animation-delay: -0.8s; +} + +.vscode-loading > span:nth-child(5) { + animation-delay: -0.7s; +} + +.vscode-loading > span:nth-child(6) { + animation-delay: -0.6s; +} + +.vscode-loading > span:nth-child(7) { + animation-delay: -0.5s; +} + +.vscode-loading > span:nth-child(8) { + animation-delay: -0.4s; +} + +.vscode-loading > span:nth-child(9) { + animation-delay: -0.3s; +} + +.vscode-loading > span:last-child { + margin-right: 0 !important; +} + +@keyframes vscodeLoading { + 0% { + transform: scaleY(0.4); + } + 25% { + transform: scaleY(1); + } + 50% { + transform: scaleY(0.4); + } + 75% { + transform: scaleY(0.4); + } + 100% { + transform: scaleY(0.4); + } +} + +.vscode-link { + cursor: pointer; + color: var(--vscode-textLink-foreground); + text-decoration: underline; +} + +.vscode-link:hover { + color: var(--vscode-textLink-activeForeground); +} + +.success-text { + color: #89d185; +} + +.warning-text { + color: #cca700; +} + +.error-text { + color: #f48771; +} diff --git a/extensions/github1s/assets/pages/components.js b/extensions/github1s/assets/pages/components.js new file mode 100644 index 000000000..ad73142b2 --- /dev/null +++ b/extensions/github1s/assets/pages/components.js @@ -0,0 +1,74 @@ +import { h } from './libraries/preact.module.js'; +import htm from './libraries/htm.module.js'; + +export const html = htm.bind(h); + +export const VscodeButton = ({ size, loading, ...props }) => { + const sizeClass = `size-${size || 'small'}`; + const loadingClass = loading ? 'loading' : ''; + const classes = `vscode-button ${sizeClass} ${loadingClass}`; + + return html`