Skip to content

Commit 471460d

Browse files
committed
Test update process
The update process has been updated on the repo to do some tests.
1 parent 4176c5e commit 471460d

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

lib/menus/update.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -160,18 +160,21 @@ export default async (beforeError, forceUpdate) => {
160160
// Shows a message indicating that the bot is downloading the new version
161161
console.log(`⬇️ ${await client.functions.utils.parseLocale(locale.downloadingNewVersion, { targetVersion: `v${latestRemoteTag}`, repositoryURL: packageConfig.repository.url })} ...`);
162162

163-
// Ignores the config.json file
164-
await git.raw(['update-index', '--skip-worktree', 'config.json']);
163+
// Stores the latest configuration from the config.json file
164+
const currentConfigContent = await fs.readFileSync('./config.json');
165165

166-
// Makes a pull to update the bot
167-
//await git.pull();
166+
// Fetches the latest changes from the repository
167+
await git.fetch(['--all']);
168168

169-
// Makes a checkout to the latest tag
170-
//await git.checkout(latestTag);
169+
// Resets the local repository to the latest remote version
170+
await git.reset(['--hard', latestRemoteTag]);
171171

172-
// Stops ignoring the config.json file
173-
await git.raw(['update-index', '--no-skip-worktree', 'config.json']);
172+
// Checks out the latest remote tag
173+
//await git.checkout(latestRemoteTag);
174174

175+
// Restores the stored configuration to the config.json file
176+
await fs.writeFile('./config.json', currentConfigContent);
177+
175178
// Cleans the console and shows the logo
176179
process.stdout.write('\u001b[2J\u001b[0;0H');
177180
await splashLogo(client.locale.lib.loaders.splashLogo);
@@ -368,4 +371,4 @@ export default async (beforeError, forceUpdate) => {
368371
// Runs this menu again, passing the error
369372
await client.functions.menus[menuName](error);
370373
};
371-
};
374+
};

0 commit comments

Comments
 (0)