-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
feat: Onboarding Setup #956
base: main
Are you sure you want to change the base?
Changes from all commits
6cf799e
1f317a3
b5c8dc3
18fdefe
2463f1a
2b7c1cf
ccd312a
df35816
5fabfc0
231da65
4e3c457
430636e
86bb24b
c74d767
6a9cead
e1e8f8a
4eddff2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import { setTimeout } from 'node:timers/promises' | ||
import * as p from '@clack/prompts' | ||
import color from 'picocolors' | ||
import { runCommand } from '@stacksjs/cli' | ||
import { path } from '@stacksjs/path' | ||
|
||
async function main() { | ||
console.clear() | ||
|
||
await setTimeout(1000) | ||
|
||
p.intro(`Stacks ${color.bgCyan(color.black(' create-app '))}`) | ||
|
||
const defaultFolderPath = './stacks' | ||
|
||
const project = await p.group( | ||
{ | ||
path: () => | ||
p.text({ | ||
message: 'Where should we create your project?', | ||
initialValue: defaultFolderPath, | ||
placeholder: defaultFolderPath, | ||
validate: (value) => { | ||
if (!value) | ||
return 'Please enter a path.' | ||
if (value[0] !== '.') | ||
return 'Please enter a relative path.' | ||
}, | ||
}), | ||
type: ({ results }) => | ||
p.select({ | ||
message: `Pick your flavor ("${results.path}")`, | ||
initialValue: 'default', | ||
maxItems: 3, | ||
options: [ | ||
{ value: 'default', label: 'Default (UI with API)' }, | ||
{ value: 'ui', label: 'UI' }, | ||
{ value: 'api', label: 'API' }, | ||
], | ||
}), | ||
modules: () => | ||
p.multiselect({ | ||
message: 'Select additional modules.', | ||
initialValues: ['prettier', 'eslint'], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unsure why prettier is here. We don't use it, and actively suggest people not to use it in combination with Stacks formatting 👍 |
||
options: [ | ||
{ value: 'database', label: 'Database', hint: 'recommended' }, | ||
{ value: 'search', label: 'Search', hint: 'recommended' }, | ||
{ | ||
value: 'notifications', | ||
label: 'Notifications (email, sms, chat)', | ||
}, | ||
{ value: 'cache', label: 'Cache' }, | ||
], | ||
}), | ||
}, | ||
{ | ||
onCancel: () => { | ||
p.cancel('Operation cancelled.') | ||
process.exit(0) | ||
}, | ||
}, | ||
) | ||
|
||
const s = p.spinner() | ||
|
||
s.start('Creating new project') | ||
await runCommand(`${path.projectPath('buddy')} new ${project.path}`) | ||
s.stop('Created new project') | ||
|
||
const nextSteps = `cd ${project.path} \nbun run dev` | ||
|
||
p.note(nextSteps, 'Next steps.') | ||
|
||
p.outro( | ||
`Problems? ${color.underline(color.cyan('https://github.com/stacksjs/stacks/issues'))}`, | ||
) | ||
} | ||
|
||
main().catch(console.error) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "stacks-onboarding", | ||
"version": "0.0.1", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"@clack/core": "^0.3.4", | ||
"@clack/prompts": "^0.7.0", | ||
"picocolors": "^1.0.0" | ||
} | ||
} | ||
Comment on lines
+1
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This shouldn't be here and extracted to core packages, placed where appropriate, like the cli package. We may already may require these deps elsewhere too |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"compilerOptions": { | ||
"noEmit": true, | ||
"module": "ESNext", | ||
"target": "ESNext", | ||
"moduleResolution": "node", | ||
"strict": true, | ||
"esModuleInterop": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"skipLibCheck": true | ||
}, | ||
"include": ["packages"] | ||
} | ||
Comment on lines
+1
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This also isn't needed then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to finish this