diff --git a/.githooks/pre-push b/.githooks/pre-push new file mode 100644 index 000000000..98b445160 --- /dev/null +++ b/.githooks/pre-push @@ -0,0 +1,7 @@ +#!/bin/sh + +set -e + +pnpm install --frozen-lockfile +pnpm lint +pnpm check \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7d1c6e253..fc3b55524 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,3 +24,21 @@ jobs: run: pnpm lint - name: Run check run: pnpm check + + release: + needs: [lint] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Publish + if: github.ref == 'refs/heads/main' + run: | + cd package + pnpm publish --no-git-checks --tag alpha + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - uses: EndBug/add-and-commit@v9 + if: github.ref == 'refs/heads/main' + with: + message: "Bump package version [skip ci]" + default_author: github_actions diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index da725609c..000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Release -on: - push: - branches: - - 'main' - -jobs: - release: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - - uses: pnpm/action-setup@v2.1.0 - with: - version: 6.32.0 - - - name: Setup Node - uses: actions/setup-node@v2 - with: - node-version: '18' - registry-url: 'https://registry.npmjs.org' - - - name: Cache pnpm modules - uses: actions/cache@v2 - with: - path: ~/.pnpm-store - key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}- - - - name: Install dependencies - run: pnpm install - - - name: Package - run: | - pnpm version patch --commit-hooks false --git-tag-version false - pnpm package - - - name: Publish - run: | - cd package - pnpm publish --no-git-checks --tag alpha - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - - uses: EndBug/add-and-commit@v9 - with: - message: 'Bump package version [skip ci]' - default_author: github_actions diff --git a/.npmignore b/.npmignore new file mode 100644 index 000000000..4e42a7a13 --- /dev/null +++ b/.npmignore @@ -0,0 +1,29 @@ +.DS_Store +node_modules/ +build/ +.svelte-kit/ +package/ +.env +.env.* +!.env.example +.vercel +generated/ +.githooks/ +.github/ +.idea/ +.vscode/ +docs/ +generated/ +locales/ +.eslintrc.cjs +.gitignore +.gitmodules +.npmignore +.npmrc +.prettierignore +.prettierrc +postcss.config.cjs +mdsvex.config.js +svelte.config.js +tsconfig.json +pnpm-lock.yaml \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index c4fec248f..5535f40f2 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -11,6 +11,7 @@ "gitlens.hovers.enabled": false, "svelte.enable-ts-plugin": true, "svelte.ask-to-enable-ts-plugin": false, + "svelte.plugin.svelte.useNewTransformation": true, "yaml.schemas": { "https://json.schemastore.org/github-workflow.json": "file:///Users/sha/Code/Modrinth/knossos/.github/workflows/deploy.yml" }, diff --git a/docs/components/Header.svelte b/docs/components/Header.svelte index eb3f98ab3..e41517efb 100644 --- a/docs/components/Header.svelte +++ b/docs/components/Header.svelte @@ -4,7 +4,7 @@ import IconChat from 'virtual:icons/heroicons-outline/chat-alt-2' import { onMount } from 'svelte' - let headerElement + let headerElement: HTMLElement onMount(() => { let lastScrollTop: number diff --git a/docs/global.d.ts b/docs/global.d.ts index a405b494c..8fbf9ed62 100644 --- a/docs/global.d.ts +++ b/docs/global.d.ts @@ -2,6 +2,7 @@ declare module '$assets/images/*' declare module '$locales/*' +declare module 'insane' declare module '*.svg' { export { SvelteComponentDev as default } from 'svelte/internal' diff --git a/docs/layout/page.svelte b/docs/layout/page.svelte index 81a5c776f..b66117f6f 100644 --- a/docs/layout/page.svelte +++ b/docs/layout/page.svelte @@ -16,7 +16,7 @@ $page.url.pathname.replace('/', '') || 'index' }.md` - let api + let api = { props: [], events: [], slots: [] } if ($page.url.pathname.includes('components')) { if (import.meta.env.DEV) { import(`../../src/components/${title}.svelte?raw&sveld`).then( diff --git a/docs/plugins/sveld.js b/docs/plugins/sveld.js index 1e9d17e3d..b88f124c5 100644 --- a/docs/plugins/sveld.js +++ b/docs/plugins/sveld.js @@ -2,7 +2,7 @@ import { ComponentParser } from 'sveld' import * as svelte from 'svelte/compiler' import fs from 'fs/promises' import path from 'path' -import { preprocess } from '../../src/config/svelte.config.js' +import { preprocess } from '../../src/config/svelte.js' export default function sveld() { return { diff --git a/docs/routes/classes/Link.md b/docs/routes/classes/Link.md index 14fa7da67..e94688d77 100644 --- a/docs/routes/classes/Link.md +++ b/docs/routes/classes/Link.md @@ -18,7 +18,7 @@ Issues Source Wiki - Discord chat + Discord chat Source link ``` diff --git a/docs/routes/components/FileUpload.md b/docs/routes/components/FileUpload.md index 99f0a5d04..1ff410357 100644 --- a/docs/routes/components/FileUpload.md +++ b/docs/routes/components/FileUpload.md @@ -4,11 +4,11 @@ - + File name: {file?.name} @@ -20,11 +20,11 @@ File name: {file?.name} - + Count: {files.length} diff --git a/docs/routes/components/Modal.md b/docs/routes/components/Modal.md index a8cbb2469..555063c97 100644 --- a/docs/routes/components/Modal.md +++ b/docs/routes/components/Modal.md @@ -2,7 +2,7 @@ @@ -12,7 +12,7 @@ Continue - + Confirm modal Are you sure you want to delete this gallery image? diff --git a/docs/routes/components/ModalDeletion.md b/docs/routes/components/ModalDeletion.md index 38f317314..9b397ad33 100644 --- a/docs/routes/components/ModalDeletion.md +++ b/docs/routes/components/ModalDeletion.md @@ -3,7 +3,11 @@ import { ModalDeletion, Button } from 'omorphia' - console.log('Do something...')}> + console.log('Do something...')}> Delete account ``` diff --git a/docs/routes/getting-started/configure.md b/docs/routes/getting-started/configure.md index adc9009d5..ba8b1c232 100644 --- a/docs/routes/getting-started/configure.md +++ b/docs/routes/getting-started/configure.md @@ -9,7 +9,7 @@ To make use of the built-in icons, styles, and plugins in omorphia, you will nee Add the following parts to your `svelte.config.js` file: ```js -import { preprocess, plugins } from 'omorphia/config/svelte.config' +import { preprocess, plugins } from 'omorphia/config/svelte.js' /** @type {import('@sveltejs/kit').Config} */ const config = { @@ -32,5 +32,5 @@ Create a `postcss.config.cjs` file in the root of your project. Add the following line to that file: ```js -module.exports = require('omorphia/config/postcss.config.cjs') +module.exports = require('omorphia/config/postcss.cjs') ``` diff --git a/docs/routes/getting-started/utils.md b/docs/routes/getting-started/utils.md index f313f1da8..b0f021b41 100644 --- a/docs/routes/getting-started/utils.md +++ b/docs/routes/getting-started/utils.md @@ -23,14 +23,16 @@ The `markdown` parser is designed for bodies of markdown text and supports image #### An image \n\ ' + {@html markdown(source)} - {@html markdown( -` | Syntax | Description | + {@html markdown( + ` | Syntax | Description | | ----------- | ----------- | | Header | Title | - | Paragraph | Text |`)} - {@html markdown('```js\nconsole.log("test")\n```')} + | Paragraph | Text |` + )} + {@html markdown('```js\nconsole.log("test")\n```')} ```` diff --git a/package.json b/package.json index c29448973..3ce075f95 100644 --- a/package.json +++ b/package.json @@ -14,28 +14,6 @@ "lint": "prettier --ignore-path .prettierignore --check --plugin-search-dir=. . && eslint --ignore-path .prettierignore .", "format": "prettier --ignore-path .prettierignore --write --plugin-search-dir=. ." }, - "devDependencies": { - "@sveltejs/adapter-static": "^1.0.0-next.29", - "@sveltejs/kit": "next", - "@typescript-eslint/eslint-plugin": "^5.10.1", - "@typescript-eslint/parser": "^5.10.1", - "eslint": "^7.32.0", - "eslint-config-prettier": "^8.3.0", - "eslint-plugin-svelte3": "^3.2.1", - "mdsvex": "^0.10.5", - "mdsvexamples": "^0.3.0", - "nodemon": "^2.0.15", - "prettier": "^2.6.2", - "prettier-plugin-svelte": "^2.7.0", - "sveld": "^0.13.4", - "svelte": "^3.48.0", - "svelte-check": "^2.2.6", - "svelte-intl-precompile": "^0.11.1", - "svelte-preprocess": "^4.10.1", - "svelte2tsx": "^0.5.5", - "tslib": "^2.3.1", - "typescript": "~4.6.2" - }, "type": "module", "svelte": "index.js", "repository": { @@ -53,6 +31,37 @@ "url": "https://github.com/modrinth/omorphia/issues" }, "homepage": "https://omorphia.modrinth.com", + "exports": { + ".": "./src/index", + "./utils": "./src//utils/index.ts", + "./styles": "./src/styles.postcss", + "./plugins": "./src/plugins/index.js", + "./config/postcss": "./src/config/postcss.cjs", + "./config/svelte": "./src/config/svelte.js" + }, + "devDependencies": { + "@sveltejs/adapter-static": "^1.0.0-next.29", + "@sveltejs/kit": "next", + "@types/marked": "^4.0.3", + "@typescript-eslint/eslint-plugin": "^5.10.1", + "@typescript-eslint/parser": "^5.10.1", + "eslint": "^7.32.0", + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-svelte3": "^3.2.1", + "mdsvex": "^0.10.5", + "mdsvexamples": "^0.3.0", + "nodemon": "^2.0.15", + "prettier": "^2.6.2", + "prettier-plugin-svelte": "^2.7.0", + "sveld": "^0.13.4", + "svelte": "^3.48.0", + "svelte-check": "^2.7.2", + "svelte-intl-precompile": "^0.11.1", + "svelte-preprocess": "^4.10.1", + "svelte2tsx": "^0.5.5", + "tslib": "^2.3.1", + "typescript": "~4.6.2" + }, "dependencies": { "@iconify-json/carbon": "^1.1.1", "@iconify-json/fa-regular": "^1.1.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c4c6f44af..646d2a017 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -10,6 +10,7 @@ specifiers: '@poppanator/sveltekit-svg': ^0.3.1 '@sveltejs/adapter-static': ^1.0.0-next.29 '@sveltejs/kit': next + '@types/marked': ^4.0.3 '@typescript-eslint/eslint-plugin': ^5.10.1 '@typescript-eslint/parser': ^5.10.1 cli-progress: ^3.11.1 @@ -39,7 +40,7 @@ specifiers: sanitize.css: ^13.0.0 sveld: ^0.13.4 svelte: ^3.48.0 - svelte-check: ^2.2.6 + svelte-check: ^2.7.2 svelte-intl-precompile: ^0.11.1 svelte-preprocess: ^4.10.1 svelte-tiny-virtual-list: ^2.0.1 @@ -85,6 +86,7 @@ dependencies: devDependencies: '@sveltejs/adapter-static': 1.0.0-next.29 '@sveltejs/kit': 1.0.0-next.350_svelte@3.48.0 + '@types/marked': 4.0.3 '@typescript-eslint/eslint-plugin': 5.14.0_4p27j37cxves4nxlnqogdhp4ta '@typescript-eslint/parser': 5.14.0_e6rt7vlgxfprtuallp2t3cvyi4 eslint: 7.32.0 @@ -97,7 +99,7 @@ devDependencies: prettier-plugin-svelte: 2.7.0_kkjbqzpydplecjtkxrgomroeru sveld: 0.13.4_jw3wiphoy34i6ad2hx6ga3jifa svelte: 3.48.0 - svelte-check: 2.4.5_2pvebpkgu3ohgo43qaf5qmcxwm + svelte-check: 2.7.2_2pvebpkgu3ohgo43qaf5qmcxwm svelte-intl-precompile: 0.11.1_svelte@3.48.0 svelte-preprocess: 4.10.4_44qe5g6fi6uxvss56imdgyaaty svelte2tsx: 0.5.5_c64miirrcucob5yjzfkddrmila @@ -1143,6 +1145,10 @@ packages: '@types/node': 17.0.21 dev: true + /@types/marked/4.0.3: + resolution: {integrity: sha512-HnMWQkLJEf/PnxZIfbm0yGJRRZYYMhb++O9M36UCTA9z53uPvVoSlAwJr3XOpDEryb7Hwl1qAx/MV6YIW1RXxg==} + dev: true + /@types/node/16.9.1: resolution: {integrity: sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQj/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7g==} dev: false @@ -4866,19 +4872,18 @@ packages: - sugarss dev: true - /svelte-check/2.4.5_2pvebpkgu3ohgo43qaf5qmcxwm: - resolution: {integrity: sha512-nRft8BbG2wcxyCdHDZ7X43xLcvDzua3xLwq6wzHGcAF3ka3Jyhv2rvgq0+SF9NwHLMefp9C2XkM6etzsxK/cMQ==} + /svelte-check/2.7.2_2pvebpkgu3ohgo43qaf5qmcxwm: + resolution: {integrity: sha512-TuVX4YtXHbRM8sVuK5Jk+mKWdm3f0d6hvAC6qCTp8yUszGZewpEBCo2V5fRWZCiz+0J4OCiDHOS+DFMxv39rJA==} hasBin: true peerDependencies: svelte: ^3.24.0 dependencies: + '@jridgewell/trace-mapping': 0.3.13 chokidar: 3.5.3 fast-glob: 3.2.11 import-fresh: 3.3.0 - minimist: 1.2.5 picocolors: 1.0.0 sade: 1.8.1 - source-map: 0.7.3 svelte: 3.48.0 svelte-preprocess: 4.10.4_44qe5g6fi6uxvss56imdgyaaty typescript: 4.6.2 diff --git a/postcss.config.cjs b/postcss.config.cjs index 4e19d1cc7..b25b99033 100644 --- a/postcss.config.cjs +++ b/postcss.config.cjs @@ -1 +1 @@ -module.exports = require('./src/config/postcss.config.cjs') +module.exports = require('./src/config/postcss.cjs') diff --git a/src/components/Avatar.svelte b/src/components/Avatar.svelte index f907b7ea7..e4040d006 100644 --- a/src/components/Avatar.svelte +++ b/src/components/Avatar.svelte @@ -18,13 +18,13 @@ floatUp && 'avatar--float-up', ]) - let img + let img: HTMLImageElement onMount(() => { if (img && img.naturalWidth) { const isPixelated = () => { if (img.naturalWidth < 96 && img.naturalWidth > 0) { - img.style = 'image-rendering: pixelated;' + img.style.imageRendering = 'pixelated' } } diff --git a/src/components/CheckboxList.svelte b/src/components/CheckboxList.svelte index e632e6d12..622359067 100644 --- a/src/components/CheckboxList.svelte +++ b/src/components/CheckboxList.svelte @@ -8,8 +8,8 @@ /** Wrap the options horizontally */ export let wrap = false - const handleChange = (e, key) => { - if (e.target.checked) { + const handleChange = (event: any, key: string | number) => { + if (event.target.checked) { if (!value) value = [] value = [key, ...value] } else { diff --git a/src/components/CheckboxVirtualList.svelte b/src/components/CheckboxVirtualList.svelte index ecc723782..46d1df662 100644 --- a/src/components/CheckboxVirtualList.svelte +++ b/src/components/CheckboxVirtualList.svelte @@ -11,8 +11,8 @@ export let value = [] export let options: Option[] = [] - const handleChange = (e, key) => { - if (e.target.checked) { + const handleChange = (event: any, key: string | number) => { + if (event.target.checked) { if (!value) value = [] value = [key, ...value] } else { diff --git a/src/components/FileUpload.svelte b/src/components/FileUpload.svelte index 8dd7f5629..d45ee3f3a 100644 --- a/src/components/FileUpload.svelte +++ b/src/components/FileUpload.svelte @@ -3,8 +3,8 @@ import IconUpload from 'virtual:icons/heroicons-outline/upload' import IconFile from 'virtual:icons/lucide/file' import { t } from 'svelte-intl-precompile' - import Button from 'omorphia/components/Button.svelte' - import { classCombine } from 'omorphia/utils/classCombine' + import Button from './Button.svelte' + import { classCombine } from '../utils/classCombine' export let multiple = false export let accept: string diff --git a/src/components/ModalDeletion.svelte b/src/components/ModalDeletion.svelte index f7a4714b0..0929c180b 100644 --- a/src/components/ModalDeletion.svelte +++ b/src/components/ModalDeletion.svelte @@ -19,8 +19,11 @@ const dispatch = createEventDispatcher() - - + + + + + {#if type === 'account' || 'project'} @@ -35,18 +38,18 @@ {id} /> - { - close() - dispatch('deletion') - }}> - - {$t(`modal.deletion.${type}.action`)} - + + { + close() + dispatch('deletion') + }}> + + {$t(`modal.deletion.${type}.action`)} + +