Skip to content

Commit 4c0ea7a

Browse files
author
Nedyalko Nikolov
authored
Merge pull request #8 from NativeScript/nnikolov/RevertToWorkWithUglify
Make plugin commonjs again.
2 parents 4f1d328 + aebcaeb commit 4c0ea7a

13 files changed

+47
-92
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ tests/platforms/
44
tests/node_modules/
55
example/node_modules/
66
example/platforms/
7+
example/**/*.js
78
dist/
89
src/**/*.js

Diff for: compile.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ node_modules/.bin/tsc -p "$SOURCE_DIR" --outDir "$PACK_DIR"
2525
node_modules/tslint/bin/tslint --project "$SOURCE_DIR"/tsconfig.json --config "$SOURCE_DIR"/tslint.json
2626

2727
# make commonjs bundle for ANDROID
28-
node_modules/rollup/bin/rollup -c --environment PLATFORM:$ANDROID
28+
# node_modules/rollup/bin/rollup -c --environment PLATFORM:$ANDROID
2929

3030
# make commonjs bundle for IOS
31-
node_modules/rollup/bin/rollup -c --environment PLATFORM:$IOS
31+
# node_modules/rollup/bin/rollup -c --environment PLATFORM:$IOS
3232

3333
copy_package_files

Diff for: example/app/app.js

-5
This file was deleted.

Diff for: example/app/app.js.map

-1
This file was deleted.

Diff for: example/app/main-page.js

-40
This file was deleted.

Diff for: example/app/main-page.js.map

-1
This file was deleted.

Diff for: example/app/main-page.ts

+34-25
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,48 @@ import { Page } from "ui/page";
33
import { DateTimeFormat } from "nativescript-intl";
44
import { fromObject, Observable } from "data/observable";
55

6-
var model: Observable;
6+
let model: Observable;
7+
let mediumDateTimeOptions = {
8+
"year": "numeric",
9+
"month": "short",
10+
"day": "numeric",
11+
"hour": "numeric",
12+
"minute": "2-digit",
13+
"second": "numeric"
14+
};
15+
let longDateOptions = {
16+
"year": "numeric",
17+
"month": "long",
18+
"day": "numeric"
19+
};
20+
let fullDateOptions = {
21+
"year": "numeric",
22+
"month": "long",
23+
"day": "numeric",
24+
"weekday": "long"
25+
};
26+
let shortDateTimeOptions = {
27+
"year": "numeric",
28+
"month": "numeric",
29+
"day": "numeric",
30+
"hour": "numeric",
31+
"minute": "numeric"
32+
};
733

834
export function onNavigating(args: EventData) {
935
let page = <Page>args.object;
10-
model = fromObject({"mediumDateTimeOptions": "", "longDateOptions": "", "fullDateOptions": "", "shortDateTimeOptions": ""});
36+
model = fromObject({
37+
"mediumDateTimeOptions": "",
38+
"longDateOptions": "",
39+
"fullDateOptions": "",
40+
"shortDateTimeOptions": ""
41+
});
1142
page.bindingContext = model;
1243
}
1344

1445
export function onTap() {
15-
var mediumDateTimeOptions = {
16-
"year": "numeric",
17-
"month": "short",
18-
"day": "numeric",
19-
"hour": "numeric",
20-
"minute": "2-digit",
21-
"second": "numeric"
22-
};
2346
model.set("mediumDateTimeOptions", new DateTimeFormat("en-US", mediumDateTimeOptions).format(new Date()));
24-
var longDateOptions = {"year": "numeric", "month": "long", "day": "numeric"};
2547
model.set("longDateOptions", new DateTimeFormat("en-US", longDateOptions).format(new Date()));
26-
var fullDateOptions = {
27-
"year": "numeric",
28-
"month": "long",
29-
"day": "numeric",
30-
"weekday": "long"
31-
};
3248
model.set("fullDateOptions", new DateTimeFormat("en-US", fullDateOptions).format(new Date()));
33-
var shortDateTimeOptions = {
34-
"year": "numeric",
35-
"month": "numeric",
36-
"day": "numeric",
37-
"hour": "numeric",
38-
"minute": "numeric"
39-
};
40-
model.set("shortDateTimeOptions", new DateTimeFormat("en-US", fullDateOptions).format(new Date()));
49+
model.set("shortDateTimeOptions", new DateTimeFormat("en-US", shortDateTimeOptions).format(new Date()));
4150
}

Diff for: example/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
"nativescript": {
77
"id": "org.nativescript.example",
88
"tns-android": {
9-
"version": "2.4.0"
9+
"version": "2.5.0-next-2016-12-19-1539"
1010
}
1111
},
1212
"dependencies": {
13+
"nativescript-intl": "file:..\\dist\\nativescript-intl-0.0.9.tgz",
1314
"nativescript-theme-core": "^0.2.1",
14-
"tns-core-modules": "2.4.0",
15-
"nativescript-intl": "file:..\\dist\\nativescript-intl-0.0.9.tgz"
15+
"tns-core-modules": "2.4.0"
1616
},
1717
"devDependencies": {
1818
"babel-traverse": "6.19.0",
@@ -23,4 +23,4 @@
2323
"nativescript-dev-typescript": "^0.3.2",
2424
"typescript": "^2.0.10"
2525
}
26-
}
26+
}

Diff for: src/nativescript-intl-common.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
DateTimeFormatOptions as intlDateTimeFormatOptions,
44
NumberFormat as intlNumberFormat,
55
NumberFormatOptions as intlNumberFormatOptions
6-
} from "nativescript-intl";
6+
} from "./nativescript-intl";
77

88
export const NUMERIC = "numeric";
99
export const LONG = "long";

Diff for: src/nativescript-intl.android.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
NumberFormat as commonNumberFormat,
44
FULL
55
} from "./nativescript-intl-common";
6-
import { NumberFormatOptions } from "nativescript-intl";
6+
import { NumberFormatOptions } from "./nativescript-intl";
77

88
let localesCache: Map<string, any> = new Map<string, any>();
99

Diff for: src/nativescript-intl.ios.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
NumberFormat as commonNumberFormat,
44
FULL
55
} from "./nativescript-intl-common";
6-
import { NumberFormatOptions } from "nativescript-intl";
6+
import { NumberFormatOptions } from "./nativescript-intl";
77

88
export class DateTimeFormat extends commonDateTimeFormat {
99
public getNativePattern(patternDefinition: {date?: string, time?: string}, locale?: string): string {

Diff for: src/package.json

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
"name": "nativescript-intl",
33
"version": "0.0.9",
44
"description": "Provides API for using Native date, time and number formatting with an API similar to Intl.js",
5-
"main": "bundle",
6-
"module": "index",
75
"nativescript": {
86
"platforms": {
97
"android": "2.3.0",

Diff for: src/tsconfig.json

+3-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"compilerOptions": {
3-
"module": "es6",
4-
"target": "es6",
3+
"module": "commonjs",
4+
"target": "es5",
55
"noImplicitAny": false,
66
"removeComments": true,
77
"preserveConstEnums": true,
@@ -13,14 +13,8 @@
1313
},
1414
"filesGlob": [
1515
"./**/*.ts",
16+
"./**/*.d.ts",
1617
"!./node_modules/**/*.ts"
1718
],
18-
"files": [
19-
"references.d.ts",
20-
"nativescript-intl-common.ts",
21-
"nativescript-intl.android.ts",
22-
"nativescript-intl.ios.ts",
23-
"index.ts"
24-
],
2519
"exclude": []
2620
}

0 commit comments

Comments
 (0)