mirror of
				https://git.unlock-music.dev/um/web.git
				synced 2025-11-04 08:03:29 +08:00 
			
		
		
		
	build: fix extension maker
This commit is contained in:
		
							parent
							
								
									b0ee928199
								
							
						
					
					
						commit
						80d79d0f65
					
				@ -2,8 +2,10 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const fs = require('fs')
 | 
					const fs = require('fs')
 | 
				
			||||||
const path = require('path')
 | 
					const path = require('path')
 | 
				
			||||||
const src = __dirname + "/src/extension/"
 | 
					
 | 
				
			||||||
const dst = __dirname + "/dist"
 | 
					const DIR_ROOT = path.resolve(__dirname, "..")
 | 
				
			||||||
 | 
					const src = DIR_ROOT + "/src/extension/"
 | 
				
			||||||
 | 
					const dst = DIR_ROOT + "/dist"
 | 
				
			||||||
fs.readdirSync(src).forEach(file => {
 | 
					fs.readdirSync(src).forEach(file => {
 | 
				
			||||||
    let srcPath = path.join(src, file)
 | 
					    let srcPath = path.join(src, file)
 | 
				
			||||||
    let dstPath = path.join(dst, file)
 | 
					    let dstPath = path.join(dst, file)
 | 
				
			||||||
@ -11,10 +13,10 @@ fs.readdirSync(src).forEach(file => {
 | 
				
			|||||||
    console.log(`Copy: ${srcPath} => ${dstPath}`)
 | 
					    console.log(`Copy: ${srcPath} => ${dstPath}`)
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const manifestRaw = fs.readFileSync(__dirname + "/extension-manifest.json", "utf-8")
 | 
					const manifestRaw = fs.readFileSync(DIR_ROOT + "/extension-manifest.json", "utf-8")
 | 
				
			||||||
const manifest = JSON.parse(manifestRaw)
 | 
					const manifest = JSON.parse(manifestRaw)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const pkgRaw = fs.readFileSync(__dirname + "/package.json", "utf-8")
 | 
					const pkgRaw = fs.readFileSync(DIR_ROOT + "/package.json", "utf-8")
 | 
				
			||||||
const pkg = JSON.parse(pkgRaw)
 | 
					const pkg = JSON.parse(pkgRaw)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
verExt = pkg["version"]
 | 
					verExt = pkg["version"]
 | 
				
			||||||
@ -23,5 +25,5 @@ if (verExt.includes("-")) verExt = verExt.split("-")[0]
 | 
				
			|||||||
manifest["version"] = `${verExt}.${pkg["ext_build"]}`
 | 
					manifest["version"] = `${verExt}.${pkg["ext_build"]}`
 | 
				
			||||||
manifest["version_name"] = pkg["version"]
 | 
					manifest["version_name"] = pkg["version"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fs.writeFileSync(__dirname + "/dist/manifest.json", JSON.stringify(manifest), "utf-8")
 | 
					fs.writeFileSync(DIR_ROOT + "/dist/manifest.json", JSON.stringify(manifest), "utf-8")
 | 
				
			||||||
console.log("Write: manifest.json")
 | 
					console.log("Write: manifest.json")
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user