Skip to content

Commit

Permalink
refactor: use import to get the package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
mateushnsoares authored and Mikael-R committed Oct 2, 2020
1 parent dbf4253 commit 853c416
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 48 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "readme-template-generator",
"version": "0.9.8",
"version": "0.9.9",
"description": "CLI to help create readme file to document your project",
"private": false,
"repository": {
Expand Down
7 changes: 4 additions & 3 deletions src/commands/readme-template-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { GluegunCommand } from 'gluegun'
import ExtendedGluegunToolbox from 'src/interfaces/extended-gluegun-toolbox'
import * as Types from 'src/types'

// @ts-ignore
import packageJSON from '../../package.json'

const command: GluegunCommand = {
name: 'readme-template-generator',
description: 'Generate README file in current work directory',
Expand Down Expand Up @@ -38,8 +41,6 @@ const command: GluegunCommand = {
if (!overwrite) process.exit(0)
}

const packageJSON: Types.PackageJSON = read('package.json', 'json')

const githubRepoURL: string = await question({
message: '🎥 Repository URL in GitHub (recommend not skip):',
defaultValue:
Expand Down Expand Up @@ -408,7 +409,7 @@ const command: GluegunCommand = {
githubRepository,
herokuUrl,
replitUrl,
packageJSON,
packageJSON: packageJSON,
status,
images,
description,
Expand Down
15 changes: 8 additions & 7 deletions src/interfaces/extended-gluegun-toolbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ import { Question } from 'src/extensions/question'
import { ShowBanner } from 'src/extensions/showBanner'
import { GithubRepoInfo } from 'src/extensions/githubRepoInfo'

export default interface ExtendedGluegunToolbox extends IHelperExtendedGluegunToolbox {
existingFiles: ExistingFiles,
generateFile: GenerateFile,
itemURL: ItemURL,
isWebURL: IsWebURL,
question: Question,
showBanner: ShowBanner,
export default interface ExtendedGluegunToolbox
extends IHelperExtendedGluegunToolbox {
existingFiles: ExistingFiles
generateFile: GenerateFile
itemURL: ItemURL
isWebURL: IsWebURL
question: Question
showBanner: ShowBanner
githubRepoInfo: GithubRepoInfo
}
37 changes: 0 additions & 37 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,40 +1,3 @@
export interface PackageJSON {
name?: string
version?: string
description?: string
keywords?: string[]
homepage?: any
bugs?: any
license?: string
author?: any
contributors?: any[]
maintainers?: any[]
files?: string[]
main?: string
bin?: any
interfaces?: string
typings?: string
man?: string[]
directories?: any
repository?: any
scripts?: {
[k: string]: string
}
config?: {
[k: string]: any
}
dependencies?: any
devDependencies?: any
optionalDependencies?: any
peerDependencies?: any
resolutions?: any
engines?: {
[k: string]: string
}
private?: boolean
[k: string]: any
}

export interface Images {
logo: string
screenshots: string[]
Expand Down

0 comments on commit 853c416

Please sign in to comment.