Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .vortex/installer/src/Prompts/Handlers/Theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,6 @@ public function process(): void {
$file_tmpl = static::findThemeFile($t, $w);
if (!empty($file_tmpl) && is_readable($file_tmpl)) {
File::remove(dirname($file_tmpl));

File::removeLineInFile($t . '/phpunit.xml', '<directory suffix="Test.php">web/themes/custom</directory>');
File::removeLineInFile($t . '/phpunit.xml', '<directory>web/themes/custom/*/node_modules</directory>');
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@@ -160,7 +160,7 @@
# Database dump file sourced from a URL.
#
# HTTP Basic Authentication credentials should be embedded into the value.
-VORTEX_DOWNLOAD_DB_URL=
+VORTEX_DOWNLOAD_DB_URL=https://github.com/drevops/vortex/releases/download/__VERSION__/db_d11.demo.sql

# Environment to download the database from.
#
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
@@ -1,57 +1 @@
-{
- "name": "star_wars",
- "version": "__VERSION__",
- "private": true,
- "description": "NodeJS dependencies for star wars project",
- "devDependencies": {
- "@homer0/prettier-plugin-jsdoc": "__VERSION__",
- "autoprefixer": "__VERSION__",
- "chokidar-cli": "__VERSION__",
- "eslint": "__VERSION__",
- "eslint-config-airbnb-base": "__VERSION__",
- "eslint-config-prettier": "__VERSION__",
- "eslint-plugin-import": "__VERSION__",
- "eslint-plugin-jsdoc": "__VERSION__",
- "eslint-plugin-no-jquery": "__VERSION__",
- "eslint-plugin-prettier": "__VERSION__",
- "eslint-plugin-yml": "__VERSION__",
- "patch-package": "__VERSION__",
- "postcss": "__VERSION__",
- "postcss-cli": "__VERSION__",
- "prettier": "__VERSION__",
- "sass": "__VERSION__",
- "stylelint": "__VERSION__",
- "stylelint-config-standard": "__VERSION__",
- "stylelint-config-standard-scss": "__VERSION__",
- "stylelint-order": "__VERSION__",
- "stylelint-scss": "__VERSION__",
- "terser": "__VERSION__"
- },
- "browserslist": [
- "last 2 versions",
- "not ie <= 8",
- "iOS >= 7"
- ],
- "scripts": {
- "build": "npm run clean && mkdir -p build/js && npm run concat && npm run uglify && npm run sass:prod && npm run postcss:prod && npm run copy",
- "build-dev": "npm run clean && mkdir -p build/js && npm run concat && npm run sass:dev && npm run postcss:dev && npm run copy",
- "clean": "rm -rf build",
- "concat": "find js -name '*.js' ! -name '*.min.js' -exec cat {} + > build/js/star_wars.min.js",
- "copy": "npm run copy:images && npm run copy:fonts",
- "copy:fonts": "mkdir -p build/fonts && cp -r fonts/* build/fonts/ 2>/dev/null || true",
- "copy:images": "mkdir -p build/images && cp -r images/* build/images/ 2>/dev/null || true",
- "lint": "npm run lint-js && npm run lint-css",
- "lint-css": "stylelint 'scss/**/*.scss'",
- "lint-css-fix": "stylelint 'scss/**/*.scss' --fix",
- "lint-fix": "npm run lint-js-fix && npm run lint-css-fix",
- "lint-js": "eslint 'js/**/*.js' --ignore-pattern '*.min.js'",
- "lint-js-fix": "eslint 'js/**/*.js' --ignore-pattern '*.min.js' --fix",
- "postcss:dev": "postcss build/css/star_wars.min.css -o build/css/star_wars.min.css --map",
- "postcss:prod": "postcss build/css/star_wars.min.css -o build/css/star_wars.min.css --no-map",
- "postinstall": "patch-package",
- "sass:dev": "sass scss/styles.scss build/css/star_wars.min.css --source-map --style=expanded",
- "sass:prod": "sass scss/styles.scss build/css/star_wars.min.css --no-source-map --style=compressed",
- "uglify": "terser build/js/star_wars.min.js -o build/js/star_wars.min.js -c drop_console=true -m reserved=['jQuery','Drupal'] 2>/dev/null || true",
- "watch": "chokidar 'js/**/*.js' 'scss/**/*.scss' -c 'npm run build-dev'"
- }
-}
+{"name": "star_wars_custom"}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
@@ -1,23 +1,3 @@
-name: star_wars
+name: Star Wars Custom
type: theme
-description: 'star wars theme.'
core_version_requirement: ^11
-base theme: olivero
-
-libraries:
- - star_wars/global-styling
-
-regions:
- header: Header
- primary_menu: 'Primary menu'
- secondary_menu: 'Secondary menu'
- hero: 'Hero (full width)'
- highlighted: Highlighted
- breadcrumb: Breadcrumb
- social: Social Bar
- content_above: Content Above
- content: Content
- sidebar: 'Sidebar'
- content_below: 'Content Below'
- footer_top: 'Footer Top'
- footer_bottom: 'Footer Bottom'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.star-wars { color: blue; }
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use DrevOps\VortexInstaller\Prompts\Handlers\Theme;
use DrevOps\VortexInstaller\Tests\Functional\FunctionalTestCase;
use DrevOps\VortexInstaller\Utils\Env;
use DrevOps\VortexInstaller\Utils\File;
use PHPUnit\Framework\Attributes\CoversClass;

#[CoversClass(Theme::class)]
Expand Down Expand Up @@ -47,6 +48,38 @@ public static function dataProviderHandlerProcess(): \Iterator {
static::cw(fn() => Env::put(Theme::envName(), 'light_saber')),
static::cw(fn(FunctionalTestCase $test) => $test->assertDirectoryNotContainsString(static::$sut, 'your_site_theme')),
];
yield 'theme_custom_non_vortex' => [
static::cw(function (FunctionalTestCase $test): void {
Env::put(Theme::envName(), 'star_wars');

// Run a first install to create a proper Vortex project
// with a Vortex-sourced custom theme.
$test->runNonInteractiveInstall();

$theme_dir = static::$sut . '/web/themes/custom/star_wars';
$test->assertFilesExist($theme_dir, ['star_wars.theme'], 'Vortex template theme files should be present');

// Replace the Vortex-installed theme files with custom
// non-Vortex theme files (simulating a project that replaced the
// Vortex theme scaffold with their own).
File::remove($theme_dir);
File::mkdir($theme_dir);
File::dump($theme_dir . '/star_wars.info.yml', 'name: Star Wars Custom' . PHP_EOL . 'type: theme' . PHP_EOL . 'core_version_requirement: ^11' . PHP_EOL);
File::dump($theme_dir . '/package.json', '{"name": "star_wars_custom"}' . PHP_EOL);
File::dump($theme_dir . '/styles.css', '.star-wars { color: blue; }' . PHP_EOL);
}),
static::cw(function (FunctionalTestCase $test): void {
// The project's own theme files must be preserved unchanged —
// Vortex must not overwrite them with its template theme files.
$theme_dir = static::$sut . '/web/themes/custom/star_wars';
$test->assertDirectoryExists($theme_dir);
$test->assertStringEqualsFile($theme_dir . '/star_wars.info.yml', 'name: Star Wars Custom' . PHP_EOL . 'type: theme' . PHP_EOL . 'core_version_requirement: ^11' . PHP_EOL);
$test->assertStringEqualsFile($theme_dir . '/package.json', '{"name": "star_wars_custom"}' . PHP_EOL);
$test->assertStringEqualsFile($theme_dir . '/styles.css', '.star-wars { color: blue; }' . PHP_EOL);

$test->assertFilesDoNotExist($theme_dir, ['star_wars.theme'], 'Vortex template theme files should not be present');
}),
];
}

}
Loading