Skip to content

Commit

Permalink
create-warp-app v1.2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
evolutionleo committed Nov 5, 2023
1 parent 5c1f942 commit f820a70
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
25 changes: 12 additions & 13 deletions create-warp-app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ else {
fs.mkdirSync(projectName);
}

shell.cd(projectName); // actually navigates


inquirer.prompt(questions).then(answers => {
const { serverTemplate, clientTemplate } = answers;
Expand Down Expand Up @@ -98,16 +96,17 @@ inquirer.prompt(questions).then(answers => {
// server
const server_cb = () => {
console.log(chalk.white('Unzipping ' + server_fname + '...'));
fs.createReadStream(server_fname)
.pipe(unzipper.Extract({ path: 'Server/' })

fs.createReadStream(path.join(projectName, server_fname))
.pipe(unzipper.Extract({ path: path.join(__dirname, projectName, 'Server/') })
.on('close', () => {
console.log(chalk.white('Done.'));
fs.rmSync(server_fname);
fs.rmSync(path.join(projectName, server_fname));
// shell.rm('-rf', server_fname);
}));
};

const server_file = fs.createWriteStream(server_fname);
const server_file = fs.createWriteStream(path.join(projectName, server_fname));
const server_req = https.get(server_url);

console.log(chalk.white('Downloading the server from'), chalk.blueBright(server_url) + chalk.white('...'));
Expand All @@ -121,14 +120,14 @@ inquirer.prompt(questions).then(answers => {
// client
const client_cb = () => {
console.log(chalk.white('Unzipping ' + client_fname + '...'));
fs.createReadStream(client_fname)
.pipe(unzipper.Extract({ path: 'Client/' })
fs.createReadStream(path.join(projectName, client_fname))
.pipe(unzipper.Extract({ path: path.join(__dirname, projectName, 'Client/') })
.on('close', () => {
// rename Client.yyp and Client.resource_order
if (clientTemplate === 'GameMaker') {
// rename the .yyp
const project_file = 'Client.yyp';
const project_path = 'Client/' + project_file;
const project_path = path.join(projectName, 'Client/', project_file);
const content = fs.readFileSync(project_path, 'utf8');
const new_project_path = project_path.replace(project_file, projectName + '.yyp');

Expand All @@ -137,7 +136,7 @@ inquirer.prompt(questions).then(answers => {

// rename the .resource_order
const ro_file = 'Client.resource_order';
const ro_path = 'Client/' + ro_file;
const ro_path = path.join(projectName, 'Client/', ro_file);
const ro_content = fs.readFileSync(ro_path, 'utf8');
const new_ro_path = ro_path.replace(project_file, projectName + '.resource_order');

Expand All @@ -146,15 +145,15 @@ inquirer.prompt(questions).then(answers => {
}

console.log(chalk.white('Done.'));
fs.rmSync(client_fname);
fs.rmSync(path.join(projectName, client_fname));
// shell.rm('-rf', client_fname);
}));
};

const client_file = fs.createWriteStream(client_fname);
const client_file = fs.createWriteStream(path.join(projectName, client_fname));
const client_req = https.get(client_url);

console.log(chalk.white('Downloading the client from'), chalk.blueBright(client_url) + chalk.greenBright('...'));
console.log(chalk.white('Downloading the client from'), chalk.blueBright(client_url) + chalk.white('...'));
client_req.on('response', (res) => {
res.pipe(client_file);
res.on('close', client_cb);
Expand Down
5 changes: 3 additions & 2 deletions create-warp-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@evoleo/create-warp-app",
"version": "1.2.3",
"version": "1.2.4",
"description": "Bootstrap a Warp project with a single command!",
"main": "index.js",
"bin": {
Expand All @@ -23,12 +23,13 @@
"license": "MIT",
"dependencies": {
"chalk": "^4.1.2",
"decompress": "^4.2.1",
"decompress-unzip": "^4.0.1",
"follow-redirects": "^1.14.5",
"inquirer": "^8.2.0",
"shelljs": "^0.8.4",
"unzipper": "^0.10.11"
},
"devDependencies": {},
"repository": {
"type": "git",
"url": "git+https://github.com/evolutionleo/warp.git"
Expand Down

0 comments on commit f820a70

Please sign in to comment.