@penskemediacorp/larva 1.2.0-alpha.0 → 1.2.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.
Files changed (236) hide show
  1. package/.eslintignore +6 -0
  2. package/LICENSE +21 -0
  3. package/README.md +119 -4
  4. package/__tests__/fixtures/build/css/common.inline.css +1 -0
  5. package/__tests__/fixtures/build/images/test.png +0 -0
  6. package/__tests__/fixtures/build/js/larva-ui.js +1 -0
  7. package/__tests__/fixtures/build/svg/defs/sprite.svg +1 -0
  8. package/__tests__/fixtures/larva.config.js +43 -0
  9. package/__tests__/fixtures/public/some-library.js +1 -0
  10. package/__tests__/fixtures/src/patterns/__tests__/.gitkeep +0 -0
  11. package/__tests__/fixtures/src/patterns/components/c-nav-link/c-nav-link.featured.aia.js +3 -0
  12. package/__tests__/fixtures/src/patterns/components/c-nav-link/c-nav-link.featured.js +3 -0
  13. package/__tests__/fixtures/src/patterns/components/c-nav-link/c-nav-link.js +1 -0
  14. package/__tests__/fixtures/src/patterns/components/c-nav-link/c-nav-link.json +3 -0
  15. package/__tests__/fixtures/src/patterns/components/c-nav-link/c-nav-link.prototype.js +3 -0
  16. package/__tests__/fixtures/src/patterns/components/c-nav-link/c-nav-link.twig +3 -0
  17. package/__tests__/fixtures/src/patterns/components/c-tagline/c-tagline.prototype.js +3 -0
  18. package/__tests__/fixtures/src/patterns/modules/_also-ignored/_also-ignored.prototype.js +3 -0
  19. package/__tests__/fixtures/src/patterns/modules/_also-ignored/_also-ignored.twig +3 -0
  20. package/__tests__/fixtures/src/patterns/modules/ignore-me/ignore-me.prototype.js +0 -0
  21. package/__tests__/fixtures/src/patterns/modules/ignore-me/ignore-me.twig +0 -0
  22. package/__tests__/fixtures/src/patterns/modules/test-module/test-module.featured.js +3 -0
  23. package/__tests__/fixtures/src/patterns/modules/test-module/test-module.prototype.js +3 -0
  24. package/__tests__/fixtures/src/patterns/modules/test-module/test-module.twig +0 -0
  25. package/__tests__/fixtures/src/patterns/objects/_objects.scss +0 -0
  26. package/__tests__/fixtures/src/patterns/objects/o-crap/o-crap.json +3 -0
  27. package/__tests__/fixtures/src/patterns/objects/o-crap/o-crap.scss +0 -0
  28. package/__tests__/fixtures/src/patterns/objects/o-crap/o-crap.twig +1 -0
  29. package/__tests__/fixtures/src/patterns/objects/o-nav/o-nav.twig +14 -0
  30. package/__tests__/fixtures/src/patterns/one-offs/newswire/newswire.html +1 -0
  31. package/__tests__/fixtures/src/patterns/one-offs/newswire/newswire.prototype.js +3 -0
  32. package/__tests__/fixtures/template-parts/some-template.php +3 -0
  33. package/__tests__/lib/generateStatic.test.js +140 -0
  34. package/__tests__/lib/utils/clonePatternData.test.js +23 -0
  35. package/__tests__/lib/utils/getAllPatternsObj.test.js +45 -0
  36. package/__tests__/lib/utils/getAppConfiguration.test.js +13 -0
  37. package/__tests__/lib/utils/getModuleNamesFromDirectory.test.js +23 -0
  38. package/__tests__/lib/utils/getPatternData.test.js +55 -0
  39. package/__tests__/lib/utils/getPatternPathsToLoad.test.js +13 -0
  40. package/__tests__/lib/utils/getPatternRoutes.test.js +29 -0
  41. package/__tests__/lib/utils/getPatternType.test.js +16 -0
  42. package/__tests__/lib/utils/getPatternVariants.test.js +20 -0
  43. package/__tests__/lib/utils/getPatternsIndexPath.test.js +9 -0
  44. package/__tests__/lib/utils/getSubDirectoryNames.test.js +17 -0
  45. package/__tests__/lib/utils/isCoreTheme.test.js +12 -0
  46. package/__tests__/lib/utils/writeJsonToFile.test.js +29 -0
  47. package/__tests__/lib/writeJson.test.js +83 -0
  48. package/bin/larva.js +25 -0
  49. package/build/css/larva-important.css +1 -0
  50. package/build/css/larva-ui.css +1 -0
  51. package/build/css/larva.css +1 -0
  52. package/build/css/larva.inline-important.css +1 -0
  53. package/build/css/larva.inline.css +1 -0
  54. package/build/css/variety.compat-important.css +1 -0
  55. package/build/css/variety.compat.css +1 -0
  56. package/build/js/common.js +26 -0
  57. package/build/js/larva-ui.js +1 -0
  58. package/build/js/standalone/video-showcase.js +26 -0
  59. package/build/svg/brand-logo-white.svg +1 -0
  60. package/build/svg/brand-logo.svg +1 -0
  61. package/build/svg/defs/sprite.defs.html +852 -0
  62. package/build/svg/defs/sprite.defs.svg +1 -0
  63. package/build/tokens/artinamerica.custom-properties.css +546 -0
  64. package/build/tokens/artinamerica.json +533 -0
  65. package/build/tokens/artinamerica.map.scss +546 -0
  66. package/build/tokens/artinamerica.raw.json +4341 -0
  67. package/build/tokens/artnews.custom-properties.css +550 -0
  68. package/build/tokens/artnews.json +536 -0
  69. package/build/tokens/artnews.map.scss +550 -0
  70. package/build/tokens/artnews.raw.json +4373 -0
  71. package/build/tokens/bbpro.custom-properties.css +96 -0
  72. package/build/tokens/bbpro.json +80 -0
  73. package/build/tokens/bbpro.map.scss +96 -0
  74. package/build/tokens/bbpro.raw.json +789 -0
  75. package/build/tokens/billboard.custom-properties.css +96 -0
  76. package/build/tokens/billboard.json +80 -0
  77. package/build/tokens/billboard.map.scss +96 -0
  78. package/build/tokens/billboard.raw.json +789 -0
  79. package/build/tokens/deadline.custom-properties.css +533 -0
  80. package/build/tokens/deadline.json +517 -0
  81. package/build/tokens/deadline.map.scss +533 -0
  82. package/build/tokens/deadline.raw.json +4204 -0
  83. package/build/tokens/default.custom-properties.css +533 -0
  84. package/build/tokens/default.json +517 -0
  85. package/build/tokens/default.map.scss +533 -0
  86. package/build/tokens/default.raw.json +4204 -0
  87. package/build/tokens/dirt.custom-properties.css +81 -0
  88. package/build/tokens/dirt.json +66 -0
  89. package/build/tokens/dirt.map.scss +81 -0
  90. package/build/tokens/dirt.raw.json +690 -0
  91. package/build/tokens/indiewire.custom-properties.css +536 -0
  92. package/build/tokens/indiewire.json +520 -0
  93. package/build/tokens/indiewire.map.scss +536 -0
  94. package/build/tokens/indiewire.raw.json +4221 -0
  95. package/build/tokens/rivet.custom-properties.css +82 -0
  96. package/build/tokens/rivet.json +68 -0
  97. package/build/tokens/rivet.map.scss +82 -0
  98. package/build/tokens/rivet.raw.json +703 -0
  99. package/build/tokens/robbreport.custom-properties.css +536 -0
  100. package/build/tokens/robbreport.json +518 -0
  101. package/build/tokens/robbreport.map.scss +536 -0
  102. package/build/tokens/robbreport.raw.json +4215 -0
  103. package/build/tokens/rollingstone-2022.custom-properties.css +534 -0
  104. package/build/tokens/rollingstone-2022.json +519 -0
  105. package/build/tokens/rollingstone-2022.map.scss +534 -0
  106. package/build/tokens/rollingstone-2022.raw.json +4035 -0
  107. package/build/tokens/rollingstone.custom-properties.css +530 -0
  108. package/build/tokens/rollingstone.json +518 -0
  109. package/build/tokens/rollingstone.map.scss +530 -0
  110. package/build/tokens/rollingstone.raw.json +4207 -0
  111. package/build/tokens/sheknows.custom-properties.css +92 -0
  112. package/build/tokens/sheknows.json +76 -0
  113. package/build/tokens/sheknows.map.scss +92 -0
  114. package/build/tokens/sheknows.raw.json +761 -0
  115. package/build/tokens/sourcingjournal.custom-properties.css +87 -0
  116. package/build/tokens/sourcingjournal.json +70 -0
  117. package/build/tokens/sourcingjournal.map.scss +87 -0
  118. package/build/tokens/sourcingjournal.raw.json +720 -0
  119. package/build/tokens/sportico.custom-properties.css +73 -0
  120. package/build/tokens/sportico.json +59 -0
  121. package/build/tokens/sportico.map.scss +73 -0
  122. package/build/tokens/sportico.raw.json +640 -0
  123. package/build/tokens/thr.custom-properties.css +83 -0
  124. package/build/tokens/thr.json +67 -0
  125. package/build/tokens/thr.map.scss +83 -0
  126. package/build/tokens/thr.raw.json +698 -0
  127. package/build/tokens/variety-compat.custom-properties.css +36 -0
  128. package/build/tokens/variety-compat.json +33 -0
  129. package/build/tokens/variety-compat.map.scss +36 -0
  130. package/build/tokens/variety-compat.raw.json +224 -0
  131. package/build/tokens/variety-vip.custom-properties.css +532 -0
  132. package/build/tokens/variety-vip.json +521 -0
  133. package/build/tokens/variety-vip.map.scss +532 -0
  134. package/build/tokens/variety-vip.raw.json +4223 -0
  135. package/build/tokens/variety.custom-properties.css +534 -0
  136. package/build/tokens/variety.json +521 -0
  137. package/build/tokens/variety.map.scss +534 -0
  138. package/build/tokens/variety.raw.json +4225 -0
  139. package/build/tokens/vibe.custom-properties.css +77 -0
  140. package/build/tokens/vibe.json +63 -0
  141. package/build/tokens/vibe.map.scss +77 -0
  142. package/build/tokens/vibe.raw.json +668 -0
  143. package/build/tokens/wwd-2021.custom-properties.css +82 -0
  144. package/build/tokens/wwd-2021.json +67 -0
  145. package/build/tokens/wwd-2021.map.scss +82 -0
  146. package/build/tokens/wwd-2021.raw.json +701 -0
  147. package/build/tokens/wwd-beauty.custom-properties.css +86 -0
  148. package/build/tokens/wwd-beauty.json +70 -0
  149. package/build/tokens/wwd-beauty.map.scss +86 -0
  150. package/build/tokens/wwd-beauty.raw.json +719 -0
  151. package/build/tokens/wwd-dd.custom-properties.css +18 -0
  152. package/build/tokens/wwd-dd.json +13 -0
  153. package/build/tokens/wwd-dd.map.scss +18 -0
  154. package/build/tokens/wwd-dd.raw.json +90 -0
  155. package/build/tokens/wwd.custom-properties.css +70 -0
  156. package/build/tokens/wwd.json +60 -0
  157. package/build/tokens/wwd.map.scss +70 -0
  158. package/build/tokens/wwd.raw.json +643 -0
  159. package/index.js +7 -0
  160. package/lib/generateStatic.js +133 -0
  161. package/lib/server.js +284 -0
  162. package/lib/start.js +7 -0
  163. package/lib/utils/clonePatternData.js +13 -0
  164. package/lib/utils/copySyncHelper.js +33 -0
  165. package/lib/utils/getAllPatternsObj.js +48 -0
  166. package/lib/utils/getAppConfiguration.js +82 -0
  167. package/lib/utils/getArgsFromCli.js +3 -0
  168. package/lib/utils/getModuleNamesFromDirectory.js +11 -0
  169. package/lib/utils/getPatternData.js +34 -0
  170. package/lib/utils/getPatternPathsToLoad.js +20 -0
  171. package/lib/utils/getPatternRoutes.js +58 -0
  172. package/lib/utils/getPatternType.js +15 -0
  173. package/lib/utils/getPatternVariants.js +24 -0
  174. package/lib/utils/getPatternsIndexPath.js +11 -0
  175. package/lib/utils/getSubDirectoryNames.js +23 -0
  176. package/lib/utils/isCoreTheme.js +8 -0
  177. package/lib/utils/renderSass.js +20 -0
  178. package/lib/utils/spawnScript.js +26 -0
  179. package/lib/utils/writeJsonToFile.js +6 -0
  180. package/lib/writeJson.js +53 -0
  181. package/package.json +72 -5
  182. package/public/webfontloader.js +22 -0
  183. package/scripts/build-html.js +52 -0
  184. package/scripts/build-icons.js +80 -0
  185. package/scripts/build-scss.js +15 -0
  186. package/scripts/config/.eslintrc.json +11 -0
  187. package/scripts/config/gulpfile.js +191 -0
  188. package/scripts/config/stylelint.config.js +5 -0
  189. package/scripts/config/svgo-config.json +67 -0
  190. package/scripts/config/webpack.config.js +95 -0
  191. package/scripts/dev-js.js +13 -0
  192. package/scripts/dev-scss.js +20 -0
  193. package/scripts/help.js +65 -0
  194. package/scripts/init.js +21 -0
  195. package/scripts/larva/.nvmrc +1 -0
  196. package/scripts/larva/README.md +29 -0
  197. package/scripts/larva/larva.config.js +3 -0
  198. package/scripts/larva/src/patterns/README.md +3 -0
  199. package/scripts/larva/src/patterns/base.html +6 -0
  200. package/scripts/larva/src/patterns/components/README.md +3 -0
  201. package/scripts/larva/src/patterns/modules/README.md +3 -0
  202. package/scripts/larva/src/patterns/objects/README.md +3 -0
  203. package/scripts/larva/src/patterns/one-offs/README.md +3 -0
  204. package/scripts/link-all.js +40 -0
  205. package/scripts/lint-js.js +11 -0
  206. package/scripts/lint-scss.js +13 -0
  207. package/scripts/lint.js +73 -0
  208. package/scripts/prod-js.js +12 -0
  209. package/scripts/prod-scss.js +24 -0
  210. package/scripts/prod.js +122 -0
  211. package/scripts/server.js +11 -0
  212. package/scripts/start.js +36 -0
  213. package/scripts/upgrade.js +99 -0
  214. package/scripts/write-json.js +14 -0
  215. package/.DS_Store +0 -0
  216. package/__tests__/larva.test.js +0 -7
  217. package/lib/larva.js +0 -7
  218. package/lib/patterns.js +0 -48
  219. package/setup.scss +0 -1
  220. package/src/02-generic/breakpoint-label.scss +0 -33
  221. package/src/06-algorithms/a-glue/a-glue.html +0 -4
  222. package/src/06-algorithms/a-glue/a-glue.scss +0 -56
  223. package/src/06-algorithms/a-glue/index.js +0 -1
  224. package/src/06-algorithms/a-grid.scss +0 -29
  225. package/src/07-utilities/u-background.scss +0 -5
  226. package/src/07-utilities/u-color.scss +0 -5
  227. package/src/07-utilities/u-crop.scss +0 -5
  228. package/src/07-utilities/u-flex.scss +0 -35
  229. package/src/07-utilities/u-margin.scss +0 -5
  230. package/src/07-utilities/u-padding.scss +0 -5
  231. package/src/07-utilities/u-text.scss +0 -33
  232. package/src/07-utilities/utilities.scss +0 -5
  233. package/static/css/components.css +0 -4
  234. package/static/css/objects.css +0 -21
  235. package/static/css/prism.css +0 -126
  236. 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 );
@@ -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 );
@@ -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
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- const larva = require('@larva/patterns');
4
-
5
- describe('larva', () => {
6
- tests.todo( 'should exist' );
7
- });
package/lib/larva.js DELETED
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = larva;
4
-
5
- function larva() {
6
- // TODO
7
- }
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,4 +0,0 @@
1
- <div class="a-glue-parent">
2
- <img src="http://placehold.it/300x300" alt="">
3
- <p class="a-glue {{ modifier_class }} kss-box">Glued Element</p>
4
- </div>
@@ -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,5 +0,0 @@
1
- @import '../setup';
2
-
3
- @mixin pmc-u-background( $colors, $color_list ) {
4
- @include _color-class-generator( 'background-color', $colors, $color_list );
5
- }
@@ -1,5 +0,0 @@
1
- @import '../setup';
2
-
3
- @mixin pmc-u-color( $colors, $color_list ) {
4
- @include _color-class-generator( 'color', $colors, $color_list );
5
- }
@@ -1,5 +0,0 @@
1
- @import '../setup';
2
-
3
- @mixin pmc-u-crop( $aspect-ratios ) {
4
- @include _crop-class-generator( $aspect-ratios );
5
- }
@@ -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,5 +0,0 @@
1
- @import '../setup';
2
-
3
- @mixin pmc-u-margin( $margins ) {
4
- @include _spacing-class-generator( 'margin', $margins );
5
- }
@@ -1,5 +0,0 @@
1
- @import '../setup';
2
-
3
- @mixin pmc-u-padding( $paddings ) {
4
- @include _spacing-class-generator( 'padding', $paddings );
5
- }
@@ -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
- }
@@ -1,5 +0,0 @@
1
- @import 'u-crop';
2
- @import 'u-flex';
3
- @import 'u-margin';
4
- @import 'u-padding';
5
- @import 'u-text';
@@ -1,4 +0,0 @@
1
- .c-nav-link,
2
- .c-nav-link:hover {
3
- color: currentColor;
4
- text-decoration: none; }
@@ -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; }