training.shoppinpal.com
  • Introduction
  • 1. The Ideal Workspace
    • The Perfect Machine
      • For Biz Team
      • For Developers
      • For Designers
    • Setup a machine in the cloud
      • Solution
      • Setup box on Azure
        • Create a machine on Azure
        • Test drive your remote machine
        • Setup Dropbox On Azure
      • Setup box on DigitalOcean
        • Setup UI
        • Shared FileSystem
          • Dropbox
            • Use locally developed node modules in another project
          • sshfs
        • Long Running Sessions
      • Feedback
  • 2. Learning Git
    • Static Code Analysis
  • 3. The Backend
    • Use Containers
    • Setup a loopback project
    • Lockdown
    • Build a better mousetrap
    • The abyss stares back
    • Built-in models
    • Extending built-in models
    • Understanding UserModel
    • Boot Scripts
    • Promises
    • Find roles for current user
    • Loopback Console
    • Current User
  • 4. Multi-tenancy With Loopback
    • What is Multi-Tenancy
    • Architecting with Loopback
    • Define scope for Roles
    • Role Resolvers
    • Access Control For Tenants
    • Better Programming with multi-tenancy
  • 5. The Frontend
    • The Browser
    • Unit Testing
      • Motivation behind this blog
      • How to write a test
      • Karma and Jasmin
      • Writing Tests
    • End-2-End Testing
    • Angular 1.x
    • Angular 2
      • Testing
  • 6. ElasticSearch
    • Better Search with NGram
    • NGram with Elasticsearch
    • Fun with Path Hierarchy Tokenizer
    • Working with Mappings and Analyzers
  • 7. Promises
    • What are Promises
    • Promise Implementations
    • Nuances
    • What should we use
  • 8. Learning Docker
    • Docker Swarm
  • 9. Queues & Workers
    • PHP workers in AWS EBS
    • NodeJS workers in AWS EBS
      • SQS Daemon by AWS
      • SQS Daemon in NodeJS
      • SQS polling by worker
    • Gearman
  • 10. Docker
    • Capabilities
  • Appendix
    • Bug in WebStorm deployments
    • The Perfect Terminal
    • Scalable App Deployment with AWS
    • Chrome Tips & Tricks
    • Host your own Gitbook
    • Gitbook Tips & Tricks
    • How to handle support incidents
    • Dev Resources
    • Debug e2e Tests on CircleCI
    • Logging
    • Authentication Principles
    • Mac
    • nvm
    • Unify testing with npm
      • Debugging Mocha
    • Sequence Diagrams
    • Project Sync via IDE
      • SFTP with WebStorm
      • SFTP with Visual Studio
    • Soft Linking
    • NodeJS Profiling
      • How to find node.js performance optimization killers
    • Setup Packer on Azure
Powered by GitBook
On this page
  • Prerequisite
  • Here goes:
  • Steps to be smart:
  1. 1. The Ideal Workspace
  2. Setup a machine in the cloud
  3. Setup box on DigitalOcean
  4. Shared FileSystem
  5. Dropbox

Use locally developed node modules in another project

Prerequisite

  • Docker

Here goes:

If you're working on developing a node module(Let's call it project1), and also want to try it in some other project locally(Let's call it project2), then you might be worried about going through the whole process of publishing it to npm.

Or write efficient tests for the module, and be confident enough that it'll work in another project no matter what.

Or moreover, you might just copy the module into your node_modules folder, and repeat it until your brain says it sucks to copy the whole thing all the time.

Or be a smart ass, and follow these simple steps (This only works with projects using docker, so shift your projects to docker today):

Steps to be smart:

  • Go to the docker-compose.yml file of your project2.

  • Find the container where you want to use the project1.

  • It should be something like this:

    service_name:
      build:
        xxx: xxx
      working_dir: xxx
      command: xxx
      blah:  
      blah:
  • Set up an attribute volume here. volume allows you to mount host paths or named volumes, specified as sub-options to a service.

    service_name:
      blah:
      blah:
      volume: 
         /path/to/project1/:/path/to/node_modules/project1
  • This mounts project1 inside the container service_name. You can go verify it by logging into the container machine once it is up and running. Here's the handy command docker-compose run service_name /bin/bash.

  • Once you enter the container machine, go see your code sync realtime at /path/to/node_modules/project1.

You're welcome ;)

PreviousDropboxNextsshfs

Last updated 7 years ago