@decaf-ts/for-fabric 0.1.32 → 0.1.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/for-fabric.cjs +1 -1
- package/dist/for-fabric.cjs.map +1 -1
- package/dist/for-fabric.js +1 -1
- package/dist/for-fabric.js.map +1 -1
- package/lib/bin/cli.cjs +8 -0
- package/lib/bin/cli.js.map +1 -0
- package/lib/cli-module.cjs +114 -44
- package/lib/cli-module.js.map +1 -1
- package/lib/cli-utils.cjs +226 -0
- package/lib/cli-utils.d.ts +12 -0
- package/lib/cli-utils.js.map +1 -0
- package/lib/client/FabricClientRepository.cjs +1 -4
- package/lib/client/FabricClientRepository.js.map +1 -1
- package/lib/client/fabric-fs.d.ts +2 -2
- package/lib/contract/AddressContract.cjs +2 -1
- package/lib/contract/AddressContract.js.map +1 -1
- package/lib/contract/Product.cjs +5 -2
- package/lib/contract/Product.d.ts +3 -3
- package/lib/contract/Product.js.map +1 -1
- package/lib/contracts/ContractAdapter.cjs +9 -85
- package/lib/contracts/ContractAdapter.js.map +1 -1
- package/lib/contracts/FabricContractRepository.cjs +4 -0
- package/lib/contracts/FabricContractRepository.js.map +1 -1
- package/lib/contracts/crud/crud-contract.cjs +2 -0
- package/lib/contracts/crud/crud-contract.js.map +1 -1
- package/lib/esm/bin/cli.js +3 -0
- package/lib/esm/bin/cli.js.map +1 -0
- package/lib/esm/cli-module.js +114 -44
- package/lib/esm/cli-module.js.map +1 -1
- package/lib/esm/cli-utils.d.ts +12 -0
- package/lib/esm/cli-utils.js +179 -0
- package/lib/esm/cli-utils.js.map +1 -0
- package/lib/esm/client/FabricClientRepository.js +1 -4
- package/lib/esm/client/FabricClientRepository.js.map +1 -1
- package/lib/esm/client/fabric-fs.d.ts +2 -2
- package/lib/esm/contract/AddressContract.js +2 -1
- package/lib/esm/contract/AddressContract.js.map +1 -1
- package/lib/esm/contract/Product.d.ts +3 -3
- package/lib/esm/contract/Product.js +5 -2
- package/lib/esm/contract/Product.js.map +1 -1
- package/lib/esm/contracts/ContractAdapter.js +11 -87
- package/lib/esm/contracts/ContractAdapter.js.map +1 -1
- package/lib/esm/contracts/FabricContractRepository.js +4 -0
- package/lib/esm/contracts/FabricContractRepository.js.map +1 -1
- package/lib/esm/contracts/crud/crud-contract.js +2 -0
- package/lib/esm/contracts/crud/crud-contract.js.map +1 -1
- package/lib/esm/shared/model/FabricBaseModel.js +4 -1
- package/lib/esm/shared/model/FabricBaseModel.js.map +1 -1
- package/lib/esm/shared/model/FabricIdentifiedBaseModel.js +3 -1
- package/lib/esm/shared/model/FabricIdentifiedBaseModel.js.map +1 -1
- package/lib/esm/shared/model/Identity.d.ts +4 -4
- package/lib/esm/shared/model/Identity.js +5 -16
- package/lib/esm/shared/model/Identity.js.map +1 -1
- package/lib/esm/shared/model/IdentityCredentials.d.ts +4 -4
- package/lib/esm/shared/model/IdentityCredentials.js +10 -21
- package/lib/esm/shared/model/IdentityCredentials.js.map +1 -1
- package/lib/esm/shared/model/index.d.ts +2 -0
- package/lib/esm/shared/model/index.js +2 -0
- package/lib/esm/shared/model/index.js.map +1 -1
- package/lib/esm/shared/utils.d.ts +1 -1
- package/lib/esm/version.d.ts +1 -1
- package/lib/esm/version.js +1 -1
- package/lib/shared/model/FabricBaseModel.cjs +3 -0
- package/lib/shared/model/FabricBaseModel.js.map +1 -1
- package/lib/shared/model/FabricIdentifiedBaseModel.cjs +2 -0
- package/lib/shared/model/FabricIdentifiedBaseModel.js.map +1 -1
- package/lib/shared/model/Identity.cjs +4 -15
- package/lib/shared/model/Identity.d.ts +4 -4
- package/lib/shared/model/Identity.js.map +1 -1
- package/lib/shared/model/IdentityCredentials.cjs +9 -20
- package/lib/shared/model/IdentityCredentials.d.ts +4 -4
- package/lib/shared/model/IdentityCredentials.js.map +1 -1
- package/lib/shared/model/index.cjs +2 -0
- package/lib/shared/model/index.d.ts +2 -0
- package/lib/shared/model/index.js.map +1 -1
- package/lib/shared/utils.d.ts +1 -1
- package/lib/version.cjs +1 -1
- package/lib/version.d.ts +1 -1
- package/package.json +10 -4
- package/lib/bin/build-contracts2.cjs +0 -73
- package/lib/bin/build-contracts2.js.map +0 -1
- package/lib/esm/bin/build-contracts2.js +0 -68
- package/lib/esm/bin/build-contracts2.js.map +0 -1
- /package/lib/bin/{build-contracts2.d.ts → cli.d.ts} +0 -0
- /package/lib/esm/bin/{build-contracts2.d.ts → cli.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/shared/model/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA2B;AAC3B,4DAAsC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/shared/model/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAkC;AAClC,kEAA4C;AAC5C,iDAA2B;AAC3B,4DAAsC"}
|
package/lib/shared/utils.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export declare class CoreUtils {
|
|
|
43
43
|
* @param {string|Buffer} contentOrPath - Path to a file on disk or an already-loaded Buffer
|
|
44
44
|
* @return {Promise<string|Uint8Array|Buffer>} The file content as a Buffer/string depending on reader
|
|
45
45
|
*/
|
|
46
|
-
static readFile(contentOrPath: string | Buffer): Promise<
|
|
46
|
+
static readFile(contentOrPath: string | Buffer): Promise<Buffer<ArrayBufferLike>>;
|
|
47
47
|
/**
|
|
48
48
|
* @description Create a Fabric CA User object with enrollment
|
|
49
49
|
* @summary Constructs a fabric-common User, sets a crypto suite, imports the provided private key, and sets enrollment with certificate and MSP ID.
|
package/lib/version.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PACKAGE_NAME = exports.VERSION = void 0;
|
|
4
4
|
const decoration_1 = require("@decaf-ts/decoration");
|
|
5
|
-
exports.VERSION = "0.1.
|
|
5
|
+
exports.VERSION = "0.1.33";
|
|
6
6
|
exports.PACKAGE_NAME = "@decaf-ts/for-fabric";
|
|
7
7
|
decoration_1.Metadata.registerLibrary(exports.PACKAGE_NAME, exports.VERSION);
|
|
8
8
|
//# sourceMappingURL=version.js.map
|
package/lib/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.1.
|
|
1
|
+
export declare const VERSION = "0.1.33";
|
|
2
2
|
export declare const PACKAGE_NAME = "@decaf-ts/for-fabric";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decaf-ts/for-fabric",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.34",
|
|
4
4
|
"description": "Abstracts fabric logic",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -25,6 +25,9 @@
|
|
|
25
25
|
"types": "./lib/shared/index.d.ts"
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
|
+
"bin": {
|
|
29
|
+
"for-fabric": "./lib/bin/cli.cjs"
|
|
30
|
+
},
|
|
28
31
|
"types": "lib/index.d.ts",
|
|
29
32
|
"typesVersions": {
|
|
30
33
|
"*": {
|
|
@@ -51,7 +54,6 @@
|
|
|
51
54
|
"flash-forward": "npx npm-check-updates -u && npm run do-install",
|
|
52
55
|
"reset": "rm -rf * && git checkout . && git pull && npm run do-install",
|
|
53
56
|
"build": "npx build-scripts --dev && sed -i -e '1i#!/usr/bin/env node\\' lib/bin/*.cjs",
|
|
54
|
-
"build:contracts": "node ./lib/bin/build-contracts.cjs compile-contract --dev",
|
|
55
57
|
"build:prod": "npx build-scripts --prod",
|
|
56
58
|
"test": "jest --runInBand --coverage --detectOpenHandles",
|
|
57
59
|
"test:unit": "jest --testPathPattern=\"/tests/unit\" --passWithNoTests --detectOpenHandles",
|
|
@@ -60,7 +62,6 @@
|
|
|
60
62
|
"test:circular": "dpdm -T --no-warning --no-tree ./src/index.ts",
|
|
61
63
|
"coverage": "rimraf ./workdocs/reports/data/*.json && npm run test:unit -- --coverage --config=./workdocs/reports/jest.coverage.config.ts",
|
|
62
64
|
"lint": "eslint .",
|
|
63
|
-
"build:contract": "node ./lib/bin/build-contract.cjs compile-global-contract --dev --debug",
|
|
64
65
|
"lint-fix": "eslint --fix .",
|
|
65
66
|
"prepare-pr": "npm run lint-fix && npm run build:prod && npm run coverage && npm run docs",
|
|
66
67
|
"prepare-release": "npm run build:prod && npm run coverage && npm run docs",
|
|
@@ -69,11 +70,15 @@
|
|
|
69
70
|
"drawings": "for FILE in workdocs/drawings/*.drawio; do echo \"converting $FILE to image...\" && docker run --rm -v $(pwd):/data rlespinasse/drawio-export --format png $FILE; done && cp -rf workdocs/drawings/export/* workdocs/resources/",
|
|
70
71
|
"uml": "cd workdocs/uml && for FILE in ./*.puml; do docker run --rm -v $(pwd):/work -w /work miy4/plantuml -DPLANTUML_LIMIT_SIZE=8192 -tpng $FILE; done && cd ../.. && cp -fr workdocs/uml/*.png workdocs/resources/",
|
|
71
72
|
"docs": "npx rimraf ./docs && mkdir docs && npx build-scripts --docs",
|
|
72
|
-
"extract:indexes": "node ./lib/bin/
|
|
73
|
+
"extract:indexes": "LEVEL=verbose node ./lib/bin/cli.cjs extract-indexes --folder ./lib/contract --outDir ./docker/infrastructure/chaincode/GlobalContract",
|
|
73
74
|
"infrastructure:up": "docker compose -f ./docker/infrastructure/docker-compose.yaml up -d",
|
|
74
75
|
"infrastructure:down": "docker compose -f ./docker/infrastructure/docker-compose.yaml down --rmi local -v && rm -rf ./docker/docker-data && rm -f ./tests/integration/chaincodeTrackers/*.count",
|
|
75
76
|
"infrastructure-hsm:up": "docker compose -f ./docker/infrastructure/docker-compose-hsm.yaml up -d",
|
|
76
77
|
"infrastructure-hsm:down": "docker compose -f ./docker/infrastructure/docker-compose-hsm.yaml down --rmi local -v",
|
|
78
|
+
"build:contract2": "npx decaf fabric compile-contract --debug --name ${CONTRACT_NAME:-GlobalContract} --input ./src/contract --output ./docker/infrastructure/chaincode && LEVEL=verbose node ./lib/bin/cli.cjs extract-indexes --folder ./lib/contract --outDir ./docker/infrastructure/chaincode/${CONTRACT_NAME:-GlobalContract}",
|
|
79
|
+
"update:contract": "npm run build:contract && npm run deploy:contract",
|
|
80
|
+
"build:contract": "node ./lib/bin/cli.cjs compile-contract --dev --debug --name ${CONTRACT_NAME:-GlobalContract} --input ./src/contract --output ./docker/infrastructure/chaincode && LEVEL=verbose node ./lib/bin/cli.cjs extract-indexes --folder ./lib/contract --outDir ./docker/infrastructure/chaincode/${CONTRACT_NAME:-GlobalContract}",
|
|
81
|
+
"deploy:contract": "node ./lib/bin/cli.cjs deploy-contract --name ${CONTRACT_NAME:-GlobalContract} --input ${CONTRACT_NAME:-GlobalContract}",
|
|
77
82
|
"publish-docs": "docker run -it --rm --user $(id -u):$(id -g) -v \"$(pwd)/workdocs/confluence:/content\" -e ATLASSIAN_API_TOKEN=$(cat .confluence-token) ghcr.io/markdown-confluence/publish:latest",
|
|
78
83
|
"copy-storage": "sudo cp -R docker/infrastructure/storage docker/docker-data/ && sudo chmod -R 755 docker/docker-data",
|
|
79
84
|
"repo:init": "codex exec \"$(cat ./.codex/prompts/repo-setup.md)\nbase_path is `./`, initialize the repository\" -s workspace-write",
|
|
@@ -115,6 +120,7 @@
|
|
|
115
120
|
},
|
|
116
121
|
"homepage": "https://github.com/decaf-ts/for-fabric#readme",
|
|
117
122
|
"devDependencies": {
|
|
123
|
+
"@decaf-ts/cli": "latest",
|
|
118
124
|
"@decaf-ts/fabric-weaver": "latest",
|
|
119
125
|
"@decaf-ts/utils": "latest"
|
|
120
126
|
},
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const path_1 = __importDefault(require("path"));
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const rollup_1 = require("rollup");
|
|
9
|
-
const plugin_replace_1 = __importDefault(require("@rollup/plugin-replace"));
|
|
10
|
-
const plugin_typescript_1 = __importDefault(require("@rollup/plugin-typescript"));
|
|
11
|
-
const commander_1 = require("commander");
|
|
12
|
-
const child_process_1 = require("child_process");
|
|
13
|
-
const program = new commander_1.Command();
|
|
14
|
-
program
|
|
15
|
-
.command("compile-contract")
|
|
16
|
-
.description("Creates a global contract")
|
|
17
|
-
.option("--dev", "compiles contracts without minification", false)
|
|
18
|
-
.option("--debug", "makes attaching debugger possible", false)
|
|
19
|
-
.option("--name <String>", "contract name", "contract")
|
|
20
|
-
.option("--output <String>", "output", undefined)
|
|
21
|
-
.action(async (options) => {
|
|
22
|
-
const dev = options.dev;
|
|
23
|
-
(0, child_process_1.execSync)("rm -rf ./contracts");
|
|
24
|
-
const pkg = JSON.parse(fs_1.default.readFileSync(path_1.default.join(__dirname, "../../package.json"), "utf-8"));
|
|
25
|
-
const version = pkg.version;
|
|
26
|
-
const bundle = await (0, rollup_1.rollup)({
|
|
27
|
-
input: "./src/contracts/index.ts",
|
|
28
|
-
plugins: [
|
|
29
|
-
(0, plugin_replace_1.default)({
|
|
30
|
-
preventAssignment: true,
|
|
31
|
-
delimiters: ["", ""],
|
|
32
|
-
values: { "##VERSION##": version, "##PACKAGE##": pkg.name },
|
|
33
|
-
}),
|
|
34
|
-
(0, plugin_typescript_1.default)({
|
|
35
|
-
tsconfig: "./tsconfig.json",
|
|
36
|
-
compilerOptions: {
|
|
37
|
-
outDir: "contracts",
|
|
38
|
-
},
|
|
39
|
-
module: "esnext",
|
|
40
|
-
declaration: false,
|
|
41
|
-
}),
|
|
42
|
-
],
|
|
43
|
-
});
|
|
44
|
-
await bundle.write({
|
|
45
|
-
file: "./contracts/GlobalContract.js",
|
|
46
|
-
format: "umd",
|
|
47
|
-
name: "GlobalContract.js",
|
|
48
|
-
});
|
|
49
|
-
const scripts = {
|
|
50
|
-
start: options.debug
|
|
51
|
-
? "node --inspect=0.0.0.0:9229 /usr/local/src/node_modules/.bin/fabric-chaincode-node start"
|
|
52
|
-
: "fabric-chaincode-node start",
|
|
53
|
-
"start:dev": 'fabric-chaincode-node start --peer.address "127.0.0.1:8541" --chaincode-id-name "chaincode1:0.0.1" --tls.enabled false',
|
|
54
|
-
"start:watch": 'nodemon --exec "npm run start:dev"',
|
|
55
|
-
build: 'echo "No need to build the chaincode"',
|
|
56
|
-
lint: "eslint . --fix --ext .js",
|
|
57
|
-
};
|
|
58
|
-
const contractPackage = pkg;
|
|
59
|
-
contractPackage.name = "global-contract";
|
|
60
|
-
contractPackage.description = "Global contract implementation";
|
|
61
|
-
contractPackage.scripts = scripts;
|
|
62
|
-
delete contractPackage.type;
|
|
63
|
-
delete contractPackage.types;
|
|
64
|
-
delete contractPackage.exports;
|
|
65
|
-
contractPackage.main = "GlobalContract.js";
|
|
66
|
-
fs_1.default.writeFileSync(path_1.default.join(__dirname, "../../contracts/package.json"), JSON.stringify(contractPackage));
|
|
67
|
-
(0, child_process_1.execSync)("cd ./contracts && npm install");
|
|
68
|
-
(0, child_process_1.execSync)("cd ./contracts && npm shrinkwrap");
|
|
69
|
-
(0, child_process_1.execSync)("cd ./contracts && rm -rf node_modules");
|
|
70
|
-
(0, child_process_1.execSync)("rm -rf ./contracts/lib && rm -rf ./contracts/dist");
|
|
71
|
-
});
|
|
72
|
-
program.parse(process.argv);
|
|
73
|
-
//# sourceMappingURL=build-contracts2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-contracts2.js","sourceRoot":"","sources":["../../src/bin/build-contracts2.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AACxB,4CAAoB;AACpB,mCAAgC;AAChC,4EAA6C;AAC7C,kFAAmD;AACnD,yCAAoC;AACpC,iDAAyC;AACzC,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC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AI,EAAE,mBAAmB;KAC1B,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG;QACd,KAAK,EAAE,OAAO,CAAC,KAAK;YAClB,CAAC,CAAC,0FAA0F;YAC5F,CAAC,CAAC,6BAA6B;QACjC,WAAW,EACT,wHAAwH;QAC1H,aAAa,EAAE,oCAAoC;QACnD,KAAK,EAAE,uCAAuC;QAC9C,IAAI,EAAE,0BAA0B;KACjC,CAAC;IAEF,MAAM,eAAe,GAAG,GAAG,CAAC;IAE5B,eAAe,CAAC,IAAI,GAAG,iBAAiB,CAAC;IACzC,eAAe,CAAC,WAAW,GAAG,gCAAgC,CAAC;IAC/D,eAAe,CAAC,OAAO,GAAG,OAAO,CAAC;IAElC,OAAO,eAAe,CAAC,IAAI,CAAC;IAC5B,OAAO,eAAe,CAAC,KAAK,CAAC;IAC7B,OAAO,eAAe,CAAC,OAAO,CAAC;IAC/B,eAAe,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAE3C,YAAE,CAAC,aAAa,CACd,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,8BAA8B,CAAC,EACpD,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,CAChC,CAAC;IAEF,IAAA,wBAAQ,EAAC,+BAA+B,CAAC,CAAC;IAC1C,IAAA,wBAAQ,EAAC,kCAAkC,CAAC,CAAC;IAC7C,IAAA,wBAAQ,EAAC,uCAAuC,CAAC,CAAC;IAElD,IAAA,wBAAQ,EAAC,mDAAmD,CAAC,CAAC;AAChE,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import fs from "fs";
|
|
3
|
-
import { rollup } from "rollup";
|
|
4
|
-
import replace from "@rollup/plugin-replace";
|
|
5
|
-
import typescript from "@rollup/plugin-typescript";
|
|
6
|
-
import { Command } from "commander";
|
|
7
|
-
import { execSync } from "child_process";
|
|
8
|
-
const program = new Command();
|
|
9
|
-
program
|
|
10
|
-
.command("compile-contract")
|
|
11
|
-
.description("Creates a global contract")
|
|
12
|
-
.option("--dev", "compiles contracts without minification", false)
|
|
13
|
-
.option("--debug", "makes attaching debugger possible", false)
|
|
14
|
-
.option("--name <String>", "contract name", "contract")
|
|
15
|
-
.option("--output <String>", "output", undefined)
|
|
16
|
-
.action(async (options) => {
|
|
17
|
-
const dev = options.dev;
|
|
18
|
-
execSync("rm -rf ./contracts");
|
|
19
|
-
const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, "../../package.json"), "utf-8"));
|
|
20
|
-
const version = pkg.version;
|
|
21
|
-
const bundle = await rollup({
|
|
22
|
-
input: "./src/contracts/index.ts",
|
|
23
|
-
plugins: [
|
|
24
|
-
replace({
|
|
25
|
-
preventAssignment: true,
|
|
26
|
-
delimiters: ["", ""],
|
|
27
|
-
values: { "##VERSION##": version, "##PACKAGE##": pkg.name },
|
|
28
|
-
}),
|
|
29
|
-
typescript({
|
|
30
|
-
tsconfig: "./tsconfig.json",
|
|
31
|
-
compilerOptions: {
|
|
32
|
-
outDir: "contracts",
|
|
33
|
-
},
|
|
34
|
-
module: "esnext",
|
|
35
|
-
declaration: false,
|
|
36
|
-
}),
|
|
37
|
-
],
|
|
38
|
-
});
|
|
39
|
-
await bundle.write({
|
|
40
|
-
file: "./contracts/GlobalContract.js",
|
|
41
|
-
format: "umd",
|
|
42
|
-
name: "GlobalContract.js",
|
|
43
|
-
});
|
|
44
|
-
const scripts = {
|
|
45
|
-
start: options.debug
|
|
46
|
-
? "node --inspect=0.0.0.0:9229 /usr/local/src/node_modules/.bin/fabric-chaincode-node start"
|
|
47
|
-
: "fabric-chaincode-node start",
|
|
48
|
-
"start:dev": 'fabric-chaincode-node start --peer.address "127.0.0.1:8541" --chaincode-id-name "chaincode1:0.0.1" --tls.enabled false',
|
|
49
|
-
"start:watch": 'nodemon --exec "npm run start:dev"',
|
|
50
|
-
build: 'echo "No need to build the chaincode"',
|
|
51
|
-
lint: "eslint . --fix --ext .js",
|
|
52
|
-
};
|
|
53
|
-
const contractPackage = pkg;
|
|
54
|
-
contractPackage.name = "global-contract";
|
|
55
|
-
contractPackage.description = "Global contract implementation";
|
|
56
|
-
contractPackage.scripts = scripts;
|
|
57
|
-
delete contractPackage.type;
|
|
58
|
-
delete contractPackage.types;
|
|
59
|
-
delete contractPackage.exports;
|
|
60
|
-
contractPackage.main = "GlobalContract.js";
|
|
61
|
-
fs.writeFileSync(path.join(__dirname, "../../contracts/package.json"), JSON.stringify(contractPackage));
|
|
62
|
-
execSync("cd ./contracts && npm install");
|
|
63
|
-
execSync("cd ./contracts && npm shrinkwrap");
|
|
64
|
-
execSync("cd ./contracts && rm -rf node_modules");
|
|
65
|
-
execSync("rm -rf ./contracts/lib && rm -rf ./contracts/dist");
|
|
66
|
-
});
|
|
67
|
-
program.parse(process.argv);
|
|
68
|
-
//# sourceMappingURL=build-contracts2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-contracts2.js","sourceRoot":"","sources":["../../../src/bin/build-contracts2.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,OAAO,MAAM,wBAAwB,CAAC;AAC7C,OAAO,UAAU,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,OAAO,CAAC,kBAAkB,CAAC;KAC3B,WAAW,CAAC,2BAA2B,CAAC;KACxC,MAAM,CAAC,OAAO,EAAE,yCAAyC,EAAE,KAAK,CAAC;KACjE,MAAM,CAAC,SAAS,EAAE,mCAAmC,EAAE,KAAK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