Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.

Commit 333df1f

Browse files
committed
Livesync operations are timestamped
See NativeScript/nativescript-cli#1263
1 parent d1ed229 commit 333df1f

File tree

2 files changed

+333
-1
lines changed

2 files changed

+333
-1
lines changed

definitions/moment.d.ts

+330
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,330 @@
1+
// Type definitions for Moment.js 2.5.0
2+
// Project: https://github.com/timrwood/moment
3+
// Definitions by: Michael Lakerveld <https://github.com/Lakerfield>
4+
// Definitions by: Aaron King <https://github.com/kingdango> (2.4.0)
5+
// Definitions by: Hiroki Horiuchi <https://github.com/horiuchi> (2.5.0)
6+
// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped
7+
8+
interface MomentInput {
9+
years?: number;
10+
y?: number;
11+
months?: number;
12+
M?: number;
13+
weeks?: number;
14+
w?: number;
15+
days?: number;
16+
d?: number;
17+
hours?: number;
18+
h?: number;
19+
minutes?: number;
20+
m?: number;
21+
seconds?: number;
22+
s?: number;
23+
milliseconds?: number;
24+
ms?: number;
25+
}
26+
27+
28+
interface Duration {
29+
30+
humanize(): string;
31+
32+
milliseconds(): number;
33+
asMilliseconds(): number;
34+
35+
seconds(): number;
36+
asSeconds(): number;
37+
38+
minutes(): number;
39+
asMinutes(): number;
40+
41+
hours(): number;
42+
asHours(): number;
43+
44+
days(): number;
45+
asDays(): number;
46+
47+
months(): number;
48+
asMonths(): number;
49+
50+
years(): number;
51+
asYears(): number;
52+
53+
}
54+
55+
interface Moment {
56+
57+
format(format: string): string;
58+
format(): string;
59+
60+
fromNow(withoutSuffix?: boolean): string;
61+
62+
startOf(soort: string): Moment;
63+
endOf(soort: string): Moment;
64+
65+
add(input: MomentInput): Moment;
66+
add(soort: string, aantal: number): Moment;
67+
add(duration: Duration): Moment;
68+
subtract(input: MomentInput): Moment;
69+
subtract(soort: string, aantal: number): Moment;
70+
71+
calendar(): string;
72+
clone(): Moment;
73+
74+
valueOf(): number;
75+
76+
local(): Moment; // current date/time in local mode
77+
78+
utc(): Moment; // current date/time in UTC mode
79+
80+
isValid(): boolean;
81+
82+
year(y: number): Moment;
83+
year(): number;
84+
quarter(): number;
85+
month(M: number): Moment;
86+
month(M: string): Moment;
87+
month(): number;
88+
day(d: number): Moment;
89+
day(d: string): Moment;
90+
day(): number;
91+
date(d: number): Moment;
92+
date(): number;
93+
hours(h: number): Moment;
94+
hours(): number;
95+
minutes(m: number): Moment;
96+
minutes(): number;
97+
seconds(s: number): Moment;
98+
seconds(): number;
99+
milliseconds(ms: number): Moment;
100+
milliseconds(): number;
101+
weekday(): number;
102+
weekday(d: number): Moment;
103+
isoWeekday(): number;
104+
isoWeekday(d: number): Moment;
105+
weekYear(): number;
106+
weekYear(d: number): Moment;
107+
isoWeekYear(): number;
108+
isoWeekYear(d: number): Moment;
109+
week(): number;
110+
week(d: number): Moment;
111+
weeks(): number;
112+
weeks(d: number): Moment;
113+
isoWeek(): number;
114+
isoWeek(d: number): Moment;
115+
isoWeeks(): number;
116+
isoWeeks(d: number): Moment;
117+
118+
from(f: Moment): string;
119+
from(f: Moment, suffix: boolean): string;
120+
from(d: Date): string;
121+
from(s: string): string;
122+
from(date: number[]): string;
123+
124+
diff(b: Moment): number;
125+
diff(b: Moment, soort: string): number;
126+
diff(b: Moment, soort: string, round: boolean): number;
127+
128+
toDate(): Date;
129+
toISOString(): string;
130+
unix(): number;
131+
132+
isLeapYear(): boolean;
133+
zone(): number;
134+
zone(b: number): Moment;
135+
zone(b: string): Moment;
136+
daysInMonth(): number;
137+
isDST(): boolean;
138+
139+
isBefore(): boolean;
140+
isBefore(b: Moment): boolean;
141+
isBefore(b: string): boolean;
142+
isBefore(b: Number): boolean;
143+
isBefore(b: Date): boolean;
144+
isBefore(b: number[]): boolean;
145+
isBefore(b: Moment, granularity: string): boolean;
146+
isBefore(b: String, granularity: string): boolean;
147+
isBefore(b: Number, granularity: string): boolean;
148+
isBefore(b: Date, granularity: string): boolean;
149+
isBefore(b: number[], granularity: string): boolean;
150+
151+
isAfter(): boolean;
152+
isAfter(b: Moment): boolean;
153+
isAfter(b: string): boolean;
154+
isAfter(b: Number): boolean;
155+
isAfter(b: Date): boolean;
156+
isAfter(b: number[]): boolean;
157+
isAfter(b: Moment, granularity: string): boolean;
158+
isAfter(b: String, granularity: string): boolean;
159+
isAfter(b: Number, granularity: string): boolean;
160+
isAfter(b: Date, granularity: string): boolean;
161+
isAfter(b: number[], granularity: string): boolean;
162+
163+
isSame(b: Moment): boolean;
164+
isSame(b: string): boolean;
165+
isSame(b: Number): boolean;
166+
isSame(b: Date): boolean;
167+
isSame(b: number[]): boolean;
168+
isSame(b: Moment, granularity: string): boolean;
169+
isSame(b: String, granularity: string): boolean;
170+
isSame(b: Number, granularity: string): boolean;
171+
isSame(b: Date, granularity: string): boolean;
172+
isSame(b: number[], granularity: string): boolean;
173+
174+
lang(language: string): void;
175+
lang(reset: boolean): void;
176+
lang(): string;
177+
178+
max(date: Date): Moment;
179+
max(date: number): Moment;
180+
max(date: any[]): Moment;
181+
max(date: string): Moment;
182+
max(date: string, format: string): Moment;
183+
max(clone: Moment): Moment;
184+
185+
min(date: Date): Moment;
186+
min(date: number): Moment;
187+
min(date: any[]): Moment;
188+
min(date: string): Moment;
189+
min(date: string, format: string): Moment;
190+
min(clone: Moment): Moment;
191+
192+
get(unit: string): number;
193+
set(unit: string, value: number): Moment;
194+
195+
}
196+
197+
interface MomentCalendar {
198+
199+
lastDay: any;
200+
sameDay: any;
201+
nextDay: any;
202+
lastWeek: any;
203+
nextWeek: any;
204+
sameElse: any;
205+
206+
}
207+
208+
interface MomentLanguage {
209+
210+
months?: any;
211+
monthsShort?: any;
212+
weekdays?: any;
213+
weekdaysShort?: any;
214+
weekdaysMin?: any;
215+
longDateFormat?: MomentLongDateFormat;
216+
relativeTime?: MomentRelativeTime;
217+
meridiem?: (hour: number, minute: number, isLowercase: boolean) => string;
218+
calendar?: MomentCalendar;
219+
ordinal?: (num: number) => string;
220+
221+
}
222+
223+
interface MomentLongDateFormat {
224+
225+
L: string;
226+
LL: string;
227+
LLL: string;
228+
LLLL: string;
229+
LT: string;
230+
l?: string;
231+
ll?: string;
232+
lll?: string;
233+
llll?: string;
234+
lt?: string;
235+
236+
}
237+
238+
interface MomentRelativeTime {
239+
240+
future: any;
241+
past: any;
242+
s: any;
243+
m: any;
244+
mm: any;
245+
h: any;
246+
hh: any;
247+
d: any;
248+
dd: any;
249+
M: any;
250+
MM: any;
251+
y: any;
252+
yy: any;
253+
254+
}
255+
256+
interface MomentStatic {
257+
258+
(): Moment;
259+
(date: number): Moment;
260+
(date: number[]): Moment;
261+
(date: string, format?: string, strict?: boolean): Moment;
262+
(date: string, format?: string, language?: string, strict?: boolean): Moment;
263+
(date: string, formats: string[], strict?: boolean): Moment;
264+
(date: string, formats: string[], language?: string, strict?: boolean): Moment;
265+
(date: Date): Moment;
266+
(date: Moment): Moment;
267+
(date: Object): Moment;
268+
269+
utc(): Moment;
270+
utc(date: number): Moment;
271+
utc(date: number[]): Moment;
272+
utc(date: string, format?: string, strict?: boolean): Moment;
273+
utc(date: string, format?: string, language?: string, strict?: boolean): Moment;
274+
utc(date: string, formats: string[], strict?: boolean): Moment;
275+
utc(date: string, formats: string[], language?: string, strict?: boolean): Moment;
276+
utc(date: Date): Moment;
277+
utc(date: Moment): Moment;
278+
utc(date: Object): Moment;
279+
280+
unix(timestamp: number): Moment;
281+
282+
isMoment(): boolean;
283+
isMoment(m: any): boolean;
284+
lang(language: string): any;
285+
lang(language: string, definition: MomentLanguage): any;
286+
longDateFormat: any;
287+
relativeTime: any;
288+
meridiem: (hour: number, minute: number, isLowercase: boolean) => string;
289+
calendar: any;
290+
ordinal: (num: number) => string;
291+
292+
duration(milliseconds: Number): Duration;
293+
duration(num: Number, soort: string): Duration;
294+
duration(input: MomentInput): Duration;
295+
duration(object: any): Duration;
296+
duration(): Duration;
297+
298+
parseZone(date: string): Moment;
299+
300+
months(): string[];
301+
months(index: number): string;
302+
months(format: string): string[];
303+
months(format: string, index: number): string;
304+
monthsShort(): string[];
305+
monthsShort(index: number): string;
306+
monthsShort(format: string): string[];
307+
monthsShort(format: string, index: number): string;
308+
weekdays(): string[];
309+
weekdays(index: number): string;
310+
weekdays(format: string): string[];
311+
weekdays(format: string, index: number): string;
312+
weekdaysShort(): string[];
313+
weekdaysShort(index: number): string;
314+
weekdaysShort(format: string): string[];
315+
weekdaysShort(format: string, index: number): string;
316+
weekdaysMin(): string[];
317+
weekdaysMin(index: number): string;
318+
weekdaysMin(format: string): string[];
319+
weekdaysMin(format: string, index: number): string;
320+
321+
normalizeUnits(unit: string): string;
322+
323+
invalid(parsingFlags?: Object): Moment;
324+
}
325+
326+
declare var moment: MomentStatic;
327+
328+
declare module "moment" {
329+
export = moment;
330+
}

services/usb-livesync-service-base.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import minimatch = require("minimatch");
55
import * as path from "path";
66
import * as util from "util";
7+
import * as moment from "moment";
78
let gaze = require("gaze");
89

910
interface IProjectFileInfo {
@@ -197,6 +198,7 @@ export class UsbLiveSyncServiceBase implements IUsbLiveSyncServiceBase {
197198
let action = (device: Mobile.IDevice) => {
198199
return (() => {
199200
if (deviceAppData.isLiveSyncSupported(device).wait()) {
201+
this.$logger.info(`Start syncing application ${deviceAppData.appIdentifier} at ${moment().format("ll LTS")}.`);
200202

201203
if(data.beforeLiveSyncAction) {
202204
data.beforeLiveSyncAction(device, deviceAppData).wait();
@@ -214,7 +216,7 @@ export class UsbLiveSyncServiceBase implements IUsbLiveSyncServiceBase {
214216
let platformSpecificLiveSyncService = this.resolvePlatformSpecificLiveSyncService(platform, device, data.platformSpecificLiveSyncServices);
215217
platformSpecificLiveSyncService.restartApplication(deviceAppData, localToDevicePaths).wait();
216218

217-
this.$logger.info(`Successfully synced application ${deviceAppData.appIdentifier}.`);
219+
this.$logger.info(`Successfully synced application ${deviceAppData.appIdentifier} at ${moment().format("ll LTS")}.`);
218220
}
219221
}).future<void>()();
220222
};

0 commit comments

Comments
 (0)