Skip to content

Commit

Permalink
Add @select and @expand decorators in PnP JS Core sample and update p…
Browse files Browse the repository at this point in the history
…ackage json versions (#252)

* update package versions taxonomypicker

* update package json versions react-async-await-sp-pnp-js

* PnP JS Core with select and expand decorators SPFx sample

* update readme property decorators
  • Loading branch information
jquintozamora authored and VesaJuvonen committed Jul 21, 2017
1 parent d44be59 commit b8405c7
Show file tree
Hide file tree
Showing 38 changed files with 1,242 additions and 31 deletions.
23 changes: 11 additions & 12 deletions samples/react-async-await-sp-pnp-js/package.json
Expand Up @@ -6,23 +6,22 @@
"node": ">=0.10.0"
},
"dependencies": {
"@microsoft/sp-client-base": "~1.0.0",
"@microsoft/sp-core-library": "~1.0.0",
"@microsoft/sp-webpart-base": "~1.0.0",
"@microsoft/sp-core-library": "~1.1.0",
"@microsoft/sp-webpart-base": "~1.1.1",
"@types/webpack-env": ">=1.12.1 <1.14.0",
"react": "15.4.2",
"react-dom": "15.4.2",
"@types/react": "0.14.46",
"@types/react-dom": "0.14.18",
"@types/react-addons-shallow-compare": "0.14.17",
"@types/react-addons-test-utils": "0.14.15",
"@types/react-addons-update": "0.14.14",
"@types/react-dom": "0.14.18",
"@types/webpack-env": ">=1.12.1 <1.14.0",
"react": "15.5.4",
"react-dom": "15.5.4",
"sp-pnp-js": "^2.0.4"
"@types/react-addons-test-utils": "0.14.15",
"sp-pnp-js": "2.0.6"
},
"devDependencies": {
"@microsoft/sp-build-web": "~1.0.1",
"@microsoft/sp-module-interfaces": "~1.0.0",
"@microsoft/sp-webpart-workbench": "~1.0.0",
"@microsoft/sp-build-web": "~1.1.0",
"@microsoft/sp-module-interfaces": "~1.1.0",
"@microsoft/sp-webpart-workbench": "~1.1.0",
"gulp": "~3.9.1",
"@types/chai": ">=3.4.34 <3.6.0",
"@types/mocha": ">=2.2.33 <2.6.0"
Expand Down
1 change: 1 addition & 0 deletions samples/react-async-await-sp-pnp-js/tsconfig.json
Expand Up @@ -6,6 +6,7 @@
"jsx": "react",
"declaration": true,
"sourceMap": true,
"experimentalDecorators": true,
"types": [
"es6-promise",
"es6-collections",
Expand Down
25 changes: 25 additions & 0 deletions samples/react-sp-pnp-js-property-decorators/.editorconfig
@@ -0,0 +1,25 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true


[*]

# change these settings to your own preference
indent_style = space
indent_size = 2

# we recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[{package,bower}.json]
indent_style = space
indent_size = 2
1 change: 1 addition & 0 deletions samples/react-sp-pnp-js-property-decorators/.gitattributes
@@ -0,0 +1 @@
* text=auto
32 changes: 32 additions & 0 deletions samples/react-sp-pnp-js-property-decorators/.gitignore
@@ -0,0 +1,32 @@
# Logs
logs
*.log
npm-debug.log*

# Dependency directories
node_modules

# Build generated files
dist
lib
solution
temp
*.sppkg

# Coverage directory used by tools like istanbul
coverage

# OSX
.DS_Store

# Visual Studio files
.ntvs_analysis.dat
.vs
bin
obj

# Resx Generated Code
*.resx.ts

# Styles Generated Code
*.scss.ts
14 changes: 14 additions & 0 deletions samples/react-sp-pnp-js-property-decorators/.npmignore
@@ -0,0 +1,14 @@
# Folders
.vscode
coverage
node_modules
sharepoint
src
temp

# Files
*.csproj
.git*
.yo-rc.json
gulpfile.js
tsconfig.json
8 changes: 8 additions & 0 deletions samples/react-sp-pnp-js-property-decorators/.yo-rc.json
@@ -0,0 +1,8 @@
{
"@microsoft/generator-sharepoint": {
"libraryName": "react-sp-pnp-js-property-decorators",
"framework": "react",
"version": "1.0.2",
"libraryId": "a843ff35-51f4-4e36-99f7-f077a93f8d37"
}
}
52 changes: 52 additions & 0 deletions samples/react-sp-pnp-js-property-decorators/README.md
@@ -0,0 +1,52 @@
# React sample showing the use of PnP JS Core custom objects with @select and @expand decorators

## Summary
This webpart demonstrates how to use [PnP JS Core](https://github.com/SharePoint/PnP-JS-Core) Custom Objects with @select and @expand TypeScript decorators.
If you are going to use PnP JS Core library and you've plans for [extending it with Custom Business Objects](https://github.com/SharePoint/PnP-JS-Core/wiki/Extending-with-Custom-Business-Objects), then this project will show you some best practices.
You can also find more information in the [blog series about working with Custom Business Objects, Parsers and TypeScript Decorators in PnP JS Core](https://blog.josequinto.com/2017/05/19/why-do-we-should-use-custom-business-objects-models-in-pnp-js-core/)


## Used SharePoint Framework Version
![drop](https://img.shields.io/badge/drop-GA-green.svg)


## Applies to
* [SharePoint Framework](http://dev.office.com/sharepoint/docs/spfx/sharepoint-framework-overview)
* [Office 365 developer tenant](http://dev.office.com/sharepoint/docs/spfx/set-up-your-developer-tenant)

## Solution

Solution|Author(s)
--------|---------
react-sp-pnp-js-property-decorators | Jose Quinto ([@jquintozamora](https://twitter.com/jquintozamora) , [blog.josequinto.com](https://blog.josequinto.com))

## Version history

Version|Date|Comments
-------|----|--------
1.0|July 2, 2017|Initial release

## Disclaimer
**THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**

---

## Minimal Path to Awesome
- clone this repo
- `$ npm i`
- `$ gulp trust-dev-cert`
- `$ gulp serve `

### Local Mode
A browser in local mode (localhost) will be opened.
https://localhost:4321/temp/workbench.html

### SharePoint Mode
If you want to try on a real environment, open:
https://your-domain.sharepoint.com/_layouts/15/workbench.aspx





<img src="https://telemetry.sharepointpnp.com/sp-dev-fx-webparts/samples/react-sp-pnp-js-property-decorators" />
13 changes: 13 additions & 0 deletions samples/react-sp-pnp-js-property-decorators/config/config.json
@@ -0,0 +1,13 @@
{
"entries": [
{
"entry": "./lib/webparts/customBusinessObjectsPnPJs/CustomBusinessObjectsPnPJsWebPart.js",
"manifest": "./src/webparts/customBusinessObjectsPnPJs/CustomBusinessObjectsPnPJsWebPart.manifest.json",
"outputPath": "./dist/custom-business-objects-pn-p-js.bundle.js"
}
],
"externals": {},
"localizedResources": {
"customBusinessObjectsPnPJsStrings": "webparts/customBusinessObjectsPnPJs/loc/{locale}.js"
}
}
@@ -0,0 +1,3 @@
{
"deployCdnPath": "temp/deploy"
}
@@ -0,0 +1,6 @@
{
"workingDir": "./temp/deploy/",
"account": "<!-- STORAGE ACCOUNT NAME -->",
"container": "react-sp-pnp-js-property-decorators",
"accessKey": "<!-- ACCESS KEY -->"
}
@@ -0,0 +1,10 @@
{
"solution": {
"name": "react-sp-pnp-js-property-decorators-client-side-solution",
"id": "a843ff35-51f4-4e36-99f7-f077a93f8d37",
"version": "1.0.0.0"
},
"paths": {
"zippedPackage": "solution/react-sp-pnp-js-property-decorators.sppkg"
}
}
9 changes: 9 additions & 0 deletions samples/react-sp-pnp-js-property-decorators/config/serve.json
@@ -0,0 +1,9 @@
{
"port": 4321,
"initialPage": "https://localhost:5432/workbench",
"https": true,
"api": {
"port": 5432,
"entryPath": "node_modules/@microsoft/sp-webpart-workbench/lib/api/"
}
}
45 changes: 45 additions & 0 deletions samples/react-sp-pnp-js-property-decorators/config/tslint.json
@@ -0,0 +1,45 @@
{
// Display errors as warnings
"displayAsWarning": true,
// The TSLint task may have been configured with several custom lint rules
// before this config file is read (for example lint rules from the tslint-microsoft-contrib
// project). If true, this flag will deactivate any of these rules.
"removeExistingRules": true,
// When true, the TSLint task is configured with some default TSLint "rules.":
"useDefaultConfigAsBase": false,
// Since removeExistingRules=true and useDefaultConfigAsBase=false, there will be no lint rules
// which are active, other than the list of rules below.
"lintConfig": {
// Opt-in to Lint rules which help to eliminate bugs in JavaScript
"rules": {
"class-name": false,
"export-name": false,
"forin": false,
"label-position": false,
"member-access": true,
"no-arg": false,
"no-console": false,
"no-construct": false,
"no-duplicate-case": true,
"no-duplicate-variable": true,
"no-eval": false,
"no-function-expression": true,
"no-internal-module": true,
"no-shadowed-variable": true,
"no-switch-case-fall-through": true,
"no-unnecessary-semicolons": true,
"no-unused-expression": true,
"no-unused-imports": true,
"no-use-before-declare": true,
"no-with-statement": true,
"semicolon": true,
"trailing-comma": false,
"typedef": false,
"typedef-whitespace": false,
"use-named-parameter": true,
"valid-typeof": true,
"variable-name": false,
"whitespace": false
}
}
}
@@ -0,0 +1,3 @@
{
"cdnBasePath": "<!-- PATH TO CDN -->"
}
6 changes: 6 additions & 0 deletions samples/react-sp-pnp-js-property-decorators/gulpfile.js
@@ -0,0 +1,6 @@
'use strict';

const gulp = require('gulp');
const build = require('@microsoft/sp-build-web');

build.initialize(gulp);
34 changes: 34 additions & 0 deletions samples/react-sp-pnp-js-property-decorators/package.json
@@ -0,0 +1,34 @@
{
"name": "react-sp-pnp-js-property-decorators",
"version": "0.0.1",
"private": true,
"engines": {
"node": ">=0.10.0"
},
"dependencies": {
"@microsoft/sp-core-library": "~1.1.0",
"@microsoft/sp-webpart-base": "~1.1.1",
"@types/webpack-env": ">=1.12.1 <1.14.0",
"react": "15.4.2",
"react-dom": "15.4.2",
"@types/react": "0.14.46",
"@types/react-dom": "0.14.18",
"@types/react-addons-shallow-compare": "0.14.17",
"@types/react-addons-update": "0.14.14",
"@types/react-addons-test-utils": "0.14.15",
"sp-pnp-js": "2.0.6"
},
"devDependencies": {
"@microsoft/sp-build-web": "~1.1.0",
"@microsoft/sp-module-interfaces": "~1.1.0",
"@microsoft/sp-webpart-workbench": "~1.1.0",
"gulp": "~3.9.1",
"@types/chai": ">=3.4.34 <3.6.0",
"@types/mocha": ">=2.2.33 <2.6.0"
},
"scripts": {
"build": "gulp bundle",
"clean": "gulp clean",
"test": "gulp test"
}
}
@@ -0,0 +1,20 @@
{
"$schema": "../../../node_modules/@microsoft/sp-module-interfaces/lib/manifestSchemas/jsonSchemas/clientSideComponentManifestSchema.json",

"id": "6e2025fd-9c31-4bc4-b217-76019a4fdd02",
"alias": "CustomBusinessObjectsPnPJsWebPart",
"componentType": "WebPart",
"version": "0.0.1",
"manifestVersion": 2,

"preconfiguredEntries": [{
"groupId": "6e2025fd-9c31-4bc4-b217-76019a4fdd02",
"group": { "default": "Under Development" },
"title": { "default": "customBusinessObjectsPnPJs" },
"description": { "default": "customBusinessObjectsPnPJs description" },
"officeFabricIconFontName": "Page",
"properties": {
"description": "customBusinessObjectsPnPJs"
}
}]
}

0 comments on commit b8405c7

Please sign in to comment.