Commit 093c37db authored by Philipp Nowinski's avatar Philipp Nowinski
Browse files

[FEATURE] upate deps and add release script

parent 8329a3af
'use strict';
const inquirer = require('inquirer'),
yargs = require('yargs').argv,
chalk = require('chalk'),
fs = require('fs'),
replace = require('replace-in-file'),
settings = require('../../gulp/settings'),
basePath = settings.getConfig().directories.basePath;
if (typeof yargs.ext === 'undefined') {
console.error(chalk.red('Please specify the extension you want to release!'))
} else if (!fs.existsSync(`${basePath}${yargs.ext}`)) {
console.error(chalk.red(`Could not find extension in ${yargs.ext}!`))
} else {
inquirer.prompt([
{
type: 'confirm',
name: 'major',
message: 'Does the user need to apply changes to the code base or configuration after installing your update?'
},
{
type: 'confirm',
name: 'feature',
message: 'Did you develop new features?',
when: answers => !answers.major
}
]).then(answers => {
try {
let pathToComposer = `${process.cwd()}/${basePath}/${yargs.ext}/composer.json`,
pathToExtEmconf = `${process.cwd()}/${basePath}/${yargs.ext}/ext_emconf.php`,
composerFile = require(pathToComposer),
currentVersion = composerFile.version,
nextVersionNumber = getNextVersionNumber(answers, currentVersion);
updateComposerJson(currentVersion, nextVersionNumber, pathToComposer).then(() => {
updateExtEmconf(currentVersion, nextVersionNumber, pathToExtEmconf)
});
} catch (error) {
console.error(chalk.red('Could not open file!'))
}
});
}
function getNextVersionNumber(answers, currentVersion) {
let numbers = currentVersion.split('.');
if (answers.major) {
numbers[0] = parseInt(numbers[0]) + 1;
numbers[1] = 0;
numbers[2] = 0;
} else if (answers.feature) {
numbers[1] = parseInt(numbers[1]) + 1;
numbers[2] = 0;
} else {
numbers[2] = parseInt(numbers[2]) + 1;
}
return `${numbers[0]}.${numbers[1]}.${numbers[2]}`;
}
function updateComposerJson(currentVersion, newVersion, path) {
return replace({
files: path,
from: `"version": "${currentVersion}"`,
to: `"version": "${newVersion}"`
});
}
function updateExtEmconf(currentVersion, newVersion, path) {
return replace({
files: path,
from: `'version' => '${currentVersion}'`,
to: `'version': '${newVersion}'`
});
}
......@@ -1289,9 +1289,9 @@ clap@^1.0.9:
dependencies:
chalk "^1.1.3"
clean-css@4.1.2:
version "4.1.2"
resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-4.1.2.tgz#6029aea30b1d9520a968a3caee0dabb1184e353a"
clean-css@4.1.3:
version "4.1.3"
resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-4.1.3.tgz#07cfe8980edb20d455ddc23aadcf1e04c6e509ce"
dependencies:
source-map "0.5.x"
......@@ -1908,14 +1908,14 @@ domelementtype@~1.1.1:
resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-1.1.3.tgz#bd28773e2642881aec51544924299c5cd822185b"
domhandler@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-2.3.0.tgz#2de59a0822d5027fabff6f032c2b25a2a8abe738"
version "2.4.1"
resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-2.4.1.tgz#892e47000a99be55bbf3774ffea0561d8879c259"
dependencies:
domelementtype "1"
domutils@^1.5.1:
version "1.5.1"
resolved "https://registry.yarnpkg.com/domutils/-/domutils-1.5.1.tgz#dcd8488a26f563d61079e48c9f7b7e32373682cf"
version "1.6.2"
resolved "https://registry.yarnpkg.com/domutils/-/domutils-1.6.2.tgz#1958cc0b4c9426e9ed367fb1c8e854891b0fa3ff"
dependencies:
dom-serializer "0"
domelementtype "1"
......@@ -2093,8 +2093,8 @@ error-ex@^1.2.0:
is-arrayish "^0.2.1"
es5-ext@^0.10.14, es5-ext@^0.10.9, es5-ext@~0.10.14:
version "0.10.20"
resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.20.tgz#72a9b4fd5832797ba1bb65dceb2e25c04241c492"
version "0.10.21"
resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.21.tgz#19a725f9e51d0300bbc1e8e821109fd9daf55925"
dependencies:
es6-iterator "2"
es6-symbol "~3.1"
......@@ -2245,6 +2245,10 @@ esprima@^2.6.0:
version "2.7.3"
resolved "https://registry.yarnpkg.com/esprima/-/esprima-2.7.3.tgz#96e3b70d5779f6ad49cd032673d1c312767ba581"
esprima@^3.1.1:
version "3.1.3"
resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633"
esprima@~1.0.2:
version "1.0.4"
resolved "https://registry.yarnpkg.com/esprima/-/esprima-1.0.4.tgz#9f557e08fc3b4d26ece9dd34f8fbf476b62585ad"
......@@ -2404,8 +2408,8 @@ extend@^3.0.0, extend@~3.0.0:
resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444"
external-editor@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.0.1.tgz#4c597c6c88fa6410e41dbbaa7b1be2336aa31095"
version "2.0.2"
resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.0.2.tgz#384f6d8ae02054235c19e0a142c6d6fc36ad9363"
dependencies:
tmp "^0.0.31"
......@@ -2751,10 +2755,6 @@ get-stdin@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe"
get-stdin@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-5.0.1.tgz#122e161591e21ff4c52530305693f20e6393a398"
get-stream@^2.2.0:
version "2.3.1"
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-2.3.1.tgz#5f38f93f346009666ee0150a054167f91bdd95de"
......@@ -2872,7 +2872,7 @@ glob@^5.0.3, glob@~5.0.0:
once "^1.3.0"
path-is-absolute "^1.0.0"
glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.0, glob@~7.1.1:
glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.0, glob@^7.1.1, glob@~7.1.1:
version "7.1.2"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15"
dependencies:
......@@ -3012,10 +3012,10 @@ gulp-check-filesize@^2.0.1:
through2 "*"
gulp-clean-css@^3.3.1:
version "3.3.1"
resolved "https://registry.yarnpkg.com/gulp-clean-css/-/gulp-clean-css-3.3.1.tgz#76fbc62ce7075b33753662618e26bc052dab14f6"
version "3.4.0"
resolved "https://registry.yarnpkg.com/gulp-clean-css/-/gulp-clean-css-3.4.0.tgz#cb4c1c746545b72f7c150c8dd906a6ee739fd84f"
dependencies:
clean-css "4.1.2"
clean-css "4.1.3"
gulp-util "3.0.8"
through2 "2.0.3"
vinyl-sourcemaps-apply "0.2.1"
......@@ -3584,10 +3584,6 @@ indent-string@^2.1.0:
dependencies:
repeating "^2.0.0"
indent-string@^3.0.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-3.1.0.tgz#08ff4334603388399b329e6b9538dc7a3cf5de7d"
indexof@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/indexof/-/indexof-0.0.1.tgz#82dc336d232b9062179d05ab3293a66059fd435d"
......@@ -3650,7 +3646,7 @@ inquirer@^0.12.0:
strip-ansi "^3.0.0"
through "^2.3.6"
inquirer@^3.0.1:
inquirer@^3.0.1, inquirer@^3.0.6:
version "3.0.6"
resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-3.0.6.tgz#e04aaa9d05b7a3cb9b0f407d04375f0447190347"
dependencies:
......@@ -4028,7 +4024,14 @@ js-tokens@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.1.tgz#08e9f132484a2c45a30907e9dc4d5567b7f114d7"
js-yaml@^3.5.1, js-yaml@~3.7.0:
js-yaml@^3.5.1:
version "3.8.4"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.8.4.tgz#520b4564f86573ba96662af85a8cafa7b4b5a6f6"
dependencies:
argparse "^1.0.7"
esprima "^3.1.1"
js-yaml@~3.7.0:
version "3.7.0"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.7.0.tgz#5c967ddd837a9bfdca5f2de84253abe8a1c03b80"
dependencies:
......@@ -4494,14 +4497,10 @@ logalot@^2.0.0:
figures "^1.3.5"
squeak "^1.0.0"
longest@^1.0.1:
longest@^1.0.0, longest@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097"
longest@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/longest/-/longest-2.0.0.tgz#557486e1f7e1dd6557330aa22834dee9a537e40c"
loose-envify@^1.0.0:
version "1.3.1"
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848"
......@@ -4520,19 +4519,14 @@ lowercase-keys@^1.0.0:
resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-1.0.0.tgz#4e3366b39e7f5457e35f1324bdf6f88d0bfc7306"
lpad-align@^1.0.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/lpad-align/-/lpad-align-1.1.1.tgz#a179e190eeee2b86460f822566f4f3548a31625f"
version "1.1.2"
resolved "https://registry.yarnpkg.com/lpad-align/-/lpad-align-1.1.2.tgz#21f600ac1c3095c3c6e497ee67271ee08481fe9e"
dependencies:
get-stdin "^5.0.1"
indent-string "^3.0.0"
longest "^2.0.0"
lpad "^2.0.1"
get-stdin "^4.0.1"
indent-string "^2.1.0"
longest "^1.0.0"
meow "^3.3.0"
lpad@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/lpad/-/lpad-2.0.1.tgz#28316b4e7b2015f511f6591459afc0e5944008ad"
lru-cache@2:
version "2.7.3"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-2.7.3.tgz#6d4524e8b955f95d4f5b58851ce21dd72fb4e952"
......@@ -5782,6 +5776,14 @@ replace-ext@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/replace-ext/-/replace-ext-1.0.0.tgz#de63128373fcbf7c3ccfa4de5a480c45a67958eb"
replace-in-file@^2.5.0:
version "2.5.0"
resolved "https://registry.yarnpkg.com/replace-in-file/-/replace-in-file-2.5.0.tgz#1f6388225c8acb4db288a8189365e266f9824da4"
dependencies:
chalk "^1.1.3"
glob "^7.1.1"
yargs "^7.0.1"
request-capture-har@^1.2.2:
version "1.2.2"
resolved "https://registry.yarnpkg.com/request-capture-har/-/request-capture-har-1.2.2.tgz#cd692cfb2cc744fd84a3358aac6ee51528cf720d"
......@@ -6790,8 +6792,8 @@ typedarray@^0.0.6, typedarray@~0.0.5:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
typescript@^2.0.3:
version "2.3.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.3.2.tgz#f0f045e196f69a72f06b25fd3bd39d01c3ce9984"
version "2.3.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.3.3.tgz#9639f3c3b40148e8ca97fe08a51dd1891bb6be22"
ua-parser-js@0.7.12:
version "0.7.12"
......@@ -7284,7 +7286,7 @@ yargs@6.4.0:
y18n "^3.2.1"
yargs-parser "^4.1.0"
yargs@^7.0.0:
yargs@^7.0.0, yargs@^7.0.1:
version "7.1.0"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-7.1.0.tgz#6ba318eb16961727f5d284f8ea003e8d6154d0c8"
dependencies:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment