feat: allow using elk as a nuxt layer (#1665)

This commit is contained in:
Daniel Roe 2023-02-08 01:51:16 -08:00 committed by GitHub
parent a3310b6ea2
commit c25715b26d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 403 additions and 1111 deletions

View file

@ -1,5 +1,5 @@
import { readFile } from 'fs-extra' import { readFile } from 'fs-extra'
import { resolve } from 'pathe' import { createResolver } from '@nuxt/kit'
import type { ManifestOptions } from 'vite-plugin-pwa' import type { ManifestOptions } from 'vite-plugin-pwa'
import { getEnv } from '../../config/env' import { getEnv } from '../../config/env'
import { i18n } from '../../config/i18n' import { i18n } from '../../config/i18n'
@ -170,8 +170,9 @@ export const createI18n = async (): Promise<LocalizedWebManifest> => {
} }
async function readI18nFile(file: string) { async function readI18nFile(file: string) {
const { resolve } = createResolver(import.meta.url)
return JSON.parse(Buffer.from( return JSON.parse(Buffer.from(
await readFile(resolve(`./locales/${file}`), 'utf-8'), await readFile(resolve(`../../locales/${file}`), 'utf-8'),
).toString()) ).toString())
} }

View file

@ -4,8 +4,13 @@ import { check } from 'stale-dep'
export default defineNuxtModule({ export default defineNuxtModule({
meta: { meta: {
name: 'stale-dep', name: 'stale-dep',
configKey: 'staleDep',
}, },
setup() { defaults: {
enabled: true,
},
setup(opts) {
if (opts.enabled)
return check('pnpm') return check('pnpm')
}, },
}) })

View file

@ -1,10 +1,11 @@
{ {
"name": "@elk-zone/elk",
"type": "module", "type": "module",
"version": "0.7.2", "version": "0.7.2",
"private": true,
"packageManager": "pnpm@7.9.0", "packageManager": "pnpm@7.9.0",
"license": "MIT", "license": "MIT",
"homepage": "https://elk.zone/", "homepage": "https://elk.zone/",
"main": "./nuxt.config.ts",
"scripts": { "scripts": {
"build": "nuxi build", "build": "nuxi build",
"dev": "nuxi dev --port 5314", "dev": "nuxi dev --port 5314",
@ -16,19 +17,30 @@
"start:https": "PORT=5314 node ./https-dev-config/local-https-server.mjs", "start:https": "PORT=5314 node ./https-dev-config/local-https-server.mjs",
"lint": "eslint --cache .", "lint": "eslint --cache .",
"typecheck": "stale-dep && nuxi typecheck", "typecheck": "stale-dep && nuxi typecheck",
"prepare": "esno scripts/prepare.ts", "prepare": "ignore-dependency-scripts \"esno scripts/prepare.ts\"",
"generate": "nuxi generate", "generate": "nuxi generate",
"test:unit": "stale-dep && vitest", "test:unit": "stale-dep && vitest",
"test:typecheck": "stale-dep && vue-tsc --noEmit && vue-tsc --noEmit --project service-worker/tsconfig.json", "test:typecheck": "stale-dep && vue-tsc --noEmit && vue-tsc --noEmit --project service-worker/tsconfig.json",
"test": "nr test:unit", "test": "nr test:unit",
"update:team:avatars": "esno scripts/avatars.ts", "update:team:avatars": "esno scripts/avatars.ts",
"postinstall": "stale-dep -u && simple-git-hooks && nuxi prepare", "postinstall": "ignore-dependency-scripts \"stale-dep -u && simple-git-hooks && nuxi prepare\"",
"release": "stale-dep && bumpp && esno scripts/release.ts" "release": "stale-dep && bumpp && esno scripts/release.ts"
}, },
"dependencies": { "dependencies": {
"@emoji-mart/data": "^1.1.2",
"@fnando/sparkline": "^0.3.10", "@fnando/sparkline": "^0.3.10",
"@iconify-emoji/twemoji": "^1.0.2", "@iconify-emoji/twemoji": "^1.0.2",
"@iconify-json/carbon": "^1.1.14",
"@iconify-json/logos": "^1.1.22",
"@iconify-json/material-symbols": "^1.1.26",
"@iconify-json/mdi": "^1.1.44",
"@iconify-json/ph": "^1.1.3",
"@iconify-json/ri": "^1.1.4",
"@iconify-json/twemoji": "^1.1.10",
"@iconify/utils": "^2.0.12", "@iconify/utils": "^2.0.12",
"@nuxtjs/color-mode": "^3.2.0",
"@nuxtjs/i18n": "8.0.0-beta.9",
"@pinia/nuxt": "^0.4.6",
"@tiptap/extension-character-count": "2.0.0-beta.204", "@tiptap/extension-character-count": "2.0.0-beta.204",
"@tiptap/extension-code-block": "2.0.0-beta.204", "@tiptap/extension-code-block": "2.0.0-beta.204",
"@tiptap/extension-history": "2.0.0-beta.204", "@tiptap/extension-history": "2.0.0-beta.204",
@ -39,51 +51,63 @@
"@tiptap/starter-kit": "2.0.0-beta.204", "@tiptap/starter-kit": "2.0.0-beta.204",
"@tiptap/suggestion": "2.0.0-beta.204", "@tiptap/suggestion": "2.0.0-beta.204",
"@tiptap/vue-3": "2.0.0-beta.204", "@tiptap/vue-3": "2.0.0-beta.204",
"@unocss/nuxt": "^0.49.0",
"@vue-macros/nuxt": "^1.0.3",
"@vueuse/core": "^9.11.1", "@vueuse/core": "^9.11.1",
"@vueuse/gesture": "2.0.0-beta.1", "@vueuse/gesture": "2.0.0-beta.1",
"@vueuse/integrations": "^9.11.1", "@vueuse/integrations": "^9.11.1",
"@vueuse/math": "^9.11.1",
"@vueuse/motion": "2.0.0-beta.12", "@vueuse/motion": "2.0.0-beta.12",
"@vueuse/nuxt": "^9.11.1",
"blurhash": "^2.0.4", "blurhash": "^2.0.4",
"browser-fs-access": "^0.31.2", "browser-fs-access": "^0.31.2",
"chroma-js": "^2.4.2",
"emoji-mart": "^5.5.2",
"file-saver": "^2.0.5",
"floating-vue": "2.0.0-beta.20", "floating-vue": "2.0.0-beta.20",
"focus-trap": "^7.2.0", "focus-trap": "^7.2.0",
"form-data": "^4.0.0", "form-data": "^4.0.0",
"fuse.js": "^6.6.2", "fuse.js": "^6.6.2",
"github-reserved-names": "^2.0.4", "github-reserved-names": "^2.0.4",
"idb-keyval": "^6.2.0", "idb-keyval": "^6.2.0",
"ignore-dependency-scripts": "^1.0.1",
"iso-639-1": "^2.1.15", "iso-639-1": "^2.1.15",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"lru-cache": "^7.14.1", "lru-cache": "^7.14.1",
"masto": "^5.6.1", "masto": "^5.6.1",
"nuxt-security": "^0.10.1",
"nuxt-vitest": "^0.6.4",
"page-lifecycle": "^0.1.2", "page-lifecycle": "^0.1.2",
"pinia": "^2.0.29", "pinia": "^2.0.29",
"postcss-nested": "^6.0.0",
"rollup-plugin-node-polyfills": "^0.2.1",
"shiki": "^0.12.1", "shiki": "^0.12.1",
"shiki-es": "^0.2.0", "shiki-es": "^0.2.0",
"simple-git": "^3.16.0",
"slimeform": "^0.9.0", "slimeform": "^0.9.0",
"stale-dep": "^0.3.1",
"std-env": "^3.3.1",
"string-length": "^5.0.1", "string-length": "^5.0.1",
"tauri-plugin-log-api": "github:tauri-apps/tauri-plugin-log", "tauri-plugin-log-api": "github:tauri-apps/tauri-plugin-log",
"tauri-plugin-store-api": "github:tauri-apps/tauri-plugin-store", "tauri-plugin-store-api": "github:tauri-apps/tauri-plugin-store",
"theme-vitesse": "^0.6.0",
"tiny-decode": "^0.1.3", "tiny-decode": "^0.1.3",
"tippy.js": "^6.3.7", "tippy.js": "^6.3.7",
"ufo": "^1.0.1", "ufo": "^1.0.1",
"ultrahtml": "^1.2.0", "ultrahtml": "^1.2.0",
"unimport": "^2.1.0",
"unplugin-auto-import": "^0.13.0",
"unplugin-vue-inspector": "^0.0.2",
"vite-plugin-inspect": "^0.7.14",
"vite-plugin-pwa": "^0.14.1",
"vue-advanced-cropper": "^2.8.8", "vue-advanced-cropper": "^2.8.8",
"vue-virtual-scroller": "2.0.0-beta.7" "vue-virtual-scroller": "2.0.0-beta.7",
"workbox-build": "^6.5.4",
"workbox-window": "^6.5.4"
}, },
"devDependencies": { "devDependencies": {
"@antfu/eslint-config": "^0.34.1", "@antfu/eslint-config": "^0.34.1",
"@antfu/ni": "^0.19.0", "@antfu/ni": "^0.19.0",
"@emoji-mart/data": "^1.1.2",
"@iconify-json/carbon": "^1.1.14",
"@iconify-json/logos": "^1.1.22",
"@iconify-json/material-symbols": "^1.1.26",
"@iconify-json/mdi": "^1.1.44",
"@iconify-json/ph": "^1.1.3",
"@iconify-json/ri": "^1.1.4",
"@iconify-json/twemoji": "^1.1.10",
"@nuxtjs/color-mode": "^3.2.0",
"@nuxtjs/i18n": "8.0.0-beta.9",
"@pinia/nuxt": "^0.4.6",
"@types/chroma-js": "^2.1.4", "@types/chroma-js": "^2.1.4",
"@types/file-saver": "^2.0.5", "@types/file-saver": "^2.0.5",
"@types/fnando__sparkline": "^0.3.4", "@types/fnando__sparkline": "^0.3.4",
@ -91,39 +115,17 @@
"@types/js-yaml": "^4.0.5", "@types/js-yaml": "^4.0.5",
"@types/prettier": "^2.7.2", "@types/prettier": "^2.7.2",
"@types/wicg-file-system-access": "^2020.9.5", "@types/wicg-file-system-access": "^2020.9.5",
"@unocss/nuxt": "^0.49.0",
"@vue-macros/nuxt": "^1.0.3",
"@vueuse/math": "^9.11.1",
"@vueuse/nuxt": "^9.11.1",
"bumpp": "^8.2.1", "bumpp": "^8.2.1",
"chroma-js": "^2.4.2",
"emoji-mart": "^5.5.2",
"eslint": "^8.32.0", "eslint": "^8.32.0",
"esno": "^0.16.3", "esno": "^0.16.3",
"file-saver": "^2.0.5",
"fs-extra": "^11.1.0", "fs-extra": "^11.1.0",
"lint-staged": "^13.1.0", "lint-staged": "^13.1.0",
"nuxt": "3.1.1", "nuxt": "3.1.1",
"nuxt-security": "^0.10.1",
"nuxt-vitest": "^0.6.4",
"postcss-nested": "^6.0.0",
"prettier": "^2.8.3", "prettier": "^2.8.3",
"rollup-plugin-node-polyfills": "^0.2.1",
"simple-git": "^3.16.0",
"simple-git-hooks": "^2.8.1", "simple-git-hooks": "^2.8.1",
"stale-dep": "^0.3.1",
"std-env": "^3.3.1",
"theme-vitesse": "^0.6.0",
"typescript": "^4.9.5", "typescript": "^4.9.5",
"unimport": "^2.1.0",
"unplugin-auto-import": "^0.13.0",
"unplugin-vue-inspector": "^0.0.2",
"vite-plugin-inspect": "^0.7.14",
"vite-plugin-pwa": "^0.14.1",
"vitest": "^0.28.4", "vitest": "^0.28.4",
"vue-tsc": "^1.0.24", "vue-tsc": "^1.0.24"
"workbox-build": "^6.5.4",
"workbox-window": "^6.5.4"
}, },
"pnpm": { "pnpm": {
"overrides": { "overrides": {

File diff suppressed because it is too large Load diff