Fix packaging to correctly handle utils/

This commit is contained in:
venashial 2022-06-24 20:36:16 -07:00
parent e245edc843
commit 81c039d645
11 changed files with 66 additions and 36 deletions

View File

@ -48,13 +48,11 @@ jobs:
with:
message: 'Bump package version [skip ci]'
default_author: github_actions
- name: Remove svelte.config.js # prevents `svelte-kit sync` from running
run: rm svelte.config.js
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Package
run: pnpm package
- name: Publish
run: pnpm publish --no-git-checks --tag alpha
run: pnpm publish package --no-git-checks --tag alpha
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

View File

@ -1,6 +1,9 @@
{
"prettier.endOfLine": "lf",
"cSpell.words": ["unplugin"],
"cSpell.words": [
"undici",
"unplugin"
],
"gitlens.showWelcomeOnInstall": false,
"gitlens.showWhatsNewAfterUpgrades": false,
"gitlens.plusFeatures.enabled": false,

View File

@ -5,7 +5,7 @@
"scripts": {
"dev": "svelte-kit dev",
"build": "svelte-kit build",
"package": "sed -i 's|\\./|\\./src/|g' src/index.ts && cp src/index.ts index.js && cp src/index.ts index.d.ts",
"package": "svelte-kit package",
"preview": "svelte-kit preview",
"prepare": "svelte-kit sync",
"check": "svelte-check --tsconfig ./tsconfig.json",
@ -30,17 +30,10 @@
"url": "https://github.com/modrinth/omorphia/issues"
},
"homepage": "https://omorphia.modrinth.com",
"exports": {
".": "./index.js",
"./utils": "./src/utils/index.ts",
"./styles.postcss": "./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/cli-progress": "^3.11.0",
"@types/marked": "^4.0.3",
"@typescript-eslint/eslint-plugin": "^5.10.1",
"@typescript-eslint/parser": "^5.10.1",

20
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/cli-progress': ^3.11.0
'@types/marked': ^4.0.3
'@typescript-eslint/eslint-plugin': ^5.10.1
'@typescript-eslint/parser': ^5.10.1
@ -85,7 +86,8 @@ dependencies:
devDependencies:
'@sveltejs/adapter-static': 1.0.0-next.29
'@sveltejs/kit': 1.0.0-next.350_svelte@3.48.0
'@sveltejs/kit': 1.0.0-next.354_svelte@3.48.0
'@types/cli-progress': 3.11.0
'@types/marked': 4.0.3
'@typescript-eslint/eslint-plugin': 5.14.0_4p27j37cxves4nxlnqogdhp4ta
'@typescript-eslint/parser': 5.14.0_e6rt7vlgxfprtuallp2t3cvyi4
@ -1076,14 +1078,14 @@ packages:
tiny-glob: 0.2.9
dev: true
/@sveltejs/kit/1.0.0-next.350_svelte@3.48.0:
resolution: {integrity: sha512-qkZNjp7yIj6t91+wMhmMtGJH0Lb89OaKdVXUDy92CS5/4OHRTKcQPdfOKs4no/upkS3RiFb+rEpOkYqTMcPUXg==}
/@sveltejs/kit/1.0.0-next.354_svelte@3.48.0:
resolution: {integrity: sha512-dTfFT0c3sxztFpiw6H4bQnPd+PtHgEZG6j6ssT9sWLONfzUgWRX0S7H/WoPEjr7u65o2HNazoj8jmEq3ZTwb9g==}
engines: {node: '>=16.7'}
hasBin: true
peerDependencies:
svelte: ^3.44.0
dependencies:
'@sveltejs/vite-plugin-svelte': 1.0.0-next.47_svelte@3.48.0+vite@2.9.10
'@sveltejs/vite-plugin-svelte': 1.0.0-next.49_svelte@3.48.0+vite@2.9.10
chokidar: 3.5.3
sade: 1.8.1
svelte: 3.48.0
@ -1096,8 +1098,8 @@ packages:
- supports-color
dev: true
/@sveltejs/vite-plugin-svelte/1.0.0-next.47_svelte@3.48.0+vite@2.9.10:
resolution: {integrity: sha512-J6n8UN51aq/TEZGQ89/EtdXTtca3cRcTJGzi6fi+xK8LkgsHQLCZhRj+PJ+swktRSWTX9IOmQS55SqVg6bz5fA==}
/@sveltejs/vite-plugin-svelte/1.0.0-next.49_svelte@3.48.0+vite@2.9.10:
resolution: {integrity: sha512-AKh0Ka8EDgidnxWUs8Hh2iZLZovkETkefO99XxZ4sW4WGJ7VFeBx5kH/NIIGlaNHLcrIvK3CK0HkZwC3Cici0A==}
engines: {node: ^14.13.1 || >= 16}
peerDependencies:
diff-match-patch: ^1.0.5
@ -1131,6 +1133,12 @@ packages:
engines: {node: '>=10.13.0'}
dev: false
/@types/cli-progress/3.11.0:
resolution: {integrity: sha512-XhXhBv1R/q2ahF3BM7qT5HLzJNlIL0wbcGyZVjqOTqAybAnsLisd7gy1UCyIqpL+5Iv6XhlSyzjLCnI2sIdbCg==}
dependencies:
'@types/node': 17.0.21
dev: true
/@types/estree/0.0.39:
resolution: {integrity: sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==}
dev: true

View File

@ -1,6 +1,7 @@
<script lang="ts">
import IconTrash from 'virtual:icons/heroicons-outline/trash'
import IconUpload from 'virtual:icons/heroicons-outline/upload'
import IconPhotograph from 'virtual:icons/heroicons-outline/photograph'
import IconFile from 'virtual:icons/lucide/file'
import { t } from 'svelte-intl-precompile'
import Button from './Button.svelte'
@ -52,7 +53,11 @@
{#each files as file (file.name)}
<div class="file">
<div class="file__tab">
{#if file.type.startsWith('image/')}
<IconPhotograph />
{:else}
<IconFile />
{/if}
<div class="file__tab__name"><b>{file.name}</b></div>
<Button
color="tertiary"
@ -61,7 +66,12 @@
}}><IconTrash /> Remove</Button>
</div>
{#if file.type.startsWith('image/')}
<img class="file__preview" src={URL.createObjectURL(file)} alt="Uploaded file preview" />
<div class="file__preview">
<img
class="file__preview__image"
src={URL.createObjectURL(file)}
alt="Uploaded file preview" />
</div>
{/if}
</div>
{/each}
@ -91,9 +101,9 @@
}
.file {
box-shadow: var(--shadow-inset);
border-radius: var(--rounded);
background-color: var(--color-button-bg);
box-shadow: var(--shadow-raised-sm), var(--shadow-inset);
&__tab {
display: flex;
@ -101,6 +111,12 @@
padding: 0.75rem 1rem;
gap: 1rem;
:global(.icon) {
/* Uses `px` to make icons slightly larger */
min-width: 18px;
height: 18px;
}
&__name {
text-overflow: ellipsis;
overflow: hidden;
@ -112,6 +128,17 @@
&__preview {
width: 100%;
border-radius: var(--rounded-bottom);
overflow: hidden;
display: flex;
justify-content: center;
background-color: black;
&__image {
height: auto;
max-height: 22rem;
width: 100%;
object-fit: contain;
}
}
}
}

View File

@ -1,10 +0,0 @@
export default function Generator(options: PluginOptions): {
name: string
buildStart(): Promise<void>
}
export interface PluginOptions {
projectColors: boolean
landingPage: boolean
gameVersions: boolean
tags: boolean
}

View File

@ -12,6 +12,21 @@ const API_URL =
// Time to live: 7 days
const TTL = 7 * 24 * 60 * 60 * 1000
/**
* @typedef {Object} PluginResult
* @property {string} name
* @property {() => Promise<void>} buildStart
*/
/**
* Generate JSON data from the backend
* @param {Object} options Plugin options
* @param {boolean} options.projectColors
* @param {boolean} options.landingPage
* @param {boolean} options.gameVersions
* @param {boolean} options.tags
* @returns {PluginResult}
*/
export default function Generator(options) {
return {
name: 'rollup-plugin-omorphia-generator',

View File

@ -1 +0,0 @@
export declare function gameVersions(API_URL: string): Promise<void>

View File

@ -1 +0,0 @@
export declare function landingPage(API_URL: string): Promise<void>

View File

@ -1 +0,0 @@
export declare function projectColors(API_URL: string): Promise<void>

View File

@ -1 +0,0 @@
export declare function tags(API_URL: string): Promise<void>