Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
Tommypop2 committed Jan 22, 2025
1 parent 5a572f9 commit 4ce5f30
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 66 deletions.
18 changes: 9 additions & 9 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"mode": "pre",
"tag": "alpha",
"initialVersions": {
"@solid-cli/create": "0.6.0-alpha.0",
"create-solid": "0.6.0-alpha.1",
"@solid-cli/full": "0.6.0-alpha.0",
"@solid-cli/utils": "0.6.0-alpha.0"
},
"changesets": []
"mode": "pre",
"tag": "alpha",
"initialVersions": {
"@solid-cli/create": "0.6.0-alpha.0",
"create-solid": "0.6.0-alpha.1",
"@solid-cli/full": "0.6.0-alpha.0",
"@solid-cli/utils": "0.6.0-alpha.0"
},
"changesets": []
}
3 changes: 2 additions & 1 deletion packages/create/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export const createSolid = (version: string) =>
`cd ${projectName}
${pM.name} install
${pM.name} ${pM.runScriptCommand("dev")}`,
"To get started, run:");
"To get started, run:",
);
},
});
82 changes: 41 additions & 41 deletions packages/create/src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,60 +30,60 @@ Thumbs.db
`;

export const JS_CONFIG = {
compilerOptions: {
jsx: "preserve",
jsxImportSource: "solid-js",
paths: {
"~/*": ["./src/*"],
},
},
compilerOptions: {
jsx: "preserve",
jsxImportSource: "solid-js",
paths: {
"~/*": ["./src/*"],
},
},
};

// Supported templates

const VANILLA_TEMPLATES = [
"ts",
"ts-vitest",
"ts-uvu",
"ts-unocss",
"ts-tailwindcss",
"ts-sass",
"ts-router",
"ts-router-file-based",
"ts-minimal",
"ts-jest",
"ts-bootstrap",
"js",
"js-vitest",
"js-tailwindcss",
"ts",
"ts-vitest",
"ts-uvu",
"ts-unocss",
"ts-tailwindcss",
"ts-sass",
"ts-router",
"ts-router-file-based",
"ts-minimal",
"ts-jest",
"ts-bootstrap",
"js",
"js-vitest",
"js-tailwindcss",
] as const;
export type VanillaTemplate = (typeof VANILLA_TEMPLATES)[number];

const START_TEMPLATES = [
"basic",
"bare",
"hackernews",
"notes",
"todomvc",
"with-auth",
"with-authjs",
"with-drizzle",
"with-mdx",
"with-prisma",
"with-solid-styled",
"with-tailwindcss",
"with-trpc",
"with-unocss",
"with-vitest",
"experiments",
"basic",
"bare",
"hackernews",
"notes",
"todomvc",
"with-auth",
"with-authjs",
"with-drizzle",
"with-mdx",
"with-prisma",
"with-solid-styled",
"with-tailwindcss",
"with-trpc",
"with-unocss",
"with-vitest",
"experiments",
] as const;
export type StartTemplate = (typeof VANILLA_TEMPLATES)[number];

export const getTemplatesList = async (isStart: boolean) => {
if (isStart) {
return START_TEMPLATES;
}
return VANILLA_TEMPLATES;
if (isStart) {
return START_TEMPLATES;
}
return VANILLA_TEMPLATES;
};

//
10 changes: 5 additions & 5 deletions packages/create/tests/template.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { expect, it } from "vitest";
import { createVanilla } from "../src"
import { createVanilla } from "../src";
import { existsSync } from "fs";
it("downloads and extracts the typescript template", async () => {
await createVanilla({ template: "ts", destination: "./test/ts" }, false)
await createVanilla({ template: "ts", destination: "./test/ts" }, false);

const appTsx = existsSync("./test/ts/src/App.tsx");
expect(appTsx).toBe(true);
})
const appTsx = existsSync("./test/ts/src/App.tsx");
expect(appTsx).toBe(true);
});
4 changes: 2 additions & 2 deletions packages/full-solid/src/bin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as color from "picocolors";
intro(`\n${color.bgCyan(color.black(` Solid CLI v${packageJson.version}`))}`);

const main = defineCommand({
subCommands: { create: createSolid(packageJson.version) },
subCommands: { create: createSolid(packageJson.version) },
});

runMain(main);
runMain(main);
4 changes: 3 additions & 1 deletion packages/utils/src/fs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ export const readFileToString = async (path: string) => {
// unqueueUpdate(path, "file");
// queueUpdate({ type: "file", name: path, contents, checked: true });
// };
export const writeChecked = async (_path: string, _contents: string) => { throw new Error("Unimplemented") }
export const writeChecked = async (_path: string, _contents: string) => {
throw new Error("Unimplemented");
};
export const insertAtBeginning = async (path: string, text: string) => {
const contents = await readFileToString(path);
writeFile(path, text + contents);
Expand Down
9 changes: 4 additions & 5 deletions setup.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { TestProject } from 'vitest/node'
import type { TestProject } from "vitest/node";
import { existsSync, rmSync } from "fs";
export default function setup(project: TestProject) {
// Clean up test directory before running tests
if (existsSync("./test"))
rmSync("./test", { recursive: true })
}
// Clean up test directory before running tests
if (existsSync("./test")) rmSync("./test", { recursive: true });
}
4 changes: 2 additions & 2 deletions vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineConfig } from "vitest/config";
export default defineConfig({
test: { globalSetup: ["./setup.ts"] }
})
test: { globalSetup: ["./setup.ts"] },
});

0 comments on commit 4ce5f30

Please sign in to comment.