-
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
10 changed files
with
1,180 additions
and
689 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 |
---|---|---|
@@ -1,29 +1,23 @@ | ||
{ | ||
"hash": "5fda2f0e", | ||
"browserHash": "dc2fbd3d", | ||
"hash": "855f32fe", | ||
"browserHash": "7703e6a4", | ||
"optimized": { | ||
"vue": { | ||
"src": "../../../node_modules/.pnpm/[email protected]/node_modules/vue/dist/vue.runtime.esm-bundler.js", | ||
"file": "vue.js", | ||
"fileHash": "3910e4dd", | ||
"fileHash": "df6bee7c", | ||
"needsInterop": false | ||
}, | ||
"vitepress > @vue/devtools-api": { | ||
"src": "../../../node_modules/.pnpm/@[email protected]/node_modules/@vue/devtools-api/lib/esm/index.js", | ||
"file": "vitepress___@vue_devtools-api.js", | ||
"fileHash": "68eb41cc", | ||
"fileHash": "a49b330b", | ||
"needsInterop": false | ||
}, | ||
"@theme/index": { | ||
"src": "../../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected]/node_modules/vitepress/dist/client/theme-default/index.js", | ||
"file": "@theme_index.js", | ||
"fileHash": "dca0976b", | ||
"needsInterop": false | ||
}, | ||
"xmind-embed-viewer": { | ||
"src": "../../../node_modules/.pnpm/[email protected]/node_modules/xmind-embed-viewer/dist/esm/index.js", | ||
"file": "xmind-embed-viewer.js", | ||
"fileHash": "76a6495e", | ||
"fileHash": "a0d89c06", | ||
"needsInterop": false | ||
} | ||
}, | ||
|
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
322 changes: 128 additions & 194 deletions
322
.vitepress/timelines.js → articles/juejin-articles.js
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
--- | ||
title: 聊聊 npm & yarn & pnpm 包管理机制 | ||
title: npm & yarn & pnpm 包管理机制 | ||
author: lvzl | ||
--- | ||
<img src="https://mp-d22f2f25-96ec-4381-920f-a0d8df227b60.cdn.bspapp.com/cloudstorage/0112a686-55e0-4e6d-a164-b79c45f17453.jpg" /> | ||
|
||
<img src="https://mp-d22f2f25-96ec-4381-920f-a0d8df227b60.cdn.bspapp.com/cloudstorage/0112a686-55e0-4e6d-a164-b79c45f17453.jpg" /> |
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,29 @@ | ||
import { origin } from './juejin-articles' | ||
|
||
const alltags = [] | ||
|
||
for (let i = 1; i < origin.length; i++) { | ||
const { tags } = origin[i] | ||
tags && alltags.push(...tags.split('、')) | ||
} | ||
|
||
function getAnyColor() { | ||
const str = '456789abcdef' | ||
return ( | ||
'#' + | ||
new Array(6) | ||
.fill('1') | ||
.map(() => str[Math.floor(Math.random() * 12)]) | ||
.join('') | ||
) | ||
} | ||
|
||
const tagColors = {} | ||
|
||
const filterTags = [...new Set(alltags)].filter(tag => !tag.startsWith('掘金')) | ||
|
||
for (const tag of filterTags) { | ||
tagColors[tag] = getAnyColor() | ||
} | ||
|
||
export { origin, tagColors } |
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,65 @@ | ||
const { writeFileSync } = require('fs') | ||
|
||
const path = require('path') | ||
|
||
let fetch | ||
import('node-fetch').then(({ default: f }) => { | ||
fetch = f | ||
reqJuejin(1) | ||
}) | ||
|
||
const articles = [] | ||
|
||
const reqJuejin = page_no => | ||
fetch('https://api.juejin.cn/content_api/v1/article/list_by_user?aid=2608&uuid=7259181137129358863&spider=0', { | ||
headers: { | ||
accept: '*/*', | ||
'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8', | ||
'content-type': 'application/json', | ||
'sec-ch-ua': '"Not.A/Brand";v="8", "Chromium";v="114", "Google Chrome";v="114"', | ||
'sec-ch-ua-mobile': '?0', | ||
'sec-ch-ua-platform': '"macOS"', | ||
'sec-fetch-dest': 'empty', | ||
'sec-fetch-mode': 'cors', | ||
'sec-fetch-site': 'same-site', | ||
'x-secsdk-csrf-token': '00010000000149c988447e760ec6d5e15e95b745171c2593a9775d684f3677613381fc35de11177b836c7b8fff5d', | ||
cookie: | ||
'__tea_cookie_tokens_2608=%257B%2522web_id%2522%253A%25227259181137129358863%2522%252C%2522user_unique_id%2522%253A%25227259181137129358863%2522%252C%2522timestamp%2522%253A1690159839194%257D; passport_csrf_token=25e655362356da605beb01f738726370; passport_csrf_token_default=25e655362356da605beb01f738726370; n_mh=pKG77FJQOrZTAh4MhH3pUvSrlLCo6Ssg99ix1gJThGM; passport_auth_status=26315e7580b2ce148a025296ffd95b23%2C; passport_auth_status_ss=26315e7580b2ce148a025296ffd95b23%2C; sid_guard=f9c1daab88dd442a9a3562841a271d51%7C1690159898%7C31536000%7CTue%2C+23-Jul-2024+00%3A51%3A38+GMT; uid_tt=56e8e1e993a03973408cb87e9e9028e1; uid_tt_ss=56e8e1e993a03973408cb87e9e9028e1; sid_tt=f9c1daab88dd442a9a3562841a271d51; sessionid=f9c1daab88dd442a9a3562841a271d51; sessionid_ss=f9c1daab88dd442a9a3562841a271d51; sid_ucp_v1=1.0.0-KDhiYzcxN2RhYWYyZGZiOGY3MDJmYmZiMGI0MTU3NjUzMTI3NDc1ODYKFwiOqLCJ_PXvARCalvelBhiwFDgCQPEHGgJscSIgZjljMWRhYWI4OGRkNDQyYTlhMzU2Mjg0MWEyNzFkNTE; ssid_ucp_v1=1.0.0-KDhiYzcxN2RhYWYyZGZiOGY3MDJmYmZiMGI0MTU3NjUzMTI3NDc1ODYKFwiOqLCJ_PXvARCalvelBhiwFDgCQPEHGgJscSIgZjljMWRhYWI4OGRkNDQyYTlhMzU2Mjg0MWEyNzFkNTE; store-region=cn-zj; store-region-src=uid; _ga=GA1.2.143415306.1690159915; _tea_utm_cache_2608={%22utm_source%22:%22news%22%2C%22utm_medium%22:%22push%22%2C%22utm_campaign%22:%22jinshi20235%22}; _ga_S695FMNGPJ=GS1.2.1691734415.12.0.1691734415.60.0.0; csrf_session_id=348b6529aba6ec35bc005002b4b6e1da; msToken=_MdCk4YIf2IAhHtONBc5dd2ZvdmPGnEnWIb7WIdFPAA0Gl0k_S29X64_mCE0MVl71UCSNL-fuCV9WZnkfGXwhvZZrGWGqe53adDdtpWNg6oHY-OovTiCf881ZcVP31Xk', | ||
Referer: 'https://juejin.cn/', | ||
'Referrer-Policy': 'strict-origin-when-cross-origin', | ||
}, | ||
body: '{"audit_status":null,"keyword":"","page_size":20,"page_no": ' + page_no + '}', | ||
method: 'POST', | ||
}) | ||
.then(res => res.json()) | ||
.then(jsonData => { | ||
const { count, data } = jsonData | ||
articles.push(...data) | ||
if (count / 20 > page_no) { | ||
reqJuejin(page_no + 1) | ||
} else { | ||
getTimeLines() | ||
} | ||
}) | ||
|
||
/** | ||
* 从掘金的接口获取数据并处理返回 | ||
* @param {*} articles | ||
* @returns | ||
*/ | ||
function getTimeLines() { | ||
const timelines = articles.map(arl => { | ||
const { article_info, tags, article_id } = arl | ||
const { title, ctime, brief_content, cover_image } = article_info | ||
return { | ||
article_id, | ||
title, | ||
content: brief_content, | ||
cover_image, | ||
tags: tags.map(tag => tag.tag_name).join('、'), | ||
time: new Date(Number(ctime.padEnd(ctime.length + 3, '0'))).toLocaleDateString('zh-CN'), | ||
} | ||
}) | ||
|
||
writeFileSync(path.resolve('articles/juejin-articles.js'), `export const origin = ${JSON.stringify(timelines, null, 2)}`) | ||
} |
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
Oops, something went wrong.