Skip to content

Commit d1c24c6

Browse files
Merge branch 'hotfix/0.1.1'
2 parents 1507b6a + 12ba569 commit d1c24c6

11 files changed

Lines changed: 26 additions & 25 deletions

File tree

bin/crc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env bash
22

33
#: TITLE: crc
4-
#: DATE: 2019-04-23
5-
#: VERSION: 0.1.0
4+
#: DATE: 2019-07-20
5+
#: VERSION: 0.1.1
66
#: AUTHOR: "Alex Y" <aleksandryackovlev@yandex.ru>
77
#: DESCRIPTION: Create React Component
88

bin/crc-config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env bash
22

33
#: TITLE: crc-config
4-
#: DATE: 2019-04-23
5-
#: VERSION: 0.1.0
4+
#: DATE: 2019-07-20
5+
#: VERSION: 0.1.1
66
#: AUTHOR: "Alex Y" <aleksandryackovlev@yandex.ru>
77
#: DESCRIPTION: CRUD for configuration files
88

bin/crc-create

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env bash
22

33
#: TITLE: crc-create
4-
#: DATE: 2019-04-23
5-
#: VERSION: 0.1.0
4+
#: DATE: 2019-07-20
5+
#: VERSION: 0.1.1
66
#: AUTHOR: "Alex Y" <aleksandryackovlev@yandex.ru>
77
#: DESCRIPTION: Creates React Component
88
#: OPTIONS: -t <TEMPLATE> - template name, default to "default"
@@ -348,7 +348,7 @@ addProps() {
348348
propsOutput="${propsOutput}\1\}"
349349
propTypesOutput="${propTypesOutput}\};\n"
350350

351-
output="s/^\(${indentation}*\)\(.*\)$(crc-env propsPlaceholder)/$propsOutput/g; "
351+
output="s/^\($(crc-env indentationPlaceholder)*\)\(.*\)$(crc-env propsPlaceholder)/$propsOutput/g; "
352352
output="${output}s/$(crc-env propTypesImportPlaceholder)/import PropTypes from 'prop-types';/g; "
353353
output="${output}s/$(crc-env propTypesDefinitionPlaceholder)/$propTypesOutput/g; "
354354

@@ -461,9 +461,9 @@ crc-create() {
461461
stylesFile="$directory"/"$stylesFile"
462462

463463
sedCommands="$(replaceComponentName "$componentName"); $(addStylesOutput "$addCss" "$stylesFileExtention")"
464-
sedCommands="$sedCommands""; $(replaceIndentation "$indentation")"
465464
sedCommands="$sedCommands""; $(addLifecycleMethods "$indentation" "$lifecycleMethods"); $(addHandlers "$indentation" "$handlers")"
466465
sedCommands="$sedCommands""; $(addMethods "$indentation" "$methods"); $(addProps "$indentation" "$componentName" "$@")"
466+
sedCommands="$sedCommands""; $(replaceIndentation "$indentation")"
467467

468468
createStylesFile "$addCss" "$stylesTemplate" "$componentName" "$stylesFile"
469469
createComponentFile "$sedCommands" "$componentTemplate" "$componentFile"

bin/crc-create.bats

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ teardown() {
7979
@test "[crc-create] replaceIndentation: should return the sed command for the indentation replacement" {
8080
run replaceIndentation ' '
8181

82-
[ "$output" = 's/ / /g' ]
82+
[ "$output" = 's/\t/ /g' ]
8383
}
8484

8585
@test "[crc-create] createComponentFile: should create a new component file for a given component name" {
@@ -213,7 +213,7 @@ teardown() {
213213
@test "[crc-create] addProps: should add given prop types to a new component" {
214214
run addProps ' ' SomeComponent "value:number" "text:object:'shell'"
215215

216-
expectedOutput='s/^\( *\)\(.*\)%PROPS%/\1\2\{\n\1 value,\n\1 text,\n\1\}/g; s/%PROP_TYPES_IMPORT%/import PropTypes from '"'prop-types'"';/g; s/%PROP_TYPES_DEFINITION%/SomeComponent.propTypes = \{\n value: PropTypes.number.isRequired,\n text: PropTypes.object,\n\};\n/g; s/%DEFAULT_PROPS%/SomeComponent.defaultProps = \{\n text: '"'shell'"',\n\};\n/g'
216+
expectedOutput='s/^\(\t*\)\(.*\)%PROPS%/\1\2\{\n\1 value,\n\1 text,\n\1\}/g; s/%PROP_TYPES_IMPORT%/import PropTypes from '"'prop-types'"';/g; s/%PROP_TYPES_DEFINITION%/SomeComponent.propTypes = \{\n value: PropTypes.number.isRequired,\n text: PropTypes.object,\n\};\n/g; s/%DEFAULT_PROPS%/SomeComponent.defaultProps = \{\n text: '"'shell'"',\n\};\n/g'
217217
[ "$output" = "$expectedOutput" ]
218218
}
219219

@@ -253,6 +253,7 @@ teardown() {
253253
}
254254

255255
@test "[crc-create] crc-create: create a react component with specified options" {
256+
rm -rf /tmp/Component
256257
run crc-create -s -l componentDidMount:componentWillUnmount -d /tmp -h handleClick -m getValues:setValues -t classical Component "value:string:'test'" 'source:object'
257258

258259
componentDiff=$(diff /tmp/Component/Component.js ../test_snapshots/Component.js)

bin/crc-env

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env bash
22

33
#: TITLE: crc-env
4-
#: DATE: 2019-04-23
5-
#: VERSION: 0.1.0
4+
#: DATE: 2019-07-20
5+
#: VERSION: 0.1.1
66
#: AUTHOR: "Alex Y" <aleksandryackovlev@yandex.ru>
77
#: DESCRIPTION: Environment variables
88

@@ -38,7 +38,7 @@ export defaultIndentation=' '
3838
## Placeholders
3939
export cssImportPlaceholder='%CSS_IMPORT%'
4040
export componentNamePlaceholder='%COMPONENT_NAME%'
41-
export indentationPlaceholder=' '
41+
export indentationPlaceholder="\t"
4242
export lifecycleMethodsPlaceholder='%LIFECYCLE_METHODS%'
4343
export handlersPlaceholder='%HANDLERS%'
4444
export methodsPlaceholder='%METHODS%'

bin/crc-help

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env bash
22

33
#: TITLE: crc-help
4-
#: DATE: 2019-04-23
5-
#: VERSION: 0.1.0
4+
#: DATE: 2019-07-20
5+
#: VERSION: 0.1.1
66
#: AUTHOR: "Alex Y" <aleksandryackovlev@yandex.ru>
77
#: DESCRIPTION: Help information
88

bin/crc-input

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env bash
22

33
#: TITLE: crc-input
4-
#: DATE: 2019-04-23
5-
#: VERSION: 0.1.0
4+
#: DATE: 2019-07-20
5+
#: VERSION: 0.1.1
66
#: AUTHOR: "Alex Y" <aleksandryackovlev@yandex.ru>
77
#: DESCRIPTION: Functions for getting users' input
88

bin/crc-output

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env bash
22

33
#: TITLE: crc-output
4-
#: DATE: 2019-04-23
5-
#: VERSION: 0.1.0
4+
#: DATE: 2019-07-20
5+
#: VERSION: 0.1.1
66
#: AUTHOR: "Alex Y" <aleksandryackovlev@yandex.ru>
77
#: DESCRIPTION: Styling functions for output messages
88

bin/crc-template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env bash
22

33
#: TITLE: crc-template
4-
#: DATE: 2019-04-23
5-
#: VERSION: 0.1.0
4+
#: DATE: 2019-07-20
5+
#: VERSION: 0.1.1
66
#: AUTHOR: "Alex Y" <aleksandryackovlev@yandex.ru>
77
#: DESCRIPTION: Functions for templates' manipulations
88

bin/crc-utils

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env bash
22

33
#: TITLE: crc-utils
4-
#: DATE: 2019-04-23
5-
#: VERSION: 0.1.0
4+
#: DATE: 2019-07-20
5+
#: VERSION: 0.1.1
66
#: AUTHOR: "Alex Y" <aleksandryackovlev@yandex.ru>
77
#: DESCRIPTION: Utils functions
88

0 commit comments

Comments
 (0)