Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Provide metalsmith.env (env setting method) #354

@webketje

Description

@webketje

Provide a metalsmith.env method that abstracts the OS & environment Metalsmith is running in.
An example of what it could look like in a first iteration:

metalsmith.env({       // setter
  platform: 'win32',
  process: 'node',
  version: '16.8.0'
})
metalsmith.env()       // getter
/** returns:
* {
*   platform: 'win32',
*   process: 'node',
*   version: '16.8.0'
* }
**/

This would primarily:

  • make it possible to cover all unit test cases on a single OS and single node version.
  • provide the base for an additional metalsmith env CLI command that would print out the metalsmith env for debugging purposes and attaching to issues

In a later iteration the option fs: require('fs') could be provided which would open up avenues for using alternative file systems in node-agnostic environments (eg browser LocalStorage or a completely custom system). Though this is a far cry from being implemented and would require other modules like path to be available in those environments too. Most plugins would also be incompatible with this

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions