@penskemediacorp/larva 1.67.0 → 1.69.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 (48) hide show
  1. package/__tests__/lib/utils/clonePatternData.test.js +12 -8
  2. package/__tests__/lib/utils/getPatternData.test.js +12 -8
  3. package/bin/larva.js +2 -0
  4. package/build/css/larva-important.css +1 -1
  5. package/build/css/larva.css +1 -1
  6. package/build/css/larva.inline-important.css +1 -1
  7. package/build/css/larva.inline.css +1 -1
  8. package/build/js/common.js +2 -159
  9. package/build/js/common.js.LICENSE.txt +28 -0
  10. package/build/js/larva-ui.js +1 -30
  11. package/build/js/standalone/video-showcase.js +1 -1
  12. package/build/tokens/billboard-2025.custom-properties.css +1 -0
  13. package/build/tokens/billboard-2025.json +82 -0
  14. package/build/tokens/billboard-2025.map.scss +92 -0
  15. package/build/tokens/billboard-2025.raw.json +801 -0
  16. package/build/tokens/wwd-fn.custom-properties.css +1 -0
  17. package/build/tokens/wwd-fn.json +67 -0
  18. package/build/tokens/wwd-fn.map.scss +84 -0
  19. package/build/tokens/wwd-fn.raw.json +699 -0
  20. package/lib/generateStatic.js +12 -8
  21. package/lib/server.js +2 -0
  22. package/lib/start.js +1 -0
  23. package/lib/utils/copySyncHelper.js +4 -2
  24. package/lib/utils/getAllPatternsObj.js +3 -0
  25. package/lib/utils/getAppConfiguration.js +2 -1
  26. package/lib/utils/getPatternData.js +9 -8
  27. package/lib/utils/getPatternRoutes.js +1 -0
  28. package/lib/utils/getPatternVariants.js +1 -0
  29. package/lib/utils/getPatternsIndexPath.js +2 -0
  30. package/lib/utils/getSubDirectoryNames.js +4 -2
  31. package/lib/writeJson.js +3 -0
  32. package/package.json +10 -10
  33. package/scripts/build-html.js +1 -0
  34. package/scripts/build-icons.js +4 -1
  35. package/scripts/config/.eslintrc.json +9 -1
  36. package/scripts/config/gulpfile.js +1 -1
  37. package/scripts/config/webpack.config.js +1 -0
  38. package/scripts/help.js +13 -11
  39. package/scripts/init.js +2 -0
  40. package/scripts/link-all.js +1 -2
  41. package/scripts/lint.js +3 -3
  42. package/scripts/prod.js +11 -13
  43. package/scripts/start.js +1 -1
  44. package/scripts/upgrade.js +4 -6
  45. package/scripts/write-json.js +1 -0
  46. package/build/html/static/js/main.6657eddb.js.map +0 -1
  47. package/build/html/static/js/main.941390b6.js.map +0 -1
  48. package/build/html/static/js/main.94574a71.js.map +0 -1
@@ -18,14 +18,12 @@ const themeAssetsConfig = getAppConfiguration( 'themeAssets' );
18
18
  * of each route, and write the content to directory structure that
19
19
  * mirrors the pattern routes.
20
20
  *
21
- * @param {Array} routesArr An array of routes in a pattern server, excluding the pattern source (i.e. larva or project).
22
- * This is the result of getPatternRoutes.
23
- * @param {string} buildPath A directory where the HTML files should be written.
24
- * @param {Function} done A callback function to run when the site generation completes.
25
- * @param {string} urlBase The base URL for the pattern library e.g. 'http://localhost:3001/larva'.
26
- * Pattern routes will be appended to this. Should not end in slash.
27
- *
28
- * @see {@link getPatternRoutes}.
21
+ * @param {Array} routesArr An array of routes in a pattern server, excluding the pattern source (i.e. larva or project).
22
+ * This is the result of getPatternRoutes.
23
+ * @param {string} buildPath A directory where the HTML files should be written.
24
+ * @param {Function} done A callback function to run when the site generation completes.
25
+ * @param {string} urlBase The base URL for the pattern library e.g. 'http://localhost:3001/larva'.
26
+ * Pattern routes will be appended to this. Should not end in slash.
29
27
  */
30
28
 
31
29
  module.exports = function generateStatic(
@@ -40,6 +38,7 @@ module.exports = function generateStatic(
40
38
 
41
39
  // Copy assets from assets/build and assets/public
42
40
  // to the static site build directory.
41
+ // eslint-disable-next-line no-console
43
42
  console.log( '\nCopying assets...\n' );
44
43
 
45
44
  // assets/public dir contains fonts and non-built things.
@@ -78,6 +77,7 @@ module.exports = function generateStatic(
78
77
  // Build the site.
79
78
  // Cycle through the list of routes and write the response
80
79
  // to files.
80
+ // eslint-disable-next-line no-console
81
81
  console.log( '\nBuilding site...\n' );
82
82
 
83
83
  try {
@@ -94,6 +94,7 @@ module.exports = function generateStatic(
94
94
  `${ dir }/index.html`,
95
95
  response.data
96
96
  );
97
+ // eslint-disable-next-line no-console
97
98
  console.log( `Built ${ route }.` );
98
99
  }
99
100
  } )
@@ -104,6 +105,7 @@ module.exports = function generateStatic(
104
105
  mkdirp.sync( dir );
105
106
  fs.writeFileSync( `${ dir }/index.html`, e.message );
106
107
 
108
+ // eslint-disable-next-line no-console
107
109
  console.log(
108
110
  chalk.yellow(
109
111
  `Error writing ${ route }: ${ e.message }.`
@@ -117,6 +119,7 @@ module.exports = function generateStatic(
117
119
  .all( promises )
118
120
  .then( () => {
119
121
  if ( errors.length > 0 ) {
122
+ // eslint-disable-next-line no-console
120
123
  console.log( errors );
121
124
  }
122
125
 
@@ -132,6 +135,7 @@ module.exports = function generateStatic(
132
135
  done( chalk.bold.red( e ) );
133
136
  } );
134
137
  } catch ( e ) {
138
+ // eslint-disable-next-line no-console
135
139
  console.error( e );
136
140
  }
137
141
  };
package/lib/server.js CHANGED
@@ -231,6 +231,7 @@ app.get( '/:source/:type/:name/:variant?', function ( req, res ) {
231
231
  .catch( ( e ) => {
232
232
  const errorMessage = `Cannot render template! \n\n${ e }`;
233
233
 
234
+ // eslint-disable-next-line no-console
234
235
  console.log( e );
235
236
 
236
237
  res.end( errorMessage );
@@ -287,6 +288,7 @@ app.get( '/:source?/style-guide', function ( req, res ) {
287
288
  .catch( ( e ) => {
288
289
  const errorMessage = `Cannot render template! \n\n${ e }`;
289
290
 
291
+ // eslint-disable-next-line no-console
290
292
  console.log( e );
291
293
 
292
294
  res.end( errorMessage );
package/lib/start.js CHANGED
@@ -3,5 +3,6 @@ const app = require( './server' );
3
3
  const port = process.env.NODE_PORT || 3000;
4
4
 
5
5
  app.listen( port, () => {
6
+ // eslint-disable-next-line no-console
6
7
  console.log( 'Larva server is listening on port ' + port );
7
8
  } );
@@ -8,9 +8,8 @@ const chalk = require( 'chalk' );
8
8
  * Wrap the fs.copySync funtion and provide useful logging.
9
9
  * See {@link https://github.com/jprichardson/node-fs-extra/blob/master/docs/copy-sync.md fs.copySync}.
10
10
  *
11
- * @param {string} src Path of directory or file to copy.
11
+ * @param {string} src Path of directory or file to copy.
12
12
  * @param {string} dest Path of destination for copied directory or file.
13
- *
14
13
  */
15
14
 
16
15
  module.exports = function copySyncHelper( src, dest ) {
@@ -19,13 +18,16 @@ module.exports = function copySyncHelper( src, dest ) {
19
18
  try {
20
19
  fs.copySync( src, dest );
21
20
 
21
+ // eslint-disable-next-line no-console
22
22
  console.log( `Copied '${ name }'.` );
23
23
  } catch ( e ) {
24
24
  if ( 'ENOENT' === e.code ) {
25
+ // eslint-disable-next-line no-console
25
26
  console.log(
26
27
  chalk.grey( `Can't find '${ name }' to copy, skipping.` )
27
28
  );
28
29
  } else {
30
+ // eslint-disable-next-line no-console
29
31
  console.error( e );
30
32
  }
31
33
  }
@@ -22,6 +22,7 @@ module.exports = function getAllPatternsObj( startPath ) {
22
22
  const obj = {};
23
23
 
24
24
  try {
25
+ // eslint-disable-next-line array-callback-return
25
26
  patternDirs.map( ( patternType ) => {
26
27
  let patterns = [];
27
28
  obj[ patternType ] = {};
@@ -39,6 +40,7 @@ module.exports = function getAllPatternsObj( startPath ) {
39
40
  );
40
41
  }
41
42
 
43
+ // eslint-disable-next-line array-callback-return
42
44
  patterns.map( ( pattern ) => {
43
45
  obj[ patternType ][ pattern ] = getPatternVariants(
44
46
  path.join( startPath, `${ patternType }/${ pattern }` )
@@ -46,6 +48,7 @@ module.exports = function getAllPatternsObj( startPath ) {
46
48
  } );
47
49
  } );
48
50
  } catch ( e ) {
51
+ // eslint-disable-next-line no-console
49
52
  console.error( e );
50
53
  }
51
54
 
@@ -11,7 +11,7 @@ const path = require( 'path' );
11
11
  * For test env, the CWD is overridden to the local directory for fixtures.
12
12
  * (this is a problem for writing project-level tests, but for a later time.)
13
13
  *
14
- * @param {string} key string that indicates a specific configuration property, e.g. patterns.
14
+ * @param {string} key string that indicates a specific configuration property, e.g. patterns.
15
15
  * @param {boolean} usePackageDefault fall back to package default if not defined in app
16
16
  *
17
17
  * @return value of the specified key.
@@ -77,6 +77,7 @@ module.exports = function getAppConfiguration( key, usePackageDefault = true ) {
77
77
 
78
78
  return config[ key ];
79
79
  } catch ( error ) {
80
+ // eslint-disable-next-line no-console
80
81
  console.warn( 'Using default configuration. ' );
81
82
 
82
83
  return defaultConfig[ key ];
@@ -4,7 +4,7 @@ const path = require( 'path' );
4
4
  * Get Pattern Data
5
5
  *
6
6
  * @param {string} patternsPath
7
- * @param {Object} params Object containing name of pattern
7
+ * @param {Object} params Object containing name of pattern
8
8
  */
9
9
  function getPatternData( patternsPath, params ) {
10
10
  const variant = params.variant || 'prototype';
@@ -14,12 +14,6 @@ function getPatternData( patternsPath, params ) {
14
14
  params.name,
15
15
  params.name + '.' + variant + '.js'
16
16
  );
17
- const jsonPath = path.join(
18
- patternsPath,
19
- params.type,
20
- params.name,
21
- params.name + '.json'
22
- );
23
17
 
24
18
  try {
25
19
  return require( patternPath );
@@ -27,10 +21,17 @@ function getPatternData( patternsPath, params ) {
27
21
  const originalError = e;
28
22
 
29
23
  try {
24
+ const jsonPath = path.join(
25
+ patternsPath,
26
+ params.type,
27
+ params.name,
28
+ params.name + '.json'
29
+ );
30
+
30
31
  // Backwards compat for Deadline when patterns were stored as JSON
31
32
  const patternData = require( jsonPath );
32
33
  return patternData;
33
- } catch ( e ) {
34
+ } catch {
34
35
  return {
35
36
  message: `Error getting data for "${ params.name }".<br>There is likely a problem with ${ params.name }.${ variant }.js.`,
36
37
  error: originalError,
@@ -48,6 +48,7 @@ module.exports = function getPatternRoutes( patterns ) {
48
48
  } )
49
49
  .flat();
50
50
  } catch ( error ) {
51
+ // eslint-disable-next-line no-console
51
52
  console.error(
52
53
  chalk.red(
53
54
  'Could not build the pattern routes. Is the pattern object structure correct?'
@@ -12,6 +12,7 @@ const regex = new RegExp( '(.[^.]+).(.+).js$' );
12
12
 
13
13
  module.exports = function getPatternVariants( startPath ) {
14
14
  // Only return Node prototype files that follow pattern name.XX.js
15
+ // eslint-disable-next-line array-callback-return
15
16
  const files = fs.readdirSync( startPath ).filter( ( file ) => {
16
17
  if ( /.+\..*\.js$/.test( file ) ) {
17
18
  return file;
@@ -1,3 +1,5 @@
1
+ // We may need to fix this later? See comment below.
2
+ // eslint-disable-next-line no-unused-vars
1
3
  const isCoreTheme = require( './isCoreTheme' );
2
4
 
3
5
  module.exports = function getPatternsIndexPath( config ) {
@@ -6,8 +6,8 @@ const fs = require( 'fs' );
6
6
  * @param {string} path path to a directory containing subdirectories.
7
7
  * @return {Array} array of strings representing names of subdirectories.
8
8
  *
9
- * @link: https://stackoverflow.com/questions/18112204/get-all-directories-within-directory-nodejs
10
- **/
9
+ * @see https://stackoverflow.com/questions/18112204/get-all-directories-within-directory-nodejs
10
+ */
11
11
 
12
12
  module.exports = function getSubDirectoryNames( path ) {
13
13
  try {
@@ -15,8 +15,10 @@ module.exports = function getSubDirectoryNames( path ) {
15
15
  if ( 'node_modules' !== file && 'fixtures' !== file ) {
16
16
  return fs.statSync( path + '/' + file ).isDirectory();
17
17
  }
18
+ return true;
18
19
  } );
19
20
  } catch {
21
+ // eslint-disable-next-line no-console
20
22
  console.error( path + " doesn't exist." );
21
23
  }
22
24
  };
package/lib/writeJson.js CHANGED
@@ -52,17 +52,20 @@ module.exports = function writeJson( patternConfig, fromLarva = false ) {
52
52
  hasChanged = false;
53
53
  }
54
54
  } catch ( error ) {
55
+ // eslint-disable-next-line no-console
55
56
  console.warn( error );
56
57
  }
57
58
 
58
59
  if ( hasChanged ) {
59
60
  writeJsonToFile( jsonDestPath, moduleData );
61
+ // eslint-disable-next-line no-console
60
62
  console.log(
61
63
  chalk.green.bold(
62
64
  `Wrote JSON for ${ moduleName }.${ variant }`
63
65
  )
64
66
  );
65
67
  } else {
68
+ // eslint-disable-next-line no-console
66
69
  console.log(
67
70
  chalk.grey( `No updates in ${ moduleName }.${ variant }` )
68
71
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@penskemediacorp/larva",
3
- "version": "1.67.0",
3
+ "version": "1.69.0",
4
4
  "description": "> TODO: description",
5
5
  "author": "laras126 <laras126@gmail.com>",
6
6
  "homepage": "https://github.com/Penske-Media-Corp/pmc-larva/tree/master/packages/larva#readme",
@@ -44,16 +44,16 @@
44
44
  "dependencies": {
45
45
  "@babel/core": "^7",
46
46
  "@babel/preset-env": "^7",
47
- "@penskemediacorp/backstopjs-config": "^1.66.4",
48
- "@penskemediacorp/eslint-config": "^1.66.4",
49
- "@penskemediacorp/larva-css": "^1.66.4",
50
- "@penskemediacorp/larva-js": "^1.66.4",
51
- "@penskemediacorp/larva-patterns": "^1.67.0",
47
+ "@penskemediacorp/backstopjs-config": "^1.69.0",
48
+ "@penskemediacorp/eslint-config": "^1.69.0",
49
+ "@penskemediacorp/larva-css": "^1.69.0",
50
+ "@penskemediacorp/larva-js": "^1.69.0",
51
+ "@penskemediacorp/larva-patterns": "^1.69.0",
52
52
  "@penskemediacorp/larva-scss": "^1.66.4",
53
53
  "@penskemediacorp/larva-svg": "^1.66.4",
54
- "@penskemediacorp/larva-tokens": "^1.66.4",
55
- "@penskemediacorp/stylelint-config": "^1.66.4",
56
- "@penskemediacorp/twig-to-php-parser": "^1.66.4",
54
+ "@penskemediacorp/larva-tokens": "^1.69.0",
55
+ "@penskemediacorp/stylelint-config": "^1.69.0",
56
+ "@penskemediacorp/twig-to-php-parser": "^1.69.0",
57
57
  "axios": "^1",
58
58
  "babel-loader": "^9",
59
59
  "chalk": "^4",
@@ -95,5 +95,5 @@
95
95
  "overrides": {
96
96
  "@wordpress/eslint-plugin": "^17"
97
97
  },
98
- "gitHead": "5016a6408bfa1bccc72babcab32eb9fd8c02ec7f"
98
+ "gitHead": "9655cabc42a4d705c189ea9b65e6d34788a809e9"
99
99
  }
@@ -52,6 +52,7 @@ generateStatic(
52
52
  // TODO: copy assets into build path
53
53
  // copy assets from larva package to static
54
54
  // copy assets from project to assets
55
+ // eslint-disable-next-line no-console
55
56
  console.log( message );
56
57
  },
57
58
  urlBase
@@ -49,6 +49,7 @@ const svgFiles = globby.sync( [ larvaIconsPath, projectIconsPath ], {
49
49
  // TODO: unfinished feature
50
50
  // let scssIcons = {};
51
51
 
52
+ // eslint-disable-next-line no-console
52
53
  console.log(
53
54
  `Looking for icon SVGs in ${ path.relative(
54
55
  process.cwd(),
@@ -68,6 +69,7 @@ svgFiles.forEach( ( file ) => {
68
69
  );
69
70
  } );
70
71
 
72
+ // eslint-disable-next-line no-console
71
73
  console.log( 'Building SVG icon sprite...' );
72
74
 
73
75
  // Write the Sass variables.
@@ -75,7 +77,7 @@ console.log( 'Building SVG icon sprite...' );
75
77
  // fs.writeFileSync( path.join( process.cwd(), './build/a-icon-svg.scss' ), getSassVarsString( scssIcons ) );
76
78
 
77
79
  // Compile the sprite
78
- spriter.compile( function ( error, result, cssData ) {
80
+ spriter.compile( function ( error, result ) {
79
81
  // Run through all configured output modes
80
82
  for ( const mode in result ) {
81
83
  // Run through all created resources and write them to disk
@@ -88,5 +90,6 @@ spriter.compile( function ( error, result, cssData ) {
88
90
  }
89
91
  }
90
92
 
93
+ // eslint-disable-next-line no-console
91
94
  console.log( 'Completed building SVG icon sprite.' );
92
95
  } );
@@ -1,3 +1,4 @@
1
+ // This config applies only to Larva's lint:js command but not other projects that use @penskemediacorp/eslint-config, such as Nova.
1
2
  {
2
3
  "extends": "@penskemediacorp/eslint-config",
3
4
  "overrides": [ {
@@ -5,7 +6,14 @@
5
6
  "**/*.js"
6
7
  ],
7
8
  "rules": {
8
- "import/no-unresolved": "off"
9
+ "import/no-unresolved": "off",
10
+ "import/no-extraneous-dependencies": "off",
11
+ "camelcase": "off"
12
+ },
13
+ "parserOptions": {
14
+ "babelOptions": {
15
+ "presets": ["@babel/preset-react"]
16
+ }
9
17
  }
10
18
  } ],
11
19
  "root": true
@@ -124,7 +124,7 @@ const composeTask = ( done, generateImportantVariants = false ) => {
124
124
  *
125
125
  * @param {Object} style PostCSS Root object for current CSS.
126
126
  * @param {Object} result PostCSS Result object containing transformed CSS.
127
- * @return {Result} PostCSS Result object.
127
+ * @return {Object} PostCSS Result object.
128
128
  */
129
129
  const declareImportanceForAll = ( style, result ) => {
130
130
  const root = postCss.parse( style );
@@ -84,6 +84,7 @@ module.exports = ( env, argv ) => {
84
84
  }
85
85
 
86
86
  if ( 'production' === argv.mode ) {
87
+ // eslint-disable-next-line no-console
87
88
  console.log( 'Building Prod JS..' );
88
89
 
89
90
  config.module.rules = ( config.module.rules || [] ).concat( [
package/scripts/help.js CHANGED
@@ -18,6 +18,7 @@
18
18
  // Dependencies.
19
19
  const fs = require( 'fs' );
20
20
  const path = require( 'path' );
21
+ // eslint-disable-next-line no-unused-vars
21
22
  const shell = require( 'shelljs' );
22
23
 
23
24
  // CLI arguments.
@@ -35,33 +36,34 @@ const allowedCommands = [
35
36
 
36
37
  // Display a generic help description.
37
38
  if ( 2 !== cliArgs.length ) {
38
- console.log( 'Usage: npx @penskemediacorp/larval <command> [--help]\n' );
39
- console.log(
39
+ process.stdout.write(
40
+ 'Usage: npx @penskemediacorp/larval <command> [--help]\n'
41
+ );
42
+ process.stdout.write(
40
43
  `Where <command> is one of ${ allowedCommands.join( ', ' ) }.\n`
41
44
  );
42
- return;
45
+ process.exit( 0 );
43
46
  }
44
-
45
- // Check for invalid commands.
47
+ // Check for invalid commands.const command = cliArgs[ 1 ];
46
48
  const command = cliArgs[ 1 ];
49
+
47
50
  if ( ! allowedCommands.includes( command ) ) {
48
- console.log( `Invalid command '${ command }'.\n` );
49
- return;
51
+ process.stderr.write( `Invalid command '${ command }'.\n` );
52
+ process.exit( 0 );
50
53
  }
51
-
52
54
  // Display the docblock for a given command.
53
55
  const pathToFile = path.resolve( __dirname, `${ command }.js` );
54
56
  try {
55
57
  if ( fs.existsSync( pathToFile ) ) {
56
58
  fs.readFile( pathToFile, 'utf8', ( error, data ) => {
57
59
  if ( error ) {
58
- console.error( error );
60
+ process.stderr.write( error );
59
61
  return;
60
62
  }
61
63
  const fileParts = data.split( '*/', 1 );
62
- console.log( fileParts[ 0 ] + '*/' );
64
+ process.stdout.write( fileParts[ 0 ] + '*/' );
63
65
  } );
64
66
  }
65
67
  } catch ( error ) {
66
- console.error( error );
68
+ process.stderr.write( error );
67
69
  }
package/scripts/init.js CHANGED
@@ -7,12 +7,14 @@ const copyTo = process.cwd();
7
7
 
8
8
  copySync( copyFrom, copyTo );
9
9
 
10
+ // eslint-disable-next-line no-console
10
11
  console.log(
11
12
  chalk.green(
12
13
  'Copied folder structure. Now, add the following scripts to package.json:'
13
14
  )
14
15
  );
15
16
 
17
+ // eslint-disable-next-line no-console
16
18
  console.log( `
17
19
  "backstop": "backstop --config=node_modules/@penskemediacorp/backstopjs-config",
18
20
  "build-html": "larva build-html",
@@ -27,9 +27,8 @@ const cliArgs = getArgsFromCli();
27
27
  // Handle help command.
28
28
  if ( cliArgs.includes( '--help' ) ) {
29
29
  shell.exec( `npx @penskemediacorp/larva help link-all` );
30
- return;
30
+ process.exit();
31
31
  }
32
-
33
32
  shell.exec( 'npm link @penskemediacorp/larva' );
34
33
  shell.exec( 'npm link @penskemediacorp/larva-css' );
35
34
  shell.exec( 'npm link @penskemediacorp/larva-js' );
package/scripts/lint.js CHANGED
@@ -51,7 +51,7 @@ const cliArgs = getArgsFromCli();
51
51
  // Handle help command.
52
52
  if ( cliArgs.includes( '--help' ) ) {
53
53
  shell.exec( `npx @penskemediacorp/larva help lint` );
54
- return;
54
+ process.exit( 0 );
55
55
  }
56
56
 
57
57
  // Trigger linting when a specific flag is present, or when neither flag is
@@ -63,11 +63,11 @@ const lintJS = cliArgs.includes( '--js' ) || ! cliArgs.includes( '--css' );
63
63
  const fix = cliArgs.includes( '--fix' ) ? ' fix' : '';
64
64
 
65
65
  if ( lintCSS ) {
66
- console.log( 'Linting CSS assets\n\n\n' );
66
+ process.stdout.write( 'Linting CSS assets\n\n\n' );
67
67
  shell.exec( `${ binPath } lint-scss${ fix }` );
68
68
  }
69
69
 
70
70
  if ( lintJS ) {
71
- console.log( 'Linting JavaScript assets\n\n\n' );
71
+ process.stdout.write( 'Linting JavaScript assets\n\n\n' );
72
72
  shell.exec( `${ binPath } lint-js ${ workingDirectory }${ fix }` );
73
73
  }
package/scripts/prod.js CHANGED
@@ -59,7 +59,7 @@ const cliArgs = getArgsFromCli();
59
59
  // Handle help command.
60
60
  if ( cliArgs.includes( '--help' ) ) {
61
61
  shell.exec( `npx @penskemediacorp/larva help prod` );
62
- return;
62
+ process.exit( 0 );
63
63
  }
64
64
 
65
65
  // Run the Twig-to-PHP parser.
@@ -68,49 +68,47 @@ if (
68
68
  cliArgs.includes( '--parser' ) ||
69
69
  cliArgs.includes( '--parse' )
70
70
  ) {
71
- console.log( 'Parsing Twig templates\n\n' );
71
+ process.stdout.write( 'Parsing Twig templates\n\n' );
72
72
  shell.exec( `npx @penskemediacorp/twig-to-php-parser` );
73
73
  } else {
74
- console.log( 'Skipping Twig templates\n' );
74
+ process.stdout.write( 'Skipping Twig templates\n' );
75
75
  }
76
-
77
76
  // Run the write-json script.
78
77
  if (
79
78
  1 === cliArgs.length ||
80
79
  cliArgs.includes( '--json' ) ||
81
80
  cliArgs.includes( '--write-json' )
82
81
  ) {
83
- console.log( 'Building JSON assets\n\n' );
82
+ process.stdout.write( 'Building JSON assets\n\n' );
84
83
  shell.exec( `${ binPath } write-json` );
85
84
  } else {
86
- console.log( 'Skipping write-json\n' );
85
+ process.stdout.write( 'Skipping write-json\n' );
87
86
  }
88
-
89
87
  // Build CSS/SCSS.
90
88
  if (
91
89
  1 === cliArgs.length ||
92
90
  cliArgs.includes( '--css' ) ||
93
91
  cliArgs.includes( '--scss' )
94
92
  ) {
95
- console.log( 'Building CSS assets\n\n' );
93
+ process.stdout.write( 'Building CSS assets\n\n' );
96
94
  shell.exec( `${ binPath } prod-scss` );
97
95
  } else {
98
- console.log( 'Skipping building CSS\n' );
96
+ process.stdout.write( 'Skipping building CSS\n' );
99
97
  }
100
98
 
101
99
  // Build JS.
102
100
  if ( 1 === cliArgs.length || cliArgs.includes( '--js' ) ) {
103
- console.log( 'Building JavaScript assets\n\n' );
101
+ process.stdout.write( 'Building JavaScript assets\n\n' );
104
102
  shell.exec( `${ binPath } prod-js` );
105
103
  } else {
106
- console.log( 'Skipping building JavaScript\n' );
104
+ process.stdout.write( 'Skipping building JavaScript\n' );
107
105
  }
108
106
 
109
107
  // Build SVG.
110
108
  if ( 1 === cliArgs.length || cliArgs.includes( '--svg' ) ) {
111
- console.log( 'Building SVG assets\n\n' );
109
+ process.stdout.write( 'Building SVG assets\n\n' );
112
110
  shell.exec( `${ binPath } build-icons` );
113
111
  shell.exec( 'npx svgo -f src/svg -o build/svg' );
114
112
  } else {
115
- console.log( 'Skipping building the SVGs\n' );
113
+ process.stdout.write( 'Skipping building the SVGs\n' );
116
114
  }
package/scripts/start.js CHANGED
@@ -26,7 +26,7 @@ const cliArgs = getArgsFromCli();
26
26
  // Handle help command.
27
27
  if ( cliArgs.includes( '--help' ) ) {
28
28
  shell.exec( `npx @penskemediacorp/larva help start` );
29
- return;
29
+ process.exit( 0 );
30
30
  }
31
31
 
32
32
  // Construct some paths to point our scripts at.
@@ -52,9 +52,8 @@ const cliArgs = getArgsFromCli();
52
52
  // Handle help command.
53
53
  if ( cliArgs.includes( '--help' ) ) {
54
54
  shell.exec( `npx @penskemediacorp/larva help upgrade` );
55
- return;
55
+ process.exit( 0 );
56
56
  }
57
-
58
57
  // Parse the --version flag. Defaults to 'latest'.
59
58
  const getVersionArg = () => {
60
59
  // Loop through our args, looking for `--version=`.
@@ -76,7 +75,7 @@ const getVersionArg = () => {
76
75
  };
77
76
 
78
77
  // Update Larva version installed.
79
- console.log( `Installing Larva@${ getVersionArg() }\n\n` );
78
+ shell.echo( `Installing Larva@${ getVersionArg() }\n\n` );
80
79
  shell.exec( `npm install @penskemediacorp/larva@${ getVersionArg() }` );
81
80
 
82
81
  // Build CSS.
@@ -84,12 +83,11 @@ if (
84
83
  ! cliArgs.includes( '--skip-css' ) ||
85
84
  cliArgs.includes( '--skip-build' )
86
85
  ) {
87
- console.log( 'Building CSS assets\n\n' );
86
+ shell.echo( 'Building CSS assets\n\n' );
88
87
  shell.exec( `${ binPath } prod-scss` );
89
88
  }
90
-
91
89
  // Build JavaScript.
92
90
  if ( ! cliArgs.includes( '--skip-js' ) || cliArgs.includes( '--skip-build' ) ) {
93
- console.log( 'Building JavaScript assets\n\n' );
91
+ shell.echo( 'Building JavaScript assets\n\n' );
94
92
  shell.exec( `${ binPath } prod-js` );
95
93
  }
@@ -9,6 +9,7 @@ const cliArgs = getArgsFromCli();
9
9
 
10
10
  const fromLarva = 'larva' === cliArgs[ 1 ] ? true : false;
11
11
 
12
+ // eslint-disable-next-line no-console
12
13
  console.log(
13
14
  chalk.bold( `\n---- ${ cliArgs[ 1 ] || 'Project' } JSON ----\n` )
14
15
  );