-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Some file format (prettier), new dep for phpfmt and fresh new ignore …
…setting prop - Prettier added to project to format and normalize JS/TS files; - Fix the package dep for PHPFMT external project with a new package; - Fresh new `ignore` setting prop to ignore auto format in some file extensions.
- Loading branch information
1 parent
d103197
commit e92644a
Showing
17 changed files
with
833 additions
and
744 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,6 @@ | ||
node_modules | ||
/out | ||
/testProject | ||
.vscode | ||
.vscode-test | ||
*.md |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module.exports = { | ||
printWidth: 120, | ||
singleQuote: false, | ||
trailingComma: "es5", | ||
bracketSpacing: true, | ||
jsxBracketSameLine: true, | ||
semi: true, | ||
requirePragma: false, | ||
proseWrap: "preserve", | ||
arrowParens: "avoid", | ||
}; |
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 |
---|---|---|
@@ -1,84 +1,66 @@ | ||
import path from 'path'; | ||
import fs from 'fs'; | ||
import os from 'os'; | ||
import Transformations from '../src/Transformations'; | ||
import path from "path"; | ||
import fs from "fs"; | ||
import os from "os"; | ||
import Transformations from "../src/Transformations"; | ||
|
||
const pkg: any = require('pjson'); | ||
const pkg: any = require("pjson"); | ||
|
||
const readmePath: string = path.join(__dirname, '/../README.md'); | ||
const readmePath: string = path.join(__dirname, "/../README.md"); | ||
|
||
const configuration: any = pkg.contributes.configuration; | ||
|
||
let config: string = | ||
'| Key | Type | Description | Default |' + | ||
os.EOL + | ||
'| -------- | ----------- | ----------- | ----------- |' + | ||
os.EOL; | ||
"| Key | Type | Description | Default |" + os.EOL + "| -------- | ----------- | ----------- | ----------- |" + os.EOL; | ||
|
||
for (const configKey of Object.keys(configuration.properties)) { | ||
const configValue = configuration.properties[configKey]; | ||
config += `| ${configKey} | `; | ||
|
||
if (typeof configValue.type === 'string') { | ||
if (typeof configValue.type === "string") { | ||
config += `\`${configValue.type}\``; | ||
} else if (Array.isArray(configValue.type)) { | ||
config += `\`${configValue.type.join(' \\| ')}\``; | ||
config += `\`${configValue.type.join(" \\| ")}\``; | ||
} | ||
config += ` | ${configValue.description}`; | ||
|
||
if (typeof configValue.default === 'string') { | ||
if (typeof configValue.default === "string") { | ||
config += ` | "${configValue.default}"`; | ||
} else if (typeof configValue.default === 'number') { | ||
} else if (typeof configValue.default === "number") { | ||
config += ` | ${configValue.default}`; | ||
} else if ( | ||
Array.isArray(configValue.default) || | ||
typeof configValue.default === 'boolean' | ||
) { | ||
} else if (Array.isArray(configValue.default) || typeof configValue.default === "boolean") { | ||
config += ` | ${JSON.stringify(configValue.default)}`; | ||
} else { | ||
throw new Error('uncovered type'); | ||
throw new Error("uncovered type"); | ||
} | ||
|
||
config += ' | ' + os.EOL; | ||
config += " | " + os.EOL; | ||
} | ||
|
||
let readmeContent = fs.readFileSync(readmePath).toString(); | ||
readmeContent = readmeContent.replace( | ||
/<!-- Configuration START -->([\s\S]*)<!-- Configuration END -->/, | ||
() => { | ||
return ( | ||
'<!-- Configuration START -->' + | ||
os.EOL + | ||
config + | ||
os.EOL + | ||
'<!-- Configuration END -->' | ||
); | ||
} | ||
); | ||
readmeContent = readmeContent.replace(/<!-- Configuration START -->([\s\S]*)<!-- Configuration END -->/, () => { | ||
return "<!-- Configuration START -->" + os.EOL + config + os.EOL + "<!-- Configuration END -->"; | ||
}); | ||
|
||
readmeContent = readmeContent.replace( | ||
/<!-- Transformations START -->([\s\S]*)<!-- Transformations END -->/, | ||
() => { | ||
return ( | ||
'<!-- Transformations START -->' + | ||
os.EOL + | ||
'| Key | Description |' + | ||
os.EOL + | ||
'| -------- | ----------- |' + | ||
os.EOL + | ||
new Transformations('php') | ||
.getTransformations() | ||
.map(item => { | ||
let row = `| ${item.key} | `; | ||
row += item.description; | ||
row += ' |'; | ||
return row; | ||
}) | ||
.join(os.EOL) + | ||
os.EOL + | ||
'<!-- Transformations END -->' | ||
); | ||
} | ||
); | ||
readmeContent = readmeContent.replace(/<!-- Transformations START -->([\s\S]*)<!-- Transformations END -->/, () => { | ||
return ( | ||
"<!-- Transformations START -->" + | ||
os.EOL + | ||
"| Key | Description |" + | ||
os.EOL + | ||
"| -------- | ----------- |" + | ||
os.EOL + | ||
new Transformations("php") | ||
.getTransformations() | ||
.map(item => { | ||
let row = `| ${item.key} | `; | ||
row += item.description; | ||
row += " |"; | ||
return row; | ||
}) | ||
.join(os.EOL) + | ||
os.EOL + | ||
"<!-- Transformations END -->" | ||
); | ||
}); | ||
|
||
fs.writeFileSync(readmePath, readmeContent); |
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
Oops, something went wrong.