Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Example of using Angular 2 with API Pokemon API #30

Closed
wants to merge 2 commits into from
Closed
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
25 changes: 25 additions & 0 deletions samples/angular2-pokemon/.editorconfig
Original file line number Diff line number Diff line change
@@ -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/angular2-pokemon/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
35 changes: 35 additions & 0 deletions samples/angular2-pokemon/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Logs
logs
*.log
npm-debug.log*

# Yeoman configuration files
.yo-rc.json

# Dependency directories
node_modules

# Build generated files
dist
lib
solution
temp
*.spapp

# 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/angular2-pokemon/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Folders
.vscode
coverage
node_modules
solution
src
temp

# Files
*.csproj
.git*
.yo-rc.json
gulpfile.js
tsconfig.json
13 changes: 13 additions & 0 deletions samples/angular2-pokemon/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch localhost with sourcemaps",
"type": "chrome",
"request": "launch",
"url": "http://localhost:4321/temp/workbench.html",
"webRoot": "${workspaceRoot}/src",
"sourceMaps": true
}
]
}
21 changes: 21 additions & 0 deletions samples/angular2-pokemon/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
// The number of spaces a tab is equal to.
"editor.tabSize": 2,

// When enabled, will trim trailing whitespace when you save a file.
"files.trimTrailingWhitespace": true,

// Controls if the editor should automatically close brackets after opening them
"editor.autoClosingBrackets": false,

// Configure glob patterns for excluding files and folders.
"search.exclude": {
"**/bower_components": true,
"**/node_modules": true,
"coverage": true,
"dist": true,
"lib-amd": true,
"lib": true,
"temp": true
}
}
34 changes: 34 additions & 0 deletions samples/angular2-pokemon/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "gulp",
"isShellCommand": true,
"showOutput": "always",
"args": [
"--no-color"
],
"tasks": [
{
"taskName": "bundle",
"isBuildCommand": true,
"problemMatcher": [
"$tsc"
]
},
{
"taskName": "test",
"isTestCommand": true,
"problemMatcher": [
"$tsc"
]
},
{
"taskName": "serve",
"isWatching": true,
"problemMatcher": [
"$tsc"
]
}
]
}
26 changes: 26 additions & 0 deletions samples/angular2-pokemon/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## todo-webpart-sample

This is where you include your web part docs.

### Building the code

```bash
git clone the repo
npm i
npm i -g gulp
gulp
```

This package produces the following:

* lib/* commonjs components - this allows this package to be reused from other packages.
* dist/* - a single bundle containing the components used for uploading to a cdn pointing a registered Sharepoint webpart library to.
* example/* a test page that hosts all components in this package.

### Build options

gulp nuke - TODO
gulp test - TODO
gulp watch - TODO
gulp build - TODO
gulp deploy - TODO
26 changes: 26 additions & 0 deletions samples/angular2-pokemon/config/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"entries": [
{
"entry": "./lib/webparts/pokemonGo/PokemonGoWebPart.js",
"manifest": "./src/webparts/pokemonGo/PokemonGoWebPart.manifest.json",
"outputPath": "./dist/pokemon-go.bundle.js"
}
],
"externals": {
"@microsoft/sp-client-base": "node_modules/@microsoft/sp-client-base/dist/sp-client-base.js",
"@microsoft/sp-client-preview": "node_modules/@microsoft/sp-client-preview/dist/sp-client-preview.js",
"@microsoft/sp-lodash-subset": "node_modules/@microsoft/sp-lodash-subset/dist/sp-lodash-subset.js",
"office-ui-fabric-react": "node_modules/office-ui-fabric-react/dist/office-ui-fabric-react.js",
"react": "node_modules/react/dist/react.min.js",
"react-dom": "node_modules/react-dom/dist/react-dom.min.js",
"react-dom/server": "node_modules/react-dom/dist/react-dom-server.min.js",
"BrowserModule" : "node_modules/@angular/platform-browser/src/platform-browser.js",
"NgModule" : "node_modules/@angular/core/src/core.js",
"CommonModule" : "node_modules/@angular/common/src/commonmodule.js",
"FormsModule" : "node_modules/@angular/forms/src/formsmodule.js",
"HttpModule": "node_modules/@angular/http/src/httpmodule.js"
},
"localizedResources": {
"pokemonGoStrings": "webparts/pokemonGo/loc/{locale}.js"
}
}
6 changes: 6 additions & 0 deletions samples/angular2-pokemon/config/deploy-azure-storage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"workingDir": "./temp/deploy/",
"account": "<!-- STORAGE ACCOUNT NAME -->",
"container": "pokemon",
"accessKey": "<!-- ACCESS KEY -->"
}
10 changes: 10 additions & 0 deletions samples/angular2-pokemon/config/package-solution.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"solution": {
"name": "pokemon-client-side-solution",
"id": "532b79c7-f8ba-45a4-8205-171bb271f09f",
"version": "1.0.0.0"
},
"paths": {
"zippedPackage": "pokemon.spapp"
}
}
3 changes: 3 additions & 0 deletions samples/angular2-pokemon/config/prepare-deploy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"deployCdnPath": "temp/deploy"
}
9 changes: 9 additions & 0 deletions samples/angular2-pokemon/config/serve.json
Original file line number Diff line number Diff line change
@@ -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/"
}
}
51 changes: 51 additions & 0 deletions samples/angular2-pokemon/config/tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
// 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,
"label-undefined": false,
"member-access": true,
"no-arg": false,
"no-console": false,
"no-construct": false,
"no-duplicate-case": true,
"no-duplicate-key": false,
"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-unused-variable": true,
"no-unreachable": 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,
"prefer-const": true,
"a11y-role": true
}
}
}
3 changes: 3 additions & 0 deletions samples/angular2-pokemon/config/write-manifests.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"cdnBasePath": "<!-- PATH TO CDN -->"
}
7 changes: 7 additions & 0 deletions samples/angular2-pokemon/gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';

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


build.initialize(gulp);
45 changes: 45 additions & 0 deletions samples/angular2-pokemon/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "pokemon",
"version": "0.0.1",
"private": true,
"engines": {
"node": ">=0.10.0"
},
"dependencies": {
"@microsoft/sp-client-base": "~0.2.0",
"@microsoft/sp-client-preview": "~0.2.0",
"@angular/common": "2.0.0-rc.6",
"@angular/compiler": "2.0.0-rc.6",
"@angular/compiler-cli": "0.6.0",
"@angular/core": "2.0.0-rc.6",
"@angular/forms": "2.0.0-rc.6",
"@angular/http": "2.0.0-rc.6",
"@angular/platform-browser": "2.0.0-rc.6",
"@angular/platform-browser-dynamic": "2.0.0-rc.6",
"@angular/router": "3.0.0-rc.2",
"@angular/upgrade": "2.0.0-rc.6",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.11",
"systemjs": "0.19.27",
"zone.js": "^0.6.17",
"angular2-in-memory-web-api": "0.0.18",
"bootstrap": "^3.3.6"
},
"devDependencies": {
"@microsoft/sp-build-web": "~0.5.0",
"@microsoft/sp-module-interfaces": "~0.2.0",
"@microsoft/sp-webpart-workbench": "~0.2.0",
"gulp": "~3.9.1" ,
"gulp-copy": "~0.0.2",
"concurrently": "^2.2.0",
"lite-server": "^2.2.2",
"typescript": "^1.8.10",
"typings":"^1.3.2"
},
"scripts": {
"build": "gulp bundle",
"clean": "gulp nuke",
"test": "gulp test"
}
}
Loading