Skip to content

Commit

Permalink
feat(workspaces)!: move frontend and contract dev to separate workspaces
Browse files Browse the repository at this point in the history
BREAKING CHANGE: This is a total re-write from the ground up with some workflow changes and different package decisions - all for a much better developer experience.
  • Loading branch information
proofoftom committed Mar 22, 2020
1 parent 3894f01 commit abd2148
Show file tree
Hide file tree
Showing 69 changed files with 1,288 additions and 1,413 deletions.
28 changes: 0 additions & 28 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,29 +1 @@
.DS_Store
node_modules
/dist

/tests/e2e/videos/
/tests/e2e/screenshots/

# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Editor directories and files
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# Build specific files
build
cache
.openzeppelin/.session
.openzeppelin/dev-*.json
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"typescript",
"typescriptreact"
],
"solidity.compileUsingRemoteVersion": "0.6.3+commit.8dda9521",
"solidity.compileUsingRemoteVersion": "0.6.4+commit.1dca32f3",
"solidity.packageDefaultDependenciesContractsDirectory": ""
}
1 change: 1 addition & 0 deletions contracts/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.sol linguist-language=Solidity
6 changes: 6 additions & 0 deletions contracts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Build specific files
.openzeppelin/.session
.openzeppelin/dev-*.json
build
cache
node_modules
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"Counter": "Counter"
},
"dependencies": {},
"name": "buidler-waffle-typechain-vue",
"name": "@my-app/contracts",
"version": "0.1.0",
"compiler": {
"compilerSettings": {
Expand All @@ -14,12 +14,12 @@
}
},
"typechain": {
"enabled": false,
"outDir": "./build/types",
"enabled": true,
"outDir": "build/types",
"target": "ethers"
},
"manager": "openzeppelin",
"solcVersion": "0.6.3",
"solcVersion": "0.6.4",
"artifactsDir": "build/contracts",
"contractsDir": "contracts"
},
Expand Down
10 changes: 5 additions & 5 deletions buidler.config.ts → contracts/buidler.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ usePlugin("buidler-typechain");

const config: BuidlerConfig = {
paths: {
artifacts: "./build/artifacts",
tests: "./tests/contracts"
artifacts: "build/contracts",
tests: "tests"
},
solc: {
version: "0.6.3"
version: "0.6.4"
},
typechain: {
outDir: "./build/types",
outDir: "build/types",
target: "ethers"
}
};

export default config;
export default config;
2 changes: 1 addition & 1 deletion contracts/Counter.sol → contracts/contracts/Counter.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.6.3;
pragma solidity ^0.6.4;

import "@nomiclabs/buidler/console.sol";

Expand Down
File renamed without changes.
41 changes: 41 additions & 0 deletions contracts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "@my-app/contracts",
"version": "0.1.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"build": "oz compile",
"node": "npx buidler node",
"deploy:local": "yarn clean && yarn build && oz create Counter --skip-compile -n development --init",
"upgrade:local": "yarn build && oz upgrade Counter --skip-compile -n development --init",
"deploy:goerli": "yarn clean && yarn build && oz create Counter --skip-compile -n goerli --init",
"upgrade:goerli": "yarn build && oz upgrade Counter --skip-compile -n goerli --init",
"test": "buidler typechain && buidler test",
"clean": "rm -rf cache && rm -rf build && rm -f .openzeppelin/.session && rm -f .openzeppelin/dev-*.json"
},
"devDependencies": {
"@nomiclabs/buidler": "^1.2.0",
"@nomiclabs/buidler-ethers": "^1.2.0",
"@nomiclabs/buidler-truffle5": "^1.2.0",
"@nomiclabs/buidler-waffle": "^1.2.0",
"@nomiclabs/buidler-web3": "^1.2.0",
"@openzeppelin/cli": "^2.7.2",
"@types/chai": "^4.2.11",
"@types/mocha": "^7.0.2",
"@types/node": "^13.9.2",
"@typescript-eslint/eslint-plugin": "^2.24.0",
"@typescript-eslint/parser": "^2.24.0",
"buidler-typechain": "^0.0.5",
"chai": "^4.2.0",
"ethereum-waffle": "^2.4.0",
"ethers": "^4.0.46",
"ts-generator": "^0.0.8",
"ts-node": "^8.8.1",
"typechain": "^1.0.5",
"typechain-target-ethers": "^1.0.3",
"typechain-target-truffle": "^1.0.2",
"typechain-target-web3-v1": "^1.0.4",
"typescript": "^3.8.3",
"web3": "^1.2.6"
}
}
24 changes: 24 additions & 0 deletions contracts/scripts/deploy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { ethers } from "@nomiclabs/buidler";

async function main() {
const factory = await ethers.getContract("Counter");

// If we had constructor arguments, they would be passed into deploy()
const contract = await factory.deploy();

// The address that the Contract WILL have once mined
console.log(contract.address);

// The transaction that was sent to the network to deploy the Contract
console.log(contract.deployTransaction.hash);

// The contract is NOT deployed yet; we must wait until it is mined
await contract.deployed();
}

main()
.then(() => process.exit(0))
.catch(error => {
console.error(error);
process.exit(1);
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { waffle } from "@nomiclabs/buidler";
import chai from "chai";
import { deployContract, solidity } from "ethereum-waffle";

import CounterArtifact from "../../build/artifacts/Counter.json";
import { Counter } from "../../build/types/Counter";
import CounterArtifact from "../build/contracts/Counter.json";
import { Counter } from "../build/types/Counter";

chai.use(solidity);
const { expect } = chai;
Expand Down
17 changes: 17 additions & 0 deletions contracts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"strict": true,
"esModuleInterop": true,
"outDir": "dist",
"resolveJsonModule": true
},
"include": ["./scripts", "./tests"],
"files": [
"./buidler.config.ts",
"./node_modules/@nomiclabs/buidler-ethers/src/type-extensions.d.ts",
"./node_modules/@nomiclabs/buidler-waffle/src/type-extensions.d.ts",
"./node_modules/buidler-typechain/src/type-extensions.d.ts"
]
}
107 changes: 23 additions & 84 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,89 +1,28 @@
{
"name": "buidler-waffle-typechain-vue",
"version": "0.1.0",
"name": "@my-app/monorepo",
"private": true,
"scripts": {
"build": "yarn build:contracts && yarn build:web",
"build:contracts": "oz compile && buidler typechain",
"build:web": "vue-cli-service build",
"clean": "rm -rf cache && rm -rf build && rm -f .openzeppelin/.session && rm -f .openzeppelin/dev-*.json",
"deploy:local": "yarn clean && yarn build:contracts && oz create Counter --skip-compile -n development --init",
"lint": "vue-cli-service lint",
"start:dev": "yarn deploy:local && vue-cli-service serve",
"start:node": "buidler node",
"start:web": "vue-cli-service serve",
"test": "yarn test:contracts && yarn test:unit && yarn test:e2e",
"test:contracts": "buidler test",
"test:e2e": "vue-cli-service test:e2e",
"test:unit": "vue-cli-service test:unit",
"upgrade:local": "yarn build:contracts && oz upgrade Counter --skip-compile -n development --init"
},
"dependencies": {
"@fortawesome/fontawesome-free": "^5.8.2",
"@resolver-engine/core": "^0.3.3",
"core-js": "^3.6.4",
"ethers": "^4.0.45",
"register-service-worker": "^1.6.2",
"roboto-fontface": "*",
"vue": "^2.6.11",
"vue-class-component": "^7.2.2",
"vue-property-decorator": "^8.3.0",
"vue-router": "^3.1.5",
"vuetify": "^2.2.11",
"vuex": "^3.1.2"
},
"devDependencies": {
"@nomiclabs/buidler": "^1.2.0",
"@nomiclabs/buidler-ethers": "^1.2.0",
"@nomiclabs/buidler-waffle": "^1.2.0",
"@openzeppelin/cli": "^2.7.1",
"@types/chai": "^4.2.9",
"@types/mocha": "^7.0.1",
"@types/node": "^13.7.7",
"@typescript-eslint/eslint-plugin": "^2.18.0",
"@typescript-eslint/parser": "^2.18.0",
"@vue/cli-plugin-babel": "~4.2.0",
"@vue/cli-plugin-e2e-cypress": "~4.2.0",
"@vue/cli-plugin-eslint": "~4.2.0",
"@vue/cli-plugin-pwa": "~4.2.0",
"@vue/cli-plugin-router": "~4.2.0",
"@vue/cli-plugin-typescript": "~4.2.0",
"@vue/cli-plugin-unit-mocha": "~4.2.0",
"@vue/cli-plugin-vuex": "~4.2.0",
"@vue/cli-service": "~4.2.0",
"@vue/eslint-config-prettier": "^6.0.0",
"@vue/eslint-config-typescript": "^5.0.1",
"@vue/test-utils": "1.0.0-beta.31",
"buidler-typechain": "^0.0.5",
"chai": "^4.2.0",
"eslint": "^6.7.2",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-vue": "^6.1.2",
"ethereum-waffle": "^2.3.2",
"lint-staged": "^9.5.0",
"null-loader": "^3.0.0",
"prettier": "^1.19.1",
"sass": "^1.25.0",
"sass-loader": "^8.0.2",
"solc": "0.6.3",
"ts-generator": "^0.0.8",
"ts-node": "^8.6.2",
"typechain": "^1.0.5",
"typechain-target-ethers": "^1.0.3",
"typechain-target-truffle": "^1.0.2",
"typechain-target-web3-v1": "^1.0.4",
"typescript": "^3.8.3",
"vue-cli-plugin-vuetify": "~2.0.5",
"vue-template-compiler": "^2.6.11",
"vuetify-loader": "^1.3.0"
},
"gitHooks": {
"pre-commit": "lint-staged"
},
"lint-staged": {
"*.{js,jsx,vue,ts,tsx}": [
"vue-cli-service lint",
"git add"
"workspaces": {
"packages": ["contracts", "vue-app"],
"nohoist": [
"**/@nomiclabs/**",
"**/typescript",
"**/ts-node",
"**/@vue/**",
"**/@openzeppelin/cli"
]
},
"scripts": {
"build": "yarn workspaces run build",
"build:contracts": "yarn workspace @my-app/contracts run build",
"build:web": "yarn workspace @my-app/vue-app run build",
"start:dev": "yarn deploy:local && yarn start:web",
"start:node": "yarn workspace @my-app/contracts run node",
"start:web": "yarn workspace @my-app/vue-app run serve",
"test": "yarn workspaces run test",
"test:contracts": "yarn workspace @my-app/contracts run test",
"test:web": "yarn workspace @my-app/vue-app run test",
"deploy:local": "yarn workspace @my-app/contracts run deploy:local",
"upgrade:local": "yarn workspace @my-app/contracts run upgrade:local",
"lint:web": "yarn workspace @my-app/vue-app run lint"
}
}
48 changes: 0 additions & 48 deletions src/App.vue

This file was deleted.

1 change: 0 additions & 1 deletion src/assets/logo.svg

This file was deleted.

Loading

0 comments on commit abd2148

Please sign in to comment.