@@ -4,12 +4,15 @@ import * as pathjs from 'path'
44import * as c from 'svelte/compiler'
55import { mkdirSync , readFileSync , writeFileSync } from 'fs'
66import * as svelteInternal from 'svelte/internal'
7+ import * as prettier from 'prettier'
78
89const PACKAGE = JSON . parse ( fs . readFileSync ( './package.json' , 'utf-8' ) )
910const PLUGIN_PACKAGE_PATH = './src/pluginPackage/'
1011const SVELTE_FILE = './src/pluginPackage/about.svelte'
1112const README_DIST_PATH = './dist/pluginPackage/about.md'
1213const DIST_PATH = './dist/pluginPackage/'
14+ const PLUGIN_REPO_PATH = 'D:/github-repos/snavesutit/blockbench-plugins/plugins/animated_java'
15+ const PLUGIN_MANIFEST_PATH = 'D:/github-repos/snavesutit/blockbench-plugins/plugins.json'
1316
1417function plugin ( ) : Plugin {
1518 return {
@@ -40,6 +43,21 @@ function plugin(): Plugin {
4043 writeFileSync ( README_DIST_PATH , html )
4144 if ( fs . existsSync ( pathjs . join ( DIST_PATH , 'about.svelte' ) ) )
4245 fs . unlinkSync ( pathjs . join ( DIST_PATH , 'about.svelte' ) )
46+
47+ if ( fs . existsSync ( PLUGIN_REPO_PATH ) ) {
48+ console . log ( '📋 Copying to plugin repo' )
49+ fs . rmSync ( PLUGIN_REPO_PATH , { recursive : true , force : true } )
50+ fs . cpSync ( DIST_PATH , PLUGIN_REPO_PATH , { recursive : true } )
51+ const manifest = JSON . parse ( fs . readFileSync ( PLUGIN_MANIFEST_PATH , 'utf-8' ) )
52+ manifest . animated_java . version = PACKAGE . version
53+ fs . writeFileSync (
54+ PLUGIN_MANIFEST_PATH ,
55+ prettier . format ( JSON . stringify ( manifest , null , '\t' ) , {
56+ useTabs : true ,
57+ parser : 'json' ,
58+ } )
59+ )
60+ }
4361 } )
4462 } ,
4563 }
0 commit comments