@penskemediacorp/larva 1.2.0-alpha.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +6 -0
- package/LICENSE +21 -0
- package/README.md +119 -4
- package/__tests__/fixtures/build/css/common.inline.css +1 -0
- package/__tests__/fixtures/build/images/test.png +0 -0
- package/__tests__/fixtures/build/js/larva-ui.js +1 -0
- package/__tests__/fixtures/build/svg/defs/sprite.svg +1 -0
- package/__tests__/fixtures/larva.config.js +43 -0
- package/__tests__/fixtures/public/some-library.js +1 -0
- package/__tests__/fixtures/src/patterns/__tests__/.gitkeep +0 -0
- package/__tests__/fixtures/src/patterns/components/c-nav-link/c-nav-link.featured.aia.js +3 -0
- package/__tests__/fixtures/src/patterns/components/c-nav-link/c-nav-link.featured.js +3 -0
- package/__tests__/fixtures/src/patterns/components/c-nav-link/c-nav-link.js +1 -0
- package/__tests__/fixtures/src/patterns/components/c-nav-link/c-nav-link.json +3 -0
- package/__tests__/fixtures/src/patterns/components/c-nav-link/c-nav-link.prototype.js +3 -0
- package/__tests__/fixtures/src/patterns/components/c-nav-link/c-nav-link.twig +3 -0
- package/__tests__/fixtures/src/patterns/components/c-tagline/c-tagline.prototype.js +3 -0
- package/__tests__/fixtures/src/patterns/modules/_also-ignored/_also-ignored.prototype.js +3 -0
- package/__tests__/fixtures/src/patterns/modules/_also-ignored/_also-ignored.twig +3 -0
- package/__tests__/fixtures/src/patterns/modules/ignore-me/ignore-me.prototype.js +0 -0
- package/__tests__/fixtures/src/patterns/modules/ignore-me/ignore-me.twig +0 -0
- package/__tests__/fixtures/src/patterns/modules/test-module/test-module.featured.js +3 -0
- package/__tests__/fixtures/src/patterns/modules/test-module/test-module.prototype.js +3 -0
- package/__tests__/fixtures/src/patterns/modules/test-module/test-module.twig +0 -0
- package/__tests__/fixtures/src/patterns/objects/_objects.scss +0 -0
- package/__tests__/fixtures/src/patterns/objects/o-crap/o-crap.json +3 -0
- package/__tests__/fixtures/src/patterns/objects/o-crap/o-crap.scss +0 -0
- package/__tests__/fixtures/src/patterns/objects/o-crap/o-crap.twig +1 -0
- package/__tests__/fixtures/src/patterns/objects/o-nav/o-nav.twig +14 -0
- package/__tests__/fixtures/src/patterns/one-offs/newswire/newswire.html +1 -0
- package/__tests__/fixtures/src/patterns/one-offs/newswire/newswire.prototype.js +3 -0
- package/__tests__/fixtures/template-parts/some-template.php +3 -0
- package/__tests__/lib/generateStatic.test.js +140 -0
- package/__tests__/lib/utils/clonePatternData.test.js +23 -0
- package/__tests__/lib/utils/getAllPatternsObj.test.js +45 -0
- package/__tests__/lib/utils/getAppConfiguration.test.js +13 -0
- package/__tests__/lib/utils/getModuleNamesFromDirectory.test.js +23 -0
- package/__tests__/lib/utils/getPatternData.test.js +55 -0
- package/__tests__/lib/utils/getPatternPathsToLoad.test.js +13 -0
- package/__tests__/lib/utils/getPatternRoutes.test.js +29 -0
- package/__tests__/lib/utils/getPatternType.test.js +16 -0
- package/__tests__/lib/utils/getPatternVariants.test.js +20 -0
- package/__tests__/lib/utils/getPatternsIndexPath.test.js +9 -0
- package/__tests__/lib/utils/getSubDirectoryNames.test.js +17 -0
- package/__tests__/lib/utils/isCoreTheme.test.js +12 -0
- package/__tests__/lib/utils/writeJsonToFile.test.js +29 -0
- package/__tests__/lib/writeJson.test.js +83 -0
- package/bin/larva.js +25 -0
- package/build/css/larva-important.css +1 -0
- package/build/css/larva-ui.css +1 -0
- package/build/css/larva.css +1 -0
- package/build/css/larva.inline-important.css +1 -0
- package/build/css/larva.inline.css +1 -0
- package/build/css/variety.compat-important.css +1 -0
- package/build/css/variety.compat.css +1 -0
- package/build/js/common.js +26 -0
- package/build/js/larva-ui.js +1 -0
- package/build/js/standalone/video-showcase.js +26 -0
- package/build/svg/brand-logo-white.svg +1 -0
- package/build/svg/brand-logo.svg +1 -0
- package/build/svg/defs/sprite.defs.html +852 -0
- package/build/svg/defs/sprite.defs.svg +1 -0
- package/build/tokens/artinamerica.custom-properties.css +546 -0
- package/build/tokens/artinamerica.json +533 -0
- package/build/tokens/artinamerica.map.scss +546 -0
- package/build/tokens/artinamerica.raw.json +4341 -0
- package/build/tokens/artnews.custom-properties.css +550 -0
- package/build/tokens/artnews.json +536 -0
- package/build/tokens/artnews.map.scss +550 -0
- package/build/tokens/artnews.raw.json +4373 -0
- package/build/tokens/bbpro.custom-properties.css +96 -0
- package/build/tokens/bbpro.json +80 -0
- package/build/tokens/bbpro.map.scss +96 -0
- package/build/tokens/bbpro.raw.json +789 -0
- package/build/tokens/billboard.custom-properties.css +96 -0
- package/build/tokens/billboard.json +80 -0
- package/build/tokens/billboard.map.scss +96 -0
- package/build/tokens/billboard.raw.json +789 -0
- package/build/tokens/deadline.custom-properties.css +533 -0
- package/build/tokens/deadline.json +517 -0
- package/build/tokens/deadline.map.scss +533 -0
- package/build/tokens/deadline.raw.json +4204 -0
- package/build/tokens/default.custom-properties.css +533 -0
- package/build/tokens/default.json +517 -0
- package/build/tokens/default.map.scss +533 -0
- package/build/tokens/default.raw.json +4204 -0
- package/build/tokens/dirt.custom-properties.css +81 -0
- package/build/tokens/dirt.json +66 -0
- package/build/tokens/dirt.map.scss +81 -0
- package/build/tokens/dirt.raw.json +690 -0
- package/build/tokens/indiewire.custom-properties.css +536 -0
- package/build/tokens/indiewire.json +520 -0
- package/build/tokens/indiewire.map.scss +536 -0
- package/build/tokens/indiewire.raw.json +4221 -0
- package/build/tokens/rivet.custom-properties.css +82 -0
- package/build/tokens/rivet.json +68 -0
- package/build/tokens/rivet.map.scss +82 -0
- package/build/tokens/rivet.raw.json +703 -0
- package/build/tokens/robbreport.custom-properties.css +536 -0
- package/build/tokens/robbreport.json +518 -0
- package/build/tokens/robbreport.map.scss +536 -0
- package/build/tokens/robbreport.raw.json +4215 -0
- package/build/tokens/rollingstone-2022.custom-properties.css +534 -0
- package/build/tokens/rollingstone-2022.json +519 -0
- package/build/tokens/rollingstone-2022.map.scss +534 -0
- package/build/tokens/rollingstone-2022.raw.json +4035 -0
- package/build/tokens/rollingstone.custom-properties.css +530 -0
- package/build/tokens/rollingstone.json +518 -0
- package/build/tokens/rollingstone.map.scss +530 -0
- package/build/tokens/rollingstone.raw.json +4207 -0
- package/build/tokens/sheknows.custom-properties.css +92 -0
- package/build/tokens/sheknows.json +76 -0
- package/build/tokens/sheknows.map.scss +92 -0
- package/build/tokens/sheknows.raw.json +761 -0
- package/build/tokens/sourcingjournal.custom-properties.css +87 -0
- package/build/tokens/sourcingjournal.json +70 -0
- package/build/tokens/sourcingjournal.map.scss +87 -0
- package/build/tokens/sourcingjournal.raw.json +720 -0
- package/build/tokens/sportico.custom-properties.css +73 -0
- package/build/tokens/sportico.json +59 -0
- package/build/tokens/sportico.map.scss +73 -0
- package/build/tokens/sportico.raw.json +640 -0
- package/build/tokens/thr.custom-properties.css +83 -0
- package/build/tokens/thr.json +67 -0
- package/build/tokens/thr.map.scss +83 -0
- package/build/tokens/thr.raw.json +698 -0
- package/build/tokens/variety-compat.custom-properties.css +36 -0
- package/build/tokens/variety-compat.json +33 -0
- package/build/tokens/variety-compat.map.scss +36 -0
- package/build/tokens/variety-compat.raw.json +224 -0
- package/build/tokens/variety-vip.custom-properties.css +532 -0
- package/build/tokens/variety-vip.json +521 -0
- package/build/tokens/variety-vip.map.scss +532 -0
- package/build/tokens/variety-vip.raw.json +4223 -0
- package/build/tokens/variety.custom-properties.css +534 -0
- package/build/tokens/variety.json +521 -0
- package/build/tokens/variety.map.scss +534 -0
- package/build/tokens/variety.raw.json +4225 -0
- package/build/tokens/vibe.custom-properties.css +77 -0
- package/build/tokens/vibe.json +63 -0
- package/build/tokens/vibe.map.scss +77 -0
- package/build/tokens/vibe.raw.json +668 -0
- package/build/tokens/wwd-2021.custom-properties.css +82 -0
- package/build/tokens/wwd-2021.json +67 -0
- package/build/tokens/wwd-2021.map.scss +82 -0
- package/build/tokens/wwd-2021.raw.json +701 -0
- package/build/tokens/wwd-beauty.custom-properties.css +86 -0
- package/build/tokens/wwd-beauty.json +70 -0
- package/build/tokens/wwd-beauty.map.scss +86 -0
- package/build/tokens/wwd-beauty.raw.json +719 -0
- package/build/tokens/wwd-dd.custom-properties.css +18 -0
- package/build/tokens/wwd-dd.json +13 -0
- package/build/tokens/wwd-dd.map.scss +18 -0
- package/build/tokens/wwd-dd.raw.json +90 -0
- package/build/tokens/wwd.custom-properties.css +70 -0
- package/build/tokens/wwd.json +60 -0
- package/build/tokens/wwd.map.scss +70 -0
- package/build/tokens/wwd.raw.json +643 -0
- package/index.js +7 -0
- package/lib/generateStatic.js +133 -0
- package/lib/server.js +284 -0
- package/lib/start.js +7 -0
- package/lib/utils/clonePatternData.js +13 -0
- package/lib/utils/copySyncHelper.js +33 -0
- package/lib/utils/getAllPatternsObj.js +48 -0
- package/lib/utils/getAppConfiguration.js +82 -0
- package/lib/utils/getArgsFromCli.js +3 -0
- package/lib/utils/getModuleNamesFromDirectory.js +11 -0
- package/lib/utils/getPatternData.js +34 -0
- package/lib/utils/getPatternPathsToLoad.js +20 -0
- package/lib/utils/getPatternRoutes.js +58 -0
- package/lib/utils/getPatternType.js +15 -0
- package/lib/utils/getPatternVariants.js +24 -0
- package/lib/utils/getPatternsIndexPath.js +11 -0
- package/lib/utils/getSubDirectoryNames.js +23 -0
- package/lib/utils/isCoreTheme.js +8 -0
- package/lib/utils/renderSass.js +20 -0
- package/lib/utils/spawnScript.js +26 -0
- package/lib/utils/writeJsonToFile.js +6 -0
- package/lib/writeJson.js +53 -0
- package/package.json +72 -5
- package/public/webfontloader.js +22 -0
- package/scripts/build-html.js +52 -0
- package/scripts/build-icons.js +80 -0
- package/scripts/build-scss.js +15 -0
- package/scripts/config/.eslintrc.json +11 -0
- package/scripts/config/gulpfile.js +191 -0
- package/scripts/config/stylelint.config.js +5 -0
- package/scripts/config/svgo-config.json +67 -0
- package/scripts/config/webpack.config.js +95 -0
- package/scripts/dev-js.js +13 -0
- package/scripts/dev-scss.js +20 -0
- package/scripts/help.js +65 -0
- package/scripts/init.js +21 -0
- package/scripts/larva/.nvmrc +1 -0
- package/scripts/larva/README.md +29 -0
- package/scripts/larva/larva.config.js +3 -0
- package/scripts/larva/src/patterns/README.md +3 -0
- package/scripts/larva/src/patterns/base.html +6 -0
- package/scripts/larva/src/patterns/components/README.md +3 -0
- package/scripts/larva/src/patterns/modules/README.md +3 -0
- package/scripts/larva/src/patterns/objects/README.md +3 -0
- package/scripts/larva/src/patterns/one-offs/README.md +3 -0
- package/scripts/link-all.js +40 -0
- package/scripts/lint-js.js +11 -0
- package/scripts/lint-scss.js +13 -0
- package/scripts/lint.js +73 -0
- package/scripts/prod-js.js +12 -0
- package/scripts/prod-scss.js +24 -0
- package/scripts/prod.js +122 -0
- package/scripts/server.js +11 -0
- package/scripts/start.js +36 -0
- package/scripts/upgrade.js +99 -0
- package/scripts/write-json.js +14 -0
- package/.DS_Store +0 -0
- package/__tests__/larva.test.js +0 -7
- package/lib/larva.js +0 -7
- package/lib/patterns.js +0 -48
- package/setup.scss +0 -1
- package/src/02-generic/breakpoint-label.scss +0 -33
- package/src/06-algorithms/a-glue/a-glue.html +0 -4
- package/src/06-algorithms/a-glue/a-glue.scss +0 -56
- package/src/06-algorithms/a-glue/index.js +0 -1
- package/src/06-algorithms/a-grid.scss +0 -29
- package/src/07-utilities/u-background.scss +0 -5
- package/src/07-utilities/u-color.scss +0 -5
- package/src/07-utilities/u-crop.scss +0 -5
- package/src/07-utilities/u-flex.scss +0 -35
- package/src/07-utilities/u-margin.scss +0 -5
- package/src/07-utilities/u-padding.scss +0 -5
- package/src/07-utilities/u-text.scss +0 -33
- package/src/07-utilities/utilities.scss +0 -5
- package/static/css/components.css +0 -4
- package/static/css/objects.css +0 -21
- package/static/css/prism.css +0 -126
- package/static/js/prism.js +0 -8
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const path = require( 'path' );
|
|
2
|
+
|
|
3
|
+
const spawnScript = require( '../lib/utils/spawnScript' );
|
|
4
|
+
|
|
5
|
+
const configPath = path.join( __dirname, './config/webpack.config.js' );
|
|
6
|
+
|
|
7
|
+
const args = [
|
|
8
|
+
`--config=${ configPath }`,
|
|
9
|
+
'--mode=production'
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
spawnScript( './node_modules/.bin/webpack', args );
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const path = require( 'path' );
|
|
2
|
+
|
|
3
|
+
const getArgsFromCli = require( '../lib/utils/getArgsFromCli' );
|
|
4
|
+
const spawnScript = require( '../lib/utils/spawnScript' );
|
|
5
|
+
|
|
6
|
+
const gulpfilePath = path.join( __dirname, './config/gulpfile.js' );
|
|
7
|
+
|
|
8
|
+
const cliArgs = getArgsFromCli();
|
|
9
|
+
const generateImportantVariants = '--generate-important-variants' === cliArgs[1];
|
|
10
|
+
|
|
11
|
+
// Remove our arg so Gulp doesn't complain about an undefined task.
|
|
12
|
+
if ( generateImportantVariants ) {
|
|
13
|
+
process.argv.pop();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const args = [
|
|
17
|
+
generateImportantVariants ? 'prod-scss-with-important-variants' : 'prod-scss',
|
|
18
|
+
'--gulpfile',
|
|
19
|
+
gulpfilePath,
|
|
20
|
+
'--cwd',
|
|
21
|
+
process.cwd(),
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
spawnScript( './node_modules/.bin/gulp', args );
|
package/scripts/prod.js
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run a production ready build in a Larva project.
|
|
3
|
+
*
|
|
4
|
+
* ## OPTIONS
|
|
5
|
+
*
|
|
6
|
+
* [--help]
|
|
7
|
+
* : Display usage and examples for this command.
|
|
8
|
+
*
|
|
9
|
+
* [--parse]
|
|
10
|
+
* : Run the Twig-to-PHP parser.
|
|
11
|
+
*
|
|
12
|
+
* [--parser]
|
|
13
|
+
* : Alias for --parse.
|
|
14
|
+
*
|
|
15
|
+
* [--json]
|
|
16
|
+
* : Run the write-json script.
|
|
17
|
+
*
|
|
18
|
+
* [--write-json]
|
|
19
|
+
* : Alias for --json.
|
|
20
|
+
*
|
|
21
|
+
* [--css]
|
|
22
|
+
* : Build CSS assets.
|
|
23
|
+
*
|
|
24
|
+
* [--scss]
|
|
25
|
+
* : Alias for --css.
|
|
26
|
+
*
|
|
27
|
+
* [--js]
|
|
28
|
+
* : Build JavaScript assets.
|
|
29
|
+
*
|
|
30
|
+
* [--svg]
|
|
31
|
+
* : Build SVG assets.
|
|
32
|
+
*
|
|
33
|
+
* ## EXAMPLES
|
|
34
|
+
*
|
|
35
|
+
* # Run a full build
|
|
36
|
+
* $ npx @penskemediacorp/larva prod
|
|
37
|
+
*
|
|
38
|
+
* # Only run the write-json script.
|
|
39
|
+
* $ npx @penskemediacorp/larva prod --write-json
|
|
40
|
+
*
|
|
41
|
+
* # Run builds for CSS & JavaScript.
|
|
42
|
+
* $ npx @penskemediacorp/larva prod --css --js
|
|
43
|
+
*
|
|
44
|
+
* # Help command.
|
|
45
|
+
* $ npx @penskemediacorp/larva prod --help
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
// Dependencies.
|
|
49
|
+
const path = require( 'path' );
|
|
50
|
+
const shell = require( 'shelljs' );
|
|
51
|
+
|
|
52
|
+
// Construct some paths to point our scripts at.
|
|
53
|
+
const binPath = path.resolve( __dirname, '../bin/larva.js' ); // For sibling scripts.
|
|
54
|
+
|
|
55
|
+
// CLI arguments.
|
|
56
|
+
const getArgsFromCli = require( '../lib/utils/getArgsFromCli' );
|
|
57
|
+
const cliArgs = getArgsFromCli();
|
|
58
|
+
|
|
59
|
+
// Handle help command.
|
|
60
|
+
if ( cliArgs.includes( '--help' ) ) {
|
|
61
|
+
shell.exec( `npx @penskemediacorp/larva help prod` );
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Run the Twig-to-PHP parser.
|
|
66
|
+
if (
|
|
67
|
+
1 === cliArgs.length
|
|
68
|
+
|| cliArgs.includes( '--parser' )
|
|
69
|
+
|| cliArgs.includes( '--parse' )
|
|
70
|
+
) {
|
|
71
|
+
console.log( 'Parsing Twig templates\n\n' );
|
|
72
|
+
shell.exec( `npx @penskemediacorp/twig-to-php-parser` );
|
|
73
|
+
} else {
|
|
74
|
+
console.log( 'Skipping Twig templates\n' );
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Run the write-json script.
|
|
78
|
+
if (
|
|
79
|
+
1 === cliArgs.length
|
|
80
|
+
|| cliArgs.includes( '--json' )
|
|
81
|
+
|| cliArgs.includes( '--write-json' )
|
|
82
|
+
) {
|
|
83
|
+
console.log( 'Building JSON assets\n\n' );
|
|
84
|
+
shell.exec( `${binPath} write-json` );
|
|
85
|
+
} else {
|
|
86
|
+
console.log( 'Skipping write-json\n' );
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Build CSS/SCSS.
|
|
90
|
+
if (
|
|
91
|
+
1 === cliArgs.length
|
|
92
|
+
|| cliArgs.includes( '--css' )
|
|
93
|
+
|| cliArgs.includes( '--scss' )
|
|
94
|
+
) {
|
|
95
|
+
console.log( 'Building CSS assets\n\n' );
|
|
96
|
+
shell.exec( `${binPath} prod-scss` );
|
|
97
|
+
} else {
|
|
98
|
+
console.log( 'Skipping building CSS\n' );
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Build JS.
|
|
102
|
+
if (
|
|
103
|
+
1 === cliArgs.length
|
|
104
|
+
|| cliArgs.includes( '--js' )
|
|
105
|
+
) {
|
|
106
|
+
console.log( 'Building JavaScript assets\n\n' );
|
|
107
|
+
shell.exec( `${binPath} prod-js` );
|
|
108
|
+
} else {
|
|
109
|
+
console.log( 'Skipping building JavaScript\n' );
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Build SVG.
|
|
113
|
+
if (
|
|
114
|
+
1 === cliArgs.length
|
|
115
|
+
|| cliArgs.includes( '--svg' )
|
|
116
|
+
) {
|
|
117
|
+
console.log( 'Building SVG assets\n\n' );
|
|
118
|
+
shell.exec( `${binPath} build-icons` );
|
|
119
|
+
shell.exec( "npx svgo -f src/svg -o build/svg" );
|
|
120
|
+
} else {
|
|
121
|
+
console.log( 'Skipping building the SVGs\n' );
|
|
122
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const path = require( 'path' );
|
|
2
|
+
|
|
3
|
+
const spawnScript = require( '../lib/utils/spawnScript' );
|
|
4
|
+
|
|
5
|
+
const scriptLocation = path.join( __dirname, '../lib/start.js' );
|
|
6
|
+
|
|
7
|
+
const args = [
|
|
8
|
+
scriptLocation
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
spawnScript( './node_modules/.bin/nodemon', args );
|
package/scripts/start.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Start the Larva server.
|
|
3
|
+
*
|
|
4
|
+
* ## OPTIONS
|
|
5
|
+
*
|
|
6
|
+
* [--help]
|
|
7
|
+
* : Display usage and examples for this command.
|
|
8
|
+
*
|
|
9
|
+
* ## EXAMPLES
|
|
10
|
+
*
|
|
11
|
+
* # Start server.
|
|
12
|
+
* $ npx @penskemediacorp/larva start
|
|
13
|
+
*
|
|
14
|
+
* # Help command.
|
|
15
|
+
* $ npx @penskemediacorp/larva start --help
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
// Dependencies.
|
|
19
|
+
const path = require( 'path' );
|
|
20
|
+
const shell = require( 'shelljs' );
|
|
21
|
+
|
|
22
|
+
// CLI arguments.
|
|
23
|
+
const getArgsFromCli = require( '../lib/utils/getArgsFromCli' );
|
|
24
|
+
const cliArgs = getArgsFromCli();
|
|
25
|
+
|
|
26
|
+
// Handle help command.
|
|
27
|
+
if ( cliArgs.includes( '--help' ) ) {
|
|
28
|
+
shell.exec( `npx @penskemediacorp/larva help start` );
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Construct some paths to point our scripts at.
|
|
33
|
+
const binPath = path.resolve( __dirname, '../bin/larva.js' ); // For sibling scripts.
|
|
34
|
+
const patternsPath = path.resolve( process.cwd(), './src/patterns' ); // Relative path to the patterns.
|
|
35
|
+
|
|
36
|
+
shell.exec( `${binPath} server --watch ${patternsPath} -e twig,html,js` );
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lint JavaScript and CSS files in a Larva project.
|
|
3
|
+
*
|
|
4
|
+
* ## OPTIONS
|
|
5
|
+
*
|
|
6
|
+
* [--help]
|
|
7
|
+
* : Display usage and examples for this command.
|
|
8
|
+
*
|
|
9
|
+
* [--version]
|
|
10
|
+
* : Optional. Version of Larva to install. Defaults to 'latest'.
|
|
11
|
+
*
|
|
12
|
+
* [--skip-css]
|
|
13
|
+
* : Skip building CSS assets.
|
|
14
|
+
*
|
|
15
|
+
* [--skip-js]
|
|
16
|
+
* : Skip building JavaScript assets.
|
|
17
|
+
*
|
|
18
|
+
* [--skip-build]
|
|
19
|
+
* : Skip building any assets.
|
|
20
|
+
*
|
|
21
|
+
* ## EXAMPLES
|
|
22
|
+
*
|
|
23
|
+
* # Upgrade to latest and kickoff a build.
|
|
24
|
+
* $ npx @penskemediacorp/larva upgrade
|
|
25
|
+
*
|
|
26
|
+
* # Skip building CSS assets.
|
|
27
|
+
* $ npx @penskemediacorp/larva upgrade --skip-css
|
|
28
|
+
*
|
|
29
|
+
* # Skip both CSS and JavaScript assets.
|
|
30
|
+
* $ npx @penskemediacorp/larva upgrade --skip-css --skip-js
|
|
31
|
+
*
|
|
32
|
+
* # Skip the entire build.
|
|
33
|
+
* $ npx @penskemediacorp/larva upgrade --skip-build
|
|
34
|
+
*
|
|
35
|
+
* # Upgrade to a specific version
|
|
36
|
+
* $ npx @penskemediacorp/larva upgrade --version=0.6.0
|
|
37
|
+
*
|
|
38
|
+
* # Help command.
|
|
39
|
+
* $ npx @penskemediacorp/larva upgrade --help
|
|
40
|
+
*/
|
|
41
|
+
// Dependencies.
|
|
42
|
+
const path = require( 'path' );
|
|
43
|
+
const shell = require( 'shelljs' );
|
|
44
|
+
|
|
45
|
+
// Construct some paths to point our scripts at.
|
|
46
|
+
const binPath = path.resolve( __dirname, '../bin/larva.js' ); // For sibling scripts.
|
|
47
|
+
|
|
48
|
+
// CLI arguments.
|
|
49
|
+
const getArgsFromCli = require( '../lib/utils/getArgsFromCli' );
|
|
50
|
+
const cliArgs = getArgsFromCli();
|
|
51
|
+
|
|
52
|
+
// Handle help command.
|
|
53
|
+
if ( cliArgs.includes( '--help' ) ) {
|
|
54
|
+
shell.exec( `npx @penskemediacorp/larva help upgrade` );
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Parse the --version flag. Defaults to 'latest'.
|
|
59
|
+
const getVersionArg = () => {
|
|
60
|
+
|
|
61
|
+
// Loop through our args, looking for `--version=`.
|
|
62
|
+
const versionFlag = cliArgs.find( ( cliArg ) => {
|
|
63
|
+
if ( ! cliArg.includes( '--version=' ) ) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
return true;
|
|
67
|
+
} );
|
|
68
|
+
|
|
69
|
+
// Did not find it.
|
|
70
|
+
if ( ! versionFlag ) {
|
|
71
|
+
return 'latest';
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Trip the value down to just the version.
|
|
75
|
+
const version = versionFlag.replace( '--version=', '' );
|
|
76
|
+
return version ? version : 'latest';
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
// Update Larva version installed.
|
|
80
|
+
console.log( `Installing Larva@${getVersionArg()}\n\n` );
|
|
81
|
+
shell.exec( `npm install @penskemediacorp/larva@${getVersionArg()}` );
|
|
82
|
+
|
|
83
|
+
// Build CSS.
|
|
84
|
+
if (
|
|
85
|
+
! cliArgs.includes( '--skip-css' )
|
|
86
|
+
|| cliArgs.includes( '--skip-build' )
|
|
87
|
+
) {
|
|
88
|
+
console.log( 'Building CSS assets\n\n' );
|
|
89
|
+
shell.exec( `${binPath} prod-scss` );
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Build JavaScript.
|
|
93
|
+
if (
|
|
94
|
+
! cliArgs.includes( '--skip-js' )
|
|
95
|
+
|| cliArgs.includes( '--skip-build' )
|
|
96
|
+
) {
|
|
97
|
+
console.log( 'Building JavaScript assets\n\n' );
|
|
98
|
+
shell.exec( `${binPath} prod-js` );
|
|
99
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const chalk = require( 'chalk' );
|
|
2
|
+
|
|
3
|
+
const getAppConfiguration = require( '../lib/utils/getAppConfiguration' );
|
|
4
|
+
const getArgsFromCli = require( '../lib/utils/getArgsFromCli' );
|
|
5
|
+
const writeJson = require( '../lib/writeJson' );
|
|
6
|
+
|
|
7
|
+
const config = getAppConfiguration( 'patterns' );
|
|
8
|
+
const cliArgs = getArgsFromCli();
|
|
9
|
+
|
|
10
|
+
let fromLarva = 'larva' === cliArgs[1] ? true : false;
|
|
11
|
+
|
|
12
|
+
console.log( chalk.bold( `\n---- ${cliArgs[1] || 'Project'} JSON ----\n` ) );
|
|
13
|
+
|
|
14
|
+
writeJson( config, fromLarva );
|
package/.DS_Store
DELETED
|
Binary file
|
package/__tests__/larva.test.js
DELETED
package/lib/larva.js
DELETED
package/lib/patterns.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
const { TwingEnvironment, TwingLoaderFilesystem, TwingLoaderArray, TwingLoaderChain } = require('twing');
|
|
2
|
-
const path = require( 'path' );
|
|
3
|
-
const fs = require( 'fs' );
|
|
4
|
-
const app = require('express')();
|
|
5
|
-
const port = process.env.NODE_PORT || 3000;
|
|
6
|
-
|
|
7
|
-
// Could do something like this to trim down pathing:
|
|
8
|
-
// function larva( patternName ) {
|
|
9
|
-
// let patternDir = 'modules';
|
|
10
|
-
|
|
11
|
-
// if ( 'o-' === patternName.substring( 0, 2 ) ) {
|
|
12
|
-
// patternDir = 'objects';
|
|
13
|
-
// }
|
|
14
|
-
|
|
15
|
-
// if ( 'c-' === patternName.substring( 0, 2 ) ) {
|
|
16
|
-
// patternDir = 'components';
|
|
17
|
-
// }
|
|
18
|
-
|
|
19
|
-
// return fs.readFileSync( path.resolve( __dirname, '../src/' + patternDir + '/' + patternName + '/' + patternName +'.twig'), 'utf8' );
|
|
20
|
-
// }
|
|
21
|
-
|
|
22
|
-
// let loader1 = new TwingLoaderArray({
|
|
23
|
-
// '@larva/o-tease-list.twig': larva( 'o-tease-list' ),
|
|
24
|
-
// '@larva/o-tease.twig': larva( 'o-tease' ),
|
|
25
|
-
// '@larva/c-title.twig': larva( 'c-title' ),
|
|
26
|
-
// '@larva/c-figure.twig': larva( 'c-figure' ),
|
|
27
|
-
// });
|
|
28
|
-
|
|
29
|
-
let loader = new TwingLoaderFilesystem( path.resolve( __dirname, '../node_modules/' ) );
|
|
30
|
-
|
|
31
|
-
loader.addPath( path.resolve( __dirname, '../src/' ), 'larva');
|
|
32
|
-
|
|
33
|
-
let twing = new TwingEnvironment( loader );
|
|
34
|
-
|
|
35
|
-
app.get( '/', function (req, res) {
|
|
36
|
-
res.end( twing.render( 'index.twig', { data: data, 'pattern': 'Welcome' } ) );
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
app.get( '/:type/:name', function (req, res) {
|
|
40
|
-
|
|
41
|
-
let data = require( '../src/' + req.params.type + '/' + req.params.name +'/' + req.params.name + '-prototype' );
|
|
42
|
-
req.params[ 'data' ] = data;
|
|
43
|
-
res.end( twing.render( 'index.twig', req.params ) );
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
app.listen(port, () => {
|
|
47
|
-
console.log('Node.js Express server listening on port '+port);
|
|
48
|
-
});
|
package/setup.scss
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@import '01-tools/tools';
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
// Add a label in the bottom right to indicate the current breakpoint.
|
|
2
|
-
@import '../setup.scss';
|
|
3
|
-
|
|
4
|
-
body::after {
|
|
5
|
-
position: fixed;
|
|
6
|
-
bottom: 0;
|
|
7
|
-
right: 0;
|
|
8
|
-
padding: 1rem 2rem;
|
|
9
|
-
background-color: navy;
|
|
10
|
-
color: lemonchiffon;
|
|
11
|
-
font-family: sans-serif;
|
|
12
|
-
content: 'between mobile and tablet';
|
|
13
|
-
|
|
14
|
-
@media( max-width: $pmc-screen-mobile ) {
|
|
15
|
-
content: 'mobile-max';
|
|
16
|
-
background-color: dodgerblue;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
@media( min-width: $pmc-screen-tablet ) {
|
|
20
|
-
content: 'tablet';
|
|
21
|
-
background-color: coral;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
@media( min-width: $pmc-screen-desktop ) {
|
|
25
|
-
content: 'desktop';
|
|
26
|
-
background-color: rebeccapurple;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
@media( min-width: $pmc-screen-desktop-xl ) {
|
|
30
|
-
content: 'desktop-xl';
|
|
31
|
-
background-color: orangered;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
// Glue
|
|
2
|
-
//
|
|
3
|
-
// This is a handy utility for positioning one element over another when no
|
|
4
|
-
// media queries are necessary (though it could be adapted to use media queries
|
|
5
|
-
// with @breakpoint suffixes. Read more here: https://notlaura.com/u-glue/
|
|
6
|
-
//
|
|
7
|
-
// Usage notes
|
|
8
|
-
// 1. Apply `a-glue-parent` to the parent element of the glued item.
|
|
9
|
-
// 2. Apply `a-glue` to the item to glue.
|
|
10
|
-
// 3. Apply a modifier of `a-glue--tr-0`, `a-glue--b-100p`, etc. to position the glued item. These modifiers do not need to be in breakpoints, unless the glued item is positioned relatively below the breakpoint (which is not the browser default). They should follow the same naming as u-margin and u-padding classes.
|
|
11
|
-
//
|
|
12
|
-
// .a-glue--tr-0 - Glue an item to the top right.
|
|
13
|
-
// .a-glue--t-100p - Glue an item at 100% of it's parent's height.
|
|
14
|
-
//
|
|
15
|
-
// Markup: a-glue.html
|
|
16
|
-
//
|
|
17
|
-
// Style Guide: Algorithms.Glue
|
|
18
|
-
|
|
19
|
-
@import '~@setup';
|
|
20
|
-
|
|
21
|
-
@mixin _pmc-a-glue-base {
|
|
22
|
-
position: absolute;
|
|
23
|
-
z-index: $z-index-middle-bottom;
|
|
24
|
-
top: var( --a-glue-top, initial );
|
|
25
|
-
bottom: var( --a-glue-bottom, initial );
|
|
26
|
-
right: var( --a-glue-right, initial );
|
|
27
|
-
left: var( --a-glue-left, initial );
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.pmc-a-glue-parent {
|
|
31
|
-
position: relative;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.pmc-a-glue {
|
|
35
|
-
// Fallback is top left for everything.
|
|
36
|
-
top: 0;
|
|
37
|
-
left: 0;
|
|
38
|
-
|
|
39
|
-
@include _pmc-a-glue-base;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.pmc-a-glue--l-0 {
|
|
43
|
-
--a-glue-left: 0;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.pmc-a-glue--r-0 {
|
|
47
|
-
--a-glue-right: 0;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.pmc-a-glue--t-0 {
|
|
51
|
-
--a-glue-top: 0;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.pmc-a-glue--b-0 {
|
|
55
|
-
--a-glue-bottom: 0;
|
|
56
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import './a-glue.scss';
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
@import '../setup';
|
|
2
|
-
|
|
3
|
-
.pmc-a-grid {
|
|
4
|
-
display: flex;
|
|
5
|
-
flex-wrap: wrap;
|
|
6
|
-
align-items: start;
|
|
7
|
-
|
|
8
|
-
@supports ( display: grid ) {
|
|
9
|
-
--cols: 1;
|
|
10
|
-
|
|
11
|
-
display: grid;
|
|
12
|
-
grid-gap: 1.25rem;
|
|
13
|
-
grid-template-columns: repeat( var( --cols ), minmax( 0, 1fr ) );
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.pmc-a-grid-item {
|
|
18
|
-
// Remove flex charactaristics to honor flex-basis value.
|
|
19
|
-
flex: none;
|
|
20
|
-
padding: 0.625rem;
|
|
21
|
-
|
|
22
|
-
@supports ( display: grid ) {
|
|
23
|
-
padding: 0;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
@mixin pmc-a-grid( $grids ) {
|
|
28
|
-
@include _grid-class-generator( $grids );
|
|
29
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
// Flex
|
|
2
|
-
//
|
|
3
|
-
// Utility patterns can be either atomic utilities (single classes applying properties and values)
|
|
4
|
-
// or more fully-featured utilities such as the `u-grid` or `u-bg-dots` that provide a means of
|
|
5
|
-
// grouping related declarations and applying variations.
|
|
6
|
-
//
|
|
7
|
-
// **Naming:** `.u-flex-[property]-[value]`
|
|
8
|
-
//
|
|
9
|
-
// .pmc-u-flex - Display flex.
|
|
10
|
-
// .pmc-u-flex-direction-column - Flex direction column.
|
|
11
|
-
// .pmc-u-flex-justify-content-center - Justify content center.
|
|
12
|
-
// .pmc-u-flex-align-items-start - Align items start.
|
|
13
|
-
// .pmc-u-flex-order-n1 - Order -1.
|
|
14
|
-
//
|
|
15
|
-
// Style guide: Utilities.Flex
|
|
16
|
-
|
|
17
|
-
.pmc-u-flex {
|
|
18
|
-
display: flex;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.pmc-u-flex-direction-column {
|
|
22
|
-
flex-direction: column;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.pmc-u-flex-justify-content-center {
|
|
26
|
-
justify-content: center;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.pmc-u-flex-align-items-start {
|
|
30
|
-
align-items: flex-start;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.pmc-u-flex-wrap-wrap {
|
|
34
|
-
flex-wrap: wrap;
|
|
35
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
@import '../setup';
|
|
2
|
-
|
|
3
|
-
.pmc-u-text-transform-uppercase {
|
|
4
|
-
text-transform: uppercase;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.pmc-u-text-align-center {
|
|
8
|
-
text-align: center;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.pmc-u-text-align-right {
|
|
12
|
-
text-align: right;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.pmc-u-text-align-left {
|
|
16
|
-
text-align: left;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
@mixin pmc-u-font-family( $tokens, $available_tokens ) {
|
|
20
|
-
@include _text-class-generator('font-family', $tokens, $available_tokens);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
@mixin pmc-u-line-height( $tokens, $available_tokens ) {
|
|
24
|
-
@include _text-class-generator('line-height', $tokens, $available_tokens);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
@mixin pmc-u-font-size( $tokens ) {
|
|
28
|
-
@include _text-class-generator('font-size', $tokens);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
@mixin pmc-u-font-weight( $tokens, $available_tokens ) {
|
|
32
|
-
@include _text-class-generator('font-weight', $tokens, $available_tokens);
|
|
33
|
-
}
|
package/static/css/objects.css
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
.o-nav__list {
|
|
2
|
-
list-style-type: none;
|
|
3
|
-
padding-left: 0;
|
|
4
|
-
margin-top: 0;
|
|
5
|
-
margin-bottom: 0; }
|
|
6
|
-
|
|
7
|
-
.o-nav--flexy .o-nav__list {
|
|
8
|
-
display: flex;
|
|
9
|
-
justify-content: center;
|
|
10
|
-
align-items: center; }
|
|
11
|
-
|
|
12
|
-
.o-nav--horizontal .o-nav__list {
|
|
13
|
-
display: flex;
|
|
14
|
-
align-items: center; }
|
|
15
|
-
|
|
16
|
-
.o-nav--flexy .o-nav__list-item {
|
|
17
|
-
padding-left: 0.5rem;
|
|
18
|
-
padding-right: 0.5rem; }
|
|
19
|
-
|
|
20
|
-
.o-nav--flexy .o-nav__list-item:last-child {
|
|
21
|
-
border-right: 0; }
|