generated from AthennaIO/Template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from AthennaIO/develop
feat(cmd): add `make:test` and configurer
- Loading branch information
Showing
21 changed files
with
916 additions
and
264 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/** | ||
* @athenna/view | ||
* | ||
* (c) João Lenon <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-nocheck | ||
|
||
import { File, Path } from '@athenna/common' | ||
import { BaseConfigurer } from '@athenna/artisan' | ||
|
||
export default class ViewConfigurer extends BaseConfigurer { | ||
public async configure() { | ||
const ext = Path.ext() | ||
const task = this.logger.task() | ||
|
||
task.addPromise(`Create view.${ext} configuration file`, () => { | ||
return new File(`./view`).copy(Path.config(`view.${ext}`)) | ||
}) | ||
|
||
task.addPromise('Update commands of .athennarc.json', () => { | ||
return this.rc | ||
.setTo( | ||
'commands', | ||
'make:view', | ||
'@athenna/view/commands/MakeViewCommand' | ||
) | ||
.save() | ||
}) | ||
|
||
task.addPromise('Update templates of .athennarc.json', () => { | ||
return this.rc | ||
.setTo( | ||
'templates', | ||
'view', | ||
'node_modules/@athenna/view/templates/model.edge' | ||
) | ||
.save() | ||
}) | ||
|
||
task.addPromise('Update providers of .athennarc.json', () => { | ||
return this.rc | ||
.pushTo('providers', '@athenna/view/providers/ViewProvider') | ||
.save() | ||
}) | ||
|
||
await task.run() | ||
|
||
console.log() | ||
this.logger.success( | ||
'Successfully configured ({dim,yellow} @athenna/view) library' | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/** | ||
* @athenna/view | ||
* | ||
* (c) João Lenon <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-nocheck | ||
|
||
import { Env } from '@athenna/config' | ||
import { Path } from '@athenna/common' | ||
|
||
export default { | ||
/* | ||
|-------------------------------------------------------------------------- | ||
| Default view disk | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Here you may define the default view disk of your application. | ||
| | ||
| ```typescript | ||
| // Render the Path.views('home.edge') file | ||
| View.render('home') | ||
| // Render the Path.views('pages/posts/post.edge') file | ||
| View.render('pages/posts/post') | ||
| ``` | ||
| | ||
*/ | ||
|
||
disk: Path.views(), | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Named view disks | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Here you may define the named view disks of your application. Different | ||
| from the `disk`, named disks are rendered with the alias in front: | ||
| | ||
| ```typescript | ||
| View.render('mydisk::myview', { name: 'Athenna' }) | ||
| ``` | ||
| | ||
*/ | ||
|
||
namedDisks: {}, | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| View components | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Here you may define your in-memory components. Components works exactly | ||
| like the `disk` to be rendered, the only difference is that they are | ||
| saved in-memory. | ||
| | ||
| ```typescript | ||
| View.render('button', { content: 'Login' }) | ||
| ``` | ||
| | ||
*/ | ||
|
||
components: {}, | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Edge options | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Define any option accepted by `Edge.create()` method. By default `cache` | ||
| option will be set if in production environment. | ||
| | ||
*/ | ||
|
||
edge: { | ||
/* | ||
|-------------------------------------------------------------------------- | ||
| Cache | ||
|-------------------------------------------------------------------------- | ||
| | ||
| The templates are re-compiled whenever you call the `View.render()` method. | ||
| Meaning that if you change your template while your application is running, | ||
| the next time `View.render()` is called it will have the new changes. | ||
| You must enable the cache mode in production to avoid re-compiling the | ||
| templates. The compiled output will be saved within the memory. | ||
| | ||
*/ | ||
|
||
cache: Env('APP_ENV') === 'production' | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.