Skip to content
This repository has been archived by the owner on Mar 19, 2019. It is now read-only.

Investigate options to reduce boiler plate in Typescript rugs #24

Closed
kipz opened this issue Dec 2, 2016 · 3 comments
Closed

Investigate options to reduce boiler plate in Typescript rugs #24

kipz opened this issue Dec 2, 2016 · 3 comments
Assignees

Comments

@kipz
Copy link
Contributor

kipz commented Dec 2, 2016

Currently there are many imports, quite a few annotations and some verbose APIs.

There are many options here, including wildcard imports, improved APIs, increased use of conventions etc.

@Lawouach
Copy link
Contributor

Lawouach commented Dec 2, 2016

Tradeoff between readability/reducing noise vs engineering best practices indeed.

@kipz
Copy link
Contributor Author

kipz commented Dec 8, 2016

imports could be produced by generating an aggregate module containing just exports, but would mean that a little more in terms of each use:

import * as atomist from '@atomist/rug/All'

val foo: atomist.File = null

But this has the obvious drawback that we'll have to rev this aggregate when any of the core types change, and as we move those types out of Rug library itself, that'll become even more difficult to manage.

@kipz kipz self-assigned this Dec 13, 2016
@kipz
Copy link
Contributor Author

kipz commented Dec 13, 2016

The below looks nice. It's removed any weird duplication due to the way decorators work, and provides a simple way to lookup services like the PathExpressionEngine.

import {SimpleEditor} from "./ProjectEditor"
import {Project} from "../model/Core"
import {Parameter} from "./Parameters"
import {PathExpressionEngine} from "../tree/PathExpression"
import {Result,Status} from "./Result"
import {Registry} from "./Registry"

let editor: SimpleEditor = {
  name: "HelloWorld",
  description: "Much simpler API for editors",
  parameters: [{name: "content", pattern: "^.*$", required: true, description: "Simple content param"}],
  edit: (project: Project, {content} : {content: string}) => {
    //codes here
    let engine: PathExpressionEngine = project.context().pathExpressionEngine()
    return new Result(Status.Success, "Woot")
  }
}

@kipz kipz closed this as completed Dec 16, 2016
kipz added a commit to atomist-attic/licensing-editors that referenced this issue Dec 16, 2016
kipz added a commit to atomist-attic/licensing-editors that referenced this issue Dec 16, 2016
kipz added a commit to atomist-attic/travis-editors that referenced this issue Dec 16, 2016
ddgenome added a commit to atomist-attic/travis-editors that referenced this issue Dec 16, 2016
atomist-attic/rug#24 Update to new model and prepare for 0.6.0 release
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants