-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
577 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
[ | ||
// === questions === | ||
{ | ||
type: 'question', | ||
title: 'Burnination request', | ||
body: 'Thanks for posting this request and allowing the community to weigh in! Please note that burninating a tag is the process of carefully moderating a specific piece of Stack Overflow (please think twice before doing tag-only mass edits, as they can be counter-productive); once the community reaches a consensus, burnination can proceed. For more info, see [What is the process for burninating tags?](/q/324070).' | ||
}, | ||
{ | ||
type: 'question', | ||
title: 'Burnination request Low Quality', | ||
body: 'Please note that burninating a tag is the process of carefully moderating a specific piece of Stack Overflow. Before burnination can proceed your question needs a bit more info on how the tag meets the burnination criteria. For more info, see [What is the process for burninating tags?](/q/324070).' | ||
}, | ||
{ | ||
type: 'question', | ||
title: 'Meta to Main', | ||
body: 'You are on [Meta](//stackoverflow.com/help/whats-meta). This question will not be answered here and you may want to go over the [Checklist](/q/260648) and [ask] before you repost on main. Please consider deleting this question.' | ||
}, | ||
{ | ||
type: 'question', | ||
title: 'Voting on meta is different', | ||
body: '[Voting on meta is different](//stackoverflow.com/help/whats-meta). Votes are often used to express (dis)agreement with the general premise of the Meta question. These votes *won\'t affect* your main site reputation.' | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
[ | ||
// === questions === | ||
{ | ||
type: 'question', | ||
title: 'ID - No tour, no details', | ||
body: 'Hi and welcome. Identification questions need more details to be answerable. Please take the [tour] that will give you the scope of identification questions. [Here](//musicfans.meta.stackexchange.com/q/350) is a list of relevant details that you should specify.' | ||
}, | ||
{ | ||
type: 'question', | ||
title: 'ID - Tour, no details', | ||
body: 'Identification questions need more details to be answerable. [Here](//musicfans.meta.stackexchange.com/q/350) is a list of relevant details that you should specify.' | ||
}, | ||
{ | ||
type: 'question', | ||
title: 'ID - No tour, no music (only video description)', | ||
body: 'Hi and welcome. Please add more details about the music itself. Please take the [tour] that will give you the scope of identification questions. [Here](//musicfans.meta.stackexchange.com/q/350) is a list of relevant details that you should specify.' | ||
}, | ||
{ | ||
type: 'question', | ||
title: 'ID - Tour, no music (only video description)', | ||
body: 'Please add more details about the music itself. [Here](//musicfans.meta.stackexchange.com/q/350) is a list of relevant details that you should specify.' | ||
} | ||
] |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import path from 'path'; | ||
import fs from 'fs'; | ||
import JSON5 from 'json5'; | ||
|
||
const typeToLetter = (type) => { | ||
switch (type) { | ||
case "question": return "Q"; | ||
case "answer": return "A"; | ||
case "close reason": return "C"; | ||
case "custom edit rejection": return "CRC"; | ||
case "edit summary question": return "EQ"; | ||
default: throw new Error(`'${type}' is not a valid type`); | ||
} | ||
} | ||
|
||
const convertJson5FileToJsonp = (json5FilePath) => { | ||
const fileNameWithoutExt = path.parse(json5FilePath).name; | ||
|
||
const json5FileContent = fs.readFileSync(json5FilePath, { encoding: "utf-8" }); | ||
const data = JSON5.parse(json5FileContent); | ||
const formattedEntries = data.map(entry => { | ||
return { | ||
name: `[${typeToLetter(entry.type)}] ${entry.title}`, | ||
description: entry.body | ||
}; | ||
}); | ||
|
||
const jsonp = "callback(\n" + JSON.stringify(formattedEntries, null, 2) + ")"; | ||
const outputFilePath = path.join('.', 'dist', 'comments', `${fileNameWithoutExt}.jsonp`); | ||
if (!fs.existsSync(path.dirname(outputFilePath))) { | ||
fs.mkdirSync(path.dirname(outputFilePath), { recursive: true }); | ||
} | ||
fs.writeFileSync(outputFilePath, jsonp, { encoding: "utf-8" }); | ||
}; | ||
|
||
const commentsDirPath = path.join(import.meta.dirname, 'comments'); | ||
|
||
for (const partialFilePath of fs.readdirSync(commentsDirPath, { recursive: true })) | ||
{ | ||
const filePath = `./comments/${partialFilePath}`; | ||
if (path.parse(filePath).ext === '.json5') | ||
{ | ||
console.log(filePath); | ||
convertJson5FileToJsonp(filePath); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters