小编not*_*ffy的帖子

我正在尝试编写 bash 脚本来更新 package.json 依赖项版本

这是我的 package.json 文件

{
    "name": "project-1",
    "version": "1.0.0",
    "description": "TestCafe project",
    "main": "index.js",
    "scripts": {
        "ci:build": "npm ci",
        "test": "testcafe",
        "precise-commits": "precise-commits"
    },
    "repository": {
        "type": "git",
        "url": "http://github.com/dev/test/testcafe-test"
    },
    "author": "Tom",
    "license": "ISC",
    "devDependencies": {
        "precise-commits": "^1.0.2",
        "prettier": "^1.16.4",
        "random-words": "^1.1.0",
        "testcafe": "^1.8.0"
    },
    "dependencies": {
        "page-objects": "1.6.169"
    }
}
Run Code Online (Sandbox Code Playgroud)

我需要将页面对象版本从 1.6.169 更新到 1.6.170,当我们更改页面对象版本时,这是我编写的 bash 文件

#!/bin/bash
PROJECT=${1?Error: No test project directory passed}
NEW_VERSION=${2?Error: Pass new version}
echo "Updating page object version for ${PROJECT} project"

cd ~/git/master/test/${PROJECT}
CURRENT_VERSION=$(node -p …
Run Code Online (Sandbox Code Playgroud)

bash shell automation json

8
推荐指数
1
解决办法
6835
查看次数

标签 统计

automation ×1

bash ×1

json ×1

shell ×1