Merge branch 'hyperledger:main' into feature/test-network-k8s

This commit is contained in:
jkneubuh 2021-10-06 09:12:18 -04:00 committed by GitHub
commit 05aa40789a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 81 additions and 19 deletions

View file

@ -6,11 +6,18 @@
"node": ">=12", "node": ">=12",
"npm": ">=5" "npm": ">=5"
}, },
"scripts": {
"lint": "eslint *.js",
"pretest": "npm run lint"
},
"engineStrict": true, "engineStrict": true,
"author": "Hyperledger", "author": "Hyperledger",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"fabric-ca-client": "^2.2.4", "fabric-ca-client": "^2.2.4",
"fabric-network": "^2.2.4" "fabric-network": "^2.2.4"
},
"devDependencies": {
"eslint": "^7.32.0"
} }
} }

View file

@ -8,7 +8,7 @@
"npm": ">=5" "npm": ">=5"
}, },
"scripts": { "scripts": {
"lint": "eslint .", "lint": "eslint *.js */**.js",
"pretest": "npm run lint", "pretest": "npm run lint",
"test": "nyc mocha --recursive", "test": "nyc mocha --recursive",
"start": "fabric-chaincode-node start" "start": "fabric-chaincode-node start"

View file

@ -2,9 +2,9 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
// Deterministic JSON.stringify() // Deterministic JSON.stringify()
import {Context, Contract, Info, Returns, Transaction} from 'fabric-contract-api';
import * as stringify from 'json-stringify-deterministic'; import * as stringify from 'json-stringify-deterministic';
import * as sortKeysRecursive from 'sort-keys-recursive'; import * as sortKeysRecursive from 'sort-keys-recursive';
import {Context, Contract, Info, Returns, Transaction} from 'fabric-contract-api';
import {Asset} from './asset'; import {Asset} from './asset';
@Info({title: 'AssetTransfer', description: 'Smart contract for trading assets'}) @Info({title: 'AssetTransfer', description: 'Smart contract for trading assets'})

View file

@ -9,8 +9,14 @@
"engineStrict": true, "engineStrict": true,
"author": "Hyperledger", "author": "Hyperledger",
"license": "Apache-2.0", "license": "Apache-2.0",
"scripts": {
"lint": "eslint *.js"
},
"dependencies": { "dependencies": {
"fabric-ca-client": "^2.2.2", "fabric-ca-client": "^2.2.2",
"fabric-network": "^2.2.2" "fabric-network": "^2.2.2"
},
"devDependencies": {
"eslint": "^7.32.0"
} }
} }

View file

@ -9,8 +9,14 @@
"engineStrict": true, "engineStrict": true,
"author": "Hyperledger", "author": "Hyperledger",
"license": "Apache-2.0", "license": "Apache-2.0",
"scripts": {
"lint": "eslint *.js"
},
"dependencies": { "dependencies": {
"fabric-ca-client": "^2.2.4", "fabric-ca-client": "^2.2.4",
"fabric-network": "^2.2.4" "fabric-network": "^2.2.4"
},
"devDependencies": {
"eslint": "^7.32.0"
} }
} }

View file

@ -8,12 +8,16 @@
"npm": ">=5.3.0" "npm": ">=5.3.0"
}, },
"scripts": { "scripts": {
"start": "fabric-chaincode-node start" "start": "fabric-chaincode-node start",
"lint": "eslint *.js */**.js"
}, },
"engine-strict": true, "engine-strict": true,
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"fabric-contract-api": "^2.0.0", "fabric-contract-api": "^2.0.0",
"fabric-shim": "^2.0.0" "fabric-shim": "^2.0.0"
},
"devDependencies": {
"eslint": "^7.32.0"
} }
} }

View file

@ -9,8 +9,14 @@
"engineStrict": true, "engineStrict": true,
"author": "Hyperledger", "author": "Hyperledger",
"license": "Apache-2.0", "license": "Apache-2.0",
"scripts": {
"lint": "eslint *.js"
},
"dependencies": { "dependencies": {
"fabric-ca-client": "^2.2.4", "fabric-ca-client": "^2.2.4",
"fabric-network": "^2.2.4" "fabric-network": "^2.2.4"
},
"devDependencies": {
"eslint": "^7.32.0"
} }
} }

View file

@ -9,8 +9,14 @@
"engineStrict": true, "engineStrict": true,
"author": "Hyperledger", "author": "Hyperledger",
"license": "Apache-2.0", "license": "Apache-2.0",
"scripts": {
"lint": "eslint *.js"
},
"dependencies": { "dependencies": {
"fabric-ca-client": "^2.2.4", "fabric-ca-client": "^2.2.4",
"fabric-network": "^2.2.4" "fabric-network": "^2.2.4"
},
"devDependencies": {
"eslint": "^7.32.0"
} }
} }

View file

@ -9,6 +9,10 @@
"engineStrict": true, "engineStrict": true,
"author": "Hyperledger", "author": "Hyperledger",
"license": "Apache-2.0", "license": "Apache-2.0",
"scripts": {
"lint": "eslint *.js"
},
"dependencies": { "dependencies": {
"fabric-ca-client": "^2.2.4", "fabric-ca-client": "^2.2.4",
"fabric-network": "^2.2.4" "fabric-network": "^2.2.4"

View file

@ -9,8 +9,14 @@
"engineStrict": true, "engineStrict": true,
"author": "Hyperledger", "author": "Hyperledger",
"license": "Apache-2.0", "license": "Apache-2.0",
"scripts": {
"lint": "eslint *.js"
},
"dependencies": { "dependencies": {
"fabric-ca-client": "^2.2.4", "fabric-ca-client": "^2.2.4",
"fabric-network": "^2.2.4" "fabric-network": "^2.2.4"
},
"devDependencies": {
"eslint": "^7.32.0"
} }
} }

View file

@ -85,8 +85,6 @@ jobs:
inputs: inputs:
versionSpec: $(NODE_VER) versionSpec: $(NODE_VER)
displayName: Install Node.js displayName: Install Node.js
- script: npm install -g typescript eslint tslint
displayName: Install Javascript Linting Deps
- script: ./ci/scripts/lint.sh - script: ./ci/scripts/lint.sh
displayName: Lint Code displayName: Lint Code

View file

@ -29,13 +29,11 @@ for dir in $dirs; do
print "The following files contain import errors, please run 'goimports -l -w <path>' to fix these issues:" print "The following files contain import errors, please run 'goimports -l -w <path>' to fix these issues:"
echo "${output}" echo "${output}"
fi fi
elif [[ "$dir" =~ "-javascript" ]]; then elif [[ "$dir" =~ "-javascript" || "$dir" =~ "-typescript" ]]; then
print "Running ESLint" print "Installing node modules"
if [[ "$dir" =~ "chaincode" ]]; then npm install
eslint *.js */**.js print "Running Lint"
else npm run lint
eslint *.js
fi
elif [[ "$dir" =~ "-java" ]]; then elif [[ "$dir" =~ "-java" ]]; then
if [[ -f "pom.xml" ]]; then if [[ -f "pom.xml" ]]; then
print "Running Maven Build" print "Running Maven Build"
@ -44,9 +42,6 @@ for dir in $dirs; do
print "Running Gradle Build" print "Running Gradle Build"
./gradlew build ./gradlew build
fi fi
elif [[ "$dir" =~ "-typescript" ]]; then
print "Running TSLint"
tslint --project .
fi fi
popd popd
fi fi

View file

@ -1,6 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
if [ "$(uname)" == "Linux" ] ; then
CCADDR="127.0.0.1"
else
CCADDR="host.docker.internal"
fi
# look for binaries in local dev environment /build/bin directory and then in local samples /bin directory # look for binaries in local dev environment /build/bin directory and then in local samples /bin directory
export PATH="${PWD}"/../../fabric/build/bin:"${PWD}"/../bin:"$PATH" export PATH="${PWD}"/../../fabric/build/bin:"${PWD}"/../bin:"$PATH"
export FABRIC_CFG_PATH="${PWD}"/../config export FABRIC_CFG_PATH="${PWD}"/../config
@ -13,7 +19,7 @@ export CORE_PEER_TLS_ROOTCERT_FILE="${PWD}"/crypto-config/peerOrganizations/org1
export CORE_PEER_ID=peer0.org1.example.com export CORE_PEER_ID=peer0.org1.example.com
export CORE_PEER_ADDRESS=127.0.0.1:7051 export CORE_PEER_ADDRESS=127.0.0.1:7051
export CORE_PEER_LISTENADDRESS=127.0.0.1:7051 export CORE_PEER_LISTENADDRESS=127.0.0.1:7051
export CORE_PEER_CHAINCODEADDRESS=host.docker.internal:7052 export CORE_PEER_CHAINCODEADDRESS="${CCADDR}":7052
export CORE_PEER_CHAINCODELISTENADDRESS=127.0.0.1:7052 export CORE_PEER_CHAINCODELISTENADDRESS=127.0.0.1:7052
# bootstrap peer is the other peer in the same org # bootstrap peer is the other peer in the same org
export CORE_PEER_GOSSIP_BOOTSTRAP=127.0.0.1:7053 export CORE_PEER_GOSSIP_BOOTSTRAP=127.0.0.1:7053

View file

@ -1,6 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
if [ "$(uname)" == "Linux" ] ; then
CCADDR="127.0.0.1"
else
CCADDR="host.docker.internal"
fi
# look for binaries in local dev environment /build/bin directory and then in local samples /bin directory # look for binaries in local dev environment /build/bin directory and then in local samples /bin directory
export PATH="${PWD}"/../../fabric/build/bin:"${PWD}"/../bin:"$PATH" export PATH="${PWD}"/../../fabric/build/bin:"${PWD}"/../bin:"$PATH"
export FABRIC_CFG_PATH="${PWD}"/../config export FABRIC_CFG_PATH="${PWD}"/../config
@ -13,7 +19,7 @@ export CORE_PEER_TLS_ROOTCERT_FILE="${PWD}"/crypto-config/peerOrganizations/org1
export CORE_PEER_ID=peer1.org1.example.com export CORE_PEER_ID=peer1.org1.example.com
export CORE_PEER_ADDRESS=127.0.0.1:7053 export CORE_PEER_ADDRESS=127.0.0.1:7053
export CORE_PEER_LISTENADDRESS=127.0.0.1:7053 export CORE_PEER_LISTENADDRESS=127.0.0.1:7053
export CORE_PEER_CHAINCODEADDRESS=host.docker.internal:7054 export CORE_PEER_CHAINCODEADDRESS="${CCADDR}":7054
export CORE_PEER_CHAINCODELISTENADDRESS=127.0.0.1:7054 export CORE_PEER_CHAINCODELISTENADDRESS=127.0.0.1:7054
# bootstrap peer is the other peer in the same org # bootstrap peer is the other peer in the same org
export CORE_PEER_GOSSIP_BOOTSTRAP=127.0.0.1:7051 export CORE_PEER_GOSSIP_BOOTSTRAP=127.0.0.1:7051

View file

@ -1,6 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
if [ "$(uname)" == "Linux" ] ; then
CCADDR="127.0.0.1"
else
CCADDR="host.docker.internal"
fi
# look for binaries in local dev environment /build/bin directory and then in local samples /bin directory # look for binaries in local dev environment /build/bin directory and then in local samples /bin directory
export PATH="${PWD}"/../../fabric/build/bin:"${PWD}"/../bin:"$PATH" export PATH="${PWD}"/../../fabric/build/bin:"${PWD}"/../bin:"$PATH"
export FABRIC_CFG_PATH="${PWD}"/../config export FABRIC_CFG_PATH="${PWD}"/../config
@ -13,7 +19,7 @@ export CORE_PEER_TLS_ROOTCERT_FILE="${PWD}"/crypto-config/peerOrganizations/org2
export CORE_PEER_ID=peer0.org2.example.com export CORE_PEER_ID=peer0.org2.example.com
export CORE_PEER_ADDRESS=127.0.0.1:7055 export CORE_PEER_ADDRESS=127.0.0.1:7055
export CORE_PEER_LISTENADDRESS=127.0.0.1:7055 export CORE_PEER_LISTENADDRESS=127.0.0.1:7055
export CORE_PEER_CHAINCODEADDRESS=host.docker.internal:7056 export CORE_PEER_CHAINCODEADDRESS="${CCADDR}":7056
export CORE_PEER_CHAINCODELISTENADDRESS=127.0.0.1:7056 export CORE_PEER_CHAINCODELISTENADDRESS=127.0.0.1:7056
# bootstrap peer is the other peer in the same org # bootstrap peer is the other peer in the same org
export CORE_PEER_GOSSIP_BOOTSTRAP=127.0.0.1:7057 export CORE_PEER_GOSSIP_BOOTSTRAP=127.0.0.1:7057

View file

@ -1,6 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
if [ "$(uname)" == "Linux" ] ; then
CCADDR="127.0.0.1"
else
CCADDR="host.docker.internal"
fi
# look for binaries in local dev environment /build/bin directory and then in local samples /bin directory # look for binaries in local dev environment /build/bin directory and then in local samples /bin directory
export PATH="${PWD}"/../../fabric/build/bin:"${PWD}"/../bin:"$PATH" export PATH="${PWD}"/../../fabric/build/bin:"${PWD}"/../bin:"$PATH"
export FABRIC_CFG_PATH="${PWD}"/../config export FABRIC_CFG_PATH="${PWD}"/../config
@ -13,7 +19,7 @@ export CORE_PEER_TLS_ROOTCERT_FILE="${PWD}"/crypto-config/peerOrganizations/org2
export CORE_PEER_ID=peer0.org2.example.com export CORE_PEER_ID=peer0.org2.example.com
export CORE_PEER_ADDRESS=127.0.0.1:7057 export CORE_PEER_ADDRESS=127.0.0.1:7057
export CORE_PEER_LISTENADDRESS=127.0.0.1:7057 export CORE_PEER_LISTENADDRESS=127.0.0.1:7057
export CORE_PEER_CHAINCODEADDRESS=host.docker.internal:7058 export CORE_PEER_CHAINCODEADDRESS="${CCADDR}":7058
export CORE_PEER_CHAINCODELISTENADDRESS=127.0.0.1:7058 export CORE_PEER_CHAINCODELISTENADDRESS=127.0.0.1:7058
# bootstrap peer is the other peer in the same org # bootstrap peer is the other peer in the same org
export CORE_PEER_GOSSIP_BOOTSTRAP=127.0.0.1:7055 export CORE_PEER_GOSSIP_BOOTSTRAP=127.0.0.1:7055