@teambit/config 0.0.396 → 0.0.397

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/config.d.ts CHANGED
@@ -15,6 +15,16 @@ export declare class Config {
15
15
  get path(): PathOsBased | undefined;
16
16
  get config(): HostConfig | undefined;
17
17
  static loadIfExist(dirPath: PathOsBased): Promise<Config | undefined | any>;
18
+ /**
19
+ * Ensure the given directory has a workspace config
20
+ * Load if existing and create new if not
21
+ *
22
+ * @static
23
+ * @param {PathOsBasedAbsolute} dirPath
24
+ * @param {WorkspaceConfigFileProps} [workspaceConfigProps={} as any]
25
+ * @returns {Promise<WorkspaceConfig>}
26
+ * @memberof WorkspaceConfig
27
+ */
18
28
  static ensureWorkspace(dirPath: PathOsBasedAbsolute, workspaceConfigProps?: WorkspaceConfigFileProps, legacyInitProps?: LegacyInitProps): Promise<Config>;
19
29
  get extensions(): ExtensionDataList | undefined;
20
30
  extension(extensionId: string, ignoreVersion: boolean): ExtensionDataEntry | undefined;
package/dist/types.d.ts CHANGED
@@ -4,7 +4,14 @@ import { SetExtensionOptions } from './config';
4
4
  export declare type WriteOptions = {
5
5
  dir?: PathOsBasedAbsolute;
6
6
  };
7
+ /**
8
+ * An interface implemented by component host (workspace / scope) config file
9
+ * This used to be able to abstract the workspace/scope config.
10
+ */
7
11
  export interface HostConfig {
12
+ /**
13
+ * Path to the actual file
14
+ */
8
15
  path: PathOsBased;
9
16
  extensions: ExtensionDataList;
10
17
  extension: (extensionId: string, ignoreVersion: boolean) => ExtensionDataEntry;
@@ -61,15 +61,76 @@ export declare class WorkspaceConfig implements HostConfig {
61
61
  private loadExtensions;
62
62
  extension(extensionId: string, ignoreVersion: boolean): any;
63
63
  setExtension(extensionId: string, config: Record<string, any>, options: SetExtensionOptions): any;
64
+ /**
65
+ * Create an instance of the WorkspaceConfig by an instance of the legacy config
66
+ *
67
+ * @static
68
+ * @param {*} legacyConfig
69
+ * @returns
70
+ * @memberof WorkspaceConfig
71
+ */
64
72
  static fromLegacyConfig(legacyConfig: any): WorkspaceConfig;
73
+ /**
74
+ * Create an instance of the WorkspaceConfig by data
75
+ *
76
+ * @static
77
+ * @param {WorkspaceConfigFileProps} data
78
+ * @returns
79
+ * @memberof WorkspaceConfig
80
+ */
65
81
  static fromObject(data: WorkspaceConfigFileProps): WorkspaceConfig;
82
+ /**
83
+ * Create an instance of the WorkspaceConfig by the workspace config template and override values
84
+ *
85
+ * @static
86
+ * @param {WorkspaceConfigFileProps} data values to override in the default template
87
+ * @returns
88
+ * @memberof WorkspaceConfig
89
+ */
66
90
  static create(props: WorkspaceConfigFileProps, dirPath?: PathOsBasedAbsolute, legacyInitProps?: LegacyInitProps): Promise<WorkspaceConfig>;
91
+ /**
92
+ * Ensure the given directory has a workspace config
93
+ * Load if existing and create new if not
94
+ *
95
+ * @static
96
+ * @param {PathOsBasedAbsolute} dirPath
97
+ * @param {WorkspaceConfigFileProps} [workspaceConfigProps={} as any]
98
+ * @returns {Promise<WorkspaceConfig>}
99
+ * @memberof WorkspaceConfig
100
+ */
67
101
  static ensure(dirPath: PathOsBasedAbsolute, workspaceConfigProps?: WorkspaceConfigFileProps, legacyInitProps?: LegacyInitProps): Promise<WorkspaceConfig>;
102
+ /**
103
+ * A function that register to the legacy ensure function in order to transform old props structure
104
+ * to the new one
105
+ * @param dirPath
106
+ * @param standAlone
107
+ * @param legacyWorkspaceConfigProps
108
+ */
68
109
  static onLegacyEnsure(dirPath: PathOsBasedAbsolute, standAlone: boolean, legacyWorkspaceConfigProps?: LegacyWorkspaceConfigProps): Promise<WorkspaceConfig>;
69
110
  static reset(dirPath: PathOsBasedAbsolute, resetHard: boolean): Promise<void>;
111
+ /**
112
+ * Get the path of the bit.jsonc file by a containing folder
113
+ *
114
+ * @static
115
+ * @param {PathOsBased} dirPath containing dir of the bit.jsonc file
116
+ * @returns {PathOsBased}
117
+ * @memberof WorkspaceConfig
118
+ */
70
119
  static composeWorkspaceJsoncPath(dirPath: PathOsBased): PathOsBased;
71
120
  static pathHasWorkspaceJsonc(dirPath: PathOsBased): Promise<boolean>;
121
+ /**
122
+ * Check if the given dir has workspace config (new or legacy)
123
+ * @param dirPath
124
+ */
72
125
  static isExist(dirPath: PathOsBased): Promise<boolean | undefined>;
126
+ /**
127
+ * Load the workspace configuration if it's exist
128
+ *
129
+ * @static
130
+ * @param {PathOsBased} dirPath
131
+ * @returns {(Promise<WorkspaceConfig | undefined>)}
132
+ * @memberof WorkspaceConfig
133
+ */
73
134
  static loadIfExist(dirPath: PathOsBased): Promise<WorkspaceConfig | undefined>;
74
135
  static _loadFromWorkspaceJsonc(workspaceJsoncPath: PathOsBased): Promise<WorkspaceConfig>;
75
136
  write({ dir }: {
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/config",
3
- "version": "0.0.396",
3
+ "version": "0.0.397",
4
4
  "homepage": "https://bit.dev/teambit/harmony/config",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.harmony",
8
8
  "name": "config",
9
- "version": "0.0.396"
9
+ "version": "0.0.397"
10
10
  },
11
11
  "dependencies": {
12
12
  "@teambit/harmony": "0.2.11",
@@ -16,8 +16,8 @@
16
16
  "chalk": "2.4.2",
17
17
  "@babel/runtime": "7.12.18",
18
18
  "core-js": "^3.0.0",
19
- "@teambit/cli": "0.0.385",
20
- "@teambit/bit-error": "0.0.371"
19
+ "@teambit/cli": "0.0.386",
20
+ "@teambit/bit-error": "0.0.372"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@types/fs-extra": "9.0.7",
@@ -30,7 +30,7 @@
30
30
  "@types/node": "12.20.4"
31
31
  },
32
32
  "peerDependencies": {
33
- "@teambit/legacy": "1.0.171",
33
+ "@teambit/legacy": "1.0.172",
34
34
  "react-dom": "^16.8.0 || ^17.0.0",
35
35
  "react": "^16.8.0 || ^17.0.0"
36
36
  },
@@ -58,7 +58,7 @@
58
58
  "react": "-"
59
59
  },
60
60
  "peerDependencies": {
61
- "@teambit/legacy": "1.0.171",
61
+ "@teambit/legacy": "1.0.172",
62
62
  "react-dom": "^16.8.0 || ^17.0.0",
63
63
  "react": "^16.8.0 || ^17.0.0"
64
64
  }
package/tsconfig.json CHANGED
@@ -25,7 +25,6 @@
25
25
  "strict": true,
26
26
  "noImplicitAny": false,
27
27
  "rootDir": ".",
28
- "removeComments": true,
29
28
  "preserveConstEnums": true,
30
29
  "resolveJsonModule": true
31
30
  },