Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.1.7 - refining cli code structure and naming conventions to get ready for more complex installable files/code #9

Merged
merged 18 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dist/generators/jetstream/generateConfigJetstream.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default function (jetstreamGitignoreText: string): string;
21 changes: 21 additions & 0 deletions dist/generators/jetstream/generateConfigJetstream.js

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

1 change: 1 addition & 0 deletions dist/generators/jetstream/generateConfigJetstream.js.map

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

1 change: 0 additions & 1 deletion dist/generators/jetstream/generateJetstreamGitignore.js

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

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

1 change: 1 addition & 0 deletions dist/helpers/cliSuccessMessage.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default function (string: string, prefixLineBreak?: boolean, suffixLineBreak?: boolean): void;
12 changes: 12 additions & 0 deletions dist/helpers/cliSuccessMessage.js

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

1 change: 1 addition & 0 deletions dist/helpers/cliSuccessMessage.js.map

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

1 change: 1 addition & 0 deletions dist/helpers/cliWarningMessage.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default function (string: string, prefixLineBreak?: boolean, suffixLineBreak?: boolean): void;
12 changes: 12 additions & 0 deletions dist/helpers/cliWarningMessage.js

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

1 change: 1 addition & 0 deletions dist/helpers/cliWarningMessage.js.map

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

1 change: 1 addition & 0 deletions dist/helpers/projectFileDoesExist.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default function (filepath: string): boolean;
16 changes: 16 additions & 0 deletions dist/helpers/projectFileDoesExist.js

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

1 change: 1 addition & 0 deletions dist/helpers/projectFileDoesExist.js.map

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

4 changes: 4 additions & 0 deletions dist/index.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/index.js.map

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

6 changes: 4 additions & 2 deletions dist/installers/installViltDsJetstream.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/installers/installViltDsJetstream.js.map

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

1 change: 0 additions & 1 deletion dist/installers/jetstream/installJetstreamGitignore.js.map

This file was deleted.

26 changes: 26 additions & 0 deletions dist/updaters/jetstream/updateConfigJetstream.js

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

1 change: 1 addition & 0 deletions dist/updaters/jetstream/updateConfigJetstream.js.map

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

1 change: 1 addition & 0 deletions dist/updaters/jetstream/updateJetstreamGitignore.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default function (): void;

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

1 change: 1 addition & 0 deletions dist/updaters/jetstream/updateJetstreamGitignore.js.map

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

4 changes: 2 additions & 2 deletions package-lock.json

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

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"name": "@obewds/vilt-ds",
"version": "0.1.6",
"version": "0.1.7",
"description": "The official repository for the VILT Design System for the Vue.js, Inertia.js, Laravel, and Tailwind CSS web app stack that is turbocharged with Typescript and VueVentus.",
"license": "MIT",
"author": "Matt McT",
"main": "src/index.js",
"type": "module",
"scripts": {
"build": "tsc",
"build": "npx rimraf dist && tsc",
"pkg:org": "npm config set scope obewds",
"tag": "PACKAGE_VERSION=$(cat package.json | grep \\\"version\\\" | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]') && git tag v$PACKAGE_VERSION && git push --tags",
"bump:patch": "npm version patch && npx rimraf dist && npm run build",
"bump:minor": "npm version minor && npx rimraf dist && npm run build",
"bump:major": "npm version major && npx rimraf dist && npm run build"
"bump:patch": "npm version patch && npm run build",
"bump:minor": "npm version minor && npm run build",
"bump:major": "npm version major && npm run build"
},
"files": [
"dist"
Expand Down
35 changes: 35 additions & 0 deletions src/generators/jetstream/generateConfigJetstream.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// ./src/generators/jetstream/generateConfigJetstream.ts

import fs from 'fs-extra'

import cwd from '../../helpers/cwd.js'
import projectFileDoesExist from '../../helpers/projectFileDoesExist.js'

export default function (jetstreamGitignoreText:string): string {

const filename = 'jetstream.php'
const filepath = '/config/' + filename

if ( projectFileDoesExist(filepath) ) {

fs.readFile(cwd + filepath, 'utf8', function(err, data) {

// error check
if (err) { throw err }

let modifiedData = String(data).replace(
/\/\/Features::termsAndPrivacyPolicy(),/g, 'Features::termsAndPrivacyPolicy(),'
).replace(
/\/\/Features::api(),/g, 'Features::api(),'
)

// If no error, then overwrite the current gitignore file content wrapped in VILT DS gitignore code
// fs.outputFileSync(cwd + filepath, generateJetstreamGitignore(String(data)), { flag: 'w+' })

})

}

return ''

}
1 change: 0 additions & 1 deletion src/generators/jetstream/generateJetstreamGitignore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ ${developer}
${mac}

${windows}

`;

}
13 changes: 13 additions & 0 deletions src/helpers/cliSuccessMessage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// ./cli/helpers/cliSuccessMessage.ts

import gradientText from './gradientText.js'

export default function (string:string, prefixLineBreak:boolean = false, suffixLineBreak:boolean = false): void {

if (prefixLineBreak) { console.log(' ') }

console.log(gradientText(string))

if (suffixLineBreak) { console.log(' ') }

}
13 changes: 13 additions & 0 deletions src/helpers/cliWarningMessage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// ./cli/helpers/cliWarningMessage.ts

import gradient from 'gradient-string'

export default function (string:string, prefixLineBreak:boolean = false, suffixLineBreak:boolean = false): void {

if (prefixLineBreak) { console.log(' ') }

console.log(gradient.morning(string))

if (suffixLineBreak) { console.log(' ') }

}
20 changes: 20 additions & 0 deletions src/helpers/projectFileDoesExist.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// ./src/helpers/projectFileDoesExist.ts

import fs from 'fs-extra'

import cwd from './cwd.js'

export default function (filepath:string): boolean {

const currentFilepath = cwd + filepath

try {
if (fs.existsSync(currentFilepath)) {
return true
}
} catch(err) {
console.error(err)
return false
}

}
7 changes: 4 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ import installViltDsJetstream from './installers/installViltDsJetstream.js'

let userInstallation: ViltDsInstallationChoice = null

// Show a starting CLI greeting message
cliStartMessage()

// Inquire the type of installation type from the cli user
userInstallation = await selectInstallation()

console.log(' ')

// For a standard installation with an existing
// Laravel + Jetstream install in a current working (root) directory
if (userInstallation === 'Install VILT DS Into A Laravel Jetstream Starter App') {

installViltDsJetstream()

}
7 changes: 5 additions & 2 deletions src/installers/installViltDsJetstream.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
// ./src/installers/installViltDsJetstream.ts

import installJetstreamGitignore from '../installers/jetstream/installJetstreamGitignore.js'
import updateConfigJetstream from '../updaters/jetstream/updateConfigJetstream.js'
import updateJetstreamGitignore from '../updaters/jetstream/updateJetstreamGitignore.js'

export default function (): void {

installJetstreamGitignore()
updateJetstreamGitignore()

updateConfigJetstream()

}
Loading