-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add deno adapter * create domco - deno * changeset * add docs * bump / doc
- Loading branch information
1 parent
f38238a
commit d52d692
Showing
34 changed files
with
765 additions
and
391 deletions.
There are no files selected for viewing
This file contains 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,5 @@ | ||
--- | ||
"domco": minor | ||
--- | ||
|
||
Adds `deno deploy` adapter |
This file contains 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,5 @@ | ||
--- | ||
"create-domco": patch | ||
--- | ||
|
||
add `deno` as a pm -- detects and outputs deno project template |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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,100 +1,4 @@ | ||
#!/usr/bin/env node | ||
import { getFiles } from "./template/index.js"; | ||
import * as p from "@clack/prompts"; | ||
import { writeFile, mkdir } from "node:fs/promises"; | ||
import { dirname, join } from "node:path"; | ||
import process from "node:process"; | ||
import whichPmRuns from "which-pm-runs"; | ||
import { createDomco } from "./index.js"; | ||
|
||
/** | ||
* Writes an array of files to the specified directory. | ||
* @param directory - the directory to write the files to | ||
* @param files - the files to write | ||
* @returns a Promise that resolves when all the files have been written | ||
*/ | ||
const writeFiles = async ( | ||
directory: string, | ||
files: { name: string; contents: string }[], | ||
) => { | ||
return Promise.all( | ||
files.map(async (file) => { | ||
const filePath = join(directory, file.name); | ||
const fileDirectory = dirname(filePath); | ||
|
||
// Ensure directory exists | ||
await mkdir(fileDirectory, { recursive: true }); | ||
|
||
// Write file | ||
return writeFile(filePath, file.contents); | ||
}), | ||
); | ||
}; | ||
|
||
const pm = whichPmRuns()?.name || "npm"; | ||
|
||
p.intro("Welcome to domco"); | ||
|
||
let dir = await p.text({ | ||
message: "Where should your project be created?", | ||
defaultValue: ".", | ||
placeholder: "(Enter for current directory)", | ||
}); | ||
|
||
if (p.isCancel(dir)) { | ||
p.cancel("Operation cancelled."); | ||
process.exit(0); | ||
} else { | ||
const lang = await p.select({ | ||
message: "Select language", | ||
options: [ | ||
{ label: "TypeScript", value: "ts" }, | ||
{ label: "JavaScript", value: "js" }, | ||
], | ||
}); | ||
|
||
if (p.isCancel(lang)) { | ||
p.cancel("Operation cancelled."); | ||
process.exit(0); | ||
} else { | ||
const extras = await p.multiselect({ | ||
message: "Select additional options (use arrow keys/space bar)", | ||
required: false, | ||
options: [ | ||
{ | ||
value: "prettier", | ||
label: "Add Prettier for formatting", | ||
}, | ||
{ | ||
value: "tailwind", | ||
label: "Add TailwindCSS for styling", | ||
}, | ||
], | ||
}); | ||
|
||
if (p.isCancel(extras)) { | ||
p.cancel("Operation cancelled."); | ||
process.exit(0); | ||
} else { | ||
const prettier = extras.includes("prettier"); | ||
const tailwind = extras.includes("tailwind"); | ||
|
||
const s = p.spinner(); | ||
|
||
s.start("Creating project"); | ||
|
||
await writeFiles( | ||
dir, | ||
getFiles({ lang: String(lang), prettier, tailwind }), | ||
); | ||
|
||
s.stop("Files created"); | ||
|
||
p.note( | ||
`${dir === "." ? "" : `cd ${dir}\n`}${pm} install\n${pm} run dev`, | ||
`Next steps`, | ||
); | ||
|
||
p.outro(`https://github.com/rossrobino/domco`); | ||
} | ||
} | ||
} | ||
createDomco(); |
This file contains 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,10 @@ | ||
export const dependencies = { | ||
domco: "0.12.0", | ||
hono: "4.6.1", | ||
autoprefixer: "10.4.20", | ||
prettier: "3.3.3", | ||
prettierTailwind: "0.6.6", | ||
tailwind: "3.4.11", | ||
typescript: "5.6.0", | ||
vite: "5.4.3", | ||
} as const; |
Oops, something went wrong.