Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
fix: styles

Signed-off-by: Innei <[email protected]>

update

Signed-off-by: Innei <[email protected]>

ci: update

Signed-off-by: Innei <[email protected]>

update

Signed-off-by: Innei <[email protected]>

update

Signed-off-by: Innei <[email protected]>

update

Signed-off-by: Innei <[email protected]>

fix

Signed-off-by: Innei <[email protected]>

fix

Signed-off-by: Innei <[email protected]>

update

Signed-off-by: Innei <[email protected]>
  • Loading branch information
Innei committed Sep 27, 2024
0 parents commit 6cdc95c
Show file tree
Hide file tree
Showing 112 changed files with 13,624 additions and 0 deletions.
1 change: 1 addition & 0 deletions .env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_API_URL='https://api.follow.is/v1'
129 changes: 129 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
name: Nightly Release

on:
push:
branches:
- main
schedule:
- cron: '0 22 * * *' # Runs at 10 PM UTC every day

env:
VITE_WEB_URL: ${{ vars.VITE_WEB_URL }}

jobs:
check_changes:
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.check_changes.outputs.should_run }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Check for code changes
id: check_changes
run: |
# 获取当前时间戳和 24 小时前的时间戳
CURRENT_TIMESTAMP=$(date +%s)
TWENTY_FOUR_HOURS_AGO_TIMESTAMP=$((CURRENT_TIMESTAMP - 86400))
echo "Current timestamp: $CURRENT_TIMESTAMP"
echo "24 hours ago timestamp: $TWENTY_FOUR_HOURS_AGO_TIMESTAMP"
echo "Commits in the last 24 hours:"
git log --since="@$TWENTY_FOUR_HOURS_AGO_TIMESTAMP" --format="%h %ct %s"
echo "All changed files in the last 24 hours (including .github):"
git diff --name-only $(git rev-list -n1 --before="@$TWENTY_FOUR_HOURS_AGO_TIMESTAMP" HEAD) HEAD
echo "Changed files excluding .github directory:"
CHANGED_FILES=$(git diff --name-only $(git rev-list -n1 --before="@$TWENTY_FOUR_HOURS_AGO_TIMESTAMP" HEAD) HEAD -- ':!.github')
if [ -z "$CHANGED_FILES" ]; then
echo "should_run=false" >> $GITHUB_OUTPUT
echo "No changes detected outside .github directory in the last 24 hours"
else
echo "should_run=true" >> $GITHUB_OUTPUT
echo "Changes detected outside .github directory in the last 24 hours:"
echo "$CHANGED_FILES"
fi
nightly-release:
needs: check_changes
if: needs.check_changes.outputs.should_run == 'true'
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [macos-latest]

steps:
- name: Check out Git repository
uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: true

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'

- name: Install dependencies
run: pnpm i

- name: Set nightly version
shell: bash
run: |
# Get the current version from package.json
if [ -f package.json ]; then
CURRENT_VERSION=$(node -p "require('./package.json').version")
# Remove any existing prerelease identifier (e.g., -alpha.1)
BASE_VERSION=$(echo $CURRENT_VERSION | sed -E 's/(-[a-zA-Z]+\.[0-9]+)$//')
# Generate the nightly version
NIGHTLY_DATE=$(date +'%Y%m%d')
NIGHTLY_VERSION="${BASE_VERSION}-nightly.${NIGHTLY_DATE}"
echo "NIGHTLY_VERSION=$NIGHTLY_VERSION" >> $GITHUB_ENV
# Update version in package.json
if [[ "$RUNNER_OS" == "Windows" ]]; then
sed -i "s/\"version\": \".*\"/\"version\": \"$NIGHTLY_VERSION\"/" package.json
else
sed -i '' "s/\"version\": \".*\"/\"version\": \"$NIGHTLY_VERSION\"/" package.json
fi
echo "Updated version to $NIGHTLY_VERSION"
else
echo "package.json not found"
exit 1
fi
- name: Build

run: pnpm build

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-nightly
path: |
.output/chrome-mv3
retention-days: 7

- name: Create Nightly Release
uses: softprops/action-gh-release@v2
with:
name: Nightly ${{ env.NIGHTLY_VERSION }}
draft: false
prerelease: true
files: |
.output/chrome-mv3
body: |
This is an automated nightly release for testing purposes.
**Warning:** This build may be unstable and is not recommended for production use.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
.output
stats.html
stats-*.json
.wxt

# Editor directories and files
# .vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

.dev-profile
7 changes: 7 additions & 0 deletions .prettierrc.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default {
semi: false,
singleQuote: false,
printWidth: 100,
tabWidth: 2,
trailingComma: 'all',
}
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["dbaeumer.vscode-eslint"]
}
39 changes: 39 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Main Process",
"type": "node",
"request": "launch",
"cwd": "${workspaceRoot}",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron-vite",
"windows": {
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron-vite.cmd"
},
"runtimeArgs": ["--sourcemap"],
"env": {
"REMOTE_DEBUGGING_PORT": "9222"
}
},
{
"name": "Debug Renderer Process",
"port": 9222,
"request": "attach",
"type": "chrome",
"webRoot": "${workspaceFolder}/src/renderer",
"timeout": 60000,
"presentation": {
"hidden": true
}
}
],
"compounds": [
{
"name": "Debug All",
"configurations": ["Debug Main Process", "Debug Renderer Process"],
"presentation": {
"order": 1
}
}
]
}
67 changes: 67 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"[javascript][javascriptreact][typescript][typescriptreact][json][jsonc]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"tailwindCSS.experimental.classRegex": [
["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"],
["cx\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"],
// ["tw\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"]
["tw`([^`]*)`", "([^`]*)"]
],
// If you do not want to autofix some rules on save
// You can put this in your user settings or workspace settings
"eslint.codeActionsOnSave.rules": [
"!prefer-const",
"!unused-imports/no-unused-imports",
"!@stylistic/jsx-self-closing-comp",
"!tailwindcss/classnames-order",
"!arrow-body-style",
"*"
],
// If you want to silent stylistic rules
// You can put this in your user settings or workspace settings
"eslint.rules.customizations": [
{
"rule": "@stylistic/*",
"severity": "off",
"fixable": true
},
{
"rule": "tailwindcss/classnames-order",
"severity": "off"
},
{
"rule": "antfu/consistent-list-newline",
"severity": "off"
},
{
"rule": "hyoban/jsx-attribute-spacing",
"severity": "off"
},
{
"rule": "simple-import-sort/*",
"severity": "off"
},
{
"rule": "prefer-const",
"severity": "off"
},
{
"rule": "unused-imports/no-unused-imports",
"severity": "off"
}
],
"cSpell.words": ["rsshub", "Русский"],
"editor.foldingImportsByDefault": true,
"commentTranslate.hover.enabled": false,
"typescript.tsdk": "node_modules/typescript/lib",
"i18n-ally.enabledFrameworks": ["i18next"],
"i18n-ally.displayLanguage": "en",
"i18n-ally.localesPaths": ["locales"],
"i18n-ally.namespace": true,
"i18n-ally.pathMatcher": "{namespaces}/{locale}.json"
}
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# WXT + React

This template should help get you started developing with React in WXT.
1 change: 1 addition & 0 deletions assets/react.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions configs/tw-css-plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// https://github.com/tailwindlabs/tailwindcss-intellisense/issues/227#issuecomment-1462034856
// cssAsPlugin.js
const postcss = require("postcss")
const postcssJs = require("postcss-js")
const { readFileSync } = require("node:fs")

require.extensions[".css"] = function (module, filename) {
const cssAsPlugin = ({ addBase, addComponents, addUtilities }) => {
const css = readFileSync(filename, "utf8")
const root = postcss.parse(css)
const jss = postcssJs.objectify(root)

if ("@layer base" in jss) {
addBase(jss["@layer base"])
}
if ("@layer components" in jss) {
addComponents(jss["@layer components"])
}
if ("@layer utilities" in jss) {
addUtilities(jss["@layer utilities"])
}
}
module.exports = cssAsPlugin
}
71 changes: 71 additions & 0 deletions css/tw.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
/* shadcn colors */

:root,
#shadow-html {
--radius: 0.5rem;
--a: theme('colors.theme.accent.DEFAULT');
}

[data-theme='light'] {
--background: 0 0% 100%;
--foreground: 20 14.3% 4.1%;
--card: 0 0% 100%;
--card-foreground: 20 14.3% 4.1%;
--popover: 0 0% 100%;
--popover-foreground: 20 14.3% 4.1%;

--muted: 60 4.8% 95.9%;
--muted-foreground: 25 5.3% 44.7%;

--destructive: 0 84.2% 60.2%;
--destructive-foreground: 60 9.1% 97.8%;
--border: 20 5.9% 90%;
--radius: 0.5rem;
}

[data-theme='dark'] {
--background: 0 0% 7.1%;
--foreground: 60 9.1% 97.8%;
--card: 20 14.3% 4.1%;
--card-foreground: 60 9.1% 97.8%;
--popover: 20 14.3% 4.1%;
--popover-foreground: 60 9.1% 97.8%;

--muted: 12 6.5% 15.1%;
--muted-foreground: 24 5.4% 63.9%;

--destructive: 0 72.2% 50.6%;
--destructive-foreground: 60 9.1% 97.8%;
--border: 0 0% 22.1%;
}
}

@layer base {
* {
@apply border-border;
}
body {
@apply text-theme-foreground;
}
}

.prose {
table * {
font-size: 1rem;
}

table table {
margin: 0;
}

p {
@apply break-words;
}

word-break: break-word;
}
3 changes: 3 additions & 0 deletions entrypoints/background.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default defineBackground(() => {
console.log('Hello background!', { id: browser.runtime.id });
});
Loading

0 comments on commit 6cdc95c

Please sign in to comment.