Skip to content
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

feat: switched from tiged to giget #63

Merged
merged 3 commits into from
Aug 3, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
"esbuild": "^0.16.17",
"eslint": "^8.55.0",
"execa": "^8.0.1",
"giget": "^1.2.3",
"nanospinner": "^1.1.0",
"np": "^7.6.3",
"prettier": "^3.3.3",
"tiged": "^2.12.7",
"tsx": "^4.7.1",
"typescript": "^5.3.3",
"vitest": "^0.34.6",
Expand Down
28 changes: 11 additions & 17 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import confirm from '@inquirer/confirm'
import input from '@inquirer/input'
import select from '@inquirer/select'
import chalk from 'chalk'
import { downloadTemplate } from 'giget'
import { createSpinner } from 'nanospinner'
// @ts-expect-error tiged does not have types
import tiged from 'tiged'
import yargsParser from 'yargs-parser'
import { version } from '../package.json'
import { projectDependenciesHook } from './hook'
Expand All @@ -19,7 +18,7 @@ const config = {
repository: 'starter',
user: 'honojs',
ref: 'main',
}
} as const

const templates = [
'aws-lambda',
Expand Down Expand Up @@ -112,19 +111,14 @@ async function main() {
const targetDirectoryPath = path.join(process.cwd(), target)
const spinner = createSpinner('Cloning the template').start()

await new Promise((res) => {
const emitter = tiged(
`${config.user}/${config.repository}/${config.directory}/${templateName}#${config.ref}`,
{
cache: false,
force: true,
},
)
emitter.clone(targetDirectoryPath).then(() => {
spinner.success()
res({})
})
})
await downloadTemplate(
`${config.user}/${config.repository}/${config.directory}/${templateName}#${config.ref}`,
{
dir: targetDirectoryPath,
offline: false,
force: true,
},
).then(() => spinner.success())

registerInstallationHook(templateName, install, pm)

Expand Down Expand Up @@ -161,7 +155,7 @@ async function main() {
fs.writeFileSync(packageJsonPath, JSON.stringify(newPackageJson, null, 2))
}

console.log(chalk.green('🎉 ' + chalk.bold('Copied project files')))
console.log(chalk.green(`🎉 ${chalk.bold('Copied project files')}`))
console.log(chalk.gray('Get started with:'), chalk.bold(`cd ${target}`))
}

Expand Down
Loading
Loading