Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
nonoroazoro committed Jul 14, 2018
2 parents 47c306e + 062adec commit f5d264a
Show file tree
Hide file tree
Showing 17 changed files with 3,193 additions and 446 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
node_modules
package-lock.json

# OS junk files
.DS_Store

# Project specific stuff
dist
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelogs

## 1.7.0 - July 13, 2018

- Changed: Merge the `settings.json` and `settings-mac.json` files into one, i.e., the `settings.json` file.
- Changed: Check the `editor.formatOnSave` setting before formating the settings file during the synchronization.


## 1.6.2 - May 11, 2018

- Changed: Format `VSCode User Settings` file.
Expand Down
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@

## Breaking Changes

* From ***version 1.6.0*** onwards, I've introduced two important changes:
* From ***version 1.7.0*** onwards:

1. **Exclude VSCode User Settings.**
* **`Syncing` will merge the `settings.json` and `settings-mac.json` files into one, i.e., the `settings.json` file, which will make it easy to sync between Windows/Mac/Linux machines.**

1. **Mistake-Proofing ([Poka-Yoke](https://en.wikipedia.org/wiki/Poka-yoke)).**
More specifically:

> Please [check out the VSCode User Settings](#vscode-user-settings) for more details.
* `VSCode User Settings` will always be uploaded as `settings.json`.

* And `Syncing` will try to download the `settings.json` corresponding to the current device, to ensure not to break your existing settings.

> Please note that the `keybindings` will still be synced separately.


## Features
Expand All @@ -31,7 +35,7 @@
1. **Upload VSCode Settings**:

* It will upload the `settings, keybindings, extensions, locales` and `snippets`.
* The `settings` and `keybindings` of `Macintosh` and `non-Macintosh` will be synced separately, in case you have multiple devices.
* The `keybindings` of `Macintosh` and `non-Macintosh` will be synced separately, in case you have multiple devices.
* Automatically create a new Gist to store your settings.
* Use an incremental algorithm to boost the synchronization.
* You can `exclude some VSCode User Settings` from being uploaded, [check out the VSCode User Settings](#vscode-user-settings) for more details.
Expand Down Expand Up @@ -97,7 +101,7 @@ From ***version 1.6.0*** onwards, you'll find these two newly added `Syncing Set

You can configure [glob patterns](https://github.com/isaacs/minimatch) for excluding some `VSCode User Settings` from being synced.

> Note that the settings not listed here will still be synced normally.
> Note that the settings not listed here will still be synced.

Take this for example:

Expand Down
14 changes: 9 additions & 5 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@

## 重要变更

* `Syncing` ***1.6.0*** 版本开始将会带来以下两个重要变更
****1.7.0*** 版本开始起

1. **在同步时允许忽略指定的 VSCode 配置项;**
* **`Syncing` 将不再按照操作系统来分开同步 `VSCode 用户设置`文件,即 Windows、Mac 和 Linux 都将使用同一个 `settings.json` 文件。**

1. **加入了[防呆设计](https://zh.wikipedia.org/wiki/%E9%98%B2%E5%91%86)**
具体来说,从这个版本起:

> 具体请参考 `Syncing` 新增的 [VSCode 配置项](#vscode-配置项)
* 上传时,`VSCode 用户设置` 将始终被上传至 `settings.json` 文件中;

* 下载时,将会优先检测当前设备对应的配置文件,如果不存在,则尝试下载其他 `settings.json` 文件,以确保本次升不会破坏你现有的配置文件。

> 注意:`keybindings`(即快捷键配置)依然会分开同步。


## 功能
Expand All @@ -31,7 +35,7 @@
1. **上传 VSCode 配置**:

* 上传的配置包括: `settings, keybindings, extensions, locales` 以及所有 `snippets`
* 因为 `Mac``非 Mac` 设备的配置通常会有一些差异,所以 `settings``keybindings` 将会按照设备类型分别上传;
* 因为 `Mac``非 Mac` 设备的配置通常会有一些差异,所以 `keybindings` 将会按照设备类型分别上传;
* 自动帮你创建新的 `Gist` 来保存 VSCode 配置,例如当你第一次使用这个插件上传配置时;
* 为了加快同步速度,整个同步过程都是`增量`的;
* 你可以`忽略某些 VSCode 配置项`,以防止它们被上传,具体请参考[这里](#vscode-配置项)
Expand Down
30 changes: 15 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "syncing",
"displayName": "Syncing",
"description": "Sync all of your VSCode settings across multiple devices.",
"version": "1.6.2",
"version": "1.7.0",
"publisher": "nonoroazoro",
"author": {
"email": "[email protected]",
Expand Down Expand Up @@ -94,35 +94,35 @@
"postinstall": "node ./node_modules/vscode/bin/install"
},
"dependencies": {
"@octokit/rest": "^15.2.6",
"async": "^2.6.0",
"extract-zip": "^1.6.6",
"fs-extra": "^5.0.0",
"@octokit/rest": "^15.9.4",
"async": "^2.6.1",
"extract-zip": "^1.6.7",
"fs-extra": "^6.0.1",
"https-proxy-agent": "^2.2.1",
"jsonc-parser": "^2.0.0",
"jsondiffpatch": "^0.3.9",
"jsonc-parser": "^2.0.1",
"jsondiffpatch": "^0.3.11",
"junk": "^2.1.0",
"lodash.pick": "^4.4.0",
"minimatch": "^3.0.4",
"moment": "^2.22.1",
"moment": "^2.22.2",
"tmp": "0.0.33"
},
"devDependencies": {
"@types/async": "^2.0.49",
"@types/extract-zip": "^1.6.2",
"@types/fs-extra": "^5.0.2",
"@types/fs-extra": "^5.0.4",
"@types/lodash.pick": "^4.4.3",
"@types/minimatch": "^3.0.3",
"@types/node": "^10.0.0",
"@types/node": "^10.5.2",
"@types/tmp": "0.0.33",
"husky": "^0.14.3",
"lint-staged": "^7.0.5",
"mocha": "^5.1.1",
"lint-staged": "^7.2.0",
"mocha": "^5.2.0",
"rimraf": "^2.6.2",
"should": "^13.2.1",
"tslint": "^5.9.1",
"typescript": "^2.8.3",
"vscode": "^1.1.16"
"tslint": "^5.10.0",
"typescript": "^2.9.2",
"vscode": "^1.1.18"
},
"lint-staged": {
"./src/**/*.ts": [
Expand Down
22 changes: 17 additions & 5 deletions src/core/GitHubTypes.ts → src/common/GitHubTypes.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* Represent the GitHub Gist.
*/
export interface IGist
{
comments: number;
Expand All @@ -19,6 +22,17 @@ export interface IGist
user?: any;
}

/**
* Represent the `files` of GitHub Gist.
*/
export interface IGistFiles
{
[key: string]: IGistFile;
}

/**
* Represent the `file` of GitHub Gist.
*/
export interface IGistFile
{
content: string;
Expand All @@ -30,11 +44,9 @@ export interface IGistFile
type: string;
}

export interface IGistFiles
{
[key: string]: IGistFile;
}

/**
* Represent the `owner` of GitHub Gist.
*/
export interface IGistOwner
{
avatar_url: string;
Expand Down
4 changes: 0 additions & 4 deletions src/constants/index.ts → src/common/constants.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/**
* Constants of `Syncing`.
*/

// Dot-separated identifiers, same as the secions of VSCode, see `vscode.workspace.getConfiguration`.
export const CONFIGURATION_KEY = "syncing";
export const CONFIGURATION_POKA_YOKE_THRESHOLD = "pokaYokeThreshold";
Expand Down
101 changes: 101 additions & 0 deletions src/common/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
/**
* Represent the types of various `VSCode Setting`, such as `Extensions`, `Keybindings`...
*/
export enum SettingTypes
{
Extensions = "extensions",
Keybindings = "keybindings",
Locale = "locale",
Settings = "settings",
Snippets = "snippets"
}

/**
* Represent a `VSCode Setting`.
*/
export interface ISetting
{
/**
* Settings content.
*/
content?: string;

/**
* Settings local filepath.
*/
filepath: string;

/**
* Settings filename in GitHub Gist.
*/
remoteFilename: string;

/**
* Settings type.
*/
type: SettingTypes;
}

/**
* Represent a VSCode extension.
*/
export interface IExtension
{
/**
* The extension's identifier in the form of: `publisher.name`.
*/
id: string;

/**
* The extension's name.
*/
name: string;

/**
* The extension's publisher.
*/
publisher: string;

/**
* The extension's version.
*/
version: string;

/**
* The extension's metadata.
*/
__metadata?: string;

/**
* The downloaded extension's zip file path.
*/
zip?: string;

/**
* The installed extension's folder path.
*/
path?: string;
}

/**
* Represent the currently synced item.
*/
export interface ISyncedItem
{
/**
* Extensions that have been added, updated or removed.
*/
extension?: {
added: IExtension[],
addedErrors: IExtension[],
updated: IExtension[],
updatedErrors: IExtension[],
removed: IExtension[],
removedErrors: IExtension[]
};

/**
* `VSCode Setting` that have been added, updated or removed.
*/
setting?: ISetting;
}
Loading

0 comments on commit f5d264a

Please sign in to comment.