Start renaming
This commit is contained in:
+29
-28
@@ -37,24 +37,24 @@ export const HELP_TEXT = `
|
||||
${
|
||||
colors.bgRgb8(
|
||||
colors.rgb8(
|
||||
` 🍋 @fresh/init${colors.rgb8(`@${initConfig.version}`, 248)} `,
|
||||
` 🍋 @paulaboks/sweet-init${colors.rgb8(`@${initConfig.version}`, 248)} `,
|
||||
0,
|
||||
),
|
||||
121,
|
||||
)
|
||||
}
|
||||
|
||||
Initialize a new Fresh project. This will create all the necessary files
|
||||
Initialize a new Sweet project. This will create all the necessary files
|
||||
for a new project.
|
||||
|
||||
To generate a project in the './foobar' subdirectory:
|
||||
${colors.rgb8("deno run -Ar jsr:@fresh/init ./foobar", 245)}
|
||||
${colors.rgb8("deno run -Ar jsr:@paulaboks/sweet-init ./foobar", 245)}
|
||||
|
||||
To generate a project in the current directory:
|
||||
${colors.rgb8("deno run -Ar jsr:@fresh/init .", 245)}
|
||||
${colors.rgb8("deno run -Ar jsr:@paulaboks/sweet-init .", 245)}
|
||||
|
||||
${colors.rgb8("USAGE:", 3)}
|
||||
${colors.rgb8("deno run -Ar jsr:@fresh/init [DIRECTORY]", 245)}
|
||||
${colors.rgb8("deno run -Ar jsr:@paulaboks/sweet-init [DIRECTORY]", 245)}
|
||||
|
||||
${colors.rgb8("OPTIONS:", 3)}
|
||||
${colors.rgb8("--force", 2)} Overwrite existing files
|
||||
@@ -89,7 +89,10 @@ export async function initProject(
|
||||
skipInstall?: boolean | null;
|
||||
} = {},
|
||||
): Promise<void> {
|
||||
const freshVersion = await getLatestVersion("@fresh/core", FRESH_VERSION);
|
||||
const freshVersion = await getLatestVersion(
|
||||
"@paulaboks/sweet",
|
||||
FRESH_VERSION,
|
||||
);
|
||||
|
||||
if (flags.help || flags.h) {
|
||||
console.log(HELP_TEXT);
|
||||
@@ -99,7 +102,7 @@ export async function initProject(
|
||||
console.log();
|
||||
console.log(
|
||||
colors.bgRgb8(
|
||||
colors.rgb8(" 🍋 Fresh: The next-gen web framework. ", 0),
|
||||
colors.rgb8(" 🍬 Sweet: The next-gen web framework. ", 0),
|
||||
121,
|
||||
),
|
||||
);
|
||||
@@ -171,7 +174,7 @@ export async function initProject(
|
||||
.env.production.local
|
||||
.env.local
|
||||
|
||||
# Fresh build directory
|
||||
# Sweet build directory
|
||||
_fresh/
|
||||
# npm + other dependencies
|
||||
node_modules/
|
||||
@@ -395,7 +398,7 @@ import "./assets/styles.css";`,
|
||||
// Skip this and be silent if there is a network issue.
|
||||
}
|
||||
|
||||
const MAIN_TS = `import { App, staticFiles } from "fresh";
|
||||
const MAIN_TS = `import { App, staticFiles } from "sweet";
|
||||
import { define, type State } from "./utils.ts";
|
||||
|
||||
export const app = new App<State>();
|
||||
@@ -447,7 +450,7 @@ export function Button(props: ButtonProps) {
|
||||
}`;
|
||||
await writeFile("components/Button.tsx", COMPONENTS_BUTTON_TSX);
|
||||
|
||||
const UTILS_TS = `import { createDefine } from "fresh";
|
||||
const UTILS_TS = `import { createDefine } from "sweet";
|
||||
|
||||
// This specifies the type of "ctx.state" which is used to share
|
||||
// data among middlewares, layouts and routes.
|
||||
@@ -459,7 +462,7 @@ export const define = createDefine<State>();`;
|
||||
await writeFile("utils.ts", UTILS_TS);
|
||||
|
||||
const ROUTES_HOME = `import { useSignal } from "@preact/signals";
|
||||
import { Head } from "fresh/runtime";
|
||||
import { Head } from "sweet/runtime";
|
||||
import { define } from "../utils.ts";
|
||||
import Counter from "../islands/Counter.tsx";
|
||||
|
||||
@@ -471,7 +474,7 @@ export default define.page(function Home(ctx) {
|
||||
return (
|
||||
<div class="px-4 py-8 mx-auto fresh-gradient min-h-screen">
|
||||
<Head>
|
||||
<title>Fresh counter</title>
|
||||
<title>Sweet counter</title>
|
||||
</Head>
|
||||
<div class="max-w-screen-md mx-auto flex flex-col items-center justify-center">
|
||||
<img
|
||||
@@ -479,9 +482,9 @@ export default define.page(function Home(ctx) {
|
||||
src="/logo.svg"
|
||||
width="128"
|
||||
height="128"
|
||||
alt="the Fresh logo: a sliced lemon dripping with juice"
|
||||
alt="the Sweet logo"
|
||||
/>
|
||||
<h1 class="text-4xl font-bold">Welcome to Fresh</h1>
|
||||
<h1 class="text-4xl font-bold">Welcome to Sweet</h1>
|
||||
<p class="my-4">
|
||||
Try updating this message in the
|
||||
<code class="mx-2">./routes/index.tsx</code> file, and refresh.
|
||||
@@ -544,8 +547,8 @@ export default function Counter(props: CounterProps) {
|
||||
await writeFile("islands/Counter.tsx", ISLANDS_COUNTER_TSX);
|
||||
|
||||
const DEV_TS = `#!/usr/bin/env -S deno run -A --watch=static/,routes/
|
||||
${useTailwind ? `import { tailwind } from "@fresh/plugin-tailwind";\n` : ""}
|
||||
import { Builder } from "fresh/dev";
|
||||
${useTailwind ? `import { tailwind } from "@paulaboks/sweet-tailwind";\n` : ""}
|
||||
import { Builder } from "sweet/dev";
|
||||
|
||||
const builder = new Builder();
|
||||
${useTailwind ? "tailwind(builder);" : ""}
|
||||
@@ -566,7 +569,6 @@ if (Deno.args.includes("build")) {
|
||||
dev: "deno run -A --watch=static/,routes/ dev.ts",
|
||||
build: "deno run -A dev.ts build",
|
||||
start: "deno serve -A _fresh/server.js",
|
||||
update: "deno run -A -r jsr:@fresh/update .",
|
||||
},
|
||||
lint: {
|
||||
rules: {
|
||||
@@ -576,7 +578,7 @@ if (Deno.args.includes("build")) {
|
||||
exclude: ["**/_fresh/*"],
|
||||
imports: {
|
||||
"@/": "./",
|
||||
"fresh": `jsr:@fresh/core@^${freshVersion}`,
|
||||
"sweet": `jsr:@paulaboks/sweet@^${freshVersion}`,
|
||||
"preact": `npm:preact@^${PREACT_VERSION}`,
|
||||
"@preact/signals": `npm:@preact/signals@^${PREACT_SIGNALS_VERSION}`,
|
||||
} as Record<string, string>,
|
||||
@@ -609,12 +611,12 @@ if (Deno.args.includes("build")) {
|
||||
denoJson.tasks.build = "vite build";
|
||||
|
||||
const vitePluginVersion = await getLatestVersion(
|
||||
"@fresh/plugin-vite",
|
||||
"@paulaboks/sweet-vite",
|
||||
FRESH_VITE_PLUGIN,
|
||||
);
|
||||
|
||||
denoJson.imports["@fresh/plugin-vite"] =
|
||||
`jsr:@fresh/plugin-vite@^${vitePluginVersion}`;
|
||||
denoJson.imports["@paulaboks/sweet-vite"] =
|
||||
`jsr:@paulaboks/sweet-vite@^${vitePluginVersion}`;
|
||||
denoJson.imports["vite"] = "npm:vite@^7.1.3";
|
||||
denoJson.imports["@types/babel__core"] = "npm:@types/babel__core@^7.20.5";
|
||||
|
||||
@@ -625,8 +627,8 @@ if (Deno.args.includes("build")) {
|
||||
}
|
||||
} else if (useTailwind) {
|
||||
denoJson.imports["tailwindcss"] = `npm:tailwindcss@^${TAILWINDCSS_VERSION}`;
|
||||
denoJson.imports["@fresh/plugin-tailwind"] =
|
||||
`jsr:@fresh/plugin-tailwind@^${FRESH_TAILWIND_VERSION}`;
|
||||
denoJson.imports["@paulaboks/sweet-tailwind"] =
|
||||
`jsr:@paulaboks/sweet-tailwind@^${FRESH_TAILWIND_VERSION}`;
|
||||
denoJson.imports["@tailwindcss/postcss"] =
|
||||
`npm:@tailwindcss/postcss@^${TAILWINDCSS_POSTCSS_VERSION}`;
|
||||
denoJson.imports["postcss"] = `npm:postcss@^${POSTCSS_VERSION}`;
|
||||
@@ -636,23 +638,22 @@ if (Deno.args.includes("build")) {
|
||||
|
||||
if (useVite) {
|
||||
let viteConfig = `import { defineConfig } from "vite";
|
||||
import { fresh } from "@fresh/plugin-vite";\n`;
|
||||
import { sweet } from "@paulaboks/sweet-vite";\n`;
|
||||
|
||||
if (useTailwind) {
|
||||
viteConfig += `import tailwindcss from "@tailwindcss/vite";\n`;
|
||||
}
|
||||
|
||||
viteConfig += `\nexport default defineConfig({
|
||||
plugins: [fresh()${useTailwind ? ", tailwindcss()" : ""}],
|
||||
plugins: [sweet()${useTailwind ? ", tailwindcss()" : ""}],
|
||||
});`;
|
||||
|
||||
await writeFile("vite.config.ts", viteConfig);
|
||||
}
|
||||
|
||||
const README_MD = `# Fresh project
|
||||
const README_MD = `# Sweet project
|
||||
|
||||
Your new Fresh project is ready to go. You can follow the Fresh "Getting
|
||||
Started" guide here: https://usefresh.dev/docs/getting-started
|
||||
Your new Sweet project is ready to go.
|
||||
|
||||
### Usage
|
||||
|
||||
|
||||
Reference in New Issue
Block a user