create-ce-app
Advanced tools
Comparing version 1.0.16 to 1.0.17
@@ -14,3 +14,6 @@ #!/usr/bin/env node | ||
import { exec } from 'child_process'; | ||
import { writeFile } from 'fs/promises'; | ||
import { addCustomElementComponent, createApp } from './src/services/app-service.js'; | ||
import { cloneGitContent } from './src/services/github.js'; | ||
const projectName = process.argv[2]; | ||
const waitForExec = ({ cmd, errorMessage, successMessage, }) => __awaiter(void 0, void 0, void 0, function* () { | ||
@@ -30,4 +33,2 @@ return new Promise((resolve, reject) => { | ||
}); | ||
console.log("INSIDE SCRIPT"); | ||
const projectName = process.argv[2]; | ||
const init = () => __awaiter(void 0, void 0, void 0, function* () { | ||
@@ -57,11 +58,17 @@ exec('clear'); | ||
}); | ||
const repoUrl = 'https://github.com/dorchaouat/test-template.git'; | ||
const subdirectory = answer.templateSelector; | ||
const destinationFolder = `./${projectName}`; | ||
const cloneCommand = `git clone --depth 1 --filter=blob:none --sparse ${repoUrl} ${destinationFolder} && cd ${destinationFolder} && git sparse-checkout init && git sparse-checkout set ${subdirectory}`; | ||
yield waitForExec({ | ||
cmd: cloneCommand, | ||
errorMessage: 'Error cloning subdirectory.', | ||
successMessage: `Subdirectory cloned to ${destinationFolder}/${subdirectory}\n`, | ||
try { | ||
console.log("Downloading Files..."); | ||
yield cloneGitContent(subdirectory, projectName); | ||
} | ||
catch (error) { | ||
console.error("Failed downloading files"); | ||
} | ||
; | ||
const applicationJson = JSON.stringify({ | ||
appDefinitionId: appId, | ||
appName: projectName, | ||
}); | ||
yield writeFile(`${destinationFolder}/.application.json`, applicationJson); | ||
console.log("Installing Packages..."); | ||
@@ -68,0 +75,0 @@ exec(`(cd ${destinationFolder}/${subdirectory} && npm i)`, (err) => { |
27
index.ts
#!/usr/bin/env node | ||
import chalk from 'chalk'; | ||
import inquirer from 'inquirer'; | ||
import { exec } from 'child_process'; | ||
import { addCustomElementComponent, createApp, getLatestAppVersion } from './src/services/app-service.js'; | ||
import { writeFile } from 'fs/promises'; | ||
import { addCustomElementComponent, createApp } from './src/services/app-service.js'; | ||
import { cloneGitContent } from './src/services/github.js'; | ||
@@ -13,2 +16,4 @@ type waitForExecRequest = { | ||
const projectName = process.argv[2]; | ||
const waitForExec = async ({ | ||
@@ -33,5 +38,2 @@ cmd, | ||
console.log("INSIDE SCRIPT") | ||
const projectName = process.argv[2]; | ||
const init = async () => { | ||
@@ -65,14 +67,19 @@ exec('clear'); | ||
const repoUrl = 'https://github.com/dorchaouat/test-template.git'; | ||
const subdirectory = answer.templateSelector; | ||
const destinationFolder = `./${projectName}`; | ||
const cloneCommand = `git clone --depth 1 --filter=blob:none --sparse ${repoUrl} ${destinationFolder} && cd ${destinationFolder} && git sparse-checkout init && git sparse-checkout set ${subdirectory}`; | ||
try { | ||
console.log("Downloading Files...") | ||
await cloneGitContent(subdirectory, projectName); | ||
} catch (error) { | ||
console.error("Failed downloading files"); | ||
}; | ||
await waitForExec({ | ||
cmd: cloneCommand, | ||
errorMessage: 'Error cloning subdirectory.', | ||
successMessage: `Subdirectory cloned to ${destinationFolder}/${subdirectory}\n`, | ||
const applicationJson = JSON.stringify({ | ||
appDefinitionId: appId, | ||
appName: projectName, | ||
}); | ||
await writeFile(`${destinationFolder}/.application.json`, applicationJson); | ||
console.log("Installing Packages..."); | ||
@@ -79,0 +86,0 @@ |
{ | ||
"name": "create-ce-app", | ||
"version": "1.0.16", | ||
"version": "1.0.17", | ||
"description": "My New Project description.", | ||
@@ -5,0 +5,0 @@ "type": "module", |
36641
19
999