Skip to content

Commit d79c29c

Browse files
BREAKING-CHANGE: Deprecate ordering by file-prefix ##- (#1252)
* Remove pattern ordering by file prefix ##- * #1252: Remove unused code * #1252 Update pattern doc locations * #1252 add possibility to disable deprecation warning * #1252 Fix dev engine twig
1 parent 030a992 commit d79c29c

File tree

211 files changed

+1111
-1119
lines changed

Some content is hidden

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

211 files changed

+1111
-1119
lines changed

packages/cli/test/fixtures/patternlab-config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
"node_modules/@pattern-lab/uikit-workshop/views/partials/general-footer.mustache",
4747
"patternSection":
4848
"node_modules/@pattern-lab/uikit-workshop/views/partials/patternSection.mustache",
49-
"patternSectionSubtype":
50-
"node_modules/@pattern-lab/uikit-workshop/views/partials/patternSectionSubtype.mustache",
49+
"patternSectionSubgroup":
50+
"node_modules/@pattern-lab/uikit-workshop/views/partials/patternSectionSubgroup.mustache",
5151
"viewall":
5252
"node_modules/@pattern-lab/uikit-workshop/views/viewall.mustache"
5353
},

packages/core/docs/events.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Emitted after patterns are iterated over to gather data about them. Right before
6161

6262
#### `EVENTS~PATTERNLAB_BUILD_GLOBAL_DATA_END`
6363

64-
Emitted after global `data.json` and `listitems.json` are read, and the supporting Pattern Lab templates are loaded into memory (header, footer, patternSection, patternSectionSubType, viewall). Right before patterns are iterated over to gather data about them.
64+
Emitted after global `data.json` and `listitems.json` are read, and the supporting Pattern Lab templates are loaded into memory (header, footer, patternSection, patternSectionSubgroup, viewall). Right before patterns are iterated over to gather data about them.
6565

6666
**Kind**: inner property of [<code>EVENTS</code>](#exp_module_Events--EVENTS)
6767
**Properties**

packages/core/patternlab-config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
"views/partials/general-footer.mustache",
4747
"patternSection":
4848
"views/partials/patternSection.mustache",
49-
"patternSectionSubtype":
50-
"views/partials/patternSectionSubtype.mustache",
49+
"patternSectionSubgroup":
50+
"views/partials/patternSectionSubgroup.mustache",
5151
"viewall":
5252
"views/viewall.mustache"
5353
},

packages/core/src/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
'use strict';
1212

13-
const path = require('path');
14-
1513
const updateNotifier = require('update-notifier');
1614

1715
const packageInfo = require('../package.json');

packages/core/src/lib/buildFooter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ let render = require('./render'); //eslint-disable-line prefer-const
1010
/**
1111
* Builds footer HTML from the general footer and user-defined footer
1212
* @param patternlab - global data store
13-
* @param patternPartial - the partial key to build this for, either viewall-patternPartial or a viewall-patternType-all
13+
* @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
*/
1616
module.exports = function(patternlab, patternPartial, uikit) {

packages/core/src/lib/buildPatterns.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const processMetaPattern = require('./processMetaPattern');
1515
const pe = require('./pattern_exporter');
1616
const lh = require('./lineage_hunter');
1717
const pm = require('./plugin_manager');
18-
const pluginMananger = new pm();
18+
const pluginManager = new pm();
1919
const markModifiedPatterns = require('./markModifiedPatterns');
2020
const parseAllLinks = require('./parseAllLinks');
2121
const render = require('./render');
@@ -27,7 +27,7 @@ let pattern_exporter = new pe(); // eslint-disable-line
2727
const lineage_hunter = new lh();
2828

2929
module.exports = async (deletePatternDir, patternlab, additionalData) => {
30-
await pluginMananger.raiseEvent(
30+
await pluginManager.raiseEvent(
3131
patternlab,
3232
events.PATTERNLAB_BUILD_START,
3333
patternlab
@@ -72,7 +72,7 @@ module.exports = async (deletePatternDir, patternlab, additionalData) => {
7272
return patternlab
7373
.processAllPatternsIterative(paths.source.patterns)
7474
.then(async () => {
75-
await pluginMananger.raiseEvent(
75+
await pluginManager.raiseEvent(
7676
patternlab,
7777
events.PATTERNLAB_PATTERN_ITERATION_END,
7878
patternlab
@@ -94,12 +94,12 @@ module.exports = async (deletePatternDir, patternlab, additionalData) => {
9494
//perhaps we can check for a convention like [uikitname]_00-head.mustache, and if found, add them to patternlab.uikits[uikitname].userFoot
9595
//then, if present, use those during compose()
9696
const headPatternPromise = processMetaPattern(
97-
`_00-head.${patternlab.config.patternExtension}`,
97+
`_head.${patternlab.config.patternExtension}`,
9898
'userHead',
9999
patternlab
100100
);
101101
const footPatternPromise = processMetaPattern(
102-
`_01-foot.${patternlab.config.patternExtension}`,
102+
`_foot.${patternlab.config.patternExtension}`,
103103
'userFoot',
104104
patternlab
105105
);

packages/core/src/lib/compose.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const parseLink = require('./parseLink');
99
const render = require('./render');
1010
const uikitExcludePattern = require('./uikitExcludePattern');
1111
const pm = require('./plugin_manager');
12-
const pluginMananger = new pm();
12+
const pluginManager = new pm();
1313

1414
const Pattern = require('./object_factory').Pattern;
1515
const CompileState = require('./object_factory').CompileState;
@@ -32,7 +32,7 @@ module.exports = async function(pattern, patternlab) {
3232
pattern.patternLineageEExists =
3333
pattern.patternLineageExists || pattern.patternLineageRExists;
3434

35-
await pluginMananger.raiseEvent(
35+
await pluginManager.raiseEvent(
3636
patternlab,
3737
events.PATTERNLAB_PATTERN_BEFORE_DATA_MERGE,
3838
patternlab,
@@ -116,13 +116,13 @@ module.exports = async function(pattern, patternlab) {
116116
pattern.patternLineageExists || pattern.patternLineageRExists,
117117
patternDesc: pattern.patternDescExists ? pattern.patternDesc : '',
118118
patternBreadcrumb:
119-
pattern.patternGroup === pattern.patternSubGroup
119+
pattern.patternGroup === pattern.patternSubgroup
120120
? {
121-
patternType: pattern.patternGroup,
121+
patternGroup: pattern.patternGroup,
122122
}
123123
: {
124-
patternType: pattern.patternGroup,
125-
patternSubtype: pattern.patternSubGroup,
124+
patternGroup: pattern.patternGroup,
125+
patternSubgroup: pattern.patternSubgroup,
126126
},
127127
patternExtension: pattern.fileExtension.substr(1), //remove the dot because styleguide asset default adds it for us
128128
patternName: pattern.patternName,
@@ -175,7 +175,7 @@ module.exports = async function(pattern, patternlab) {
175175
///////////////
176176
// WRITE FILES
177177
///////////////
178-
await pluginMananger.raiseEvent(
178+
await pluginManager.raiseEvent(
179179
patternlab,
180180
events.PATTERNLAB_PATTERN_WRITE_BEGIN,
181181
patternlab,
@@ -190,7 +190,7 @@ module.exports = async function(pattern, patternlab) {
190190
uikit.outputDir
191191
);
192192

193-
await pluginMananger.raiseEvent(
193+
await pluginManager.raiseEvent(
194194
patternlab,
195195
events.PATTERNLAB_PATTERN_WRITE_END,
196196
patternlab,

packages/core/src/lib/events.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const EVENTS = Object.freeze({
3030
PATTERNLAB_PATTERN_ITERATION_END: 'patternlab-pattern-iteration-end',
3131

3232
/**
33-
* @desc Emitted after global `data.json` and `listitems.json` are read, and the supporting Pattern Lab templates are loaded into memory (header, footer, patternSection, patternSectionSubType, viewall). Right before patterns are iterated over to gather data about them.
33+
* @desc Emitted after global `data.json` and `listitems.json` are read, and the supporting Pattern Lab templates are loaded into memory (header, footer, patternSection, patternSectionSubgroup, viewall). Right before patterns are iterated over to gather data about them.
3434
* @property {object} patternlab - global data store
3535
*/
3636
PATTERNLAB_BUILD_GLOBAL_DATA_END: 'patternlab-build-global-data-end',

packages/core/src/lib/exportData.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ module.exports = function(patternlab, uikit) {
3131

3232
//navItems
3333
output +=
34-
'var navItems = {"patternTypes": ' +
35-
JSON.stringify(patternlab.patternTypes) +
34+
'var navItems = {"patternGroups": ' +
35+
JSON.stringify(patternlab.patternGroups) +
3636
', "ishControlsHide": ' +
3737
JSON.stringify(patternlab.config.ishControlsHide) +
3838
'};' +

packages/core/src/lib/loadPattern.js

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
const path = require('path');
44

55
const Pattern = require('./object_factory').Pattern;
6-
const mp = require('./markdown_parser');
76
const logger = require('./log');
87
const patternEngines = require('./pattern_engines');
98
const ch = require('./changes_hunter');
@@ -12,7 +11,6 @@ const addPattern = require('./addPattern');
1211
const buildListItems = require('./buildListItems');
1312
const readDocumentation = require('./readDocumentation');
1413

15-
const markdown_parser = new mp();
1614
const changes_hunter = new ch();
1715
const dataLoader = new da();
1816

@@ -37,11 +35,11 @@ module.exports = function(relPath, patternlab) {
3735
"It's strongly suggested to not deviate from the following structure under _patterns/"
3836
);
3937
logger.warning(
40-
'[patternType]/[patternSubtype]/[patternName].[patternExtension]'
38+
'[patternGroup]/[patternSubgroup]/[patternName].[patternExtension]'
4139
);
4240
logger.warning('or');
4341
logger.warning(
44-
'[patternType]/[patternSubtype]/[patternName]/[patternName].[patternExtension]'
42+
'[patternGroup]/[patternSubgroup]/[patternName]/[patternName].[patternExtension]'
4543
);
4644
logger.warning('');
4745
logger.warning(
@@ -53,46 +51,7 @@ module.exports = function(relPath, patternlab) {
5351
logger.warning('');
5452
}
5553

56-
//check if the found file is a top-level markdown file
5754
const fileObject = path.parse(relPath);
58-
if (fileObject.ext === '.md') {
59-
try {
60-
const proposedDirectory = path.resolve(
61-
patternlab.config.paths.source.patterns,
62-
fileObject.dir,
63-
fileObject.name
64-
);
65-
const proposedDirectoryStats = fs.statSync(proposedDirectory);
66-
if (proposedDirectoryStats.isDirectory()) {
67-
const subTypeMarkdownFileContents = fs.readFileSync(
68-
proposedDirectory + '.md',
69-
'utf8'
70-
);
71-
const subTypeMarkdown = markdown_parser.parse(
72-
subTypeMarkdownFileContents
73-
);
74-
const subTypePattern = new Pattern(relPath, null, patternlab);
75-
subTypePattern.patternSectionSubtype = true;
76-
subTypePattern.patternDesc = subTypeMarkdown
77-
? subTypeMarkdown.markdown
78-
: '';
79-
subTypePattern.flatPatternPath =
80-
subTypePattern.flatPatternPath + '-' + subTypePattern.fileName;
81-
subTypePattern.isPattern = false;
82-
subTypePattern.engine = null;
83-
patternlab.subtypePatterns[
84-
subTypePattern.patternPartial
85-
] = subTypePattern;
86-
87-
return subTypePattern;
88-
}
89-
} catch (err) {
90-
// no file exists, meaning it's a pattern markdown file
91-
if (err.code !== 'ENOENT') {
92-
logger.warning(err);
93-
}
94-
}
95-
}
9655

9756
//extract some information
9857
const filename = fileObject.base;

0 commit comments

Comments
 (0)