omodule

0.4.0 • Public • Published

omodule

omodule 是一种简单实用的文件目录管理规范,帮助开发者更好的管理项目模块。目前可使用 babel 插件 babel-plugin-transform-omodule-scope 进行 omodule 作用域常量的代码编译。

omodule 规范下的文件目录结构 🌲

例子: ./omodule-structure-example

root
|__ omodules
    |__ account
    |   |__ omodules
    |       |__ login
    |       |__ register
    |__ homepage
    |__ order

三个 omodule 作用域常量的定义

__onamespace

  • 当前 omodule 的命名空间(基于根节点)

文件路径:root/omodules/account/omodules/login/loginPage.js

console.log(__onamespace); // Prints: /account/login

__oname

  • 当前 omodule 的名称

文件路径:root/omodules/account/omodules/register/registerPage.js

console.log(__oname); // Prints: register

__ofilepath

  • 基于 omodule 根节点的文件路径

文件路径:root/omodules/homepage/homePage.js

console.log(__ofilepath); // Prints: omodules/homepage/homePage.js

关于 babel 插件

目前可配合 babel-plugin-transform-omodule-scope 编译 omodule 作用域常量。

Readme

Keywords

none

Package Sidebar

Install

npm i omodule

Weekly Downloads

2

Version

0.4.0

License

MIT

Last publish

Collaborators

  • wuchangming