From eddd4d69c0ccf74bf69eb278f855c9c25c9ac676 Mon Sep 17 00:00:00 2001 From: Patrick Date: Mon, 16 May 2016 15:54:29 -0400 Subject: [PATCH 1/2] updates to expose pnp and pnp.default, removes string replace in package --- .npmignore | 1 + .vscode/settings.json | 2 +- buildtasks/package.js | 10 +++----- src/pnp.ts | 54 +++++++++++++++++++++++++++++++------------ 4 files changed, 44 insertions(+), 23 deletions(-) diff --git a/.npmignore b/.npmignore index 17638f97..7e4a3c33 100644 --- a/.npmignore +++ b/.npmignore @@ -1,4 +1,5 @@ .npmignore +.github bower.json gulpfile.js jsconfig.json diff --git a/.vscode/settings.json b/.vscode/settings.json index 4c8bcbec..88264f94 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,7 +3,7 @@ "files.exclude": { "**/.git": true, "**/.DS_Store": true, - "lib/": true, + "lib/": false, "build/": true, "node_modules/": true, "server-root/require.js": true, diff --git a/buildtasks/package.js b/buildtasks/package.js index e89c291f..569e6903 100644 --- a/buildtasks/package.js +++ b/buildtasks/package.js @@ -68,7 +68,7 @@ function packageLib() { var packageProject = tsc.createProject({ "declaration": true, "removeComments": false, - "module": "es5", + "module": "umd", "target": "es5", "jsx": "react" }); @@ -90,8 +90,6 @@ function packageBundle() { standalone: '$pnp', }).ignore('*.d.ts').bundle() .pipe(src(global.TSDist.BundleFileName)) - .pipe(replace(/Object\.defineProperty\(exports, "__esModule", \{ value: true \}\);/ig, "")) - .pipe(replace(/exports.default = PnP;/ig, "return PnP;")) .pipe(buffer()) .pipe(header(banner, { pkg: global.pkg })) .pipe(gulp.dest(global.TSDist.RootFolder)); @@ -107,8 +105,6 @@ function packageBundleUglify() { standalone: '$pnp', }).ignore('*.d.ts').bundle() .pipe(src(global.TSDist.MinifyFileName)) - .pipe(replace(/Object\.defineProperty\(exports, "__esModule", \{ value: true \}\);/ig, "")) - .pipe(replace(/exports.default = PnP;/ig, "return PnP;")) .pipe(buffer()) .pipe(srcmaps.init({ loadMaps: true })) .pipe(uglify()) @@ -123,7 +119,7 @@ function packageProvisioningBundle() { return browserify('./build/src/sharepoint/provisioning/provisioning.js', { debug: false, - standalone: '$pnpProvisioning', + standalone: '$pnp.Provisioning', }).ignore('*.d.ts').bundle() .pipe(src("pnp-provisioning.js")) .pipe(buffer()) @@ -138,7 +134,7 @@ function packageProvisioningBundleUglify() { return browserify('./build/src/sharepoint/provisioning/provisioning.js', { debug: false, - standalone: '$pnpProvisioning', + standalone: '$pnp.Provisioning', }).ignore('*.d.ts').bundle() .pipe(src("pnp-provisioning.min.js")) .pipe(buffer()) diff --git a/src/pnp.ts b/src/pnp.ts index 71148709..0bec0d64 100644 --- a/src/pnp.ts +++ b/src/pnp.ts @@ -9,30 +9,54 @@ import { Rest } from "./SharePoint/Rest/rest"; /** * Root class of the Patterns and Practices namespace, provides an entry point to the library */ -export default class PnP { +/** + * Utility methods + */ +export const util = Util; + +/** + * Provides access to the REST interface + */ +export const sp = new Rest(); + +/** + * Provides access to local and session storage + */ +export const storage: PnPClientStorage = new PnPClientStorage(); + +/** + * Global configuration instance to which providers can be added + */ +export const config = new Settings(); + +/** + * Global logging instance to which subscribers can be registered and messages written + */ +export const log = Logger; + +/** + * Enables use of the import pnp from syntax + */ +export default { /** - * Utility methods + * Global configuration instance to which providers can be added */ - public static util = Util; - + config: config, /** - * Provides easy access to the REST interface + * Global logging instance to which subscribers can be registered and messages written */ - public static sp = new Rest(); - + log: log, /** - * Provides access to local and session storage + * Provides access to the REST interface */ - public static storage = new PnPClientStorage(); - + sp: sp, /** - * Global configuration instance to which providers can be added + * Provides access to local and session storage */ - public static config = new Settings(); - + storage: storage, /** - * Global logging instance to which subscribers can be registered and messages written + * Utility methods */ - public static log = Logger; + util: util, } From a1048e97d8f5df022c27310724ba3ad0852112b6 Mon Sep 17 00:00:00 2001 From: Patrick Date: Mon, 16 May 2016 16:04:59 -0400 Subject: [PATCH 2/2] fixing settings.json --- .vscode/settings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 88264f94..4c8bcbec 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,7 +3,7 @@ "files.exclude": { "**/.git": true, "**/.DS_Store": true, - "lib/": false, + "lib/": true, "build/": true, "node_modules/": true, "server-root/require.js": true,