GithubHelp home page GithubHelp logo

adonis-ignitor's Introduction

Adonis Ignitor ๐Ÿ”ฅ

This repo contains all the code for bootstraping AdonisJs applications. It removes all the boilerplate code from your AdonisJs apps to keep them clean ๐Ÿ›

NPM Version Build Status Appveyor Coveralls

What it does?

This repo performs following actions in order.

  1. Load application package.json file.
  2. Register the Helpers provider, since it needs to be ready before registering any other providers.
  3. Load hooks file from start/hooks.js ( if exists ).
  4. Register all the providers from start/app.js file.
  5. Boot all registered providers.
  6. Define aliases for providers.
  7. Setup global exception handler by loading app/Exceptions/Handler.js file (if any).
  8. Loads files to be preloaded.
  9. Registers ace commands if process is started by the ace command line or someone manually instructs ignitor to load commands.

Node/OS Target

This repo/branch is supposed to run fine on all major OS platforms and targets Node.js >=7.0

Development

Great! If you are planning to contribute to this module, make sure to adhere to following conventions, since a consistent code-base is always joy to work with.

Run the following command to see list of available npm scripts.

npm run

Tests & Linting

  1. Lint your code using standardJs. Run npm run lint command to check if there are any linting errors.
  2. Make sure you write tests for all the changes/bug fixes.
  3. Also you can write regression tests, which shows that something is failing but doesn't breaks the build. Which is actually a nice way to show that something fails. Regression tests are written using test.failing() method.
  4. Make sure all the tests are passing on travis and appveyor.

General Practices

Since Es6 is in, you should strive to use latest features. For example:

  1. Use Spread over arguments keyword.
  2. Never use bind or call. After calling these methods, we cannot guarantee the scope of any methods and in AdonisJs codebase we do not override the methods scope.
  3. Make sure to write proper docblock.

Issues & PR

It is always helpful if we try to follow certain practices when creating issues or PR's, since it will save everyone's time.

  1. Always try creating regression tests when you find a bug (if possible).
  2. Share some context on what you are trying to do, with enough code to reproduce the issue.
  3. For general questions, please create a forum thread.
  4. When creating a PR for a feature, make sure to create a parallel PR for docs too.

Regression Tests

Regression tests are tests, which shows how a piece of code fails under certain circumstance, but the beauty is even after the failure, the test suite will never fail. Actually is a nice way to notify about bugs, but making sure everything is green.

The regression tests are created using

test.failing('2 + 2 is always 4, but add method returns 6', (assert) => {
 assert.true(add(2, 2), 4)
})

Now since the add method has a bug, it will return 6 instead of 4. But the build will pass.

adonis-ignitor's People

Contributors

benallfree avatar romainlanz avatar targos avatar thetutlage avatar vincentducorps avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adonis-ignitor's Issues

Error when using the CLI in a monorepo

Package version

2.0.8

Node.js and npm version

12.3.1 and 6.9.0

I get this error when using this package in a Yarn Monorepo:

image

I found that the problem lives in this line:

const ace = require(path.join(root, '/node_modules/@adonisjs/ace'))

Why don't you just require the package normally?

const ace = require('@adonisjs/ace')

Server start tries to load factory.js even if .loadCommands() not called

Introduced in 2.0.0. My server.js file:

const { Ignitor } = require('@adonisjs/ignitor')

new Ignitor(require('@adonisjs/fold'))
  .appRoot(__dirname)
  .fireHttpServer()
  .catch(console.error)

Throws the following error:

Error: Cannot find module 'Factory'

at /Users/iegner/Code/..../database/factory.js:
`const Factory = use('Factory')`

This can be suppressed by adding .loadCommands(), but I think this is inconsistent.
factory.js should not be loaded if Factory isn't already loaded. Should factory.js only be loaded if loadCommands is called?

Cannot find module '@adonisjs/ignitor'

When I tried to run my application the command line says:
cannot find the module @adonisjs/ignitor.
But when I look up the package.json dependecies there is :
"@adonisjs/ignitor": "^2.0.8" line.
So anyone can please help me about this issue?

Error: Cannot find module './src/Hooks'

Hi,

I have an error with adonis/ignitor package, I've installed packages from npm install but I've this error in console:

0| | Error: Cannot find module './src/Hooks'
0| | at Function.Module._resolveFilename (module.js:536:15)
0| o| at Function.Module._load (module.js:466:25)
0| | at Module.require (module.js:579:17)
0| | at require (internal/module.js:11:18)
0| | at Object. (/home/website/server/releases/xxxxxxx/node_modules/@adonisjs/ignitor/index.js:12:15)
0| | at Module._compile (module.js:635:30)
0| | at Object.Module._extensions..js (module.js:646:10)
0| | at Module.load (module.js:554:32)
0| | at tryModuleLoad (module.js:497:12)
0| | at Function.Module._load (module.js:489:3)

Cannot find module '...', when set aliases in app.js

Hello friends!

I had bug Error: Cannot find module '...', when used aliases in app.js, which generated in providers

I've analized code

/**
* Register + Boot providers
*/
this._registerProviders()
await this._bootProviders()
/**
* Define aliases by reading them from the `start/app.js` file, so that
* pre-defined aliases are overridden by the user defined aliases.
*/
this._defineAliases()

And I suppose calling _defineAliases must be BEFORE _bootProviders:

    /**
     * Register providers
     */

    this._registerProviders()
    /**
     * Define aliases by reading them from the `start/app.js` file, so that
     * pre-defined aliases are overridden by the user defined aliases.
     */
    this._defineAliases()

    /**
     * Boot providers
     */
    await this._bootProviders()

After this bug was solved

Error: Cannot find module 'Youch'

Hello,

I'm trying to format the errors with Youch, but I'm getting a mistake.

I'm importing Youch as follows:

const Youch = use('Youch')

Error: Cannot find module 'Youch'
Error: Cannot find module 'Youch'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at requireStack (/usr/app/node_modules/require-stack/src/index.js:44:12)
at Ioc._require (/usr/app/node_modules/@adonisjs/fold/src/Ioc/index.js:345:12)
at Ioc.use (/usr/app/node_modules/@adonisjs/fold/src/Ioc/index.js:742:17)
at Object. (/usr/app/app/Exceptions/Handler.js:5:15)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at requireStack (/usr/app/node_modules/require-stack/src/index.js:44:12)

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.