Skip to content

Commit

Permalink
Improve execSync
Browse files Browse the repository at this point in the history
  • Loading branch information
polarker committed Oct 16, 2024
1 parent 98fddaa commit 0c8fc73
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions packages/cli/scripts/create-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,27 @@ along with the library. If not, see <http://www.gnu.org/licenses/>.

import fsExtra from 'fs-extra'
import path from 'path'
import { execSync } from 'child_process'
import { execFileSync } from 'child_process'

function prepareNextJs(templateType: string, _packageRoot: string, projectRoot: string) {
console.log('Creating the Nextjs app')
const prefix = templateType === 'nextjs' ? 'nextjs-app' : templateType
execSync(`npx create-next-app ${projectRoot} --example https://github.com/alephium/${prefix}-dapp-template --typescript`)
execSync('npm install && npm run prettier', { cwd: projectRoot })
execFileSync(
'npx',
[
'create-next-app',
projectRoot,
'--example',
`https://github.com/alephium/${prefix}-dapp-template`,
'--typescript'
],
{ stdio: 'inherit' }
)
console.log()
}

function gitClone(url: string, projectRoot: string) {
execSync(`git clone ${url} ${projectRoot}`)
execFileSync('git', ['clone', url, projectRoot], { stdio: 'inherit' })
}

export function createProject(templateType: string, packageRoot: string, projectRoot: string): void {
Expand Down

0 comments on commit 0c8fc73

Please sign in to comment.