Skip to content

2.0.0-alpha #361

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 224 commits into from
Jun 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
224 commits
Select commit Hold shift + click to select a range
7454424
Add editorconfig and eslintrc
geoffp Aug 25, 2015
4a9dec6
Add first draft of pattern engines
geoffp Aug 25, 2015
4899cd9
first batch of changes to migrate from direct dependence on mustache to
geoffp Aug 25, 2015
30f8000
First steps toward a .render() method directly on the oPattern
geoffp Aug 28, 2015
5420ad1
comment fixups
geoffp Sep 21, 2015
d022308
Merge tag 'v0.12.0' into pattern-engines
geoffp Sep 21, 2015
3452046
Merge branch 'master' into pattern-engines
geoffp Oct 6, 2015
a2f5cf7
fix typos and module path issues
geoffp Oct 27, 2015
6a6db63
make PatternEngines a genuine Object, and set up its method-bearing p…
geoffp Oct 27, 2015
f22551b
temporarily restore mustache-only pattern rendering
geoffp Oct 27, 2015
a7236f7
'working' renderPattern function
geoffp Oct 27, 2015
fd5e6b6
start rendering real oPatterns and fix that rendering path
geoffp Oct 27, 2015
c4d5080
add file extension to oPattern, update unit test
geoffp Oct 27, 2015
37bacdc
Create a new mapping between file extensions and engine names at load
geoffp Oct 27, 2015
f54db83
Add unit tests for pattern_engines.js and individual pattern engines
geoffp Oct 27, 2015
9d0eff3
Merge remote-tracking branch 'remotes/upstream/pattern-engines' into …
geoffp Nov 16, 2015
5217108
isPatternFile consolidation and tests
geoffp Nov 16, 2015
ac54ffb
We now pass all tests and build "successfully," but pseudo-patterns
geoffp Nov 17, 2015
eb52998
a little progress on the pseudo-pattern problem. They render now, but
geoffp Nov 17, 2015
2cca3cb
eliminate redundant "is this really a pattern" checking
geoffp Nov 17, 2015
861a146
misc
geoffp Nov 17, 2015
a648ae5
fix homepage pattern and its pseudo-pattern not rendering
geoffp Nov 17, 2015
7989cfb
a little more leniency from eslint
geoffp Nov 25, 2015
b37e5d7
Factor the finders out of pattern_assembler and add them as methods on
geoffp Nov 25, 2015
2c04ac1
Beef up all the unit tests -- use the new oPattern factories rather than
geoffp Nov 25, 2015
3d9753a
Merge pull request #191 from geoffp/pattern-engines
Nov 26, 2015
e8f99c1
Remove unused module requires -- that's the last of the direct couplings
geoffp Dec 1, 2015
96c88c0
Migrate some things to a nicer object literal syntax; use the oPattern
geoffp Dec 1, 2015
d7a531e
factor utility functions out of the pattern assembler and put 'em in our
geoffp Dec 1, 2015
0ffb2fe
have eslint chill out about a couple things
geoffp Dec 1, 2015
b03bc45
New partial finding regex for Mustache that accounts for regular syntax,
geoffp Dec 1, 2015
882aee2
streamline, DRY out and update unit tests
geoffp Dec 1, 2015
fd3c4b5
unit test fixups, plus a tweak to the Mustache partial finder to permit
geoffp Dec 2, 2015
ee6fcfc
fix for out-of-order pseudopattern bug -- isPatternFile() should return
geoffp Dec 3, 2015
75d90a2
Note verbose syntax in unit test
geoffp Dec 3, 2015
ded3224
Fix (?) partial name; unit test now passes
geoffp Dec 3, 2015
0681781
Merge remote-tracking branch 'refs/remotes/upstream/master' into patt…
geoffp Dec 4, 2015
b2e1a38
Fix the 'process_list_item_partials finds verbose partials and outputs
geoffp Dec 4, 2015
bdb0b7b
Factor getPartialKey out of pattern assembler -- it's Mustache-specific
geoffp Dec 4, 2015
b807680
Merge pull request #199 from geoffp/pattern-engines
Dec 4, 2015
bb47678
Generate the list of supported pattern engines based on the presence to
geoffp Dec 7, 2015
e4b73e8
further streamline engine loading process and logging
geoffp Dec 8, 2015
d80df26
clean up require()s
geoffp Dec 8, 2015
c7adf8a
slight polish to engine loader console output
geoffp Dec 8, 2015
5cab80b
clean up eslintrc a bit
geoffp Dec 8, 2015
fe6206b
make process_pattern_iterative() return the oPattern to make it a little
geoffp Dec 8, 2015
865b38d
Handlebars engine, plus unit tests and proposed pattern tree for
geoffp Dec 8, 2015
c741d18
I am now realizing that I called an atom from inside an atom. The
geoffp Dec 8, 2015
5302a4d
oops, add molecules directory and pattern
geoffp Dec 8, 2015
5c745c2
add Handlebars as an npm dependency (for now)
geoffp Dec 8, 2015
6b22356
Merge remote-tracking branch 'upstream/master' into pattern-engines
geoffp Dec 9, 2015
8ac9b6e
(mostly?) working handlebars rendering on a real tree -- there's a
geoffp Dec 11, 2015
82c76ed
Fix the circular reference problem in the log file, which occurred when
geoffp Dec 14, 2015
6693ee2
remove speculative alternate pattern data structures
geoffp Dec 14, 2015
a2c6c71
Add pattern-engines branch to .travis.yml
geoffp Dec 14, 2015
4f52169
Merge pull request #208 from geoffp/pattern-engines
Dec 14, 2015
865a6b2
more eslint chilling
geoffp Dec 22, 2015
b933916
unit test: handlebars partials can render JSON values
geoffp Jan 6, 2016
7a6d9c6
pass unit test 'handlebars partials can render JSON values'; a mechanism
geoffp Jan 6, 2016
7243967
Handlebars (and possibly other engines) need to be excluded from
geoffp Jan 7, 2016
5769a9c
Merge remote-tracking branch 'refs/remotes/upstream/dev' into pattern…
geoffp Jan 11, 2016
7b0a44c
factor Mustache-specific findPartialKey out of the lineage hunter and
geoffp Jan 12, 2016
5dd8052
fix up some unit tests for the pattern engines branch, wherein we
geoffp Jan 12, 2016
e62a8ed
minor fixups
geoffp Jan 12, 2016
803d541
fix handlebars engine's findPartialKey method signature to match new
geoffp Jan 12, 2016
e7d1a1f
minor environment fixes to a LIH unit test -- and with that, we pass
geoffp Jan 12, 2016
25fbef6
Merge remote-tracking branch 'remotes/upstream/pattern-engines' into …
geoffp Jan 12, 2016
efb0c2f
Merge remote-tracking branch 'refs/remotes/upstream/dev' into pattern…
geoffp Jan 18, 2016
b67abfa
get rid of unnecessary remaining direct references to config.json
geoffp Jan 20, 2016
61ef4d7
Get rid of direct references to config.json
geoffp Jan 20, 2016
dc43f4a
Merge pull request #233 from geoffp/pattern-engines
Feb 17, 2016
8c605fa
Merge remote-tracking branch 'refs/remotes/upstream/dev' into pattern…
geoffp Feb 17, 2016
a422daa
a parameterized partial finder. comments on partial finding regex
Feb 19, 2016
f9ba2df
removing duplicate line
Feb 19, 2016
1e94f31
deleting vim .swp file
Feb 19, 2016
c1d034a
comment and character escape update
Feb 19, 2016
5d4c18f
Merge pull request #256 from e2tha-e/regex-cleanup-mustache
geoffp Feb 19, 2016
f787136
fixing regex for replace operation in findPartialKey_new
Feb 22, 2016
e2ee979
Merge branch 'pattern-engines' into pattern-engines-upstream
geoffp Feb 24, 2016
1d07ef8
Merge remote-tracking branch 'refs/remotes/upstream/dev' into pattern…
geoffp Feb 24, 2016
2875322
Don't run the handlebars tests unless handlebars is installed.
geoffp Feb 24, 2016
0150b79
Merge pull request #258 from e2tha-e/mustache-regex
geoffp Feb 24, 2016
5c4d065
Underscore engine with basic support and unit tests!
geoffp Feb 26, 2016
cfa2aaf
Gulpfile enhancements: auto-watch all supported template types
geoffp Feb 26, 2016
ad8324d
comment on engine support level and cleanup
geoffp Feb 26, 2016
fe2ea00
*temporarily* add template renderers to package.json just so our unit
geoffp Feb 26, 2016
86ae226
Don't run handlebars unit tests if handlebars isn't installed
geoffp Feb 26, 2016
600b990
Merge commit 'upstream/dev^' into pattern-engines
geoffp Feb 29, 2016
b9e8139
Merge branch 'dev' into pattern-engines
geoffp Feb 29, 2016
d3df3a3
Stashing changes - working Twig template includes!
Feb 29, 2016
e5448f0
a more accurate docblock
Mar 1, 2016
4f6ee81
-Adding Grunt dependencies to run the PL Twig engine as well
Mar 1, 2016
8f9ea26
Merge commit 'b9e8139526dc8c260a63c9228bd14870d6a304c3' into pattern-…
Mar 1, 2016
bbc2c16
Re-fixing pattern globbing to watch everything inside of the pattern …
Mar 1, 2016
ebba8de
updating function name and description
Mar 3, 2016
8eba9b1
Merge remote-tracking branch 'refs/remotes/upstream/dev' into pattern…
geoffp Mar 7, 2016
d7a3846
move pattern engines and utilities to the new core/lib location and fix
geoffp Mar 7, 2016
0a4f6ee
Fix a total misinterpretation of underscore-prefixed patterns: they're
geoffp Mar 7, 2016
601c143
Merge pull request #279 from sghoweri/pattern-engines
geoffp Mar 8, 2016
8eee29a
tell the linter to chill out about some things
geoffp Mar 8, 2016
875f26e
code cleanups and linter appeasement
geoffp Mar 8, 2016
1578b0b
Clean up code in engine_twig and move to the correct location
geoffp Mar 8, 2016
701477b
Tweaks, cleanups and unit tests for the Twig engine.
geoffp Mar 9, 2016
a78b748
oops, debugger statement
geoffp Mar 9, 2016
4df8007
fixing JSON error in package.gulp.json
EvanLovely Mar 9, 2016
8f9cb72
fixing Travis build error when Grunt trys to load Gulp tasks
EvanLovely Mar 9, 2016
33c078a
Merge pull request #286 from EvanLovely/feature/pattern-engines-tweaks
geoffp Mar 9, 2016
6db7cb1
fix whitespace in lineage-hunter test
geoffp Mar 11, 2016
558ecab
Merge remote-tracking branch 'refs/remotes/upstream/dev' into pattern…
geoffp Mar 11, 2016
2f183dc
resolving merge conflict
Mar 16, 2016
3df9420
updating function name and docblock
Mar 16, 2016
7f4d92d
Change underscore engine extension to html
geoffp Mar 17, 2016
d303b4f
Merge remote-tracking branch 'refs/remotes/upstream/master' into patt…
geoffp Mar 17, 2016
b66de48
rename underscore test templates to .html
geoffp Mar 17, 2016
ba1b232
fix underscore unit tests
geoffp Mar 17, 2016
d5502e3
Merge branch 'dev' into pattern-engines
geoffp Mar 21, 2016
19b2e21
Merge pull request #278 from e2tha-e/pattern-engines-docblock-update
geoffp Mar 21, 2016
d63e274
Handle undefined variables in underscore templates
geoffp Mar 22, 2016
70e5330
factor out the UI Builder into its own module -- just get it working …
geoffp Mar 24, 2016
3febce8
factor out assembleStyleguidePatterns()
geoffp Mar 24, 2016
a682296
factor out buildViewAllPages()
geoffp Mar 24, 2016
44b7319
factor out buildNavigation()
geoffp Mar 24, 2016
110452d
comment placement adjustment to not lie
geoffp Mar 24, 2016
590843e
factor out sortPatterns()
geoffp Mar 24, 2016
ea10c07
comments
geoffp Mar 24, 2016
15ff8ab
factor out pattern exclusion from buildNavigation()
geoffp Mar 25, 2016
7f78ae5
factor out variable declarations and nav item name getting
geoffp Mar 25, 2016
ff36df9
factor out navSubItem creation
geoffp Mar 25, 2016
e21598f
remove gulpfile and gulp json
bmuenzenmeyer Mar 27, 2016
bd015df
Merge pull request #298 from pattern-lab/factor-out-ui-builder-oops
Mar 29, 2016
a1fbadf
add dev-2.0-core to the travis regimin
bmuenzenmeyer Mar 29, 2016
277fe1f
small suggestions from eslint
bmuenzenmeyer Mar 29, 2016
7c138bb
rename nav items and ishControls to align with styelguide
bmuenzenmeyer Mar 30, 2016
c685d39
trying to prevent an overwrite
bmuenzenmeyer Mar 30, 2016
effb110
removing styleguide assets
bmuenzenmeyer Mar 30, 2016
2ca0cdf
point to the new structure
bmuenzenmeyer Mar 30, 2016
1fbbb8f
WIP
bmuenzenmeyer Apr 1, 2016
fd80c21
MASSIVE disruption as the styleguide refers to `key` as `patternParti…
bmuenzenmeyer Apr 3, 2016
5c4a81e
first round of changes -- some problems remain
geoffp Apr 4, 2016
b45b2e0
Simple fix -- now Mustache works again
geoffp Apr 4, 2016
0c382eb
Merge branch 'dev-2.0-core' into dev
bmuenzenmeyer Apr 5, 2016
d6cb382
Merge branch 'dev' into dev-2.0-core
bmuenzenmeyer Apr 5, 2016
409f2b3
Merge branch 'dev-2.0-core' into dev-2.0-full-pattern-objects-passed-…
bmuenzenmeyer Apr 5, 2016
2755c56
Merge branch 'dev-2.0-full-pattern-objects-passed-to-engine-render' i…
bmuenzenmeyer Apr 5, 2016
7b524aa
remove backup files
bmuenzenmeyer Apr 6, 2016
90d38fe
navigation working along with pattern-extra toggle
bmuenzenmeyer Apr 6, 2016
c7f80ee
Working navigation, also slightly more dry.
bmuenzenmeyer Apr 9, 2016
8f15a56
added encoded patternPartialCode to pattern
bmuenzenmeyer Apr 11, 2016
40e553e
Merge branch 'dev-2.0-core' into styleguide-integration
bmuenzenmeyer Apr 11, 2016
d586191
re-changing references in lineage_hunter due to a merge error on my part
bmuenzenmeyer Apr 11, 2016
6e1748e
all unit tests passing
bmuenzenmeyer Apr 11, 2016
14b1940
code cleanup
bmuenzenmeyer Apr 11, 2016
ecf2aeb
put some basic error handling around template and file loading
bmuenzenmeyer Apr 11, 2016
549f270
remove patternlab from the travis run
bmuenzenmeyer Apr 11, 2016
d0677de
Merge pull request #306 from pattern-lab/styleguide-integration
Apr 11, 2016
faa09d6
delete included engines
geoffp Apr 11, 2016
416132c
engine loader now finds the mustache engine module from the edition!
geoffp Apr 11, 2016
e0c4940
relocate pattern_engines.js
geoffp Apr 11, 2016
7422b5b
Merge branch 'dev-2.0-core' into load-engines
geoffp Apr 12, 2016
12810de
nicer error reporting for missing styleguidekit assets
geoffp Apr 12, 2016
f472717
attempt to align lineage keys with styleguide
bmuenzenmeyer Apr 13, 2016
6365d72
Merge branch 'dev-2.0-core' of https://github.com/pattern-lab/pattern…
bmuenzenmeyer Apr 13, 2016
faebb17
basic support for lineage https://github.com/pattern-lab/edition-node…
bmuenzenmeyer Apr 13, 2016
40a041c
Merge branch 'dev' into dev-2.0-core
bmuenzenmeyer Apr 18, 2016
c5e85c5
added support for the old-style annotations as part of https://github…
Apr 19, 2016
241266a
work in progress markdown pattern descriptions.
bmuenzenmeyer May 8, 2016
fb3b240
fix path to new location of styleguide assets index.html
bmuenzenmeyer May 18, 2016
9b8589c
Merge branch 'dev-2.0-core' into load-engines
geoffp May 19, 2016
ea1b680
Dev 2.0 core oPattern refactor (#331)
geoffp May 23, 2016
f1f9f71
updating dependencies
bmuenzenmeyer May 23, 2016
6695c2c
Annotations Support (#337)
May 25, 2016
a6d419f
gutted most of gruntfile and package.json
bmuenzenmeyer May 25, 2016
985c466
Merge pull request #334 from pattern-lab/package-update
May 25, 2016
8d62ca3
moved head and foot management code
bmuenzenmeyer May 25, 2016
64dd237
Merge pull request #338 from pattern-lab/332-move-meta
May 25, 2016
86d0783
playing with travis ci webhook to gitter
bmuenzenmeyer May 25, 2016
b54387a
bumping node engine support
bmuenzenmeyer May 25, 2016
57c0703
attempt to fix hardcoded path in media_hunter call
bmuenzenmeyer May 25, 2016
934345d
still seeing intermitent lodash problems. explicit version dep.
bmuenzenmeyer May 25, 2016
4b1edb4
Merge pull request #340 from pattern-lab/336-remove-hardcoded-path
May 25, 2016
b6e921c
stubbed file
bmuenzenmeyer May 25, 2016
5071ac9
console.log out the current list
bmuenzenmeyer May 25, 2016
3ea5911
Merge remote-tracking branch 'refs/remotes/origin/dev-2.0-core' into …
geoffp May 25, 2016
a983189
add patternengine-node-mustache as a dependency
geoffp May 27, 2016
591e60e
Merge pull request #333 from pattern-lab/load-engines
May 28, 2016
c84e70c
fix pathing issue in version command
bmuenzenmeyer May 28, 2016
63a89ea
core side of starterkit list wiring
bmuenzenmeyer May 28, 2016
94a1075
wiring up load kit
bmuenzenmeyer May 28, 2016
df8d175
rudimentary starterkit support
bmuenzenmeyer May 28, 2016
80aa5b7
Merge pull request #341 from pattern-lab/starterkit-manager
May 28, 2016
2028f1f
remove angry error message output when caught gracefully
bmuenzenmeyer May 28, 2016
9975fc8
no need to encode these files anymore
bmuenzenmeyer May 28, 2016
8778a93
delete old grunt and gulp task files, having replaced them with editions
bmuenzenmeyer Jun 1, 2016
3aaf422
Load engines flexibly from either the current directory's node_modules
geoffp Jun 1, 2016
bd16153
Merge pull request #342 from pattern-lab/flexible-engine-loading
Jun 3, 2016
689337a
fix some eslint warnings
bmuenzenmeyer Jun 3, 2016
c87cdfc
move isPattern declaration to the proper data level
bmuenzenmeyer Jun 3, 2016
452748c
refactor patternName per styleguidekit-mustache-default key mismatch
bmuenzenmeyer Jun 3, 2016
d401904
Merge pull request #346 from pattern-lab/patternName-rename
Jun 3, 2016
dc6cd22
pushed to support https://github.com/pattern-lab/edition-node-gulp/is…
bmuenzenmeyer Jun 3, 2016
cac925a
Hopefully fix #347. Use Path tools and regex instead of hackish
geoffp Jun 3, 2016
8966f66
Hopefully fix the nav issue
geoffp Jun 3, 2016
20787f0
Merge pull request #348 from pattern-lab/fix-347
Jun 3, 2016
618f8fd
better handles flat patterns when constructing the breadcrumb
bmuenzenmeyer Jun 3, 2016
1c9c92d
return when an error occurs
bmuenzenmeyer Jun 7, 2016
9599e4f
Make source/_meta a configurable path
bmuenzenmeyer Jun 7, 2016
9d37b62
Merge branch 'dev-2.0-core' of https://github.com/pattern-lab/pattern…
bmuenzenmeyer Jun 7, 2016
1c89489
Make the engine unit tests chill out if their engines aren't
geoffp Jun 7, 2016
fa1e6d3
Merge pull request #354 from pattern-lab/engine-unit-tests-chill
Jun 7, 2016
bd0d95f
improved throne error when cannot find partial by not clobbering it j…
bmuenzenmeyer Jun 9, 2016
56379e0
Merge branch 'dev-2.0-core' of https://github.com/pattern-lab/pattern…
bmuenzenmeyer Jun 9, 2016
9aeb5db
improve error message
bmuenzenmeyer Jun 9, 2016
9640056
removing direct dependencies
bmuenzenmeyer Jun 10, 2016
50950a9
Merge pull request #358 from pattern-lab/remove_dependencies
Jun 10, 2016
8c9d85e
pushing a failing test for #356
bmuenzenmeyer Jun 11, 2016
eda17c0
reset extendedTemplate to template after retrieval
bmuenzenmeyer Jun 11, 2016
a17fa30
clean up travis file per docs
bmuenzenmeyer Jun 11, 2016
8c7a7f6
Merge pull request #359 from pattern-lab/356-listitem-bug
Jun 11, 2016
0f75f15
improved help and changed CLI interface a bit
bmuenzenmeyer Jun 11, 2016
f2d6227
remove space
bmuenzenmeyer Jun 11, 2016
105c57b
bumping engine semver
bmuenzenmeyer Jun 11, 2016
037a42e
bumping semver
bmuenzenmeyer Jun 11, 2016
23e1a30
Merge branch 'dev' into dev-2.0-core
bmuenzenmeyer Jun 11, 2016
7c2d2fd
reverting engine dependency until Geoff npm publishes it
bmuenzenmeyer Jun 11, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"eqeqeq": [2, "allow-null"],
"global-strict": [0, "never"],
"guard-for-in": 2,
"indent": [2, 2, {"SwitchCase": 1, "VariableDeclarator": 1}],
"lines-around-comment": [2, {
"indent": [1, 2, {"SwitchCase": 1, "VariableDeclarator": 1}],
"lines-around-comment": [1, {
"beforeBlockComment": true,
"beforeLineComment": true,
"allowBlockStart": true,
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
node_modules/
npm-debug.log
.DS_Store
latest-change.txt
patternlab.json
Expand Down
17 changes: 13 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
language: node_js

node_js:
- stable
- 4.0
- 0.12
- 0.11
- node
- 6
- 5
- 4

before_install:
- phantomjs --version
Expand All @@ -16,3 +16,12 @@ branches:
only:
- master
- dev
- dev-2.0-core

notifications:
webhooks:
urls:
- https://webhooks.gitter.im/e/a14f537f16b0756d9470
on_success: always
on_failure: always
on_start: never
147 changes: 10 additions & 137 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,168 +1,41 @@
module.exports = function (grunt) {

var path = require('path');

function paths() {
return require('./patternlab-config.json').paths;
}

// Project configuration.
/******************************
* Project configuration.
* Should only be needed if you are developing against core, running tests, linting and want to run tests or increment package numbers
*****************************/
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
stripBanners: true,
banner: '/* \n * <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy") %> \n * \n * <%= pkg.author %>, and the web community.\n * Licensed under the <%= pkg.license %> license. \n * \n * Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice. \n *\n */\n\n',
banner: '/* \n * <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy") %> \n * \n * <%= pkg.author.name %>, <%= pkg.contributors[0].name %>, and the web community.\n * Licensed under the <%= pkg.license %> license. \n * \n * Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice. \n *\n */\n\n',
},
patternlab: {
src: './core/lib/patternlab.js',
dest: './core/lib/patternlab.js'
},
object_factory: {
src: './core/lib/object_factory.js',
dest: './core/lib/object_factory.js'
},
lineage: {
src: './core/lib/lineage_hunter.js',
dest: './core/lib/lineage_hunter.js'
},
media_hunter: {
src: './core/lib/media_hunter.js',
dest: './core/lib/media_hunter.js'
},
patternlab_grunt: {
src: './core/lib/patternlab_grunt.js',
dest: './core/lib/patternlab_grunt.js'
},
patternlab_gulp: {
src: './core/lib/patternlab_gulp.js',
dest: './core/lib/patternlab_gulp.js'
},
parameter_hunter: {
src: './core/lib/parameter_hunter.js',
dest: './core/lib/parameter_hunter.js'
},
pattern_exporter: {
src: './core/lib/pattern_exporter.js',
dest: './core/lib/pattern_exporter.js'
},
pattern_assembler: {
src: './core/lib/pattern_assembler.js',
dest: './core/lib/pattern_assembler.js'
},
pseudopattern_hunter: {
src: './core/lib/pseudopattern_hunter.js',
dest: './core/lib/pseudopattern_hunter.js'
},
list_item_hunter: {
src: './core/lib/list_item_hunter.js',
dest: './core/lib/list_item_hunter.js'
},
style_modifier_hunter: {
src: './core/lib/style_modifier_hunter.js',
dest: './core/lib/style_modifier_hunter.js'
}
},
copy: {
main: {
files: [
{ expand: true, cwd: path.resolve(paths().source.js), src: '*.js', dest: path.resolve(paths().public.js) },
{ expand: true, cwd: path.resolve(paths().source.css), src: '*.css', dest: path.resolve(paths().public.css) },
{ expand: true, cwd: path.resolve(paths().source.images), src: ['**/*.png', '**/*.jpg', '**/*.gif', '**/*.jpeg'], dest: path.resolve(paths().public.images) },
{ expand: true, cwd: path.resolve(paths().source.fonts), src: '*', dest: path.resolve(paths().public.fonts) },
{ expand: true, cwd: path.resolve(paths().source.data), src: 'annotations.js', dest: path.resolve(paths().public.data) }
]
},
styleguide: {
files: [
{ expand: true, cwd: path.resolve(paths().source.styleguide), src: ['*.*', '**/*.*'], dest: path.resolve(paths().public.styleguide) }
]
}
},
watch: {
all: {
files: [
path.resolve(paths().source.css + '**/*.css'),
path.resolve(paths().source.styleguide + 'css/*.css'),
path.resolve(paths().source.patterns + '**/*.mustache'),
path.resolve(paths().source.patterns + '**/*.json'),
path.resolve(paths().source.fonts + '/*'),
path.resolve(paths().source.images + '/*'),
path.resolve(paths().source.data + '*.json'),
path.resolve(paths().source.js + '/*.js')
],
tasks: ['default', 'bsReload:css']
}
},
nodeunit: {
all: ['test/*_tests.js']
},
browserSync: {
dev: {
options: {
server: path.resolve(paths().public.root),
watchTask: true,
watchOptions: {
ignoreInitial: true,
ignored: '*.html'
},
snippetOptions: {
// Ignore all HTML files within the templates folder
blacklist: ['/index.html', '/', '/?*']
},
plugins: [
{
module: 'bs-html-injector',
options: {
files: [path.resolve(paths().public.root + '/index.html'), path.resolve(paths().public.styleguide + '/styleguide.html')]
}
}
],
notify: {
styles: [
'display: none',
'padding: 15px',
'font-family: sans-serif',
'position: fixed',
'font-size: 1em',
'z-index: 9999',
'bottom: 0px',
'right: 0px',
'border-top-left-radius: 5px',
'background-color: #1B2032',
'opacity: 0.4',
'margin: 0',
'color: white',
'text-align: center'
]
}
}
}
},
eslint: {
options: {
configFile: './.eslintrc'
},
target: ['./core/lib/*']
},
bsReload: {
css: path.resolve(paths().public.root + '**/*.css')
}
});

// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);

//load the patternlab task
grunt.task.loadTasks('./core/lib/');

grunt.registerTask('default', ['patternlab', 'copy:main', 'copy:styleguide']);
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-contrib-nodeunit');

//travis CI task
grunt.registerTask('travis', ['nodeunit', 'eslint', 'patternlab']);

grunt.registerTask('serve', ['patternlab', 'copy:main', 'copy:styleguide', 'browserSync', 'watch:all']);
grunt.registerTask('travis', ['nodeunit', 'eslint']);

//to be run prior to releasing a version
grunt.registerTask('build', ['nodeunit', 'eslint', 'concat']);

};
113 changes: 113 additions & 0 deletions core/lib/annotation_exporter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
"use strict";

var annotations_exporter = function (pl) {
var path = require('path'),
fs = require('fs-extra'),
JSON5 = require('json5'),
_ = require('lodash'),
md = require('markdown-it')(),
paths = pl.config.paths;

/*
Returns the array of comments that used to be wrapped in raw JS.
*/
function parseAnnotationsJS() {
//attempt to read the file
try {
var oldAnnotations = fs.readFileSync(path.resolve(paths.source.annotations, 'annotations.js'), 'utf8');
} catch (ex) {
console.log('annotations.js file missing from ' + paths.source.annotations + '. This may be expected.');
return [];
}

//parse as JSON by removing the old wrapping js syntax. comments and the trailing semi-colon
oldAnnotations = oldAnnotations.replace('var comments = ', '');
try {
var oldAnnotationsJSON = JSON5.parse(oldAnnotations.trim().slice(0, -1));
} catch (ex) {
console.log('There was an error parsing JSON for ' + paths.source.annotations + 'annotations.js');
console.log(ex);
return [];
}
return oldAnnotationsJSON.comments;
}

/*
Converts the annotations.md file yaml list into an array of annotations
*/
function parseAnnotationsMD() {
var annotations = [];

//attempt to read the file
var annotationsMD = '';
try {
annotationsMD = fs.readFileSync(path.resolve(paths.source.annotations, 'annotations.md'), 'utf8');
} catch (ex) {
console.log('annotations.md file missing from ' + paths.source.annotations + '. This may be expected.');
return [];
}

//take the annotation snippets and split them on our custom delimiter
var annotationsYAML = annotationsMD.split('~*~');
for (var i = 0; i < annotationsYAML.length; i++) {
var annotation = {};

//for each annotation process the yaml frontmatter and markdown
var annotationSnippet = annotationsYAML[i];
var annotationsRE = /---\r?\n{1}([\s\S]*)---\r?\n{1}([\s\S]*)+/gm;
var chunks = annotationsRE.exec(annotationSnippet);
if (chunks && chunks[1] && chunks[2]) {

//convert each yaml frontmatter key into an object key
var frontmatter = chunks[1];
var frontmatterLines = frontmatter.split(/\n/gm);
for (var j = 0; j < frontmatterLines.length; j++) {
var frontmatterLine = frontmatterLines[j];
if (frontmatterLine.length > 0) {
var frontmatterLineChunks = frontmatterLine.split(':'); //test this
var frontmatterKey = frontmatterLineChunks[0].toLowerCase().trim();
var frontmatterValueString = frontmatterLineChunks[1].trim();
var frontmatterValue = frontmatterValueString.substring(1, frontmatterValueString.length - 1);
if (frontmatterKey === 'el' || frontmatterKey === 'selector') {
annotation.el = frontmatterValue;
}
if (frontmatterKey === 'title') {
annotation.title = frontmatterValue;
}
}
}

//set the comment to the parsed markdown
var annotationMarkdown = chunks[2];
annotation.comment = md.render(annotationMarkdown);

annotations.push(annotation);
} else {
console.log('annotations.md file not formatted as expected. Error parsing frontmatter and markdown out of ' + annotationSnippet);
}
}
return annotations;
}

function gatherAnnotations() {
var annotationsJS = parseAnnotationsJS();
var annotationsMD = parseAnnotationsMD();
var mergedAnnotations = _.unionBy(annotationsJS, annotationsMD, 'el');
return mergedAnnotations;
}

return {
gather: function () {
return gatherAnnotations();
},
gatherJS: function () {
return parseAnnotationsJS();
},
gatherMD: function () {
return parseAnnotationsMD();
}
};

};

module.exports = annotations_exporter;
Loading