@penskemediacorp/larva 1.25.0 → 1.28.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 (82) hide show
  1. package/__tests__/fixtures/larva.config.js +9 -16
  2. package/__tests__/fixtures/src/patterns/components/c-nav-link/c-nav-link.featured.aia.js +2 -2
  3. package/__tests__/fixtures/src/patterns/components/c-nav-link/c-nav-link.featured.js +2 -2
  4. package/__tests__/fixtures/src/patterns/components/c-nav-link/c-nav-link.js +1 -1
  5. package/__tests__/fixtures/src/patterns/components/c-nav-link/c-nav-link.prototype.js +2 -2
  6. package/__tests__/fixtures/src/patterns/components/c-tagline/c-tagline.prototype.js +2 -2
  7. package/__tests__/fixtures/src/patterns/modules/_also-ignored/_also-ignored.prototype.js +2 -2
  8. package/__tests__/fixtures/src/patterns/modules/test-module/test-module.featured.js +2 -2
  9. package/__tests__/fixtures/src/patterns/modules/test-module/test-module.prototype.js +2 -2
  10. package/__tests__/fixtures/src/patterns/one-offs/newswire/newswire.prototype.js +2 -2
  11. package/__tests__/lib/generateStatic.test.js +120 -86
  12. package/__tests__/lib/utils/clonePatternData.test.js +17 -10
  13. package/__tests__/lib/utils/getAllPatternsObj.test.js +14 -29
  14. package/__tests__/lib/utils/getAppConfiguration.test.js +5 -5
  15. package/__tests__/lib/utils/getModuleNamesFromDirectory.test.js +29 -10
  16. package/__tests__/lib/utils/getPatternData.test.js +36 -23
  17. package/__tests__/lib/utils/getPatternPathsToLoad.test.js +5 -5
  18. package/__tests__/lib/utils/getPatternRoutes.test.js +4 -6
  19. package/__tests__/lib/utils/getPatternType.test.js +4 -4
  20. package/__tests__/lib/utils/getPatternVariants.test.js +7 -12
  21. package/__tests__/lib/utils/getPatternsIndexPath.test.js +9 -4
  22. package/__tests__/lib/utils/getSubDirectoryNames.test.js +16 -6
  23. package/__tests__/lib/utils/isCoreTheme.test.js +5 -3
  24. package/__tests__/lib/utils/writeJsonToFile.test.js +8 -10
  25. package/__tests__/lib/writeJson.test.js +39 -21
  26. package/bin/larva.js +6 -6
  27. package/build/css/larva-important.css +1 -1
  28. package/build/css/larva.css +1 -1
  29. package/build/css/larva.inline-important.css +1 -1
  30. package/build/css/larva.inline.css +1 -1
  31. package/build/js/standalone/video-showcase.js +7 -7
  32. package/build/svg/defs/sprite.defs.html +1 -1
  33. package/build/tokens/spy-2022.custom-properties.css +1 -0
  34. package/build/tokens/spy-2022.json +521 -0
  35. package/build/tokens/spy-2022.map.scss +536 -0
  36. package/build/tokens/spy-2022.raw.json +4039 -0
  37. package/index.js +1 -1
  38. package/lib/generateStatic.js +67 -63
  39. package/lib/server.js +139 -117
  40. package/lib/start.js +1 -1
  41. package/lib/utils/clonePatternData.js +1 -1
  42. package/lib/utils/copySyncHelper.js +5 -6
  43. package/lib/utils/getAllPatternsObj.js +14 -9
  44. package/lib/utils/getAppConfiguration.js +17 -15
  45. package/lib/utils/getArgsFromCli.js +2 -2
  46. package/lib/utils/getModuleNamesFromDirectory.js +13 -6
  47. package/lib/utils/getPatternData.js +19 -11
  48. package/lib/utils/getPatternPathsToLoad.js +5 -5
  49. package/lib/utils/getPatternRoutes.js +29 -27
  50. package/lib/utils/getPatternType.js +3 -3
  51. package/lib/utils/getPatternVariants.js +5 -6
  52. package/lib/utils/getPatternsIndexPath.js +3 -3
  53. package/lib/utils/getSubDirectoryNames.js +5 -5
  54. package/lib/utils/isCoreTheme.js +1 -2
  55. package/lib/utils/renderSass.js +17 -14
  56. package/lib/utils/spawnScript.js +4 -9
  57. package/lib/utils/writeJsonToFile.js +2 -2
  58. package/lib/writeJson.js +34 -15
  59. package/package.json +15 -12
  60. package/scripts/build-html.js +21 -14
  61. package/scripts/build-icons.js +38 -26
  62. package/scripts/build-scss.js +1 -1
  63. package/scripts/config/.eslintrc.json +2 -1
  64. package/scripts/config/gulpfile.js +0 -1
  65. package/scripts/config/stylelint.config.js +1 -1
  66. package/scripts/config/webpack.config.js +22 -20
  67. package/scripts/dev-js.js +1 -1
  68. package/scripts/dev-scss.js +2 -7
  69. package/scripts/help.js +9 -7
  70. package/scripts/init.js +4 -2
  71. package/scripts/larva/larva.config.js +1 -1
  72. package/scripts/link-all.js +2 -2
  73. package/scripts/lint-js.js +1 -4
  74. package/scripts/lint-scss.js +5 -7
  75. package/scripts/lint.js +4 -4
  76. package/scripts/prod-js.js +1 -4
  77. package/scripts/prod-scss.js +5 -2
  78. package/scripts/prod.js +16 -22
  79. package/scripts/server.js +1 -3
  80. package/scripts/start.js +3 -3
  81. package/scripts/upgrade.js +10 -14
  82. package/scripts/write-json.js +4 -2
@@ -9,14 +9,17 @@ const getAllPatternsObj = require( '../lib/utils/getAllPatternsObj' );
9
9
 
10
10
  const config = getAppConfiguration( 'patterns' );
11
11
  const cliArgs = getArgsFromCli();
12
- const source = 'larva' === cliArgs[1] ? 'larva' : 'project';
13
- const port = process.env.NODE_PORT || '3000' ;
12
+ const source = 'larva' === cliArgs[ 1 ] ? 'larva' : 'project';
13
+ const port = process.env.NODE_PORT || '3000';
14
14
 
15
15
  const urlBase = 'http://localhost:' + port + '/' + source;
16
16
  const buildPath = path.join( process.cwd(), './build/html/' + source );
17
17
 
18
18
  const patternsObj = ( () => {
19
- const patternDir = 'larva' === source ? config.larvaPatternsDir : config.projectPatternsDir;
19
+ const patternDir =
20
+ 'larva' === source
21
+ ? config.larvaPatternsDir
22
+ : config.projectPatternsDir;
20
23
  return getAllPatternsObj( patternDir );
21
24
  } )();
22
25
 
@@ -32,7 +35,7 @@ const staticPaths = [
32
35
  '',
33
36
  ];
34
37
 
35
- staticPaths.forEach( p => {
38
+ staticPaths.forEach( ( p ) => {
36
39
  // Only build these paths for the larva source.
37
40
  if ( p === 'style-guide' || p === 'css' ) {
38
41
  if ( 'larva' !== source ) {
@@ -40,13 +43,17 @@ staticPaths.forEach( p => {
40
43
  }
41
44
  }
42
45
 
43
- routesArr.push( p )
44
- });
45
-
46
- generateStatic( routesArr, buildPath, ( message ) => {
47
-
48
- // TODO: copy assets into build path
49
- // copy assets from larva package to static
50
- // copy assets from project to assets
51
- console.log( message );
52
- }, urlBase );
46
+ routesArr.push( p );
47
+ } );
48
+
49
+ generateStatic(
50
+ routesArr,
51
+ buildPath,
52
+ ( message ) => {
53
+ // TODO: copy assets into build path
54
+ // copy assets from larva package to static
55
+ // copy assets from project to assets
56
+ console.log( message );
57
+ },
58
+ urlBase
59
+ );
@@ -1,14 +1,17 @@
1
1
  'use strict';
2
2
 
3
- const SVGSpriter = require('svg-sprite');
4
- const path = require('path');
5
- const mkdirp = require('mkdirp');
6
- const globby = require('globby');
7
- const fs = require('fs');
3
+ const SVGSpriter = require( 'svg-sprite' );
4
+ const path = require( 'path' );
5
+ const mkdirp = require( 'mkdirp' );
6
+ const globby = require( 'globby' );
7
+ const fs = require( 'fs' );
8
8
  const svgoConfig = require( './config/svgo-config.json' );
9
9
 
10
10
  const projectIconsPath = path.join( process.cwd(), './src/svg/icons' );
11
- const larvaIconsPath = path.join( process.cwd(), './node_modules/@penskemediacorp/larva-svg/src' );
11
+ const larvaIconsPath = path.join(
12
+ process.cwd(),
13
+ './node_modules/@penskemediacorp/larva-svg/src'
14
+ );
12
15
 
13
16
  // TODO: unfinished feature
14
17
  // const getSassVarsString = require( './lib/getSassVarsString' );
@@ -19,20 +22,20 @@ const config = {
19
22
  mode: {
20
23
  defs: {
21
24
  example: true,
22
- sprite: 'sprite.defs.svg'
23
- }
25
+ sprite: 'sprite.defs.svg',
26
+ },
24
27
  },
25
28
  shape: {
26
29
  id: {
27
30
  separator: '',
28
31
  },
29
32
  transform: {
30
- svgo: svgoConfig
31
- }
33
+ svgo: svgoConfig,
34
+ },
32
35
  },
33
36
  svg: {
34
37
  dimensionAttributes: false,
35
- }
38
+ },
36
39
  };
37
40
 
38
41
  const spriter = new SVGSpriter( config );
@@ -40,21 +43,30 @@ const spriter = new SVGSpriter( config );
40
43
  const svgFiles = globby.sync( [ larvaIconsPath, projectIconsPath ], {
41
44
  expandDirectories: {
42
45
  extensions: [ 'svg' ],
43
- }
44
- });
46
+ },
47
+ } );
45
48
 
46
49
  // TODO: unfinished feature
47
50
  // let scssIcons = {};
48
51
 
49
- console.log( `Looking for icon SVGs in ${path.relative( process.cwd(), larvaIconsPath )} and ${path.relative( process.cwd(), projectIconsPath )}...` );
52
+ console.log(
53
+ `Looking for icon SVGs in ${ path.relative(
54
+ process.cwd(),
55
+ larvaIconsPath
56
+ ) } and ${ path.relative( process.cwd(), projectIconsPath ) }...`
57
+ );
50
58
 
51
- svgFiles.forEach( file => {
59
+ svgFiles.forEach( ( file ) => {
52
60
  // TODO: unfinished feature.
53
61
  // Build Sass vars object
54
62
  // scssIcons[ path.basename( file, '.svg' ) ] = fs.readFileSync( file, { encoding: 'utf-8' } );
55
63
 
56
- spriter.add( file, path.basename( file ), fs.readFileSync( file, { encoding: 'utf-8' } ) );
57
- });
64
+ spriter.add(
65
+ file,
66
+ path.basename( file ),
67
+ fs.readFileSync( file, { encoding: 'utf-8' } )
68
+ );
69
+ } );
58
70
 
59
71
  console.log( 'Building SVG icon sprite...' );
60
72
 
@@ -63,18 +75,18 @@ console.log( 'Building SVG icon sprite...' );
63
75
  // fs.writeFileSync( path.join( process.cwd(), './build/a-icon-svg.scss' ), getSassVarsString( scssIcons ) );
64
76
 
65
77
  // Compile the sprite
66
- spriter.compile( function( error, result, cssData ) {
67
-
78
+ spriter.compile( function ( error, result, cssData ) {
68
79
  // Run through all configured output modes
69
- for ( var mode in result ) {
70
-
80
+ for ( const mode in result ) {
71
81
  // Run through all created resources and write them to disk
72
- for ( var type in result[mode] ) {
73
- mkdirp.sync( path.dirname( result[mode][type].path ) );
74
- fs.writeFileSync( result[mode][type].path, result[mode][type].contents );
82
+ for ( const type in result[ mode ] ) {
83
+ mkdirp.sync( path.dirname( result[ mode ][ type ].path ) );
84
+ fs.writeFileSync(
85
+ result[ mode ][ type ].path,
86
+ result[ mode ][ type ].contents
87
+ );
75
88
  }
76
-
77
89
  }
78
90
 
79
91
  console.log( 'Completed building SVG icon sprite.' );
80
- });
92
+ } );
@@ -9,7 +9,7 @@ const args = [
9
9
  '--gulpfile',
10
10
  gulpfilePath,
11
11
  '--cwd',
12
- process.cwd()
12
+ process.cwd(),
13
13
  ];
14
14
 
15
15
  spawnScript( './node_modules/.bin/gulp', args );
@@ -7,5 +7,6 @@
7
7
  "rules": {
8
8
  "import/no-unresolved": "off"
9
9
  }
10
- } ]
10
+ } ],
11
+ "root": true
11
12
  }
@@ -65,7 +65,6 @@ const buildScss = (
65
65
  minify = false,
66
66
  generateImportantVariants = false
67
67
  ) => {
68
-
69
68
  if ( minify ) {
70
69
  sassOpts.outputStyle = 'compressed';
71
70
  }
@@ -1,5 +1,5 @@
1
1
  const rules = {
2
- 'extends': '@penskemediacorp/stylelint-config'
2
+ extends: '@penskemediacorp/stylelint-config',
3
3
  };
4
4
 
5
5
  module.exports = rules;
@@ -1,5 +1,5 @@
1
1
  const path = require( 'path' );
2
- const ESLintPlugin = require('eslint-webpack-plugin');
2
+ const ESLintPlugin = require( 'eslint-webpack-plugin' );
3
3
 
4
4
  const getConfig = require( '../../index' ).getConfig;
5
5
 
@@ -11,21 +11,20 @@ const entries = getConfig( 'webpack' ).entries;
11
11
  const aliases = {
12
12
  '@larva-js': path.resolve( './node_modules/@penskemediacorp/larva-js/src' ),
13
13
  '@npm': path.resolve( './node_modules/' ),
14
- ... getConfig( 'webpack' ).aliases
14
+ ...getConfig( 'webpack' ).aliases,
15
15
  };
16
16
 
17
17
  const eslintConfig = getConfig( 'eslint', true );
18
- const eslintConfigFile = undefined !== eslintConfig ? eslintConfig.configFile : null;
18
+ const eslintConfigFile =
19
+ undefined !== eslintConfig ? eslintConfig.configFile : null;
19
20
 
20
21
  // Tools
21
22
  const { CleanWebpackPlugin } = require( 'clean-webpack-plugin' );
22
23
 
23
-
24
24
  //=========================================================
25
25
  // Rules
26
26
  //---------------------------------------------------------
27
27
  const rules = {
28
-
29
28
  /**
30
29
  * JS Loaders
31
30
  */
@@ -40,16 +39,16 @@ const rules = {
40
39
  exclude: /(node_modules|nobundle|vendor)/,
41
40
  loader: 'babel-loader',
42
41
  query: {
43
- presets: [ '@babel/preset-env' ]
44
- }
45
- }
42
+ presets: [ '@babel/preset-env' ],
43
+ },
44
+ },
46
45
  };
47
46
 
48
47
  const plugins = {
49
48
  cleanup: new CleanWebpackPlugin(),
50
- eslint: new ESLintPlugin({
51
- overrideConfigFile: eslintConfigFile
52
- })
49
+ eslint: new ESLintPlugin( {
50
+ overrideConfigFile: eslintConfigFile,
51
+ } ),
53
52
  };
54
53
 
55
54
  //=========================================================
@@ -59,35 +58,38 @@ const config = {
59
58
  entry: entries,
60
59
  output: {
61
60
  path: BUILD_DIR,
62
- filename: '[name].js'
61
+ filename: '[name].js',
63
62
  },
64
63
  module: {
65
- rules: [ rules.js ]
64
+ rules: [ rules.js ],
66
65
  },
67
66
  watch: false,
68
67
  watchOptions: {
69
- ignored: /node_modules/
68
+ ignored: /node_modules/,
70
69
  },
71
70
  resolve: {
72
- alias: aliases
71
+ alias: aliases,
73
72
  },
74
73
  optimization: {
75
- minimize: true
76
- }
74
+ minimize: true,
75
+ },
77
76
  };
78
77
 
79
78
  module.exports = ( env, argv ) => {
80
-
81
79
  if ( 'development' === argv.mode ) {
82
80
  config.devtool = 'source-map';
83
- config.module.rules = ( config.module.rules || [] ).concat( [ rules.pre ] );
81
+ config.module.rules = ( config.module.rules || [] ).concat( [
82
+ rules.pre,
83
+ ] );
84
84
  config.plugins = [ plugins.eslint ];
85
85
  }
86
86
 
87
87
  if ( 'production' === argv.mode ) {
88
88
  console.log( 'Building Prod JS..' );
89
89
 
90
- config.module.rules = ( config.module.rules || [] ).concat( [ rules.pre ] );
90
+ config.module.rules = ( config.module.rules || [] ).concat( [
91
+ rules.pre,
92
+ ] );
91
93
  config.plugins = [ plugins.eslint, plugins.cleanup ];
92
94
  }
93
95
 
package/scripts/dev-js.js CHANGED
@@ -7,7 +7,7 @@ const configPath = path.join( __dirname, './config/webpack.config.js' );
7
7
  const args = [
8
8
  `--config=${ configPath }`,
9
9
  '--mode=development',
10
- '--watch=true'
10
+ '--watch=true',
11
11
  ];
12
12
 
13
13
  spawnScript( './node_modules/.bin/webpack', args );
@@ -10,11 +10,6 @@ const gulpfilePath = path.join( __dirname, './config/gulpfile.js' );
10
10
 
11
11
  spawn.sync(
12
12
  './node_modules/.bin/gulp',
13
- [
14
- '--gulpfile',
15
- gulpfilePath,
16
- '--cwd',
17
- process.cwd(),
18
- ... cliArgs
19
- ], { stdio: 'inherit' }
13
+ [ '--gulpfile', gulpfilePath, '--cwd', process.cwd(), ...cliArgs ],
14
+ { stdio: 'inherit' }
20
15
  );
package/scripts/help.js CHANGED
@@ -16,7 +16,7 @@
16
16
  */
17
17
 
18
18
  // Dependencies.
19
- const fs = require('fs');
19
+ const fs = require( 'fs' );
20
20
  const path = require( 'path' );
21
21
  const shell = require( 'shelljs' );
22
22
 
@@ -36,19 +36,21 @@ const allowedCommands = [
36
36
  // Display a generic help description.
37
37
  if ( 2 !== cliArgs.length ) {
38
38
  console.log( 'Usage: npx @penskemediacorp/larval <command> [--help]\n' );
39
- console.log( `Where <command> is one of ${allowedCommands.join( ', ' )}.\n` );
39
+ console.log(
40
+ `Where <command> is one of ${ allowedCommands.join( ', ' ) }.\n`
41
+ );
40
42
  return;
41
43
  }
42
44
 
43
45
  // Check for invalid commands.
44
- const command = cliArgs[1];
46
+ const command = cliArgs[ 1 ];
45
47
  if ( ! allowedCommands.includes( command ) ) {
46
- console.log( `Invalid command '${command}'.\n` );
48
+ console.log( `Invalid command '${ command }'.\n` );
47
49
  return;
48
50
  }
49
51
 
50
52
  // Display the docblock for a given command.
51
- const pathToFile = path.resolve( __dirname, `${command}.js` );
53
+ const pathToFile = path.resolve( __dirname, `${ command }.js` );
52
54
  try {
53
55
  if ( fs.existsSync( pathToFile ) ) {
54
56
  fs.readFile( pathToFile, 'utf8', ( error, data ) => {
@@ -57,9 +59,9 @@ try {
57
59
  return;
58
60
  }
59
61
  const fileParts = data.split( '*/', 1 );
60
- console.log( fileParts[0] + '*/' );
62
+ console.log( fileParts[ 0 ] + '*/' );
61
63
  } );
62
64
  }
63
- } catch( error ) {
65
+ } catch ( error ) {
64
66
  console.error( error );
65
67
  }
package/scripts/init.js CHANGED
@@ -8,7 +8,9 @@ const copyTo = process.cwd();
8
8
  copySync( copyFrom, copyTo );
9
9
 
10
10
  console.log(
11
- chalk.green( 'Copied folder structure. Now, add the following scripts to package.json:' )
11
+ chalk.green(
12
+ 'Copied folder structure. Now, add the following scripts to package.json:'
13
+ )
12
14
  );
13
15
 
14
16
  console.log( `
@@ -18,4 +20,4 @@ console.log( `
18
20
  "parser": "./node_modules/.bin/twig-to-php-parser",
19
21
  "update-larva": "npm install @penskemediacorp/larva@latest",
20
22
  "write-json": "larva write-json"
21
- ` );
23
+ ` );
@@ -1,3 +1,3 @@
1
1
  module.exports = {
2
- brand: ''
2
+ brand: '',
3
3
  };
@@ -26,8 +26,8 @@ const cliArgs = getArgsFromCli();
26
26
 
27
27
  // Handle help command.
28
28
  if ( cliArgs.includes( '--help' ) ) {
29
- shell.exec( `npx @penskemediacorp/larva help link-all` );
30
- return;
29
+ shell.exec( `npx @penskemediacorp/larva help link-all` );
30
+ return;
31
31
  }
32
32
 
33
33
  shell.exec( 'npm link @penskemediacorp/larva' );
@@ -3,9 +3,6 @@ const spawnScript = require( '../lib/utils/spawnScript' );
3
3
 
4
4
  const { configFile } = getAppConfiguration( 'eslint' );
5
5
 
6
- const args = [
7
- '--c',
8
- configFile
9
- ];
6
+ const args = [ '--c', configFile ];
10
7
 
11
8
  spawnScript( './node_modules/.bin/eslint', args );
@@ -1,13 +1,11 @@
1
1
  const path = require( 'path' );
2
2
 
3
- const stylelintConfigPath = path.join( __dirname, './config/stylelint.config.js' );
3
+ const stylelintConfigPath = path.join(
4
+ __dirname,
5
+ './config/stylelint.config.js'
6
+ );
4
7
  const spawnScript = require( '../lib/utils/spawnScript' );
5
8
 
6
- const args = [
7
- 'files',
8
- './src/scss',
9
- '--config',
10
- stylelintConfigPath
11
- ];
9
+ const args = [ 'files', './src/scss', '--config', stylelintConfigPath ];
12
10
 
13
11
  spawnScript( './node_modules/.bin/stylelint', args );
package/scripts/lint.js CHANGED
@@ -50,8 +50,8 @@ const cliArgs = getArgsFromCli();
50
50
 
51
51
  // Handle help command.
52
52
  if ( cliArgs.includes( '--help' ) ) {
53
- shell.exec( `npx @penskemediacorp/larva help lint` );
54
- return;
53
+ shell.exec( `npx @penskemediacorp/larva help lint` );
54
+ return;
55
55
  }
56
56
 
57
57
  // Trigger linting when a specific flag is present, or when neither flag is
@@ -64,10 +64,10 @@ const fix = cliArgs.includes( '--fix' ) ? ' fix' : '';
64
64
 
65
65
  if ( lintCSS ) {
66
66
  console.log( 'Linting CSS assets\n\n\n' );
67
- shell.exec( `${binPath} lint-scss${fix}` );
67
+ shell.exec( `${ binPath } lint-scss${ fix }` );
68
68
  }
69
69
 
70
70
  if ( lintJS ) {
71
71
  console.log( 'Linting JavaScript assets\n\n\n' );
72
- shell.exec( `${binPath} lint-js ${workingDirectory}${fix}` );
72
+ shell.exec( `${ binPath } lint-js ${ workingDirectory }${ fix }` );
73
73
  }
@@ -4,9 +4,6 @@ const spawnScript = require( '../lib/utils/spawnScript' );
4
4
 
5
5
  const configPath = path.join( __dirname, './config/webpack.config.js' );
6
6
 
7
- const args = [
8
- `--config=${ configPath }`,
9
- '--mode=production'
10
- ];
7
+ const args = [ `--config=${ configPath }`, '--mode=production' ];
11
8
 
12
9
  spawnScript( './node_modules/.bin/webpack', args );
@@ -6,7 +6,8 @@ const spawnScript = require( '../lib/utils/spawnScript' );
6
6
  const gulpfilePath = path.join( __dirname, './config/gulpfile.js' );
7
7
 
8
8
  const cliArgs = getArgsFromCli();
9
- const generateImportantVariants = '--generate-important-variants' === cliArgs[1];
9
+ const generateImportantVariants =
10
+ '--generate-important-variants' === cliArgs[ 1 ];
10
11
 
11
12
  // Remove our arg so Gulp doesn't complain about an undefined task.
12
13
  if ( generateImportantVariants ) {
@@ -14,7 +15,9 @@ if ( generateImportantVariants ) {
14
15
  }
15
16
 
16
17
  const args = [
17
- generateImportantVariants ? 'prod-scss-with-important-variants' : 'prod-scss',
18
+ generateImportantVariants
19
+ ? 'prod-scss-with-important-variants'
20
+ : 'prod-scss',
18
21
  '--gulpfile',
19
22
  gulpfilePath,
20
23
  '--cwd',
package/scripts/prod.js CHANGED
@@ -64,9 +64,9 @@ if ( cliArgs.includes( '--help' ) ) {
64
64
 
65
65
  // Run the Twig-to-PHP parser.
66
66
  if (
67
- 1 === cliArgs.length
68
- || cliArgs.includes( '--parser' )
69
- || cliArgs.includes( '--parse' )
67
+ 1 === cliArgs.length ||
68
+ cliArgs.includes( '--parser' ) ||
69
+ cliArgs.includes( '--parse' )
70
70
  ) {
71
71
  console.log( 'Parsing Twig templates\n\n' );
72
72
  shell.exec( `npx @penskemediacorp/twig-to-php-parser` );
@@ -76,47 +76,41 @@ if (
76
76
 
77
77
  // Run the write-json script.
78
78
  if (
79
- 1 === cliArgs.length
80
- || cliArgs.includes( '--json' )
81
- || cliArgs.includes( '--write-json' )
79
+ 1 === cliArgs.length ||
80
+ cliArgs.includes( '--json' ) ||
81
+ cliArgs.includes( '--write-json' )
82
82
  ) {
83
83
  console.log( 'Building JSON assets\n\n' );
84
- shell.exec( `${binPath} write-json` );
84
+ shell.exec( `${ binPath } write-json` );
85
85
  } else {
86
86
  console.log( 'Skipping write-json\n' );
87
87
  }
88
88
 
89
89
  // Build CSS/SCSS.
90
90
  if (
91
- 1 === cliArgs.length
92
- || cliArgs.includes( '--css' )
93
- || cliArgs.includes( '--scss' )
91
+ 1 === cliArgs.length ||
92
+ cliArgs.includes( '--css' ) ||
93
+ cliArgs.includes( '--scss' )
94
94
  ) {
95
95
  console.log( 'Building CSS assets\n\n' );
96
- shell.exec( `${binPath} prod-scss` );
96
+ shell.exec( `${ binPath } prod-scss` );
97
97
  } else {
98
98
  console.log( 'Skipping building CSS\n' );
99
99
  }
100
100
 
101
101
  // Build JS.
102
- if (
103
- 1 === cliArgs.length
104
- || cliArgs.includes( '--js' )
105
- ) {
102
+ if ( 1 === cliArgs.length || cliArgs.includes( '--js' ) ) {
106
103
  console.log( 'Building JavaScript assets\n\n' );
107
- shell.exec( `${binPath} prod-js` );
104
+ shell.exec( `${ binPath } prod-js` );
108
105
  } else {
109
106
  console.log( 'Skipping building JavaScript\n' );
110
107
  }
111
108
 
112
109
  // Build SVG.
113
- if (
114
- 1 === cliArgs.length
115
- || cliArgs.includes( '--svg' )
116
- ) {
110
+ if ( 1 === cliArgs.length || cliArgs.includes( '--svg' ) ) {
117
111
  console.log( 'Building SVG assets\n\n' );
118
- shell.exec( `${binPath} build-icons` );
119
- shell.exec( "npx svgo -f src/svg -o build/svg" );
112
+ shell.exec( `${ binPath } build-icons` );
113
+ shell.exec( 'npx svgo -f src/svg -o build/svg' );
120
114
  } else {
121
115
  console.log( 'Skipping building the SVGs\n' );
122
116
  }
package/scripts/server.js CHANGED
@@ -4,8 +4,6 @@ const spawnScript = require( '../lib/utils/spawnScript' );
4
4
 
5
5
  const scriptLocation = path.join( __dirname, '../lib/start.js' );
6
6
 
7
- const args = [
8
- scriptLocation
9
- ];
7
+ const args = [ scriptLocation ];
10
8
 
11
9
  spawnScript( './node_modules/.bin/nodemon', args );
package/scripts/start.js CHANGED
@@ -25,12 +25,12 @@ const cliArgs = getArgsFromCli();
25
25
 
26
26
  // Handle help command.
27
27
  if ( cliArgs.includes( '--help' ) ) {
28
- shell.exec( `npx @penskemediacorp/larva help start` );
29
- return;
28
+ shell.exec( `npx @penskemediacorp/larva help start` );
29
+ return;
30
30
  }
31
31
 
32
32
  // Construct some paths to point our scripts at.
33
33
  const binPath = path.resolve( __dirname, '../bin/larva.js' ); // For sibling scripts.
34
34
  const patternsPath = path.resolve( process.cwd(), './src/patterns' ); // Relative path to the patterns.
35
35
 
36
- shell.exec( `${binPath} server --watch ${patternsPath} -e twig,html,js` );
36
+ shell.exec( `${ binPath } server --watch ${ patternsPath } -e twig,html,js` );
@@ -57,8 +57,7 @@ if ( cliArgs.includes( '--help' ) ) {
57
57
 
58
58
  // Parse the --version flag. Defaults to 'latest'.
59
59
  const getVersionArg = () => {
60
-
61
- // Loop through our args, looking for `--version=`.
60
+ // Loop through our args, looking for `--version=`.
62
61
  const versionFlag = cliArgs.find( ( cliArg ) => {
63
62
  if ( ! cliArg.includes( '--version=' ) ) {
64
63
  return false;
@@ -66,34 +65,31 @@ const getVersionArg = () => {
66
65
  return true;
67
66
  } );
68
67
 
69
- // Did not find it.
68
+ // Did not find it.
70
69
  if ( ! versionFlag ) {
71
70
  return 'latest';
72
71
  }
73
72
 
74
- // Trip the value down to just the version.
73
+ // Trip the value down to just the version.
75
74
  const version = versionFlag.replace( '--version=', '' );
76
75
  return version ? version : 'latest';
77
76
  };
78
77
 
79
78
  // Update Larva version installed.
80
- console.log( `Installing Larva@${getVersionArg()}\n\n` );
81
- shell.exec( `npm install @penskemediacorp/larva@${getVersionArg()}` );
79
+ console.log( `Installing Larva@${ getVersionArg() }\n\n` );
80
+ shell.exec( `npm install @penskemediacorp/larva@${ getVersionArg() }` );
82
81
 
83
82
  // Build CSS.
84
83
  if (
85
- ! cliArgs.includes( '--skip-css' )
86
- || cliArgs.includes( '--skip-build' )
84
+ ! cliArgs.includes( '--skip-css' ) ||
85
+ cliArgs.includes( '--skip-build' )
87
86
  ) {
88
87
  console.log( 'Building CSS assets\n\n' );
89
- shell.exec( `${binPath} prod-scss` );
88
+ shell.exec( `${ binPath } prod-scss` );
90
89
  }
91
90
 
92
91
  // Build JavaScript.
93
- if (
94
- ! cliArgs.includes( '--skip-js' )
95
- || cliArgs.includes( '--skip-build' )
96
- ) {
92
+ if ( ! cliArgs.includes( '--skip-js' ) || cliArgs.includes( '--skip-build' ) ) {
97
93
  console.log( 'Building JavaScript assets\n\n' );
98
- shell.exec( `${binPath} prod-js` );
94
+ shell.exec( `${ binPath } prod-js` );
99
95
  }