Skip to content

Commit

Permalink
Release 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kokororin committed Apr 27, 2023
1 parent 7c851f7 commit 503093f
Show file tree
Hide file tree
Showing 14 changed files with 297 additions and 214 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node_modules
.vscode
.vscode-test
*.md
.travis.yml
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ addons:

before_install:
- if [ $TRAVIS_OS_NAME == "linux" ]; then
export CXX="g++-4.9" CC="gcc-4.9" DISPLAY=:99.0;
sh -e /etc/init.d/xvfb start;
sleep 3;
fi
export CXX="g++-4.9" CC="gcc-4.9" DISPLAY=:99.0;
sh -e /etc/init.d/xvfb start;
sleep 3;
fi
- nvm install 8;
- npm install -g yarn

Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 1.1.0

- Update fmt.phar [(#101)](https://github.com/kokororin/vscode-phpfmt/pull/101)

### 1.0.31
- Update fmt.phar to 19.8.0
- Fix warnings for PHP 7
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,13 @@
}
},
"devDependencies": {
"@kokororin/prettierrc": "^0.1.1",
"@types/mocha": "^9.1.0",
"@types/node": "^17.0.13",
"cross-env": "^7.0.3",
"mocha": "^9.2.0",
"pjson": "^1.0.9",
"prettier": "^2.8.8",
"trash-cli": "^5.0.0",
"ts-node": "^10.4.0",
"typescript": "^4.5.5",
Expand Down
12 changes: 1 addition & 11 deletions prettier.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1 @@
module.exports = {
printWidth: 120,
singleQuote: false,
trailingComma: "es5",
bracketSpacing: true,
jsxBracketSameLine: true,
semi: true,
requirePragma: false,
proseWrap: "preserve",
arrowParens: "avoid",
};
module.exports = require('@kokororin/prettierrc');
94 changes: 56 additions & 38 deletions scripts/generate.ts
Original file line number Diff line number Diff line change
@@ -1,66 +1,84 @@
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);
Loading

0 comments on commit 503093f

Please sign in to comment.