@teambit/workspace.testing.mock-workspace 0.0.2
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.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/mock-workspace.d.ts +15 -0
- package/dist/mock-workspace.js +44 -0
- package/dist/mock-workspace.js.map +1 -0
- package/index.ts +1 -0
- package/mock-workspace.ts +29 -0
- package/package-tar/teambit-workspace.testing.mock-workspace-0.0.2.tgz +0 -0
- package/package.json +58 -0
- package/tsconfig.json +26 -0
- package/types/asset.d.ts +29 -0
- package/types/style.d.ts +42 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { mockWorkspace, destroyWorkspace, WorkspaceData } from './mock-workspace';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.destroyWorkspace = exports.mockWorkspace = void 0;
|
|
4
|
+
var mock_workspace_1 = require("./mock-workspace");
|
|
5
|
+
Object.defineProperty(exports, "mockWorkspace", { enumerable: true, get: function () { return mock_workspace_1.mockWorkspace; } });
|
|
6
|
+
Object.defineProperty(exports, "destroyWorkspace", { enumerable: true, get: function () { return mock_workspace_1.destroyWorkspace; } });
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,mDAAkF;AAAzE,+GAAA,aAAa,OAAA;AAAE,kHAAA,gBAAgB,OAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare type WorkspaceData = {
|
|
2
|
+
workspacePath: string;
|
|
3
|
+
remoteScopePath: string;
|
|
4
|
+
remoteScopeName: string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* setup a new workspace on a temp directory and setup a bare-scope locally to simulate a remote scope for commands
|
|
8
|
+
* such as `bit export`.
|
|
9
|
+
* call `destroyWorkspace()` once the tests completed to keep the filesystem clean.
|
|
10
|
+
*/
|
|
11
|
+
export declare function mockWorkspace(): WorkspaceData;
|
|
12
|
+
/**
|
|
13
|
+
* deletes the paths created by mockWorkspace. pass the results you got from `mockWorkspace()`
|
|
14
|
+
*/
|
|
15
|
+
export declare function destroyWorkspace(workspaceData: WorkspaceData): Promise<void>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.destroyWorkspace = exports.mockWorkspace = void 0;
|
|
16
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
17
|
+
const e2e_helper_1 = __importDefault(require("@teambit/legacy/dist/e2e-helper/e2e-helper"));
|
|
18
|
+
/**
|
|
19
|
+
* setup a new workspace on a temp directory and setup a bare-scope locally to simulate a remote scope for commands
|
|
20
|
+
* such as `bit export`.
|
|
21
|
+
* call `destroyWorkspace()` once the tests completed to keep the filesystem clean.
|
|
22
|
+
*/
|
|
23
|
+
function mockWorkspace() {
|
|
24
|
+
const legacyHelper = new e2e_helper_1.default();
|
|
25
|
+
legacyHelper.scopeHelper.setNewLocalAndRemoteScopesHarmony();
|
|
26
|
+
legacyHelper.bitJsonc.setupDefault();
|
|
27
|
+
return {
|
|
28
|
+
workspacePath: legacyHelper.scopes.localPath,
|
|
29
|
+
remoteScopePath: legacyHelper.scopes.remotePath,
|
|
30
|
+
remoteScopeName: legacyHelper.scopes.remote,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
exports.mockWorkspace = mockWorkspace;
|
|
34
|
+
/**
|
|
35
|
+
* deletes the paths created by mockWorkspace. pass the results you got from `mockWorkspace()`
|
|
36
|
+
*/
|
|
37
|
+
function destroyWorkspace(workspaceData) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
const { workspacePath, remoteScopePath } = workspaceData;
|
|
40
|
+
yield Promise.all([workspacePath, remoteScopePath].map((_) => fs_extra_1.default.remove(_)));
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
exports.destroyWorkspace = destroyWorkspace;
|
|
44
|
+
//# sourceMappingURL=mock-workspace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock-workspace.js","sourceRoot":"","sources":["../mock-workspace.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,wDAA0B;AAC1B,4FAAsE;AAItE;;;;GAIG;AACH,SAAgB,aAAa;IAC3B,MAAM,YAAY,GAAG,IAAI,oBAAY,EAAE,CAAC;IACxC,YAAY,CAAC,WAAW,CAAC,iCAAiC,EAAE,CAAC;IAC7D,YAAY,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC;IAErC,OAAO;QACL,aAAa,EAAE,YAAY,CAAC,MAAM,CAAC,SAAS;QAC5C,eAAe,EAAE,YAAY,CAAC,MAAM,CAAC,UAAU;QAC/C,eAAe,EAAE,YAAY,CAAC,MAAM,CAAC,MAAM;KAC5C,CAAC;AACJ,CAAC;AAVD,sCAUC;AAED;;GAEG;AACH,SAAsB,gBAAgB,CAAC,aAA4B;;QACjE,MAAM,EAAE,aAAa,EAAE,eAAe,EAAE,GAAG,aAAa,CAAC;QACzD,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,kBAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/E,CAAC;CAAA;AAHD,4CAGC"}
|
package/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { mockWorkspace, destroyWorkspace, WorkspaceData } from './mock-workspace';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import fs from 'fs-extra';
|
|
2
|
+
import LegacyHelper from '@teambit/legacy/dist/e2e-helper/e2e-helper';
|
|
3
|
+
|
|
4
|
+
export type WorkspaceData = { workspacePath: string; remoteScopePath: string; remoteScopeName: string };
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* setup a new workspace on a temp directory and setup a bare-scope locally to simulate a remote scope for commands
|
|
8
|
+
* such as `bit export`.
|
|
9
|
+
* call `destroyWorkspace()` once the tests completed to keep the filesystem clean.
|
|
10
|
+
*/
|
|
11
|
+
export function mockWorkspace(): WorkspaceData {
|
|
12
|
+
const legacyHelper = new LegacyHelper();
|
|
13
|
+
legacyHelper.scopeHelper.setNewLocalAndRemoteScopesHarmony();
|
|
14
|
+
legacyHelper.bitJsonc.setupDefault();
|
|
15
|
+
|
|
16
|
+
return {
|
|
17
|
+
workspacePath: legacyHelper.scopes.localPath,
|
|
18
|
+
remoteScopePath: legacyHelper.scopes.remotePath,
|
|
19
|
+
remoteScopeName: legacyHelper.scopes.remote,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* deletes the paths created by mockWorkspace. pass the results you got from `mockWorkspace()`
|
|
25
|
+
*/
|
|
26
|
+
export async function destroyWorkspace(workspaceData: WorkspaceData) {
|
|
27
|
+
const { workspacePath, remoteScopePath } = workspaceData;
|
|
28
|
+
await Promise.all([workspacePath, remoteScopePath].map((_) => fs.remove(_)));
|
|
29
|
+
}
|
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@teambit/workspace.testing.mock-workspace",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"componentId": {
|
|
6
|
+
"scope": "teambit.workspace",
|
|
7
|
+
"name": "testing/mock-workspace",
|
|
8
|
+
"version": "0.0.2"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"fs-extra": "10.0.0"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@types/fs-extra": "9.0.7",
|
|
15
|
+
"@types/mocha": "5.2.7",
|
|
16
|
+
"@babel/runtime": "7.12.18",
|
|
17
|
+
"@types/node": "12.20.4",
|
|
18
|
+
"@types/jest": "26.0.20"
|
|
19
|
+
},
|
|
20
|
+
"peerDependencies": {},
|
|
21
|
+
"license": "Apache-2.0",
|
|
22
|
+
"bit": {
|
|
23
|
+
"bindingPrefix": "@teambit",
|
|
24
|
+
"env": {},
|
|
25
|
+
"overrides": {
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@teambit/legacy": "-"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@teambit/legacy": "-",
|
|
31
|
+
"@types/mocha": "5.2.7",
|
|
32
|
+
"@babel/runtime": "7.12.18",
|
|
33
|
+
"@types/node": "12.20.4",
|
|
34
|
+
"@types/jest": "26.0.20"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"private": false,
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=12.22.0"
|
|
41
|
+
},
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "https://github.com/teambit/bit"
|
|
45
|
+
},
|
|
46
|
+
"keywords": [
|
|
47
|
+
"bit",
|
|
48
|
+
"components",
|
|
49
|
+
"collaboration",
|
|
50
|
+
"web",
|
|
51
|
+
"react",
|
|
52
|
+
"react-components",
|
|
53
|
+
"angular",
|
|
54
|
+
"angular-components",
|
|
55
|
+
"vue",
|
|
56
|
+
"vue-components"
|
|
57
|
+
]
|
|
58
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"lib": [
|
|
4
|
+
"es2019",
|
|
5
|
+
"DOM",
|
|
6
|
+
"ES6",
|
|
7
|
+
"DOM.Iterable"
|
|
8
|
+
],
|
|
9
|
+
"target": "es2015",
|
|
10
|
+
"module": "commonjs",
|
|
11
|
+
"jsx": "react",
|
|
12
|
+
"allowJs": true,
|
|
13
|
+
"composite": true,
|
|
14
|
+
"declaration": true,
|
|
15
|
+
"sourceMap": true,
|
|
16
|
+
"skipLibCheck": true,
|
|
17
|
+
"outDir": "dist",
|
|
18
|
+
"moduleResolution": "node",
|
|
19
|
+
"esModuleInterop": true,
|
|
20
|
+
"rootDir": ".",
|
|
21
|
+
"resolveJsonModule": true
|
|
22
|
+
},
|
|
23
|
+
"exclude": [
|
|
24
|
+
"dist"
|
|
25
|
+
]
|
|
26
|
+
}
|
package/types/asset.d.ts
ADDED
|
@@ -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
|
+
}
|
package/types/style.d.ts
ADDED
|
@@ -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
|
+
}
|