Skip to content

Commit 26e886c

Browse files
committed
fix: add a new method to check if PL is currently compiling + add new method to get the config PL is using
1 parent ab7fc92 commit 26e886c

3 files changed

Lines changed: 31 additions & 5 deletions

File tree

packages/core/src/index.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,30 @@ const patternlab_module = function(config) {
7777
return patternlab.getVersion();
7878
},
7979

80+
/**
81+
* Returns the current pattern lab configuration being used
82+
*
83+
* @memberof patternlab
84+
* @name getConfig
85+
* @instance
86+
* @returns {string} the current patternlab-node config (defaults + customizations)
87+
*/
88+
getConfig() {
89+
return config;
90+
},
91+
92+
/**
93+
* Returns if Pattern Lab is busy compiling or not
94+
*
95+
* @memberof patternlab
96+
* @name isBusy
97+
* @instance
98+
* @returns {boolean} if pattern lab is currently busy compiling
99+
*/
100+
isBusy: function() {
101+
return patternlab.isBusy;
102+
},
103+
80104
/**
81105
* Builds patterns, copies assets, and constructs user interface
82106
*

packages/core/src/lib/patternlab.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ module.exports = class PatternLab {
4747
// Load up engines please
4848
this.engines = patternEngines;
4949
this.engines.loadAllEngines(config);
50+
this.isBusy = false;
5051

5152
//
5253
// INITIALIZE EMPTY GLOBAL DATA STRUCTURES

packages/core/src/lib/watchPatternLabFiles.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ const watchPatternLabFiles = (
2121
assetDirectories.source.meta,
2222
];
2323
const globalPaths = globalSources.map(globalSource =>
24-
path.join(basePath, globalSource, '*')
24+
path.join(path.resolve(basePath, globalSource), '*')
2525
);
2626

2727
_.each(globalPaths, globalPath => {
28-
logger.debug(`Pattern Lab is watching ${globalPath} for changes`);
28+
logger.debug(`Pattern Lab is watching ${globalPath} for changes!`);
2929

3030
if (patternlab.watchers[globalPath]) {
3131
patternlab.watchers[globalPath].close();
@@ -80,13 +80,14 @@ const watchPatternLabFiles = (
8080
.concat(patternlab.engines.getSupportedFileExtensions())
8181
.map(dotExtension =>
8282
path.join(
83-
basePath,
84-
assetDirectories.source.patterns,
83+
path.resolve(basePath, assetDirectories.source.patterns),
8584
`/**/*${dotExtension}`
8685
)
8786
);
8887
_.each(patternWatches, patternWatchPath => {
89-
logger.debug(`Pattern Lab is watching ${patternWatchPath} for changes`);
88+
logger.debug(
89+
`Pattern Lab is watching ${patternWatchPath} for changes - local!`
90+
);
9091

9192
if (patternlab.watchers[patternWatchPath]) {
9293
patternlab.watchers[patternWatchPath].close();

0 commit comments

Comments
 (0)