chore: update devDependencies.

This commit is contained in:
jaywcjlove 2021-05-17 14:54:21 +08:00
parent a6d062f247
commit bb961d8538
11 changed files with 1271 additions and 1006 deletions

View File

@ -7,27 +7,17 @@ jobs:
build-deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: '10.x'
- run: npm install
- run: npm run create:html
- run: npm run create:ast
# - name: Cache dependencies
# uses: actions/cache@v1
# with:
# path: ~/.npm
# key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
# restore-keys: |
# ${{ runner.os }}-node-
- run: npm install
- run: npm run start
- name: Build and Deploy
uses: peaceiris/actions-gh-pages@v2.5.0
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: ./dist
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist

3
.gitignore vendored
View File

@ -1,5 +1,6 @@
node_modules/
dist
dist/*.html
dist/*.json
npm-debug.log*
package-lock.json

View File

@ -1,5 +1,6 @@
Awesome Mac
----
<!--rehype:style=font-size: 38px; border-bottom: 0; padding-bottom: 20px; padding-top: 26px;-->
[![jaywcjlove/sb](https://jaywcjlove.github.io/sb/ico/awesome.svg)](https://github.com/sindresorhus/awesome) [![jaywcjlove/sb](https://jaywcjlove.github.io/sb/lang/english.svg)](README.md) [![Gitter](https://jaywcjlove.github.io/sb/ico/gitter.svg)](https://gitter.im/awesome-mac/en?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge) [![SegmentFault](https://jaywcjlove.github.io/sb/ico/segmentfault.svg)](https://segmentfault.com/g/1570000010622746) [![](https://jaywcjlove.github.io/sb/ico/weibo.svg)](http://weibo.com/pc175) [![Backers on Open Collective](https://opencollective.com/awesome-mac/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/awesome-mac/sponsors/badge.svg)](#sponsors)
@ -77,7 +78,7 @@ Awesome Mac
- [Sponsors](#sponsors)
- [License](#license)
<!--start-->
## 开发者工具
@ -968,6 +969,8 @@ Awesome Mac
* 威锋网:~~`https://bbs.feng.com/forum.php?mod=forumdisplay&fid=19&page=`~~
* MAC萌新网~~`https://www.macxin.com`~~
<!--end-->
**[⬆ 返回顶部](#目录)**

View File

@ -1,5 +1,6 @@
Awesome Mac
----
<!--rehype:style=font-size: 38px; border-bottom: 0; padding-bottom: 20px; padding-top: 26px;-->
[![jaywcjlove/sb](https://jaywcjlove.github.io/sb/ico/awesome.svg)](https://github.com/sindresorhus/awesome) [![jaywcjlove/sb](https://jaywcjlove.github.io/sb/lang/chinese.svg)](README-zh.md) [![Gitter](https://jaywcjlove.github.io/sb/ico/gitter.svg)](https://gitter.im/awesome-mac/en?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge)
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fjaywcjlove%2Fawesome-mac.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fjaywcjlove%2Fawesome-mac?ref=badge_shield)
@ -93,6 +94,8 @@ Any comments, suggestions? [Let us know!](https://github.com/jaywcjlove/awesome-
- [Sponsors](#sponsors)
- [License](#license)
<!--start-->
## Reading and Writing Tools
*Applications to edit text, I suggest the open-source editors*
@ -1001,10 +1004,7 @@ If you come across websites offering pirated software or cracks, please post [HE
**[⬆ back to top](#contents)**
[OSS Icon]: https://jaywcjlove.github.io/sb/ico/min-oss.svg "Open Source Software"
[Freeware Icon]: https://jaywcjlove.github.io/sb/ico/min-free.svg "Freeware"
[app-store Icon]: https://jaywcjlove.github.io/sb/ico/min-app-store.svg "App Store Software"
[awesome-list Icon]: https://jaywcjlove.github.io/sb/ico/min-awesome.svg "Awesome List"
<!--end-->
## Contributors
@ -1031,3 +1031,8 @@ Support this project by becoming a sponsor. Your logo will show up here with a l
[![Creative Commons License](http://i.creativecommons.org/l/by/4.0/88x31.png)](https://creativecommons.org/licenses/by/4.0/)
This work is licensed under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/).
[OSS Icon]: https://jaywcjlove.github.io/sb/ico/min-oss.svg "Open Source Software"
[Freeware Icon]: https://jaywcjlove.github.io/sb/ico/min-free.svg "Freeware"
[app-store Icon]: https://jaywcjlove.github.io/sb/ico/min-app-store.svg "App Store Software"
[awesome-list Icon]: https://jaywcjlove.github.io/sb/ico/min-awesome.svg "Awesome List"

135
build/ast.mjs Normal file
View File

@ -0,0 +1,135 @@
import { toVFile } from 'to-vfile'
import remark from 'remark'
import gfm from 'remark-gfm'
import FS from 'fs-extra'
const getHeadingText = (arr = [], title = '') => {
arr.forEach(child => {
title += child.value
if (child.children && Array.isArray(child.children)) {
title += getHeadingText(child.children, title)
}
})
return title;
}
const getSoftwareName = (obj, result = { title: '' }) => {
if (obj.value) {
result.title += obj.value
}
if (obj.url) {
result.url = obj.url
}
if (obj.type === 'delete') {
result.delete = true
}
if (obj.children && Array.isArray(obj.children)) {
obj.children.forEach(child => {
result = getSoftwareName(child, result)
})
}
return result
}
const getIconDetail = (data, url = '') => {
if (data.type === 'imageReference' && data.identifier && /^(freeware\s+icon|oss\s+icon|app-store\s+icon|awesome-list\s+icon)/.test(data.identifier.toLocaleLowerCase())) {
let type = ''
if (/^(freeware\s+icon)/.test(data.identifier.toLocaleLowerCase())) {
type = 'freeware'
}
if (/^(oss\s+icon)/.test(data.identifier.toLocaleLowerCase())) {
type = 'oss'
}
if (/^(app-store\s+icon)/.test(data.identifier.toLocaleLowerCase())) {
type = 'app-store'
}
if (/^(awesome-list\s+icon)/.test(data.identifier.toLocaleLowerCase())) {
type = 'awesome-list'
}
return { type, url }
}
return false
}
/**
* ```markdown
* * [Atom](https://atom.io) - xxxxxxx. [![Open-Source Software][OSS Icon]](https://xxx) ![Freeware][Freeware Icon] [![Awesome List][awesome-list Icon]](https://xxx)
* ```
*/
const getMarkIcons = (arr = [], parent = {}) => {
let mark = { icons: [] }
if (arr && Array.isArray(arr) && arr[1] && arr[1].type === 'text' && /^([\s]+)?-\s/.test(arr[1].value)) {
mark = { ...mark, ...getSoftwareName(arr[0]) }
arr = arr.filter(child => {
const data = getIconDetail(child)
if (data) {
mark.icons.push(data)
return false
}
if (child.type === 'link' && child.children && Array.isArray(child.children)) {
const childArr = child.children.filter(d => getIconDetail(d))
if (childArr.length > 0) {
childArr.forEach((item) => {
mark.icons.push(getIconDetail(item, child.url))
})
return false
}
}
if (child.type === 'text' && child.value.replace(/\s/g, '') === '') {
return false
}
return true
});
}
return { children: [...arr], mark: { ...mark } }
}
const getMdToAST = (data = [], parent = {}) => {
data = data.map((child) => {
if (child.position) {
delete child.position
if (child.type === 'listItem') {
delete child.checked
delete child.spread;
}
if (child.type === 'paragraph' && parent.type === 'listItem') {
const result = getMarkIcons(child.children, child)
child = { ...child, ...result }
}
if (child.type === 'heading') {
child.value = getHeadingText(child.children)
delete child.children
}
}
if (child.children && Array.isArray(child.children)) {
child.children = getMdToAST(child.children, child)
}
return child
})
return data
}
remark()
.use(gfm)
.use(() => (tree) => {
const startIndex = tree.children.findIndex(item => item.type === 'html' && /<!--start-->/.test(item.value))
const endIndex = tree.children.findIndex(item => item.type === 'html' && /<!--end-->/.test(item.value))
const data = tree.children.slice(startIndex + 1, endIndex)
const dataAST = getMdToAST([...data])
FS.outputJsonSync('./dist/awesome-mac.json', dataAST)
console.log(' create file: ./dist/awesome-mac.json')
})
.processSync(toVFile.readSync('README.md'))
remark()
.use(gfm)
.use(() => (tree) => {
const startIndex = tree.children.findIndex(item => item.type === 'html' && /<!--start-->/.test(item.value))
const endIndex = tree.children.findIndex(item => item.type === 'html' && /<!--end-->/.test(item.value))
const data = tree.children.slice(startIndex + 1, endIndex)
const dataAST = getMdToAST([...data])
FS.outputJsonSync('./dist/awesome-mac.zh.json', dataAST)
console.log(' create file: ./dist/awesome-mac.zh.json')
})
.processSync(toVFile.readSync('README-zh.md'))

View File

@ -1,278 +0,0 @@
const path = require('path');
const ejs = require('ejs');
const FS = require('fs-extra');
const marked = require('marked');
const loading = require('loading-cli');
const ghpages = require('gh-pages');
const minify = require("html-minifier").minify;
const markdownParse = require("@textlint/markdown-to-ast").parse;
const colors = require('colors-cli/toxic');
const pkg = require('../package.json');
const deployDir = path.resolve(process.cwd(), 'dist');
const templatePath = path.resolve(process.cwd(), 'build', 'template.ejs');
const faviconPath = path.resolve(process.cwd(), 'build', 'favicon.ico');
mkdirs(deployDir)
.then(dir => emptyDir(dir))
.then(dir => markdownToAst(path.resolve(process.cwd(), 'README.md')))
// Output `awesome-mac-data.json` file, https://github.com/jaywcjlove/amac
.then(ast => outputFile(path.resolve(deployDir, 'awesome-mac-data.json'), JSON.stringify(ast)))
.then(dir => MarkedToHTMLOutputFile(
path.resolve(process.cwd(), 'README.md'),
path.resolve(deployDir, 'index.html')
))
.then(dir => MarkedToHTMLOutputFile(
path.resolve(process.cwd(), 'README-zh.md'),
path.resolve(deployDir, 'index.zh.html')
))
.then(dir => MarkedToHTMLOutputFile(
path.resolve(process.cwd(), 'editor-plugin.md'),
path.resolve(deployDir, 'editor-plugin.html')
))
.then(dir => MarkedToHTMLOutputFile(
path.resolve(process.cwd(), 'editor-plugin-zh.md'),
path.resolve(deployDir, 'editor-plugin-zh.html')
))
.then(() => FS.copySync(faviconPath, path.resolve(deployDir, 'favicon.ico') ))
// .then(() => PushGhpage(deployDir, {
// repo: 'git@github.com:jaywcjlove/awesome-mac.git',
// message: `MacOSX software list update, Compiler generation page. ${new Date()}`
// }))
// .then(() => console.log(`\n Push Success!!\n`.green))
.catch((err) => {
if (err && err.message) {
console.log(`\n ERROR :> ${err.message.red_bt}\n`)
}
});
/**
* Create a directory
* @param {String} dir
*/
function mkdirs(dir) {
return new Promise((resolve, reject) => {
FS.ensureDir(dir, err => {
err ? reject(err) : resolve(dir);
})
});
}
/**
* Empty a directory
* @param {String} dir
*/
function emptyDir(dir) {
return new Promise((resolve, reject) => {
FS.emptyDir(dir, err => {
err ? reject(err) : resolve(dir);
})
});
}
/**
* Output file.
* @param {String} filePath
* @param {String} html
*/
function outputFile(filePath, html) {
return new Promise((resolve, reject) => {
try {
FS.outputFileSync(filePath, minify(html, {
minifyCSS: true,
minifyJS: true,
collapseWhitespace: true,
conservativeCollapse: true
}));
resolve();
} catch (err) {
reject(err)
}
});
}
/**
* Markdown to HTML
* @param {String} file Markdown path
*/
function MarkedToHTML(file) {
return new Promise((resolve, reject) => {
try {
const markdownStr = FS.readFileSync(file);
const renderer = new marked.Renderer();
renderer.heading = function (text, level) {
text = text.replace(/<+.*>/, '');
if (/[\u4E00-\u9FA5]/i.test(text)) {
return '<h' + level + ' id="' + text.toLowerCase() + '">' + text + '</h' + level + '>';
}
const escapedText = text.toLowerCase().replace(/[^\w]+/g, '-');
return '<h' + level + ' id="' + escapedText + '">' + text + '</h' + level + '>';
}
marked.setOptions({ renderer });
resolve(marked(markdownStr.toString()));
} catch (err) {
reject(err)
}
});
}
/**
* Replace 'README.md' => 'index.html'
* @param {String} html HTML code
* @param {Object} options
*/
function MDhrefToPath(html, options = {}) {
const reg = new RegExp('<*href="(.*?)"*>', 'ig');
return new Promise((resolve, reject) => {
try {
const htmlResult = html.replace(reg, (a, st) => {
Object.keys(options).forEach((key) => {
if (st.indexOf(key) > -1) {
a = a.replace(st, options[key]);
}
})
return a
});
resolve(htmlResult);
} catch (err) {
reject(err)
}
});
}
function ejsRenderFile(ejsPath, data, options = {}) {
return new Promise((resolve, reject) => {
ejs.renderFile(ejsPath, data, options, (err, str) => {
err ? reject(err) : resolve(str);
});
});
}
function MarkedToHTMLOutputFile(mdpath, toPath) {
return MarkedToHTML(mdpath)
.then(html => MDhrefToPath(html, {
'README.md': 'index.html',
'README-zh.md': 'index.zh.html',
'editor-plugin.md': 'editor-plugin.html',
'editor-plugin-zh.md': 'editor-plugin-zh.html',
}))
.then(html => ejsRenderFile(
templatePath,
{
lang: toPath.indexOf('zh.html') > 0 ? 'zh' : 'en',
html
}
))
.then(html => outputFile(toPath, html))
.then(() => {
console.log(`${'Success:'.green} ${mdpath.replace(process.cwd(), '').blue} -> ${toPath.replace(process.cwd(), '').blue}`)
return toPath;
});
}
function PushGhpage(dirPath, options = {}) {
if (!options.branch) options.branch = 'gh-pages';
return new Promise((resolve, reject) => {
const load = loading(' Pushing code!!');
load.start();
return ghpages.publish(dirPath, options, (err) => {
load.stop();
err ? reject(err) : resolve(str);
});
});
}
function arrayToJsonAst(arr, depth = 2, result = []) {
const getArrayItems = (items) => {
const itemsLink = [];
for (let a = 0; a < items.length; a += 1) {
if (a !== 0 && items[a].type == 'Header' && items[a].depth <= depth) {
break;
} else if (a !== 0 && items[a].type == 'List') {
items[a].children.forEach((child) => {
if (child.children[0] && child.children[0].children.length > 0) {
const itemChild = {};
child.children[0].children.forEach((_item, idx) => {
if (idx === 0 && _item.type === 'Link') {
itemChild.link = _item.url;
itemChild.name = '';
if (_item.children && _item.children.length > 0) {
itemChild.name = _item.children[0].value;
}
}
if (idx === 1 && _item.type === 'Str') {
itemChild.des = _item.value.replace(/^(-|\s-\s|\s-|-\s)/g, '');
}
if (idx > 1 && /(Link|imageReference)/.test(_item.type)) {
if (!itemChild.tag) itemChild.tag = [];
if (/(awesome-list\ icon|app-store\ icon|freeware\ icon|oss\ icon)/.test(_item.identifier)) {
itemChild.tag.push({
alt: _item.alt,
identifier: _item.identifier,
})
}
if (/(Link)/.test(_item.type) && _item.children && _item.children[0] && /(awesome-list\ icon|app-store\ icon|freeware\ icon|oss\ icon)/.test(_item.children[0].identifier)) {
itemChild.tag.push({
url: _item.url,
alt: _item.children[0].alt,
identifier: _item.children[0].identifier,
})
}
}
})
if (itemChild.des) itemsLink.push(itemChild);
}
})
}
}
return itemsLink;
}
arr.forEach((item, idx) => {
if (item.type == 'Header' && item.depth === depth) {
const title = item.children.filter(_item => _item.type === 'Str')[0];
let des = '';
if (arr[idx + 1] && arr[idx + 1].type === 'Paragraph') {
des = arr[idx + 1].raw;
}
const props = {
title: title.value,
des,
key: title.value.toLowerCase().replace(/\s/g, '-'),
items: getArrayItems(arr.slice(idx, arr.length)),
};
if (props.items && props.items.length > 0) {
result.push(props);
}
}
});
if (depth <= 6 && result.length === 0) {
result = arrayToJsonAst(arr, depth + 1);
}
return result;
}
/**
* Markdown to JSON
* @param {String} markdownPath
*/
function markdownToAst(markdownPath) {
return new Promise((resolve, reject) => {
try {
const markdownStr = FS.readFileSync(markdownPath);
const AST = markdownParse(markdownStr.toString());
const ASTData = {
version: pkg.version,
name: pkg.name,
description: pkg.description,
data: [],
};
if (AST && AST.children && AST.children.length > 0) {
ASTData.data = arrayToJsonAst(AST.children);
}
resolve(ASTData);
} catch (err) {
reject(err);
}
});
}

227
build/create.mjs Normal file
View File

@ -0,0 +1,227 @@
import FS from 'fs-extra'
import unified from 'unified'
import { toVFile } from 'to-vfile'
import { reporter } from 'vfile-reporter'
import markdown from 'remark-parse'
import slug from 'remark-slug'
import headings from 'remark-autolink-headings'
import { html, template, doctype } from 'rehype-template'
import stringify from 'rehype-stringify'
import remark2rehype from 'remark-rehype'
import rehypeAttrs from 'rehype-attr'
import rehypeRaw from 'rehype-raw'
import rehypeRewrite from 'rehype-rewrite'
import rehypeUrls from 'rehype-urls'
FS.ensureDirSync('./dist');
const styles = `
body,html{padding: 0;margin:0;}
body{font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; font-size: 16px; line-height: 1.5; word-wrap: break-word; }
p,blockquote,ul,ol,dl,table,pre{margin-top: 0; margin-bottom: 16px; }
blockquote{margin-right: 0; margin-left: 0; padding: 0 1em; color: #777; border-left: 0.25em solid #ddd; }
a { color: #4078c0; text-decoration: none; }
.markdown-body{ padding: 25px; padding-top: 43px;}
.markdown-body>*:first-child { margin-top: 0 !important; }
.markdown-body .anchor { float: left; padding-right: 4px; margin-left: -20px; line-height: 1; }
.markdown-body .anchor svg.octicon-link { vertical-align: middle; visibility: hidden; }
.markdown-body h1:hover .anchor svg.octicon-link,
.markdown-body h2:hover .anchor svg.octicon-link,
.markdown-body h3:hover .anchor svg.octicon-link,
.markdown-body h4:hover .anchor svg.octicon-link,
.markdown-body h5:hover .anchor svg.octicon-link,
.markdown-body h6:hover .anchor svg.octicon-link { visibility: visible; }
h1, h2, h3, h4, h5, h6{margin-top: 24px; margin-bottom: 16px; font-weight: 600; line-height: 1.25; }
h1{padding-bottom: 0.3em; font-size: 2em; border-bottom: 1px solid #eee; }
h2{padding-bottom: 0.3em; font-size: 1.5em; border-bottom: 1px solid #eee; }
ul, ol {padding-left: 1.2em; }
li>p {margin-top: 16px; }
code, tt{padding: 0; padding-top: 0.2em; padding-bottom: 0.2em; margin: 0; font-size: 85%; background-color: rgba(0,0,0,0.04); border-radius: 3px; }
code{white-space: normal; }
code, pre{font-family: Consolas, "Liberation Mono", Courier, monospace; }
del code{text-decoration: inherit; }
code:before, code:after, tt:before, tt:after { letter-spacing: -0.2em; content: "\\00a0"; }
del{color: #727272; }
ul {list-style-type: square;}
ul ul{list-style-type:circle;}
ul ul ul{list-style-type:disc; }
.totop{ position: fixed; bottom: 20px; right: 20px; display: inline-block; background: rgba(0, 0, 0, 0.74); padding: 10px; border-radius: 3px; z-index: 9999; color: #fff; font-size: 10px; }
a.github-corner {position: fixed; top: 0; right: 0; }
.github-corner svg{fill:#e1e1e1;color:#000;position:absolute;top:0;border:0;right:0;z-index:99;width:4.375rem;height:4.375rem}
.github-corner:hover .octo-arm{-webkit-animation:octocat-wave 560ms ease-in-out;animation:octocat-wave 560ms ease-in-out}
@-webkit-keyframes octocat-wave{
0%,100%{-webkit-transform:rotate(0);transform:rotate(0)}
20%,60%{-webkit-transform:rotate(-25deg);transform:rotate(-25deg)}
40%,80%{-webkit-transform:rotate(10deg);transform:rotate(10deg)}
}
@keyframes octocat-wave{
0%,100%{-webkit-transform:rotate(0);transform:rotate(0)}
20%,60%{-webkit-transform:rotate(-25deg);transform:rotate(-25deg)}
40%,80%{-webkit-transform:rotate(10deg);transform:rotate(10deg)}
}
#awesome-mac { padding: 37px 0px 40px 0; text-align: center; color: #686868; }
.topmenu { position: fixed; left: 5px; }
.topmenu a { background: #00000073; display: inline-block; padding: 1px 5px; font-size: 12px; border-radius: 2px; margin-right: 5px; color: #fff; }
.topmenu a:hover{ background: #2186ff; color: #fff; }
#gitalk-container { padding: 15px; }
`
const t = (node, frontmatter) => html`
${doctype}
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<title>Awesome Mac application sharing recommendation - Awesome Mac</title>
<meta name="description" content="A curated list of awesome applications, softwares, tools and shiny things for Mac osx. - Awesome Mac" />
<meta name="keywords" content="mac,osx,app,softwares,applications,mac softwares,awesome mac,free softwares,Freeware" />
<link rel="shortcut icon" href="./favicon.ico" />
<link rel="stylesheet" href="//unpkg.com/gitalk/dist/gitalk.css" />
<style>${styles}</style>
</head>
<body id="totop">
<div class="topmenu">
<a href="https://github.com/jaywcjlove/awesome-mac/issues">
Recommended
</a>
<a href="https://github.com/jaywcjlove/awesome-mac/issues">Link failure Report</a>
</div>
<a href="https://github.com/jaywcjlove/awesome-mac" target="_blank" class="github-corner">
<svg viewBox="0 0 250 250">
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
<path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>
<path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path>
</svg>
</a>
<div class="markdown-body">
${node}
</div>
<div id="gitalk-container"></div>
<script src="https://utteranc.es/client.js" repo="jaywcjlove/awesome-mac" issue-term="homepage" crossorigin theme="github-light" async></script>
<a href="#totop" class="totop">Top</a>
</body>
</html>
`
const tZh = (node, frontmatter) => html`
${doctype}
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<title>Awesome Mac application sharing recommendation - Awesome Mac</title>
<meta name="description" content="收集分享大量非常好用的Mac应用程序、软件以及工具主要面向开发者和设计师。 - Awesome Mac" />
<meta name="keywords" content="mac,osx,app,mac软件,awesome mac,苹果软件下载,免费软件,mac免费软件下载,精品mac应用" />
<link rel="shortcut icon" href="./favicon.ico" />
<link rel="stylesheet" href="https://unpkg.com/gitalk/dist/gitalk.css" />
<style>${styles}</style>
</head>
<body id="totop">
<div class="topmenu">
<a href="https://github.com/jaywcjlove/awesome-mac/issues">
Recommended
</a>
<a href="https://github.com/jaywcjlove/awesome-mac/issues">Link failure Report</a>
</div>
<a href="https://github.com/jaywcjlove/awesome-mac" target="_blank" class="github-corner">
<svg viewBox="0 0 250 250">
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
<path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>
<path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path>
</svg>
</a>
<div class="markdown-body">
${node}
</div>
<div id="gitalk-container"></div>
<script src="https://utteranc.es/client.js" repo="jaywcjlove/awesome-mac" issue-term="homepage" crossorigin theme="github-light" async></script>
<a href="#totop" class="totop">Top</a>
</body>
</html>
`
const rehypeRewriteHandle = (node, index, parent) => {
if (node.type === 'element' && parent.type === 'root' && /h(1|2|3|4|5|6)/.test(node.tagName) && index !== 0) {
const child = node.children && node.children[0] ? node.children[0] : null
if (child && child.properties && child.properties.ariaHidden === 'true') {
child.properties = { class: 'anchor', ...child.properties }
child.children = [
{
type: "element",
tagName: "svg",
properties: {
class: "octicon octicon-link",
viewBox: "0 0 16 16",
version: "1.1",
width: "16",
height: "16",
ariaHidden: "true",
},
children: [
{
type: "element",
tagName: "path",
properties: {
fillRule: "evenodd",
d: "M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z",
}
}
]
}
]
}
}
}
function processorHandle(templ) {
var processor = unified()
.use(markdown)
.use(slug)
.use(headings)
.use(remark2rehype, { allowDangerousHtml: true })
.use(rehypeRaw)
.use(rehypeAttrs, { properties: 'attr' })
.use(rehypeRewrite, rehypeRewriteHandle)
.use(rehypeUrls, (url) => {
if (/README-zh.md$/.test(url.href)) {
url.path = 'index.zh.html'
return url.path
}
if (/README.md$/.test(url.href)) {
url.path = 'index.html'
return url.path
}
})
.use(template, { template: templ })
.use(stringify)
return processor
}
processorHandle(tZh).process(toVFile.readSync('README-zh.md'), (err, file) => {
if (err) {
console.error(reporter(err || file))
return
}
file.extname = '.html'
toVFile.writeSync({
value: file.contents,
path: './dist/index.zh.html'
})
console.log(' create file: ./dist/index.zh.html')
})
processorHandle(t).process(toVFile.readSync('README.md'), (err, file) => {
if (err) {
console.error(reporter(err || file))
return
}
file.extname = '.html'
toVFile.writeSync({
value: file.contents,
path: './dist/index.html'
})
console.log(' create file: ./dist/index.html')
})

View File

@ -1,110 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
<title><% if(lang=='zh'){ %> 精品Mac应用分享推荐 - Awesome Mac <% }else{ %> Awesome Mac application sharing recommendation - Awesome Mac <% } %></title>
<meta name="description" content="<% if(lang=='zh'){ %> 收集分享大量非常好用的Mac应用程序、软件以及工具主要面向开发者和设计师。 - Awesome Mac <% }else{ %> A curated list of awesome applications, softwares, tools and shiny things for Mac osx. - Awesome Mac <% } %>" />
<meta name="keywords" content="<% if(lang=='zh'){ %> mac,osx,app,mac软件,awesome mac,苹果软件下载,免费软件,mac免费软件下载,精品mac应用 <% }else{ %> mac,osx,app,softwares,applications,mac softwares,awesome mac,free softwares,Freeware <% } %>" />
<link rel="shortcut icon" href="./favicon.ico" />
<link rel="stylesheet" href="//unpkg.com/gitalk/dist/gitalk.css">
<style type="text/css">
* {box-sizing: border-box; }
body,html{padding: 0;margin:0;}
body{font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; font-size: 16px; line-height: 1.5; word-wrap: break-word; }
p,blockquote,ul,ol,dl,table,pre{margin-top: 0; margin-bottom: 16px; }
blockquote{margin-right: 0; margin-left: 0; padding: 0 1em; color: #777; border-left: 0.25em solid #ddd; }
a {color: #4078c0; text-decoration: none; }
.markdown-body{padding: 15px; }
.markdown-body>*:first-child {margin-top: 0 !important; }
h1, h2, h3, h4, h5, h6{margin-top: 24px; margin-bottom: 16px; font-weight: 600; line-height: 1.25; }
h1{padding-bottom: 0.3em; font-size: 2em; border-bottom: 1px solid #eee; }
h2{padding-bottom: 0.3em; font-size: 1.5em; border-bottom: 1px solid #eee; }
ul, ol {padding-left: 1.2em; }
li>p {margin-top: 16px; }
code, tt{padding: 0; padding-top: 0.2em; padding-bottom: 0.2em; margin: 0; font-size: 85%; background-color: rgba(0,0,0,0.04); border-radius: 3px; }
code{white-space: normal; }
code, pre{font-family: Consolas, "Liberation Mono", Courier, monospace; }
del code{text-decoration: inherit; }
code::before, code::after, tt::before, tt::after{letter-spacing: -0.2em; content: "\00a0"; }
del{color: #727272; }
ul{list-style-type: square;}
ul ul{list-style-type:circle;}
ul ul ul{list-style-type:disc; }
.totop{
position: fixed;
bottom: 20px;
right: 20px;
display: inline-block;
background: rgba(0, 0, 0, 0.74);
padding: 10px;
border-radius: 3px;
z-index: 9999;
color: #fff;
font-size: 10px;
}
a.github-corner {position: fixed; top: 0; right: 0; }
.github-corner svg{fill:#e1e1e1;color:#000;position:absolute;top:0;border:0;right:0;z-index:99;width:4.375rem;height:4.375rem}
.github-corner:hover .octo-arm{-webkit-animation:octocat-wave 560ms ease-in-out;animation:octocat-wave 560ms ease-in-out}
@-webkit-keyframes octocat-wave{
0%,100%{-webkit-transform:rotate(0);transform:rotate(0)}
20%,60%{-webkit-transform:rotate(-25deg);transform:rotate(-25deg)}
40%,80%{-webkit-transform:rotate(10deg);transform:rotate(10deg)}
}
@keyframes octocat-wave{
0%,100%{-webkit-transform:rotate(0);transform:rotate(0)}
20%,60%{-webkit-transform:rotate(-25deg);transform:rotate(-25deg)}
40%,80%{-webkit-transform:rotate(10deg);transform:rotate(10deg)}
}
#awesome-mac {
padding: 37px 0px 40px 0;
text-align: center;
color: #686868;
}
.topmenu{
position: fixed;
left: 5px;
}
.topmenu a{
background: #ebebeb;
display: inline-block;
padding: 1px 5px;
font-size: 12px;
border-radius: 2px;
color:#757575;
}
.topmenu a:hover{
background: #2186ff;
color: #fff;
}
#gitalk-container {
padding: 15px;
}
</style>
</head>
<body id="totop">
<a href="https://github.com/jaywcjlove/awesome-mac" target="_blank" class="github-corner">
<svg viewBox="0 0 250 250">
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
<path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>
<path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path>
</svg>
</a>
<div class="topmenu">
<a href="https://github.com/jaywcjlove/awesome-mac/issues">
<% if(lang=='zh'){ %> 推荐软件 <% }else{ %> Recommended <% } %>
</a>
<a href="https://github.com/jaywcjlove/awesome-mac/issues"><% if(lang=='zh'){ %> 链接失效报告 <% }else{ %> Link failure Report <% } %></a>
</div>
<article class="markdown-body">
<%- html %>
</article>
<div id="gitalk-container"></div>
<script src="https://utteranc.es/client.js" repo="jaywcjlove/awesome-mac" issue-term="homepage" crossorigin theme="github-light" async></script>
<a href="#totop" class="totop">Top</a>
</body>
</html>

View File

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

1443
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -4,8 +4,9 @@
"description": " This repo is a collection of awesome Mac applications and tools for developers and designers. ",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node build/build.js"
"start": "npm run create:html && npm run create:ast",
"create:html": "node build/create.mjs",
"create:ast": "node build/ast.mjs"
},
"repository": {
"type": "git",
@ -25,13 +26,21 @@
},
"homepage": "https://jaywcjlove.github.io/awesome-mac",
"devDependencies": {
"@textlint/markdown-to-ast": "^6.0.9",
"colors-cli": "^1.0.20",
"ejs": "^2.6.1",
"fs-extra": "^7.0.0",
"gh-pages": "^2.0.1",
"html-minifier": "^3.5.20",
"loading-cli": "^1.0.8",
"marked": "^2.0.0"
"fs-extra": "10.0.0",
"rehype-attr": "1.1.7",
"rehype-raw": "5.1.0",
"rehype-rewrite": "1.0.0",
"rehype-stringify": "8.0.0",
"rehype-template": "0.3.0",
"rehype-urls": "1.1.1",
"remark": "13.0.0",
"remark-autolink-headings": "6.0.1",
"remark-parse": "9.0.0",
"remark-gfm": "1.0.0",
"remark-rehype": "8.1.0",
"remark-slug": "6.0.0",
"to-vfile": "7.0.0",
"unified": "9.2.1",
"vfile-reporter": "7.0.0"
}
}