Add project files.

This commit is contained in:
Bauke 2022-10-05 12:25:58 +02:00
parent 67ac1cd3e7
commit d3d65ea050
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
6 changed files with 7456 additions and 0 deletions

112
.gitignore vendored Normal file
View File

@ -0,0 +1,112 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
# parcel-bundler cache (https://parceljs.org/)
.cache
# Next.js build output
.next
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Browser profile directories
chromium/
firefox/
# Build output directories
build/
web-ext-artifacts/

9
.stylelintrc.json Normal file
View File

@ -0,0 +1,9 @@
{
"extends": [
"stylelint-config-standard-scss"
],
"rules": {
"no-descending-specificity": null,
"string-quotes": "single"
}
}

48
package.json Normal file
View File

@ -0,0 +1,48 @@
{
"name": "re-nav",
"license": "AGPL-3.0-or-later",
"repository": "https://git.bauke.xyz/Holllo/re-nav",
"private": true,
"scripts": {
"start": "vite build -m development --watch",
"start:chromium": "VITE_BROWSER=chromium pnpm start",
"clean": "trash build web-ext-artifacts",
"build": "pnpm clean && pnpm build:chromium && pnpm build:firefox && pnpm zip-source",
"build:chromium": "VITE_BROWSER=chromium vite build && web-ext build -n re-nav-chromium-{version}.zip -s build/chromium",
"build:firefox": "VITE_BROWSER=firefox vite build && web-ext build -n re-nav-firefox-{version}.zip -s build/firefox",
"zip-source": "git archive --format zip --output web-ext-artifacts/re-nav-source.zip HEAD",
"test": "xo && stylelint 'source/**/*.scss' && tsc"
},
"dependencies": {
"@holllo/migration-helper": "^0.1.3",
"@holllo/preact-components": "^0.2.3",
"htm": "^3.1.1",
"modern-normalize": "^1.1.0",
"preact": "^10.11.0",
"webextension-polyfill": "^0.10.0"
},
"devDependencies": {
"@preact/preset-vite": "^2.4.0",
"@types/babel__core": "^7.1.19",
"@types/webextension-polyfill": "^0.9.1",
"postcss": "^8.4.16",
"sass": "^1.55.0",
"stylelint": "^14.13.0",
"stylelint-config-standard-scss": "^5.0.0",
"trash-cli": "^5.0.0",
"typescript": "^4.8.4",
"vite": "^3.1.4",
"vite-plugin-web-extension": "^1.4.4",
"web-ext": "^7.2.0",
"xo": "^0.52.3"
},
"xo": {
"prettier": true,
"rules": {
"@typescript-eslint/consistent-type-definitions": "off",
"@typescript-eslint/consistent-type-imports": "off",
"n/file-extension-in-import": "off"
},
"space": true
}
}

7212
pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load Diff

18
tsconfig.json Normal file
View File

@ -0,0 +1,18 @@
{
"compilerOptions": {
"esModuleInterop": true,
"lib": [
"ESNext"
],
"module": "ESNext",
"moduleResolution": "Node",
"noEmit": true,
"outDir": "build",
"strict": true,
"target": "ESNext"
},
"include": [
"source/**/*.ts",
"vite.config.ts"
]
}

57
vite.config.ts Normal file
View File

@ -0,0 +1,57 @@
import fs from 'node:fs';
import path from 'node:path';
import process from 'node:process';
import url from 'node:url';
import {defineConfig} from 'vite';
// Vite Plugins
import preactPreset from '@preact/preset-vite';
import webExtension from 'vite-plugin-web-extension';
import createManifest from './source/manifest.js';
const targetBrowser = process.env.VITE_BROWSER ?? 'firefox';
process.env.VITE_BROWSER = targetBrowser;
const currentDir = path.dirname(url.fileURLToPath(import.meta.url));
const buildDir = path.join(currentDir, 'build', targetBrowser);
const sourceDir = path.join(currentDir, 'source');
// Create the browser profile if it doesn't already exist.
fs.mkdirSync(path.join(currentDir, targetBrowser), {recursive: true});
const webExtConfig: Record<string, unknown> = {
browserConsole: true,
chromiumProfile: 'chromium/',
firefoxProfile: 'firefox/',
keepProfileChanges: true,
};
if (targetBrowser === 'chromium') {
webExtConfig.startUrl = 'chrome://extensions/';
webExtConfig.target = 'chromium';
} else {
webExtConfig.startUrl = 'about:debugging#/runtime/this-firefox';
webExtConfig.target = 'firefox-desktop';
}
export default defineConfig({
build: {
outDir: buildDir,
minify: false,
sourcemap: 'inline',
},
plugins: [
preactPreset(),
// See vite-plugin-web-extension for documentation.
// https://github.com/aklinker1/vite-plugin-web-extension
webExtension({
assets: 'assets',
browser: targetBrowser,
manifest: () => createManifest(targetBrowser),
webExtConfig,
}),
],
root: sourceDir,
});