Browse Source

Renamed lib directory to imports

master
Tal Kol 2 years ago
parent
commit
09d9e2aaf0
  1. 2
      README.md
  2. 4
      build/build.ts
  3. 0
      contracts/imports/stdlib.fc
  4. 0
      contracts/imports/utils.fc

2
README.md

@ -51,7 +51,7 @@ To setup your machine for development, please make sure you have the following:
* Develop * Develop
* FunC contracts are located in `contracts/*.fc` * FunC contracts are located in `contracts/*.fc`
* Standalone root contracts are located in `contracts/*.fc` * Standalone root contracts are located in `contracts/*.fc`
* Imported utility code (when breaking code to multiple files) in `contracts/lib/*.fc` * Imported utility code (when breaking code to multiple files) in `contracts/imports/*.fc`
* This structure assists with build and deployment and assumed by the included scripts * This structure assists with build and deployment and assumed by the included scripts
* Tests are located in `test/*.spec.ts` * Tests are located in `test/*.spec.ts`

4
build/build.ts

@ -2,7 +2,7 @@
// It assumes that it is running from the repo root, and the directories are organized this way: // It assumes that it is running from the repo root, and the directories are organized this way:
// ./build/ - directory for build artifacts exists // ./build/ - directory for build artifacts exists
// ./contracts/*.fc - root contracts that are deployed separately are here // ./contracts/*.fc - root contracts that are deployed separately are here
// ./contracts/lib/*.fc - utility code that should be imported as compilation dependency is here // ./contracts/imports/*.fc - utility code that should be imported as compilation dependency is here
import * as fs from "fs"; import * as fs from "fs";
import * as path from "path"; import * as path from "path";
@ -43,7 +43,7 @@ for (const rootContract of rootContracts) {
// create one string with all source code from all merged files // create one string with all source code from all merged files
let sourceToCompile = ""; let sourceToCompile = "";
const importFiles = fg.sync(["contracts/lib/**/*.fc", "contracts/lib/**/*.func"]); const importFiles = fg.sync(["contracts/imports/**/*.fc", "contracts/imports/**/*.func"]);
for (const importFile of importFiles) { for (const importFile of importFiles) {
console.log(` - Adding import '${importFile}'`); console.log(` - Adding import '${importFile}'`);
sourceToCompile += `${fs.readFileSync(importFile).toString()}\n`; sourceToCompile += `${fs.readFileSync(importFile).toString()}\n`;

0
contracts/lib/stdlib.fc → contracts/imports/stdlib.fc

0
contracts/lib/utils.fc → contracts/imports/utils.fc

Loading…
Cancel
Save