pnpm -F @opentiny/tiny-engine-controller -F @opentiny/tiny-engine-dsl-vue build 这个命令的作用是什么

pnpm -F @opentiny/tiny-engine-controller -F @opentiny/tiny-engine-dsl-vue build 命令的作用是使用 pnpm 包管理器对指定的工作区包进行构建。具体来说:

  • pnpm:这是 Node.js 的包管理器,类似于 npm,但更高效,支持工作区(workspace)管理。
  • -F--filter:这是一个选项,用于筛选特定的工作区包。你可以通过包名来指定要操作的包。
  • @opentiny/tiny-engine-controller@opentiny/tiny-engine-dsl-vue:这是你要操作的两个工作区包的名称。
  • build:这是要执行的命令,通常用于构建项目。

命令详解

  1. pnpm

    • pnpm 是一个高性能的包管理器,它通过使用内容可寻址的存储来减少磁盘上的重复文件,从而提高性能。
  2. -F--filter

    • 这个选项允许你指定要操作的工作区包。你可以通过包名来过滤,只对特定的包执行命令。
    • 在这个命令中,-F @opentiny/tiny-engine-controller -F @opentiny/tiny-engine-dsl-vue 表示只对 @opentiny/tiny-engine-controller@opentiny/tiny-engine-dsl-vue 这两个包执行后续的 build 命令。
  3. build

    • 这是一个常见的构建命令,通常定义在 package.json 文件的 scripts 部分。
    • 例如,package.json 中可能有一个 build 脚本,如下所示:
      { "scripts": { "build": "rollup -c" } }
    • 当你运行 pnpm build 时,pnpm 会执行 rollup -c 命令(假设 build 脚本是这样定义的)。

综合解释

pnpm -F @opentiny/tiny-engine-controller -F @opentiny/tiny-engine-dsl-vue build 命令的作用是:

  • 只对 @opentiny/tiny-engine-controller@opentiny/tiny-engine-dsl-vue 这两个工作区包执行 build 命令。
  • 这些包的 build 脚本会在各自的 package.json 文件中定义,通常是用于编译、打包或其他构建任务。

pnpm-workspace.yaml

packages: - 'packages/**' - 'mockServer' # 忽略测试文件夹中的 project - '!packages/**/test/**'

lint-staged.config.js

module.exports = { './packages/**/**.{js,vue,jsx}': 'eslint', './packages/**/**.{vue,js,ts,html,json,less}': 'prettier --write' }

lerna.json

{ "command": { "version": { "message": "chore(release): publish" } }, "useNx": false, "version": "independent", "npmClient": "pnpm", "publish": { "npmClient": "pnpm" }, "ignoreChanges": ["**/*.md", "**/test/**", ".npmrc"], "granularPathspec": false }

jsconfig.json

{ "compilerOptions": { "baseUrl": "./", "jsx": "react", "paths": { "@/*": ["packages/*"], "@opentiny/tiny-engine-canvas": ["packages/canvas/src/index.js"], "@opentiny/tiny-engine-controller": ["packages/controller/src/index"], "@opentiny/tiny-engine-plugin-materials": ["packages/plugins/materials/index"], "@opentiny/tiny-engine-plugin-data": ["packages/plugins/data/index"], "@opentiny/tiny-engine-plugin-script": ["packages/plugins/script/index"], "@opentiny/tiny-engine-plugin-tree": ["packages/plugins/tree/index"], "@opentiny/tiny-engine-plugin-help": ["packages/plugins/help/index"], "@opentiny/tiny-engine-plugin-schema": ["packages/plugins/schema/index"], "@opentiny/tiny-engine-plugin-page": ["packages/plugins/page/index"], "@opentiny/tiny-engine-plugin-i18n": ["packages/plugins/i18n/index"], "@opentiny/tiny-engine-plugin-bridge": ["packages/plugins/bridge/index"], "@opentiny/tiny-engine-i18n-host": ["packages/i18n/src/lib"] } }, "include": ["packages/**/*"], "exclude": ["node_modules", "dist"] }

.npmignore

.build_config .cid .codecheck .husky .vscode # 只忽略根目录的 dist 文件夹 /dist test node_modules .editorconfig .eslintignore .eslintrc.js .prettierignore .prettierrc jsconfig.json package-lock.json # 忽略可能存在的其它编辑器文件夹 .idea /packages/design-core/public/mock/* **/**/tmp **/**/temp

logger.mjs

import colors from 'picocolors' class Logger { constructor(command) { this.command = command } output(type, msg) { const format = () => { const colorMap = { info: 'cyan', warn: 'yellow', error: 'red', success: 'green' } const time = new Date().toLocaleTimeString() const colorMsg = colors[colorMap[type]](type) return `[${this.command}] [${colors.dim(time)}] ${colorMsg} ${msg}` } // eslint-disable-next-line no-console return console.log(format()) } info(msg) { this.output('info', msg) } warn(msg) { this.output('warn', msg) } error(msg) { this.output('error', msg) } success(msg) { this.output('success', msg) } } export default Logger

使用

import Logger from './logger.mjs' const logger = new Logger('splitMaterials') logger.success('materials splitted.') logger.error(`failed to split materials: ${error}.`)

文件名转换

const capitalize = (str) => `${str.charAt(0).toUpperCase()}${str.slice(1)}` const toPascalCase = (str) => str.split('-').map(capitalize).join('')

copyToVscode.js

const path = require('path') const fse = require('fs-extra') const removeDir = (dir) => { if (fse.existsSync(dir)) { fse.removeSync(dir) } } const moveDir = (src, dest) => { if (fse.existsSync(src)) { fse.moveSync(src, dest, { overwrite: true }) } } const copyDir = (src, dest) => { if (fse.existsSync(src)) { fse.copySync(src, dest, { overwrite: true }) } } const run = () => { const vscodeDir = path.resolve('/Tiny/lowcode-vscode/packages/vsix-crm/project/public/editor') moveDir(path.join(__dirname, '../dist/editor/monaco-workers'), path.join(__dirname, '../dist/monaco-workers')) removeDir(path.join(__dirname, '../dist/angular')) removeDir(path.join(__dirname, '../dist/editor')) removeDir(path.join(__dirname, '../dist/img-crm')) removeDir(path.join(__dirname, '../dist/mock')) removeDir(vscodeDir) copyDir(path.join(__dirname, '../dist'), vscodeDir) } run()

从 .env.local 中读取配置

// 先构造出.env*文件的绝对路径 const appDirectory = fs.realpathSync(process.cwd()) const resolveApp = (relativePath) => path.resolve(appDirectory, relativePath) const pathsDotenv = resolveApp('.env') // 加载.env.local dotenv.config({ path: `${pathsDotenv}.local` }) const { SQL_HOST, SQL_PORT, SQL_USER, SQL_PASSWORD, SQL_DATABASE } = process.env

__EOF__

本文作者龙陌
本文链接https://www.cnblogs.com/longmo666/p/18567444.html
关于博主:评论和私信会在第一时间回复。或者直接私信我。
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
声援博主:如果您觉得文章对您有帮助,可以点击文章右下角推荐一下。您的鼓励是博主的最大动力!
posted @   龙陌  阅读(59)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
点击右上角即可分享
微信分享提示