Skip to content

Commit

Permalink
build for 7.1.0 and remove documentation but include link to node docs
Browse files Browse the repository at this point in the history
  • Loading branch information
calvinmetcalf committed Nov 9, 2016
1 parent ea4eaba commit 80dc00c
Show file tree
Hide file tree
Showing 14 changed files with 160 additions and 2,054 deletions.
1 change: 1 addition & 0 deletions .npmignore
Expand Up @@ -6,3 +6,4 @@ zlib.js
.zuul.yml
.nyc_output
coverage
docs/
4 changes: 3 additions & 1 deletion README.md
Expand Up @@ -16,7 +16,9 @@ npm install --save readable-stream
***Node-core streams for userland***

This package is a mirror of the Streams2 and Streams3 implementations in
Node-core, including [documentation](doc/stream.md).
Node-core.

Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v7.1.0/docs/api/).

If you want to guarantee a stable streams base, regardless of what version of
Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core, for background see [this blogpost](http://r.va.gg/2014/06/why-i-dont-use-nodes-core-stream-module.html).
Expand Down
20 changes: 13 additions & 7 deletions build/build.js
Expand Up @@ -12,21 +12,18 @@ const hyperquest = require('hyperzip')(require('hyperdirect'))
, nodeVersionRegexString = '\\d+\\.\\d+\\.\\d+'
, usageVersionRegex = RegExp('^' + nodeVersionRegexString + '$')
, readmeVersionRegex =
RegExp('(Node-core v)' + nodeVersionRegexString, 'g')
RegExp('((?:Node-core )|(?:https\:\/\/nodejs\.org\/dist\/)v)' + nodeVersionRegexString, 'g')

, readmePath = path.join(__dirname, '..', 'README.md')
, files = require('./files')
, testReplace = require('./test-replacements')
, docReplace = require('./doc-replacements')

, srcurlpfx = `https://raw.githubusercontent.com/nodejs/node/v${nodeVersion}/`
, libsrcurl = srcurlpfx + 'lib/'
, testsrcurl = srcurlpfx + 'test/parallel/'
, testlisturl = `https://github.com/nodejs/node/tree/v${nodeVersion}/test/parallel`
, libourroot = path.join(__dirname, '../lib/')
, testourroot = path.join(__dirname, '../test/parallel/')
, docurlpfx = `https://raw.githubusercontent.com/nodejs/node/v${nodeVersion}/doc/api/`
, docourroot = path.join(__dirname, '../doc')


if (!usageVersionRegex.test(nodeVersion)) {
Expand Down Expand Up @@ -68,7 +65,14 @@ function processFile (inputLoc, out, replacements) {
})
}))
}

function deleteOldTests(){
const files = fs.readdirSync(path.join(__dirname, '..', 'test', 'parallel'));
for (let file of files) {
let name = path.join(__dirname, '..', 'test', 'parallel', file);
console.log('removing', name);
fs.unlinkSync(name);
}
}
function processLibFile (file) {
var replacements = files[file]
, url = libsrcurl + file
Expand All @@ -94,6 +98,10 @@ function processTestFile (file) {

Object.keys(files).forEach(processLibFile)

// delete the current contents of test/parallel so if node removes any tests
// they are removed here
deleteOldTests();

//--------------------------------------------------------------------
// Discover, grab and process all test-stream* files on nodejs/node

Expand All @@ -110,8 +118,6 @@ hyperquest(testlisturl).pipe(bl(function (err, data) {
})
}))

processFile(docurlpfx + 'stream.md', path.join(docourroot, 'stream.md'), docReplace)


//--------------------------------------------------------------------
// Grab the nodejs/node test/common.js
Expand Down
6 changes: 0 additions & 6 deletions build/doc-replacements.js

This file was deleted.

8 changes: 7 additions & 1 deletion build/files.js
Expand Up @@ -27,9 +27,13 @@ const headRegexp = /(^module.exports = \w+;?)/m

// The browser build ends up with a circular dependency, so the require is
// done lazily, but cached.
, addDuplexDec = [
headRegexp
, '$1\n\n/*<replacement>*/\nvar Duplex;\n/*</replacement>*/\n'
]
, addDuplexRequire = [
/^(function (?:Writable|Readable)(?:State)?.*{)/gm
, 'var Duplex;\n$1\n Duplex = Duplex || require(\'./_stream_duplex\');\n'
, '\n$1\n Duplex = Duplex || require(\'./_stream_duplex\');\n'
]

, altForEachImplReplacement = require('./common-replacements').altForEachImplReplacement
Expand Down Expand Up @@ -199,6 +203,7 @@ module.exports['_stream_passthrough.js'] = [

module.exports['_stream_readable.js'] = [
addDuplexRequire
, addDuplexDec
, requireReplacement
, instanceofReplacement
, altForEachImplReplacement
Expand Down Expand Up @@ -232,6 +237,7 @@ module.exports['_stream_transform.js'] = [

module.exports['_stream_writable.js'] = [
addDuplexRequire
, addDuplexDec
, requireReplacement
, instanceofReplacement
, utilReplacement
Expand Down
14 changes: 14 additions & 0 deletions build/test-replacements.js
Expand Up @@ -174,6 +174,14 @@ module.exports['common.js'] = [
, [
/process\.binding\('timer_wrap'\)\.Timer;/,
'{now: function (){}}'
],
[
/exports\.enoughTestCpu/,
'//exports.enoughTestCpu'
],
[
/exports\.buildType/,
'//exports.buildType'
]
]

Expand Down Expand Up @@ -284,3 +292,9 @@ module.exports['test-stream-writev.js'] = [
`'binary'`
]
]
module.exports['test-stream2-readable-empty-buffer-no-eof.js'] = [
[
/case 3:\n(\s+)setImmediate\(r\.read\.bind\(r, 0\)\);/,
'case 3:\n$1setTimeout(r.read.bind(r, 0), 50);'
]
]

0 comments on commit 80dc00c

Please sign in to comment.