Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not ignore package-lock.json #1134

Merged
merged 4 commits into from
Jan 13, 2024
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
2 changes: 1 addition & 1 deletion .docker/cli.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ COPY ${WEBROOT}/themes/custom/your_site_theme/patches /app/${WEBROOT}/themes/cus
# Install NodeJS dependencies.
# Since Drupal does not use NodeJS for production, it does not matter if we
# install development dependencnies here - they are not exposed in any way.
RUN npm --prefix /app/${WEBROOT}/themes/custom/your_site_theme install --no-audit --no-progress --unsafe-perm
RUN npm --prefix /app/${WEBROOT}/themes/custom/your_site_theme ci --no-audit --no-progress --unsafe-perm

# Copy all files into appllication source directory. Existing files are always
# overridden.
Expand Down
19 changes: 4 additions & 15 deletions .drevops/installer/src/Command/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ protected function processWebroot($dir) {
static::dirReplaceContent(': web', ': ' . $new_name, $dir);
static::dirReplaceContent('=web', '=' . $new_name, $dir);
static::dirReplaceContent('!web', '!' . $new_name, $dir);
static::dirReplaceContent('/web', '/' . $new_name, $dir);
static::dirReplaceContent('/\/web\//', '/' . $new_name . '/', $dir);
rename($dir . DIRECTORY_SEPARATOR . 'web', $dir . DIRECTORY_SEPARATOR . $new_name);
}
}
Expand Down Expand Up @@ -1868,22 +1868,11 @@ protected static function dirContains($needle, $dir) {
}

protected static function isRegex($str) {
if (preg_match('/^(.{3,}?)[imsxuADU]*$/', $str, $m)) {
$start = substr($m[1], 0, 1);
$end = substr($m[1], -1);

if ($start === $end) {
return !preg_match('/[*?[:alnum:] \\\\]/', $start);
}

foreach ([['{', '}'], ['(', ')'], ['[', ']'], ['<', '>']] as $delimiters) {
if ($start === $delimiters[0] && $end === $delimiters[1]) {
return TRUE;
}
}
if ($str === '' || strlen($str) < 3) {
return FALSE;
}

return FALSE;
return @preg_match($str, '') !== FALSE;
}

protected static function fileReplaceContent($needle, $replacement, $filename) {
Expand Down
43 changes: 43 additions & 0 deletions .drevops/installer/tests/phpunit/unit/HelpersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,47 @@ public static function dataProviderToCamelCase() {
];
}

/**
* @dataProvider dataProviderIsRegex
*/
public function testIsRegex($value, $expected) {
$actual = $this->callProtectedMethod(InstallCommand::class, 'isRegex', [$value]);
$this->assertEquals($expected, $actual);
}

public static function dataProviderIsRegex() {
return [
['', FALSE],

// Valid regular expressions.
["/^[a-z]$/", TRUE],
["#[a-z]*#i", TRUE],
["{[0-9]+}", TRUE],
["(\\d+)", TRUE],
["<[A-Z]{3,6}>", TRUE],

// Invalid regular expressions (wrong delimiters or syntax).
["^[a-z]$", FALSE],
["/[a-z", FALSE],
["[a-z]+/", FALSE],
["{[a-z]*", FALSE],
["(a-z]", FALSE],

// Edge cases.
// Valid, but '*' as delimiter would be invalid.
["/a*/", TRUE],
// Empty string.
["", FALSE],
// Just delimiters, no pattern.
["//", FALSE],

['web/', FALSE],
['web\/', FALSE],
[': web', FALSE],
['=web', FALSE],
['!web', FALSE],
['/web', FALSE],
];
}

}
2 changes: 1 addition & 1 deletion .drevops/tests/bats/workflow.install.bats
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ load _helper.workflow.bash
}

@test "Workflow: DB-driven, custom webroot" {
prepare_sut "Starting DB-driven WORKFLOW tests in build directory ${BUILD_DIR}" "rootdoc"
prepare_sut "Starting DB-driven WORKFLOW with custom webroot tests in build directory ${BUILD_DIR}" "rootdoc"

assert_ahoy_download_db

Expand Down
19 changes: 0 additions & 19 deletions .drevops/tests/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ web/sites/default/*
#;< DREVOPS_DEV
#; Ignore these files in DrevOps itself, but do not ignore in consumer site.
/composer.lock
package-lock.json
#;> DREVOPS_DEV

# Ignore dependencies cache files.
Expand Down
Loading