Skip to content

Commit

Permalink
Update node-modules example to use moment
Browse files Browse the repository at this point in the history
Moment is used instead of date-fns because date-fns doesn't bundle the
main script.
  • Loading branch information
Hyunje Jun committed Jun 4, 2018
1 parent 3a6a83b commit 2187739
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 18 deletions.
6 changes: 2 additions & 4 deletions examples/05-node-modules/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { currentDate as currentDate1 } from "./module1";
import { currentDate as currentDate2 } from "./module2";
import { currentDate } from "./module";

console.log(currentDate1());
console.log(currentDate2());
console.log(currentDate());
5 changes: 5 additions & 0 deletions examples/05-node-modules/module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import * as moment from "moment";

export function currentDate(): string {
return moment().format('[Today is a] dddd');
}
5 changes: 0 additions & 5 deletions examples/05-node-modules/module1.ts

This file was deleted.

5 changes: 0 additions & 5 deletions examples/05-node-modules/module2.ts

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
"typescript": "^2.9.1"
},
"devDependencies": {
"date-fns": "^1.29.0"
"moment": "^2.22.2"
}
}
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
version "10.1.4"
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.1.4.tgz#606651d3f8a8bec08b8cb262161aab9209f4a29d"

date-fns@^1.29.0:
version "1.29.0"
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.29.0.tgz#12e609cdcb935127311d04d33334e2960a2a54e6"
moment@^2.22.2:
version "2.22.2"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.22.2.tgz#3c257f9839fc0e93ff53149632239eb90783ff66"

typescript@^2.9.1:
version "2.9.1"
Expand Down

0 comments on commit 2187739

Please sign in to comment.