Skip to content
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
51 changes: 51 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
## How to contribute
There are many ways that you can contribute to the react-winjs project:

* Submit a bug
* Verify fixes for bugs
* Submit a code fix for a bug
* Submit a feature request
* Submit a unit test
* Tell others about the WinJS project
* Tell the developers how much you appreciate the project
* Other...

## Contributing Code
Note that all code submissions will be rigorously reviewed and tested by the team, and only those that meet an extremely high bar for both quality and design/roadmap appropriateness will be merged into the source.

### Pull Requests
You will need to sign a [Contribution License Agreement](https://cla.microsoft.com/) ([CLA](https://cla.microsoft.com/)) before submitting your pull request be it a feature or a bug fix. To complete the CLA, you will need to submit the request via the form and then electronically sign the CLA when you receive the email containing the link to the document.

This needs to only be done once for any Microsoft open source project.

### Feature Requests
Before submitting a feature or substantial code contribution please discuss it with the team and ensure it aligns with the project's roadmap.

## Contributing to README and Wiki
You do not need to sign a Contribution License Agreement if you are just contributing to the README or the Wiki. By submitting a contribution to the README or the Wiki, you are contributing it under the [Creative Commons CC0 1.0 Universal Public Domain Dedication](http://creativecommons.org/publicdomain/zero/1.0/).


# Development

To make propert updates to the project the development requires a bit of setup.

## Required Dependencies

- [Grunt](http://gruntjs.com/) `npm install -g grunt-cli`
- If on a Mac (to run the `Nuget.exe`)
- [Mono](http://www.mono-project.com/download/) `brew install mono`

##

1. Create a folder to host multiple repositories (let's call the folder `winjs`)
2. Inside of the `winjs` root folder pull down the following projects
- `git clone https://github.com/winjs/winjs.git`
- `git clone https://github.com/winjs/react-winjs.git`
- `git clone https://github.com/winjs/winjs-control-apis.git`
3. Follow each's projects setup (usually `npm install`) etc...
4. In the `winjs` proper project check out the version you want (ex: `v4.4.0`) and run a build.
5. The build should create a `winjs.d.ts` file in `/winjs/typings/winjs/winjs.d.ts`. Copy this to `/react-winjs/typings/winjs.d.ts`
6. Make sure the Grunt task `update-controls-api` has the necessary `.d.ts` files configured.
7. Run `grunt update-controls-api` in this project (`winjs-react`).
- The above grunt task should have updated `react-winjs.js` with any updates to the necessary api. Validate that the updates are correct/proper.
8. Based on the updates above, update examples of new controls or other changes...
59 changes: 36 additions & 23 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ 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');
Expand All @@ -19,24 +19,25 @@ module.exports = function(grunt) {
}
// 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: [
'ReactControlApis.js',
'react-winjs.js',
'LICENSE.txt',
'package.json',
Expand All @@ -46,7 +47,7 @@ module.exports = function(grunt) {
}]
}
},

compress: {
publish: {
options: {
Expand All @@ -59,7 +60,7 @@ module.exports = function(grunt) {
}]
}
},

"check-bom": {
publish: {
files: [{
Expand All @@ -74,7 +75,16 @@ module.exports = function(grunt) {
}]
}
},


"update-controls-api": {
publish: {
files: [
{ src: "typings/winjs.d.ts" },
{ src: "typings/MediaElement.d.ts" }
]
}
},

nugetpack: {
publish: {
src: 'React.WinJS.nuspec',
Expand All @@ -84,7 +94,7 @@ module.exports = function(grunt) {
}
}
},

// Publishes nuget package
nugetpush: {
// Requires NuGet API key to be set. You can do this with:
Expand All @@ -93,7 +103,7 @@ module.exports = function(grunt) {
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
Expand All @@ -120,9 +130,9 @@ module.exports = function(grunt) {
}
}
});

grunt.loadTasks('tasks/');

var plugins = [
'grunt-contrib-clean',
'grunt-contrib-compress',
Expand All @@ -133,40 +143,43 @@ module.exports = function(grunt) {
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',
'update-controls-api:publish',
'copy:publish',
'compress:publish',
'nugetpack:publish',
'check-bom: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/react-winjs/releases)');
grunt.log.writeln('');
});


grunt.registerTask('default', ['prepare-publish'])

//
// 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
Expand All @@ -179,7 +192,7 @@ module.exports = function(grunt) {
if (!process.env.GITHUB_ACCESS_TOKEN) {
grunt.fail.fatal('The GITHUB_ACCESS_TOKEN environment variable must be set in order to create GitHub releases');
}

if (!mode) {
grunt.log.writeln('');
grunt.log.writeln('Will publish version ' + pkg.version + ' of react-winjs to npm, NuGet, etc. Double check that:');
Expand All @@ -197,5 +210,5 @@ module.exports = function(grunt) {
'finished-publish',
]);
}
});
});
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"grunt-contrib-compress": "^0.13.0",
"grunt-contrib-copy": "^0.8.0",
"grunt-github-releaser": "^0.1.17",
"grunt-nuget": "^0.1.4"
"grunt-nuget": "^0.1.4",
"winjs-control-apis": "git+https://github.com/winjs/winjs-control-apis.git"
}
}
Loading