Skip to content

Commit

Permalink
build, package, test, lint, serve all working - beta9
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick-rodgers committed Dec 16, 2020
1 parent cce16ae commit 14e33a1
Show file tree
Hide file tree
Showing 35 changed files with 582 additions and 457 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -38,6 +38,7 @@ debug/launch/*
!debug/launch/sp.ts
!debug/launch/graph.ts
!debug/launch/tsconfig.json
!debug/launch/setup.ts

debug/serve/*
!debug/serve/main.ts
Expand Down
2 changes: 1 addition & 1 deletion .mocharc.js
Expand Up @@ -53,7 +53,7 @@ const config = {
ui: "bdd",
retries: "2",
require: [
resolve("./", "tools/local-module-resolver/register.js"),
resolve("./", "build/testing/tools/local-module-resolver/register.js"),
],
spec: paths,
};
Expand Down
6 changes: 3 additions & 3 deletions .vscode/settings.json
Expand Up @@ -3,12 +3,12 @@
"files.exclude": {
"**/.git": true,
"**/.DS_Store": true,
"lib": true,
"lib": false,
"**/node_modules": true,
"coverage": true,
".nyc_output": true,
"build": true,
"dist": true,
"build": false,
"dist": false,
"site": true
},
"typescript.validate.enable": true,
Expand Down
22 changes: 22 additions & 0 deletions CHANGELOG.md
Expand Up @@ -5,6 +5,28 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## 2.0.13 - 2020-Dec-14

### Added

- graph: Added new method to get the Team Site for a Group [@RamPrasadMeenavalli](https://github.com/RamPrasadMeenavalli) [[PR](https://github.com/pnp/pnpjs/pull/1446)]
- general: Adding MSAL support for local dev and tests, updating actions to use [@patrick-rodgers](https://github.com/patrick-rodgers) [[PR](https://github.com/pnp/pnpjs/pull/1454)]
- sp: Adds and updates for Taxonomy issues [@patrick-rodgers](https://github.com/patrick-rodgers) [[PR](https://github.com/pnp/pnpjs/pull/1465)]
- graph: Add create for teams endpoint, Adds team getOperationId, Updates cloneTeam response type [@juliemturner](https://github.com/juliemturner) [[PR](https://github.com/pnp/pnpjs/pull/1469)]

### Changed

- docs: Updated SPFx On-Prem & TypeScript (alternative) docs [@koltyakov](https://github.com/koltyakov) [[PR](https://github.com/pnp/pnpjs/pull/1473)]
- sp: Add NextHref prop in IRenderListDataAsStreamResult [@Leomaradan](https://github.com/Leomaradan) [[PR](https://github.com/pnp/pnpjs/pull/1453)]

### Fixed

- sp: Fixed issue with addChunked method [@tavikukko](https://github.com/tavikukko) [[PR](https://github.com/pnp/pnpjs/pull/1463)]
- docs: Updating methods for valid syntax [@bcameron1231](https://github.com/bcameron1231) [[PR](https://github.com/pnp/pnpjs/pull/1459)]
- docs: HubSite Documentation Fix [@juliemturner](https://github.com/juliemturner) [[PR](https://github.com/pnp/pnpjs/pull/1450)]
- docs: Spelling fix sp-app-registration.md [@RamPrasadMeenavalli](https://github.com/RamPrasadMeenavalli) [[PR](https://github.com/pnp/pnpjs/pull/1442)]
- docs: Spelling fix mkdocs.yml [@RamPrasadMeenavalli](https://github.com/RamPrasadMeenavalli) [[PR](https://github.com/pnp/pnpjs/pull/1441)]

## 2.0.12 - 2020-Nov-16

### Added
Expand Down
48 changes: 24 additions & 24 deletions buildsystem-config.ts
Expand Up @@ -41,7 +41,7 @@ export default <ConfigCollection>[
},
<PackageSchema>{

name: "package",
name: "package",

role: "package",

Expand All @@ -55,9 +55,9 @@ export default <ConfigCollection>[
Tasks.Package.createCopyTargetFiles(),
Tasks.Package.copyStaticAssets,
Tasks.Package.createWritePackageFiles((p) => {
return Object.assign({ }, p, {
funding: {
"type": "individual",
return Object.assign({}, p, {
funding: {
"type": "individual",
"url": "https://github.com/sponsors/patrick-rodgers/",
},
type: "module",
Expand All @@ -83,9 +83,9 @@ export default <ConfigCollection>[
Tasks.Package.copyStaticAssets,
Tasks.Package.createWritePackageFiles(p => {

const newP = Object.assign({ }, p, {
funding: {
"type": "individual",
const newP = Object.assign({}, p, {
funding: {
"type": "individual",
"url": "https://github.com/sponsors/patrick-rodgers/",
},
type: "commonjs",
Expand All @@ -94,7 +94,7 @@ export default <ConfigCollection>[
// selective imports don't work in commonjs or matter for nodejs
// so we retarget main to the preset for these libraries (and update typings pointer)
if (newP.name.match(/\/sp$|\/graph$/)) {
newP.main = "./presets/all.js";
newP.main = "./presets/all.js";
newP.typings = "./presets/all";
}

Expand All @@ -103,13 +103,13 @@ export default <ConfigCollection>[

// and we need to rewrite the dependencies to point to the commonjs ones
if (newP.dependencies) {
const newDeps = { };
const newDeps = {};
for (const key in newP.dependencies) {

if (key.startsWith("@pnp/")) {
newDeps[`${key}-commonjs`] = newP.dependencies[key];
newDeps[`${key}-commonjs`] = newP.dependencies[key];
} else {
newDeps[key] = newP.dependencies[key];
newDeps[key] = newP.dependencies[key];
}
}

Expand All @@ -128,27 +128,27 @@ export default <ConfigCollection>[
entry: resolve("./build/packages/esm/pnpjs/index.js"),
mode: "production",
output: {
filename: "pnp.js",
filename: "pnp.js",
library: "pnp",
libraryTarget: "umd",
path: resolve("./dist/packages/esm/pnpjs/dist"),
},
performance: {
// we are making a big package, but this is designed to be non-optimal
maxAssetSize: 400000,
// we are making a big package, but this is designed to be non-optimal
maxAssetSize: 400000,
maxEntrypointSize: 400000,
},
plugins: [
new wp.BannerPlugin({
banner,
raw: true,
banner,
raw: true,
}),
],
resolve: {
alias: {
// a list of module name aliases
// aliases are imported relative to the current context
"@pnp/adaljsclient": resolve(__dirname, "build/packages/esm/adaljsclient"),
alias: {
// a list of module name aliases
// aliases are imported relative to the current context
"@pnp/adaljsclient": resolve(__dirname, "build/packages/esm/adaljsclient"),
"@pnp/common": resolve(__dirname, "build/packages/esm/common"),
"@pnp/logging": resolve(__dirname, "build/packages/esm/logging"),
// tslint:disable-next-line: object-literal-sort-keys
Expand All @@ -162,15 +162,15 @@ export default <ConfigCollection>[
extensions: [".js", ".ts", ".json"],
},
stats: {
assets: false,
assets: false,
colors: true,
},
}),
],
},
<PublishSchema>{

name: "publish",
name: "publish",

role: "publish",

Expand All @@ -186,7 +186,7 @@ export default <ConfigCollection>[
postPublishTasks: [],
},
<BuildSchema>{
name: "build-debug",
name: "build-debug",

role: "build",

Expand All @@ -206,7 +206,7 @@ export default <ConfigCollection>[
},
<PublishSchema>{

name: "publish-beta",
name: "publish-beta",

role: "publish",

Expand Down
2 changes: 1 addition & 1 deletion debug/launch/graph.ts
@@ -1,6 +1,6 @@
import { Logger, LogLevel } from "@pnp/logging";
import { graph } from "@pnp/graph";
import { graphSetup } from "./setup";
import { graphSetup } from "./setup.js";
import "@pnp/graph/groups";

declare var process: { exit(code?: number): void };
Expand Down
4 changes: 2 additions & 2 deletions debug/launch/main.ts
@@ -1,14 +1,14 @@
import * as findup from "findup-sync";
import { ConsoleListener, LogLevel, Logger } from "@pnp/logging";
import { ITestingSettings } from "../../test/settings";
import { ITestingSettings } from "../../test/settings.js";

// importing the example debug scenario and running it
// adding your debugging to other files and importing them will keep them out of git
// PRs updating the debug.ts or example.ts will not be accepted unless they are fixing bugs
// add your debugging imports here and prior to submitting a PR git checkout debug/debug.ts
// will allow you to keep all your debugging files locally
// comment out the example
import { Example } from "./sp";
import { Example } from "./sp.js";

// setup the connection to SharePoint using the settings file, you can
// override any of the values as you want here, just be sure not to commit
Expand Down
53 changes: 53 additions & 0 deletions debug/launch/setup.ts
@@ -0,0 +1,53 @@
import { ITestingSettings } from "../../test/settings.js";
import { SPFetchClient, MsalFetchClient, AdalFetchClient } from "@pnp/nodejs";
import { sp } from "@pnp/sp";
import { graph } from "@pnp/graph";

export async function spSetup(settings: ITestingSettings): Promise<void> {

// if we have an msal section, use that one
if (settings.testing.sp.msal) {
sp.setup({
sp: {
baseUrl: settings.testing.sp.url,
fetchClientFactory: () => {
return new MsalFetchClient(settings.testing.sp.msal.init, settings.testing.sp.msal.scopes);
},
},
});

} else {
// configure your node options
sp.setup({
sp: {
fetchClientFactory: () => {
return new SPFetchClient(settings.testing.sp.url, settings.testing.sp.id, settings.testing.sp.secret);
},
},
});
}
}

export async function graphSetup(settings: ITestingSettings): Promise<void> {

// if we have an msal section, use that one
if (settings.testing.graph.msal) {
graph.setup({
graph: {
fetchClientFactory: () => {
return new MsalFetchClient(settings.testing.graph.msal.init, settings.testing.graph.msal.scopes);
},
},
});

} else {
// configure your node options
graph.setup({
graph: {
fetchClientFactory: () => {
return new AdalFetchClient(settings.testing.graph.tenant, settings.testing.graph.id, settings.testing.graph.secret);
},
},
});
}
}
4 changes: 2 additions & 2 deletions debug/launch/sp.ts
@@ -1,7 +1,7 @@
import { ITestingSettings } from "../../test/settings";
import { ITestingSettings } from "../../test/settings.js";
import { Logger, LogLevel } from "@pnp/logging";
import { sp } from "@pnp/sp";
import { spSetup } from "./setup";
import { spSetup } from "./setup.js";
import "@pnp/sp/webs";

declare var process: { exit(code?: number): void };
Expand Down
4 changes: 2 additions & 2 deletions debug/serve/main.ts
@@ -1,5 +1,5 @@
import { sp } from "@pnp/sp/presets/all";
import { graph } from "@pnp/graph/presets/all";
// import { graph } from "@pnp/graph/presets/all";

// ******
// Please edit this file and do any testing required. Please do not submit changes as part of a PR.
Expand All @@ -25,7 +25,7 @@ document.onreadystatechange = async () => {

try {

const r = await sp.web.get();
const r = await sp.web();

html.push(`<textarea cols="200" rows="40">${JSON.stringify(r, null, 4)}</textarea>`);

Expand Down
37 changes: 9 additions & 28 deletions debug/serve/tsconfig.json
@@ -1,33 +1,14 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"target": "es2015",
"module": "commonjs",
"baseUrl": ".",
"rootDir": "../../",
"outDir": "../../serve/",
"declaration": true,
"declarationMap": true,
"types": [
"sharepoint"
],
"lib": [
"es6",
"dom"
],
"paths": {
"@pnp/*": [
"../../packages/*"
]
},
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
"inlineSources": true,
"sourceMap": true,
"skipDefaultLibCheck": true,
"skipLibCheck": true,
"experimentalDecorators": true
"outDir": "../../build/server/",
"noUnusedLocals": false,
"noUnusedParameters": false,
"composite": false,
"incremental": true,
},
"files": [
"./main.ts"
"include": [
"./**/*.ts",
"../../packages/**/*.ts"
]
}
38 changes: 32 additions & 6 deletions docs/SPFx-on-premises.md
Expand Up @@ -16,14 +16,40 @@ npm i -g rimraf # used to remove the node_modules folder (much better/faster)
1. Replace "2.4.1" or "2.2.2" with "3.6.4"
1. Search for the next `"typescript"` occurrence and replace the block with:

```JSON
```JSON
"typescript": {
"version": "3.6.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.6.4.tgz",
"integrity": "sha512-unoCll1+l+YK4i4F8f22TaNVPRHcD9PA3yCuZ8g5e0qGqlVlJ/8FSateOLLSagn+Yg5+ZwuPkL8LFUc0Jcvksg==",
"dev": true
"version": "3.6.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.6.4.tgz",
"integrity": "sha512-unoCll1+l+YK4i4F8f22TaNVPRHcD9PA3yCuZ8g5e0qGqlVlJ/8FSateOLLSagn+Yg5+ZwuPkL8LFUc0Jcvksg==",
"dev": true
}
```
```

1. Remove node_modules folder `rimraf node_modules`
1. Run `npm install`

## Alternative using `npm-force-resolutions`

1. Install resolutions package and TypeScript providing considered version explicitly:

```bash
npm i -D npm-force-resolutions typescript@3.6.4
```

1. Add a resolution for TypeScript and preinstall script into `package.json` to a corresponding code blocks:

```JSON
{
"scripts": {
"preinstall": "npx npm-force-resolutions"
},
"resolutions": {
"typescript": "3.6.4"
}
}
```

1. Run ```npm install``` to trigger preinstall script and bumping TypeScript version into `package-lock.json`
1. Run ```npm run build```, should produce no errors

Installing additional dependencies should be safe then.

0 comments on commit 14e33a1

Please sign in to comment.