8000 chore: make `text` the default `contentType` (#72) · sveltejs/cli@fda158e · GitHub
[go: up one dir, main page]

Skip to content

Commit fda158e

Browse files
chore: make text the default contentType (#72)
* chore: make text the default contentType * Update packages/core/files/processors.ts Co-authored-by: CokaKoala <31664583+AdrianGonz97@users.noreply.github.com> * Update packages/core/files/processors.ts Co-authored-by: CokaKoala <31664583+AdrianGonz97@users.noreply.github.com> * try again * update community template --------- Co-authored-by: CokaKoala <31664583+AdrianGonz97@users.noreply.github.com>
1 parent 2c48a41 commit fda158e

File tree

9 files changed

+2
-18
lines changed

9 files changed

+2
-18
lines changed

community-adder-template/src/config/adder.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export const adder = defineAdderConfig({
1515
files: [
1616
{
1717
name: () => 'adder-template-demo.txt',
18-
contentType: 'text',
1918
content: ({ content, options }) => {
2019
if (options.demo) {
2120
return 'This is a text file made by the Community Adder Template demo!';

packages/adders/drizzle/config/adder.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,14 @@ export const adder = defineAdderConfig({
7474
files: [
7575
{
7676
name: () => '.env',
77-
contentType: 'text',
7877
content: generateEnvFileContent
7978
},
8079
{
8180
name: () => '.env.example',
82-
contentType: 'text',
8381
content: generateEnvFileContent
8482
},
8583
{
8684
name: () => 'docker-compose.yml',
87-
contentType: 'text',
8885
condition: ({ options }) =>
8986
options.docker && (options.mysql === 'mysql2' || options.postgresql === 'postgres.js'),
9087
content: ({ content, options }) => {
@@ -142,7 +139,6 @@ export const adder = defineAdderConfig({
142139
{
143140
// Adds the db file to the gitignore if an ignore is present
144141
name: () => '.gitignore',
145-
contentType: 'text',
146142
condition: ({ options }) => options.database === 'sqlite',
147143
content: ({ content }) => {
148144
if (content.length === 0) return content;

packages/adders/drizzle/config/tests.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ export const tests = defineAdderTests({
6565
{
6666
// override the config so we can remove strict mode
6767
name: ({ typescript }) => `drizzle.config.${typescript ? 'ts' : 'js'}`,
68-
contentType: 'text',
6968
condition: ({ kit }) => Boolean(kit),
7069
content: ({ content }) => {
7170
return content.replace('strict: true,', '');

packages/adders/lucia/config/adder.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,6 @@ export const adder = defineAdderConfig({
476476
name: ({ kit, typescript }) =>
477477
`${kit!.routesDirectory}/demo/login/+page.server.${typescript ? 'ts' : 'js'}`,
478478
condition: ({ options }) => options.demo,
479-
contentType: 'text',
480479
content({ content, typescript }) {
481480
if (content) {
482481
log.warn(
@@ -622,7 +621,6 @@ export const adder = defineAdderConfig({
622621
{
623622
name: ({ kit }) => `${kit!.routesDirectory}/demo/login/+page.svelte`,
624623
condition: ({ options }) => options.demo,
625-
contentType: 'text',
626624
content({ content, typescript }) {
627625
if (content) {
628626
log.warn(`Existing ${colors.yellow('/demo/login/+page.svelte')} file. Could not update.`);
@@ -660,7 +658,6 @@ export const adder = defineAdderConfig({
660658
name: ({ kit, typescript }) =>
661659
`${kit!.routesDirectory}/demo/+page.server.${typescript ? 'ts' : 'js'}`,
662660
condition: ({ options }) => options.demo,
663-
contentType: 'text',
664661
content({ content, typescript }) {
665662
if (content) {
666663
log.warn(
@@ -704,7 +701,6 @@ export const adder = defineAdderConfig({
704701
{
705702
name: ({ kit }) => `${kit!.routesDirectory}/demo/+page.svelte`,
706703
condition: ({ options }) => options.demo,
707-
contentType: 'text',
708704
content({ content, typescript }) {
709705
if (content) {
710706
log.warn(`Existing ${colors.yellow('/demo/+page.svelte')} file. Could not update.`);

packages/adders/mdsvex/config/tests.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,11 @@ export const tests = defineAdderTests({
2424
},
2525
{
2626
name: ({ kit }) => `${kit?.routesDirectory}/Demo.svx`,
27-
contentType: 'text',
2827
content: addMarkdownFile,
2928
condition: ({ kit }) => Boolean(kit)
3029
},
3130
{
3231
name: () => 'src/Demo.svx',
33-
contentType: 'text',
3432
content: addMarkdownFile,
3533
condition: ({ kit }) => !kit
3634
}

packages/adders/playwright/config/adder.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export const adder = defineAdderConfig({
3535
},
3636
{
3737
name: () => '.gitignore',
38-
contentType: 'text',
3938
condition: ({ cwd }) => fs.existsSync(join(cwd, '.gitignore')),
4039
content: ({ content }) => {
4140
if (content.includes('test-results')) return content;
@@ -44,7 +43,6 @@ export const adder = defineAdderConfig({
4443
},
4544
{
4645
name: ({ typescript }) => `e2e/demo.test.${typescript ? 'ts' : 'js'}`,
47-
contentType: 'text',
4846
content: ({ content }) => {
4947
if (content) return content;
5048

packages/adders/prettier/config/adder.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ export const adder = defineAdderConfig({
2929
files: [
3030
{
3131
name: () => '.prettierignore',
32-
contentType: 'text',
3332
content: ({ content }) => {
3433
if (content) return content;
3534
return dedent`

packages/adders/vitest/config/adder.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ export const adder = defineAdderConfig({
3434
},
3535
{
3636
name: ({ typescript }) => `src/demo.spec.${typescript ? 'ts' : 'js'}`,
37-
contentType: 'text',
3837
content: ({ content }) => {
3938
if (content) return content;
4039

packages/core/files/processors.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ type SvelteFile<Args extends OptionDefinition> = {
5454
content: (editor: SvelteFileEditor<Args>) => void;
5555
};
5656
type TextFile<Args extends OptionDefinition> = {
57-
contentType: 'text';
57+
contentType?: undefined;
5858
content: (editor: TextFileEditor<Args>) => string;
5959
};
6060

@@ -107,7 +107,7 @@ export function createOrUpdateFiles<Args extends OptionDefinition>(
107107
if (fileDetails.contentType === 'svelte') {
108108
content = handleSvelteFile(content, fileDetails, workspace);
109109
}
110-
if (fileDetails.contentType === 'text') {
110+
if (!fileDetails.contentType) {
111111
content = handleTextFile(content, fileDetails, workspace);
112112
}
113113

0 commit comments

Comments
 (0)
0