Skip to content

Commit

Permalink
feat: switched from tiged to giget (#63)
Browse files Browse the repository at this point in the history
* feat: switched from tiged to giget

* chore: minor string formatting change

* fix: resolved test issues
  • Loading branch information
MathurAditya724 authored Aug 3, 2024
1 parent bd97ce2 commit 929643b
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 125 deletions.
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(
`gh:${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

0 comments on commit 929643b

Please sign in to comment.