Skip to content

Commit 7fd13e6

Browse files
committed
Replace date-fns by date-and-time-formatter
1 parent a61ef39 commit 7fd13e6

File tree

9 files changed

+45
-56
lines changed

9 files changed

+45
-56
lines changed

README.md

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,10 @@ concurrently [options] <command ...>
145145
146146
General
147147
-m, --max-processes How many processes should run at once.
148-
Exact number or a percent of CPUs available (for example "50%").
149148
New processes only spawn after all restart tries
150-
of a process. [string]
149+
of a process.
150+
Exact number or a percent of CPUs available (for
151+
example "50%") [string]
151152
-n, --names List of custom names to be used in prefix
152153
template.
153154
Example names: "main,browser,server" [string]
@@ -202,7 +203,7 @@ Prefix styling
202203
in prefix. The option can be used to shorten the
203204
prefix when it is set to "command"
204205
[number] [default: 10]
205-
-t, --timestamp-format Specify the timestamp in moment/date-fns format.
206+
-t, --timestamp-format Specify the timestamp in Unicode LDML format.
206207
[string] [default: "yyyy-MM-dd HH:mm:ss.SSS"]
207208
208209
Input handling
@@ -219,8 +220,9 @@ Killing other processes
219220
-k, --kill-others Kill other processes if one exits or dies.[boolean]
220221
--kill-others-on-fail Kill other processes if one exits with non zero
221222
status code. [boolean]
222-
--kill-signal Signal to send to other processes if one exits or dies.
223-
(SIGTERM/SIGKILL, defaults to SIGTERM) [string]
223+
--kill-signal, --ks Signal to send to other processes if one exits or
224+
dies. (SIGTERM/SIGKILL, defaults to SIGTERM)
225+
[string]
224226
225227
Restarting
226228
--restart-tries How many times a process that died should restart.
@@ -238,73 +240,73 @@ Examples:
238240
239241
- Output nothing more than stdout+stderr of child processes
240242
241-
$ concurrently --raw "npm run watch-less" "npm run watch-js"
243+
$ concurrently.js --raw "npm run watch-less" "npm run watch-js"
242244
243245
- Normal output but without colors e.g. when logging to file
244246
245-
$ concurrently --no-color "grunt watch" "http-server" > log
247+
$ concurrently.js --no-color "grunt watch" "http-server" > log
246248
247249
- Custom prefix
248250
249-
$ concurrently --prefix "{time}-{pid}" "npm run watch" "http-server"
251+
$ concurrently.js --prefix "{time}-{pid}" "npm run watch" "http-server"
250252
251253
- Custom names and colored prefixes
252254
253-
$ concurrently --names "HTTP,WATCH" -c "bgBlue.bold,bgMagenta.bold"
255+
$ concurrently.js --names "HTTP,WATCH" -c "bgBlue.bold,bgMagenta.bold"
254256
"http-server" "npm run watch"
255257
256258
- Auto varying colored prefixes
257259
258-
$ concurrently -c "auto" "npm run watch" "http-server"
260+
$ concurrently.js -c "auto" "npm run watch" "http-server"
259261
260262
- Mixing auto and manual colored prefixes
261263
262-
$ concurrently -c "red,auto" "npm run watch" "http-server" "echo hello"
264+
$ concurrently.js -c "red,auto" "npm run watch" "http-server" "echo hello"
263265
264266
- Configuring via environment variables with CONCURRENTLY_ prefix
265267
266-
$ CONCURRENTLY_RAW=true CONCURRENTLY_KILL_OTHERS=true concurrently "echo
268+
$ CONCURRENTLY_RAW=true CONCURRENTLY_KILL_OTHERS=true concurrently.js "echo
267269
hello" "echo world"
268270
269271
- Send input to default
270272
271-
$ concurrently --handle-input "nodemon" "npm run watch-js"
273+
$ concurrently.js --handle-input "nodemon" "npm run watch-js"
272274
rs # Sends rs command to nodemon process
273275
274276
- Send input to specific child identified by index
275277
276-
$ concurrently --handle-input "npm run watch-js" nodemon
278+
$ concurrently.js --handle-input "npm run watch-js" nodemon
277279
1:rs
278280
279281
- Send input to specific child identified by name
280282
281-
$ concurrently --handle-input -n js,srv "npm run watch-js" nodemon
283+
$ concurrently.js --handle-input -n js,srv "npm run watch-js" nodemon
282284
srv:rs
283285
284286
- Shortened NPM run commands
285287
286-
$ concurrently npm:watch-node npm:watch-js npm:watch-css
288+
$ concurrently.js npm:watch-node npm:watch-js npm:watch-css
287289
288290
- Shortened NPM run command with wildcard (make sure to wrap it in quotes!)
289291
290-
$ concurrently "npm:watch-*"
292+
$ concurrently.js "npm:watch-*"
291293
292294
- Exclude patterns so that between "lint:js" and "lint:fix:js", only "lint:js"
293295
is ran
294296
295-
$ concurrently "npm:*(!fix)"
297+
$ concurrently.js "npm:*(!fix)"
296298
297299
- Passthrough some additional arguments via '{<number>}' placeholder
298300
299-
$ concurrently -P "echo {1}" -- foo
301+
$ concurrently.js -P "echo {1}" -- foo
300302
301303
- Passthrough all additional arguments via '{@}' placeholder
302304
303-
$ concurrently -P "npm:dev-* -- {@}" -- --watch --noEmit
305+
$ concurrently.js -P "npm:dev-* -- {@}" -- --watch --noEmit
304306
305307
- Passthrough all additional arguments combined via '{*}' placeholder
306308
307-
$ concurrently -P "npm:dev-* -- {*}" -- --watch --noEmit
309+
$ concurrently.js -P "npm:dev-* -- {*}" -- --watch --noEmit
308310
309311
For more details, visit https://github.com/open-cli-tools/concurrently
310312
```
@@ -346,7 +348,7 @@ For more details, visit https://github.com/open-cli-tools/concurrently
346348
Anything else means all processes should exit successfully.
347349
- `restartTries`: how many attempts to restart a process that dies will be made. Default: `0`.
348350
- `restartDelay`: how many milliseconds to wait between process restarts. Default: `0`.
349-
- `timestampFormat`: a [date-fns format](https://date-fns.org/v2.0.1/docs/format)
351+
- `timestampFormat`: a [Unicode LDML format](https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table)
350352
to use when prefixing with `time`. Default: `yyyy-MM-dd HH:mm:ss.ZZZ`
351353
- `additionalArguments`: list of additional arguments passed that will get replaced in each command. If not defined, no argument replacing will happen.
352354

bin/concurrently.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ const args = yargs(argsBeforeSep)
151151
},
152152
'timestamp-format': {
153153
alias: 't',
154-
describe: 'Specify the timestamp in moment/date-fns format.',
154+
describe: 'Specify the timestamp in Unicode LDML format.',
155155
default: defaults.timestampFormat,
156156
type: 'string',
157157
},

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"license": "MIT",
5252
"dependencies": {
5353
"chalk": "^4.1.2",
54-
"date-fns": "^2.30.0",
54+
"date-and-time-formatter": "^1.0.0",
5555
"lodash": "^4.17.21",
5656
"rxjs": "^7.8.1",
5757
"shell-quote": "^1.8.1",

pnpm-lock.yaml

Lines changed: 6 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/defaults.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export const success = 'all' as SuccessCondition;
6161

6262
/**
6363
* Date format used when logging date/time.
64-
* @see https://date-fns.org/v2.0.1/docs/format
64+
* @see https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
6565
*/
6666
export const timestampFormat = 'yyyy-MM-dd HH:mm:ss.SSS';
6767

src/flow-control/log-timings.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import formatDate from 'date-fns/format';
1+
import { formatDateTime } from 'date-and-time-formatter';
22
import { createMockInstance } from 'jest-create-mock-instance';
33

44
import { CloseEvent } from '../command';
@@ -79,22 +79,22 @@ it('logs the timings at the start and end (ie complete or error) event of each c
7979

8080
expect(logger.logCommandEvent).toHaveBeenCalledTimes(4);
8181
expect(logger.logCommandEvent).toHaveBeenCalledWith(
82-
`${commands[0].command} started at ${formatDate(startDate0, timestampFormat)}`,
82+
`${commands[0].command} started at ${formatDateTime(startDate0, timestampFormat)}`,
8383
commands[0],
8484
);
8585
expect(logger.logCommandEvent).toHaveBeenCalledWith(
86-
`${commands[1].command} started at ${formatDate(startDate1, timestampFormat)}`,
86+
`${commands[1].command} started at ${formatDateTime(startDate1, timestampFormat)}`,
8787
commands[1],
8888
);
8989
expect(logger.logCommandEvent).toHaveBeenCalledWith(
90-
`${commands[1].command} stopped at ${formatDate(
90+
`${commands[1].command} stopped at ${formatDateTime(
9191
endDate1,
9292
timestampFormat,
9393
)} after ${command1DurationTextMs}`,
9494
commands[1],
9595
);
9696
expect(logger.logCommandEvent).toHaveBeenCalledWith(
97-
`${commands[0].command} stopped at ${formatDate(
97+
`${commands[0].command} stopped at ${formatDateTime(
9898
endDate0,
9999
timestampFormat,
100100
)} after ${command0DurationTextMs}`,

src/flow-control/log-timings.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as assert from 'assert';
2-
import formatDate from 'date-fns/format';
2+
import { formatDateTime } from 'date-and-time-formatter';
33
import _ from 'lodash';
44
import * as Rx from 'rxjs';
55
import { bufferCount, combineLatestWith, take } from 'rxjs/operators';
@@ -77,14 +77,14 @@ export class LogTimings implements FlowController {
7777
commands.forEach((command) => {
7878
command.timer.subscribe(({ startDate, endDate }) => {
7979
if (!endDate) {
80-
const formattedStartDate = formatDate(startDate, this.timestampFormat);
80+
const formattedStartDate = formatDateTime(startDate, this.timestampFormat);
8181
logger.logCommandEvent(
8282
`${command.command} started at ${formattedStartDate}`,
8383
command,
8484
);
8585
} else {
8686
const durationMs = endDate.getTime() - startDate.getTime();
87-
const formattedEndDate = formatDate(endDate, this.timestampFormat);
87+
const formattedEndDate = formatDateTime(endDate, this.timestampFormat);
8888
logger.logCommandEvent(
8989
`${
9090
command.command

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export type ConcurrentlyOptions = BaseConcurrentlyOptions & {
4343

4444
/**
4545
* Date format used when logging date/time.
46-
* @see https://date-fns.org/v2.0.1/docs/format
46+
* @see https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
4747
*/
4848
timestampFormat?: string;
4949

src/logger.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import chalk from 'chalk';
2-
import formatDate from 'date-fns/format';
2+
import { formatDateTime } from 'date-and-time-formatter';
33
import _ from 'lodash';
44
import * as Rx from 'rxjs';
55

@@ -56,7 +56,7 @@ export class Logger {
5656

5757
/**
5858
* Date format used when logging date/time.
59-
* @see https://date-fns.org/v2.0.1/docs/format
59+
* @see https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
6060
*/
6161
timestampFormat?: string;
6262
}) {
@@ -93,7 +93,7 @@ export class Logger {
9393
index: String(command.index),
9494
name: command.name,
9595
command: this.shortenText(command.command),
96-
time: formatDate(Date.now(), this.timestampFormat),
96+
time: formatDateTime(new Date(), this.timestampFormat),
9797
};
9898
}
9999

0 commit comments

Comments
 (0)