Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

updates to expose pnp and pnp.default, removes string replace in package #110

Merged
merged 2 commits into from
May 17, 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 .npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.npmignore
.github
bower.json
gulpfile.js
jsconfig.json
Expand Down
10 changes: 3 additions & 7 deletions buildtasks/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function packageLib() {
var packageProject = tsc.createProject({
"declaration": true,
"removeComments": false,
"module": "es5",
"module": "umd",
"target": "es5",
"jsx": "react"
});
Expand All @@ -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));
Expand All @@ -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())
Expand All @@ -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())
Expand All @@ -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())
Expand Down
54 changes: 39 additions & 15 deletions src/pnp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}