-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from lexmin0412/f-20240422-full-block
F 20240422 full block
- Loading branch information
Showing
23 changed files
with
605 additions
and
12 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
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,3 @@ | ||
lib | ||
es | ||
node_modules |
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,5 @@ | ||
# @readue/block-env_requirement | ||
|
||
Readue 环境要求块插件。 | ||
|
||
![version](https://img.shields.io/npm/v/@readue/block-env_requirement) ![downloads-month](https://img.shields.io/npm/dm/@readue/block-env_requirement) |
7 changes: 7 additions & 0 deletions
7
packages/block-env_requirement/__tests__/block-env_requirement.test.js
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,7 @@ | ||
'use strict'; | ||
|
||
const blockEnvRequirement = require('..'); | ||
const assert = require('assert').strict; | ||
|
||
assert.strictEqual(blockEnvRequirement(), 'Hello from blockEnvRequirement'); | ||
console.info('blockEnvRequirement tests passed'); |
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,52 @@ | ||
{ | ||
"name": "@readue/block-env_requirement", | ||
"version": "0.2.4", | ||
"description": "Readue 环境要求块插件。", | ||
"keywords": [ | ||
"readue" | ||
], | ||
"author": "lexmin0412 <[email protected]>", | ||
"homepage": "https://github.com/lexmin0412/readue#readme", | ||
"license": "ISC", | ||
"main": "./lib/index.js", | ||
"directories": { | ||
"lib": "lib", | ||
"test": "__tests__" | ||
}, | ||
"files": [ | ||
"es", | ||
"lib" | ||
], | ||
"publishConfig": { | ||
"access": "public", | ||
"registry": "https://registry.npmjs.org/" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/lexmin0412/readue.git" | ||
}, | ||
"scripts": { | ||
"test": "node ./__tests__/block-env_requirement.test.js", | ||
"build:commonjs": "rimraf lib && tsc --target es5 --outDir lib --module commonjs --declaration", | ||
"build:es": "rimraf es && tsc --target es6 --outDir es --module es6", | ||
"build": "npm run build:commonjs && npm run build:es", | ||
"ts": "ts-node src/", | ||
"prepublishOnly": "npm run build" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/lexmin0412/readue/issues" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20.12.7", | ||
"rimraf": "^5.0.5", | ||
"ts-node": "^10.9.2", | ||
"typescript": "^5.4.5" | ||
}, | ||
"types": "./lib/index.d.ts", | ||
"jsnext:main": "./es/index.js", | ||
"module": "./es/index.js", | ||
"dependencies": { | ||
"@readue/config": "workspace:*", | ||
"pkg-types": "^1.1.0" | ||
} | ||
} |
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,20 @@ | ||
import type { PackageJson } from 'pkg-types' | ||
import { ReadueConfig } from '@readue/config' | ||
|
||
export default function generate(_readueConfig: ReadueConfig, pkgJson: PackageJson) { | ||
|
||
const content: string[] = [ | ||
'## 环境要求', | ||
] | ||
|
||
if (pkgJson.engines) { | ||
for (const key in pkgJson.engines) { | ||
content.push('', `- ${key} ${pkgJson.engines[key]}`) | ||
} | ||
} | ||
|
||
return { | ||
name: 'EnvRequirement', | ||
content | ||
} | ||
} |
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,14 @@ | ||
{ | ||
"compilerOptions": { | ||
"moduleResolution": "node", | ||
"lib": [ | ||
"es6" | ||
], | ||
"alwaysStrict": true, | ||
"strictNullChecks": true, | ||
"noImplicitAny": true | ||
}, | ||
"includes": [ | ||
"src/*" | ||
] | ||
} |
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,3 @@ | ||
lib | ||
es | ||
node_modules |
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,5 @@ | ||
# @readue/block-techstack | ||
|
||
Readue 技术栈块插件。 | ||
|
||
![version](https://img.shields.io/npm/v/@readue/block-techstack) ![downloads-month](https://img.shields.io/npm/dm/@readue/block-techstack) |
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,7 @@ | ||
'use strict'; | ||
|
||
const blockTechstack = require('..'); | ||
const assert = require('assert').strict; | ||
|
||
assert.strictEqual(blockTechstack(), 'Hello from blockTechstack'); | ||
console.info('blockTechstack tests passed'); |
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,48 @@ | ||
{ | ||
"name": "@readue/block-techstack", | ||
"version": "0.2.4", | ||
"description": "Readue 技术栈块插件。", | ||
"keywords": [ | ||
"readue" | ||
], | ||
"author": "lexmin0412 <[email protected]>", | ||
"homepage": "https://github.com/lexmin0412/readue#readme", | ||
"license": "ISC", | ||
"main": "./lib/index.js", | ||
"directories": { | ||
"lib": "lib", | ||
"test": "__tests__" | ||
}, | ||
"files": [ | ||
"es", | ||
"lib" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/lexmin0412/readue.git" | ||
}, | ||
"scripts": { | ||
"test": "node ./__tests__/block-techstack.test.js", | ||
"build:commonjs": "rimraf lib && tsc --target es5 --outDir lib --module commonjs --declaration", | ||
"build:es": "rimraf es && tsc --target es6 --outDir es --module es6", | ||
"build": "npm run build:commonjs && npm run build:es", | ||
"ts": "ts-node src/", | ||
"prepublishOnly": "npm run build" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/lexmin0412/readue/issues" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20.12.7", | ||
"rimraf": "^5.0.5", | ||
"ts-node": "^10.9.2", | ||
"typescript": "^5.4.5" | ||
}, | ||
"types": "./lib/index.d.ts", | ||
"jsnext:main": "./es/index.js", | ||
"module": "./es/index.js", | ||
"dependencies": { | ||
"@readue/config": "workspace:^", | ||
"pkg-types": "^1.1.0" | ||
} | ||
} |
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,73 @@ | ||
import { ReadueBlockFunction } from "@readue/config"; | ||
|
||
const generate: ReadueBlockFunction = function (readueConfig, pkgJson) { | ||
const BASE_LIBS = [ | ||
{ | ||
name: "用户界面框架", | ||
list: ["react", "vue", "svelte", "angular"], | ||
}, | ||
{ | ||
name: "用户界面UI库", | ||
list: ["antd", "element-ui", "bootstrap", "tailwindcss"], | ||
}, | ||
{ | ||
name: "路由", | ||
list: ["react-router", "vue-router"], | ||
}, | ||
{ | ||
name: "状态管理", | ||
list: [ | ||
"redux", | ||
"react-redux", | ||
"zustand", | ||
"recoil", | ||
"mobx", | ||
"vuex", | ||
"pinia", | ||
], | ||
}, | ||
{ | ||
name: "构建工具", | ||
list: ["webpack", "rollup", "vite", "esbuild", "swc", "rsbuild"], | ||
}, | ||
{ | ||
name: "请求库", | ||
list: ["axios", "ahooks"], | ||
}, | ||
{ | ||
name: "测试", | ||
list: ["jest", "cypress", "playwright", "puppeteer", "vitest"], | ||
}, | ||
{ | ||
name: "类型系统", | ||
list: ["typescript", "flow"], | ||
}, | ||
]; | ||
|
||
const content: string[] = [ | ||
'## 技术栈' | ||
]; | ||
|
||
// 读取 pkgJson 的依赖 | ||
const dependencies = pkgJson?.dependencies || {}; | ||
const devDependencies = pkgJson?.devDependencies || {}; | ||
const allDependencies = { ...dependencies, ...devDependencies }; | ||
|
||
BASE_LIBS.forEach((libType) => { | ||
const matchedDeps: string[] = [] | ||
Object.keys(allDependencies).forEach((dep) => { | ||
if (libType.list.includes(dep)) { | ||
matchedDeps.push(`${dep}`); | ||
} | ||
}); | ||
const itemContent = matchedDeps?.length ? matchedDeps.join("、") : '未知' | ||
content.push('', `- ${libType.name}: ${itemContent}`); | ||
}); | ||
|
||
return { | ||
name: "Techstack", | ||
content, | ||
}; | ||
}; | ||
|
||
export default generate; |
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,14 @@ | ||
{ | ||
"compilerOptions": { | ||
"moduleResolution": "node", | ||
"lib": [ | ||
"es6" | ||
], | ||
"alwaysStrict": true, | ||
"strictNullChecks": true, | ||
"noImplicitAny": true | ||
}, | ||
"includes": [ | ||
"src/*" | ||
] | ||
} |
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,3 @@ | ||
lib | ||
es | ||
node_modules |
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,5 @@ | ||
# @readue/block-tree | ||
|
||
Readue 文件树块插件。 | ||
|
||
![version](https://img.shields.io/npm/v/@readue/block-tree) ![downloads-month](https://img.shields.io/npm/dm/@readue/block-tree) |
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,7 @@ | ||
'use strict'; | ||
|
||
const blockTree = require('..'); | ||
const assert = require('assert').strict; | ||
|
||
assert.strictEqual(blockTree(), 'Hello from blockTree'); | ||
console.info('blockTree tests passed'); |
Oops, something went wrong.