Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ui_patterns
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
ui_patterns
Commits
8667ca8e
Commit
8667ca8e
authored
9 months ago
by
Pierre Dureau
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3467398
by pdureau: Migration command: don't break if missing composer.json
parent
53471f68
No related branches found
No related tags found
1 merge request
!181
Issue #3467398 by pdureau: Migration command: don't break if missing composer.json
Pipeline
#250525
passed
9 months ago
Stage: build
Stage: validate
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/ui_patterns_legacy/src/ComponentWriter.php
+7
-0
7 additions, 0 deletions
modules/ui_patterns_legacy/src/ComponentWriter.php
modules/ui_patterns_legacy/src/Drush/Commands/UiPatternsLegacyCommands.php
+9
-0
9 additions, 0 deletions
...ns_legacy/src/Drush/Commands/UiPatternsLegacyCommands.php
with
16 additions
and
0 deletions
modules/ui_patterns_legacy/src/ComponentWriter.php
+
7
−
0
View file @
8667ca8e
...
...
@@ -21,6 +21,13 @@ class ComponentWriter {
mkdir
(
$path
,
0775
,
TRUE
);
}
$filename
=
$component_id
.
'.component.yml'
;
// Let's comply with https://prettier.io/
// - indentation: 2 spaces
// However, still not 100% compliant:
// - strings: Symfony does simple quotes, Prettier does double quotes
// - empty objects: Symfony does "{ }", Prettier does "{}"
// - arrays of objects: Symfony adds a line break after dash, Prettier
// doesn't.
$yaml
=
Yaml
::
dump
(
$definition
,
10
,
2
);
file_put_contents
(
$path
.
$filename
,
$yaml
);
}
...
...
This diff is collapsed.
Click to expand it.
modules/ui_patterns_legacy/src/Drush/Commands/UiPatternsLegacyCommands.php
+
9
−
0
View file @
8667ca8e
...
...
@@ -109,6 +109,10 @@ final class UiPatternsLegacyCommands extends DrushCommands {
*/
protected
function
changeInfoFile
(
string
$extension
,
string
$extension_path
):
void
{
$info_path
=
$extension_path
.
"/"
.
$extension
.
".info.yml"
;
// Just a safeguard because a info file is always expected.
if
(
!
file_exists
(
$info_path
))
{
return
;
}
$content
=
file_get_contents
(
$info_path
)
?:
""
;
$content
=
preg_replace
(
'/ui_patterns_settings.*/'
,
'ui_patterns:ui_patterns_legacy'
,
$content
);
file_put_contents
(
$info_path
,
$content
);
...
...
@@ -119,6 +123,11 @@ final class UiPatternsLegacyCommands extends DrushCommands {
*/
protected
function
changeComposerFile
(
string
$extension_path
):
void
{
$composer_path
=
$extension_path
.
"/composer.json"
;
// Some themes or modules don't have a composer file. It is generated by
// the Drupal pipeline if missing.
if
(
!
file_exists
(
$composer_path
))
{
return
;
}
$content
=
file_get_contents
(
$composer_path
)
?:
""
;
$data
=
json_decode
(
$content
,
TRUE
);
unset
(
$data
[
"require"
][
"drupal/ui_patterns_settings"
]);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment