Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
v0.0.6
Browse files Browse the repository at this point in the history
Multi-Platform Backup/Restore
  • Loading branch information
DK013 committed Apr 29, 2020
1 parent 1f97c54 commit a98c210
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 20 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to the "vscode-backup" extension will be documented in this

## Release Notes

### 0.0.6

Multi-Pltform Backup/Restore
Backup package from one platform can be used to restore on another platform.

### 0.0.5

Linux Support Added
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Or can be accessed manually with the folowing commands:

### Failed to Install Extension

Some Extensions in visual studio marketplace has different package id then what they register in system after install. Sice this plugin doesn't copy any existing extension file from one system to anoteher for privacy and security reasons and install everything from marketplace in the new system, some extensions might fail to install in the newer system if they have different package id in the marketplace. e.g. `ms-vscode.csharp` has the id `ms-dotnettools.csharp` in the marketplace.
Some Extensions in visual studio marketplace has different package id than what they register in system after install. Sice this plugin doesn't copy any existing extension file from one system to anoteher for privacy and security reasons and install everything from marketplace in the new system, some extensions might fail to install in the newer system if they have different package id in the marketplace. e.g. `ms-vscode.csharp` has the id `ms-dotnettools.csharp` in the marketplace.

Workaround: Check the output log and install the failed to install extensions manually

Expand Down Expand Up @@ -69,6 +69,11 @@ Build: `npm run build`

## Release Notes

### 0.0.6

Multi-Pltform Backup/Restore
Backup package from one platform can be used to restore on another platform.

### 0.0.5

Linux Support Added
Expand Down
30 changes: 12 additions & 18 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function activate(context) {
ps.addCommand('code --list-extensions | % { "code --install-extension $_ " }');
ps.invoke()
.then(output => {
fs.writeFile(path.join(folderPath, 'plugins.ps1'), output, error => {
fs.writeFile(path.join(folderPath, 'plugins'), output, error => {
if(error) {
Output.appendLine(error.toString());
vscode.window.showErrorMessage('Failed to create backup file');
Expand All @@ -67,7 +67,7 @@ function activate(context) {
}
else {
sh.exec('code --list-extensions | xargs -L 1 echo code --install-extension', (code, output) => {
fs.writeFile(path.join(folderPath, 'plugins.sh'), output, error => {
fs.writeFile(path.join(folderPath, 'plugins'), output, error => {
if(error) {
Output.appendLine(error.toString());
vscode.window.showErrorMessage('Failed to create backup file');
Expand All @@ -93,11 +93,11 @@ function activate(context) {
});
child.stderr.on("data",function(data){
Output.appendLine("Errors: " + data);
vscode.window.showErrorMessage('Some Hiccups while Installing Extaintions. Check Output for Details');
vscode.window.showErrorMessage('Some Hiccups while Installing Extensions. Check Output for Details');
});
child.on("exit",function(){
Output.appendLine("Script finished");
vscode.window.showInformationMessage('Extaintions Imported. Check Output for Details');
vscode.window.showInformationMessage('Extensions Imported. Check Output for Details');
});
child.stdin.end(); //end input
}
Expand All @@ -109,11 +109,11 @@ function activate(context) {
});
child.stderr.on("data",function(data){
Output.appendLine("Errors: " + data);
vscode.window.showErrorMessage('Some Hiccups while Installing Extaintions. Check Output for Details');
vscode.window.showErrorMessage('Some Hiccups while Installing Extensions. Check Output for Details');
});
child.on("exit",function(){
Output.appendLine("Script finished");
vscode.window.showInformationMessage('Extaintions Imported. Check Output for Details');
vscode.window.showInformationMessage('Extensions Imported. Check Output for Details');
});
child.stdin.end(); //end input
}
Expand Down Expand Up @@ -150,15 +150,9 @@ function archive(mode = 'create') { //implemet node-zip after mac test
if(mode === 'create') {
// @ts-ignore
var zip = new require('node-zip')();
if(process.platform === 'win32') {
zip.file('plugins.ps1', fs.readFileSync(path.join(folderPath, 'plugins.ps1')));
}
else if(process.platform === 'darwin') {
zip.file('plugins.sh', fs.readFileSync(path.join(folderPath, 'plugins.sh')));
}
else {
zip.file('plugins.sh', fs.readFileSync(path.join(folderPath, 'plugins.sh')));
}

zip.file('plugins', fs.readFileSync(path.join(folderPath, 'plugins')));

if(fs.existsSync(path.join(folderPath, 'settings.json'))) {
zip.file('settings.json', fs.readFileSync(path.join(folderPath, 'settings.json')));
}
Expand Down Expand Up @@ -217,13 +211,13 @@ function archive(mode = 'create') { //implemet node-zip after mac test
}

if(process.platform === 'win32') {
fs.writeFileSync(path.join(folderPath, 'plugins.ps1'), zip.files['plugins.ps1']._data);
fs.writeFileSync(path.join(folderPath, 'plugins.ps1'), zip.files['plugins']._data);
}
else if(process.platform === 'darwin') {
fs.writeFileSync(path.join(folderPath, 'plugins.sh'), zip.files['plugins.sh']._data);
fs.writeFileSync(path.join(folderPath, 'plugins.sh'), zip.files['plugins']._data);
}
else {
fs.writeFileSync(path.join(folderPath, 'plugins.sh'), zip.files['plugins.sh']._data);
fs.writeFileSync(path.join(folderPath, 'plugins.sh'), zip.files['plugins']._data);
}

vscode.window.showWarningMessage('Installing Plugins. Do Not Close the Window. Check Output log for details.');
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"color": "#101010",
"theme": "dark"
},
"version": "0.0.5",
"version": "0.0.6",
"engines": {
"vscode": "^1.41.0"
},
Expand Down

0 comments on commit a98c210

Please sign in to comment.