Adding management of the new README.md file that is retrieved with the plugin skeletons.

This commit is contained in:
mike12345567 2022-08-18 18:23:07 +01:00
parent e53f86c0b2
commit 65659225e1
3 changed files with 4 additions and 3 deletions

View File

@ -48,7 +48,7 @@ async function init(opts) {
// get the skeleton // get the skeleton
console.log(info("Retrieving project...")) console.log(info("Retrieving project..."))
await getSkeleton(type, name) await getSkeleton(type, name)
await fleshOutSkeleton(name, desc, version) await fleshOutSkeleton(type, name, desc, version)
console.log(info("Installing dependencies...")) console.log(info("Installing dependencies..."))
await runPkgCommand("install", join(process.cwd(), name)) await runPkgCommand("install", join(process.cwd(), name))
console.log(info(`Plugin created in directory "${name}"`)) console.log(info(`Plugin created in directory "${name}"`))

View File

@ -6,7 +6,7 @@ const { join } = require("path")
const tar = require("tar") const tar = require("tar")
const { processStringSync } = require("@budibase/string-templates") const { processStringSync } = require("@budibase/string-templates")
const HBS_FILES = ["package.json.hbs", "schema.json.hbs"] const HBS_FILES = ["package.json.hbs", "schema.json.hbs", "README.md.hbs"]
async function getSkeletonUrl(type) { async function getSkeletonUrl(type) {
const resp = await fetch( const resp = await fetch(
@ -40,7 +40,7 @@ exports.getSkeleton = async (type, name) => {
fs.rmSync(tarballFile) fs.rmSync(tarballFile)
} }
exports.fleshOutSkeleton = async (name, description, version) => { exports.fleshOutSkeleton = async (type, name, description, version) => {
for (let file of HBS_FILES) { for (let file of HBS_FILES) {
const oldFile = join(name, file), const oldFile = join(name, file),
newFile = join(name, file.substring(0, file.length - 4)) newFile = join(name, file.substring(0, file.length - 4))

View File

@ -363,6 +363,7 @@ exports.getDatasourcePlugin = async (name, url, hash) => {
if (currentHash === hash) { if (currentHash === hash) {
return require(filename) return require(filename)
} else { } else {
console.log(`Updating plugin: ${name}`)
fs.unlinkSync(filename) fs.unlinkSync(filename)
} }
} }