chore: add update-user (#26)

* chore: add update-user

* fix link
This commit is contained in:
xrkffgg
2020-12-31 22:23:41 +08:00
committed by GitHub
parent dc73f4f963
commit 80c1fcca98
6 changed files with 170 additions and 91 deletions

View File

@@ -961,50 +961,33 @@ You can come to the following repositories for reference. Please leave a message
At the same time, if you have any questions during use, you can also ask and inquire in the issue or discussion. At the same time, if you have any questions during use, you can also ask and inquire in the issue or discussion.
<table> <table>
<tr> <tr>
<td align="center"> <td align="center"><a href="https://github.com/ant-design/ant-design"><img src="https://avatars1.githubusercontent.com/u/12101536?s=200&v=4" width="46" /></a></td>
<a href="https://github.com/ant-design/ant-design"> <td align="center"><a href="https://github.com/vueComponent/ant-design-vue"><img src="https://avatars1.githubusercontent.com/u/32120805?s=200&v=4" width="46" /></a></td>
<img src="https://avatars1.githubusercontent.com/u/12101536?s=200&v=4" width="46" /> <td align="center"><a href="https://github.com/umijs/dumi"><img src="https://avatars1.githubusercontent.com/u/33895495?s=200&v=4" width="46" /></a></td>
</a> <td align="center"><a href="https://github.com/mui-org/material-ui"><img src="https://avatars2.githubusercontent.com/u/33663932?s=200&v=4" width="46" /></a></td>
</td> <td align="center"><a href="https://github.com/umijs/umi"><img src="https://avatars1.githubusercontent.com/u/33895495?s=200&v=4" width="46" /></a></td>
<td align="center"> </tr>
<a href="https://github.com/vueComponent/ant-design-vue"> <tr>
<img src="https://avatars2.githubusercontent.com/u/32120805?s=200&v=4" width="46" /> <td width="160" align="center">ant-design</td>
</a> <td width="160" align="center">ant-design-vue</td>
</td> <td width="160" align="center">dumi</td>
<td align="center"> <td width="160" align="center">material-ui</td>
<a href="https://github.com/umijs/dumi"> <td width="160" align="center">umi</td>
<img src="https://avatars2.githubusercontent.com/u/33895495?s=200&v=4" width="46" /> </tr><tr>
</a> <td align="center"><a href="https://github.com/AttoJS/vue-request"><img src="https://raw.githubusercontent.com/AttoJS/art/master/vue-request-logo.png" width="46" /></a></td>
</td> <td align="center"></td>
<td align="center"> <td align="center"></td>
<a href="https://github.com/umijs/umi"> <td align="center"></td>
<img src="https://avatars2.githubusercontent.com/u/33895495?s=200&v=4" width="46" /> <td align="center"></td>
</a> </tr>
</td> <tr>
<td align="center"> <td width="160" align="center">vue-request</td>
<a href="https://github.com/AttoJS/vue-request"> <td width="160" align="center"></td>
<img src="https://raw.githubusercontent.com/AttoJS/art/master/vue-request-logo.png" width="46" /> <td width="160" align="center"></td>
</a> <td width="160" align="center"></td>
</td> <td width="160" align="center"></td>
</tr> </tr>
<tr>
<td align="center" width="160">
<strong>ant-design</strong>
</td>
<td align="center" width="160">
<strong>ant-design-vue</strong>
</td>
<td align="center" width="160">
<strong>dumi</strong>
</td>
<td align="center" width="160">
<strong>umi</strong>
</td>
<td align="center" width="160">
<strong>vue-request</strong>
</td>
</tr>
</table> </table>
## LICENSE ## LICENSE

View File

@@ -956,50 +956,33 @@ x2 + y2
同时,如果你在使用过程中有什么疑问,也可以在 issue 或者 discussion 中进行提问和查询。 同时,如果你在使用过程中有什么疑问,也可以在 issue 或者 discussion 中进行提问和查询。
<table> <table>
<tr> <tr>
<td align="center"> <td align="center"><a href="https://github.com/ant-design/ant-design"><img src="https://avatars1.githubusercontent.com/u/12101536?s=200&v=4" width="46" /></a></td>
<a href="https://github.com/ant-design/ant-design"> <td align="center"><a href="https://github.com/vueComponent/ant-design-vue"><img src="https://avatars1.githubusercontent.com/u/32120805?s=200&v=4" width="46" /></a></td>
<img src="https://avatars1.githubusercontent.com/u/12101536?s=200&v=4" width="46" /> <td align="center"><a href="https://github.com/umijs/dumi"><img src="https://avatars1.githubusercontent.com/u/33895495?s=200&v=4" width="46" /></a></td>
</a> <td align="center"><a href="https://github.com/mui-org/material-ui"><img src="https://avatars2.githubusercontent.com/u/33663932?s=200&v=4" width="46" /></a></td>
</td> <td align="center"><a href="https://github.com/umijs/umi"><img src="https://avatars1.githubusercontent.com/u/33895495?s=200&v=4" width="46" /></a></td>
<td align="center"> </tr>
<a href="https://github.com/vueComponent/ant-design-vue"> <tr>
<img src="https://avatars2.githubusercontent.com/u/32120805?s=200&v=4" width="46" /> <td width="160" align="center">ant-design</td>
</a> <td width="160" align="center">ant-design-vue</td>
</td> <td width="160" align="center">dumi</td>
<td align="center"> <td width="160" align="center">material-ui</td>
<a href="https://github.com/umijs/dumi"> <td width="160" align="center">umi</td>
<img src="https://avatars2.githubusercontent.com/u/33895495?s=200&v=4" width="46" /> </tr><tr>
</a> <td align="center"><a href="https://github.com/AttoJS/vue-request"><img src="https://raw.githubusercontent.com/AttoJS/art/master/vue-request-logo.png" width="46" /></a></td>
</td> <td align="center"></td>
<td align="center"> <td align="center"></td>
<a href="https://github.com/umijs/umi"> <td align="center"></td>
<img src="https://avatars2.githubusercontent.com/u/33895495?s=200&v=4" width="46" /> <td align="center"></td>
</a> </tr>
</td> <tr>
<td align="center"> <td width="160" align="center">vue-request</td>
<a href="https://github.com/AttoJS/vue-request"> <td width="160" align="center"></td>
<img src="https://raw.githubusercontent.com/AttoJS/art/master/vue-request-logo.png" width="46" /> <td width="160" align="center"></td>
</a> <td width="160" align="center"></td>
</td> <td width="160" align="center"></td>
</tr> </tr>
<tr>
<td align="center" width="160">
<strong>ant-design</strong>
</td>
<td align="center" width="160">
<strong>ant-design-vue</strong>
</td>
<td align="center" width="160">
<strong>dumi</strong>
</td>
<td align="center" width="160">
<strong>umi</strong>
</td>
<td align="center" width="160">
<strong>vue-request</strong>
</td>
</tr>
</table> </table>
## LICENSE ## LICENSE

View File

@@ -51,7 +51,7 @@ jobs:
## 💖 Who is using? ## 💖 Who is using?
<embed src="../README.md#L958-L1003"></embed> <embed src="../README.md#L958-L986"></embed>
## ⚡ Feedback ## ⚡ Feedback

View File

@@ -51,7 +51,7 @@ jobs:
## 💖 谁在使用? ## 💖 谁在使用?
<embed src="../README.md#L958-L1003"></embed> <embed src="../README.md#L958-L986"></embed>
## ⚡ 反馈 ## ⚡ 反馈

View File

@@ -10,7 +10,8 @@
"docs-dev:build": "UMI_ENV=dev dumi build", "docs-dev:build": "UMI_ENV=dev dumi build",
"docs:deploy": "gh-pages -d docs-dist", "docs:deploy": "gh-pages -d docs-dist",
"deploy": "npm run docs:build && npm run docs:deploy", "deploy": "npm run docs:build && npm run docs:deploy",
"package": "ncc build src/main.js -o dist" "package": "ncc build src/main.js -o dist",
"update": "node ./script/update-user.js"
}, },
"author": "xrkffgg", "author": "xrkffgg",
"license": "MIT", "license": "MIT",
@@ -33,6 +34,7 @@
}, },
"devDependencies": { "devDependencies": {
"@vercel/ncc": "^0.25.1", "@vercel/ncc": "^0.25.1",
"common-tags": "^1.8.0",
"dotenv": "^8.2.0", "dotenv": "^8.2.0",
"dumi": "^1.1.0", "dumi": "^1.1.0",
"gh-pages": "^3.1.0", "gh-pages": "^3.1.0",

111
script/update-user.js Normal file
View File

@@ -0,0 +1,111 @@
const { readFileSync, writeFileSync } = require('fs');
const { format } = require('prettier');
const { stripIndent } = require('common-tags');
// **************************************************************************
let users = [
{
url: 'https://github.com/ant-design/ant-design',
logo: 'https://avatars1.githubusercontent.com/u/12101536?s=200&v=4'
},
{
url: 'https://github.com/vueComponent/ant-design-vue',
logo: 'https://avatars1.githubusercontent.com/u/32120805?s=200&v=4'
},
{
url: 'https://github.com/umijs/dumi',
logo: 'https://avatars1.githubusercontent.com/u/33895495?s=200&v=4'
},
{
url: 'https://github.com/umijs/umi',
logo: 'https://avatars1.githubusercontent.com/u/33895495?s=200&v=4'
},
{
url: 'https://github.com/AttoJS/vue-request',
logo: 'https://raw.githubusercontent.com/AttoJS/art/master/vue-request-logo.png'
},
{
url: 'https://github.com/mui-org/material-ui',
logo: 'https://avatars2.githubusercontent.com/u/33663932?s=200&v=4'
},
];
users.sort((a, b) => getName(a).localeCompare(getName(b)));
// **************************************************************************
let table = '';
let row = users.length / 5;
let lastNo = users.length % 5;
if (lastNo != 0) row += 1;
for (let j = 1; j <= row; j++) {
let data = '';
data = stripIndent`
<tr>
<td align="center">${getImg(users[(j-1)*5])}</td>
<td align="center">${getImg(users[(j-1)*5+1])}</td>
<td align="center">${getImg(users[(j-1)*5+2])}</td>
<td align="center">${getImg(users[(j-1)*5+3])}</td>
<td align="center">${getImg(users[(j-1)*5+4])}</td>
</tr>
<tr>
<td width="160" align="center">${getName(users[(j-1)*5])}</td>
<td width="160" align="center">${getName(users[(j-1)*5+1])}</td>
<td width="160" align="center">${getName(users[(j-1)*5+2])}</td>
<td width="160" align="center">${getName(users[(j-1)*5+3])}</td>
<td width="160" align="center">${getName(users[(j-1)*5+4])}</td>
</tr>
`;
table += data
};
table = `<table>
${table}
</table>
`;
// **************************************************************************
const point = '<table>';
const last = `
## LICENSE
[MIT](https://github.com/actions-cool/issues-helper/blob/main/LICENSE)
`;
// **************************************************************************
const cn = readFileSync('./README.md', 'utf8');
const cnIn = cn.indexOf(point);
const cnBefore = cn.substring(0, cnIn);
const newcn = cnBefore + table + last;
writeFileSync('./README.md', newcn);
console.log(`🎉 Done cn`);
// **************************************************************************
const en = readFileSync('./README.en-US.md', 'utf8');
const enIn = en.indexOf(point);
const enBefore = en.substring(0, enIn);
const newen = enBefore + table + last;
writeFileSync('./README.en-US.md', newen);
console.log(`🎉 Done en`);
// **************************************************************************
function getImg (o) {
if (o) {
return `<a href="${o.url}"><img src="${o.logo}" width="46" /></a>`
}
return ``
};
function getName (o) {
if (o) {
return o.url.split('/').slice(-1)[0]
}
return ``
};
// **************************************************************************