@pzlr/build-core
Advanced tools
Comparing version 0.2.1 to 0.2.3
@@ -12,3 +12,2 @@ 'use strict'; | ||
let config = {}; | ||
if (configExists) { | ||
@@ -23,5 +22,9 @@ try { | ||
} else { | ||
console.log('Warning: .pzlrrc doesn\'t exist'); | ||
console.warn('Warning: .pzlrrc doesn\'t exist'); | ||
} | ||
/** | ||
* Config object | ||
* @type {!Object} | ||
*/ | ||
module.exports = config; |
'use strict'; | ||
const Sugar = require('sugar'); | ||
const | ||
Sugar = require('sugar'), | ||
validators = require('./validators'); | ||
const validators = require('./validators'); | ||
const blockTypes = { | ||
@@ -15,2 +15,9 @@ i: 'interface', | ||
class Declaration { | ||
/** | ||
* Parses the specified string declaration of a package and returns a new Declaration object | ||
* | ||
* @param {string} declaration | ||
* @param {boolean=} [test] | ||
* @returns {Declaration} | ||
*/ | ||
static parse(declaration, test = false) { | ||
@@ -45,2 +52,6 @@ if (test && !/package\(/.test(declaration)) { | ||
/** | ||
* @param {(string|!Object)} declaration | ||
* @returns {!Declaration} | ||
*/ | ||
constructor(declaration) { | ||
@@ -59,2 +70,3 @@ if (typeof declaration === 'string') { | ||
/** @returns {!Object} */ | ||
toJSON() { | ||
@@ -64,2 +76,3 @@ return Sugar.Object.select(this, ['name', 'parent', 'dependencies']); | ||
/** @returns {string} */ | ||
toString() { | ||
@@ -69,7 +82,7 @@ let res = `package('${this.name}')`; | ||
if (this.parent) { | ||
res += `\n .extends('${this.parent}')`; | ||
res += `\n\t.extends('${this.parent}')`; | ||
} | ||
if (this.dependencies.length) { | ||
res += `\n .dependencies('${this.dependencies.join(`', '`)}')`; | ||
res += `\n\t.dependencies('${this.dependencies.join(`', '`)}')`; | ||
} | ||
@@ -76,0 +89,0 @@ |
@@ -9,4 +9,14 @@ 'use strict'; | ||
/** | ||
* Source directory | ||
* @type {string} | ||
*/ | ||
module.exports.sourceDir = sourceDir; | ||
module.exports.block = (name) => path.join(sourceDir, 'blocks', name); | ||
/** | ||
* Returns an absolute path to a block by the specified name | ||
* | ||
* @param {string} name | ||
* @returns {string} | ||
*/ | ||
module.exports.block = (name) => path.join(sourceDir, 'blocks', name).replace(/\\/g, '/'); |
'use strict'; | ||
const joi = require('joi'); | ||
const | ||
joi = require('joi'), | ||
blockNameRegExp = /^[bigp]-[a-z0-9][a-z0-9-_]*$/; | ||
const blockNameRegExp = /^[bigp]-[a-z0-9][a-z0-9-_]*$/; | ||
/** | ||
* Returns true if the specified name is valid for a block | ||
* | ||
* @param {string} name | ||
* @returns {boolean} | ||
*/ | ||
function blockName(name) { | ||
@@ -32,4 +38,13 @@ return blockNameRegExp.test(name); | ||
/** | ||
* Validates the specified package declaration | ||
* | ||
* @template {T} | ||
* @param {T} obj | ||
* @returns {T} | ||
*/ | ||
function declaration(obj) { | ||
const {error, value} = joi.validate(obj, declarationSchema); | ||
const | ||
{error, value} = joi.validate(obj, declarationSchema); | ||
if (error) { | ||
@@ -36,0 +51,0 @@ throw new TypeError(`Invalid declaration object: ${error.message}`); |
{ | ||
"name": "@pzlr/build-core", | ||
"version": "0.2.1", | ||
"description": "Core tools for pzlr", | ||
"homepage": "https://github.com/pzlr/build-core#readme", | ||
"main": "index.js", | ||
"version": "0.2.3", | ||
"license": "MIT", | ||
"author": { | ||
"name": "Konstantin Kutsyllo", | ||
"email": "trikadin@mail.ru", | ||
"url": "https://github.com/trikadin" | ||
}, | ||
"repository": { | ||
@@ -9,9 +17,8 @@ "url": "git@github.com:pzlr/build-core.git", | ||
}, | ||
"author": "Konstantin Kutsyllo <trikadin@mail.ru>", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"babel-eslint": "^7.0.0", | ||
"eslint": "^3.8.1", | ||
"eslint-plugin-flowtype": "^2.25.0" | ||
"bugs": { | ||
"url": "https://github.com/pzlr/build-core/issues" | ||
}, | ||
"keywords": [ | ||
"pzlr" | ||
], | ||
"dependencies": { | ||
@@ -21,3 +28,7 @@ "fs-extra": "^0.30.0", | ||
"sugar": "^2.0.1" | ||
}, | ||
"devDependencies": { | ||
"babel-eslint": "^7.0.0", | ||
"eslint": "^3.8.1" | ||
} | ||
} |
@@ -1,2 +0,18 @@ | ||
# Build Core | ||
Core tools for pzlr | ||
Build Core | ||
========== | ||
Core tools for pzlr. | ||
## .pzlrrc | ||
* **sourceDir** - root source directory; | ||
* **projectType** - project type (ts, js, static). | ||
**Example:** | ||
```json | ||
{ | ||
"sourceDir": "./src", | ||
"projectType": "js" | ||
} | ||
``` |
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
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
45599
2
163
0
1
19
2