Skip to content

Commit

Permalink
feat: migrate to adonisjs
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Sep 6, 2019
1 parent b79c2a2 commit ab370b8
Show file tree
Hide file tree
Showing 18 changed files with 563 additions and 944 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div align="center">
<img src="https://res.cloudinary.com/adonisjs/image/upload/q_100/v1557762307/poppinss_iftxlt.jpg" width="600px">
<img src="https://res.cloudinary.com/adonisjs/image/upload/q_100/v1564392111/adonis-banner_o9lunk.png" width="600px">
</div>

# Adonis application
Expand All @@ -22,16 +22,16 @@ The application class for AdonisJs to know more about the environment and projec
Ideally you shouldn't be installing this module directly, since it is part of AdonisJs by default. However, installing module directly is helpful when testing AdonisJs specific addons.

```sh
npm i @poppinss/application
npm i @adonisjs/application

# Yarn
yarn add @poppinss/application
yarn add @adonisjs/application
```

and then use it as follows:

```ts
import { Application } from '@poppinss/application'
import { Application } from '@adonisjs/application/build/standalone'
import { Ioc } from '@adonisjs/fold'

const app = new Application(
Expand All @@ -55,7 +55,7 @@ The constructor takes 4 arguments, which you can fake during tests.
The application instance will parse the contents of `.adonisrc.json` file. However, if you need the parser, you can access and use it as follows.

```ts
import { rcParser } from '@poppinss/application'
import { rcParser } from '@adonisjs/application/build/standalone'
rcParser.parse(require('.adonisrc.json'))
```

Expand All @@ -64,11 +64,11 @@ Following are the autogenerated files via Typedoc

* [API](docs/README.md)

[circleci-image]: https://img.shields.io/circleci/project/github/poppinss/application/master.svg?style=for-the-badge&logo=circleci
[circleci-url]: https://circleci.com/gh/poppinss/application "circleci"
[circleci-image]: https://img.shields.io/circleci/project/github/adonisjs/application/master.svg?style=for-the-badge&logo=circleci
[circleci-url]: https://circleci.com/gh/adonisjs/application "circleci"

[npm-image]: https://img.shields.io/npm/v/@poppinss/application.svg?style=for-the-badge&logo=npm
[npm-url]: https://npmjs.org/package/@poppinss/application "npm"
[npm-image]: https://img.shields.io/npm/v/@adonisjs/application.svg?style=for-the-badge&logo=npm
[npm-url]: https://npmjs.org/package/@adonisjs/application "npm"

[typescript-image]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript

Expand Down
76 changes: 76 additions & 0 deletions adonis-typings/application.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/**
* @module @adonisjs/application
*/

/*
* @adonisjs/application
*
* (c) Harminder Virk <virk@adonisjs.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare module '@ioc:Adonis/Core/Application' {
import { IocContract } from '@adonisjs/fold'

export type PreloadNode = {
file: string,
environment: ('web' | 'console' | 'test')[],
optional: boolean,
}

export type SemverNode = {
major: number,
minor: number,
patch: number,
prerelease: (string | number)[],
version: string,
}

export type RcFile = {
exceptionHandlerNamespace: string,
preloads: PreloadNode[],
copyToBuild: string[],
directories: {
[key: string]: string,
},
autoloads: {
[key: string]: string,
},
namespaces: {
[key: string]: string,
},
}

export interface ApplicationContract {
readonly rcFile: RcFile,
readonly appRoot: string
readonly cliCwd?: string
readonly appName: string
readonly adonisVersion: SemverNode | null
readonly version: SemverNode | null
exceptionHandlerNamespace: string
container: IocContract
preloads: PreloadNode[]
environment: 'web' | 'console' | 'test' | 'unknown'
isReady: boolean
inProduction: boolean
inDev: boolean
isShuttingDown: boolean
directoriesMap: Map<string, string>
autoloadsMap: Map<string, string>
namespacesMap: Map<string, string>
makePath (...paths: string[]): string
makePathFromCwd (...paths: string[]): string
configPath (...paths: string[]): string
publicPath (...paths: string[]): string
databasePath (...paths: string[]): string
migrationsPath (...paths: string[]): string
seedsPath (...paths: string[]): string
resourcesPath (...paths: string[]): string
viewsPath (...paths: string[]): string
startPath (...paths: string[]): string
tmpPath (...paths: string[]): string
}
}
9 changes: 5 additions & 4 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
**[@poppinss/application](README.md)**
**[@adonisjs/application](README.md)**

[Globals](README.md)

## Index

### External modules

* ["Application"](modules/_application_.md)
* ["contracts"](modules/_contracts_.md)
* ["rcParser"](modules/_rcparser_.md)
* ["adonis-typings/application"](modules/_adonis_typings_application_.md)
* ["src/Application"](modules/_src_application_.md)
* ["src/rcParser"](modules/_src_rcparser_.md)
* ["standalone"](modules/_standalone_.md)
Loading

0 comments on commit ab370b8

Please sign in to comment.