bit-scope-client
Advanced tools
Comparing version 0.6.2 to 0.6.3
@@ -10,2 +10,7 @@ # Change Log | ||
## [0.6.3] - 2017-05-29 | ||
- file-extension of the dist file is based on the language defined in bit.json | ||
- add getRequiredFile function to the bit.json | ||
## [0.6.2] - 2017-05-21 | ||
@@ -12,0 +17,0 @@ |
@@ -55,2 +55,3 @@ 'use strict'; | ||
this.tester = _ramda2.default.path(['env', 'tester'], bitJson) || defaultBitJson.tester; | ||
this.lang = _ramda2.default.prop('lang', bitJson) || _constants.DEFAULT_LANGUAGE; | ||
this.dependencies = _ramda2.default.prop('dependencies', bitJson) || defaultBitJson.dependencies; | ||
@@ -62,2 +63,11 @@ this.packageDependencies = _ramda2.default.prop('packageDependencies', bitJson); | ||
_createClass(BitJson, [{ | ||
key: 'getFileExtension', | ||
value: function getFileExtension() { | ||
switch (this.lang) { | ||
case _constants.DEFAULT_LANGUAGE: | ||
default: | ||
return 'js'; | ||
} | ||
} | ||
}, { | ||
key: 'getDependenciesArray', | ||
@@ -129,2 +139,19 @@ value: function getDependenciesArray() { | ||
} | ||
}, { | ||
key: 'getRequiredFile', | ||
value: function getRequiredFile() { | ||
return !this.compiler || this.compiler !== _constants.NO_PLUGIN_TYPE ? _path2.default.join(_constants.DEFAULT_DIST_DIRNAME, this.impl) : this.impl; | ||
} | ||
}, { | ||
key: 'distImplFileName', | ||
get: function get() { | ||
var baseImplName = _path2.default.parse(this.impl).name; | ||
return `${baseImplName}.${this.getFileExtension()}`; | ||
} | ||
}, { | ||
key: 'distSpecFileName', | ||
get: function get() { | ||
var baseSpecName = _path2.default.parse(this.spec).name; | ||
return `${baseSpecName}.${this.getFileExtension()}`; | ||
} | ||
}], [{ | ||
@@ -131,0 +158,0 @@ key: 'loadIfExists', |
@@ -47,3 +47,3 @@ 'use strict'; | ||
function getRequiredFile(bitJson) { | ||
return !bitJson.compiler || bitJson.compiler !== _constants.NO_PLUGIN_TYPE ? _path2.default.join(_constants.DEFAULT_DIST_DIRNAME, bitJson.impl) : bitJson.impl; | ||
return !bitJson.compiler || bitJson.compiler !== _constants.NO_PLUGIN_TYPE ? _path2.default.join(_constants.DEFAULT_DIST_DIRNAME, bitJson.distImplFileName) : bitJson.distImplFileName; | ||
} | ||
@@ -50,0 +50,0 @@ |
@@ -6,3 +6,3 @@ 'use strict'; | ||
}); | ||
exports.LOCAL_SCOPE_NOTATION = exports.LATEST_BIT_VERSION = exports.DEFAULT_BOXNAME = exports.DEFAULT_DIST_DIRNAME = exports.BIT_JSON_NAME = exports.DEFAULT_LICENSE_FILENAME = exports.VERSION_DELIMITER = exports.NO_PLUGIN_TYPE = exports.COMPONENTS_DIRNAME = exports.SCOPE_JSON = exports.BIT_HIDDEN_DIR = exports.REMOTE_ALIAS_SIGN = exports.ID_DELIMITER = exports.CFG_HUB_DOMAIN_KEY = exports.DEFAULT_HUB_DOMAIN = exports.CFG_SSH_KEY_FILE_KEY = exports.DEFAULT_SSH_KEY_FILE = exports.SPACE_DELIMITER = exports.NULL_BYTE = exports.GLOBAL_REMOTES = exports.GLOBAL_CONFIG_FILE = exports.BIT_VERSION = exports.GLOBAL_CONFIG = exports.CACHE_ROOT = undefined; | ||
exports.DEFAULT_LANGUAGE = exports.LOCAL_SCOPE_NOTATION = exports.LATEST_BIT_VERSION = exports.DEFAULT_BOXNAME = exports.DEFAULT_DIST_DIRNAME = exports.BIT_JSON_NAME = exports.DEFAULT_LICENSE_FILENAME = exports.VERSION_DELIMITER = exports.NO_PLUGIN_TYPE = exports.COMPONENTS_DIRNAME = exports.SCOPE_JSON = exports.BIT_HIDDEN_DIR = exports.REMOTE_ALIAS_SIGN = exports.ID_DELIMITER = exports.CFG_HUB_DOMAIN_KEY = exports.DEFAULT_HUB_DOMAIN = exports.CFG_SSH_KEY_FILE_KEY = exports.DEFAULT_SSH_KEY_FILE = exports.SPACE_DELIMITER = exports.NULL_BYTE = exports.GLOBAL_REMOTES = exports.GLOBAL_CONFIG_FILE = exports.BIT_VERSION = exports.GLOBAL_CONFIG = exports.CACHE_ROOT = undefined; | ||
@@ -61,2 +61,3 @@ var _userHome = require('user-home'); | ||
var LOCAL_SCOPE_NOTATION = exports.LOCAL_SCOPE_NOTATION = '@this'; | ||
var DEFAULT_LANGUAGE = exports.DEFAULT_LANGUAGE = 'javascript'; | ||
//# sourceMappingURL=constants.js.map |
{ | ||
"name": "bit-scope-client", | ||
"version": "0.6.2", | ||
"version": "0.6.3", | ||
"description": "A module for consuming bit components out of a remote scope", | ||
@@ -5,0 +5,0 @@ "main": "dist/main.js", |
@@ -5,3 +5,3 @@ // @flow | ||
import path from 'path'; | ||
import { BIT_JSON_NAME, VERSION_DELIMITER, ID_DELIMITER } from '../constants'; | ||
import { BIT_JSON_NAME, VERSION_DELIMITER, ID_DELIMITER, DEFAULT_LANGUAGE, DEFAULT_DIST_DIRNAME, NO_PLUGIN_TYPE } from '../constants'; | ||
import DependencyMap from '../dependency-map'; | ||
@@ -15,3 +15,3 @@ import InvalidBitJsonException from '../exceptions/invalid-bit-json'; | ||
class BitJson { | ||
impl: ?string; | ||
impl: string; | ||
spec: ?string; | ||
@@ -21,2 +21,3 @@ misc: ?string[]; | ||
tester: ?string; | ||
lang: ?string; | ||
dependencies: ?{[string]: string}; | ||
@@ -32,2 +33,3 @@ packageDependencies: ?{[string]: string}; | ||
this.tester = R.path(['env', 'tester'], bitJson) || defaultBitJson.tester; | ||
this.lang = R.prop('lang', bitJson) || DEFAULT_LANGUAGE; | ||
this.dependencies = R.prop('dependencies', bitJson) || defaultBitJson.dependencies; | ||
@@ -38,2 +40,20 @@ this.packageDependencies = R.prop('packageDependencies', bitJson); | ||
getFileExtension(): string { | ||
switch (this.lang) { | ||
case DEFAULT_LANGUAGE: | ||
default: | ||
return 'js'; | ||
} | ||
} | ||
get distImplFileName(): string { | ||
const baseImplName = path.parse(this.impl).name; | ||
return `${baseImplName}.${this.getFileExtension()}`; | ||
} | ||
get distSpecFileName(): string { | ||
const baseSpecName = path.parse(this.spec).name; | ||
return `${baseSpecName}.${this.getFileExtension()}`; | ||
} | ||
getDependenciesArray(): string[] { | ||
@@ -95,2 +115,7 @@ return R.toPairs(this.dependencies) | ||
getRequiredFile(): string { | ||
return !this.compiler || this.compiler !== NO_PLUGIN_TYPE ? | ||
path.join(DEFAULT_DIST_DIRNAME, this.impl) : this.impl; | ||
} | ||
static loadIfExists(bitPath: string): ?BitJson { | ||
@@ -97,0 +122,0 @@ const bitJsonPath = composePath(bitPath); |
@@ -27,3 +27,3 @@ /** @flow */ | ||
return !bitJson.compiler || bitJson.compiler !== NO_PLUGIN_TYPE ? | ||
path.join(DEFAULT_DIST_DIRNAME, bitJson.impl) : bitJson.impl; | ||
path.join(DEFAULT_DIST_DIRNAME, bitJson.distImplFileName) : bitJson.distImplFileName; | ||
} | ||
@@ -30,0 +30,0 @@ |
@@ -46,1 +46,2 @@ import userHome from 'user-home'; | ||
export const LOCAL_SCOPE_NOTATION = '@this'; | ||
export const DEFAULT_LANGUAGE = 'javascript'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
548799
9063