Once we finish our portfolio site, hopefully, one of the main activities we'd be doing with it is to create new content. Thus we want to automate the creation of a new blog article, which includes the creation of a new MDX file in the _articles
folder as well as initialize the article's front matter with the title, author, and creation date.
Nx has a powerful concept, called generators. While many of them come already built into the Nx plugins (e.g. @nrwl/next
, @nrwl/react
,...), we can also define our own, Nx Workspace Generators. This is exactly what we leverage to scaffold new blog articles.
Prefer to read along as well? Here's the accompanying article
When I tried to use command create-article, I've got the error: TS5042: Option 'project' cannot be mixed with source files on a command line.