Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into edit-folder-structure
  • Loading branch information
julia-rabello committed Sep 5, 2024
2 parents 3f1e962 + 70af0e8 commit db525ba
Show file tree
Hide file tree
Showing 1,190 changed files with 2,736 additions and 1,509 deletions.
95 changes: 48 additions & 47 deletions docs-utils/fix-callouts.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const fs = require('fs');
const fs = require('fs').promises;
const path = require('path');

// The root folder to process
const rootFolder = 'docs';

// Maximum number of files to process simultaneously
const MAX_CONCURRENT_FILES = 100; // Adjust this based on your system's limit
const MAX_CONCURRENT_FILES = 100;

// Array to keep track of currently processing files
let activeFiles = 0;
Expand Down Expand Up @@ -65,58 +65,59 @@ function convertCallout(htmlCallout) {
return markdownCallout;
}

// Function to process each markdown file
function processFile(filePath) {
// Function to process each Markdown file
async function processFile(filePath) {
activeFiles++;

fs.readFile(filePath, 'utf8', (err, data) => {
if (err) throw err;

try {
const data = await fs.readFile(filePath, 'utf8');
// Replace HTML structures with corresponding markdown symbols
const newData = data
.replace(/<div\s+class\s*=\s*"alert alert-info">(.*?)<\/div>/gs, (match, p1) => `>ℹ️ ${convertCallout(p1)}`)
.replace(/<div\s+class\s*=\s*"alert alert-warning">(.*?)<\/div>/gs, (match, p1) => `>⚠️ ${convertCallout(p1)}`)
.replace(/<div\s+class\s*=\s*"alert alert-danger">(.*?)<\/div>/gs, (match, p1) => `>❗ ${convertCallout(p1)}`);

// Write the modified content back to the file
fs.writeFile(filePath, newData, 'utf8', (err) => {
if (err) throw err;
console.log(`Processed file: ${filePath}`);
activeFiles--;

// Process the next file in the queue if available
if (fileQueue.length > 0) {
const nextFile = fileQueue.shift();
processFile(nextFile);
}
});
});
.replace(/<div\s+[^>]*class\s*=\s*"alert alert-info"[^>]*>(.*?)<\/div>/gs, (match, p1) => `>ℹ️ ${convertCallout(p1)}`)
.replace(/<div\s+[^>]*class\s*=\s*"alert alert-warning"[^>]*>(.*?)<\/div>/gs, (match, p1) => `>⚠️ ${convertCallout(p1)}`)
.replace(/<div\s+[^>]*class\s*=\s*"alert alert-danger"[^>]*>(.*?)<\/div>/gs, (match, p1) => `>❗ ${convertCallout(p1)}`);

await fs.writeFile(filePath, newData, 'utf8');
} catch (err) {
console.error(`Error processing file: ${filePath}`, err);
} finally {
activeFiles--;
if (fileQueue.length > 0) {
const nextFile = fileQueue.shift();
processFile(nextFile);
}
}
}

// Recursive function to process all markdown files in the directory
function processDirectory(directory) {
fs.readdir(directory, (err, files) => {
if (err) throw err;

files.forEach(file => {
async function processDirectory(directory) {
try {
const files = await fs.readdir(directory);
for (const file of files) {
const filePath = path.join(directory, file);
fs.stat(filePath, (err, stats) => {
if (err) throw err;

if (stats.isDirectory()) {
// Recursively process subdirectories
processDirectory(filePath);
} else if (path.extname(file) === '.md') {
if (activeFiles < MAX_CONCURRENT_FILES) {
processFile(filePath);
} else {
fileQueue.push(filePath);
}
const stats = await fs.stat(filePath);

if (stats.isDirectory()) {
await processDirectory(filePath);
} else if (path.extname(file) === '.md') {
if (activeFiles < MAX_CONCURRENT_FILES) {
processFile(filePath);
} else {
fileQueue.push(filePath);
}
});
});
});
}
}
} catch (err) {
console.error(`Error processing directory: ${directory}`, err);
}
}

async function fixCallouts() {
console.log("Fixing callouts...");
await processDirectory(rootFolder);
while (activeFiles > 0 || fileQueue.length > 0) {
await new Promise(resolve => setTimeout(resolve, 100));
}
console.log("Finished fixing callouts in markdown files.");
}

// Start processing from the root folder
processDirectory(rootFolder);
module.exports = { fixCallouts };
146 changes: 81 additions & 65 deletions docs-utils/replace-quotes.js
Original file line number Diff line number Diff line change
@@ -1,82 +1,98 @@
const fs = require('fs');
const fs = require('fs').promises;
const path = require('path');

// Path to the 'docs' directory
const docsDir = path.resolve(__dirname, '../docs');
const MAX_CONCURRENT_FILES = 100;

let activeFiles = 0;
let fileQueue = [];

// Function to process each Markdown file
const processFile = (filePath) => {
const data = fs.readFileSync(filePath, 'utf8');
const lines = data.split('\n');
async function processFile(filePath) {
try {
const data = await fs.readFile(filePath, 'utf8');
const lines = data.split('\n');

if (lines[1] && lines[1].startsWith('title:')) {
let titleLine = lines[1].trim();
const titleContentMatch = titleLine.match(/^title:\s*(['"])(.*)\1$/);

if (lines[1] && lines[1].startsWith('title:')) {
let titleLine = lines[1].trim();
const titleContentMatch = titleLine.match(/^title:\s*(['"])(.*)\1$/);
if (titleContentMatch) {
const currentOuterQuote = titleContentMatch[1];
const originalTitleContent = titleContentMatch[2];
let updatedTitleContent;
let updatedTitleLine;

if (titleContentMatch) {
const currentOuterQuote = titleContentMatch[1];
const originalTitleContent = titleContentMatch[2];
let updatedTitleContent;
let updatedTitleLine;
if (currentOuterQuote === `'`) {
if (originalTitleContent.includes('"')) {
updatedTitleContent = originalTitleContent.replace(/"/g, "'");
updatedTitleLine = `title: "${updatedTitleContent}"`;
} else {
updatedTitleLine = titleLine;
}
} else if (currentOuterQuote === `"`) {
if (originalTitleContent.includes('"')) {
updatedTitleContent = originalTitleContent.replace(/"(?![^"]*")/g, "'");
updatedTitleLine = `title: "${updatedTitleContent}"`;
} else {
updatedTitleLine = titleLine;
}
}

if (currentOuterQuote === `'`) {
// Outer quotes are single
if (originalTitleContent.includes('"')) {
// Inner double quotes present
updatedTitleContent = originalTitleContent.replace(/"/g, "'");
updatedTitleLine = `title: "${updatedTitleContent}"`;
} else {
// No inner double quotes
updatedTitleLine = titleLine;
if (updatedTitleLine && updatedTitleLine !== titleLine) {
lines[1] = updatedTitleLine;
const newData = lines.join('\n');
await fs.writeFile(filePath, newData, 'utf8');
// console.log(`Quotes replaced in file: ${filePath}`);
}
}
}
} else if (currentOuterQuote === `"`) {
// Outer quotes are double
if (originalTitleContent.includes('"')) {
// Inner double quotes present
updatedTitleContent = originalTitleContent.replace(/"(?![^"]*")/g, "'");
updatedTitleLine = `title: "${updatedTitleContent}"`;
} else {
// No inner double quotes
updatedTitleLine = titleLine;
} catch (error) {
console.error(`Error processing file: ${filePath}`, error);
} finally {
activeFiles--;
if (fileQueue.length > 0) {
const nextFile = fileQueue.shift();
processFile(nextFile);
}
}

// Only update if necessary
if (updatedTitleLine && updatedTitleLine !== titleLine) {
lines[1] = updatedTitleLine;
const newData = lines.join('\n');
fs.writeFileSync(filePath, newData, 'utf8');
console.log(`Updated file: ${filePath}`);
}
}
}
};
}

// Function to recursively process files in directories
const processDirectory = (dirPath) => {
fs.readdir(dirPath, (err, files) => {
if (err) {
console.error('Unable to scan directory:', err);
return;
}
async function processDirectory(dirPath) {
try {
const files = await fs.readdir(dirPath);

for (const file of files) {
const filePath = path.join(dirPath, file);
const stats = await fs.stat(filePath);

files.forEach((file) => {
const filePath = path.join(dirPath, file);
fs.stat(filePath, (err, stats) => {
if (err) {
console.error('Unable to stat file:', err);
return;
if (stats.isDirectory()) {
await processDirectory(filePath);
} else if (path.extname(file) === '.md') {
if (activeFiles < MAX_CONCURRENT_FILES) {
activeFiles++;
processFile(filePath);
} else {
fileQueue.push(filePath);
}
}
}
} catch (error) {
console.error('Error processing directory:', error);
}
}

if (stats.isDirectory()) {
processDirectory(filePath);
} else if (path.extname(file) === '.md') {
processFile(filePath);
}
});
});
});
};
async function replaceQuotes() {
console.log("Replacing quotation marks...");
await processDirectory(docsDir);

// Wait until all files are processed
while (activeFiles > 0 || fileQueue.length > 0) {
await new Promise(resolve => setTimeout(resolve, 100));
}

console.log("Finished replacing quotation marks in markdown files.");
}

// Start processing from the docs directory
processDirectory(docsDir);
module.exports = { replaceQuotes };
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The product integration flow on the Via Varejo Marketplace was [modified in thei

There was no need for mapping to activate the Via Varejo Integration before this change. Mapping categories, variations and attributes for your products is henceforth __mandatory__.

<div class="alert alert-warning" role="alert"><strong>Attention:</strong> Products created or updated after this change will only be integrated if their category, variations and attributes are mapped out.</div>
>⚠️ **Attention:** Products created or updated after this change will only be integrated if their category, variations and attributes are mapped out.
## Why did we make this change?

Expand All @@ -36,4 +36,4 @@ To ensure the best positioning and experience for our clients in the certified m

Map categories, variations and attributes according to our [documentation](https://help.vtex.com/en/tracks/configurar-integracao-da-via-varejo--3E9XylGaJ2wqwISGyw4GuY/5QVZFYNfuRIQKdq34MbTxz#fazendo-o-upload).

<div class="alert alert-info" role="alert">This process can be performed gradually according to your needs and only needs to be done once per category. Once a category and its variations/attributes are mapped, all products in that category will be integrated normally without requiring any additional action.</div>
>ℹ️ This process can be performed gradually according to your needs and only needs to be done once per category. Once a category and its variations/attributes are mapped, all products in that category will be integrated normally without requiring any additional action.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Nowadays, consumers seek diversity and ease of payments, and it is essential to

That's why VTEX entered into a partnership with Lendico, which launched the installments loans function, aiming to democratize purchasing power and contribute exponentially to increase your sales.

<div class="alert alert-info" role="alert">This payment option is only available in Brazil.</div>
>ℹ️ This payment option is only available in Brazil.
## Who is Lendico?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ announcementSynopsisEN: 'This is a regional exclusive content not applicable to
---


<div class="alert alert-warning" role="alert">This is a regional exclusive content not applicable to English speaking countries.</div>
>⚠️ This is a regional exclusive content not applicable to English speaking countries.
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ announcementSynopsisEN: 'Solve problems faster and autonomously with our redesig
VTEX is constantly evolving to enhance the customer support experience and empower our clients to solve problems more efficiently and autonomously.
To facilitate access to support, now you can use the Troubleshooting guides available in the [Help Center](https://help.vtex.com/subcategory/store-operations--2Q0IQjRcOqSgJTh6wRHVMB) and [Developer Portal](https://developers.vtex.com/docs/troubleshooting). These guides detail potential error scenarios in store operations and during store or app development, as well as provide instructions on how to proceed to restore expected performance for your store.

<div class="alert alert-info" role="alert">
Would you like to contribute to this initiative? Complete this <a href="https://forms.gle/PdVNZmMDMjiDfJaf8">Feedback form</a>.
</div>
>ℹ️ Would you like to contribute to this initiative? Complete this [Feedback form](https://forms.gle/PdVNZmMDMjiDfJaf8).
## How are the Troubleshooting guides organized?
The Troubleshooting guides are available in the [Help Center](https://help.vtex.com/subcategory/store-operations--2Q0IQjRcOqSgJTh6wRHVMB) and [Developer Portal](https://developers.vtex.com/docs/troubleshooting), organized into categories as follows:
Expand All @@ -32,9 +30,7 @@ The Troubleshooting guides are available in the [Help Center](https://help.vtex.
- **Development**: This section is designed to address errors related to storefront and app development.
- **Store performance**: This section includes procedures for debugging errors and restoring the store to operational condition if it is down or malfunctioning.

<div class="alert alert-info" role="alert">
At the time of this announcement's publication, 15 guides are available for consultation, with more in production.
</div>
>ℹ️ At the time of this announcement's publication, 15 guides are available for consultation, with more in production.
## Why did we create this initiative?
Our goal is to simplify and streamline the VTEX support experience. With the new Troubleshooting guides, you can:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ locale: en
legacySlug:
---

<div class="alert alert-warning" role="alert">This is a regional exclusive content not applicable to English speaking countries.</div>
>⚠️ This is a regional exclusive content not applicable to English speaking countries.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ locale: en
legacySlug: i-ve-activated-a-product-recurrence-but-it-doesnt-appear-on-the-site
---

<div class = "alert alert-warning" >
<p><b>Warning:</b> there are two ways to configure collections, through the CMS or the Collection module (Beta). This article is about how to <a href = "https://help.vtex.com/en/tutorial/adding-collections-cms--2YBy6P6X0NFRpkD2ZBxF6L">configure collections through the CMS</a>.</p>
</div>
>⚠️ **Warning:** there are two ways to configure collections, through the CMS or the Collection module (Beta). This article is about how to <a href = "https://help.vtex.com/en/tutorial/adding-collections-cms--2YBy6P6X0NFRpkD2ZBxF6L">configure collections through the CMS</a>.
Whenever you change or create a subscription, you need to reindex your SKUs to make it work properly. In doing so, you will be saving the information that such SKU has an attachment (in this case, subscription) and should be treated differently.

Expand All @@ -31,6 +29,6 @@ For manual inclusion of specific SKUs, follow these step-by-step instructions:
5. Name your Collection (the other fields are not to be filled).
6. Insert the SKUs in the field and __separate them with commas__.

![recurrence-specific-skus](https://images.ctfassets.net/alneenqid6w5/70r903nMha2s220AsC2W6k/2fa8421274d56304d680388cc3309323/recurrence-specific-skus.png)
![recurrence-specific-skus](https://raw.githubusercontent.com/vtexdocs/help-center-content/main/images/en/i-ve-activated-a-product-subscription-but-it-doesnt-appear-on-the-site-0.png)

Finally, give a name to the __Group__ of your Collection and click __Save Group__.
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,14 @@ locale: en
legacySlug: nao-encontro-uma-colecao-o-que-fazer
---

<div class = "alert alert-warning" >
<p><b>Warning:</b> there are two ways to configure collections, through the CMS or the Collection module (Beta). This article is about how to <a href = "https://help.vtex.com/en/tutorial/adding-collections-cms--2YBy6P6X0NFRpkD2ZBxF6L">configure collections through the CMS</a>.</p>
</div>
>⚠️ **Warning:** there are two ways to configure collections, through the CMS or the Collection module (Beta). This article is about how to <a href = "https://help.vtex.com/en/tutorial/adding-collections-cms--2YBy6P6X0NFRpkD2ZBxF6L">configure collections through the CMS</a>.
By default, the CMS module only displays the __last 20 collections__ updated.

So if your store has more than 20 collections, it's normal for some of them not to appear in the list shown in the CMS.

![findCollection1](https://images.contentful.com/alneenqid6w5/1DM1TNjCKYsY0KQkMgycGm/c49a70d5570d62c993539114d8596549/findCollection1.png)
![findCollection1](https://raw.githubusercontent.com/vtexdocs/help-center-content/main/images/en/nao-encontro-uma-colecao-o-que-fazer-0.png)

But you can fetch any collection using the __search field__ (Find), including those that are not displayed by default.

![findCollection2](https://images.contentful.com/alneenqid6w5/6LBUTpvCH64Uc2CQEwiigk/5739b97f92b27ec9fc40fb4e93ffb2af/findCollection2.png)
![findCollection2](https://raw.githubusercontent.com/vtexdocs/help-center-content/main/images/en/nao-encontro-uma-colecao-o-que-fazer-1.png)
2 changes: 1 addition & 1 deletion docs/en/faq/Post-purchase/faq-vtex-shipping-network.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ locale: en
legacySlug: faq-vtex-log
---

<div class="alert alert-warning" role="alert">Content under translation.</div>
>⚠️ Content under translation.
Loading

0 comments on commit db525ba

Please sign in to comment.