#!/usr/bin/env node
var replace = require('stream-replace')
var path = require('path')

var name = require(path.join(process.cwd(), 'package.json')).name

process.stdin
  .pipe(
    replace(
      new RegExp('require\\(\s*[\'"]' + name + '[\'"]\s*\\)', 'g'),
      'require(\'./\')'))
  .pipe(process.stdout)

#!/usr/bin/env node
var replace = require('stream-replace')
var path = require('path')

var name = require(path.join(process.cwd(), 'package.json')).name

process.stdin
  .pipe(
    replace(
      new RegExp('require\\(\s*[\'"]' + name, 'g'),
      'require(\'./'))
  .pipe(process.stdout)

Replace only the first part of the require call
Replace only the first part of the require call

This permits replacement of submodule require statements like
`require('this-package/some-submodule')`.
