Skip to content

Commit 5b8e9bb

Browse files
authored
Rename to sync-child-process (#2)
It turns out `sync-process` already exists, it's just a security placeholder because it used to by malicious so it doesn't show up on npm search.
1 parent 81a80c9 commit 5b8e9bb

File tree

5 files changed

+23
-23
lines changed

5 files changed

+23
-23
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
deploy:
4949
name: Deploy
5050
runs-on: ubuntu-latest
51-
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/sync-process'"
51+
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/sync-child-process'"
5252
needs: [static_analysis, tests]
5353

5454
steps:
@@ -65,7 +65,7 @@ jobs:
6565

6666
typedoc:
6767
runs-on: ubuntu-latest
68-
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/sync-process'"
68+
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/sync-child-process'"
6969
needs: [deploy]
7070

7171
environment:

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
# `sync-process`
1+
# `sync-child-process`
22

3-
This package exposes a `SyncProcess` class that allows Node.js to run
4-
a subprocess synchronously *and* interactively.
3+
This package exposes a `SyncChildProcess` class that allows Node.js to run a
4+
subprocess synchronously *and* interactively.
55

66
## Usage
77

8-
Use `new SyncProcess()` to start running a subprocess. This supports the same
9-
API as [`child_process.spawn()`] other than a few options. You can send input to
10-
the process using `process.stdin`, and receive events from it (stdout, stderr,
11-
or exit) using `process.next()`. This implements [the iterator protocol], but
12-
*not* the iterable protocol because it's intrinsically stateful.
8+
Use `new SyncChildProcess()` to start running a subprocess. This supports the
9+
same API as [`child_process.spawn()`] other than a few options. You can send
10+
input to the process using `process.stdin`, and receive events from it (stdout,
11+
stderr, or exit) using `process.next()`. This implements [the iterator
12+
protocol], but *not* the iterable protocol because it's intrinsically stateful.
1313

1414
[the iterator protocol]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_iterator_protocol
1515
[`child_process.spawn()`]: https://nodejs.org/api/child_process.html#child_processspawncommand-args-options
1616

1717
```js
18-
import {SyncProcess} from 'sync-process';
18+
import {SyncChildProcess} from 'sync-child-process';
1919
// or
20-
// const {SyncProcess} = require('sync-process');
20+
// const {SyncChildProcess} = require('sync-child-process');
2121

22-
const node = new SyncProcess('node', ['--interactive']);
22+
const node = new SyncChildProcess('node', ['--interactive']);
2323

2424
for (;;) {
2525
if (node.next().value.data.toString().endsWith('> ')) break;

lib/index.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
import * as fs from 'fs';
66
import * as p from 'path';
77

8-
import {ExitEvent, StderrEvent, StdoutEvent, SyncProcess} from './index';
8+
import {ExitEvent, StderrEvent, StdoutEvent, SyncChildProcess} from './index';
99

10-
describe('SyncProcess', () => {
10+
describe('SyncChildProcess', () => {
1111
describe('stdio', () => {
1212
it('emits stdout', () => {
1313
withJSProcess('console.log("hello, world!");', node => {
@@ -70,7 +70,7 @@ describe('SyncProcess', () => {
7070

7171
it('passes options to the subprocess', () => {
7272
withJSFile('console.log(process.env.SYNC_PROCESS_TEST);', file => {
73-
const node = new SyncProcess(process.argv0, [file], {
73+
const node = new SyncChildProcess(process.argv0, [file], {
7474
env: {...process.env, SYNC_PROCESS_TEST: 'abcdef'},
7575
});
7676
expectStdout(node.next(), 'abcdef\n');
@@ -134,15 +134,15 @@ function expectExit(
134134
}
135135

136136
/**
137-
* Starts a `SyncProcess` running a JS file with the given `contents` and passes
138-
* it to `callback`.
137+
* Starts a `SyncChildProcess` running a JS file with the given `contents` and
138+
* passes it to `callback`.
139139
*/
140140
function withJSProcess(
141141
contents: string,
142-
callback: (process: SyncProcess) => void,
142+
callback: (process: SyncChildProcess) => void,
143143
): void {
144144
return withJSFile(contents, file => {
145-
const node = new SyncProcess(process.argv0, [file]);
145+
const node = new SyncChildProcess(process.argv0, [file]);
146146

147147
try {
148148
callback(node);

lib/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function isMarkedAsUntransferable(object: unknown): boolean {
3030
* A child process that runs synchronously while also allowing the user to
3131
* interact with it before it shuts down.
3232
*/
33-
export class SyncProcess
33+
export class SyncChildProcess
3434
implements Iterator<StderrEvent | StdoutEvent, ExitEvent | undefined>
3535
{
3636
/** The port that communicates with the worker thread. */

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"name": "sync-process",
2+
"name": "sync-child-process",
33
"version": "1.0.0",
44
"description": "Run a subprocess synchronously and interactively in Node.js",
5-
"repository": "sass/sync-process",
5+
"repository": "sass/sync-child-process",
66
"author": "Google Inc.",
77
"license": "MIT",
88
"exports": {

0 commit comments

Comments
 (0)