Skip to content

Commit

Permalink
Cleanups before merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Saksham Saxena committed Aug 25, 2017
1 parent 5e993e8 commit fe6bd7e
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 45 deletions.
9 changes: 0 additions & 9 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,15 +322,6 @@ module.exports = function(grunt) {
'./docs/reference/data.min.json': './docs/reference/data.json'
}
}
},
copy: {
main: {
files: [
{expand: true, src: ['lib/addons/*'], dest: 'dist/', filter: 'isFile', flatten: true},
{expand: true, src: ['lib/*.js'], dest: 'dist/', filter: 'isFile', flatten: true},
{expand: true, src: ['lib/empty-example/*'], dest: 'dist/empty-example', flatten: true}
]
}
}
});

Expand Down
7 changes: 0 additions & 7 deletions lib/.gitkeep

This file was deleted.

4 changes: 2 additions & 2 deletions lib/empty-example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<html>
<head>
<script src="../p5.min.js"></script>
<script src="../p5.dom.min.js"></script>
<script src="../p5.sound.min.js"></script>
<script src="../addons/p5.dom.min.js"></script>
<script src="../addons/p5.sound.min.js"></script>
<script src="sketch.js"></script>
<style> body {padding: 0; margin: 0;} </style>
</head>
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@
"lib/p5.min.js",
"lib/p5.js",
"lib/addons/p5.sound.js",
"lib/addons/p5.sound.min.js"
"lib/addons/p5.sound.min.js",
"lib/addons/p5.dom.js",
"lib/addons/p5.dom.min.js",
"lib/addons/p5.dom.min.js"
],
"description": "[![Build Status](https://travis-ci.org/processing/p5.js.svg?branch=master)](https://travis-ci.org/processing/p5.js) [![npm version](https://badge.fury.io/js/p5.svg)](https://www.npmjs.com/package/p5)",
"bugs": {
Expand Down
20 changes: 10 additions & 10 deletions tasks/release/release-bower.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
/* Grunt Task to Release the Library files on dist repo for Bower */

// Using native exec instead of Grunt spawn so as to utilise Promises
const exec = require('child_process').exec;

module.exports = function(grunt) {

grunt.registerTask('release-bower', 'Publishes the new release of p5.js on Bower', function() {

// Async Task
// Async Task
var done = this.async();
// Keep the version handy
var version = require('../../package.json').version;
// Avoiding Callback Hell and using Promises
const P = new Promise(function(resolve, reject) {
new Promise(function(resolve, reject) {
// Clone the repo. NEEDS TO BE QUIET. Took 3 hours to realise this.
// Otherwise the stdout screws up
console.log("Clone part");
exec('git clone -q https://github.com/sakshamsaxena/p5.js-release.git bower-repo', function(err, stdout, stderr) {
console.log("Cloning the Release repo ...");
exec('git clone -q https://github.com/lmccart/p5.js-release.git bower-repo', function(err, stdout, stderr) {
if (err)
throw new Error(err);
if (stderr)
throw new Error(stderr);
resolve();
})
});

P.then(function(resolve, reject) {
}).then(function(resolve, reject) {
// Copy the lib to bower-repo.
// NOTE : Uses "cp" of UNIX. Make sure it is unaliased in your .bashrc,
// otherwise it may prompt always for overwrite (not desirable)
console.log("Copy part");
console.log("Copying new files ...");
return new Promise(function(resolve, reject) {
exec('cp lib/*.js lib/addons bower-repo/lib -r', function(err, stdout, stderr) {
if (err)
Expand All @@ -39,7 +39,7 @@ module.exports = function(grunt) {
})
}).then(function(resolve, reject) {
// Git add, commit, push
console.log("Add, commit, push");
console.log("Pushing out changes ...");
return new Promise(function(resolve, reject) {
exec('git add --all && git commit -am "' + version + '" && git push', { cwd: './bower-repo' }, function(err, stdout, stderr) {
if (err)
Expand All @@ -51,7 +51,7 @@ module.exports = function(grunt) {
})
})
}).catch(function(err) {
console.error(err);
throw new Error(err);
})
})
}
11 changes: 11 additions & 0 deletions tasks/release/release-docs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* Grunt Task to Release the Library files on dist repo for Bower */

// Using native exec instead of Grunt spawn so as to utilise Promises
const exec = require('child_process').exec;

module.exports = function(grunt) {

grunt.registerTask('release-docs', 'Publishes the new docs of p5.js on the website', function() {

})
}
40 changes: 25 additions & 15 deletions tasks/release/release-p5.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = function(grunt) {
'releaseIt': {
'options': {
'non-interactive': true,
'dry-run': true,// set to false later
'dry-run': false,
'pkgFiles': ['package.json'],
'increment': '',
'buildCommand': 'grunt yui && grunt build',
Expand All @@ -16,7 +16,7 @@ module.exports = function(grunt) {
'commitMessage': 'Release v%s',
'tagName': '%s',
'tagAnnotation': 'Release v%s',
'pushRepo': 'origin easing-up-the-release-process' //change this to master before PR
'pushRepo': 'origin master'
},
'dist': {
'repo': false,
Expand All @@ -36,6 +36,15 @@ module.exports = function(grunt) {
{ cwd: 'dist/', src: ['**/*'], expand: true }
]
}
},
'copy': {
'main': {
'files': [
{expand: true, src: ['lib/addons/*'], dest: 'dist/', filter: 'isFile', flatten: true},
{expand: true, src: ['lib/*.js'], dest: 'dist/', filter: 'isFile', flatten: true},
{expand: true, src: ['lib/empty-example/*'], dest: 'dist/empty-example', flatten: true}
]
}
}
};

Expand All @@ -47,6 +56,7 @@ module.exports = function(grunt) {
opts.releaseIt.options.increment = args;
grunt.config.set('release-it', opts.releaseIt);
grunt.config.set('compress', opts.compress);
grunt.config.set('copy', opts.copy);

// 1. Test Suite
grunt.task.run('test');
Expand All @@ -57,20 +67,20 @@ module.exports = function(grunt) {
// 3. Push the new lib files to the dist repo (to be referred as bower-repo here)
grunt.task.run('release-bower');

// 3. Copy the library files and example to a new folder 'dist'
grunt.task.run('copy');
// 4. [TODO]Push the docs out to the website
grunt.task.run('release-docs');

// 5. Zip the 'dist' folder
/* p5.zip File List
p5.js
p5.min.js
p5.dom.js
p5.dom.min.js
p5.sound.js
p5.sound.min.js
empty-example/index.html
empty-example/sketch.js
*/
// 5. Copy the library files and example to a new folder 'dist' and zip the folder
// p5.zip File List:
// - p5.js
// - p5.min.js
// - p5.dom.js
// - p5.dom.min.js
// - p5.sound.js
// - p5.sound.min.js
// - empty-example/index.html
// - empty-example/sketch.js
grunt.task.run('copy');
grunt.task.run('compress');

});
Expand Down

0 comments on commit fe6bd7e

Please sign in to comment.