initial commit
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
.DS_Store
|
||||
node_modules
|
||||
dist
|
||||
/package
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
vite.config.js.timestamp-*
|
||||
vite.config.ts.timestamp-*
|
||||
Generated
+50
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"name": "create-ezpplauncher-theme",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "create-ezpplauncher-theme",
|
||||
"version": "1.0.0",
|
||||
"bin": {
|
||||
"create-ezpplauncher-theme": "dist/index.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^25.6.0",
|
||||
"typescript": "^6.0.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "25.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.6.0.tgz",
|
||||
"integrity": "sha512-+qIYRKdNYJwY3vRCZMdJbPLJAtGjQBudzZzdzwQYkEPQd+PJGixUL5QfvCLDaULoLv+RhT3LDkwEfKaAkgSmNQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"undici-types": "~7.19.0"
|
||||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "6.0.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz",
|
||||
"integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.17"
|
||||
}
|
||||
},
|
||||
"node_modules/undici-types": {
|
||||
"version": "7.19.2",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.19.2.tgz",
|
||||
"integrity": "sha512-qYVnV5OEm2AW8cJMCpdV20CDyaN3g0AjDlOGf1OW4iaDEx8MwdtChUp4zu4H0VP3nDRF/8RKWH+IPp9uW0YGZg==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "create-ezpplauncher-theme",
|
||||
"version": "1.0.0",
|
||||
"bin": {
|
||||
"create-ezpplauncher-theme": "dist/index.js"
|
||||
},
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "tsc"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^25.6.0",
|
||||
"typescript": "^6.0.3"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env node
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { execSync } from 'child_process';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
const projectName = process.argv[2];
|
||||
|
||||
if (!projectName) {
|
||||
console.error('❌ Please provide a project name');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const targetDir = path.resolve(process.cwd(), projectName);
|
||||
const templateDir = path.resolve(__dirname, '../templates/base');
|
||||
|
||||
if (fs.existsSync(targetDir)) {
|
||||
console.error('❌ Directory already exists');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
fs.cpSync(templateDir, targetDir, { recursive: true });
|
||||
|
||||
const pkgPath = path.join(targetDir, 'package.json');
|
||||
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
|
||||
pkg.name = projectName;
|
||||
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
|
||||
|
||||
const themePath = path.join(targetDir, 'theme.json');
|
||||
const theme = JSON.parse(fs.readFileSync(themePath, 'utf-8'));
|
||||
theme.name = projectName;
|
||||
fs.writeFileSync(themePath, JSON.stringify(theme, null, 2));
|
||||
|
||||
console.log('📦 Installing dependencies...');
|
||||
execSync('npm install', { cwd: targetDir, stdio: 'inherit' });
|
||||
|
||||
console.log(`\n✅ Theme created!\n`);
|
||||
@@ -0,0 +1,37 @@
|
||||
import fs from "fs";
|
||||
import archiver from "archiver";
|
||||
import path from "path";
|
||||
|
||||
const toSafeName = (name: string) => {
|
||||
return name
|
||||
.toLowerCase()
|
||||
.replace(/[^a-z0-9]/g, "_")
|
||||
.replace(/-+/g, "_");
|
||||
};
|
||||
|
||||
const themeInfo = JSON.parse(fs.readFileSync("theme.json", "utf-8"));
|
||||
|
||||
const distDir = path.resolve("dist");
|
||||
const output = fs.createWriteStream(
|
||||
path.join(distDir, `${toSafeName(themeInfo.name)}.ezpplauncher-theme`),
|
||||
);
|
||||
|
||||
const archive = archiver("zip", { zlib: { level: 9 } });
|
||||
archive.pipe(output);
|
||||
|
||||
archive.file("theme.json", { name: "theme.json" });
|
||||
archive.file(path.join(distDir, "bundle.js"), { name: "bundle.js" });
|
||||
|
||||
if (fs.existsSync(path.join(distDir, "ezpp-theme.css"))) {
|
||||
archive.file(path.join(distDir, "ezpp-theme.css"), { name: "style.css" });
|
||||
}
|
||||
|
||||
if (fs.existsSync("public/assets")) {
|
||||
archive.directory("public/assets", "assets");
|
||||
}
|
||||
|
||||
archive.finalize();
|
||||
|
||||
output.on("close", () => {
|
||||
console.log("✅ Theme packaged:", output.path);
|
||||
});
|
||||
@@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
<script type="module">
|
||||
import { mountTheme } from '/src/main.ts';
|
||||
|
||||
mountTheme(document.getElementById('app'), {
|
||||
assets: "yes"
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Generated
+2778
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "ezpp-theme",
|
||||
"version": "1.0.0",
|
||||
"scripts": {
|
||||
"dev": "vite dev",
|
||||
"build": "vite build && ts-node build-theme.ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sveltejs/vite-plugin-svelte": "^7.0.0",
|
||||
"@types/archiver": "^7.0.0",
|
||||
"archiver": "^7.0.1",
|
||||
"svelte": "^5.55.0",
|
||||
"ts-node": "^10.0.0",
|
||||
"typescript": "^6.0.3",
|
||||
"vite": "^8.0.10",
|
||||
"tailwindcss": "^4.0.0",
|
||||
"@tailwindcss/vite": "^4.0.0"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 2.8 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 66 KiB |
@@ -0,0 +1,11 @@
|
||||
<script lang="ts">
|
||||
import { asset } from "./lib/assets";
|
||||
import type { EZPPLauncherThemeAPI } from "./types";
|
||||
|
||||
const props: { api: EZPPLauncherThemeAPI } = $props();
|
||||
</script>
|
||||
|
||||
<div class="w-full h-full flex flex-col items-center justify-center">
|
||||
<audio src={asset(props.api, "audio.mp3")} loop autoplay></audio>
|
||||
<img src={asset(props.api, "dance.gif")} alt="Dance" />
|
||||
</div>
|
||||
@@ -0,0 +1 @@
|
||||
@import "tailwindcss";
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
declare module '*.png';
|
||||
declare module '*.jpg';
|
||||
declare module '*.jpeg';
|
||||
declare module '*.gif';
|
||||
declare module '*.webp';
|
||||
declare module '*.svg';
|
||||
@@ -0,0 +1,9 @@
|
||||
import type { EZPPLauncherThemeAPI } from "../types";
|
||||
|
||||
export function asset(api: EZPPLauncherThemeAPI, path: string) {
|
||||
const isDev = import.meta.env.DEV;
|
||||
|
||||
return isDev
|
||||
? `/assets/${path}`
|
||||
: `${api.assets}/${path}`;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// @ts-ignore: side-effect CSS import declaration not available in this context
|
||||
import "./app.css";
|
||||
import App from "./App.svelte";
|
||||
import { mount } from "svelte";
|
||||
import type { EZPPLauncherThemeAPI } from "./types";
|
||||
|
||||
export function mountTheme(target: HTMLElement, api: EZPPLauncherThemeAPI) {
|
||||
mount(App, {
|
||||
target,
|
||||
props: {
|
||||
api,
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export type EZPPLauncherThemeAPI = {
|
||||
assets: string;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "Dance",
|
||||
"version": "1.0.0",
|
||||
"apiVersion": "1.0",
|
||||
"author": "HorizonCode",
|
||||
"entry": "bundle.js",
|
||||
"style": "style.css",
|
||||
"preview": "preview.png"
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"include": ["src"]
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import { defineConfig } from "vite";
|
||||
import { svelte } from "@sveltejs/vite-plugin-svelte";
|
||||
import tailwindcss from "@tailwindcss/vite";
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [svelte(), tailwindcss()],
|
||||
build: {
|
||||
cssCodeSplit: false,
|
||||
lib: {
|
||||
entry: "src/main.ts",
|
||||
formats: ["es"],
|
||||
name: "EZPPTheme",
|
||||
},
|
||||
rollupOptions: {
|
||||
output: {
|
||||
entryFileNames: "bundle.js",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2022",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "bundler",
|
||||
"outDir": "dist",
|
||||
"rootDir": "./src",
|
||||
"esModuleInterop": true,
|
||||
"strict": true,
|
||||
"types": ["node"]
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
Reference in New Issue
Block a user