dop-stick
Version:
Source control tooling for versionable-upgradeable smart contracts
73 lines • 2.43 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.mineCommand = void 0;
const index_1 = require("../../index");
const config_1 = require("../utils/config");
const logger_1 = require("../../utils/logsAndMetrics/core/logger");
/**
* Command to deploy a new diamond contract with specified facets.
*
* Usage:
* ```bash
* dopstick mine [options]
* ```
*
* Options:
* - `--no-cache`: Disable caching during deployment process
* - `--no-compile`: Skip contract compilation
*
* Configuration:
* Requires a valid dopstick.config.ts file with:
* - Contract paths
* - Deployment settings
* - Module specifications
*
* Example:
* ```bash
* dopstick mine
* dopstick mine --no-cache
* dopstick mine --no-compile
* ```
*
* Output:
* - Displays deployment progress
* - Returns deployed diamond address on success
*/
exports.mineCommand = {
register: (program) => {
program
.command('mine')
.description('Deploy a new diamond contract and add facets')
.option('--no-cache', 'Disable caching during deployment')
.option('--no-compile', 'Skip contract compilation')
.action(async (options) => {
try {
const config = (0, config_1.loadConfig)({ requireUpgrades: true });
// Override cache settings if --no-cache is used
if (options.cache === false) {
config.cache = {
...config.cache,
enabled: false
};
logger_1.Logger.info('Cache disabled via CLI option');
}
// Skip compilation if --no-compile is used
if (options.compile === false) {
config.compiler = {
...config.compiler,
skip: true
};
logger_1.Logger.info('Compilation skipped via CLI option');
}
const diamondAddress = await (0, index_1.mine)(config);
logger_1.Logger.success(`Diamond deployed at: ${diamondAddress}`);
process.exit(0);
}
catch (error) {
logger_1.Logger.error(error instanceof Error ? error.message : String(error));
process.exit(1);
}
});
}
};
//# sourceMappingURL=mine.js.map