Skip to content

Commit 86baa4c

Browse files
committed
Merge branch 'dev' into refactor/updated-redux
2 parents aa64967 + da469b9 commit 86baa4c

File tree

76 files changed

+2204
-2224
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+2204
-2224
lines changed

CHANGELOG.md

Lines changed: 267 additions & 267 deletions
Large diffs are not rendered by default.

packages/cli/bin/inquiries/starterkit.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ const starterkitSetup = [
1010
message: 'What initial patterns do you want included in your project?',
1111
choices: [
1212
{
13-
name: 'Handlebars base patterns (some basic patterns to get started with)',
13+
name:
14+
'Handlebars base patterns (some basic patterns to get started with)',
1415
value: '@pattern-lab/starterkit-handlebars-vanilla',
1516
},
1617
{

packages/cli/bin/scaffold.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22
const path = require('path');
33
const execa = require('execa');
4-
const fs = require('fs-extra');
4+
const fs = require('fs');
55
const wrapAsync = require('./utils').wrapAsync;
66
const mkdirsAsync = require('./utils').mkdirsAsync;
77

@@ -18,7 +18,6 @@ const scaffold = (projectDir, sourceDir, publicDir, exportDir) =>
1818
wrapAsync(function* () {
1919
const projectPath = path.join(process.cwd(), projectDir);
2020
if (!fs.existsSync(path.join(projectPath, 'package.json'))) {
21-
fs.ensureDirSync(projectPath);
2221
execa.sync('npm', ['init', '-y'], {
2322
cwd: projectPath,
2423
});

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
],
5050
"scripts": {
5151
"lint": "eslint ./{bin,test}",
52-
"test:separate": "tap ./test/*.test.js --reporter spec --timeout=120"
52+
"test:separate": "tap './test/*.test.js' --reporter spec --timeout=120"
5353
},
5454
"repository": "https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli",
5555
"bugs": "https://github.com/pattern-lab/patternlab-node/issues",

packages/core/src/lib/addPattern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const logger = require('./log');
44

5-
module.exports = function (pattern, patternlab) {
5+
module.exports = function(pattern, patternlab) {
66
//add the link to the global object
77
if (!patternlab.data.link) {
88
patternlab.data.link = {};

packages/core/src/lib/annotation_exporter.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const _ = require('lodash');
66
const mp = require('./markdown_parser');
77
const logger = require('./log');
88

9-
const annotations_exporter = function (pl) {
9+
const annotations_exporter = function(pl) {
1010
const paths = pl.config.paths;
1111
let oldAnnotations;
1212

@@ -68,7 +68,7 @@ const annotations_exporter = function (pl) {
6868
//let annotations = annotations;
6969
const markdown_parser = parser;
7070

71-
return function (filePath) {
71+
return function(filePath) {
7272
const annotationsMD = fs.readFileSync(path.resolve(filePath), 'utf8');
7373

7474
//take the annotation snippets and split them on our custom delimiter
@@ -110,15 +110,15 @@ const annotations_exporter = function (pl) {
110110
}
111111

112112
return {
113-
gather: function () {
113+
gather: function() {
114114
return gatherAnnotations();
115115
},
116-
gatherJS: function () {
116+
gatherJS: function() {
117117
return parseAnnotationsJS();
118118
},
119-
gatherMD: function () {
119+
gatherMD: function() {
120120
return parseAnnotationsMD();
121-
},
121+
}
122122
};
123123
};
124124

packages/core/src/lib/buildFooter.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ let render = require('./render'); //eslint-disable-line prefer-const
1313
* @param patternPartial - the partial key to build this for, either viewall-patternPartial or a viewall-patternGroup-all
1414
* @returns A promise which resolves with the HTML
1515
*/
16-
module.exports = function (patternlab, patternPartial, uikit) {
16+
module.exports = function(patternlab, patternPartial, uikit) {
1717
//first render the general footer
1818
return render(Pattern.createEmpty({ extendedTemplate: uikit.footer }), {
1919
patternData: JSON.stringify({
20-
patternPartial: patternPartial,
20+
patternPartial: patternPartial
2121
}),
22-
cacheBuster: patternlab.cacheBuster,
22+
cacheBuster: patternlab.cacheBuster
2323
})
24-
.then((footerPartial) => {
24+
.then(footerPartial => {
2525
let allFooterData;
2626
try {
2727
allFooterData = jsonCopy(
@@ -36,7 +36,7 @@ module.exports = function (patternlab, patternPartial, uikit) {
3636

3737
return render(patternlab.userFoot, allFooterData);
3838
})
39-
.catch((reason) => {
39+
.catch(reason => {
4040
console.log(reason);
4141
logger.error('Error building buildFooterHTML');
4242
});

packages/core/src/lib/buildListItems.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ const items = [
2323
'seventeen',
2424
'eighteen',
2525
'nineteen',
26-
'twenty',
26+
'twenty'
2727
];
2828

29-
module.exports = function (container) {
29+
module.exports = function(container) {
3030
//combine all list items into one structure
3131
const list = [];
3232
for (const item in container.listitems) {

packages/core/src/lib/buildPatterns.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,13 @@ module.exports = async (deletePatternDir, patternlab, additionalData) => {
113113
return render(
114114
Pattern.createEmpty({
115115
// todo should this be uikit.header?
116-
extendedTemplate: patternlab.header,
116+
extendedTemplate: patternlab.header
117117
}),
118118
{
119-
cacheBuster: patternlab.cacheBuster,
119+
cacheBuster: patternlab.cacheBuster
120120
}
121121
)
122-
.then((results) => {
122+
.then(results => {
123123
patternlab.data.patternLabHead = results;
124124

125125
// If deletePatternDir == true or graph needs to be updated
@@ -133,7 +133,7 @@ module.exports = async (deletePatternDir, patternlab, additionalData) => {
133133
if (patternlab.incrementalBuildsEnabled) {
134134
// When the graph was loaded from file, some patterns might have been moved/deleted between runs
135135
// so the graph data become out of sync
136-
patternlab.graph.sync().forEach((n) => {
136+
patternlab.graph.sync().forEach(n => {
137137
logger.info('[Deleted/Moved] ' + n);
138138
});
139139

@@ -150,18 +150,18 @@ module.exports = async (deletePatternDir, patternlab, additionalData) => {
150150
}
151151
//render all patterns last, so lineageR works
152152
const allPatternsPromise = patternsToBuild.map(
153-
async (pattern) => await compose(pattern, patternlab)
153+
async pattern => await compose(pattern, patternlab)
154154
);
155155
//copy non-pattern files like JavaScript
156-
const allJS = patternsToBuild.map((pattern) => {
156+
const allJS = patternsToBuild.map(pattern => {
157157
const { name, patternPartial, subdir } = pattern;
158158
const {
159159
source: { patterns: sourceDir },
160-
public: { patterns: publicDir },
160+
public: { patterns: publicDir }
161161
} = patternlab.config.paths;
162162
const src = path.join(sourceDir, subdir);
163163
const dest = path.join(publicDir, name);
164-
return map(patternlab.uikits, (uikit) => {
164+
return map(patternlab.uikits, uikit => {
165165
return copy(
166166
src,
167167
path.resolve(process.cwd(), uikit.outputDir, dest),
@@ -170,7 +170,7 @@ module.exports = async (deletePatternDir, patternlab, additionalData) => {
170170
filter: ['*.js'],
171171
rename: () => {
172172
return `${patternPartial}.js`;
173-
},
173+
}
174174
}
175175
).on(copy.events.COPY_FILE_COMPLETE, () => {
176176
logger.debug(
@@ -199,27 +199,27 @@ module.exports = async (deletePatternDir, patternlab, additionalData) => {
199199
//export patterns if necessary
200200
pattern_exporter.export_patterns(patternlab);
201201
})
202-
.catch((reason) => {
202+
.catch(reason => {
203203
console.log(reason);
204204
logger.error('Error rendering patterns');
205205
});
206206
})
207-
.catch((reason) => {
207+
.catch(reason => {
208208
console.log(reason);
209209
logger.error('Error rendering pattern lab header');
210210
});
211211
})
212-
.catch((reason) => {
212+
.catch(reason => {
213213
console.log(reason);
214214
logger.error('Error processing meta patterns');
215215
});
216216
})
217-
.catch((reason) => {
217+
.catch(reason => {
218218
console.log(reason);
219219
logger.error('Error processing patterns recursively');
220220
});
221221
})
222-
.catch((reason) => {
222+
.catch(reason => {
223223
console.log(reason);
224224
logger.error('Error in buildPatterns()');
225225
});

packages/core/src/lib/changes_hunter.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ let fs = require('fs-extra'); //eslint-disable-line prefer-const
1212
* For detecting changed patterns.
1313
* @constructor
1414
*/
15-
const ChangesHunter = function () {};
15+
const ChangesHunter = function() {};
1616

1717
ChangesHunter.prototype = {
1818
/**
@@ -25,7 +25,7 @@ ChangesHunter.prototype = {
2525
*
2626
* @see {@link CompileState}
2727
*/
28-
checkBuildState: function (pattern, patternlab) {
28+
checkBuildState: function(pattern, patternlab) {
2929
//write the compiled template to the public patterns directory
3030
const renderedTemplatePath =
3131
patternlab.config.paths.public.patterns +
@@ -40,12 +40,12 @@ ChangesHunter.prototype = {
4040
pattern.compileState = CompileState.NEEDS_REBUILD;
4141
}
4242

43-
_.each(patternlab.uikits, (uikit) => {
43+
_.each(patternlab.uikits, uikit => {
4444
try {
4545
// renderedTemplatePath required to display a single element
4646
// Markup only is required for "View All" pages. It will get loaded later on.
4747
// If any of these is missing, mark pattern for recompile
48-
[renderedTemplatePath, markupOnlyPath].forEach((renderedFile) => {
48+
[renderedTemplatePath, markupOnlyPath].forEach(renderedFile => {
4949
// Prevent error message if file does not exist
5050
fs.accessSync(
5151
path.join(process.cwd(), uikit.outputDir, renderedFile),
@@ -94,7 +94,7 @@ ChangesHunter.prototype = {
9494
* @param {Pattern} currentPattern
9595
* @param {string} file
9696
*/
97-
checkLastModified: function (currentPattern, file) {
97+
checkLastModified: function(currentPattern, file) {
9898
if (file && fs.pathExistsSync(file)) {
9999
try {
100100
const stat = fs.statSync(file);
@@ -110,12 +110,12 @@ ChangesHunter.prototype = {
110110
}
111111
},
112112

113-
needsRebuild: function (lastModified, p) {
113+
needsRebuild: function(lastModified, p) {
114114
if (p.compileState !== CompileState.CLEAN || !p.lastModified) {
115115
return true;
116116
}
117117
return p.lastModified >= lastModified;
118-
},
118+
}
119119
};
120120

121121
module.exports = ChangesHunter;

packages/core/src/lib/cleanBuildDirectory.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ module.exports = (incrementalBuildsEnabled, patternlab) => {
1515
return Promise.resolve();
1616
} else {
1717
return Promise.all(
18-
_.map(patternlab.uikits, (uikit) => {
18+
_.map(patternlab.uikits, uikit => {
1919
return fs.emptyDir(
2020
path.join(process.cwd(), uikit.outputDir, paths.public.patterns)
2121
);
2222
})
23-
).catch((reason) => {
23+
).catch(reason => {
2424
logger.error(reason);
2525
});
2626
}

packages/core/src/lib/compose.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const pluginManager = new pm();
1515
const Pattern = require('./object_factory').Pattern;
1616
const CompileState = require('./object_factory').CompileState;
1717

18-
module.exports = async function (pattern, patternlab) {
18+
module.exports = async function(pattern, patternlab) {
1919
// Pattern does not need to be built and recompiled more than once
2020
if (!pattern.isPattern || pattern.compileState === CompileState.CLEAN) {
2121
return Promise.resolve(false);
@@ -41,7 +41,7 @@ module.exports = async function (pattern, patternlab) {
4141
);
4242

4343
return Promise.all(
44-
_.map(patternlab.uikits, (uikit) => {
44+
_.map(patternlab.uikits, uikit => {
4545
// exclude pattern from uikit rendering
4646
if (uikitExcludePattern(pattern, uikit)) {
4747
return Promise.resolve();
@@ -125,18 +125,18 @@ module.exports = async function (pattern, patternlab) {
125125
patternBreadcrumb:
126126
pattern.patternGroup === pattern.patternSubgroup
127127
? {
128-
patternGroup: pattern.patternGroup,
128+
patternGroup: pattern.patternGroup
129129
}
130130
: {
131131
patternGroup: pattern.patternGroup,
132-
patternSubgroup: pattern.patternSubgroup,
132+
patternSubgroup: pattern.patternSubgroup
133133
},
134134
patternExtension: pattern.fileExtension.substr(1), //remove the dot because styleguide asset default adds it for us
135135
patternName: pattern.patternName,
136136
patternPartial: pattern.patternPartial,
137137
patternState: pattern.patternState,
138138
patternEngineName: pattern.engine.engineName,
139-
extraOutput: extraOutput,
139+
extraOutput: extraOutput
140140
});
141141

142142
//set the pattern-specific footer by compiling the general-footer with data, and then adding it to the meta footer
@@ -145,16 +145,16 @@ module.exports = async function (pattern, patternlab) {
145145
{
146146
isPattern: pattern.isPattern,
147147
patternData: pattern.patternData,
148-
cacheBuster: patternlab.cacheBuster,
148+
cacheBuster: patternlab.cacheBuster
149149
}
150150
);
151151

152152
return Promise.all([
153153
headPromise,
154154
patternPartialPromise,
155-
footerPartialPromise,
155+
footerPartialPromise
156156
])
157-
.then((intermediateResults) => {
157+
.then(intermediateResults => {
158158
// retrieve results of promises
159159
const headHTML = intermediateResults[0]; //headPromise
160160
pattern.patternPartialCode = intermediateResults[1]; //patternPartialPromise
@@ -178,7 +178,7 @@ module.exports = async function (pattern, patternlab) {
178178
allFooterData.patternLabFoot = footerPartial;
179179

180180
return render(patternlab.userFoot, allFooterData).then(
181-
async (footerHTML) => {
181+
async footerHTML => {
182182
///////////////
183183
// WRITE FILES
184184
///////////////
@@ -212,7 +212,7 @@ module.exports = async function (pattern, patternlab) {
212212
}
213213
);
214214
})
215-
.catch((reason) => {
215+
.catch(reason => {
216216
console.log(reason);
217217
});
218218
})

0 commit comments

Comments
 (0)