Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • S sweet-core
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 62
    • Issues 62
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 4
    • Merge requests 4
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • sweet-js
  • sweet-core
  • Merge requests
  • !102

Use node plumbing to locate macro module.

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/natefaubion/load-module into master Sep 26, 2013
  • Overview 5
  • Commits 1
  • Pipelines 0
  • Changes 1

Created by: natefaubion

This is a change to the sjs binary that lets it load macros from installed modules, in addition to relative files, by piggybacking off of node's internal API for resolving module locations.

This is a bit hacky as node doesn't expose this API directly, but seeing as how node's module system is locked, I doubt it will be changing significantly any time soon.

If you provide a --module that starts with a ./ or ../ it will resolve it based on the cwd. If you provide it with a package name like somelib/macros it will walk up the node_modules tree.

Overall, a lot could be done to improve macro loading from packages, but I think this is a decent first step that doesn't require users to copy files around.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/natefaubion/load-module