@seagull/code-generators
Advanced tools
Comparing version 0.5.0 to 0.5.1
@@ -10,3 +10,3 @@ "use strict"; | ||
indentationText: ts_simple_ast_1.IndentationText.TwoSpaces, | ||
quoteType: ts_simple_ast_1.QuoteType.Single, | ||
quoteType: ts_simple_ast_1.QuoteKind.Single, | ||
scriptTarget: ts.ScriptTarget.Latest, | ||
@@ -17,2 +17,3 @@ }, | ||
const prettierSettings = { | ||
parser: 'babylon', | ||
semi: false, | ||
@@ -19,0 +20,0 @@ singleQuote: true, |
@@ -26,3 +26,3 @@ import { ConstructorDeclarationStructure } from 'ts-simple-ast'; | ||
} | ||
export default class extends Base { | ||
export default class extends Base { | ||
private classDeclaration; | ||
@@ -29,0 +29,0 @@ constructor(name: string, parent?: string, addDefaultInterfaces?: boolean); |
import CodeBlockWriter from 'code-block-writer'; | ||
import Base from './base'; | ||
export default class extends Base { | ||
export default class extends Base { | ||
private functionDeclaration; | ||
@@ -5,0 +5,0 @@ constructor(name: string); |
@@ -13,6 +13,2 @@ "use strict"; | ||
const gen = new class_1.default(name, 'React.Component<IProps, IState>', true); | ||
gen.addConstructor({ | ||
bodyText: 'super(props)\n this.state = {}', | ||
parameters: [{ name: 'props', type: 'IProps' }], | ||
}); | ||
gen.addInterface('IProps'); | ||
@@ -19,0 +15,0 @@ gen.addInterface('IState'); |
@@ -30,9 +30,2 @@ "use strict"; | ||
} | ||
'when class, contains constructor'() { | ||
const gen = _lib_1.generateComponentTsx('MyDiv', true); | ||
const code = gen.toString(); | ||
chai_1.expect(code).to.contain(`constructor(props: IProps) {`); | ||
chai_1.expect(code).to.contain(`super(props)`); | ||
chai_1.expect(code).to.contain(`this.state = {}`); | ||
} | ||
'when class, contains render method'() { | ||
@@ -73,8 +66,2 @@ const gen = _lib_1.generateComponentTsx('MyDiv', true); | ||
__metadata("design:returntype", void 0) | ||
], CodegenGenerateComponentTsxTest.prototype, "when class, contains constructor", null); | ||
__decorate([ | ||
mocha_typescript_1.test, | ||
__metadata("design:type", Function), | ||
__metadata("design:paramtypes", []), | ||
__metadata("design:returntype", void 0) | ||
], CodegenGenerateComponentTsxTest.prototype, "when class, contains render method", null); | ||
@@ -81,0 +68,0 @@ __decorate([ |
{ | ||
"name": "@seagull/code-generators", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "Scaffolding capabilities and AST transforms for seagull apps", | ||
@@ -38,3 +38,3 @@ "main": "dist/src/index.js", | ||
"shelljs": "^0.8.1", | ||
"ts-simple-ast": "^8.1.0" | ||
"ts-simple-ast": "^10.1.0" | ||
}, | ||
@@ -41,0 +41,0 @@ "peerDependencies": { |
import { writeFileSync } from 'fs' | ||
import * as prettier from 'prettier' | ||
import Ast, { IndentationText, QuoteType, SourceFile } from 'ts-simple-ast' | ||
import Ast, { IndentationText, QuoteKind, SourceFile } from 'ts-simple-ast' | ||
import * as ts from 'typescript' | ||
@@ -9,3 +9,3 @@ | ||
indentationText: IndentationText.TwoSpaces, | ||
quoteType: QuoteType.Single, | ||
quoteType: QuoteKind.Single, | ||
scriptTarget: ts.ScriptTarget.Latest, | ||
@@ -17,2 +17,3 @@ }, | ||
const prettierSettings = { | ||
parser: 'babylon', | ||
semi: false, | ||
@@ -19,0 +20,0 @@ singleQuote: true, |
@@ -14,6 +14,2 @@ import GenClass from './class' | ||
const gen = new GenClass(name, 'React.Component<IProps, IState>', true) | ||
gen.addConstructor({ | ||
bodyText: 'super(props)\n this.state = {}', | ||
parameters: [{ name: 'props', type: 'IProps' }], | ||
}) | ||
gen.addInterface('IProps') | ||
@@ -20,0 +16,0 @@ gen.addInterface('IState') |
@@ -29,11 +29,2 @@ import { generateComponentTsx } from '@lib' | ||
@test | ||
'when class, contains constructor'() { | ||
const gen = generateComponentTsx('MyDiv', true) | ||
const code = gen.toString() | ||
expect(code).to.contain(`constructor(props: IProps) {`) | ||
expect(code).to.contain(`super(props)`) | ||
expect(code).to.contain(`this.state = {}`) | ||
} | ||
@test | ||
'when class, contains render method'() { | ||
@@ -40,0 +31,0 @@ const gen = generateComponentTsx('MyDiv', true) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1152719
2975
+ Addedcode-block-writer@6.13.0(transitive)
+ Addedglob-parent@3.1.0(transitive)
+ Addedis-extglob@2.1.1(transitive)
+ Addedis-glob@3.1.0(transitive)
+ Addedpath-dirname@1.0.2(transitive)
+ Addedts-simple-ast@10.5.0(transitive)
+ Addedtslib@1.14.1(transitive)
+ Addedtypescript@2.8.1(transitive)
- Removedcode-block-writer@6.14.0(transitive)
- Removedts-simple-ast@8.2.4(transitive)
- Removedtypescript@2.7.1(transitive)
Updatedts-simple-ast@^10.1.0