Skip to content

Commit

Permalink
[cli] basic --help/ command structure + basic build implementation
Browse files Browse the repository at this point in the history
(build will pick up specific files)
  • Loading branch information
janedegtiareva committed Feb 26, 2019
1 parent bef0493 commit 6c4cb9c
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
36 changes: 36 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
const gulp = require("gulp");

gulp.task("build:model", function (done) {
const asc = require("assemblyscript/bin/asc");
asc.main([
"model.ts",
"--baseDir", "./out",
"--nearFile", "../out/model.near.ts",
"--measure"
], done);
});

gulp.task("build:bindings", function (done) {
console.log('bb1')
const asc = require('assemblyscript/bin/asc');
asc.main([
"main.ts",
"--baseDir", "./out",
"--binaryFile", "../out/main.wasm",
"--nearFile", "../out/main.near.ts",
"--measure"
], done);
});

gulp.task("build:all", gulp.series('build:model', 'build:bindings', function (done) {
done();
}));

gulp.task('copyfiles', function(done) {
return gulp.src('./assembly/**/*')
.pipe(gulp.dest('./out/'));
});

gulp.task('build', gulp.series('copyfiles', 'build:all', function(done) {
done();
}));
27 changes: 27 additions & 0 deletions near
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env node

const commandLineArgs = require('command-line-args');
const nearLib = require('nearlib');
const gulp = require('gulp');
const gulpfile = require('./gulpfile') // import the gulp file

require('yargs') // eslint-disable-line
.command('build', 'build your smart contract', (yargs) => {

}, (argv) => {
if (argv.verbose) console.info(`build contract on :${argv.port}`)
if (gulp.task('build')) {
const result = gulp.task('build')();
}
})
.command('deploy', 'deploy your smart contract', (yargs) => {
yargs
.positional('contract_name', {
describe: 'Name of the contract to deploy',
default: 'default'
})
}, (argv) => {
if (argv.verbose) console.info(`deploy contract`)
console.log('NOT IMPLEMENTED YET')
})
.argv;
16 changes: 13 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "near-cli",
"name": "near-shell",
"version": "1.0.0",
"description": "Command line utilities to interact with near blockchain",
"main": "index.js",
"scripts": {
"build": "echo \"Error: not implemented\" && exit 1",
"deploy" : "echo \"Error: not implemented\" && exit 1",
"deploy": "echo \"Error: not implemented\" && exit 1",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
Expand All @@ -17,5 +17,15 @@
"bugs": {
"url": "https://github.com/nearprotocol/near-cli/issues"
},
"homepage": "https://github.com/nearprotocol/near-cli#readme"
"homepage": "https://github.com/nearprotocol/near-cli#readme",
"devDependencies": {
"assemblyscript": "github:nearprotocol/assemblyscript",
"command-line-args": "^5.0.2",
"fs": "0.0.1-security",
"gulp": "^4.0.0",
"nearlib": "^0.3.1",
"run-sequence": "^2.2.1",
"yargs": "^13.2.1"
},
"dependencies": {}
}

0 comments on commit 6c4cb9c

Please sign in to comment.