Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use external icons instead generating own #73

Open
wants to merge 7 commits into
base: 1.19.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 4 additions & 86 deletions .github/workflows/release-web.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy Website
name: Release Website
on:
workflow_dispatch:

Expand All @@ -7,107 +7,25 @@ env:
GITHUB_REPO: ${{ github.repository }}

jobs:
datagen:
runs-on: windows-2022
permissions:
contents: read
packages: read

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16

- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('web/**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: pnpm install --frozen-lockfile --strict-peer-dependencies
working-directory: web
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/cache@v3
name: Setup resources cache
with:
path: web/packages/datagen/resources/*.jar
key: ${{ runner.os }}-resources-${{ hashFiles('web/packages/datagen/sources.json') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- uses: actions/cache@v3
name: Setup icons cache
with:
path: web/apps/next/public/icons
key: ${{ runner.os }}-icons-${{ hashFiles('web/packages/datagen/resources/*.jar') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Generate Data
run: pnpm gen
working-directory: web
env:
VANILLA_DATA: ${{ secrets.VANILLA_DATA }}
FORGE_DATA: ${{ secrets.FORGE_DATA }}
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_DOWNLOAD_TOKEN }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}

- name: Upload generated data as artifact
uses: actions/upload-artifact@v3
with:
retention-days: 1
name: generated-data
path: |
web/apps/next/public/icons
web/apps/next/data
web/apps/next/lang

docker:
runs-on: ubuntu-latest
needs: datagen
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Download generated data from artifact
uses: actions/download-artifact@v3
with:
name: generated-data
path: web/apps/next
uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.GITHUB_REPO }}

Expand Down
38 changes: 12 additions & 26 deletions .github/workflows/test-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,26 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16

- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 8
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
version: "9.6.0"
run_install: |
- recursive: true
args: [--frozen-lockfile, --strict-peer-dependencies]
cwd: web

- uses: actions/cache@v3
name: Setup pnpm cache
- name: Install Node.js
uses: actions/setup-node@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('web/**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: pnpm install --frozen-lockfile --strict-peer-dependencies
working-directory: web
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
node-version: 18
cache: pnpm
cache-dependency-path: web/pnpm-lock.yaml

- name: Test & Lint
run: pnpm test
Expand Down
6 changes: 2 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ val xmlutil_version: String by extra

plugins {
idea
id("com.possible-triangle.gradle") version ("0.1.0")
id("com.possible-triangle.gradle") version ("0.1.5")
}

withKotlin()
Expand Down Expand Up @@ -49,9 +49,7 @@ subprojects {
}

enablePublishing {
repositories {
githubPackages(this@subprojects)
}
githubPackages()
}

tasks.withType<Jar> {
Expand Down
5 changes: 1 addition & 4 deletions web/.npmrc
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
auto-install-peers = true

@pssbletrngle:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
auto-install-peers = true
81 changes: 0 additions & 81 deletions web/apps/next/Dockerfile.full

This file was deleted.

27 changes: 15 additions & 12 deletions web/apps/next/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,24 @@ const analyze = require("@next/bundle-analyzer");
const mcVersion = "1.19";
const basePath = "/" + mcVersion;

/** @type {import('next').NextConfig} */
const config = {
reactStrictMode: true,
output: "standalone",
experimental: {
outputFileTracingRoot: path.join(__dirname, "../../"),
},
basePath,
publicRuntimeConfig: { basePath, mc_version: mcVersion },
compiler: {
styledComponents: true,
},
};

module.exports = withPlugins(
[
transpile(["ui", "schema"]),
analyze({ enabled: process.env.ANALYZE === "true" }),
],
{
reactStrictMode: true,
output: "standalone",
experimental: {
outputFileTracingRoot: path.join(__dirname, "../../"),
},
basePath,
publicRuntimeConfig: { basePath, mc_version: mcVersion },
compiler: {
styledComponents: true,
},
}
config
);
18 changes: 15 additions & 3 deletions web/apps/next/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ import Head from "next/head";
import NextImage from "next/image";
import NextLink from "next/link";
import { useRouter } from "next/router";
import { Centered } from "ui/components/basic/Text";
import Footer from "ui/components/Footer";
import DefaultImg from "ui/components/Image";
import SourceDisplay, { CIProps } from "ui/components/SourceDisplay";
import { ElementsContext, ElementsProvider } from "ui/context/elements";
import { RouterProvider } from "ui/context/router";
import Global from "ui/styles/global";
import "ui/styles/reset.css";
import ThemeProvider from "ui/styles/theme";
import dark from "ui/styles/theme/dark";
import { Centered } from "ui/components/basic/Text";
import SourceDisplay, { CIProps } from "ui/components/SourceDisplay";

const { publicRuntimeConfig } = getConfig();

Expand All @@ -22,7 +23,18 @@ const createLink: ElementsContext["createLink"] = (href, link) => (
</NextLink>
);

const createImg: ElementsContext["createImg"] = ({ size, src, ...props }) => {
const createImg: ElementsContext["createImg"] = ({
size,
src,
objectFit,
...props
}) => {
if (src.startsWith("https://")) {
return (
<DefaultImg {...props} $size={size} $objectFit={objectFit} src={src} />
);
}

const realSrc = src.startsWith("/")
? publicRuntimeConfig.basePath + src
: src;
Expand Down
6 changes: 1 addition & 5 deletions web/apps/next/parser/XMLParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,7 @@ export default class XMLParser {

async getIcon(block: Named) {
const mod = block.mod ?? "minecraft";
const icon = `icons/${mod}/${block.id}.png`;
if (await this.resolver.exists("file", "public", icon)) {
return `/${icon}`;
}
return null;
return `https://icons.macarena.ceo/icons/${mod}/${block.id}.png`;
}

async extendBlock(block: Block) {
Expand Down
6 changes: 3 additions & 3 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
"format": "prettier --write \"**/*.{ts,ts,gql}\""
},
"devDependencies": {
"@turbo/gen": "^1.9.7",
"@turbo/gen": "^2.0.12",
"dotenv-cli": "^7.2.1",
"eslint": "^7.32.0",
"eslint-config-custom": "workspace:*",
"prettier": "^2.5.1",
"turbo": "latest"
"turbo": "^2.0.12"
},
"packageManager": "pnpm@8.6.12",
"packageManager": "pnpm@9.6.0",
"name": "skygrid-web"
}
4 changes: 0 additions & 4 deletions web/packages/datagen/.dockerignore

This file was deleted.

4 changes: 0 additions & 4 deletions web/packages/datagen/.gitignore

This file was deleted.

Loading
Loading