1.0.15 • Published 6 years ago

baiji-glue v1.0.15

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

Glue

Build Status npm version npm GitHub license

Magic glue that makes baiji components work together

Installation

npm install baiji-glue --save

How glue works

#
# Load config files by predefined pattern and orders:
#
# 1. Load `config.{js,json}`
#
# 2. Load `[extraConfig].config.{js,json}`
#
# 3. Load `[environment].{js,json}` file according to `process.env.NODE_ENV`, default
#    is `development`, such as: environments/development.js
#
# 4. Load `[extra].env.{js,json}` file according to `process.env.NODE_ENV`, default
#    is `development`, such as: database.env.js
#
# 5. Generate environment related method according to file names under `environments`
#    folder, such as:
#    ├── environments
#    ...├── development.js
#    ...├── production.js
#    ...└── test.js
#    method `isDevelopment`, `isProduction`, `isTest` will be generated according
#    to above folder structure
#
# 6. Add logger folder and related files
#    ├── logs
#    ...├── [environment]_access.js => development_access.log
#    ...└── [environment]_error.js => development_error.log
#
# 7. Combine above configs by following structure:
#    {
#       env: {
#          NODE_ENV: 'development',
#          isDevelopment() {},
#          isProduction() {},
#          isTest() {},
#       },
#       logger: {}
#          error() {},
#          warning() {},
#          info() {},
#          verbose() {},
#          debug() {},
#          silly() {},
#          infoLogger: winston.Logger instance...,
#          errorLogger: winston.Logger instance...
#       },
#       ... other configs from environment related config file and default config file
#    }
#
# 8. Load initializer files under `initializers` folder and invoke functional
#    initializers with `config` as parameter
#
# 9. Return combined config
#

Usage & APIs

glue(dir)

const glue = require('glue');

module.exports = glue(__dirname);

load(baseDir, pattern, excludedFiles)

const load = require('glue').load;

const models = load(__dirname, '*.js', ['index.js'])
1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

7 years ago

1.0.12

7 years ago

1.0.11

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago