Skip to content

Commit

Permalink
Initial Release
Browse files Browse the repository at this point in the history
  • Loading branch information
anilibriz committed Feb 29, 2024
2 parents 4d0ea8c + c1cfc10 commit 82f1d55
Show file tree
Hide file tree
Showing 31 changed files with 4,297 additions and 167 deletions.
5 changes: 0 additions & 5 deletions .changeset/brave-foxes-hunt.md

This file was deleted.

7 changes: 0 additions & 7 deletions .changeset/lovely-readers-lick.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/poor-fireants-march.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/yellow-ways-buy.md

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist
node_modules
*.tgz
*.tgz
example
33 changes: 17 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ Before beginning, make sure you have the following set up:
### From NPM

Install Aleo.js globally using npm:
`npm install -g @dokojs/cli@latest`
`npm install -g @doko-js/cli@latest`

### From Source

> In case pnpm is not set up, follow the [pnpm installation guide](https://pnpm.io/installation)
```bash
# Download the source file
git clone https://github.com/venture23-zkp/dokojs
git clone https://github.com/venture23-aleo/doko-js

cd dokojs
cd doko-js

# Install the dependencies
pnpm install
Expand All @@ -46,23 +46,24 @@ npm run install:cli
To use DokoJS, in your terminal, run:

```bash
dokojs-cli-dev
dokojs
```

The expected output is as following:

```bash _ _ _ ____
/ \ | | ___ ___ | / ___|
/ _ \ | |/ _ \/ _ \ _ | \___ \
/ ___ \| | __/ (_) | |_| |___) |
/_/ \_\_|\___|\___/ \___/|____/
Usage: dokojs-cli-dev [options] [command]
```bash
____ _ _ ____
| _ \ ___ | | _____ | / ___|
| | | |/ _ \| |/ / _ \ _ | \___ \
| |_| | (_) | | (_) | |_| |___) |
|____/ \___/|_|\_\___/ \___/|____/
Usage: dokojs [options] [command]

DokoJS CLI

Options:
-h, --help display help for command
-V, --version output the version number
-h, --help display help for command

Commands:
init [options] <project-name> Initialize your DokoJS project
Expand All @@ -82,7 +83,7 @@ Commands:
Initialize a new project by giving the name of the project.

```
dokojs-cli-dev init <PROJECT_NAME>
dokojs init <PROJECT_NAME>
```

Let's create a new project called `token`.
Expand Down Expand Up @@ -162,14 +163,14 @@ We have two modes of execution supported:
To add a new program create a new file inside the `programs/` directory.
To modify the existing file, simply modify the existing file or run command
```
dokojs-cli-dev add [PROGRAM_NAME]
dokojs add [PROGRAM_NAME]
```
### Compliation

To compile the project, run:

```
dokojs-cli-dev compile
dokojs compile
```

This will create the `artifacts` folder. The artifacts folder has the two main directories:
Expand Down Expand Up @@ -241,7 +242,7 @@ This documentation provides a comprehensive guide to installing Aleo.js, startin
Create a test file (e.g., token.test.ts) inside the test directory. An example test file is provided below:

```js
import { parseRecordString } from '@dokojs/core';
import { parseRecordString } from '@doko-js/core';
import { PrivateKey } from '@aleohq/sdk';

import { TokenContract } from '../artifacts/js/token';
Expand Down Expand Up @@ -304,7 +305,7 @@ test(
async () => {
const [result, tx] = await contract.mint_private(admin, amount);

// tx is undefined in evaluate mode, so we undefine it
// tx is undefined in evaluate mode
// This method waits for the transction to be broadcasted in execute mode
if (tx) await contract.wait(tx);

Expand Down
38 changes: 3 additions & 35 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,5 @@
# @aleojs/cli
# @doko-js/cli

## 0.2.1
## 0.0.1

### Patch Changes

- Update description in package json
- Updated dependencies
- @aleojs/core@0.2.1

## 0.2.0

### Minor Changes

- 930c6c1: Copy private key from aleo-config.js to leo build

### Patch Changes

- 6dfa9cd: Add wait() function for transactions in base-contract
- 4334483: Update sample_program test
Remove axios as dependency and replace with native fetch
- Updated dependencies [930c6c1]
- Updated dependencies [6dfa9cd]
- Updated dependencies [4334483]
- @aleojs/core@0.2.0

## 0.1.0

### Minor Changes

- Minor updates & code cleanup

### Patch Changes

- Updated dependencies
- @aleojs/utils@0.1.0
- @aleojs/core@0.1.0
- Initial release
16 changes: 8 additions & 8 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@dokojs/cli",
"version": "0.2.1",
"name": "@doko-js/cli",
"description": "DokoJS CLI tool",
"version": "0.0.1",
"main": "dist/index.js",
"type": "module",
"scripts": {
Expand All @@ -14,7 +14,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/venture23-zkp/aleojs.git"
"url": "git+https://github.com/venture23-aleo/doko-js.git"
},
"keywords": [
"doko",
Expand All @@ -24,17 +24,17 @@
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/venture23-zkp/aleojs/issues"
"url": "https://github.com/venture23-aleo/doko-js/issues"
},
"homepage": "https://github.com/venture23-zkp/aleojs#readme",
"homepage": "https://github.com/venture23-aleo/doko-js#readme",
"dependencies": {
"@dokojs/core": "workspace:*",
"@dokojs/utils": "workspace:*",
"@doko-js/core": "workspace:*",
"@doko-js/utils": "workspace:*",
"commander": "^11.0.0",
"fs-extra": "^11.1.1"
},
"bin": {
"dokojs-cli-dev": "dist/index.js"
"dokojs": "dist/index.js"
},
"types": "./dist/index.d.ts"
}
21 changes: 7 additions & 14 deletions packages/cli/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env -S node --experimental-modules

import { Command } from 'commander';
import { checkAndInstallRequirements } from '@dokojs/utils';
import { compilePrograms } from '@dokojs/core';
import { checkAndInstallRequirements } from '@doko-js/utils';
import { compilePrograms } from '@doko-js/core';
import {
addProgram,
createProjectStructure,
Expand All @@ -21,18 +21,11 @@ const pkg = JSON.parse(
);

function printProjectName() {
console.log(' _ _ _ ____ ');
console.log(' / \\ | | ___ ___ | / ___| ');
console.log(' / _ \\ | |/ _ \\/ _ \\ _ | \\___ \\ ');
console.log(' / ___ \\| | __/ (_) | |_| |___) |');
console.log(' /_/ \\_\\_|\\___|\\___/ \\___/|____/ ');
/*
____ _ _ ____
| _ \ ___ | | _____ | / ___|
| | | |/ _ \| |/ / _ \ _ | \___ \
| |_| | (_) | | (_) | |_| |___) |
|____/ \___/|_|\_\___/ \___/|____/
*/
console.log(' ____ _ _ ____ ');
console.log(' | _ \\ ___ | | _____ | / ___| ');
console.log(' | | | |/ _ \\| |/ / _ \\ _ | \\___ \\ ');
console.log(' | |_| | (_) | | (_) | |_| |___) |');
console.log(' |____/ \\___/|_|\\_\\___/ \\___/|____/ ');
}

printProjectName();
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/scripts/compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
getProjectRoot,
toSnakeCase,
Shell
} from '@dokojs/utils';
} from '@doko-js/utils';
import { Node, sort } from '@/utils/graph';

const GENERATE_FILE_OUT_DIR = 'artifacts';
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/scripts/deploy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from 'path';
import fse from 'fs-extra';

import {Shell, getAleoConfig, getProjectRoot} from '@dokojs/utils';
import {Shell, getAleoConfig, getProjectRoot} from '@doko-js/utils';

function createProgramPath(programName: string) {
const projectRoot = getProjectRoot();
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/scripts/execute.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Shell} from '@dokojs/utils';
import {Shell} from '@doko-js/utils';

export function leoExecute(filePath: string) {
const shell = new Shell(`ts-node ${filePath}`);
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/scripts/leo-node.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from 'path';
import { spawn } from 'child_process';
import readline from 'readline';
import { getAleoConfig } from '@dokojs/utils';
import { getAleoConfig } from '@doko-js/utils';

const rl = readline.createInterface({
input: process.stdin,
Expand Down
10 changes: 8 additions & 2 deletions packages/cli/src/scripts/program-generator.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from 'path';
import fse from 'fs-extra';

import { getProjectRoot, toSnakeCase, Shell } from '@dokojs/utils';
import { getProjectRoot, toSnakeCase, Shell } from '@doko-js/utils';

import { fileURLToPath } from 'url';

Expand Down Expand Up @@ -115,7 +115,13 @@ async function installNpmPackages(path: string | undefined) {
'babel-jest',
'@babel/preset-env'
];
const dependencies = ['zod', 'dotenv', '@dokojs/core', '@dokojs/utils', 'aleo-program-to-address'];
const dependencies = [
'zod',
'dotenv',
'aleo-program-to-address',
'@doko-js/core',
'@doko-js/utils'
];
const command = `cd "${path}" && npm install --save-dev ${devDeps.join(
' '
)} && npm install ${dependencies.join(' ')}`;
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/scripts/test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Shell} from '@dokojs/utils';
import {Shell} from '@doko-js/utils';

export function runTest(fileName: string) {
const shell = new Shell(`npm run test -- ${fileName}`);
Expand Down
Loading

0 comments on commit 82f1d55

Please sign in to comment.