From b91ab8983459fa2d86ecbc5b3a67c69524c24721 Mon Sep 17 00:00:00 2001 From: Ben Word Date: Sat, 14 Jan 2017 19:56:17 -0700 Subject: [PATCH] Add option to remove Bootstrap when creating project (#1810) * Add option to remove Bootstrap when creating project * Remove phpmd, per @QWp6t --- composer.json | 9 +- composer.lock | 297 ++--------------------------- src/lib/Sage/PostCreateProject.php | 28 +++ 3 files changed, 44 insertions(+), 290 deletions(-) create mode 100755 src/lib/Sage/PostCreateProject.php diff --git a/composer.json b/composer.json index 1205967..6a42c21 100644 --- a/composer.json +++ b/composer.json @@ -35,13 +35,12 @@ "illuminate/config": "~5.3.0" }, "require-dev": { - "squizlabs/php_codesniffer": "^2.5.1", - "phpmd/phpmd": "^2.4.2" + "squizlabs/php_codesniffer": "^2.5.1" }, "scripts": { "test": [ - "vendor/bin/phpcs", - "vendor/bin/phpmd src text cleancode,codesize,controversial,design,naming,unusedcode" - ] + "vendor/bin/phpcs" + ], + "post-create-project-cmd": "Roots\\Sage\\PostCreateProject::removeBootstrap" } } diff --git a/composer.lock b/composer.lock index ee1cb69..5e7cb59 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "971d5df95d501fb79f467c7192ea7965", - "content-hash": "50f25d093572c0558c11fb9498cb6603", + "hash": "002e8b887ae673a31eb09214ecb0334a", + "content-hash": "94588c58ddc098ab8b4424252ba31242", "packages": [ { "name": "composer/installers", @@ -608,16 +608,16 @@ }, { "name": "symfony/debug", - "version": "v3.1.8", + "version": "v3.1.9", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "c058661c32f5b462722e36d120905940089cbd9a" + "reference": "73f1c337907ba963af8028844fea1af98498dfff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/c058661c32f5b462722e36d120905940089cbd9a", - "reference": "c058661c32f5b462722e36d120905940089cbd9a", + "url": "https://api.github.com/repos/symfony/debug/zipball/73f1c337907ba963af8028844fea1af98498dfff", + "reference": "73f1c337907ba963af8028844fea1af98498dfff", "shasum": "" }, "require": { @@ -661,20 +661,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2016-11-15 12:55:20" + "time": "2017-01-02 20:31:54" }, { "name": "symfony/finder", - "version": "v3.1.8", + "version": "v3.1.9", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "74dcd370c8d057882575e535616fde935e411b19" + "reference": "59687a255d1562f2c17b012418273862083d85f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/74dcd370c8d057882575e535616fde935e411b19", - "reference": "74dcd370c8d057882575e535616fde935e411b19", + "url": "https://api.github.com/repos/symfony/finder/zipball/59687a255d1562f2c17b012418273862083d85f7", + "reference": "59687a255d1562f2c17b012418273862083d85f7", "shasum": "" }, "require": { @@ -710,115 +710,10 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2016-12-13 09:38:21" + "time": "2017-01-02 20:31:54" } ], "packages-dev": [ - { - "name": "pdepend/pdepend", - "version": "2.3.2", - "source": { - "type": "git", - "url": "https://github.com/pdepend/pdepend.git", - "reference": "8d7ab8fe8c1f9de5056bb7ea2c0852f4ddd44f90" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/pdepend/pdepend/zipball/8d7ab8fe8c1f9de5056bb7ea2c0852f4ddd44f90", - "reference": "8d7ab8fe8c1f9de5056bb7ea2c0852f4ddd44f90", - "shasum": "" - }, - "require": { - "php": ">=5.3.7", - "symfony/config": "^2.3.0|^3", - "symfony/dependency-injection": "^2.3.0|^3", - "symfony/filesystem": "^2.3.0|^3" - }, - "require-dev": { - "phpunit/phpunit": "^4.4.0,<4.8", - "squizlabs/php_codesniffer": "^2.0.0" - }, - "bin": [ - "src/bin/pdepend" - ], - "type": "library", - "autoload": { - "psr-4": { - "PDepend\\": "src/main/php/PDepend" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "Official version of pdepend to be handled with Composer", - "time": "2016-11-23 20:25:02" - }, - { - "name": "phpmd/phpmd", - "version": "2.5.0", - "source": { - "type": "git", - "url": "https://github.com/phpmd/phpmd.git", - "reference": "9298602a922cd8c46666df8d540a60bc5925ce55" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpmd/phpmd/zipball/9298602a922cd8c46666df8d540a60bc5925ce55", - "reference": "9298602a922cd8c46666df8d540a60bc5925ce55", - "shasum": "" - }, - "require": { - "pdepend/pdepend": "^2.0.4", - "php": ">=5.3.9" - }, - "require-dev": { - "phpunit/phpunit": "^4.0", - "squizlabs/php_codesniffer": "^2.0" - }, - "bin": [ - "src/bin/phpmd" - ], - "type": "project", - "autoload": { - "psr-0": { - "PHPMD\\": "src/main/php" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Manuel Pichler", - "email": "github@manuel-pichler.de", - "homepage": "https://github.com/manuelpichler", - "role": "Project Founder" - }, - { - "name": "Other contributors", - "homepage": "https://github.com/phpmd/phpmd/graphs/contributors", - "role": "Contributors" - }, - { - "name": "Marc Würth", - "email": "ravage@bluewin.ch", - "homepage": "https://github.com/ravage84", - "role": "Project Maintainer" - } - ], - "description": "PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD.", - "homepage": "http://phpmd.org/", - "keywords": [ - "mess detection", - "mess detector", - "pdepend", - "phpmd", - "pmd" - ], - "time": "2016-11-23 20:33:32" - }, { "name": "squizlabs/php_codesniffer", "version": "2.7.1", @@ -896,174 +791,6 @@ "standards" ], "time": "2016-11-30 04:02:31" - }, - { - "name": "symfony/config", - "version": "v3.2.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/config.git", - "reference": "b4ec9f099599cfc5b7f4d07bb2e910781a2be5e4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/b4ec9f099599cfc5b7f4d07bb2e910781a2be5e4", - "reference": "b4ec9f099599cfc5b7f4d07bb2e910781a2be5e4", - "shasum": "" - }, - "require": { - "php": ">=5.5.9", - "symfony/filesystem": "~2.8|~3.0" - }, - "require-dev": { - "symfony/yaml": "~3.0" - }, - "suggest": { - "symfony/yaml": "To use the yaml reference dumper" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Config\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Config Component", - "homepage": "https://symfony.com", - "time": "2016-12-09 07:45:17" - }, - { - "name": "symfony/dependency-injection", - "version": "v3.2.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/dependency-injection.git", - "reference": "037054501c41007c93b6de1b5c7a7acb83523593" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/037054501c41007c93b6de1b5c7a7acb83523593", - "reference": "037054501c41007c93b6de1b5c7a7acb83523593", - "shasum": "" - }, - "require": { - "php": ">=5.5.9" - }, - "conflict": { - "symfony/yaml": "<3.2" - }, - "require-dev": { - "symfony/config": "~2.8|~3.0", - "symfony/expression-language": "~2.8|~3.0", - "symfony/yaml": "~3.2" - }, - "suggest": { - "symfony/config": "", - "symfony/expression-language": "For using expressions in service container configuration", - "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", - "symfony/yaml": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\DependencyInjection\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony DependencyInjection Component", - "homepage": "https://symfony.com", - "time": "2016-12-08 15:27:33" - }, - { - "name": "symfony/filesystem", - "version": "v3.2.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "8d4cf7561a5b17e5eb7a02b80d0b8f014a3796d4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/8d4cf7561a5b17e5eb7a02b80d0b8f014a3796d4", - "reference": "8d4cf7561a5b17e5eb7a02b80d0b8f014a3796d4", - "shasum": "" - }, - "require": { - "php": ">=5.5.9" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Filesystem\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Filesystem Component", - "homepage": "https://symfony.com", - "time": "2016-11-24 00:46:43" } ], "aliases": [], diff --git a/src/lib/Sage/PostCreateProject.php b/src/lib/Sage/PostCreateProject.php new file mode 100755 index 0000000..df9eb58 --- /dev/null +++ b/src/lib/Sage/PostCreateProject.php @@ -0,0 +1,28 @@ +getIO(); + + // @codingStandardsIgnoreStart + if ($io->isInteractive()) { + if ($io->askConfirmation('Remove Bootstrap? [y,N]? ', false)) { + file_put_contents('package.json', str_replace(' "bootstrap": "^4.0.0-alpha.6",' . "\n", '', file_get_contents('package.json'))); + file_put_contents('assets/styles/main.scss', str_replace('// Import npm dependencies' . "\n", '', file_get_contents('assets/styles/main.scss'))); + file_put_contents('assets/styles/main.scss', str_replace('@import "~bootstrap/scss/bootstrap";' . "\n", '', file_get_contents('assets/styles/main.scss'))); + file_put_contents('assets/scripts/main.js', str_replace('import \'bootstrap/dist/js/bootstrap\';' . "\n", '', file_get_contents('assets/scripts/main.js'))); + file_put_contents('assets/styles/components/_comments.scss', ''); + file_put_contents('assets/styles/components/_forms.scss', ''); + file_put_contents('assets/styles/components/_wp-classes.scss', ''); + file_put_contents('assets/styles/layouts/_header.scss', ''); + } + } + // @codingStandardsIgnoreEnd + } +}