Commit 3dc9206d authored by Philipp Nowinski's avatar Philipp Nowinski
Browse files

Merge branch 'next' into 'master'

Next

See merge request !2
parents bca36402 6c12f651
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
lastUpdateCheck 1495625859628
yarn-offline-mirror "sgc-packages-offline-cache"
yarn-offline-mirror-pruning true
......@@ -20,10 +20,12 @@ if [ "$1" == "shortlist" ]; then
else
echo -e ${taskList}
fi
elif [ -e "sgc-core/modules/$1.sh" ]; then
./sgc-core/modules/$1.sh
elif [ -e "sgc-core/core/modules/$1.sh" ]; then
./sgc-core/core/modules/$1.sh
elif [ -e "./sgc-scripts/$1.sh" ]; then
./sgc-scripts/$1.sh
elif [ -e "./sgc-core/core/modules/$1.js" ]; then
node ./sgc-core/core/modules/$1.js $@
else
cd sgc-core
......
......@@ -9,7 +9,12 @@ then
then
gem install scss_lint
else
sudo gem install scss_lint
gem install scss_lint
if [ $? -ne 0 ]
then
echo -e "\033[0;34mInstallation failed, trying to install with sudo\033[0m";
sudo gem install scss_lint
fi
fi
else
echo -e "\n\033[0;31mYou need to have ruby installed on your machine in order for scss-lint to work!\033[0m\n";
......@@ -17,5 +22,3 @@ then
else
echo -e "\033[0;32mscss-lint already installed ✓\033[0m\n"
fi
'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 ✓'));
}
});
}
});
}
'use strict';
const exec = require('child_process').exec,
settings = require('../../gulp/settings'),
chalk = require('chalk');
console.log(`${chalk.bold(chalk.yellow('Heads up:'))} ${chalk.yellow('this feature is still experimental!')}`);
exec(`node ./sgc-core/node_modules/lighthouse/lighthouse-cli/index.js --chrome-flags="--ignore-certificate-errors" ${settings.getConfig().browsersync.url} --view`);
'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}'`
});
}
nodeversion="6.7.0"
nodeversion="7.10.0"
SGC_VERSION=2.0.0
SGC_VERSION=2.1.0
'use strict';
var gulp = require('gulp'),
let gulp = require('gulp'),
path = require('path'),
settings = require('./settings'),
config = settings.getConfig(),
......@@ -14,19 +14,22 @@ var gulp = require('gulp'),
lazypipe = require('lazypipe');
function processCss() {
var filter = plugins.filter(filterPattern, {restore: true}),
let filter = plugins.filter(filterPattern, {restore: true}),
compilationProcess = lazypipe()
.pipe(plugins.sass, {precision: 8})
.pipe(plugins.cssImageDimensions, path.resolve(settings.getPath() + '/' + config.directories.images))
.pipe(plugins.autoprefixer, {
browsers: ['last 1 version', '> 1%', 'ie 8']
browsers: config.css.supportedBrowsers ? config.css.supportedBrowsers : ['last 1 version', '> 1%', 'ie 8']
})
.pipe(plugins.cleanCss, {
"restructuring": false,
"advanced": false
.pipe(function() {
return plugins.if(config.css.pipeline.cleanCss, plugins.cleanCss({
inline: false
}));
})
.pipe(plugins.rename, {
suffix: '.min'
.pipe(function() {
return plugins.if(config.css.pipeline.renameToDotMin, plugins.rename({
suffix: '.min'
}));
});
if (argv.production) {
......@@ -39,11 +42,15 @@ function processCss() {
.pipe(filter.restore)
.pipe(gulp.dest(settings.getPath() + '/' + config.directories.css));
} else {
let sourcemapsPath;
if (config.directories.hasOwnProperty('cssSourceMaps') && config.directories.cssSourceMaps !== 'inline') {
sourcemapsPath = path.relative(settings.getPath() + '/' + config.directories.css, settings.getPath() + '/' + config.directories.cssSourceMaps);
}
return gulp.src([settings.getPath() + '/' + config.directories.sass + '/**/*.scss', '!**/*scsslint_tmp*.scss'], {since: gulp.lastRun('css')})
.pipe(plugins.sourcemaps.init())
.pipe(compilationProcess())
.on('error', plugins.sass.logError)
.pipe(plugins.sourcemaps.write(path.relative(settings.getPath() + '/' + config.directories.css, settings.getPath() + '/' + config.directories.cssSourceMaps)))
.pipe(plugins.sourcemaps.write(sourcemapsPath))
.pipe(filter)
.pipe(plugins.checkFilesize({
enableGzip: true
......@@ -60,7 +67,7 @@ function processCssAndSync() {
gulp.task('css:sprites', function() {
// Generate our spritesheet
var spriteData = gulp.src(settings.getPath() + '/' + config.directories.sprites + '/**/*.png').pipe(plugins.spritesmith({
let spriteData = gulp.src(settings.getPath() + '/' + config.directories.sprites + '/**/*.png').pipe(plugins.spritesmith({
imgName: 'sprites.png',
cssName: '_sprite.scss',
imgPath: '/' + settings.getPath(true) + '/' + config.directories.images + '/sprites.png',
......@@ -68,14 +75,14 @@ gulp.task('css:sprites', function() {
}));
// Pipe image stream through image optimizer and onto disk
var imgStream = spriteData.img
let imgStream = spriteData.img
.pipe(buffer())
.pipe(plugins.imagemin({
progressive: true
}))
.pipe(gulp.dest(settings.getPath() + '/' + config.directories.images));
var cssStream = spriteData.css
let cssStream = spriteData.css
.pipe(gulp.dest(settings.getPath() + '/' + config.directories.sass));
return merge(imgStream, cssStream);
......
......@@ -9,7 +9,7 @@
}
{{#svgs}}
${{{name}}}: '{{{inline}}}' {{width}} {{height}};
${{{name}}}: "{{{inline}}}" {{width}} {{height}};
{{/svgs}}
@mixin inline-svg($name, $color: null) {
......
'use strict';
var gulp = require('gulp'),
const gulp = require('gulp'),
settings = require('./settings'),
config = settings.getConfig(),
path = require('path'),
argv = require('yargs').argv,
glob = require('glob'),
compiler,
plugins = require('gulp-load-plugins')({
pattern: ['gulp-*', 'gulp.*', 'browserify', 'browser-sync']
});
let compiler;
function setUpCompiler() {
if (!config.js.compiler) {
plugins.util.log(plugins.util.colors.red('No compiler specified!'));
......@@ -35,8 +36,8 @@ function setUpCompiler() {
gulp.task('js:qa', function() {
return gulp.src([settings.getPath() + '/' + config.directories.javascriptSrc + '/**/*.js', '!**/*.min.js'].concat(config.js.excludeFromQa))
.pipe(plugins.jshint())
.pipe(plugins.jshint.reporter('jshint-stylish'));
.pipe(plugins.eslint())
.pipe(plugins.eslint.format('sgc-core/node_modules/eslint-formatter-pretty'))
});
gulp.task('js:compile', function(done) {
......
......@@ -42,6 +42,10 @@ module.exports = function() {
}))
.pipe(gulp.dest(settings.getPath() + '/' + config.directories.javascriptDest));
} else {
let sourcemapsPath;
if (config.directories.hasOwnProperty('javascriptSourceMaps') && config.directories.javascriptSourceMaps !== 'inline') {
sourcemapsPath = path.relative(settings.getPath() + '/' + config.directories.javascriptDest, settings.getPath() + '/' + config.directories.javascriptSourceMaps);
}
return browserify.transform(babelify.configure({
presets: [require('babel-preset-es2015')]
}))
......@@ -49,16 +53,16 @@ module.exports = function() {
.pipe(source(file))
.pipe(buffer())
.pipe(plugins.sourcemaps.init({loadMaps: true}))
.pipe(plugins.uglify())
.pipe(plugins.if(config.js.pipeline.uglify, plugins.uglify()))
.on('error', console.log)
.pipe(rename({
extname: '.bundled.min.js',
extname: config.js.pipeline.renameToDotMin ? '.bundled.min.js' : '.bundled.js',
dirname: ''
}))
.pipe(plugins.checkFilesize({
enableGzip: true
}))
.pipe(plugins.sourcemaps.write(path.relative(settings.getPath() + '/' + config.directories.javascriptDest, settings.getPath() + '/' + config.directories.javascriptSourceMaps)))
.pipe(plugins.sourcemaps.write(sourcemapsPath))
.pipe(gulp.dest(settings.getPath() + '/' + config.directories.javascriptDest));
}
});
......
......@@ -41,22 +41,26 @@ module.exports = function() {
}))
.pipe(gulp.dest(settings.getPath() + '/' + config.directories.javascriptDest));
} else {
let sourcemapsPath;
if (config.directories.hasOwnProperty('javascriptSourceMaps') && config.directories.javascriptSourceMaps !== 'inline') {
sourcemapsPath = path.relative(settings.getPath() + '/' + config.directories.javascriptDest, settings.getPath() + '/' + config.directories.javascriptSourceMaps);
}
return browserify
.plugin(tsify, {noImplicitAny: true})
.bundle()
.pipe(source(file))
.pipe(buffer())
.pipe(plugins.sourcemaps.init({loadMaps: true}))
.pipe(plugins.uglify())
.pipe(plugins.if(config.js.pipeline.uglify, plugins.uglify()))
.on('error', console.log)
.pipe(rename({
extname: '.bundled.min.js',
extname: config.js.pipeline.renameToDotMin ? '.bundled.min.js' : '.bundled.js',
dirname: ''
}))
.pipe(plugins.checkFilesize({
enableGzip: true
}))
.pipe(plugins.sourcemaps.write(path.relative(settings.getPath() + '/' + config.directories.javascriptDest, settings.getPath() + '/' + config.directories.javascriptSourceMaps)))
.pipe(plugins.sourcemaps.write(sourcemapsPath))
.pipe(gulp.dest(settings.getPath() + '/' + config.directories.javascriptDest));
}
});
......
......@@ -23,12 +23,21 @@
],
"excludeFromQa": [
"!**/Extensions/**/*"
]
],
"pipeline": {
"uglify": true,
"renameToDotMin": true
}
},
"css": {
"excludeFromQa": [
"!**/FontAwesome/**/*"
]
],
"supportedBrowsers": ["last 1 version", "> 1%", "ie 8"],
"pipeline": {
"cleanCss": true,
"renameToDotMin": true
}
},
"images": {
"optimize": [
......
......@@ -57,7 +57,9 @@ echo -e "\033[0;32mNode installed ✓\033[0m\n"
# install node deps
echo -e "\033[0;34mInstall dependencies\033[0m";
rm -rf ./node_modules
npm install --depth 0
npm install yarn
node_modules/yarn/bin/yarn install
echo -e "\033[0;32mDependencies installed ✓\033[0m\n"
echo -e "\033[0;34mInstall ruby dependencies\033[0m";
......@@ -71,6 +73,8 @@ then
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
......
This diff is collapsed.
......@@ -11,44 +11,48 @@
"license": "SEE LICENSE IN LICENSE.md",
"devDependencies": {},
"engines": {
"node": "~6.7.0"
"node": "~7.10.0"
},
"dependencies": {
"babel-preset-es2015": "^6.16.0",
"babel-preset-es2015": "^6.24.1",
"babelify": "^7.3.0",
"browser-sync": "^2.17.0",
"browserify": "^13.1.0",
"browser-sync": "^2.18.12",
"browserify": "^14.3.0",
"eslint-formatter-pretty": "^1.1.0",
"event-stream": "^3.3.4",
"gulp": "github:gulpjs/gulp#4.0",
"gulp-autoprefixer": "^3.1.1",
"gulp-autoprefixer": "^4.0.0",
"gulp-check-filesize": "^2.0.1",
"gulp-clean-css": "^2.0.13",
"gulp-clean-css": "^3.3.1",
"gulp-css-image-dimensions": "^1.1.5",
"gulp-filter": "^4.0.0",
"gulp-eslint": "^3.0.1",
"gulp-filter": "^5.0.0",
"gulp-hub": "^0.8.0",
"gulp-if": "^2.0.1",
"gulp-imagemin": "^3.0.3",
"gulp-inline-source": "^3.0.0",
"gulp-inline-svg": "^1.0.3",
"gulp-jshint": "^2.0.1",
"gulp-load-plugins": "^1.3.0",
"gulp-if": "^2.0.2",
"gulp-imagemin": "^3.2.0",
"gulp-inline-source": "^3.1.0",
"gulp-inline-svg": "^1.1.1",
"gulp-load-plugins": "^1.5.0",
"gulp-rename": "^1.2.2",
"gulp-sass": "^2.3.2",
"gulp-sass": "^3.1.0",
"gulp-scss-lint": "^0.4.0",
"gulp-scss-lint-stylish": "^1.0.1",
"gulp-sourcemaps": "^1.6.0",
"gulp-svgmin": "^1.2.3",
"gulp-uglify": "^2.0.0",
"gulp-util": "^3.0.7",
"gulp.spritesmith": "^6.2.1",
"jshint": "^2.9.3",
"jshint-stylish": "^2.2.1",
"gulp-sourcemaps": "^2.6.0",
"gulp-svgmin": "^1.2.4",
"gulp-uglify": "^3.0.0",
"gulp-util": "^3.0.8",
"gulp.spritesmith": "^6.5.0",
"inquirer": "^3.0.6",
"json-format": "^1.0.1",
"lazypipe": "^1.0.1",
"merge-stream": "^1.0.0",
"tsify": "^1.0.8",
"lighthouse": "^2.0.0",
"merge-stream": "^1.0.1",
"replace-in-file": "^2.5.0",
"tsify": "^3.0.1",
"typescript": "^2.0.3",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.1.0",
"yargs": "^6.0.0"
"yargs": "^8.0.1",
"yarn": "^0.24.5"
}
}
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