Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

Commit

Permalink
Add codegen, draft feature to context menu and updated docs (#136)
Browse files Browse the repository at this point in the history
* Add codegen and draft feature to context menu

Signed-off-by: Ayman161803 <[email protected]>

* create common styles function and add breakline above preview html

Signed-off-by: Ayman161803 <[email protected]>

* Remove unnecessary comments from webpack config

Signed-off-by: Ayman161803 <[email protected]>

* Updated docs in README.md

Signed-off-by: Ayman161803 <[email protected]>

Signed-off-by: Ayman161803 <[email protected]>
  • Loading branch information
Ayman161803 authored Aug 30, 2022
1 parent f0ff2c9 commit 62a7682
Show file tree
Hide file tree
Showing 16 changed files with 361 additions and 101 deletions.
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,30 @@ Please visit the [Visual Studio Code Marketplace](https://marketplace.visualstud

### Commands

- Compile your ``model.cto `` file to a target

![Code Gen GIF](./assets/Code%20Gen.gif)


- Draft clause after passing relevent input into the form.

![Draft Clause GIF](./assets/Draft%20Clause.gif)


- Work offline by downloading Concerto model dependencies (context-click on a `*.cto` file)
- Package templates into Cicero Template Archive (cta) files (context-click on root folder)
- Export PlantUML class diagram (context-click on a `*.cto` file)

![Downdload Models and Export Class Diagrsms GIF](./assets/Downloads%20Models%20and%20Export%20Class%20Diagrsm.gif)

- Parse Clause after entering relevent information into the input form.
- Export the template directory as a ``.cta`` archive.

![Parse Clause and Export as archive GIF](./assets/Parse%20Clause%20And%20Export%20As%20Archive.gif)

- Trigger a template, parsing data from sample.md and passing in `request.json` and `state.json` (context-click on root folder)

![Trigger Clause GIF](./assets/Trigger%20Clause.gif)

### Views
- HTML preview for template text (open `grammar.tem.md` and then press the _Open Preview_ icon in the editor or context menu)
- HTML preview for Concerto models (open `*.cto` and then press the _Open Preview_ icon in the editor or context menu)
Expand Down
Binary file added assets/Code Gen.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Draft Clause.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Parse Clause And Export As Archive.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Trigger Clause.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion babel.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
"@babel/preset-env",
"@babel/preset-typescript"
],
"plugins": ["@babel/plugin-transform-typescript"]
"plugins": ["@babel/plugin-transform-typescript",["@babel/plugin-transform-runtime",
{
"regenerator": true
}]]
}
4 changes: 2 additions & 2 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"dependencies": {
"@accordproject/cicero-core": "^0.22.0",
"@accordproject/cicero-engine": "^0.22.0",
"@accordproject/concerto-core": "^1.0.0",
"@accordproject/concerto-tools": "^1.0.0",
"@accordproject/concerto-core": "^1.2.1",
"@accordproject/concerto-tools": "^1.2.1",
"@accordproject/markdown-it-cicero": "^0.13.0",
"@accordproject/markdown-it-template": "^0.13.0",
"mermaid": "^8.13.8",
Expand Down
8 changes: 7 additions & 1 deletion client/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ import {
getPreviewWebviewContent,
parseClause,
setOutputChannelForCommonCommands,
draftClause,
compileToTarget,
} from './webCommandHandlers';

let client: LanguageClient;
Expand Down Expand Up @@ -123,7 +125,11 @@ export function activate(context: vscode.ExtensionContext) {
.registerCommand('cicero-vscode-extension.parseClause', parseClause));
context.subscriptions.push(vscode.commands
.registerCommand('cicero-vscode-extension.verifyTemplateSignature', verifyTemplateSignature));

context.subscriptions.push(vscode.commands
.registerCommand('cicero-vscode-extension.draftClause', draftClause));
context.subscriptions.push(vscode.commands
.registerCommand('cicero-vscode-extension.compileToTarget', compileToTarget));

let currentPanel: vscode.WebviewPanel | undefined = undefined;

context.subscriptions.push(
Expand Down
6 changes: 3 additions & 3 deletions client/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ async function loadFileBuffer(path, fileName, required=false) {
const filePath = Utils.resolvePath(path, fileName);

try{
return await vscode.workspace.fs.readFile(filePath);
const contents = Buffer.from(await vscode.workspace.fs.readFile(filePath));
return contents;
}
catch(e) {
if(required){
Expand Down Expand Up @@ -117,8 +118,7 @@ export async function fromDirectory(Template, path, options = {offline:false}) {
const readmeContents = await loadFileContents(path, 'README.md');

// grab the logo.png
const logo = Buffer.from(await loadFileBuffer(path, 'logo.png'));

const logo = await loadFileBuffer(path, 'logo.png');
// grab the request.json
const requestJsonObject = await loadFileContents(path, 'request.json', true );

Expand Down
8 changes: 7 additions & 1 deletion client/src/webClientMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ import {
downloadModels,
exportClassDiagram,
parseClause,
exportArchive
exportArchive,
compileToTarget,
draftClause
} from './webCommandHandlers';

async function onDocumentChange(event) {
Expand Down Expand Up @@ -55,6 +57,10 @@ export async function activate(context: vscode.ExtensionContext) {
.registerCommand('cicero-vscode-extension.downloadModels', downloadModels));
context.subscriptions.push(vscode.commands
.registerCommand('cicero-vscode-extension.exportClassDiagram', exportClassDiagram));
context.subscriptions.push(vscode.commands
.registerCommand('cicero-vscode-extension.compileToTarget', compileToTarget));
context.subscriptions.push(vscode.commands
.registerCommand('cicero-vscode-extension.draftClause', draftClause));

let currentPanel: vscode.WebviewPanel | undefined = undefined;

Expand Down
Loading

0 comments on commit 62a7682

Please sign in to comment.