Skip to content
This repository was archived by the owner on Jul 23, 2019. It is now read-only.

Commit a2048a8

Browse files
author
Alessandro Bellini
authored
Merge pull request #12 from spryker/develop
Version 2.1.0
2 parents 95baac9 + 0726033 commit a2048a8

File tree

5 files changed

+70
-33
lines changed

5 files changed

+70
-33
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
### 2.1.0
4+
- new dependencies (`poscss-loader` and `autoprefixer`)
5+
- updated dependencies (less warnings)
6+
- provider system updated (full support for bundle aliases)
7+
- allow configuration extensions
8+
39
### 2.0.4
410
- yves build process searches for common entry points in core, even when there is a target theme
511

lib/automation.js

+14-7
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,22 @@ function automation(target, targetPattern, theme) {
5555

5656
try {
5757
if (extensions.count.valid > 0) {
58-
if (extensions.count.valid > 1) {
59-
console.warn(` ${String.fromCharCode(0x2517)} warning: more than one extension for the same application/theme - first will be processed, the others ignored`.yellow);
60-
}
58+
config = R.keys(extensions.valid).reduce((baseConfig, key) => {
59+
try {
60+
console.log(` ${String.fromCharCode(0x2517)} configuration:`.gray, extensions.valid[key].magenta);
61+
62+
let partial = provider.import(path.join(cwd, extensions.valid[key]), entryPoints.valid, manifests.valid);
6163

62-
let extensionName = R.keys(extensions.valid)[0];
63-
console.log(` ${String.fromCharCode(0x2517)} configuration:`.gray, extensions.valid[extensionName].magenta);
64+
if (typeof(partial) === 'function') {
65+
return partial(baseConfig);
66+
}
6467

65-
let extension = provider.import(path.join(cwd, extensions.valid[extensionName]), entryPoints.valid, manifests.valid);
66-
config = R.merge(configurator.getDefault(), extension);
68+
return Object.assign(configurator.getDefault(), partial);
69+
} catch (err) {
70+
console.error('- build'.gray, 'aborted'.red);
71+
reject(errors.enrich(err, `${key} configuration contains errors`));
72+
}
73+
}, configurator.getDefault());
6774

6875
// LEGACY
6976
if (context.has('legacy') && target === 'yves') {

lib/automation/provider.js

+34-19
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,35 @@
66

77
'use strict';
88

9-
let path = require('path');
10-
let fs = require('graceful-fs');
11-
let R = require('ramda');
12-
let context = require('../context');
13-
let cwd = process.cwd();
14-
15-
function contextRequire(id) {
16-
try {
17-
return require(`${cwd}/node_modules/${id}`);
18-
} catch (err) {
19-
return require(id);
9+
const path = require('path');
10+
const fs = require('graceful-fs');
11+
const R = require('ramda');
12+
const context = require('../context');
13+
const cwd = process.cwd();
14+
15+
function getAlias(src) {
16+
return fs.readdirSync(src)
17+
.filter(dir => fs.statSync(path.join(src, dir)).isDirectory())
18+
.reduce((list, dir) => {
19+
list[`@${dir.toLowerCase()}`] = `${dir}/assets/Zed/src`;
20+
return list;
21+
}, {});
22+
}
23+
24+
function createContextRequire() {
25+
function contextRequire(id) {
26+
try {
27+
return require(`${cwd}/node_modules/${id}`);
28+
} catch (err) {
29+
return require(id);
30+
}
2031
}
32+
33+
return Object.assign(contextRequire, require);
2134
}
2235

23-
function getAntelope(entryPoints, manifests) {
36+
function getAntelope(file, entryPoints, manifests) {
37+
let alias = getAlias(path.join(path.dirname(file), '../../../'));
2438
let loadersPaths = process.mainModule.paths.concat([path.join(cwd, './node_modules')]);
2539
let rootPaths = [
2640
cwd,
@@ -33,6 +47,7 @@ function getAntelope(entryPoints, manifests) {
3347
remote: (id) => require(id),
3448
options: context.options(),
3549
entryPoints: entryPoints,
50+
alias: alias,
3651
paths: {
3752
root: rootPaths,
3853
loaders: loadersPaths
@@ -41,16 +56,16 @@ function getAntelope(entryPoints, manifests) {
4156
}
4257

4358
module.exports = {
44-
import: (id, entryPoints, manifest) => {
59+
import: (file, entryPoints, manifest) => {
4560
let context = require('module');
46-
let body = fs.readFileSync(id, 'utf8');
61+
let body = fs.readFileSync(file, 'utf8');
4762
let fn = new Function('module', 'exports', 'require', '__dirname', 'antelope', body);
4863
let args = [
49-
context,
50-
context.exports,
51-
contextRequire,
52-
path.dirname(id),
53-
getAntelope(entryPoints, manifest)
64+
context,
65+
context.exports,
66+
createContextRequire(),
67+
path.dirname(file),
68+
getAntelope(file, entryPoints, manifest)
5469
];
5570

5671
fn.apply(context, args);

lib/automation/webpack.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@
66

77
'use strict';
88

9+
const context = require('../context');
910
const cwd = process.cwd();
1011

1112
module.exports = {
1213
getDefault: () => {
1314
return {
1415
antelope: {},
15-
context: cwd
16+
context: cwd,
17+
debug: context.has('debug'),
18+
watch: context.has('watch')
1619
};
1720
},
1821
legacy: {

package.json

+12-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "antelope",
3-
"version": "2.0.4",
3+
"version": "2.1.0",
44
"description": "Spryker frontend automation tool",
55
"main": "antelope.js",
66
"preferGlobal": "true",
@@ -21,27 +21,33 @@
2121
"bin": "./bin"
2222
},
2323
"engines": {
24-
"node": ">=5.0.0",
25-
"npm": ">=3.3.6"
24+
"node": ">=5.11.0",
25+
"npm": ">=3.4.0"
2626
},
2727
"dependencies": {
28+
"autoprefixer": "~6.3.6",
29+
"babel-core": "~6.9.1",
30+
"babel-loader": "~6.2.4",
31+
"babel-polyfill": "~6.9.1",
32+
"babel-preset-es2015": "~6.9.0",
2833
"colors": "~1.1.2",
2934
"commander": "~2.9.0",
3035
"css-loader": "~0.23.0",
3136
"exit": "~0.1.2",
3237
"extract-text-webpack-plugin": "~1.0.1",
3338
"file-loader": "~0.8.5",
34-
"globby": "~4.0.0",
39+
"globby": "~5.0.0",
3540
"graceful-fs": "~4.1.2",
36-
"node-sass": "~3.4.2",
41+
"node-sass": "~3.7.0",
3742
"organizer-loader": "github:ilmente/organizer-loader",
43+
"postcss-loader": "~0.9.1",
3844
"ramda": "~0.18.0",
3945
"resolve-url-loader": "~1.4.3",
4046
"sass-loader": "~3.1.1",
4147
"semver": "~5.1.0",
4248
"shelljs": "~0.5.3",
4349
"style-loader": "~0.13.0",
4450
"url-loader": "~0.5.7",
45-
"webpack": "~1.12.6"
51+
"webpack": "~1.13.1"
4652
}
4753
}

0 commit comments

Comments
 (0)