Skip to content
Closed
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
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ This ignore mechanism works with any of the changes that the codemods in this
package will try to suggest.


## Environment Support

The codemod tool supports multiple deployment environments. Test fixtures include examples for:
- `sandbox.wdesk.com` - Sandbox environment
- `ca.wdesk.com` - CA production environment (prod-ca)

When generating HTML or Dart code with preconnect links, ensure URLs follow the appropriate environment pattern.

## Authoring codemods

### Resources
Expand Down
85 changes: 85 additions & 0 deletions test/rmui_bundle_updater_suggestors/dart_script_updater_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -420,5 +420,90 @@ void main() {
);
});
});

test('in context with ca environment HTML logic', () async {
await testSuggestor(
expectedPatchCount: 4,
shouldDartfmtOutput: false,
input: '''
List<String> _reactHtmlHeaders = const [
'<!DOCTYPE html>',
'<html>',
' <head>',
' <base href="/">',
' ',
' <meta http-equiv="X-UA-Compatible" content="IE=edge">',
' <meta charset="UTF-8">',
' <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">',
' <meta name="apple-mobile-web-app-capable" content="yes">',
' <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />',
' <meta name="google" content="notranslate" />',
' ',
' <title>Wdesk</title>',
' ',
' <!-- Preconnects -->',
' <link rel="preconnect" href="https://ca.wdesk.com">',
' ',
' <!-- PRELOAD SCRIPTS -->',
' <link rel="preload" href="packages/react/react_with_react_dom_prod.js" as="script">',
' <link rel="preload" href="$rmuiBundleProd" as="script">',
' <link rel="preload" href="main.dart.js" as="script">',
' ',
' <!-- STYLESHEETS -->',
' <link rel="stylesheet" href="packages/web_skin/dist/css/web-skin.min.css">',
' </head>',
' ',
' <body>',
' <!-- App Container -->',
' <div id="shell-container" aria-hidden="true" tabindex="-1"></div>',
' ',
' <!-- SCRIPTS -->',
' <script src="packages/react/react_with_react_dom_prod.js"></script>',
' <script src="$rmuiBundleProd"></script>',
' <script defer src="main.dart.js"></script>',
' </body>',
'</html>',
];''',
expectedOutput: '''
List<String> _reactHtmlHeaders = const [
'<!DOCTYPE html>',
'<html>',
' <head>',
' <base href="/">',
' ',
' <meta http-equiv="X-UA-Compatible" content="IE=edge">',
' <meta charset="UTF-8">',
' <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">',
' <meta name="apple-mobile-web-app-capable" content="yes">',
' <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />',
' <meta name="google" content="notranslate" />',
' ',
' <title>Wdesk</title>',
' ',
' <!-- Preconnects -->',
' <link rel="preconnect" href="https://ca.wdesk.com">',
' ',
' <!-- PRELOAD SCRIPTS -->',
' <link rel="preload" href="packages/react/react_with_react_dom_prod.js" as="script">',
' <link rel="preload" href="$rmuiBundleProdUpdated" crossorigin="" as="script">',
' <link rel="preload" href="main.dart.js" as="script">',
' ',
' <!-- STYLESHEETS -->',
' <link rel="stylesheet" href="packages/web_skin/dist/css/web-skin.min.css">',
' </head>',
' ',
' <body>',
' <!-- App Container -->',
' <div id="shell-container" aria-hidden="true" tabindex="-1"></div>',
' ',
' <!-- SCRIPTS -->',
' <script src="packages/react/react_with_react_dom_prod.js"></script>',
' <script src="$rmuiBundleProdUpdated" type="module"></script>',
' <script defer src="main.dart.js"></script>',
' </body>',
'</html>',
];\n''',
);
});
});
}
85 changes: 85 additions & 0 deletions test/rmui_bundle_updater_suggestors/html_script_updater_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -289,5 +289,90 @@ void main() {
'',
);
});

test('in context with ca environment HTML logic', () async {
await testSuggestor(
expectedPatchCount: 4,
shouldDartfmtOutput: false,
input: ''
'<!DOCTYPE html>\n'
'<html>\n'
' <head>\n'
' <base href="/">\n'
' \n'
' <!-- MUST BE THE FIRST META TAG WITHIN <HEAD> -->\n'
' <meta http-equiv="X-UA-Compatible" content="IE=edge">\n'
' <meta charset="UTF-8">\n'
' <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">\n'
' <meta name="apple-mobile-web-app-capable" content="yes">\n'
' <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />\n'
' <meta name="google" content="notranslate" />\n'
' \n'
' <title>Wdesk</title>\n'
' \n'
' <!-- Preconnects -->\n'
' <link rel="preconnect" href="https://ca.wdesk.com">\n'
' \n'
' <!-- PRELOAD SCRIPTS -->\n'
' <link rel="preload" href="packages/react/react_with_react_dom_prod.js" as="script">\n'
' <link rel="preload" href="$rmuiBundleProd" as="script">\n'
' <link rel="preload" href="main.dart.js" as="script">\n'
' \n'
' <!-- STYLESHEETS -->\n'
' <link rel="stylesheet" href="packages/web_skin/dist/css/web-skin.min.css">\n'
' </head>\n'
' \n'
' <body>\n'
' <!-- App Container -->\n'
' <div id="shell-container" aria-hidden="true" tabindex="-1"></div>\n'
' \n'
' <!-- SCRIPTS -->\n'
' <script src="packages/react/react_with_react_dom_prod.js"></script>\n'
' <script src="$rmuiBundleProd"></script>\n'
' <script defer src="main.dart.js"></script>\n'
' </body>\n'
'</html>\n'
'',
expectedOutput: ''
'<!DOCTYPE html>\n'
'<html>\n'
' <head>\n'
' <base href="/">\n'
' \n'
' <!-- MUST BE THE FIRST META TAG WITHIN <HEAD> -->\n'
' <meta http-equiv="X-UA-Compatible" content="IE=edge">\n'
' <meta charset="UTF-8">\n'
' <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">\n'
' <meta name="apple-mobile-web-app-capable" content="yes">\n'
' <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />\n'
' <meta name="google" content="notranslate" />\n'
' \n'
' <title>Wdesk</title>\n'
' \n'
' <!-- Preconnects -->\n'
' <link rel="preconnect" href="https://ca.wdesk.com">\n'
' \n'
' <!-- PRELOAD SCRIPTS -->\n'
' <link rel="preload" href="packages/react/react_with_react_dom_prod.js" as="script">\n'
' <link rel="preload" href="$rmuiBundleProdUpdated" crossorigin="" as="script">\n'
' <link rel="preload" href="main.dart.js" as="script">\n'
' \n'
' <!-- STYLESHEETS -->\n'
' <link rel="stylesheet" href="packages/web_skin/dist/css/web-skin.min.css">\n'
' </head>\n'
' \n'
' <body>\n'
' <!-- App Container -->\n'
' <div id="shell-container" aria-hidden="true" tabindex="-1"></div>\n'
' \n'
' <!-- SCRIPTS -->\n'
' <script src="packages/react/react_with_react_dom_prod.js"></script>\n'
' <script src="$rmuiBundleProdUpdated" type="module"></script>\n'
' <script defer src="main.dart.js"></script>\n'
' </body>\n'
'</html>\n'
'',
);
});
});
}
Loading