Skip Typescript compilation on packaging

This commit is contained in:
venashial 2022-06-20 23:50:33 -07:00
parent 252c812125
commit f70f670ed3
31 changed files with 171 additions and 132 deletions

7
.githooks/pre-push Normal file
View File

@ -0,0 +1,7 @@
#!/bin/sh
set -e
pnpm install --frozen-lockfile
pnpm lint
pnpm check

View File

@ -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

View File

@ -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

29
.npmignore Normal file
View File

@ -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

View File

@ -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"
},

View File

@ -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

1
docs/global.d.ts vendored
View File

@ -2,6 +2,7 @@
declare module '$assets/images/*'
declare module '$locales/*'
declare module 'insane'
declare module '*.svg' {
export { SvelteComponentDev as default } from 'svelte/internal'

View File

@ -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(

View File

@ -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 {

View File

@ -12,7 +12,7 @@
<Button color="primary" slot="button"><IconArrowRight /> Continue</Button>
</Modal>
<Modal let:trigger size='sm'>
<Modal let:trigger size="sm">
<Button on:click={trigger} slot="trigger">Confirm modal</Button>
Are you sure you want to delete this gallery image?

View File

@ -3,7 +3,11 @@
import { ModalDeletion, Button } from 'omorphia'
</script>
<ModalDeletion type="account" key="venashial" let:trigger on:deletion={() => console.log('Do something...')}>
<ModalDeletion
type="account"
key="venashial"
let:trigger
on:deletion={() => console.log('Do something...')}>
<Button slot="trigger" color="danger" on:click={trigger}>Delete account</Button>
</ModalDeletion>
```

View File

@ -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')
```

View File

@ -23,13 +23,15 @@ The `markdown` parser is designed for bodies of markdown text and supports image
#### An image \n\
![](https://cdn.modrinth.com/data/YL57xq9U/images/d382106b9a2b943d06107c31c139c77849f1a0e8.png)'
</script>
<div class="card markdown">
{@html markdown(source)}
{@html markdown(
` | Syntax | Description |
` | Syntax | Description |
| ----------- | ----------- |
| Header | Title |
| Paragraph | Text |`)}
| Paragraph | Text |`
)}
{@html markdown('```js\nconsole.log("test")\n```')}
</div>
````

View File

@ -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",

17
pnpm-lock.yaml generated
View File

@ -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

View File

@ -1 +1 @@
module.exports = require('./src/config/postcss.config.cjs')
module.exports = require('./src/config/postcss.cjs')

View File

@ -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'
}
}

View File

@ -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 {

View File

@ -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 {

View File

@ -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

View File

@ -19,8 +19,11 @@
const dispatch = createEventDispatcher()
</script>
<Modal title={$t(`modal.deletion.${type}.title`)} bind:open let:trigger bind:data>
<slot slot="trigger" name="trigger" {trigger} />
<!-- @ts-ignore -->
<Modal title={$t(`modal.deletion.${type}.title`)} bind:open bind:data>
<svelte:fragment slot="trigger" let:trigger>
<slot name="trigger" {trigger} />
</svelte:fragment>
{#if type === 'account' || 'project'}
<div class="important-banner">
@ -35,11 +38,10 @@
{id} />
</Field>
<svelte:fragment slot="button" let:close>
<Button
color="danger"
slot="button"
disabled={key !== data.key}
let:close
on:click={() => {
close()
dispatch('deletion')
@ -47,6 +49,7 @@
<IconTrash />
{$t(`modal.deletion.${type}.action`)}
</Button>
</svelte:fragment>
</Modal>
<style lang="postcss">

View File

@ -1,10 +1,10 @@
<script lang="ts">
import type { SvelteComponent } from 'svelte/internal'
export let placeholder = ''
export let icon: SvelteComponent = undefined
/** A Svelte component */
export let icon: any = undefined
export let value = ''
export let multiline = false
/** An ID for better accessibility */
export let id: string = undefined
export let fill = false
</script>
@ -41,14 +41,14 @@
border: none;
width: 100%;
max-width: 100%;
&.has-icon {
padding-left: 2.5rem;
}
}
input {
padding: 0.25rem 1rem;
&.has-icon {
padding-left: 2.5rem;
}
}
textarea {

1
src/plugins/index.js Normal file
View File

@ -0,0 +1 @@
export { default as Generator } from './generator/index.js'

View File

@ -1,3 +1,3 @@
export function classCombine(names) {
export function classCombine(names: string[]) {
return names.filter((name) => name && !name.includes('undefined')).join(' ')
}

View File

@ -76,8 +76,8 @@ export function formatVersions(versionArray: string[]): string {
return output.join(', ')
}
export const getPrimary = (files) => files.find((file) => file.primary) || files[0]
export const getPrimary = (files: any[]) => files.find((file) => file.primary) || files[0]
export function downloadUrl(file): string {
export function downloadUrl(file: any): string {
return import.meta.env.VITE_API_URL + `version_file/${file?.hashes.sha1}/download`
}

View File

@ -4,7 +4,7 @@ import adapter from '@sveltejs/adapter-static'
import examples from 'mdsvexamples/vite'
import sveld from './docs/plugins/sveld.js'
import path from 'path'
import { preprocess, plugins } from './src/config/svelte.config.js'
import { preprocess, plugins } from './src/config/svelte.js'
import Generator from './src/plugins/generator/index.js'
import precompileIntl from 'svelte-intl-precompile/sveltekit-plugin'

View File

@ -1,9 +1,9 @@
{
"compilerOptions": {
"paths": {
"omorphia/utils": ["package/utils"],
"omorphia/*": ["package/*"],
"omorphia": ["package"],
"omorphia/utils": ["src/utils"],
"omorphia/*": ["src/*"],
"omorphia": ["src"],
"$generated/*": ["generated/*"],
"$lib": ["src"],
"$lib/*": ["src/*"]
@ -11,5 +11,14 @@
"resolveJsonModule": true,
"esModuleInterop": true
},
"include": [
"./docs/**/*.js",
"./docs/**/*.ts",
"./docs/**/*.svelte",
"./src/**/*.js",
"./src/**/*.ts",
"./src/**/*.svelte"
],
"exclude": ["./node_modules/**", "./.svelte-kit/**"],
"extends": "./.svelte-kit/tsconfig.json"
}