betschki / ghost-myrtle Goto Github PK
View Code? Open in Web Editor NEWGhost Myrtle is a NodeJS command-line interface (CLI) tool that aims to make it easier for Ghost theme developers to create content for their theme demo sites.
Ghost Myrtle is a NodeJS command-line interface (CLI) tool that aims to make it easier for Ghost theme developers to create content for their theme demo sites.
This is a great application, thanks. There must be a way to tell the AI not to generate excessively long titles though. Or maybe you should include a function to cut them to fit the ghost limit.
Error with Ghost API: Error [ValidationError]: Validation error, cannot save post.
at /root/.nvm/versions/node/v18.19.0/lib/node_modules/ghost-myrtle/node_modules/@tryghost/admin-api/lib/admin-api.js:463:33
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async pushToGhost (file:///root/.nvm/versions/node/v18.19.0/lib/node_modules/ghost-myrtle/create.js:52:9)
at async default (file:///root/.nvm/versions/node/v18.19.0/lib/node_modules/ghost-myrtle/create.js:228:3)
at async createCommand (file:///root/.nvm/versions/node/v18.19.0/lib/node_modules/ghost-myrtle/index.js:25:5) {
context: 'Value in [posts.title] exceeds maximum length of 255 characters. posts.title',
type: 'ValidationError',
details: null,
property: null,
help: null,
code: null,
id: 'c55bf753dc5a',
ghostErrorCode: null
}
I have been trying to run the app but my efforts have been fruitless and IDK how to proceed because I'm not very familiar with nodejs. I tried installing fs but it doesn't resolve the issue:
root@9c97f7225753:/# myrtle config
internal/process/esm_loader.js:74
internalBinding('errors').triggerUncaughtException(
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/usr/local/lib/node_modules/fs/promises' imported from /usr/local/lib/node_modules/ghost-myrtle/config.js
at finalizeResolution (internal/modules/esm/resolve.js:285:11)
at moduleResolve (internal/modules/esm/resolve.js:708:10)
at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:798:11)
at Loader.resolve (internal/modules/esm/loader.js:100:40)
at Loader.getModuleJob (internal/modules/esm/loader.js:246:28)
at ModuleWrap. (internal/modules/esm/module_job.js:47:40)
at link (internal/modules/esm/module_job.js:46:36) {
code: 'ERR_MODULE_NOT_FOUND'
}
root@9c97f7225753:/#
Almost all the titles that come out of this script start with a quotation mark. Copilot has this to say about it. IDK, because I'm just learning JS but maybe you should have a look at it.
"The issue seems to be with the regular expression used in the replace() function. The regular expression ^\d+[.)]\s+"|"$ is looking for a digit at the start of the string followed by a period or a parenthesis, then one or more spaces, and then a quotation mark. It also looks for a quotation mark at the end of the string. However, the | operator in the regular expression is causing the issue. It creates two separate conditions: one for the start of the string and one for the end of the string.
Here’s the corrected function:
function cleanTitle(title) {
// Remove numbering (e.g. 1., 2., 1), 2)) and wrapping quotes
return title.replace(/^\d+[\.)]\s+\"|\"$/g, '').replace(/^\"|\"$/g, '').trim();
}
In this corrected function, I’ve added another replace() function with the regular expression ^"|"$. This regular expression looks for a quotation mark at the start or end of the string and replaces it with nothing. This should remove the quotation marks at the start and end of your titles. If you have any more questions or need further clarification, feel free to ask! 😊"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.