From 4ba7bedae95adab83b9545283307725d17b0c31a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Go=C5=82e=CC=A8biowski-Owczarek?= Date: Sun, 10 May 2020 22:41:49 +0200 Subject: [PATCH] Build: Put version in file names instead of the parent directory --- build/release.js | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/build/release.js b/build/release.js index 60bce8c..187df60 100644 --- a/build/release.js +++ b/build/release.js @@ -1,20 +1,45 @@ "use strict"; module.exports = function( Release ) { - var - files = [ + var shell = require( "shelljs" ), + cdnFolder = "dist/cdn", + distFiles = [ "dist/jquery.color.js", "dist/jquery.color.min.js", "dist/jquery.color.plus-names.js", "dist/jquery.color.plus-names.min.js", "dist/jquery.color.svg-names.js", "dist/jquery.color.svg-names.min.js" - ]; + ], + releaseFiles = { + "jquery.color-@VERSION.js": "dist/jquery.color.js", + "jquery.color-@VERSION.min.js": "dist/jquery.color.min.js", + "jquery.color.plus-names-@VERSION.js": "dist/jquery.color.plus-names.js", + "jquery.color.plus-names-@VERSION.min.js": "dist/jquery.color.plus-names.min.js", + "jquery.color.svg-names-@VERSION.js": "dist/jquery.color.svg-names.js", + "jquery.color.svg-names-@VERSION.min.js": "dist/jquery.color.svg-names.min.js" + }; + + function makeReleaseCopies( Release ) { + shell.mkdir( "-p", cdnFolder ); + + Object.keys( releaseFiles ).forEach( function( key ) { + var builtFile = releaseFiles[ key ], + unpathedFile = key.replace( /@VERSION/g, Release.newVersion ), + releaseFile = cdnFolder + "/" + unpathedFile; + + shell.cp( "-f", builtFile, releaseFile ); + } ); + } Release.define( { npmPublish: true, issueTracker: "github", - cdnPublish: "dist", + cdnPublish: cdnFolder, + + changelogShell: function() { + return "# Changelog for jQuery Color v" + Release.newVersion + "\n"; + }, /** * Generates any release artifacts that should be included in the release. @@ -24,7 +49,12 @@ module.exports = function( Release ) { */ generateArtifacts: function( callback ) { Release.exec( "grunt", "Grunt command failed" ); - callback( files ); + makeReleaseCopies( Release ); + callback( distFiles ); } } ); }; + +module.exports.dependencies = [ + "shelljs@0.8.4" +];