From 4a4fccf69b075f4395230690d35bf45e0c4f5500 Mon Sep 17 00:00:00 2001 From: Sergei Sergeev Date: Fri, 31 Mar 2017 01:34:42 +0300 Subject: [PATCH] Upgraded Vue.js sample to GA. (#168) --- .../.vscode/settings.json | 8 ++--- .../README.md | 3 +- .../config/config.json | 10 +++--- .../{prepare-deploy.json => copy-assets.json} | 0 .../config/package-solution.json | 2 +- .../config/tslint.json | 6 +--- .../package.json | 34 +++++++++---------- .../src/tests.js | 5 --- .../webparts/todo/TodoWebPart.manifest.json | 8 ++--- .../src/webparts/todo/TodoWebPart.ts | 3 +- .../src/webparts/todo/loc/mystrings.d.ts | 6 ++-- .../src/webparts/todo/tests/Todo.test.ts | 2 +- .../tsconfig.json | 1 + .../typings/@ms/odsp.d.ts | 8 +++++ .../typings/tsd.d.ts | 1 + 15 files changed, 49 insertions(+), 48 deletions(-) rename samples/vuejs-todo-single-file-component/config/{prepare-deploy.json => copy-assets.json} (100%) delete mode 100644 samples/vuejs-todo-single-file-component/src/tests.js create mode 100644 samples/vuejs-todo-single-file-component/typings/@ms/odsp.d.ts create mode 100644 samples/vuejs-todo-single-file-component/typings/tsd.d.ts diff --git a/samples/vuejs-todo-single-file-component/.vscode/settings.json b/samples/vuejs-todo-single-file-component/.vscode/settings.json index b10e8e412..9bf6614d3 100644 --- a/samples/vuejs-todo-single-file-component/.vscode/settings.json +++ b/samples/vuejs-todo-single-file-component/.vscode/settings.json @@ -1,7 +1,5 @@ +// Place your settings in this file to overwrite default and user settings. { - "vsicons.presets.angular": false, - "typescript.tsdk": "./node_modules/typescript/lib", - "files.associations": { - "*.vue": "vue" - } + "tslint.configFile": "./config/tslint.json", + "tslint.ignoreDefinitionFiles": true } \ No newline at end of file diff --git a/samples/vuejs-todo-single-file-component/README.md b/samples/vuejs-todo-single-file-component/README.md index 8cce5d593..cba11c031 100644 --- a/samples/vuejs-todo-single-file-component/README.md +++ b/samples/vuejs-todo-single-file-component/README.md @@ -5,7 +5,7 @@ Sample Todo web part demonstrating how you can utilize [Vue](https://vuejs.org/v2) (a progressive framework for building user interfaces) with SharePoint Framework using handy [single-file components](https://vuejs.org/v2/guide/single-file-components.html) approach. ## Used SharePoint Framework Version -![drop](https://img.shields.io/badge/drop-RC0-green.svg) +![drop](https://img.shields.io/badge/drop-GA-green.svg) ## Applies to @@ -23,6 +23,7 @@ vuejs-todo-single-file-component|Sergei Sergeev ([@sergeev_srg](https://twitter. Version|Date|Comments -------|----|-------- 0.0.1|January 27, 2017|Initial version. +0.0.2|March 30, 2017|Updated to GA ## 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.** diff --git a/samples/vuejs-todo-single-file-component/config/config.json b/samples/vuejs-todo-single-file-component/config/config.json index fb41887b8..f304bf3a6 100644 --- a/samples/vuejs-todo-single-file-component/config/config.json +++ b/samples/vuejs-todo-single-file-component/config/config.json @@ -1,15 +1,15 @@ { "entries": [ { - "entry": "./lib/webparts/todo/TodoWebPart.js", - "manifest": "./src/webparts/todo/TodoWebPart.manifest.json", - "outputPath": "./dist/todo.bundle.js" + "entry": "./lib/webparts/toDo/ToDoWebPart.js", + "manifest": "./src/webparts/toDo/ToDoWebPart.manifest.json", + "outputPath": "./dist/to-do.bundle.js" } ], "externals": { "vue": "node_modules/vue/dist/vue.runtime.js" }, "localizedResources": { - "todoStrings": "webparts/todo/loc/{locale}.js" + "toDoStrings": "webparts/toDo/loc/{locale}.js" } -} \ No newline at end of file +} diff --git a/samples/vuejs-todo-single-file-component/config/prepare-deploy.json b/samples/vuejs-todo-single-file-component/config/copy-assets.json similarity index 100% rename from samples/vuejs-todo-single-file-component/config/prepare-deploy.json rename to samples/vuejs-todo-single-file-component/config/copy-assets.json diff --git a/samples/vuejs-todo-single-file-component/config/package-solution.json b/samples/vuejs-todo-single-file-component/config/package-solution.json index 79a6484a4..4956572fb 100644 --- a/samples/vuejs-todo-single-file-component/config/package-solution.json +++ b/samples/vuejs-todo-single-file-component/config/package-solution.json @@ -1,7 +1,7 @@ { "solution": { "name": "vue-todo-client-side-solution", - "id": "3a3be1f4-edfd-4816-8cfb-f100f1727031", + "id": "93e1bc8f-a063-4617-aa40-837e3b39f958", "version": "1.0.0.0" }, "paths": { diff --git a/samples/vuejs-todo-single-file-component/config/tslint.json b/samples/vuejs-todo-single-file-component/config/tslint.json index 0010b6105..2bc05ff24 100644 --- a/samples/vuejs-todo-single-file-component/config/tslint.json +++ b/samples/vuejs-todo-single-file-component/config/tslint.json @@ -16,13 +16,11 @@ "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, @@ -32,8 +30,6 @@ "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, @@ -44,7 +40,7 @@ "valid-typeof": true, "variable-name": false, "whitespace": false, - "prefer-const": true + "prefer-const": false } } } \ No newline at end of file diff --git a/samples/vuejs-todo-single-file-component/package.json b/samples/vuejs-todo-single-file-component/package.json index 651e98ec4..b6e74ba22 100644 --- a/samples/vuejs-todo-single-file-component/package.json +++ b/samples/vuejs-todo-single-file-component/package.json @@ -1,33 +1,33 @@ { "name": "vue-todo", - "version": "0.0.1", + "version": "0.0.2", "private": true, "engines": { "node": ">=0.10.0" }, "dependencies": { - "@microsoft/sp-client-base": "~0.7.0", - "@microsoft/sp-client-preview": "~0.9.0", - "@microsoft/sp-core-library": "~0.1.2", - "@microsoft/sp-webpart-base": "~0.4.0", + "@microsoft/sp-client-base": "~1.0.0", + "@microsoft/sp-core-library": "~1.0.0", + "@microsoft/sp-webpart-base": "~1.0.0", "@types/webpack-env": ">=1.12.1 <1.14.0", - "vue": "^2.1.10", - "vue-class-component": "^4.4.0", - "vue-property-decorator": "^3.4.0", - "vue-template-compiler": "^2.1.10" + "vue": "^2.2.6", + "vue-class-component": "^5.0.1", + "vue-property-decorator": "^4.0.0", + "vue-template-compiler": "^2.2.6" }, "devDependencies": { - "@microsoft/sp-build-web": "~0.9.0", - "@microsoft/sp-module-interfaces": "~0.7.0", - "@microsoft/sp-webpart-workbench": "~0.8.0", + "@microsoft/gulp-core-build-typescript": "^3.0.0", + "@microsoft/sp-build-web": "~1.0.0", + "@microsoft/sp-module-interfaces": "~1.0.0", + "@microsoft/sp-webpart-workbench": "~1.0.0", "@types/chai": ">=3.4.34 <3.6.0", "@types/mocha": ">=2.2.33 <2.6.0", + "css-loader": "^0.28.0", "gulp": "~3.9.1", - "node-sass": "^4.3.0", - "sass-loader": "^4.1.1", - "css-loader": "^0.26.1", - "vue-loader": "^10.0.2", - "webpack-merge": "^2.4.0" + "node-sass": "^4.5.2", + "sass-loader": "^6.0.3", + "vue-loader": "^11.3.4", + "webpack-merge": "^4.1.0" }, "scripts": { "build": "gulp bundle", diff --git a/samples/vuejs-todo-single-file-component/src/tests.js b/samples/vuejs-todo-single-file-component/src/tests.js deleted file mode 100644 index cb4bb5cf2..000000000 --- a/samples/vuejs-todo-single-file-component/src/tests.js +++ /dev/null @@ -1,5 +0,0 @@ -var context = require.context('.', true, /.+\.test\.js?$/); - -context.keys().forEach(context); - -module.exports = context; diff --git a/samples/vuejs-todo-single-file-component/src/webparts/todo/TodoWebPart.manifest.json b/samples/vuejs-todo-single-file-component/src/webparts/todo/TodoWebPart.manifest.json index 47dec1351..83c5600a2 100644 --- a/samples/vuejs-todo-single-file-component/src/webparts/todo/TodoWebPart.manifest.json +++ b/samples/vuejs-todo-single-file-component/src/webparts/todo/TodoWebPart.manifest.json @@ -1,16 +1,16 @@ { "$schema": "../../../node_modules/@microsoft/sp-module-interfaces/lib/manifestSchemas/jsonSchemas/clientSideComponentManifestSchema.json", - "id": "1c993233-909a-4662-8643-8548d961f2b3", - "alias": "TodoWebPart", + "id": "a0e1eddd-ea67-4775-a52b-0141c5807146", + "alias": "ToDoWebPart", "componentType": "WebPart", "version": "0.0.1", "manifestVersion": 2, "preconfiguredEntries": [{ - "groupId": "1c993233-909a-4662-8643-8548d961f2b3", + "groupId": "a0e1eddd-ea67-4775-a52b-0141c5807146", "group": { "default": "Under Development" }, - "title": { "default": "Todo" }, + "title": { "default": "ToDo" }, "description": { "default": "My Todo's" }, "officeFabricIconFontName": "Page", "properties": { diff --git a/samples/vuejs-todo-single-file-component/src/webparts/todo/TodoWebPart.ts b/samples/vuejs-todo-single-file-component/src/webparts/todo/TodoWebPart.ts index 588fed8e5..27c1577df 100644 --- a/samples/vuejs-todo-single-file-component/src/webparts/todo/TodoWebPart.ts +++ b/samples/vuejs-todo-single-file-component/src/webparts/todo/TodoWebPart.ts @@ -4,11 +4,12 @@ import { IPropertyPaneConfiguration, PropertyPaneTextField } from '@microsoft/sp-webpart-base'; +import { escape } from '@microsoft/sp-lodash-subset'; import * as Vue from 'vue'; import TodoComponent from './components/todo/Todo.vue'; -import * as strings from 'todoStrings'; +import * as strings from 'toDoStrings'; import { ITodoWebPartProps } from './ITodoWebPartProps'; export default class TodoWebPart extends BaseClientSideWebPart { diff --git a/samples/vuejs-todo-single-file-component/src/webparts/todo/loc/mystrings.d.ts b/samples/vuejs-todo-single-file-component/src/webparts/todo/loc/mystrings.d.ts index 5b94b8d6f..54ade0686 100644 --- a/samples/vuejs-todo-single-file-component/src/webparts/todo/loc/mystrings.d.ts +++ b/samples/vuejs-todo-single-file-component/src/webparts/todo/loc/mystrings.d.ts @@ -1,10 +1,10 @@ -declare interface ITodoStrings { +declare interface IToDoStrings { PropertyPaneDescription: string; BasicGroupName: string; DescriptionFieldLabel: string; } -declare module 'todoStrings' { - const strings: ITodoStrings; +declare module 'toDoStrings' { + const strings: IToDoStrings; export = strings; } diff --git a/samples/vuejs-todo-single-file-component/src/webparts/todo/tests/Todo.test.ts b/samples/vuejs-todo-single-file-component/src/webparts/todo/tests/Todo.test.ts index 70a211831..0262823e5 100644 --- a/samples/vuejs-todo-single-file-component/src/webparts/todo/tests/Todo.test.ts +++ b/samples/vuejs-todo-single-file-component/src/webparts/todo/tests/Todo.test.ts @@ -2,7 +2,7 @@ import { assert } from 'chai'; -describe('TodoWebPart', () => { +describe('ToDoWebPart', () => { it('should do something', () => { assert.ok(true); }); diff --git a/samples/vuejs-todo-single-file-component/tsconfig.json b/samples/vuejs-todo-single-file-component/tsconfig.json index 5bf5956b3..63a68fc77 100644 --- a/samples/vuejs-todo-single-file-component/tsconfig.json +++ b/samples/vuejs-todo-single-file-component/tsconfig.json @@ -7,6 +7,7 @@ "declaration": true, "sourceMap": true, "experimentalDecorators": true, + "allowSyntheticDefaultImports": true, "types": [ "webpack-env" ] diff --git a/samples/vuejs-todo-single-file-component/typings/@ms/odsp.d.ts b/samples/vuejs-todo-single-file-component/typings/@ms/odsp.d.ts new file mode 100644 index 000000000..2d2913e53 --- /dev/null +++ b/samples/vuejs-todo-single-file-component/typings/@ms/odsp.d.ts @@ -0,0 +1,8 @@ +// Type definitions for Microsoft ODSP projects +// Project: ODSP + +/* Global definition for UNIT_TEST builds + Code that is wrapped inside an if(UNIT_TEST) {...} + block will not be included in the final bundle when the + --ship flag is specified */ +declare const UNIT_TEST: boolean; \ No newline at end of file diff --git a/samples/vuejs-todo-single-file-component/typings/tsd.d.ts b/samples/vuejs-todo-single-file-component/typings/tsd.d.ts new file mode 100644 index 000000000..e7efdd728 --- /dev/null +++ b/samples/vuejs-todo-single-file-component/typings/tsd.d.ts @@ -0,0 +1 @@ +///