Skip to content
This repository was archived by the owner on Jun 15, 2026. It is now read-only.
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules/
dist/

Thumbs.db
ehthumbs.db
Expand Down
2 changes: 1 addition & 1 deletion Angular.WinJS.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>Angular.WinJS</id>
<version>3.0.0</version>
<version>1.0.0</version>
<authors>Microsoft Corporation and other contributors</authors>
<licenseUrl>https://raw.githubusercontent.com/winjs/angular-winjs/master/License.txt</licenseUrl>
<projectUrl>https://github.com/winjs/angular-winjs</projectUrl>
Expand Down
198 changes: 198 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
// Copyright (c) Microsoft Corp. All Rights Reserved. Licensed under the MIT License. See License.txt in the project root for license information.

"use strict";

var exec = require('child_process').exec;
var execSync = require('child_process').execSync;

module.exports = function(grunt) {

var publishRoot = 'dist/';
var npmPublishRoot = publishRoot + 'npm/';

// All version number information is derived from package.json. This includes the version
// info used with npm, bower, NuGet, and the GitHub release.
var pkg = grunt.file.readJSON('package.json');
var fullWinjsVersion = pkg.devDependencies.winjs;
if (!fullWinjsVersion) {
grunt.fail.fatal('Unable to determine WinJS version required by angular-winjs');
}
// package.json version contains <major>.<minor>.<patch>. We just want <major>.<minor>
var winjsVersion = fullWinjsVersion.split(".").slice(0, 2).join(".");

var currentGitCommitHash = execSync('git rev-parse HEAD').toString().trim();

var bomGlob = "**/*.+(js|css|htm|html)";

// Project configuration.
grunt.initConfig({
pkg: pkg,

clean: {
publish: [publishRoot]
},

copy: {
publish: {
files: [{
expand: true,
src: [
'js/**',
'License.txt',
'package.json',
'README.md'
],
dest: npmPublishRoot
}]
}
},

compress: {
publish: {
options: {
archive: publishRoot + 'angular-winjs.zip'
},
files: [{
expand: true,
cwd: npmPublishRoot,
src: ["**"]
}]
}
},

"check-bom": {
publish: {
files: [{
cwd: 'js',
src: bomGlob,
expand: true,
nocase: true
}, {
cwd: publishRoot,
src: bomGlob,
expand: true,
nocase: true
}]
}
},

nugetpack: {
publish: {
src: 'Angular.WinJS.nuspec',
dest: publishRoot,
options: {
version: '<%= pkg.version %>'
}
}
},

// Publishes nuget package
nugetpush: {
// Requires NuGet API key to be set. You can do this with:
// grunt nugetkey --key=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
publish: {
src: publishRoot + '*.nupkg',
}
},

// Publishes GitHub release and bower package (bower consumes GitHub tags/releases)
'github-release': {
// Requires this environment variable to be set: GITHUB_ACCESS_TOKEN
// GITHUB_ACCESS_TOKEN can be generated from https://help.github.com/articles/creating-an-access-token-for-command-line-use/
publish: {
options: {
repository: 'winjs/angular-winjs',
auth: {
user: process.env.GITHUB_ACCESS_TOKEN
},
release: {
tag_name: 'v<%= pkg.version %>', // Must follow semver syntax in order for bower to pick it up
target_commitish: currentGitCommitHash,
name: '<%= pkg.version %>',
body:
'Release of angular-winjs <%= pkg.version %>.\n' +
'\n' +
'Compatible with WinJS ' + winjsVersion + '.\n'
}
},
files: {
src: [publishRoot + 'angular-winjs.zip']
}
}
}
});

grunt.loadTasks('tasks/');

var plugins = [
'grunt-contrib-clean',
'grunt-contrib-compress',
'grunt-contrib-copy',
'grunt-nuget',
'grunt-github-releaser'
];
plugins.forEach(function (plugin) {
grunt.loadNpmTasks(plugin);
});

// Publishes npm package
grunt.registerTask('npm-release', function (mode) {
var done = this.async();
var cmd = 'npm publish ' + npmPublishRoot;

exec(cmd, function (err, stdout) {
if (err) {
grunt.fatal('npm publish failed using command: ' + cmd);
}
done();
});
});

// Sets up all of the state necessary to do a publish but doesn't actually publish
// to any of the package managers.
grunt.registerTask('prepare-publish', [
'clean:publish',
'copy:publish',
'compress:publish',
'nugetpack:publish',
'check-bom:publish',
]);

grunt.registerTask('finished-publish', function (mode) {
grunt.log.writeln('');
grunt.log.writeln('Publish complete. Hand tweak the GitHub release description if necessary (https://github.com/winjs/angular-winjs/releases)');
grunt.log.writeln('');
});

//
// Public tasks designed to be run from the command line
//

// Populates the 'dist' folder and then uses it to:
// - Create a GitHub release
// - Publish to npm
// - Publish to bower
// - Publish to NuGet
// When debugging publish, it's helpful to run just the 'prepare-publish'
// task which puts all of the publication data into the 'dist' folder but
// doesn't actually send the data to the package managers.
grunt.registerTask('publish', function (mode) {
if (!mode) {
grunt.log.writeln('');
grunt.log.writeln('Will publish version ' + pkg.version + ' of angular-winjs to npm, NuGet, etc. Double check that:');
grunt.log.writeln(' * You are on the branch you\'d like to publish');
grunt.log.writeln(' * The branch has been pushed to GitHub');
grunt.log.writeln(' * You don\'t have any local edits');
grunt.log.writeln('');
grunt.log.writeln('If everything is in order, run "grunt publish:force" to proceed');
} else if (mode === 'force') {
grunt.task.run([
'prepare-publish',
'nugetpush:publish',
'github-release:publish',
'npm-release',
'finished-publish',
]);
}
});
};
46 changes: 25 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,6 @@ Examples of control usage
<win-menu-command label="'this would be a great place for ng-repeater...'"></win-menu-command>
</win-menu>

### NavBar and friends

<!-- Shows up on the top of the screen, use right-click or touch edgy gesture to show -->
<win-nav-bar>
<win-nav-bar-container>
<win-nav-bar-command label="'Home'" icon="'home'" tooltip="'Go home!!'"></win-nav-bar-command>
<win-nav-bar-command label="'Save'" icon="'save'"></win-nav-bar-command>
</win-nav-bar-container>
</win-nav-bar>

### Pivot and PivotItem

<win-pivot>
Expand Down Expand Up @@ -155,20 +145,17 @@ Examples of control usage
</win-list-view>
</win-semantic-zoom>

### SplitView

<win-split-view>
<win-split-view-pane>SplitView Navigation Pane</win-split-view-pane>
<win-split-view-content>SplitView Content Area</win-split-view-content>
</win-split-view>

### SplitView
### SplitView and optional SplitViewPaneToggle
angular.module("yourAngularApp", ["winjs"]).controller("yourController", function ($scope) {
$scope.splitViewElement = document.getElementById("splitView");
});
<win-split-view-pane-toggle split-view="splitViewElement"></win-split-view-pane-toggle>
<win-split-view id="splitView">
<win-split-view-pane>SplitView Navigation Pane</win-split-view-pane>
<win-split-view-pane>
SplitView Navigation Pane
<win-split-view-command label="'Home'" icon="'home'" on-invoked="goToHome()"></win-split-view-command>
<win-split-view-command label="'Settings'" icon="'settings'" on-invoked="goToSettings()"></win-split-view-command>
</win-split-view-pane>
<win-split-view-content>SplitView Content Area</win-split-view-content>
</win-split-view>

Expand Down Expand Up @@ -203,12 +190,29 @@ Examples of control usage
<!-- If you ever need access to the WinJS winControl, you can expose it to your Angular scope by using the win-control directive -->
<win-pivot win-control="pivotWinControl">
<win-pivot-item header="'Sample'">
This Pivot is showing how to access its winControl through Angular
This Pivot is showing how to access its winControl through Angular.
The winControl can now be accessed as a variable on the Angular scope, using the same name that was
specified in the directive. In this case, $scope.pivotWinControl
</win-pivot-item>
</win-pivot>

How to run unit tests
-------------------------

### Install Node
In order run tests, ensure that you have [Node.js](http://nodejs.org/download/) installed.

### Run the tests
From the local angular-winjs repository
```
npm install
npm test
```


Notes
-----

For all of the controls you can bind to all public properties and events and the camel cased property names conveniently map to attributes.
For all of the controls you can bind to: all public events, and camel cased property names, conveniently map to attributes.
- ```appBar.closedDisplayMode = "compact"``` maps to ```<win-app-bar closed-display-mode="'compact'">```
- ```flipView.onpageselected = pagesSelected()``` maps to ```<win-flip-view on-page-selected="pageSelected($event)">```
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"name": "angular-winjs",
"version": "3.0.0",
"homepage": "https://github.com/winjs/angular-winjs",
"authors": [
"Microsoft Corporation and other contributors"
Expand All @@ -21,6 +20,7 @@
"tests",
"package.json",
"karma.config.js",
"*.nuspec"
"*.nuspec",
"Gruntfile.js"
]
}
Loading