Skip to content

Commit

Permalink
feat: upgrade dependencies & zip plugin ui files
Browse files Browse the repository at this point in the history
  • Loading branch information
duruer committed Jan 29, 2025
1 parent e010e2a commit a2db062
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 52 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ build
node_modules
src/main/resources/plugin-ui

/*.mjs
/*.mjs

src/main/resources/*.zip
17 changes: 10 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ val handlebarsVersion: String by project
val bootstrap = (project.findProperty("bootstrap") as String?)?.toBoolean() ?: false
val pluginsDir: File? by rootProject.extra


val os = System.getProperty("os.name").lowercase()
val arch = System.getProperty("os.arch").lowercase()

Expand Down Expand Up @@ -103,20 +102,20 @@ tasks {
}

register("zipPluginUI", Zip::class) {
dependsOn("buildUI")

val buildDir = layout.buildDirectory.asFile
dependsOn("buildUI") // Önce UI build edilsin

from("$buildDir/resources/main/plugin-ui")
from("src/main/resources/plugin-ui")
archiveFileName.set("plugin-ui.zip")
destinationDirectory.set(file("$buildDir/resources/main"))
destinationDirectory.set(file("src/main/resources"))

doLast {
val pluginUIFolder = file("$buildDir/resources/main/plugin-ui")
val pluginUIFolder = file("src/main/resources/plugin-ui")
if (pluginUIFolder.exists()) {
pluginUIFolder.deleteRecursively()
}
}

outputs.upToDateWhen { false }
}

shadowJar {
Expand Down Expand Up @@ -174,6 +173,10 @@ tasks.named("build") {
dependsOn("zipPluginUI")
}

tasks.named("processResources") {
dependsOn("zipPluginUI")
}

publishing {
repositories {
maven {
Expand Down
Binary file modified bun.lockb
Binary file not shown.
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
"prepublishOnly": "npm run build"
},
"devDependencies": {
"@rollup/plugin-node-resolve": "^9.0.0",
"@rollup/plugin-node-resolve": "^16.0.0",
"cross-env": "^7.0.3",
"rollup": "^2.60.0",
"rollup-plugin-svelte": "^7.1.0",
"svelte": "^3.44.1"
"rollup": "^4.32.1",
"rollup-plugin-delete": "^2.1.0",
"rollup-plugin-svelte": "^7.2.2",
"svelte": "^5.19.4"
},
"keywords": [
"svelte"
Expand Down
92 changes: 52 additions & 40 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,48 +1,60 @@
import svelte from 'rollup-plugin-svelte';
import resolve from '@rollup/plugin-node-resolve';
import pkg from './package.json';
import del from 'rollup-plugin-delete';

const name = pkg.name
.replace(/^(@\S+\/)?(svelte-)?(\S+)/, '$3')
.replace(/^\w/, m => m.toUpperCase())
.replace(/-\w/g, m => m[1].toUpperCase());

export default [{
const baseConfig = {
input: 'src/main.js',
output: [
{file: process.env.DEV ? "server.mjs" : "src/main/resources/plugin-ui/server.mjs", 'format': 'es'},
// { file: pkg.main, 'format': 'umd', name }
],
output: {
format: 'es',
chunkFileNames: '[name]-[hash].js', // Chunk file naming
},
plugins: [
svelte({
compilerOptions: {
generate: "ssr",
hydratable: true
},
emitCss: false
del({
targets: process.env.DEV ? 'dist/*' : 'src/main/resources/plugin-ui/*', // Targets to clean
runOnce: true // Run only once
}),
resolve()
],
watch: {
include: "src/**"
}
}, {
input: 'src/main.js',
output: [
{file: process.env.DEV ? "client.mjs" : "src/main/resources/plugin-ui/client.mjs", 'format': 'es', name},
// { file: pkg.main, 'format': 'umd', name }
resolve(),
],
plugins: [
svelte({
compilerOptions: {
generate: "dom",
hydratable: true
},
emitCss: false
}),
resolve()
],
watch: {
include: "src/**"
preserveEntrySignatures: 'strict'
};

export default [
// Server configuration
{
...baseConfig,
output: {
...baseConfig.output,
dir: process.env.DEV ? "dist/server" : "src/main/resources/plugin-ui/server", // Server directory
entryFileNames: 'server.mjs' // Server entry file
},
plugins: [
...baseConfig.plugins,
svelte({
compilerOptions: {
generate: "ssr",
hydratable: true
},
emitCss: false
})
]
},
// Client configuration
{
...baseConfig,
output: {
...baseConfig.output,
dir: process.env.DEV ? "dist/client" : "src/main/resources/plugin-ui/client", // Client directory
entryFileNames: 'client.mjs' // Client entry file
},
plugins: [
...baseConfig.plugins,
svelte({
compilerOptions: {
generate: "dom",
hydratable: true
},
emitCss: false
})
]
}
}];
];

0 comments on commit a2db062

Please sign in to comment.