-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: don't require
stream
package in codebase (#520)
* fix: dont have require('stream') * chore: add stream importing regression tests to CI * chore: fix webpacking dist * chore: fix runner-prepare script
- Loading branch information
Showing
8 changed files
with
102 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ coverage/ | |
node_modules/ | ||
node-*.tar.gz | ||
package-lock.json | ||
tmp/ | ||
tmp/ | ||
readable-stream-test/dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import * as all from '../lib/ours' | ||
import * as allBrowser from '../lib/ours/browser' | ||
import * as allRoot from '../lib/ours' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import { exec } from 'child_process' | ||
import util from '../lib/ours/util.js' | ||
|
||
function info(message) { | ||
console.log(`\x1b[34m[INFO]\x1b[0m ${message}`) | ||
} | ||
|
||
function error(message) { | ||
console.log(`\x1b[31m[INFO]\x1b[0m ${message}`) | ||
} | ||
|
||
async function run(command) { | ||
info(`Executing \x1b[33m${command}\x1b[0m ...`) | ||
const { promise, reject, resolve } = util.createDeferredPromise() | ||
|
||
let hasOutput = false | ||
function logOutput(chunk) { | ||
if (!hasOutput) { | ||
hasOutput = true | ||
console.log('') | ||
} | ||
|
||
console.log(chunk.toString('utf-8').trim().replace(/^/gm, ' ')) | ||
} | ||
|
||
try { | ||
const process = exec(command, { stdio: 'pipe' }, (error) => { | ||
if (error) { | ||
return reject(error) | ||
} | ||
|
||
resolve(error) | ||
}) | ||
|
||
process.stdout.on('data', logOutput) | ||
process.stderr.on('data', logOutput) | ||
await promise | ||
|
||
if (hasOutput) { | ||
console.log('') | ||
} | ||
} catch (e) { | ||
if (hasOutput) { | ||
console.log('') | ||
} | ||
|
||
error(`Command failed with status code ${e.code}.`) | ||
process.exit(1) | ||
} | ||
} | ||
|
||
async function main() { | ||
const validBundlers = ['browserify', 'esbuild', 'rollup', 'webpack'] | ||
const bundler = process.argv[2] || process.env.BUNDLER | ||
|
||
if (!validBundlers.includes(bundler)) { | ||
error(`Usage: node await runner-prepare.mjs [${validBundlers.join('|')}]`) | ||
error('You can also use the BUNDLER environment variable.') | ||
process.exit(1) | ||
} | ||
|
||
switch (bundler) { | ||
case 'browserify': | ||
break | ||
case 'esbuild': | ||
break | ||
case 'rollup': | ||
break | ||
case 'webpack': | ||
await run('webpack -c readable-stream-test/webpack.config.mjs') | ||
} | ||
} | ||
|
||
main().catch((e) => { | ||
error(e) | ||
process.exit(1) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { resolve } from 'path' | ||
import { fileURLToPath } from 'url' | ||
|
||
const rootDir = resolve(fileURLToPath(new URL('.', import.meta.url)), '../') | ||
|
||
export default { | ||
mode: 'development', | ||
entry: './readable-stream-test/import.js', | ||
output: { | ||
path: resolve(rootDir, 'readable-stream-test', 'dist'), | ||
filename: 'import.js' | ||
} | ||
} |