Skip to content

Make plugin commonjs again. #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ tests/platforms/
tests/node_modules/
example/node_modules/
example/platforms/
example/**/*.js
dist/
src/**/*.js
4 changes: 2 additions & 2 deletions compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ node_modules/.bin/tsc -p "$SOURCE_DIR" --outDir "$PACK_DIR"
node_modules/tslint/bin/tslint --project "$SOURCE_DIR"/tsconfig.json --config "$SOURCE_DIR"/tslint.json

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

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

copy_package_files
5 changes: 0 additions & 5 deletions example/app/app.js

This file was deleted.

1 change: 0 additions & 1 deletion example/app/app.js.map

This file was deleted.

40 changes: 0 additions & 40 deletions example/app/main-page.js

This file was deleted.

1 change: 0 additions & 1 deletion example/app/main-page.js.map

This file was deleted.

59 changes: 34 additions & 25 deletions example/app/main-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,48 @@ import { Page } from "ui/page";
import { DateTimeFormat } from "nativescript-intl";
import { fromObject, Observable } from "data/observable";

var model: Observable;
let model: Observable;
let mediumDateTimeOptions = {
"year": "numeric",
"month": "short",
"day": "numeric",
"hour": "numeric",
"minute": "2-digit",
"second": "numeric"
};
let longDateOptions = {
"year": "numeric",
"month": "long",
"day": "numeric"
};
let fullDateOptions = {
"year": "numeric",
"month": "long",
"day": "numeric",
"weekday": "long"
};
let shortDateTimeOptions = {
"year": "numeric",
"month": "numeric",
"day": "numeric",
"hour": "numeric",
"minute": "numeric"
};

export function onNavigating(args: EventData) {
let page = <Page>args.object;
model = fromObject({"mediumDateTimeOptions": "", "longDateOptions": "", "fullDateOptions": "", "shortDateTimeOptions": ""});
model = fromObject({
"mediumDateTimeOptions": "",
"longDateOptions": "",
"fullDateOptions": "",
"shortDateTimeOptions": ""
});
page.bindingContext = model;
}

export function onTap() {
var mediumDateTimeOptions = {
"year": "numeric",
"month": "short",
"day": "numeric",
"hour": "numeric",
"minute": "2-digit",
"second": "numeric"
};
model.set("mediumDateTimeOptions", new DateTimeFormat("en-US", mediumDateTimeOptions).format(new Date()));
var longDateOptions = {"year": "numeric", "month": "long", "day": "numeric"};
model.set("longDateOptions", new DateTimeFormat("en-US", longDateOptions).format(new Date()));
var fullDateOptions = {
"year": "numeric",
"month": "long",
"day": "numeric",
"weekday": "long"
};
model.set("fullDateOptions", new DateTimeFormat("en-US", fullDateOptions).format(new Date()));
var shortDateTimeOptions = {
"year": "numeric",
"month": "numeric",
"day": "numeric",
"hour": "numeric",
"minute": "numeric"
};
model.set("shortDateTimeOptions", new DateTimeFormat("en-US", fullDateOptions).format(new Date()));
model.set("shortDateTimeOptions", new DateTimeFormat("en-US", shortDateTimeOptions).format(new Date()));
}
8 changes: 4 additions & 4 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
"nativescript": {
"id": "org.nativescript.example",
"tns-android": {
"version": "2.4.0"
"version": "2.5.0-next-2016-12-19-1539"
}
},
"dependencies": {
"nativescript-intl": "file:..\\dist\\nativescript-intl-0.0.9.tgz",
"nativescript-theme-core": "^0.2.1",
"tns-core-modules": "2.4.0",
"nativescript-intl": "file:..\\dist\\nativescript-intl-0.0.9.tgz"
"tns-core-modules": "2.4.0"
},
"devDependencies": {
"babel-traverse": "6.19.0",
Expand All @@ -23,4 +23,4 @@
"nativescript-dev-typescript": "^0.3.2",
"typescript": "^2.0.10"
}
}
}
2 changes: 1 addition & 1 deletion src/nativescript-intl-common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
DateTimeFormatOptions as intlDateTimeFormatOptions,
NumberFormat as intlNumberFormat,
NumberFormatOptions as intlNumberFormatOptions
} from "nativescript-intl";
} from "./nativescript-intl";

export const NUMERIC = "numeric";
export const LONG = "long";
Expand Down
2 changes: 1 addition & 1 deletion src/nativescript-intl.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
NumberFormat as commonNumberFormat,
FULL
} from "./nativescript-intl-common";
import { NumberFormatOptions } from "nativescript-intl";
import { NumberFormatOptions } from "./nativescript-intl";

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

Expand Down
2 changes: 1 addition & 1 deletion src/nativescript-intl.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
NumberFormat as commonNumberFormat,
FULL
} from "./nativescript-intl-common";
import { NumberFormatOptions } from "nativescript-intl";
import { NumberFormatOptions } from "./nativescript-intl";

export class DateTimeFormat extends commonDateTimeFormat {
public getNativePattern(patternDefinition: {date?: string, time?: string}, locale?: string): string {
Expand Down
2 changes: 0 additions & 2 deletions src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
"name": "nativescript-intl",
"version": "0.0.9",
"description": "Provides API for using Native date, time and number formatting with an API similar to Intl.js",
"main": "bundle",
"module": "index",
"nativescript": {
"platforms": {
"android": "2.3.0",
Expand Down
12 changes: 3 additions & 9 deletions src/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"module": "es6",
"target": "es6",
"module": "commonjs",
"target": "es5",
"noImplicitAny": false,
"removeComments": true,
"preserveConstEnums": true,
Expand All @@ -13,14 +13,8 @@
},
"filesGlob": [
"./**/*.ts",
"./**/*.d.ts",
"!./node_modules/**/*.ts"
],
"files": [
"references.d.ts",
"nativescript-intl-common.ts",
"nativescript-intl.android.ts",
"nativescript-intl.ios.ts",
"index.ts"
],
"exclude": []
}