Skip to content

Commit

Permalink
v1.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisCates committed Jul 26, 2022
1 parent e2b4b10 commit 2094b70
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# 🛠️ CHANGELOG

## v1.1.2

- Array Typed injections were patched to use [...] instead of {...} for spread assignment.

## v1.1.1

- Made sure type injections support array namespaces
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
## Automation Tooling for Next, Redux and Prisma

![license](https://img.shields.io/badge/license-AGPLv3-blue.svg)
![version](https://img.shields.io/badge/version-1.1.1-blue.svg)
![version](https://img.shields.io/badge/version-1.1.2-blue.svg)
[![CircleCI](https://circleci.com/gh/PrinterFramework/CLI.svg?style=svg)](https://circleci.com/gh/PrinterFramework/CLI)
[![codecov](https://codecov.io/gh/PrinterFramework/CLI/branch/master/graph/badge.svg)](https://codecov.io/gh/PrinterFramework/CLI)

Expand Down
8 changes: 6 additions & 2 deletions dist/src/generators/inject.js

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

2 changes: 1 addition & 1 deletion dist/src/generators/inject.js.map

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

2 changes: 1 addition & 1 deletion dist/src/printer.js

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@printerframework/cli",
"description": "🖨️ Automation Tooling for Next, Redux and Prisma.",
"version": "1.1.1",
"version": "1.1.2",
"private": false,
"preferGlobal": true,
"repository": "https://github.com/PrinterFramework/CLI.git",
Expand Down
7 changes: 6 additions & 1 deletion src/generators/inject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ export async function inject (slice: string, component: string) {

let typeMap = 'any'
let value = stateInjection.value
let spreadLeft = '{'
let spreadRight = '}'

if (stateInjection.type) {
let typeName = stateInjection.type[0].toUpperCase() + stateInjection.type.substring(1) + 'Type'
Expand All @@ -91,9 +93,12 @@ export async function inject (slice: string, component: string) {
value = value.replaceAll('[]', '')
}
typeMap = `{ ${stateInjection.type.replaceAll('[]', '')}: { ${value}: ${typeName} } }`

spreadLeft = '['
spreadRight = ']'
}

tempContents[injectionLine] = tempContents[injectionLine] + `\n const ${value} = useSelector((state: ${typeMap}) => ({ ...state.${slice}.${value} }))`
tempContents[injectionLine] = tempContents[injectionLine] + `\n const ${value} = useSelector((state: ${typeMap}) => (${spreadLeft} ...state.${slice}.${value} ${spreadRight}))`

if (i === stateInjections.length - 1) {
tempContents[injectionLine] = tempContents[injectionLine] + '\n'
Expand Down
2 changes: 1 addition & 1 deletion src/printer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { inject } from './generators/inject'
export const Printer = new Command('🖨️ Printer')

Printer
.version('1.1.1')
.version('1.1.2')
.description('🖨️ Printer: Automation Tooling for Next, Redux and Prisma.')

Printer
Expand Down

0 comments on commit 2094b70

Please sign in to comment.