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

Generator incorrectly replacing content in docs generator script #493

Open
blackfalcon opened this issue Jan 27, 2024 · 0 comments
Open
Assignees

Comments

@blackfalcon
Copy link
Member

Issue

The following code is edited with a new generator build.

/**
* Replace all instances of [npm], [name], [Name], [namespace] and [Namespace] accordingly
*/
function formatTemplateFileContents(content, destination) {
let nameExtractionData = nameExtraction();
let result = content;
/**
* Replace placeholder strings
*/
result = result.replace(/\[npm]/g, nameExtractionData.npm);
result = result.replace(/\[name](?!\()/g, nameExtractionData.name);
result = result.replace(/\[Name](?!\()/g, nameExtractionData.nameCap);
result = result.replace(/\[namespace]/g, nameExtractionData.namespace);
result = result.replace(/\[Namespace]/g, nameExtractionData.namespaceCap);

Here is the output from a recently generated repo

/**
 * Replace all instances of @aurodesignsystem, menu, Menu, auro and Auro accordingly
 */

function formatTemplateFileContents(content, destination) {
  let nameExtractionData = nameExtraction();
  let result = content;

  /**
   * Replace placeholder strings
   */
  result = result.replace(/\@aurodesignsystem/g, nameExtractionData.npm);
  result = result.replace(/\menu(?!\()/g, nameExtractionData.name);
  result = result.replace(/\Menu(?!\()/g, nameExtractionData.nameCap);
  result = result.replace(/\auro/g, nameExtractionData.namespace);
  result = result.replace(/\Auro/g, nameExtractionData.namespaceCap);

Band-aid fix, replace contents of this file with that from the auro-library, here is the diff when done.

 /**
- * Replace all instances of @aurodesignsystem, menu, Menu, auro and Auro accordingly
+ * Replace all instances of [npm], [name], [Name], [namespace] and [Namespace] accordingly
  */

 function formatTemplateFileContents(content, destination) {
@@ -48,11 +48,11 @@ function formatTemplateFileContents(content, destination) {
   /**
    * Replace placeholder strings
    */
-  result = result.replace(/\@aurodesignsystem/g, nameExtractionData.npm);
-  result = result.replace(/\menu(?!\()/g, nameExtractionData.name);
-  result = result.replace(/\Menu(?!\()/g, nameExtractionData.nameCap);
-  result = result.replace(/\auro/g, nameExtractionData.namespace);
-  result = result.replace(/\Auro/g, nameExtractionData.namespaceCap);
+  result = result.replace(/\[npm]/g, nameExtractionData.npm);
+  result = result.replace(/\[name](?!\()/g, nameExtractionData.name);
+  result = result.replace(/\[Name](?!\()/g, nameExtractionData.nameCap);
+  result = result.replace(/\[namespace]/g, nameExtractionData.namespace);
+  result = result.replace(/\[Namespace]/g, nameExtractionData.namespaceCap);

   /**
    * Cleanup line breaks
    * 

Expected behavior

The contents of the script are not edited or corrected with a generated repo.

Exit criteria

This issue can be closed once the contents of this file are either not edited or corrected with the building of a new element repo.

@blackfalcon blackfalcon added Type: Bug Bug or Bug fixes not-reviewed Issue has not been reviewed by Auro team members wc-generator labels Jan 27, 2024
@jason-capsule42 jason-capsule42 removed Type: Bug Bug or Bug fixes not-reviewed Issue has not been reviewed by Auro team members labels Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants