-
-
Notifications
You must be signed in to change notification settings - Fork 59
feat: add create
and add
commands
#16
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
Merged
Merged
Changes from all commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
d59d340
use `none` instead of `null`
AdrianGonz97 116cccd
change `default` to `demo`
AdrianGonz97 77920b0
initial `create` command
AdrianGonz97 1505c33
not needed
AdrianGonz97 e570384
move config directly into `adders`
AdrianGonz97 9de4bd8
missed a spot
AdrianGonz97 48d6173
run adder wizard after `create`
AdrianGonz97 9c316d1
initial `add` cmd implementation
AdrianGonz97 f47ce63
add global preconditions
AdrianGonz97 6d5678b
tweak types
AdrianGonz97 bd546da
tweak
AdrianGonz97 3380842
validate workspace
AdrianGonz97 6b5b33d
update entry
AdrianGonz97 767af1b
no longer necessary
AdrianGonz97 13a8f88
try to reduce core to its essentials
AdrianGonz97 4e8acbb
tweaks
AdrianGonz97 efa766a
log errors
AdrianGonz97 37b1912
word
AdrianGonz97 f15ba41
add community adders
AdrianGonz97 25786e6
lint
AdrianGonz97 9336428
todo
AdrianGonz97 1b3eb61
types
AdrianGonz97 876b5dc
am i going insane?
AdrianGonz97 8217d5c
Merge branch 'main' into feat/add-subcommands
AdrianGonz97 2cf6fe1
yea ok. no idea why this is only failing in CI. disabling you for now
AdrianGonz97 962c85a
tweaks and expose findUp
AdrianGonz97 bae2396
infer workspace if we're in a child directory of one
AdrianGonz97 2e89184
only format if there are files to format
AdrianGonz97 79469a0
apply code review suggestions
AdrianGonz97 5fc5a3d
re-enable linting rule and fix errors
manuel3108 e64a46b
fix type
AdrianGonz97 fbe1cfb
derive adder details from categories
AdrianGonz97 be078ad
dont prompt if a directory is specified
AdrianGonz97 3dd2d0a
wording
AdrianGonz97 a4ae9f5
prompt to install deps when `--no-adders` is set
AdrianGonz97 21d892f
skip install if specified
AdrianGonz97 bfe8153
add `sv` to the root workspace
AdrianGonz97 d7064cc
Merge branch 'main' into feat/add-subcommands
AdrianGonz97 13c0409
initial adder option flags implementation
AdrianGonz97 93c84b2
tweak error
AdrianGonz97 5c21342
fix order
AdrianGonz97 ec6828d
validate workspace when `--cwd` is specified
AdrianGonz97 ebb4f8c
adjust create template order
AdrianGonz97 38a62ea
add basic choices to help cmd
AdrianGonz97 b26c388
set initial value of the install prompt to the current pm
AdrianGonz97 0df1af7
tweak
AdrianGonz97 bc4dfdb
unnecessary
AdrianGonz97 ccc8cc9
print next steps for `create`
AdrianGonz97 31aff01
i borked it - fixed
AdrianGonz97 7ef6540
ugh
AdrianGonz97 e3950c5
silly
AdrianGonz97 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export { adderIds, adderCategories, getAdderDetails } from './official'; | ||
export { categories, type CategoryKeys, type CategoryInfo } from './categories'; | ||
export { communityAdders } from './community'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import type { AdderCategories } from './categories'; | ||
import type { AdderWithoutExplicitArgs } from '@svelte-cli/core'; | ||
|
||
// adders | ||
import drizzle from '../drizzle'; | ||
import eslint from '../eslint'; | ||
import mdsvex from '../mdsvex'; | ||
import playwright from '../playwright'; | ||
import prettier from '../prettier'; | ||
import routify from '../routify'; | ||
import storybook from '../storybook'; | ||
import tailwindcss from '../tailwindcss'; | ||
import vitest from '../vitest'; | ||
|
||
const categories = { | ||
codeQuality: [prettier, eslint], | ||
testing: [vitest, playwright], | ||
css: [tailwindcss], | ||
db: [drizzle], | ||
additional: [storybook, mdsvex, routify] | ||
}; | ||
|
||
export const adderCategories: AdderCategories = getCategoriesById(); | ||
|
||
function getCategoriesById(): AdderCategories { | ||
const adderCategories: any = {}; | ||
for (const [key, adders] of Object.entries(categories)) { | ||
adderCategories[key] = adders.map((a) => a.config.metadata.id); | ||
} | ||
return adderCategories; | ||
} | ||
|
||
export const adderIds: string[] = Object.values(adderCategories).flatMap((x) => x); | ||
|
||
const adderDetails = Object.values(categories).flat(); | ||
|
||
export function getAdderDetails(name: string): AdderWithoutExplicitArgs { | ||
const details = adderDetails.find((a) => a.config.metadata.id === name); | ||
if (!details) { | ||
throw new Error(`invalid adder name: ${name}`); | ||
} | ||
|
||
return details as AdderWithoutExplicitArgs; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1 @@ | ||
import type { AdderConfig, AdderWithoutExplicitArgs, Question } from '@svelte-cli/core'; | ||
|
||
export async function getAdderDetails(name: string) { | ||
const adder: { default: AdderWithoutExplicitArgs } = await import(`./${name}/index.ts`); | ||
|
||
return adder.default; | ||
} | ||
|
||
export async function getAdderConfig(name: string) { | ||
// Mainly used by the website | ||
// Either vite / rollup or esbuild are not able to process the shebangs | ||
// present on the `index.js` file. That's why we directly import the configuration | ||
// for the website here, as this is the only important part. | ||
|
||
const adder: Promise<{ adder: AdderConfig<Record<string, Question>> }> = await import( | ||
`./${name}/config/adder.ts` | ||
); | ||
const { adder: adderConfig } = await adder; | ||
|
||
return adderConfig; | ||
} | ||
export * from './_config/index'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.