Skip to content
This repository has been archived by the owner on Jun 18, 2019. It is now read-only.

Commit

Permalink
Revert exposing core back to exposing old pnp with the gulp replace t…
Browse files Browse the repository at this point in the history
…ransform
  • Loading branch information
pbjorklund committed May 5, 2016
1 parent ccaff21 commit 99efb57
Show file tree
Hide file tree
Showing 87 changed files with 101 additions and 95 deletions.
4 changes: 3 additions & 1 deletion buildtasks/build.js
Expand Up @@ -13,6 +13,7 @@

var gulp = require("gulp"),
tsc = require("gulp-typescript"),
print = require('gulp-print'),
replace = require('gulp-replace');

//******************************************************************************
Expand All @@ -25,5 +26,6 @@ gulp.task("build", ["lint", "build-typings", "clean"], function () {
return gulp.src(src)
.pipe(tsc(global.tsProject))
.js.pipe(replace(/(\(function \(factory\) {)/g, '$1/* istanbul ignore next */'))
.pipe(gulp.dest(global.TSCompiledOutput.RootFolder));
.pipe(gulp.dest(global.TSCompiledOutput.RootFolder))
.pipe(print());
});
15 changes: 10 additions & 5 deletions buildtasks/package.js
@@ -1,7 +1,7 @@
//******************************************************************************
//* package.js
//*
//* Defines a custom gulp task for creating core.js, core.min.js,
//* Defines a custom gulp task for creating pnp.js, pnp.min.js,
//* provisioning.js, provisioning.min.js
//* and pnp/provisioning.min.js.map in the dist folder
//******************************************************************************
Expand All @@ -20,7 +20,8 @@ var gulp = require("gulp"),
buffer = require("vinyl-buffer"),
header = require('gulp-header'),
srcmaps = require("gulp-sourcemaps"),
merge = require("merge2");
merge = require("merge2"),
replace = require("gulp-replace");

// we need to build src (es5, umd) -> build
// we need to package the definitions in a single file -> dist
Expand Down Expand Up @@ -79,6 +80,8 @@ function packageBundle(file) {
external: ["es6-promise", "jquery", "whatwg-fetch", "node-fetch"]
}).ignore('*.d.ts').bundle()
.pipe(src(file + ".js"))
.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 @@ -95,6 +98,8 @@ function packageBundleUglify(file) {
external: ["es6-promise", "jquery", "whatwg-fetch", "node-fetch"]
}).ignore('*.d.ts').bundle()
.pipe(src(file + ".min"))
.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 @@ -107,10 +112,10 @@ function packageBundleUglify(file) {
//* PACKAGE
//******************************************************************************
gulp.task("package", ["build", "test"], function () {
packageDefinitions("core");
packageDefinitions("pnp");
packageLib();
packageBundle("core");
packageBundleUglify("core");
packageBundle("pnp");
packageBundleUglify("pnp");

packageDefinitions("provisioning");
packageLib();
Expand Down
2 changes: 1 addition & 1 deletion gulpfile.js
Expand Up @@ -28,7 +28,7 @@ global.TSCompiledOutput = {

global.TSWorkspace = {
"RootFolder": 'src',
"PnPFile": "src/core.ts",
"PnPFile": "src/pnp.ts",
"Files": [
'src/**/*.ts',
],
Expand Down
5 changes: 2 additions & 3 deletions server-root/index.html
Expand Up @@ -9,10 +9,9 @@
<script src="./require.js" type="text/javascript"></script>

<script type="text/javascript">
require(['scripts/core'], function(pnp) {
require(['scripts/pnp'], function(pnp) {

var core = new pnp.Core();
alert("our random string: " + core.util.getRandomString(5));
alert("our random string: " + pnp.util.getRandomString(5));
});

require(['scripts/provisioning'], function(pnp) {
Expand Down
43 changes: 0 additions & 43 deletions src/core.ts

This file was deleted.

43 changes: 43 additions & 0 deletions src/pnp.ts
@@ -0,0 +1,43 @@
"use strict";

import { Util } from "./pnp/utils/Util";
import { SharePoint } from "./pnp/SharePoint/SharePoint";
import { PnPClientStorage } from "./pnp/utils/Storage";
import * as Configuration from "./pnp/configuration/configuration";
import { Logger } from "./pnp/utils/logging";
import { Rest } from "./pnp/SharePoint/Rest/rest";

/**
* Root class of the Patterns and Practices namespace, provides an entry point to the library
*/
export default class PnP {
/**
* Utility methods
*/
public static util = Util;

/**
* The full SharePoint library
*/
public static sharepoint = new SharePoint();

/**
* Provides easy access to the REST interface
*/
public static sp = new Rest();

/**
* Provides access to local and session storage
*/
public static storage: PnPClientStorage = new PnPClientStorage();

/**
* Global configuration instance to which providers can be added
*/
public static configuration = Configuration;

/**
* Global logging instance to which subscribers can be registered and messages written
*/
public static log = Logger;
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/provisioning/core/core.ts
Expand Up @@ -10,7 +10,7 @@ import { ObjectComposedLook } from "../ObjectHandlers/ObjectComposedLook/ObjectC
import { ObjectCustomActions } from "../ObjectHandlers/ObjectCustomActions/ObjectCustomActions";
import { ObjectFiles } from "../ObjectHandlers/ObjectFiles/ObjectFiles";
import { ObjectLists } from "../ObjectHandlers/ObjectLists/ObjectLists";
import { replaceUrlTokens } from "../../core/sharepoint/util";
import { replaceUrlTokens } from "../../pnp/sharepoint/util";
import * as Resources from "../Resources/Resources";
import { Log } from "../Provisioning";
import { SiteSchema } from "../schema/isiteschema";
Expand Down
Expand Up @@ -2,7 +2,7 @@

import { IComposedLook } from "../schema/icomposedlook";

import { replaceUrlTokens, getRelativeUrl } from "../../../core/sharepoint/util";
import { replaceUrlTokens, getRelativeUrl } from "../../../pnp/sharepoint/util";
import { ObjectHandlerBase } from "../ObjectHandlerBase/ObjectHandlerBase";

export class ObjectComposedLook extends ObjectHandlerBase {
Expand Down
2 changes: 1 addition & 1 deletion src/provisioning/objecthandlers/objectfiles/objectfiles.ts
@@ -1,7 +1,7 @@
"use strict";

// import { Promise } from "es6-promise";
import { replaceUrlTokens } from "../../../core/sharepoint/util";
import { replaceUrlTokens } from "../../../pnp/sharepoint/util";
import { ObjectHandlerBase } from "../ObjectHandlerBase/ObjectHandlerBase";
import { IFile } from "../schema/ifile";
import { IWebPart } from "../schema/iwebpart";
Expand Down
@@ -1,7 +1,7 @@
"use strict";

// import { Promise } from "es6-promise";
import { getNodeFromCollectionByTitle, replaceUrlTokens } from "../../../core/sharepoint/util";
import { getNodeFromCollectionByTitle, replaceUrlTokens } from "../../../pnp/sharepoint/util";
import { ObjectHandlerBase } from "../ObjectHandlerBase/ObjectHandlerBase";
import { INavigation } from "../schema/inavigation";
import { INavigationNode } from "../schema/inavigationnode";
Expand Down
@@ -1,7 +1,7 @@
"use strict";

// import { Promise } from "es6-promise";
import { encodePropertyKey } from "../../../core/sharepoint/util";
import { encodePropertyKey } from "../../../pnp/sharepoint/util";
import { ObjectHandlerBase } from "../ObjectHandlerBase/ObjectHandlerBase";
import { IPropertyBagEntry } from "../../schema/ipropertybagentry";

Expand Down
2 changes: 1 addition & 1 deletion tests/core/collections/collections.test.ts
@@ -1,7 +1,7 @@
"use strict";

import { expect } from "chai";
import * as Collections from "../../../src/core/collections/collections";
import * as Collections from "../../../src/pnp/collections/collections";

describe("Collections", () => {

Expand Down
4 changes: 2 additions & 2 deletions tests/core/configuration/configuration.test.ts
@@ -1,8 +1,8 @@
"use strict";

import { expect } from "chai";
import * as Collections from "../../../src/core/collections/collections";
import * as Configuration from "../../../src/core/configuration/configuration";
import * as Collections from "../../../src/pnp/collections/collections";
import * as Configuration from "../../../src/pnp/configuration/configuration";
import {default as MockConfigurationProvider} from "../mocks/mockConfigurationProvider";

describe("Configuration", () => {
Expand Down
@@ -1,10 +1,10 @@
import { expect } from "chai";
import { default as CachingConfigurationProvider } from "../../../../src/core/configuration/providers/cachingConfigurationProvider";
import * as Collections from "../../../../src/core/collections/collections";
import * as Configuration from "../../../../src/core/configuration/configuration";
import { default as CachingConfigurationProvider } from "../../../../src/pnp/configuration/providers/cachingConfigurationProvider";
import * as Collections from "../../../../src/pnp/collections/collections";
import * as Configuration from "../../../../src/pnp/configuration/configuration";
import {default as MockConfigurationProvider} from "../../mocks/mockConfigurationProvider";
import MockStorage from "../../mocks/MockStorage";
import * as storage from "../../../../src/core/utils/storage";
import * as storage from "../../../../src/pnp/utils/storage";

describe("Configuration", () => {

Expand Down
@@ -1,7 +1,7 @@
import { expect } from "chai";
import { default as SPListConfigurationProvider } from "../../../../src/core/configuration/providers/spListConfigurationProvider";
import { default as SPListConfigurationProvider } from "../../../../src/pnp/configuration/providers/spListConfigurationProvider";
import MockStorage from "../../mocks/MockStorage";
import * as Collections from "../../../../src/core/collections/collections";
import * as Collections from "../../../../src/pnp/collections/collections";

declare var global: any;

Expand Down
4 changes: 2 additions & 2 deletions tests/core/mocks/MockConfigurationProvider.ts
@@ -1,7 +1,7 @@
"use strict";

import { IConfigurationProvider } from "../../../src/core/configuration/configuration";
import { TypedHash } from "../../../src/core/collections/collections";
import { IConfigurationProvider } from "../../../src/pnp/configuration/configuration";
import { TypedHash } from "../../../src/pnp/collections/collections";

export default class MockConfigurationProvider implements IConfigurationProvider {
public shouldThrow: boolean = false;
Expand Down
2 changes: 1 addition & 1 deletion tests/core/mocks/MockStorage.ts
@@ -1,6 +1,6 @@
"use strict";

import * as Collections from "../../../src/core/collections/collections";
import * as Collections from "../../../src/pnp/collections/collections";

export default class MockStorage implements Storage {
constructor() {
Expand Down
2 changes: 1 addition & 1 deletion tests/core/sharepoint/rest/contenttypes.test.ts
@@ -1,7 +1,7 @@
"use strict";

import { expect } from "chai";
import { ContentTypes } from "../../../../src/core/sharepoint/rest/ContentTypes";
import { ContentTypes } from "../../../../src/pnp/sharepoint/rest/ContentTypes";

describe("ContentTypes", () => {
it("Should be an object", () => {
Expand Down
4 changes: 2 additions & 2 deletions tests/core/sharepoint/rest/fields.test.ts
@@ -1,8 +1,8 @@
"use strict";

import { Util } from "../../../../src/core/utils/util";
import { Util } from "../../../../src/pnp/utils/util";
import { expect } from "chai";
import { Fields, Field } from "../../../../src/core/sharepoint/rest/fields";
import { Fields, Field } from "../../../../src/pnp/sharepoint/rest/fields";

describe("Fields", () => {

Expand Down
4 changes: 2 additions & 2 deletions tests/core/sharepoint/rest/items.test.ts
@@ -1,7 +1,7 @@
"use strict";
import { Util } from "../../../../src/core/utils/util";
import { Util } from "../../../../src/pnp/utils/util";
import { expect } from "chai";
import { Items, Item } from "../../../../src/core/sharepoint/rest/items";
import { Items, Item } from "../../../../src/pnp/sharepoint/rest/items";

describe("Items", () => {

Expand Down
2 changes: 1 addition & 1 deletion tests/core/sharepoint/rest/lists.test.ts
@@ -1,7 +1,7 @@
"use strict";

import { expect } from "chai";
import { Lists, List } from "../../../../src/core/sharepoint/rest/lists";
import { Lists, List } from "../../../../src/pnp/sharepoint/rest/lists";

describe("Lists", () => {

Expand Down
2 changes: 1 addition & 1 deletion tests/core/sharepoint/rest/navigation.test.ts
@@ -1,7 +1,7 @@
"use strict";

import { expect } from "chai";
import { Navigation } from "../../../../src/core/sharepoint/rest/navigation";
import { Navigation } from "../../../../src/pnp/sharepoint/rest/navigation";

describe("Navigation", () => {
it("Should be an object", () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/core/sharepoint/rest/quicklaunch.test.ts
@@ -1,7 +1,7 @@
"use strict";

import { expect } from "chai";
import { QuickLaunch } from "../../../../src/core/sharepoint/rest/quickLaunch";
import { QuickLaunch } from "../../../../src/pnp/sharepoint/rest/quickLaunch";

describe("QuickLaunch", () => {
it("Should be an object", () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/core/sharepoint/rest/roleassignments.test.ts
@@ -1,7 +1,7 @@
"use strict";

import { expect } from "chai";
import { RoleAssignments } from "../../../../src/core/sharepoint/rest/roleAssignments";
import { RoleAssignments } from "../../../../src/pnp/sharepoint/rest/roleAssignments";

describe("RoleAssignments", () => {
it("Should be an object", () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/core/sharepoint/rest/search.test.ts
@@ -1,7 +1,7 @@
"use strict";

import { expect } from "chai";
import { Search } from "../../../../src/core/sharepoint/rest/search";
import { Search } from "../../../../src/pnp/sharepoint/rest/search";

describe("Search", () => {
it("Should be an object", () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/core/sharepoint/rest/siteusers.test.ts
@@ -1,7 +1,7 @@
"use strict";

import { expect } from "chai";
import { SiteUsers } from "../../../../src/core/sharepoint/rest/siteUsers";
import { SiteUsers } from "../../../../src/pnp/sharepoint/rest/siteUsers";

describe("SiteUsers", () => {
it("Should be an object", () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/core/sharepoint/rest/topnavigationbar.test.ts
@@ -1,7 +1,7 @@
"use strict";

import { expect } from "chai";
import { TopNavigationBar } from "../../../../src/core/sharepoint/rest/topNavigationBar";
import { TopNavigationBar } from "../../../../src/pnp/sharepoint/rest/topNavigationBar";

describe("TopNavigationBar", () => {
it("Should be an object", () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/core/sharepoint/rest/views.test.ts
@@ -1,7 +1,7 @@
"use strict";

import { expect } from "chai";
import { Views } from "../../../../src/core/sharepoint/rest/views";
import { Views } from "../../../../src/pnp/sharepoint/rest/views";

describe("Views", () => {
it("Should be an object", () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/core/sharepoint/rest/web.test.ts
@@ -1,7 +1,7 @@
"use strict";

import { expect } from "chai";
import { Web } from "../../../../src/core/sharepoint/rest/webs";
import { Web } from "../../../../src/pnp/sharepoint/rest/webs";

describe("Web", () => {

Expand Down

0 comments on commit 99efb57

Please sign in to comment.