Request: Contribution guide for OpenZeppelin SDK - environment setup

I’m looking for some guide on how to set up local environment to start contributing to openzeppelin-sdk, e.g. how to start daemon that convert typescript to js, how to link folder with openzeppelin-sdk as a global npm package, how to run tests and etc

Current guide https://github.com/OpenZeppelin/openzeppelin-sdk/blob/master/CONTRIBUTING.md describes only git flow

3 Likes

Hi @melnikaite

Welcome to the Community Forum :wave:. Great to have you here.
Thanks for the Pull Requests that you have been making. :pray:

I agree that there is a need for more detail on how to contribute to the OpenZeppelin SDK.

Currently the (minimal) instructions are:

Clone the repository git clone https://github.com/OpenZeppelin/openzeppelin-sdk.git
Run npm install on the root project directory
Run npx lerna bootstrap.

Change to the packages/cli directory
Run npm test.

1 Like
Error: Cannot find module '/Users/melnikov/projects/openzeppelin-sdk/packages/cli/build/contracts/ImplV1.json'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:668:15)
    at Function.Module._load (internal/modules/cjs/loader.js:591:27)
    at Module.require (internal/modules/cjs/loader.js:723:19)
    at require (internal/modules/cjs/helpers.js:14:16)
    at Function._getFromPath (/Users/melnikov/projects/openzeppelin-sdk/packages/lib/lib/artifacts/Contracts.js:90:24)
    at Function.getFromLocal (/Users/melnikov/projects/openzeppelin-sdk/packages/lib/lib/artifacts/Contracts.js:53:26)
    at Object.<anonymous> (/Users/melnikov/projects/openzeppelin-sdk/packages/cli/test/utils/events.test.js:10:26)
    at Module._compile (internal/modules/cjs/loader.js:816:30)
    at Module.m._compile (/Users/melnikov/projects/openzeppelin-sdk/packages/cli/node_modules/ts-node/src/index.ts:439:23)
    at Module._extensions..js (internal/modules/cjs/loader.js:827:10)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/melnikov/projects/openzeppelin-sdk/packages/cli/node_modules/ts-node/src/index.ts:442:12)
    at Module.load (internal/modules/cjs/loader.js:685:32)
    at Function.Module._load (internal/modules/cjs/loader.js:620:12)
    at Module.require (internal/modules/cjs/loader.js:723:19)
    at require (internal/modules/cjs/helpers.js:14:16)
    at /Users/melnikov/projects/openzeppelin-sdk/packages/cli/node_modules/mocha/lib/mocha.js:231:27
    at Array.forEach (<anonymous>)
    at Mocha.loadFiles (/Users/melnikov/projects/openzeppelin-sdk/packages/cli/node_modules/mocha/lib/mocha.js:228:14)
    at Mocha.run (/Users/melnikov/projects/openzeppelin-sdk/packages/cli/node_modules/mocha/lib/mocha.js:536:10)
    at /Users/melnikov/projects/openzeppelin-sdk/packages/cli/node_modules/truffle/build/webpack:/packages/truffle-core/lib/test.js:118:1
Truffle v5.0.5 (core: 5.0.5)
Node v11.15.0
npm ERR! Test failed.  See above for more details.
1 Like

Hi @melnikaite

I get the same on master when I run npm test

openzeppelin-sdk/packages/cli$ npm test

I can run some tests if I compile first

openzeppelin-sdk/packages/cli$ npx truffle compile

It helped a bit, but now it complains about project file

Error: OpenZeppelin file .openzeppelin/project.json not found. Run 'openzeppelin init' first to initialize the project.
    at new LocalController (/Users/melnikov/projects/openzeppelin-sdk/packages/cli/src/models/local/LocalController.ts:32:13)
    at Object.<anonymous> (/Users/melnikov/projects/openzeppelin-sdk/packages/cli/src/scripts/link.ts:7:22)
    at Generator.next (<anonymous>)
    at /Users/melnikov/projects/openzeppelin-sdk/packages/cli/src/scripts/link.ts:7:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/melnikov/projects/openzeppelin-sdk/packages/cli/src/scripts/link.ts:3:12)
    at Object.link [as default] (/Users/melnikov/projects/openzeppelin-sdk/packages/cli/src/scripts/link.ts:16:12)
    at Command.<anonymous> (/Users/melnikov/projects/openzeppelin-sdk/packages/cli/src/commands/link.ts:32:13)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/melnikov/projects/openzeppelin-sdk/packages/cli/src/commands/link.ts:4:58)
1 Like

I manually ran npx oz init and then npm test and get the majority of the tests to run.

718 passing (7m)
  6 pending
  7 failing

We still need official instructions.

Thanks a lot!

We can add npx truffle compile and npx oz init @openzeppelin/cli --no-interactive commands to packages/cli/scripts/test.sh script

1 Like