Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
embl.org
vf-core-mirror
Commits
6e68c32a
Commit
6e68c32a
authored
Nov 23, 2021
by
Ken Hawkins
Browse files
Support for marked 4 and babel/core
parent
4cc40dd3
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
71 additions
and
52 deletions
+71
-52
tools/vf-component-library/package.json
tools/vf-component-library/package.json
+2
-1
tools/vf-core/CHANGELOG.md
tools/vf-core/CHANGELOG.md
+8
-0
tools/vf-core/fractal.js
tools/vf-core/fractal.js
+45
-44
tools/vf-core/package.json
tools/vf-core/package.json
+2
-2
tools/vf-frctl-extensions/CHANGELOG.md
tools/vf-frctl-extensions/CHANGELOG.md
+4
-0
tools/vf-frctl-extensions/markdown.js
tools/vf-frctl-extensions/markdown.js
+3
-3
tools/vf-frctl-extensions/package.json
tools/vf-frctl-extensions/package.json
+1
-1
tools/vf-sass-compilation/CHANGELOG.md
tools/vf-sass-compilation/CHANGELOG.md
+4
-0
tools/vf-sass-compilation/package.json
tools/vf-sass-compilation/package.json
+2
-1
No files found.
tools/vf-component-library/package.json
View file @
6e68c32a
...
...
@@ -27,7 +27,8 @@
"@11ty/eleventy"
:
"1.0.0-beta.8"
,
"@visual-framework/vf-config"
:
"1.0.1-alpha.0"
,
"@visual-framework/vf-core"
:
"^2.2.33"
,
"@visual-framework/vf-extensions"
:
"^1.0.1"
,
"@visual-framework/vf-core"
:
"^2.2.36"
,
"@visual-framework/vf-extensions"
:
"^2.0.0-alpha.1"
,
"html-minifier"
:
"4.0.0"
,
"node-html-parser"
:
"5.1.0"
,
"require-dir"
:
"1.2.0"
,
...
...
tools/vf-core/CHANGELOG.md
View file @
6e68c32a
### 2.2.36
*
Use
`renderMarkdown.parse`
for marked 4+ support.
### 2.2.35
*
Update @visual-framework/vf-frctl-extensions to ^2.0.0 for marked 4+ support.
### 2.2.34
*
Update marked to 4.0.4
...
...
tools/vf-core/fractal.js
View file @
6e68c32a
const
renderMarkdown
=
require
(
"
marked
"
);
module
.
exports
=
{
// mode: 'build' or 'server'
initialize
:
function
(
mode
,
callback
)
{
/* Create a new Fractal instance and export it for use elsewhere if required */
const
fractal
=
module
.
exports
=
require
(
'
@frctl/fractal
'
).
create
();
const
fractal
=
module
.
exports
=
require
(
"
@frctl/fractal
"
).
create
();
const
logger
=
fractal
.
cli
.
console
;
var
vfName
=
global
.
vfName
||
'
Visual Framework component library
'
;
var
vfName
=
global
.
vfName
||
"
Visual Framework component library
"
;
const
projectTitle
=
vfName
;
const
path
=
require
(
'
path
'
);
const
path
=
require
(
"
path
"
);
/* Set the title of the project */
fractal
.
set
(
'
project.title
'
,
projectTitle
);
fractal
.
set
(
"
project.title
"
,
projectTitle
);
/* Tell Fractal where the components will live */
var
vfComponentPath
=
global
.
vfComponentPath
||
__dirname
+
'
/components
'
;
var
vfComponentPath
=
global
.
vfComponentPath
||
__dirname
+
"
/components
"
;
// Possible needed fix to resolve path
// vfComponentPath = path.resolve('.',vfComponentPath);
fractal
.
components
.
set
(
'
path
'
,
vfComponentPath
);
fractal
.
components
.
set
(
"
path
"
,
vfComponentPath
);
/* Tell Fractal where the documentation pages will live */
var
vfDocsPath
=
global
.
vfDocsPath
||
__dirname
+
'
/docs
'
;
fractal
.
docs
.
set
(
'
path
'
,
vfDocsPath
);
var
vfDocsPath
=
global
.
vfDocsPath
||
__dirname
+
"
/docs
"
;
fractal
.
docs
.
set
(
"
path
"
,
vfDocsPath
);
const
nunj
=
require
(
'
@frctl/nunjucks
'
)({
const
nunj
=
require
(
"
@frctl/nunjucks
"
)({
env
:
{
lstripBlocks
:
true
,
trimBlocks
:
true
,
...
...
@@ -35,8 +37,7 @@ module.exports = {
filters
:
{
// {{ "## Parse me" | marked }}
marked
:
function
(
string
)
{
const
renderMarkdown
=
require
(
'
marked
'
);
return
renderMarkdown
(
string
);
return
renderMarkdown
.
parse
(
string
);
},
// A filter and non-async version of frctl's context extension from
// https://github.com/frctl/nunjucks/blob/develop/src/extensions/context.js
...
...
@@ -55,61 +56,61 @@ module.exports = {
hextorgb
:
module
.
exports
=
function
(
text
)
{
function
hexToRGB
(
hex
)
{
var
r
=
parseInt
(
hex
.
slice
(
1
,
3
),
16
),
g
=
parseInt
(
hex
.
slice
(
3
,
5
),
16
),
b
=
parseInt
(
hex
.
slice
(
5
,
7
),
16
);
g
=
parseInt
(
hex
.
slice
(
3
,
5
),
16
),
b
=
parseInt
(
hex
.
slice
(
5
,
7
),
16
);
return
"
rgb(
"
+
r
+
"
,
"
+
g
+
"
,
"
+
b
+
"
)
"
;
}
var
hex
=
new
String
(
text
);
return
hexToRGB
(
hex
);
}
}
},
// globals: {
// // global-name: global-val
// },
extensions
:
{
codeblock
:
require
(
'
@visual-framework/vf-frctl-extensions/codeblock.js
'
)(
fractal
),
spaceless
:
require
(
'
@visual-framework/vf-frctl-extensions/spaceless.js
'
)(
fractal
),
markdown
:
require
(
'
@visual-framework/vf-frctl-extensions/markdown.js
'
)(
fractal
)
codeblock
:
require
(
"
@visual-framework/vf-frctl-extensions/codeblock.js
"
)(
fractal
),
spaceless
:
require
(
"
@visual-framework/vf-frctl-extensions/spaceless.js
"
)(
fractal
),
markdown
:
require
(
"
@visual-framework/vf-frctl-extensions/markdown.js
"
)(
fractal
)
}
});
fractal
.
components
.
set
(
'
ext
'
,
'
.njk
'
);
// look for files with a .nunj file extension
fractal
.
components
.
set
(
"
ext
"
,
"
.njk
"
);
// look for files with a .nunj file extension
fractal
.
components
.
engine
(
nunj
);
/* set as the default template engine for components */
fractal
.
docs
.
set
(
'
ext
'
,
'
.njk
'
);
// look for files with a .njk file extension
fractal
.
docs
.
set
(
"
ext
"
,
"
.njk
"
);
// look for files with a .njk file extension
fractal
.
docs
.
engine
(
nunj
);
/* you can also use the same instance for documentation, if you like! */
/* configure components */
fractal
.
components
.
set
(
'
default.status
'
,
'
alpha
'
);
fractal
.
components
.
set
(
'
default.preview
'
,
`
@preview
`
);
fractal
.
components
.
set
(
"
default.status
"
,
"
alpha
"
);
fractal
.
components
.
set
(
"
default.preview
"
,
"
@preview
"
);
/* build destination */
var
vfBuilderPath
=
global
.
vfBuilderPath
||
__dirname
+
'
/build
'
;
fractal
.
web
.
set
(
'
builder.dest
'
,
vfBuilderPath
);
fractal
.
set
(
'
components.resources.assets.match
'
,
[
'
**/*.njk
'
,
'
**/*.config.yml
'
,
'
**/*.scss
'
,
'
**/CHANGELOG.md
'
,
'
**/*.js
'
,
'
**/*.css
'
,
'
!**/*.precompiled.js
'
,
'
!**/package.variables.scss
'
,
'
!**/index.scss
'
])
var
vfBuilderPath
=
global
.
vfBuilderPath
||
__dirname
+
"
/build
"
;
fractal
.
web
.
set
(
"
builder.dest
"
,
vfBuilderPath
);
fractal
.
set
(
"
components.resources.assets.match
"
,
[
"
**/*.njk
"
,
"
**/*.config.yml
"
,
"
**/*.scss
"
,
"
**/CHANGELOG.md
"
,
"
**/*.js
"
,
"
**/*.css
"
,
"
!**/*.precompiled.js
"
,
"
!**/package.variables.scss
"
,
"
!**/index.scss
"
])
;
/* configure web */
var
vfStaticPath
=
global
.
vfStaticPath
||
__dirname
+
'
/temp/build-files
'
;
fractal
.
web
.
set
(
'
static.path
'
,
vfStaticPath
);
fractal
.
web
.
set
(
'
server.sync
'
,
true
);
var
vfStaticPath
=
global
.
vfStaticPath
||
__dirname
+
"
/temp/build-files
"
;
fractal
.
web
.
set
(
"
static.path
"
,
vfStaticPath
);
fractal
.
web
.
set
(
"
server.sync
"
,
true
);
var
vfOpenBrowser
=
typeof
global
.
vfOpenBrowser
===
"
undefined
"
?
true
:
global
.
vfOpenBrowser
;
fractal
.
web
.
set
(
'
server.syncOptions
'
,
{
fractal
.
web
.
set
(
"
server.syncOptions
"
,
{
watchOptions
:
{
// @todo: this should use vfComponentPath
ignored
:
path
.
join
(
__dirname
,
'
../../components/**/*.scss
'
),
ignored
:
path
.
join
(
__dirname
,
"
../../components/**/*.scss
"
),
},
open
:
vfOpenBrowser
,
browser
:
'
default
'
,
browser
:
"
default
"
,
sync
:
true
});
var
vfThemePath
=
global
.
vfThemePath
||
'
@frctl/mandelbrot
'
;
var
vfThemePath
=
global
.
vfThemePath
||
"
@frctl/mandelbrot
"
;
const
vfTheme
=
require
(
vfThemePath
);
const
vfThemeConfig
=
vfTheme
({},
fractal
);
fractal
.
components
.
set
(
'
statuses
'
,
{
fractal
.
components
.
set
(
"
statuses
"
,
{
/* status definitions here */
alpha
:
{
label
:
"
alpha
"
,
...
...
@@ -136,8 +137,8 @@ module.exports = {
fractal
.
web
.
theme
(
vfThemeConfig
);
if
(
mode
==
'
server
'
)
{
fractal
.
set
(
'
project.environment.local
'
,
'
true
'
);
if
(
mode
==
"
server
"
)
{
fractal
.
set
(
"
project.environment.local
"
,
"
true
"
);
const
fractalServer
=
fractal
.
web
.
server
({
sync
:
true
});
...
...
@@ -150,27 +151,27 @@ module.exports = {
}
// If you want to build static html files
if
(
mode
==
'
build
'
)
{
fractal
.
set
(
'
project.environment.production
'
,
'
true
'
);
if
(
mode
==
"
build
"
)
{
fractal
.
set
(
"
project.environment.production
"
,
"
true
"
);
const
builder
=
fractal
.
web
.
builder
();
builder
.
on
(
'
progress
'
,
(
completed
,
total
)
=>
logger
.
update
(
`Exported
${
completed
}
of
${
total
}
items`
,
'
info
'
)
builder
.
on
(
"
progress
"
,
(
completed
,
total
)
=>
logger
.
update
(
`Exported
${
completed
}
of
${
total
}
items`
,
"
info
"
)
);
builder
.
on
(
'
error
'
,
err
=>
logger
.
error
(
err
.
message
));
builder
.
on
(
"
error
"
,
err
=>
logger
.
error
(
err
.
message
));
return
builder
.
build
().
then
(()
=>
{
logger
.
success
(
'
Fractal build completed!
'
);
logger
.
success
(
"
Fractal build completed!
"
);
callback
(
fractal
);
});
}
// To build the fractal object in memory
if
(
mode
==
'
dataobject
'
)
{
fractal
.
set
(
'
project.environment.production
'
,
'
true
'
);
if
(
mode
==
"
dataobject
"
)
{
fractal
.
set
(
"
project.environment.production
"
,
"
true
"
);
const
server
=
fractal
.
web
.
server
();
server
.
start
().
then
(
function
(){
console
.
log
(
'
The Fractal component data has been generated.
'
);
console
.
log
(
"
The Fractal component data has been generated.
"
);
callback
(
fractal
);
server
.
stop
();
fractal
.
unwatch
();
// exit fractal
...
...
@@ -178,4 +179,4 @@ module.exports = {
}
}
}
}
;
tools/vf-core/package.json
View file @
6e68c32a
{
"name"
:
"@visual-framework/vf-core"
,
"version"
:
"2.2.3
4
"
,
"version"
:
"2.2.3
6
"
,
"description"
:
"Common dependencies for the Visual Framework 2.0."
,
"engines"
:
{
"node"
:
">=12.0.0"
...
...
@@ -31,7 +31,7 @@
"dependencies"
:
{
"@visual-framework/vf-component-generator"
:
"^1.1.5"
,
"@visual-framework/vf-component-initialization"
:
"^1.1.7"
,
"@visual-framework/vf-frctl-extensions"
:
"^
1
.0.
1
"
,
"@visual-framework/vf-frctl-extensions"
:
"^
2
.0.
0
"
,
"@visual-framework/vf-sass-compilation"
:
"^1.1.16"
,
"chalk"
:
"^4.0.0"
,
"del"
:
"^6.0.0"
,
...
...
tools/vf-frctl-extensions/CHANGELOG.md
View file @
6e68c32a
### 2.0.0
*
Invoke marked with
`renderMarkdown.parse`
for compatibility with version 4.
### 1.0.1
*
Updates highlightjs syntax of codeblock tag
...
...
tools/vf-frctl-extensions/markdown.js
View file @
6e68c32a
...
...
@@ -58,14 +58,14 @@ module.exports = function(fractal){
var
body
=
body
();
var
spacesRegex
=
/^
[\s]
+/
;
var
tabStart
=
tabStart
();
// The column postion of the {% markdown %} tag.
var
tabStart
=
tabStart
();
// The column pos
i
tion of the {% markdown %} tag.
if
(
tabStart
>
0
)
{
// If the {% markdown %} tag is tabbed in, normalize the content to the same depth.
body
=
body
.
split
(
/
\r?\n
/
);
// Split into lines.
body
=
body
.
map
(
function
(
line
)
{
var
startSpaces
=
line
.
match
(
spacesRegex
);
if
(
startSpaces
&&
startSpaces
[
0
].
length
>=
tabStart
)
{
// If the content is not at the same or greater tab depth, do nothing..
return
line
.
slice
(
tabStart
);
// Subtract the column postion from the start of the string.
return
line
.
slice
(
tabStart
);
// Subtract the column pos
i
tion from the start of the string.
}
else
if
(
startSpaces
)
{
return
line
.
slice
(
startSpaces
[
0
].
length
);
}
else
{
...
...
@@ -75,8 +75,8 @@ module.exports = function(fractal){
body
=
body
.
join
(
"
\n
"
);
// Rejoin into one string.
}
return
new
nunjucks
.
runtime
.
SafeString
(
renderMarkdown
(
body
));
};
return
new
nunjucks
.
runtime
.
SafeString
(
renderMarkdown
.
parse
(
body
));
}
...
...
tools/vf-frctl-extensions/package.json
View file @
6e68c32a
{
"name"
:
"@visual-framework/vf-frctl-extensions"
,
"version"
:
"
1
.0.
1
"
,
"version"
:
"
2
.0.
0
"
,
"description"
:
"Reusable componentised code, modules and config for Visual Framework based projects using Fractal."
,
"main"
:
"index.js"
,
"scripts"
:
{
...
...
tools/vf-sass-compilation/CHANGELOG.md
View file @
6e68c32a
### 1.1.18
*
Add now required @babel/core dependency.
### 1.1.17
*
Update @babel/preset-env to 7.16.4
...
...
tools/vf-sass-compilation/package.json
View file @
6e68c32a
{
"name"
:
"@visual-framework/vf-sass-compilation"
,
"version"
:
"1.1.1
7
"
,
"version"
:
"1.1.1
8
"
,
"description"
:
"Build the Sass for Visual Framework 2.0 projects."
,
"main"
:
"index.js"
,
"scripts"
:
{
...
...
@@ -12,6 +12,7 @@
},
"private"
:
false
,
"dependencies"
:
{
"@babel/core"
:
"^7.16.0"
,
"@babel/preset-env"
:
"7.16.4"
,
"eslint"
:
"^8.0.0"
,
"gulp-autoprefixer"
:
"^8.0.0"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment