| 1 | var umd = require('../'); |
| 2 | var fs = require('fs'); |
| 3 | var join = require('path').join; |
| 4 | |
| 5 | fs.createReadStream(join(__dirname, 'cjs', 'index.js')) |
| 6 | .pipe(umd('common-js-module', true)) |
| 7 | .pipe(fs.createWriteStream(join(__dirname, 'cjs', 'bundle.js'))) |
| 8 | .on('close', end); |
| 9 | |
| 10 | fs.createReadStream(join(__dirname, 'raw', 'index.js')) |
| 11 | .pipe(umd('common-js-module', false)) |
| 12 | .pipe(fs.createWriteStream(join(__dirname, 'raw', 'bundle.js'))) |
| 13 | .on('close', end); |
| 14 | fs.createReadStream(join(__dirname, 'constructor', 'index.js')) |
| 15 | .pipe(umd('Common-Js-Module', false)) |
| 16 | .pipe(fs.createWriteStream(join(__dirname, 'constructor', 'bundle.js'))) |
| 17 | .on('close', end); |
| 18 | |
| 19 | var remaining = 2; |
| 20 | function end() { |
| 21 | if (0 !== --remaining) return; |
| 22 | console.log(require('./cjs/bundle')); |
| 23 | console.log(require('./raw/bundle')); |
| 24 | console.log(require('./constructor/bundle')); |
| 25 | } |