1
0
Fork 0
mirror of synced 2024-06-28 02:50:50 +12:00

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
console.log(info("Retrieving project..."))
await getSkeleton(type, name)
await fleshOutSkeleton(name, desc, version)
await fleshOutSkeleton(type, name, desc, version)
console.log(info("Installing dependencies..."))
await runPkgCommand("install", join(process.cwd(), name))
console.log(info(`Plugin created in directory "${name}"`))

View file

@ -6,7 +6,7 @@ const { join } = require("path")
const tar = require("tar")
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) {
const resp = await fetch(
@ -40,7 +40,7 @@ exports.getSkeleton = async (type, name) => {
fs.rmSync(tarballFile)
}
exports.fleshOutSkeleton = async (name, description, version) => {
exports.fleshOutSkeleton = async (type, name, description, version) => {
for (let file of HBS_FILES) {
const oldFile = join(name, file),
newFile = join(name, file.substring(0, file.length - 4))

View file

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