Skip to content

Commit

Permalink
[#88] Move vite-template outside from the lerna packages folder
Browse files Browse the repository at this point in the history
  • Loading branch information
malparty committed Jul 25, 2022
1 parent 54c8bcc commit 40f2fff
Show file tree
Hide file tree
Showing 73 changed files with 25,427 additions and 41,866 deletions.
38,138 changes: 11,305 additions & 26,833 deletions package-lock.json

Large diffs are not rendered by default.

19 changes: 9 additions & 10 deletions packages/cli-tool/src/template/initialize-vite-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,19 @@ const downloadTemplateRepository = (

const extractViteTemplateFolder = (options: InitViteOptions): Promise<void> => {
CliUx.ux.info("Extracting template source files...");
const branchPath = options.branch.replace("/", "-");

return runCommand(
"tar",
[
"-xz",
"-f",
`${options.appName}.gz`,
"--strip=2",
`${TEMPLATE_REPO}-${branchPath}/packages/vite-template`,
],
["-xz", "-f", `${options.appName}.gz`],
options.dest
);
};

const renameFolder = (options: InitViteOptions): Promise<void> => {
CliUx.ux.info("Rename your app folder...");
const branchPath = options.branch.replace("/", "-");

return runCommand("mv", ["vite-template", options.appName], options.dest);
return runCommand("mv", [`${TEMPLATE_REPO}-${branchPath}/vite-template/`, options.appName], options.dest);
};

const replaceAppName = (options: InitViteOptions): void => {
Expand All @@ -69,8 +63,13 @@ const npmInstall = (options: InitViteOptions): Promise<void> => {

const cleanTemporaryFiles = (options: InitViteOptions): Promise<void> => {
CliUx.ux.info("Remove zip and unwanted files...");
const branchPath = options.branch.replace("/", "-");

return runCommand("rm", [`${options.appName}.gz`], options.dest);
// Remove the archive
return runCommand("rm", [`${options.appName}.gz`], options.dest).then(() => {
// Remove the extracted folder
return runCommand("rm", ["-rf", `${TEMPLATE_REPO}-${branchPath}`], options.dest)
});
};

const initializeViteApp = async (options: InitViteOptions): Promise<void> => {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 40f2fff

Please sign in to comment.