@teambit/git 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ import { Aspect } from '@teambit/harmony';
2
+ export declare const GitAspect: Aspect;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.GitAspect = void 0;
7
+ function _harmony() {
8
+ const data = require("@teambit/harmony");
9
+ _harmony = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ const GitAspect = _harmony().Aspect.create({
15
+ id: 'teambit.git/git'
16
+ });
17
+ exports.GitAspect = GitAspect;
18
+
19
+ //# sourceMappingURL=git.aspect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["GitAspect","Aspect","create","id"],"sources":["git.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const GitAspect = Aspect.create({\n id: 'teambit.git/git',\n});\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,SAAS,GAAGC,iBAAM,CAACC,MAAM,CAAC;EACrCC,EAAE,EAAE;AACN,CAAC,CAAC;AAAC"}
@@ -0,0 +1,10 @@
1
+ import { Command } from '@teambit/cli';
2
+ export declare class GitCmd implements Command {
3
+ name: string;
4
+ alias: string;
5
+ description: string;
6
+ options: never[];
7
+ group: string;
8
+ commands: Command[];
9
+ report([unrecognizedSubcommand]: [string]): Promise<string>;
10
+ }
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ require("core-js/modules/es.array.iterator.js");
5
+ require("core-js/modules/es.promise.js");
6
+ Object.defineProperty(exports, "__esModule", {
7
+ value: true
8
+ });
9
+ exports.GitCmd = void 0;
10
+ function _defineProperty2() {
11
+ const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
+ _defineProperty2 = function () {
13
+ return data;
14
+ };
15
+ return data;
16
+ }
17
+ function _chalk() {
18
+ const data = _interopRequireDefault(require("chalk"));
19
+ _chalk = function () {
20
+ return data;
21
+ };
22
+ return data;
23
+ }
24
+ const COMMAND_NAME = 'git';
25
+ class GitCmd {
26
+ constructor() {
27
+ (0, _defineProperty2().default)(this, "name", `${COMMAND_NAME} <sub-command>`);
28
+ (0, _defineProperty2().default)(this, "alias", '');
29
+ (0, _defineProperty2().default)(this, "description", 'perform git operations');
30
+ (0, _defineProperty2().default)(this, "options", []);
31
+ (0, _defineProperty2().default)(this, "group", 'git');
32
+ (0, _defineProperty2().default)(this, "commands", []);
33
+ }
34
+ // helpUrl = '';
35
+
36
+ async report([unrecognizedSubcommand]) {
37
+ return _chalk().default.red(`"${unrecognizedSubcommand}" is not a subcommand of "git", please run "bit git --help" to list the subcommands`);
38
+ }
39
+ }
40
+ exports.GitCmd = GitCmd;
41
+
42
+ //# sourceMappingURL=git.cmd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["COMMAND_NAME","GitCmd","report","unrecognizedSubcommand","chalk","red"],"sources":["git.cmd.ts"],"sourcesContent":["import { Command } from '@teambit/cli';\nimport chalk from 'chalk';\n\nconst COMMAND_NAME = 'git';\n\nexport class GitCmd implements Command {\n name = `${COMMAND_NAME} <sub-command>`;\n alias = '';\n description = 'perform git operations';\n options = [];\n group = 'git';\n commands: Command[] = [];\n // helpUrl = '';\n\n async report([unrecognizedSubcommand]: [string]) {\n return chalk.red(\n `\"${unrecognizedSubcommand}\" is not a subcommand of \"git\", please run \"bit git --help\" to list the subcommands`\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA,MAAMA,YAAY,GAAG,KAAK;AAEnB,MAAMC,MAAM,CAAoB;EAAA;IAAA,8CAC7B,GAAED,YAAa,gBAAe;IAAA,+CAC9B,EAAE;IAAA,qDACI,wBAAwB;IAAA,iDAC5B,EAAE;IAAA,+CACJ,KAAK;IAAA,kDACS,EAAE;EAAA;EACxB;;EAEA,MAAME,MAAM,CAAC,CAACC,sBAAsB,CAAW,EAAE;IAC/C,OAAOC,gBAAK,CAACC,GAAG,CACb,IAAGF,sBAAuB,qFAAoF,CAChH;EACH;AACF;AAAC"}
@@ -0,0 +1,20 @@
1
+ import { CLIMain } from '@teambit/cli';
2
+ import { Workspace } from '@teambit/workspace';
3
+ declare type SetGitMergeDriverOpts = {
4
+ global?: boolean;
5
+ };
6
+ export declare class GitMain {
7
+ private workspace;
8
+ constructor(workspace: Workspace);
9
+ mergeBitmaps(ancestor: string, current: string, other: string): Promise<string>;
10
+ setGitMergeDriver(opts: SetGitMergeDriverOpts): Promise<boolean>;
11
+ private setGitConfig;
12
+ private setGitAttributes;
13
+ private getGitAttributesPath;
14
+ private stripBom;
15
+ static slots: never[];
16
+ static dependencies: import("@teambit/harmony").Aspect[];
17
+ static runtime: import("@teambit/harmony").RuntimeDefinition;
18
+ static provider([cli, workspace]: [CLIMain, Workspace]): Promise<GitMain>;
19
+ }
20
+ export default GitMain;
@@ -0,0 +1,198 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ require("core-js/modules/es.array.iterator.js");
5
+ require("core-js/modules/es.promise.js");
6
+ Object.defineProperty(exports, "__esModule", {
7
+ value: true
8
+ });
9
+ exports.default = exports.GitMain = void 0;
10
+ function _defineProperty2() {
11
+ const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
+ _defineProperty2 = function () {
13
+ return data;
14
+ };
15
+ return data;
16
+ }
17
+ function _fsExtra() {
18
+ const data = _interopRequireDefault(require("fs-extra"));
19
+ _fsExtra = function () {
20
+ return data;
21
+ };
22
+ return data;
23
+ }
24
+ function _bitError() {
25
+ const data = require("@teambit/bit-error");
26
+ _bitError = function () {
27
+ return data;
28
+ };
29
+ return data;
30
+ }
31
+ function _os() {
32
+ const data = require("os");
33
+ _os = function () {
34
+ return data;
35
+ };
36
+ return data;
37
+ }
38
+ function _path() {
39
+ const data = require("path");
40
+ _path = function () {
41
+ return data;
42
+ };
43
+ return data;
44
+ }
45
+ function _gitconfig() {
46
+ const data = _interopRequireDefault(require("gitconfig"));
47
+ _gitconfig = function () {
48
+ return data;
49
+ };
50
+ return data;
51
+ }
52
+ function _cli() {
53
+ const data = require("@teambit/cli");
54
+ _cli = function () {
55
+ return data;
56
+ };
57
+ return data;
58
+ }
59
+ function _workspace() {
60
+ const data = require("@teambit/workspace");
61
+ _workspace = function () {
62
+ return data;
63
+ };
64
+ return data;
65
+ }
66
+ function _git() {
67
+ const data = require("./git.aspect");
68
+ _git = function () {
69
+ return data;
70
+ };
71
+ return data;
72
+ }
73
+ function _mergeBitmaps() {
74
+ const data = require("./merge-bitmaps.cmd");
75
+ _mergeBitmaps = function () {
76
+ return data;
77
+ };
78
+ return data;
79
+ }
80
+ function _setGitMergeDriver() {
81
+ const data = require("./set-git-merge-driver.cmd");
82
+ _setGitMergeDriver = function () {
83
+ return data;
84
+ };
85
+ return data;
86
+ }
87
+ function _git2() {
88
+ const data = require("./git.cmd");
89
+ _git2 = function () {
90
+ return data;
91
+ };
92
+ return data;
93
+ }
94
+ const GIT_BASE_KEY = 'merge.bitmap-driver';
95
+ const GIT_NAME_KEY = `${GIT_BASE_KEY}.name`;
96
+ const GIT_DRIVER_KEY = `${GIT_BASE_KEY}.driver`;
97
+ const GIT_NAME_VALUE = 'A custom merge driver used to resolve conflicts in .bitmap files';
98
+ // const binName = process.argv[1];
99
+ const GIT_DRIVER_VALUE = 'bit git merge-bitmaps %O %A %B';
100
+ const GIT_ATTRIBUTES = '.bitmap merge=bitmap-driver';
101
+ class GitMain {
102
+ constructor(workspace) {
103
+ this.workspace = workspace;
104
+ }
105
+ async mergeBitmaps(ancestor, current, other) {
106
+ const encoding = 'utf-8';
107
+ // const ancestorContent = this.stripBom(fs.readFileSync(ancestor, encoding));
108
+ const currentContent = this.stripBom(_fsExtra().default.readFileSync(current, encoding));
109
+ const otherContent = this.stripBom(_fsExtra().default.readFileSync(other, encoding));
110
+ const merged = this.workspace.bitMap.mergeBitmaps(currentContent, otherContent);
111
+ await _fsExtra().default.outputFile(current, merged);
112
+ return merged;
113
+ }
114
+ async setGitMergeDriver(opts) {
115
+ await this.setGitConfig(opts);
116
+ await this.setGitAttributes(opts);
117
+ return true;
118
+ }
119
+ async setGitConfig(opts) {
120
+ const isGit = await _fsExtra().default.pathExists('.git');
121
+ if (!isGit && !opts.global) {
122
+ throw new (_bitError().BitError)('This is not a git repository');
123
+ }
124
+ const location = opts.global ? 'global' : 'local';
125
+ let gitVal;
126
+ try {
127
+ gitVal = await _gitconfig().default.get(GIT_NAME_KEY, {
128
+ location
129
+ });
130
+ } catch (_unused) {
131
+ // do nothing, it just means that there is no config yet which is fine
132
+ }
133
+ if (gitVal) {
134
+ return; // already set
135
+ }
136
+
137
+ await _gitconfig().default.set(GIT_NAME_KEY, GIT_NAME_VALUE, {
138
+ location
139
+ });
140
+ await _gitconfig().default.set(GIT_DRIVER_KEY, GIT_DRIVER_VALUE, {
141
+ location
142
+ });
143
+ }
144
+ async setGitAttributes(opts) {
145
+ const attributesPath = await this.getGitAttributesPath(opts.global);
146
+ const isGit = await _fsExtra().default.pathExists('.git');
147
+ if (!isGit && !opts.global) {
148
+ throw new (_bitError().BitError)('This is not a git repository');
149
+ }
150
+ const fileExist = await _fsExtra().default.pathExists(attributesPath);
151
+ if (!fileExist) {
152
+ await _fsExtra().default.writeFile(attributesPath, GIT_ATTRIBUTES);
153
+ } else {
154
+ const gitAttributes = await _fsExtra().default.readFile(attributesPath, 'utf8');
155
+ if (gitAttributes.includes(GIT_ATTRIBUTES)) {
156
+ return; // already set
157
+ }
158
+
159
+ await _fsExtra().default.appendFile(attributesPath, `\n${GIT_ATTRIBUTES}`);
160
+ }
161
+ }
162
+ async getGitAttributesPath(global = false) {
163
+ const fromConfig = await _gitconfig().default.get('core.attributesFile', {
164
+ location: global ? 'global' : 'local'
165
+ });
166
+ if (fromConfig) {
167
+ return fromConfig;
168
+ }
169
+ if (!global) {
170
+ return '.gitattributes';
171
+ }
172
+ const xdgConfigHome = process.env.XDG_CONFIG_HOME;
173
+ if (xdgConfigHome) {
174
+ return (0, _path().join)(xdgConfigHome, 'git', 'attributes');
175
+ }
176
+ return (0, _path().join)((0, _os().homedir)(), '.config', 'git', 'attributes');
177
+ }
178
+ stripBom(str) {
179
+ return str[0] === '\uFEFF' ? str.slice(1) : str;
180
+ }
181
+ static async provider([cli, workspace]) {
182
+ const gitMain = new GitMain(workspace);
183
+ const gitCmd = new (_git2().GitCmd)();
184
+ gitCmd.commands = [new (_setGitMergeDriver().SetGitMergeDriverCmd)(gitMain), new (_mergeBitmaps().MergeBitmapsCmd)(gitMain)];
185
+ cli.register(gitCmd);
186
+ cli.registerGroup('git', 'Git');
187
+ return gitMain;
188
+ }
189
+ }
190
+ exports.GitMain = GitMain;
191
+ (0, _defineProperty2().default)(GitMain, "slots", []);
192
+ (0, _defineProperty2().default)(GitMain, "dependencies", [_cli().CLIAspect, _workspace().WorkspaceAspect]);
193
+ (0, _defineProperty2().default)(GitMain, "runtime", _cli().MainRuntime);
194
+ _git().GitAspect.addRuntime(GitMain);
195
+ var _default = GitMain;
196
+ exports.default = _default;
197
+
198
+ //# sourceMappingURL=git.main.runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["GIT_BASE_KEY","GIT_NAME_KEY","GIT_DRIVER_KEY","GIT_NAME_VALUE","GIT_DRIVER_VALUE","GIT_ATTRIBUTES","GitMain","constructor","workspace","mergeBitmaps","ancestor","current","other","encoding","currentContent","stripBom","fs","readFileSync","otherContent","merged","bitMap","outputFile","setGitMergeDriver","opts","setGitConfig","setGitAttributes","isGit","pathExists","global","BitError","location","gitVal","gitconfig","get","set","attributesPath","getGitAttributesPath","fileExist","writeFile","gitAttributes","readFile","includes","appendFile","fromConfig","xdgConfigHome","process","env","XDG_CONFIG_HOME","join","homedir","str","slice","provider","cli","gitMain","gitCmd","GitCmd","commands","SetGitMergeDriverCmd","MergeBitmapsCmd","register","registerGroup","CLIAspect","WorkspaceAspect","MainRuntime","GitAspect","addRuntime"],"sources":["git.main.runtime.ts"],"sourcesContent":["import fs from 'fs-extra';\nimport { BitError } from '@teambit/bit-error';\nimport { homedir } from 'os';\nimport { join } from 'path';\nimport gitconfig from 'gitconfig';\nimport { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { WorkspaceAspect, Workspace } from '@teambit/workspace';\nimport { GitAspect } from './git.aspect';\nimport { MergeBitmapsCmd } from './merge-bitmaps.cmd';\nimport { SetGitMergeDriverCmd } from './set-git-merge-driver.cmd';\nimport { GitCmd } from './git.cmd';\n\ntype SetGitMergeDriverOpts = {\n global?: boolean;\n};\n\nconst GIT_BASE_KEY = 'merge.bitmap-driver';\nconst GIT_NAME_KEY = `${GIT_BASE_KEY}.name`;\nconst GIT_DRIVER_KEY = `${GIT_BASE_KEY}.driver`;\n\nconst GIT_NAME_VALUE = 'A custom merge driver used to resolve conflicts in .bitmap files';\n// const binName = process.argv[1];\nconst GIT_DRIVER_VALUE = 'bit git merge-bitmaps %O %A %B';\n\nconst GIT_ATTRIBUTES = '.bitmap merge=bitmap-driver';\n\nexport class GitMain {\n constructor(private workspace: Workspace) {}\n\n async mergeBitmaps(ancestor: string, current: string, other: string) {\n const encoding = 'utf-8';\n // const ancestorContent = this.stripBom(fs.readFileSync(ancestor, encoding));\n const currentContent = this.stripBom(fs.readFileSync(current, encoding));\n const otherContent = this.stripBom(fs.readFileSync(other, encoding));\n const merged = this.workspace.bitMap.mergeBitmaps(currentContent, otherContent);\n await fs.outputFile(current, merged);\n return merged;\n }\n\n async setGitMergeDriver(opts: SetGitMergeDriverOpts) {\n await this.setGitConfig(opts);\n await this.setGitAttributes(opts);\n return true;\n }\n\n private async setGitConfig(opts: SetGitMergeDriverOpts) {\n const isGit = await fs.pathExists('.git');\n if (!isGit && !opts.global) {\n throw new BitError('This is not a git repository');\n }\n const location = opts.global ? 'global' : 'local';\n let gitVal;\n try {\n gitVal = await gitconfig.get(GIT_NAME_KEY, { location });\n } catch {\n // do nothing, it just means that there is no config yet which is fine\n }\n if (gitVal) {\n return; // already set\n }\n await gitconfig.set(GIT_NAME_KEY, GIT_NAME_VALUE, { location });\n await gitconfig.set(GIT_DRIVER_KEY, GIT_DRIVER_VALUE, { location });\n }\n\n private async setGitAttributes(opts: SetGitMergeDriverOpts) {\n const attributesPath = await this.getGitAttributesPath(opts.global);\n const isGit = await fs.pathExists('.git');\n if (!isGit && !opts.global) {\n throw new BitError('This is not a git repository');\n }\n const fileExist = await fs.pathExists(attributesPath);\n if (!fileExist) {\n await fs.writeFile(attributesPath, GIT_ATTRIBUTES);\n } else {\n const gitAttributes = await fs.readFile(attributesPath, 'utf8');\n if (gitAttributes.includes(GIT_ATTRIBUTES)) {\n return; // already set\n }\n await fs.appendFile(attributesPath, `\\n${GIT_ATTRIBUTES}`);\n }\n }\n\n private async getGitAttributesPath(global = false) {\n const fromConfig = await gitconfig.get('core.attributesFile', { location: global ? 'global' : 'local' });\n if (fromConfig) {\n return fromConfig;\n }\n if (!global) {\n return '.gitattributes';\n }\n const xdgConfigHome = process.env.XDG_CONFIG_HOME;\n if (xdgConfigHome) {\n return join(xdgConfigHome, 'git', 'attributes');\n }\n return join(homedir(), '.config', 'git', 'attributes');\n }\n\n private stripBom(str) {\n return str[0] === '\\uFEFF' ? str.slice(1) : str;\n }\n\n static slots = [];\n // define your aspect dependencies here.\n // in case you need to use another aspect API.\n static dependencies = [CLIAspect, WorkspaceAspect];\n\n static runtime = MainRuntime;\n\n static async provider([cli, workspace]: [CLIMain, Workspace]) {\n const gitMain = new GitMain(workspace);\n const gitCmd = new GitCmd();\n gitCmd.commands = [new SetGitMergeDriverCmd(gitMain), new MergeBitmapsCmd(gitMain)];\n cli.register(gitCmd);\n cli.registerGroup('git', 'Git');\n return gitMain;\n }\n}\n\nGitAspect.addRuntime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,SAAS,CAAuB,EAAE;IAC5D,MAAM8C,OAAO,GAAG,IAAIhD,OAAO,CAACE,SAAS,CAAC;IACtC,MAAM+C,MAAM,GAAG,KAAIC,cAAM,GAAE;IAC3BD,MAAM,CAACE,QAAQ,GAAG,CAAC,KAAIC,yCAAoB,EAACJ,OAAO,CAAC,EAAE,KAAIK,+BAAe,EAACL,OAAO,CAAC,CAAC;IACnFD,GAAG,CAACO,QAAQ,CAACL,MAAM,CAAC;IACpBF,GAAG,CAACQ,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC;IAC/B,OAAOP,OAAO;EAChB;AACF;AAAC;AAAA,gCA1FYhD,OAAO,WA2EH,EAAE;AAAA,gCA3ENA,OAAO,kBA8EI,CAACwD,gBAAS,EAAEC,4BAAe,CAAC;AAAA,gCA9EvCzD,OAAO,aAgFD0D,kBAAW;AAY9BC,gBAAS,CAACC,UAAU,CAAC5D,OAAO,CAAC;AAAC,eAEfA,OAAO;AAAA"}
@@ -0,0 +1,4 @@
1
+ import { GitAspect } from './git.aspect';
2
+ export type { GitMain } from './git.main.runtime';
3
+ export default GitAspect;
4
+ export { GitAspect };
package/dist/index.js ADDED
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "GitAspect", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _git().GitAspect;
10
+ }
11
+ });
12
+ exports.default = void 0;
13
+ function _git() {
14
+ const data = require("./git.aspect");
15
+ _git = function () {
16
+ return data;
17
+ };
18
+ return data;
19
+ }
20
+ var _default = _git().GitAspect;
21
+ exports.default = _default;
22
+
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["GitAspect"],"sources":["index.ts"],"sourcesContent":["import { GitAspect } from './git.aspect';\n\nexport type { GitMain } from './git.main.runtime';\nexport default GitAspect;\nexport { GitAspect };\n"],"mappings":";;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAyC,eAG1BA,gBAAS;AAAA"}
@@ -0,0 +1,14 @@
1
+ import { Command, CommandOptions } from '@teambit/cli';
2
+ import { GitMain } from './git.main.runtime';
3
+ export declare class MergeBitmapsCmd implements Command {
4
+ private git;
5
+ name: string;
6
+ alias: string;
7
+ description: string;
8
+ options: CommandOptions;
9
+ group: string;
10
+ commands: Command[];
11
+ private: boolean;
12
+ constructor(git: GitMain);
13
+ report([ancestor, current, other]: string[]): Promise<string>;
14
+ }
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ require("core-js/modules/es.array.iterator.js");
5
+ require("core-js/modules/es.promise.js");
6
+ Object.defineProperty(exports, "__esModule", {
7
+ value: true
8
+ });
9
+ exports.MergeBitmapsCmd = void 0;
10
+ function _defineProperty2() {
11
+ const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
+ _defineProperty2 = function () {
13
+ return data;
14
+ };
15
+ return data;
16
+ }
17
+ function _chalk() {
18
+ const data = _interopRequireDefault(require("chalk"));
19
+ _chalk = function () {
20
+ return data;
21
+ };
22
+ return data;
23
+ }
24
+ const COMMAND_NAME = 'merge-bitmaps';
25
+
26
+ // - `%O`: ancestor’s version of the conflicting file
27
+ // - `%A`: current version of the conflicting file
28
+ // - `%B`: other branch's version of the conflicting file
29
+
30
+ class MergeBitmapsCmd {
31
+ // helpUrl = '';
32
+
33
+ constructor(git) {
34
+ this.git = git;
35
+ (0, _defineProperty2().default)(this, "name", `${COMMAND_NAME} <ancestor> <current> <other>`);
36
+ (0, _defineProperty2().default)(this, "alias", '');
37
+ (0, _defineProperty2().default)(this, "description", `a special command to merge conflicting bitmap files during git merge`);
38
+ (0, _defineProperty2().default)(this, "options", []);
39
+ (0, _defineProperty2().default)(this, "group", 'git');
40
+ (0, _defineProperty2().default)(this, "commands", []);
41
+ (0, _defineProperty2().default)(this, "private", true);
42
+ }
43
+ async report([ancestor, current, other]) {
44
+ const res = await this.git.mergeBitmaps(ancestor, current, other);
45
+ if (res) {
46
+ return _chalk().default.green('git merge driver was successfully set');
47
+ }
48
+ return _chalk().default.red('git merge driver was not set');
49
+ }
50
+ }
51
+ exports.MergeBitmapsCmd = MergeBitmapsCmd;
52
+
53
+ //# sourceMappingURL=merge-bitmaps.cmd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["COMMAND_NAME","MergeBitmapsCmd","constructor","git","report","ancestor","current","other","res","mergeBitmaps","chalk","green","red"],"sources":["merge-bitmaps.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { GitMain } from './git.main.runtime';\n\nconst COMMAND_NAME = 'merge-bitmaps';\n\n// - `%O`: ancestor’s version of the conflicting file\n// - `%A`: current version of the conflicting file\n// - `%B`: other branch's version of the conflicting file\n\nexport class MergeBitmapsCmd implements Command {\n name = `${COMMAND_NAME} <ancestor> <current> <other>`;\n alias = '';\n description = `a special command to merge conflicting bitmap files during git merge`;\n options = [] as CommandOptions;\n group = 'git';\n commands: Command[] = [];\n private = true;\n // helpUrl = '';\n\n constructor(private git: GitMain) {}\n\n async report([ancestor, current, other]: string[]) {\n const res = await this.git.mergeBitmaps(ancestor, current, other);\n if (res) {\n return chalk.green('git merge driver was successfully set');\n }\n return chalk.red('git merge driver was not set');\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA,MAAMA,YAAY,GAAG,eAAe;;AAEpC;AACA;AACA;;AAEO,MAAMC,eAAe,CAAoB;EAQ9C;;EAEAC,WAAW,CAASC,GAAY,EAAE;IAAA,KAAdA,GAAY,GAAZA,GAAY;IAAA,8CATxB,GAAEH,YAAa,+BAA8B;IAAA,+CAC7C,EAAE;IAAA,qDACK,sEAAqE;IAAA,iDAC1E,EAAE;IAAA,+CACJ,KAAK;IAAA,kDACS,EAAE;IAAA,iDACd,IAAI;EAGqB;EAEnC,MAAMI,MAAM,CAAC,CAACC,QAAQ,EAAEC,OAAO,EAAEC,KAAK,CAAW,EAAE;IACjD,MAAMC,GAAG,GAAG,MAAM,IAAI,CAACL,GAAG,CAACM,YAAY,CAACJ,QAAQ,EAAEC,OAAO,EAAEC,KAAK,CAAC;IACjE,IAAIC,GAAG,EAAE;MACP,OAAOE,gBAAK,CAACC,KAAK,CAAC,uCAAuC,CAAC;IAC7D;IACA,OAAOD,gBAAK,CAACE,GAAG,CAAC,8BAA8B,CAAC;EAClD;AACF;AAAC"}
@@ -0,0 +1,7 @@
1
+ ;
2
+ ;
3
+
4
+ export const compositions = [];
5
+ export const overview = [];
6
+
7
+ export const compositions_metadata = {"compositions":[]};
@@ -0,0 +1,17 @@
1
+ import { Command, CommandOptions } from '@teambit/cli';
2
+ import { GitMain } from './git.main.runtime';
3
+ declare type SetGitMergeDriverFlags = {
4
+ global?: boolean;
5
+ };
6
+ export declare class SetGitMergeDriverCmd implements Command {
7
+ private git;
8
+ name: string;
9
+ alias: string;
10
+ description: string;
11
+ options: CommandOptions;
12
+ group: string;
13
+ commands: Command[];
14
+ constructor(git: GitMain);
15
+ report(_args: any, flags: SetGitMergeDriverFlags): Promise<string>;
16
+ }
17
+ export {};
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ require("core-js/modules/es.promise.js");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.SetGitMergeDriverCmd = void 0;
9
+ function _defineProperty2() {
10
+ const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+ _defineProperty2 = function () {
12
+ return data;
13
+ };
14
+ return data;
15
+ }
16
+ function _chalk() {
17
+ const data = _interopRequireDefault(require("chalk"));
18
+ _chalk = function () {
19
+ return data;
20
+ };
21
+ return data;
22
+ }
23
+ const COMMAND_NAME = 'set-merge-driver';
24
+ class SetGitMergeDriverCmd {
25
+ // helpUrl = '';
26
+
27
+ constructor(git) {
28
+ this.git = git;
29
+ (0, _defineProperty2().default)(this, "name", COMMAND_NAME);
30
+ (0, _defineProperty2().default)(this, "alias", 'smd');
31
+ (0, _defineProperty2().default)(this, "description", `setup bit's git merge driver for bitmap files`);
32
+ (0, _defineProperty2().default)(this, "options", [['g', 'global', 'set the git merge driver globally']]);
33
+ (0, _defineProperty2().default)(this, "group", 'git');
34
+ (0, _defineProperty2().default)(this, "commands", []);
35
+ }
36
+ async report(_args, flags) {
37
+ const res = await this.git.setGitMergeDriver(flags);
38
+ if (res) {
39
+ return _chalk().default.green('git merge driver was successfully set');
40
+ }
41
+ return _chalk().default.red('git merge driver was not set');
42
+ }
43
+ }
44
+ exports.SetGitMergeDriverCmd = SetGitMergeDriverCmd;
45
+
46
+ //# sourceMappingURL=set-git-merge-driver.cmd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["COMMAND_NAME","SetGitMergeDriverCmd","constructor","git","report","_args","flags","res","setGitMergeDriver","chalk","green","red"],"sources":["set-git-merge-driver.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { GitMain } from './git.main.runtime';\n\nconst COMMAND_NAME = 'set-merge-driver';\n\ntype SetGitMergeDriverFlags = {\n global?: boolean;\n};\n\nexport class SetGitMergeDriverCmd implements Command {\n name = COMMAND_NAME;\n alias = 'smd';\n description = `setup bit's git merge driver for bitmap files`;\n options = [['g', 'global', 'set the git merge driver globally']] as CommandOptions;\n group = 'git';\n commands: Command[] = [];\n // helpUrl = '';\n\n constructor(private git: GitMain) {}\n\n async report(_args, flags: SetGitMergeDriverFlags) {\n const res = await this.git.setGitMergeDriver(flags);\n if (res) {\n return chalk.green('git merge driver was successfully set');\n }\n return chalk.red('git merge driver was not set');\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA,MAAMA,YAAY,GAAG,kBAAkB;AAMhC,MAAMC,oBAAoB,CAAoB;EAOnD;;EAEAC,WAAW,CAASC,GAAY,EAAE;IAAA,KAAdA,GAAY,GAAZA,GAAY;IAAA,8CARzBH,YAAY;IAAA,+CACX,KAAK;IAAA,qDACE,+CAA8C;IAAA,iDACnD,CAAC,CAAC,GAAG,EAAE,QAAQ,EAAE,mCAAmC,CAAC,CAAC;IAAA,+CACxD,KAAK;IAAA,kDACS,EAAE;EAGW;EAEnC,MAAMI,MAAM,CAACC,KAAK,EAAEC,KAA6B,EAAE;IACjD,MAAMC,GAAG,GAAG,MAAM,IAAI,CAACJ,GAAG,CAACK,iBAAiB,CAACF,KAAK,CAAC;IACnD,IAAIC,GAAG,EAAE;MACP,OAAOE,gBAAK,CAACC,KAAK,CAAC,uCAAuC,CAAC;IAC7D;IACA,OAAOD,gBAAK,CAACE,GAAG,CAAC,8BAA8B,CAAC;EAClD;AACF;AAAC"}
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@teambit/git",
3
+ "version": "0.0.1",
4
+ "main": "dist/index.js",
5
+ "componentId": {
6
+ "scope": "teambit.git",
7
+ "name": "git",
8
+ "version": "0.0.1"
9
+ },
10
+ "dependencies": {
11
+ "chalk": "2.4.2",
12
+ "fs-extra": "10.0.0",
13
+ "gitconfig": "2.0.8",
14
+ "core-js": "^3.0.0",
15
+ "@babel/runtime": "7.20.0",
16
+ "@teambit/harmony": "0.4.6",
17
+ "@teambit/cli": "0.0.736",
18
+ "@teambit/bit-error": "0.0.402",
19
+ "@teambit/workspace": "0.0.1096"
20
+ },
21
+ "devDependencies": {
22
+ "@types/fs-extra": "9.0.7",
23
+ "@types/mocha": "9.1.0",
24
+ "@types/node": "12.20.4",
25
+ "@types/react": "^17.0.8",
26
+ "@types/react-dom": "^17.0.5",
27
+ "@types/jest": "^26.0.0",
28
+ "@types/testing-library__jest-dom": "5.9.5"
29
+ },
30
+ "peerDependencies": {
31
+ "@teambit/legacy": "1.0.517",
32
+ "react": "^16.8.0 || ^17.0.0",
33
+ "react-dom": "^16.8.0 || ^17.0.0"
34
+ },
35
+ "license": "Apache-2.0",
36
+ "private": false,
37
+ "engines": {
38
+ "node": ">=12.22.0"
39
+ },
40
+ "repository": {
41
+ "type": "git",
42
+ "url": "https://github.com/teambit/bit"
43
+ },
44
+ "keywords": [
45
+ "bit",
46
+ "bit-aspect",
47
+ "components",
48
+ "collaboration",
49
+ "web",
50
+ "react",
51
+ "react-components",
52
+ "angular",
53
+ "angular-components"
54
+ ]
55
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "compilerOptions": {
3
+ "lib": [
4
+ "es2019",
5
+ "DOM",
6
+ "ES6",
7
+ "DOM.Iterable",
8
+ "ScriptHost"
9
+ ],
10
+ "target": "es2015",
11
+ "module": "commonjs",
12
+ "jsx": "react",
13
+ "allowJs": true,
14
+ "composite": true,
15
+ "declaration": true,
16
+ "sourceMap": true,
17
+ "skipLibCheck": true,
18
+ "experimentalDecorators": true,
19
+ "outDir": "dist",
20
+ "moduleResolution": "node",
21
+ "esModuleInterop": true,
22
+ "rootDir": ".",
23
+ "resolveJsonModule": true,
24
+ "emitDeclarationOnly": true,
25
+ "emitDecoratorMetadata": true,
26
+ "allowSyntheticDefaultImports": true,
27
+ "strictPropertyInitialization": false,
28
+ "strict": true,
29
+ "noImplicitAny": false,
30
+ "preserveConstEnums": true
31
+ },
32
+ "exclude": [
33
+ "dist",
34
+ "package.json"
35
+ ],
36
+ "include": [
37
+ "**/*",
38
+ "**/*.json"
39
+ ]
40
+ }
@@ -0,0 +1,29 @@
1
+ declare module '*.png' {
2
+ const value: any;
3
+ export = value;
4
+ }
5
+ declare module '*.svg' {
6
+ import type { FunctionComponent, SVGProps } from 'react';
7
+
8
+ export const ReactComponent: FunctionComponent<SVGProps<SVGSVGElement> & { title?: string }>;
9
+ const src: string;
10
+ export default src;
11
+ }
12
+
13
+ // @TODO Gilad
14
+ declare module '*.jpg' {
15
+ const value: any;
16
+ export = value;
17
+ }
18
+ declare module '*.jpeg' {
19
+ const value: any;
20
+ export = value;
21
+ }
22
+ declare module '*.gif' {
23
+ const value: any;
24
+ export = value;
25
+ }
26
+ declare module '*.bmp' {
27
+ const value: any;
28
+ export = value;
29
+ }
@@ -0,0 +1,42 @@
1
+ declare module '*.module.css' {
2
+ const classes: { readonly [key: string]: string };
3
+ export default classes;
4
+ }
5
+ declare module '*.module.scss' {
6
+ const classes: { readonly [key: string]: string };
7
+ export default classes;
8
+ }
9
+ declare module '*.module.sass' {
10
+ const classes: { readonly [key: string]: string };
11
+ export default classes;
12
+ }
13
+
14
+ declare module '*.module.less' {
15
+ const classes: { readonly [key: string]: string };
16
+ export default classes;
17
+ }
18
+
19
+ declare module '*.less' {
20
+ const classes: { readonly [key: string]: string };
21
+ export default classes;
22
+ }
23
+
24
+ declare module '*.css' {
25
+ const classes: { readonly [key: string]: string };
26
+ export default classes;
27
+ }
28
+
29
+ declare module '*.sass' {
30
+ const classes: { readonly [key: string]: string };
31
+ export default classes;
32
+ }
33
+
34
+ declare module '*.scss' {
35
+ const classes: { readonly [key: string]: string };
36
+ export default classes;
37
+ }
38
+
39
+ declare module '*.mdx' {
40
+ const component: any;
41
+ export default component;
42
+ }