🎉 To celebrate crossing 1k users, Adonis Mastery Pro is 50% off all through August. Go Pro!

Adding a config file with user inputs

In the last lesson, we saw how to work with template files using the automatic method. In this lesson, we are going to cover how to do the same thing and more using the manual method.

What you'll learn

  • How to use instructions.ts to manually create template files
  • How to accept users' input when configuring AdonisJS packages
  • How to use user-provided values in template files

AdonisJS package development

1hr 5mins
10 lessons
Intermediate

Comfirm password

adonis-mrm is a preset of tasks for mrm which is a command line tool for scaffolding new projects and keeping their configurations in sync. We’ll be using it to scaffold the package.

Now, let's start building the package. We'll copy over the package implementation from the tutorial and register it with the AdonisJS IoC container.

In the lesson, we’ll be covering how to make the package configurable. That is, using node ace configure.

5m 47s

Before we start using the package in an AdonisJS project, let’s add types for the package so it plays nicely with TypeScript.

What you'll learn

  • How to create a TypeScript ambient module
  • How to add types to types to AdonisJS packages

Now, let's test what we have so far. Instead of having to first publish the package to npm, we will be using an npm package called Yalc, which allows us to test or use npm packages locally.

What you'll learn

  • How to use Yalc to publish and use install packages locally.

There are times we might want our package to make use of user-defined configurations. You might have seen that in most Adonis packages. In this lesson, we will cover how to do that.

What you'll learn

  • How to use template files in AdonisJS packages

In the last lesson, we saw how to work with template files using the automatic method. In this lesson, we are going to cover how to do the same thing and more using the manual method.

What you'll learn

  • How to use instructions.ts to manually create template files
  • How to accept users' input when configuring AdonisJS packages
  • How to use user-provided values in template files

There are times we might want to pass additional instructions or information after users might have installed and configured our package. We can achieve that using the instructions.md file and in this lesson, we’ll cover how to do just that.

What you'll learn

  • How to display post-configuration instructions in AdonisJS packages

The package is now feature complete. What’s left is making it available to the world by publishing it to npm.

What you'll learn

  • How to publish AdonisJS packages to npm

To wrap up this course, I have put together a package development skeleton based off of this course for quickly scaffolding and building AdonisJS packages.

Chimezie Enyinnaya

Hi, I'm Chimezie Enyinnaya, your teacher.

I’m a self-taught software developer based in Lagos, Nigeria, with over 8 years of experience. In the last couple of years, I've been doing more teaching because I enjoy sharing my knowledge so that others can benefit from it. Come along as I teach you all I know about AdonisJS, Node.js, and JavaScript at large!

Lesson video (SD)
Lesson video (HD)

No comments yet.