Skip to content

Commit b78b3b4

Browse files
Merge pull request #1098 from pattern-lab/feature/simplify-uikit-dx
RFC: Simplify UIKit Development Experience / Workflow
2 parents a66f032 + 7136c8c commit b78b3b4

File tree

22 files changed

+1747
-423
lines changed

22 files changed

+1747
-423
lines changed

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
12.9.0
1+
12.12.0

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"clean": "git clean -dfx",
4040
"publish": "npx lerna publish -m \"[skip travis] chore(release): publish %s\"",
4141
"postpublish": "auto release",
42-
"preview:hbs": "cd packages/development-edition-engine-handlebars && npx patternlab add --starterkits '@pattern-lab/starterkit-handlebars-vanilla' && npm run pl:build"
42+
"preview:hbs": "cd packages/development-edition-engine-handlebars && npx patternlab add --starterkits @pattern-lab/starterkit-handlebars-vanilla && npm run pl:build"
4343
},
4444
"nyc": {
4545
"exclude": [

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 {object} 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();
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
10.0.0
1+
12.12.0

packages/development-edition-engine-handlebars/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,19 @@ This Development Edition is a variant of [Edition Node](https://github.com/patte
1010
* Build and test against Handlebars pattern tree
1111

1212
> Development Editions of Pattern Lab provide the ability to work on and commit changes to select packages within the overall Pattern Lab [ecosystem](http://patternlab.io/docs/advanced-ecosystem-overview.html). This Edition is NOT stable.
13+
14+
15+
## Working on Pattern Lab's UI Locally
16+
17+
### Step 1: Install Dependencies
18+
Run the following in the root of the Pattern Lab repo:
19+
20+
```
21+
yarn run setup
22+
```
23+
24+
### Step 2 (Optional)
25+
If you want to build using a fuller set of examples than what comes with this default Handlebars demo, run `yarn run preview:hbs`. Otherwise skip to step 3.
26+
27+
### Step 3
28+
Finally, go back into this folder, `cd packages/development-edition-engine-handlebars`, and start up the local dev server which watches UIKit and the local Pattern Lab instance for changes, live reloads, etc by running `yarn dev`

packages/development-edition-engine-handlebars/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"pl:help": "patternlab --help",
99
"pl:install": "patternlab install --config ./patternlab-config.json",
1010
"pl:serve": "patternlab serve --config ./patternlab-config.json",
11-
"pl:version": "patternlab --version"
11+
"pl:version": "patternlab --version",
12+
"dev": "node ./node_modules/@pattern-lab/uikit-workshop/build-tools.js"
1213
},
1314
"keywords": [
1415
"Pattern Lab",
@@ -24,7 +25,7 @@
2425
"url": "git://github.com/pattern-lab/patternlab-node.git"
2526
},
2627
"engines": {
27-
"node": ">=10.0"
28+
"node": ">=12.12.0"
2829
},
2930
"dependencies": {
3031
"@pattern-lab/cli": "^5.3.0",

packages/edition-twig/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## Working on Pattern Lab's UI Locally
2+
3+
### Step 1: Install Dependencies
4+
Run the following in the root of the Pattern Lab repo:
5+
6+
```
7+
yarn run setup
8+
```
9+
10+
### Step 2
11+
Finally, go back into this folder, `cd packages/edition-twig`, and start up the local dev server which watches UIKit and the local Pattern Lab instance for changes, live reloads, etc by running `yarn dev`

packages/edition-twig/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"install": "patternlab install --config ./patternlab-config.json",
2020
"serve": "patternlab serve --config ./patternlab-config.json",
2121
"start": "npm run serve",
22-
"version": "patternlab --version"
22+
"version": "patternlab --version",
23+
"dev": "node ./node_modules/@pattern-lab/uikit-workshop/build-tools.js"
2324
},
2425
"dependencies": {
2526
"@pattern-lab/cli": "^5.3.0",

0 commit comments

Comments
 (0)