Skip to content

Commit 7434ff7

Browse files
committed
Run prettier
1 parent d081ecf commit 7434ff7

File tree

2,129 files changed

+10502
-7966
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,129 files changed

+10502
-7966
lines changed

.prettierignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
app-dist
2+
dist
3+
.idea
4+
.github
5+
public
6+
node_modules
7+
pnpm-lock.yaml

astro.config.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default defineConfig({
2626
'https://github.com/kamranahmedse',
2727
'https://thenewstack.io',
2828
'https://cs.fyi',
29-
'https://roadmap.sh'
29+
'https://roadmap.sh',
3030
];
3131

3232
if (whiteListedStarts.some((start) => href.startsWith(start))) {

bin/best-practice-dirs.cjs

+22-11
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ const path = require('path');
33

44
const CONTENT_DIR = path.join(__dirname, '../content');
55
// Directory containing the best-practices
6-
const BEST_PRACTICE_CONTENT_DIR = path.join(__dirname, '../src/data/best-practices');
6+
const BEST_PRACTICE_CONTENT_DIR = path.join(
7+
__dirname,
8+
'../src/data/best-practices'
9+
);
710
const bestPracticeId = process.argv[2];
811

912
const allowedBestPracticeId = fs.readdirSync(BEST_PRACTICE_CONTENT_DIR);
@@ -28,7 +31,10 @@ if (!bestPracticeDirName) {
2831
process.exit(1);
2932
}
3033

31-
const bestPracticeDirPath = path.join(BEST_PRACTICE_CONTENT_DIR, bestPracticeDirName);
34+
const bestPracticeDirPath = path.join(
35+
BEST_PRACTICE_CONTENT_DIR,
36+
bestPracticeDirName
37+
);
3238
const bestPracticeContentDirPath = path.join(
3339
BEST_PRACTICE_CONTENT_DIR,
3440
bestPracticeDirName,
@@ -37,7 +43,9 @@ const bestPracticeContentDirPath = path.join(
3743

3844
// If best practice content already exists do not proceed as it would override the files
3945
if (fs.existsSync(bestPracticeContentDirPath)) {
40-
console.error(`Best Practice content already exists @ ${bestPracticeContentDirPath}`);
46+
console.error(
47+
`Best Practice content already exists @ ${bestPracticeContentDirPath}`
48+
);
4149
process.exit(1);
4250
}
4351

@@ -51,7 +59,11 @@ function prepareDirTree(control, dirTree) {
5159
const controlName = control?.properties?.controlName || '';
5260

5361
// No directory for a group without control name
54-
if (!controlName || controlName.startsWith('check:') || controlName.startsWith('ext_link:')) {
62+
if (
63+
!controlName ||
64+
controlName.startsWith('check:') ||
65+
controlName.startsWith('ext_link:')
66+
) {
5567
return;
5668
}
5769

@@ -76,7 +88,10 @@ function prepareDirTree(control, dirTree) {
7688
return { dirTree };
7789
}
7890

79-
const bestPractice = require(path.join(__dirname, `../public/jsons/best-practices/${bestPracticeId}`));
91+
const bestPractice = require(path.join(
92+
__dirname,
93+
`../public/jsons/best-practices/${bestPracticeId}`
94+
));
8095
const controls = bestPractice.mockup.controls.control;
8196

8297
// Prepare the dir tree that we will be creating
@@ -129,16 +144,12 @@ function createDirTree(parentDir, dirTree, filePaths = {}) {
129144
// For each of the directory names, create a
130145
// directory inside the given directory
131146
childrenDirNames.forEach((dirName) => {
132-
createDirTree(
133-
path.join(parentDir, dirName),
134-
dirTree[dirName],
135-
filePaths
136-
);
147+
createDirTree(path.join(parentDir, dirName), dirTree[dirName], filePaths);
137148
});
138149

139150
return filePaths;
140151
}
141152

142153
// Create directories and get back the paths for created directories
143154
createDirTree(bestPracticeContentDirPath, dirTree);
144-
console.log('Created best practice content directory structure');
155+
console.log('Created best practice content directory structure');

bin/readme.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
## CLI Tools
2+
23
> A bunch of CLI scripts to make the development easier
34
45
## `roadmap-links.cjs`
@@ -34,5 +35,3 @@ For the content skeleton to be generated, we should have proper grouping, and th
3435
- Assign the name to the groups.
3536
- Group names have the format of `[sort]-[slug]` e.g. `100-internet`. Each group name should start with a number starting from 100 which helps with sorting of the directories and the files. Groups at the same level have the sequential sorting information.
3637
- Each groups children have a separate group and have the name similar to `[sort]-[parent-slug]:[child-slug]` where sort refers to the sorting of the `child-slug` and not the parent. Also parent-slug does not need to have the sorting information as a part of slug e.g. if parent was `100-internet` the children would be `100-internet:how-does-the-internet-work`, `101-internet:what-is-http`, `102-internet:browsers`.
37-
38-

bin/roadmap-content.cjs

+6-3
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ async function run() {
9595

9696
const roadmapJson = require(path.join(ROADMAP_JSON_DIR, `${roadmapId}.json`));
9797
const groups = roadmapJson?.mockup?.controls?.control?.filter(
98-
(control) => control.typeID === '__group__' && !control.properties?.controlName?.startsWith('ext_link')
98+
(control) =>
99+
control.typeID === '__group__' &&
100+
!control.properties?.controlName?.startsWith('ext_link')
99101
);
100102

101103
if (!OPEN_AI_API_KEY) {
@@ -106,8 +108,9 @@ async function run() {
106108

107109
for (let group of groups) {
108110
const topicId = group?.properties?.controlName;
109-
const topicTitle = group?.children?.controls?.control?.find((control) => control?.typeID === 'Label')?.properties
110-
?.text;
111+
const topicTitle = group?.children?.controls?.control?.find(
112+
(control) => control?.typeID === 'Label'
113+
)?.properties?.text;
111114
const currTopicUrl = topicId.replace(/^\d+-/g, '/').replace(/:/g, '/');
112115
const contentFilePath = topicUrlToPathMapping[currTopicUrl];
113116

bin/roadmap-dirs.cjs

+4-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,10 @@ function prepareDirTree(control, dirTree, dirSortOrders) {
8282
return { dirTree, dirSortOrders };
8383
}
8484

85-
const roadmap = require(path.join(__dirname, `../public/jsons/roadmaps/${roadmapId}`));
85+
const roadmap = require(path.join(
86+
__dirname,
87+
`../public/jsons/roadmaps/${roadmapId}`
88+
));
8689
const controls = roadmap.mockup.controls.control;
8790

8891
// Prepare the dir tree that we will be creating and also calculate the sort orders

bin/update-sponsors.cjs

+21-6
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,24 @@ function populatePageAds({
2727
const isConfiguredActive = isActive.toLowerCase() === 'yes';
2828

2929
const currentDate = new Date();
30-
const isDateInRange = currentDate >= new Date(startDate) && currentDate <= new Date(endDate);
30+
const isDateInRange =
31+
currentDate >= new Date(startDate) && currentDate <= new Date(endDate);
3132
const shouldShowAd = isConfiguredActive && isDateInRange;
3233

33-
const urlPart = pageUrl.replace('https://roadmap.sh/', '').replace(/\?.+?$/, '');
34+
const urlPart = pageUrl
35+
.replace('https://roadmap.sh/', '')
36+
.replace(/\?.+?$/, '');
3437

35-
const parentDir = urlPart.startsWith('best-practices/') ? 'best-practices' : 'roadmaps';
38+
const parentDir = urlPart.startsWith('best-practices/')
39+
? 'best-practices'
40+
: 'roadmaps';
3641
const pageId = urlPart.replace(`${parentDir}/`, '');
3742

38-
const pageFilePath = path.join(__dirname, `../src/data/${parentDir}`, `${pageId}/${pageId}.md`);
43+
const pageFilePath = path.join(
44+
__dirname,
45+
`../src/data/${parentDir}`,
46+
`${pageId}/${pageId}.md`
47+
);
3948

4049
if (!fs.existsSync(pageFilePath)) {
4150
console.error(`Page file not found: ${pageFilePath}`);
@@ -48,7 +57,9 @@ function populatePageAds({
4857
const frontMatterRegex = /---\n([\s\S]*?)\n---/;
4958

5059
const existingFrontmatter = pageFileContent.match(frontMatterRegex)[1];
51-
const contentWithoutFrontmatter = pageFileContent.replace(frontMatterRegex, ``).trim();
60+
const contentWithoutFrontmatter = pageFileContent
61+
.replace(frontMatterRegex, ``)
62+
.trim();
5263

5364
let frontmatterObj = yaml.load(existingFrontmatter);
5465
delete frontmatterObj.sponsor;
@@ -77,7 +88,11 @@ function populatePageAds({
7788
frontmatterObj = Object.fromEntries(frontmatterValues);
7889
}
7990

80-
const newFrontmatter = yaml.dump(frontmatterObj, { lineWidth: 10000, forceQuotes: true, quotingType: '"' });
91+
const newFrontmatter = yaml.dump(frontmatterObj, {
92+
lineWidth: 10000,
93+
forceQuotes: true,
94+
quotingType: '"',
95+
});
8196
const newContent = `---\n${newFrontmatter}---\n\n${contentWithoutFrontmatter}`;
8297

8398
fs.writeFileSync(pageFilePath, newContent, 'utf8');

code_of_conduct.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,21 @@ appearance, race, religion, or sexual identity and orientation.
1414
Examples of behavior that contributes to creating a positive environment
1515
include:
1616

17-
* Using welcoming and inclusive language
18-
* Being respectful of differing viewpoints and experiences
19-
* Gracefully accepting constructive criticism
20-
* Focusing on what is best for the community
21-
* Showing empathy towards other community members
17+
- Using welcoming and inclusive language
18+
- Being respectful of differing viewpoints and experiences
19+
- Gracefully accepting constructive criticism
20+
- Focusing on what is best for the community
21+
- Showing empathy towards other community members
2222

2323
Examples of unacceptable behavior by participants include:
2424

25-
* The use of sexualized language or imagery and unwelcome sexual attention or
25+
- The use of sexualized language or imagery and unwelcome sexual attention or
2626
advances
27-
* Trolling, insulting/derogatory comments, and personal or political attacks
28-
* Public or private harassment
29-
* Publishing others' private information, such as a physical or electronic
27+
- Trolling, insulting/derogatory comments, and personal or political attacks
28+
- Public or private harassment
29+
- Publishing others' private information, such as a physical or electronic
3030
address, without explicit permission
31-
* Other conduct which could reasonably be considered inappropriate in a
31+
- Other conduct which could reasonably be considered inappropriate in a
3232
professional setting
3333

3434
## Our Responsibilities

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"start": "astro dev",
99
"build": "astro build",
1010
"preview": "astro preview",
11+
"format": "prettier --write .",
1112
"astro": "astro",
1213
"deploy": "NODE_DEBUG=gh-pages gh-pages -d dist -t",
1314
"compress:jsons": "node bin/compress-jsons.cjs",

playwright.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ const config: PlaywrightTestConfig = {
100100
/* Run your local dev server before starting the tests */
101101
webServer: {
102102
command: 'npm run dev',
103-
url: "http://localhost:3000",
103+
url: 'http://localhost:3000',
104104
reuseExistingServer: !process.env.CI,
105105
},
106106
};

0 commit comments

Comments
 (0)