Skip to content

Commit

Permalink
Merge branch 'master' into feature/#540-#541-yarn-package-manager-config
Browse files Browse the repository at this point in the history
  • Loading branch information
GiladShoham committed Jan 7, 2018
2 parents e8147b2 + 0c0ed97 commit 3664a39
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [unreleased]

- rename default extension to core extension
- when a nested dependency is imported directly, re-link all its dependents
- [#527](https://github.com/teambit/bit/issues/527) rename structure property in bit.json
- support yarn as package manager
Expand Down
2 changes: 1 addition & 1 deletion src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const DEFAULT_EXTENSIONS = {
'ext-docs-parser': {
config: {},
options: {
default: true
core: true
}
}
};
Expand Down
16 changes: 8 additions & 8 deletions src/extensions/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import HooksManager, { HookAction } from '../hooks';
import { HOOKS_NAMES } from '../constants';

const HooksManagerInstance = HooksManager.getInstance();
const DEFAULT_EXTENSIONS_PATH = './default-extensions';
const CORE_EXTENSIONS_PATH = './core-extensions';

type NewCommand = {
name: string,
Expand Down Expand Up @@ -118,7 +118,7 @@ export default class Extension {
* The file path is relative to the bit.json of the project or absolute
* @param {string} name - name of the extension
* @param {Object} rawConfig - raw config for the extension
* @param {Object} options - extension options such as - disabled, file, default
* @param {Object} options - extension options such as - disabled, file, core
* @param {string} consumerPath - path to the consumer folder (to load the file relatively)
* @param {string} scopePath - scope which stores the extension code
*/
Expand All @@ -140,7 +140,7 @@ export default class Extension {
}
// Require extension from scope
try {
const componentPath = _getExtensionPath(name, scopePath, options.default);
const componentPath = _getExtensionPath(name, scopePath, options.core);
return Extension.loadFromFile(name, componentPath, rawConfig, options);
} catch (err) {
logger.error(`loading extension ${name} faild`);
Expand Down Expand Up @@ -215,8 +215,8 @@ const _loadScope = async (scopePath: ?string) => {
return consumer.scope;
};

const _getDefaultExtensionPath = (name: string): string => {
const componentPath = path.join(__dirname, DEFAULT_EXTENSIONS_PATH, name);
const _getCoreExtensionPath = (name: string): string => {
const componentPath = path.join(__dirname, CORE_EXTENSIONS_PATH, name);
return componentPath;
};

Expand All @@ -228,9 +228,9 @@ const _getRegularExtensionPath = (name: string, scopePath: string): string => {
return componentPath;
};

const _getExtensionPath = (name: string, scopePath: string, isDefault: boolean = false): string => {
if (isDefault) {
return _getDefaultExtensionPath(name);
const _getExtensionPath = (name: string, scopePath: string, isCore: boolean = false): string => {
if (isCore) {
return _getCoreExtensionPath(name);
}
return _getRegularExtensionPath(name, scopePath);
};
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/extensions-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { GLOBAL_CONFIG, BIT_JSON } from '../constants';

/**
* Load all extensions
* Regular, defaults, globals
* Regular, core, globals
*/
export default (async function loadExtensions(): Extension[] {
try {
Expand Down

0 comments on commit 3664a39

Please sign in to comment.