fuchengwei / deploy-cli-service Goto Github PK
View Code? Open in Web Editor NEW前端自动部署脚手架服务
License: MIT License
前端自动部署脚手架服务
License: MIT License
希望能增加根据deploy.config.js里的配置的bakDir回滚到上一个版本的功能,可以配置到package.json的scripts里
非常感谢 @fuchengwei 开发的这个工具
是否可以提几个需求?
1.布署可能会涉及多台服务器,能否支持多台服务器?
2.目前布署需要同时打包,是否可以不打包?
3.布署时需要备份线上版本,是否可以支持“布署前”和“布署后”在服务器上执行一条shell的功能?
请问支持windows2012服务器部署吗?不是ssh连接的
目前一个前端操作倒是没问题,多个前端privateKey 地址不同的话,怎么操作啊
本地出现 (6)解压成功 服务器上的是压缩文件(有时候会出现)
✖ Error: All configured authentication methods failed
之前一直都是没问题的,我把node从14升级到了18.14.0 后,在打包后报了这个错误;还有一个项目一直显示在打包中,只执行build打包都正常,不知该如何处理。有什么好的debug方法吗
目前公司正式环境是将index.html放到服务器,其他静态文件全部放到阿里oss,要是能支持index传服务器,其他文件传oss就好了
我早上用的时候,不知道为什么我的.zip文件复制到测试环境中, 但没进行解压。最后控制台得到的解压成功,更新成功。(这个时候是已经有unzip命令的)
(我发现我windows Server一开始没有unzip命令的时候,ssh.execCommand也不会报错)。
但我想再复现都没复现出来。
所以
1.让他报错报出来(这个不知道ssh.execCommand能不能支持),
2.加一个后置任务,我自己加一段代码支持用来检测 这个页面能不能正常访问
现在会删除配置目录下的资源后,然后上传,但实际开发中,服务器上的目录下可能还有其它资源,删除这个操作很危险,建议做成配置项
你好, 希望webDir这里可以放个数组, 有时候需要放服务器的两个位置, 但是部署的文件内容是一致的, 不想打包两次, 想打包一次分别放到服务器的两个位置
如:
webDir: ["地址一", "地址二"]
谢谢作者!
标题所述
请问公司服务器在内网,这个可以用吗。
希望增加一个配置项来配置 文件打包上传成功之后是否要删除上传到服务器的.zip文件。因为我们部署到测试环境之后 确认了没问题就直接拷贝测试服务器的.zip文件到正式服务器运行即可。
谢谢
备份文件在服务器上找不到
前天我用1.0.9版本OK,这个工具感觉非常不错,这里得先感谢一下作者。但是您这里升级得1.1.0版本,文件处理顺序令我惊呆了,我在云端所有得项目都没有了,发现你这边得远端文件处理顺序由先删除旧文件,再上传新文件改成了先上传新文件,上传成功再删除远端文件,oh my god!
如题 不然打包就回出错
? blue-ydb 项目是否部署到 开发环境? Yes
(1) npm run build
✖ 打包失败
✖ stdout maxBuffer length exceeded
运行deploy命令报错:ERR_UNSUPPORTED_ESM_URL_SCHEME
具体信息如下:
deploy-cli-service deploy --mode dev
node:internal/modules/esm/load:239
throw new ERR_UNSUPPORTED_ESM_URL_SCHEME(parsed, schemes);
^
Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'd:'
at throwIfUnsupportedURLScheme (node:internal/modules/esm/load:239:11)
at defaultLoad (node:internal/modules/esm/load:130:3)
at ModuleLoader.load (node:internal/modules/esm/loader:403:13)
at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:285:56)
at new ModuleJob (node:internal/modules/esm/module_job:67:26)
at #createModuleJob (node:internal/modules/esm/loader:297:17)
at ModuleLoader.getJobFromResolveResult (node:internal/modules/esm/loader:254:34)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:235:17)
at async ModuleLoader.import (node:internal/modules/esm/loader:322:23) {
code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
}
Node.js v20.12.2
配置了 "type": "module"
的情况下,打包会报错
> [email protected] deploy:test E:\projects\rong-saas
> deploy-cli-service deploy --mode test
E:\projects\rong-saas\node_modules\.pnpm\[email protected]\node_modules\deploy-cli-service\lib\commands\deploy.js:291
const config = require(deployConfigPath)
^
Error [ERR_REQUIRE_ESM]: require() of ES Module E:\projects\rong-saas\deploy.config.js from E:\projects\rong-saas\node_modules\.pnpm\[email protected]\node_modules\deploy-cli-service\lib\commands\deploy.js not supported.
Instead change the require of deploy.config.js in E:\projects\rong-saas\node_modules\.pnpm\[email protected]\node_modules\deploy-cli-service\lib\commands\deploy.js to a dynamic import() which is available in all CommonJS mo
dules.
at Object.apply (E:\projects\rong-saas\node_modules\.pnpm\[email protected]\node_modules\deploy-cli-service\lib\commands\deploy.js:291:22)
at Command.<anonymous> (E:\projects\rong-saas\node_modules\.pnpm\[email protected]\node_modules\deploy-cli-service\lib\service.js:40:19)
at Command.listener [as _actionHandler] (E:\projects\rong-saas\node_modules\.pnpm\[email protected]\node_modules\commander\index.js:426:31)
at Command._parseCommand (E:\projects\rong-saas\node_modules\.pnpm\[email protected]\node_modules\commander\index.js:1002:14)
at Command._dispatchSubcommand (E:\projects\rong-saas\node_modules\.pnpm\[email protected]\node_modules\commander\index.js:953:18)
at Command._parseCommand (E:\projects\rong-saas\node_modules\.pnpm\[email protected]\node_modules\commander\index.js:970:12)
at Command.parse (E:\projects\rong-saas\node_modules\.pnpm\[email protected]\node_modules\commander\index.js:801:10)
at Service.run (E:\projects\rong-saas\node_modules\.pnpm\[email protected]\node_modules\deploy-cli-service\lib\service.js:13:13)
at Object.<anonymous> (E:\projects\rong-saas\node_modules\.pnpm\[email protected]\node_modules\deploy-cli-service\bin\deploy-cli-service.js:10:9) {
code: 'ERR_REQUIRE_ESM'
}
百度之后说是由于 Node.js 同时有 Common JS 和 ES6 两套规则导致的
修改源码、把配置改为es module之后可以打包了
node_modules/deploy-cli-service/lib/commands/deploy.js
// const config = require(deployConfigPath) 改为import()
let module = await import(`file://${deployConfigPath}`)
const config = module.default
const cluster = config.cluster
const projectName = config.projectName
const currentTime = new Date().getTime()
const createdEnvConfig = (env) => {
checkEnvCorrect(config, env)
return Object.assign(config[env], {
privateKey: config.privateKey,
passphrase: config.passphrase,
readyTimeout: config.readyTimeout
})
}
export default {
projectName: '', // 项目名称
passphrase: '',
test: {
}
}
请问还有什么其他的解决方案吗?
第三步 ssh 连接 *** 然后:
✖ AssertionError [ERR_ASSERTION]: config.privateKey does not exist at given fs path
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
私钥文件权限给了777 也还是不行 ~/.ssh/id_rsa
如题。
据我所知,ssh工具是不能这样直接连接的。请问用deploy-cli-service该如何处理?
您使用的是zip包 , node-zip-stream
目前问题是, 如果不设置forceLocalTime, 则压缩包里的文件时间会有时区问题
团队项目生产部署,这个服务器登录密码能不能在运行时动态录入进去啊
配置文件中删除 script 字段报错。提示“× 配置错误: test环境 script属性 配置不正确”
deploy.config.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules.
Instead rename deploy.config.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in C:\Users\Administrator\Desktop\work\jc-admin\package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).
如果将package.json的type 改成 commonjs 是可以用,但同时也就失去了 type 为module的tree-shaking优化。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.