Coder Social home page Coder Social logo

betschki / ghost-myrtle Goto Github PK

View Code? Open in Web Editor NEW
8.0 8.0 1.0 31 KB

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.

JavaScript 100.00%
ghost ghost-cms

ghost-myrtle's People

Contributors

betschki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

cartersimpson

ghost-myrtle's Issues

Title too long

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
}

Cannot find module '/usr/local/lib/node_modules/fs/promises'

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:/#

Titles start with quotation mark

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! 😊"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.