Commit ce4ead74 authored by Philipp Nowinski's avatar Philipp Nowinski
Browse files

[TASK] remove old upgrade script

parent 2b584aa5
'use strict';
let filePath = process.cwd() + '/../.sgc-config.json';
const sgcConfiguration = require(filePath);
const jsonFormat = require('json-format');
const fs = require('fs');
const chalk = require('chalk');
const request = require('request');
const inquirer = require('inquirer');
if (!sgcConfiguration.js.hasOwnProperty('pipeline')) {
console.log(chalk.green('Add JS pipeline configuration to your .sgc-config.json ✓'));
sgcConfiguration.js.pipeline = {
uglify: true,
renameToDotMin: true
};
}
if (!sgcConfiguration.css.hasOwnProperty('pipeline')) {
console.log(chalk.green('Add CSS pipeline configuration to your .sgc-config.json ✓'));
sgcConfiguration.css.pipeline = {
cleanCss: true,
renameToDotMin: true
};
}
if (!sgcConfiguration.css.hasOwnProperty('supportedBrowsers')) {
console.log(chalk.green('Add supported Browsers configuration to your .sgc-config.json ✓'));
sgcConfiguration.css.supportedBrowsers = ['last 1 version', '> 1%', 'ie 8'];
}
console.log('');
console.log(chalk.green('Your .sgc-config.json is compatible with SGC 2.1.0 ✓'));
fs.writeFile(filePath, jsonFormat(sgcConfiguration), error => console.log);
checkEslint();
function checkEslint() {
fs.exists(process.cwd() + '/../.eslintrc.js', exists => {
if (!exists) {
console.log('');
inquirer.prompt([
{
type: 'confirm',
name: 'provideEsLint',
message: 'Looks like you don\'t have an EsLint configuration file, yet. Do you want to include the sgalinski default configuration?'
}
]).then(answers => {
if (answers.provideEsLint) {
request('https://gitlab.sgalinski.de/snippets/28/raw').pipe(fs.createWriteStream(process.cwd() + '/../.eslintrc.js'));
console.log(chalk.green('Add EsLint configuration ✓'));
}
checkJsHint();
});
} else {
console.log(chalk.green('EsLint configuration found ✓'));
checkJsHint();
}
});
}
function checkJsHint() {
fs.exists(process.cwd() + '/../.jshintrc', exists => {
if (exists) {
console.log('');
inquirer.prompt([
{
type: 'confirm',
name: 'removeJsHint',
message: 'The SGC does not use JsHint anymore. Do you want to remove your .jshintrc file?'
}
]).then(answers => {
if (answers.removeJsHint) {
fs.unlink(process.cwd() + '/../.jshintrc', error => console.log);
console.log(chalk.green('Removed .jshintrc ✓'));
}
checkStyleLint();
});
} else {
checkStyleLint();
}
});
}
function checkStyleLint() {
fs.exists(process.cwd() + '/../.stylelintrc', exists => {
if (!exists) {
console.log('');
inquirer.prompt([
{
type: 'confirm',
name: 'provideStyleLint',
message: 'Looks like you don\'t have a Stylelint configuration file, yet. Do you want to include the sgalinski default configuration?'
}
]).then(answers => {
if (answers.provideStyleLint) {
request('https://gitlab.sgalinski.de/snippets/29/raw').pipe(fs.createWriteStream(process.cwd() + '/../.stylelintrc'));
console.log(chalk.green('Add Stylelint configuration ✓'));
}
checkScssLint();
});
} else {
console.log(chalk.green('Stylelint configuration found ✓'));
checkScssLint();
}
});
}
function checkScssLint() {
fs.exists(process.cwd() + '/../.scss-lint.yml', exists => {
if (exists) {
console.log('');
inquirer.prompt([
{
type: 'confirm',
name: 'removeScssLint',
message: 'The SGC does not use scss-lint anymore. Do you want to remove your .scss-lint.yml file?'
}
]).then(answers => {
if (answers.removeScssLint) {
fs.unlink(process.cwd() + '/../.scss-lint.yml', error => console.log);
console.log(chalk.green('Removed .scss-lint.yml ✓'));
}
});
}
});
}
......@@ -75,17 +75,6 @@ npm ci --prefer-offline --no-audit &> /dev/null
npm set progress=true
echo -e "\033[0;32mDependencies installed ✓\033[0m\n"
# copy config file if no present yet
if [ ! -e ../.sgc-config.json ]
then
cp ./gulp/sgc-config.template.json ../.sgc-config.json
echo -e "\033[0;32mSGC config file created ✓\033[0m\n"
else
echo -e "\033[0;34mSGC config file found. Skip config creation...\033[0m";
# run upgrade wizard to ensure compatibility with current version
# node ./core/installers/upgrade.js
fi
if [ "$1" == "--local" ]; then
# install cli locally
echo -e "\033[0;34mInstall sgc\033[0m";
......
Supports Markdown
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