@adonisjs/framework

中文文档
5.0.13发布于 2019/02/16MITCommonJS近 30 天下载 2.2万

Adonis framework makes it easy for you to write webapps with less code

原始使用文档
文档目录8 节
  1. What's in the box?
  2. Node/OS Target
  3. Development
  4. Tests & Linting
  5. General Practices
  6. Issues & PR
  7. Regression Tests
  8. License

Adonis Framework :triangular_ruler:

This repo contains the core modules for the AdonisJs framework. You must checkout the source code or the API docs on official website to learn more.




NPM Version Build Status Appveyor Coveralls FOSSA Status Pr's Welcome

What's in the box?

This repo contains following providers.

  1. Router
  2. Request & Response
  3. Http Server
  4. Config
  5. Env
  6. Views
  7. Static Files Middleware
  8. Hashing Module
  9. Encrypter
  10. Logger
  11. Exceptions Handler

Node/OS Target

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

Development

Great! If you are planning to contribute to the framework, 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.

License

FOSSA Status

版本与发布记录

@adonisjs/framework 共发布 45 个版本,首次发布于 2017/06/22;过去 12 个月发布了 0 个版本。

版本发布日期距今
5.0.13latest2019/02/167 年前
5.0.122018/10/178 年前
5.0.112018/10/168 年前
5.0.92018/09/308 年前
5.0.82018/06/058 年前
5.0.72018/06/028 年前

关于 @adonisjs/framework 的常见问题

@adonisjs/framework 是什么?

Adonis framework makes it easy for you to write webapps with less code

如何安装 @adonisjs/framework?

在项目目录运行 npm install @adonisjs/framework,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 framework,可以用 npx framework 直接运行。

@adonisjs/framework 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/adonisjs__framework 是否存在。

@adonisjs/framework 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@adonisjs/framework 可以商用吗?

@adonisjs/framework 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@adonisjs/framework 的下载量有多少?

根据 npm 官方下载统计,@adonisjs/framework 在 2026/10/05 – 2026/11/03 这 30 天内被下载 21,898 次,日均约 730 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@adonisjs/framework 还在维护吗?

最新版本 5.0.13 发布于 2019/02/16(7 年前);至今共发布 45 个版本,其中过去 12 个月发布了 0 个;首次发布于 2017/06/22。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。