This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | /** |
||
2 | * Start |
||
3 | * |
||
4 | * The create-guten-block CLI starts here. |
||
5 | * |
||
6 | * TODO: |
||
7 | * - checkRequiredFiles |
||
8 | * - printBuildError |
||
9 | */ |
||
10 | 'use strict'; |
||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
11 | |||
12 | // Do this as the first thing so that any code reading it knows the right env. |
||
13 | process.env.BABEL_ENV = 'development'; |
||
0 ignored issues
–
show
|
|||
14 | process.env.NODE_ENV = 'development'; |
||
0 ignored issues
–
show
|
|||
15 | |||
16 | // Makes the script crash on unhandled rejections instead of silently |
||
17 | // ignoring them. In the future, promise rejections that are not handled will |
||
18 | // terminate the Node.js process with a non-zero exit code. |
||
19 | process.on( 'unhandledRejection', err => { |
||
0 ignored issues
–
show
'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').
Generally using ECMAScript 6 specific syntax is fine if you are sure that it is already supported by all engines which are supposed to run this code. Further Reading: ![]() |
|||
20 | throw err; |
||
21 | } ); |
||
22 | |||
23 | const ora = require( 'ora' ); |
||
0 ignored issues
–
show
|
|||
24 | const chalk = require( 'chalk' ); |
||
0 ignored issues
–
show
|
|||
25 | const webpack = require( 'webpack' ); |
||
0 ignored issues
–
show
|
|||
26 | const config = require( '../config/webpack.config.dev' ); |
||
0 ignored issues
–
show
|
|||
27 | const resolvePkg = require( 'resolve-pkg' ); |
||
0 ignored issues
–
show
|
|||
28 | const cgbDevUtilsPath = resolvePkg( 'cgb-dev-utils', { cwd: __dirname } ); |
||
0 ignored issues
–
show
|
|||
29 | const clearConsole = require( cgbDevUtilsPath + '/clearConsole' ); |
||
0 ignored issues
–
show
|
|||
30 | const formatWebpackMessages = require( cgbDevUtilsPath + |
||
0 ignored issues
–
show
|
|||
31 | '/formatWebpackMessages' ); |
||
32 | |||
33 | // Don't run below node 8. |
||
34 | const currentNodeVersion = process.versions.node; |
||
0 ignored issues
–
show
|
|||
35 | const semver = currentNodeVersion.split( '.' ); |
||
0 ignored issues
–
show
|
|||
36 | const major = semver[ 0 ]; |
||
0 ignored issues
–
show
|
|||
37 | |||
38 | // If below Node 8. |
||
39 | if ( major < 8 ) { |
||
40 | console.error( |
||
0 ignored issues
–
show
|
|||
41 | chalk.red( |
||
42 | 'You are running Node ' + |
||
43 | currentNodeVersion + |
||
44 | '.\n' + |
||
45 | 'Create Guten Block requires Node 8 or higher. \n' + |
||
46 | 'Kindly, update your version of Node.' |
||
47 | ) |
||
48 | ); |
||
49 | process.exit( 1 ); |
||
0 ignored issues
–
show
|
|||
50 | } |
||
51 | |||
52 | clearConsole(); |
||
53 | |||
54 | // Init the spinner. |
||
55 | const spinner = new ora( { text: '' } ); |
||
0 ignored issues
–
show
|
|||
56 | |||
57 | // Create the production build and print the deployment instructions. |
||
58 | async function build( webpackConfig ) { |
||
0 ignored issues
–
show
Did you forget to assign or call a function?
This error message can for example pop up if you forget to assign the result of a function call to a variable or pass it to another function: function someFunction(x) {
(x > 0) ? callFoo() : callBar();
}
// JSHint expects you to assign the result to a variable:
function someFunction(x) {
var rs = (x > 0) ? callFoo() : callBar();
}
// If you do not use the result, you could also use if statements in the
// case above.
function someFunction(x) {
if (x > 0) {
callFoo();
} else {
callBar();
}
}
![]() There were too many errors found in this file; checking aborted after 45%.
If JSHint finds too many errors in a file, it aborts checking altogether because it suspects a configuration issue. Further Reading: ![]() |
|||
59 | // Compiler Instance. |
||
60 | const compiler = await webpack( webpackConfig ); |
||
0 ignored issues
–
show
|
|||
61 | |||
62 | // Run the compiler. |
||
63 | compiler.watch( {}, ( err, stats ) => { |
||
0 ignored issues
–
show
'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').
Generally using ECMAScript 6 specific syntax is fine if you are sure that it is already supported by all engines which are supposed to run this code. Further Reading: ![]() |
|||
64 | clearConsole(); |
||
65 | |||
66 | if ( err ) { |
||
67 | return console.log( err ); |
||
0 ignored issues
–
show
|
|||
68 | } |
||
69 | |||
70 | // Get the messages formatted. |
||
71 | const messages = formatWebpackMessages( stats.toJson( {}, true ) ); |
||
0 ignored issues
–
show
|
|||
72 | |||
73 | // If there are errors just show the errors. |
||
74 | if ( messages.errors.length ) { |
||
75 | // Only keep the first error. Others are often indicative |
||
76 | // of the same problem, but confuse the reader with noise. |
||
77 | if ( messages.errors.length > 1 ) { |
||
78 | messages.errors.length = 1; |
||
79 | } |
||
80 | |||
81 | // Clear success messages. |
||
82 | clearConsole(); |
||
83 | |||
84 | // Formatted errors. |
||
85 | console.log( '\n❌ ', chalk.black.bgRed( ' Failed to compile. \n' ) ); |
||
0 ignored issues
–
show
|
|||
86 | const logErrors = console.log( '\n👉 ', messages.errors.join( '\n\n' ) ); |
||
0 ignored issues
–
show
|
|||
87 | console.log( '\n' ); |
||
0 ignored issues
–
show
|
|||
88 | spinner.start( |
||
89 | chalk.dim( |
||
90 | 'Watching for changes... let\'s fix this... (Press CTRL + C to stop).' |
||
91 | ) |
||
92 | ); |
||
93 | return logErrors; |
||
94 | } |
||
95 | |||
96 | // CI. |
||
97 | if ( |
||
98 | process.env.CI && |
||
0 ignored issues
–
show
|
|||
99 | ( typeof process.env.CI !== 'string' || |
||
0 ignored issues
–
show
|
|||
100 | process.env.CI.toLowerCase() !== 'false' ) && |
||
0 ignored issues
–
show
|
|||
101 | messages.warnings.length |
||
102 | ) { |
||
103 | console.log( |
||
0 ignored issues
–
show
|
|||
104 | chalk.yellow( |
||
105 | '\nTreating warnings as errors because process.env.CI = true.\n' + |
||
106 | 'Most CI servers set it automatically.\n' |
||
107 | ) |
||
108 | ); |
||
109 | return console.log( messages.warnings.join( '\n\n' ) ); |
||
0 ignored issues
–
show
|
|||
110 | } |
||
111 | |||
112 | // Start the build. |
||
113 | console.log( `\n${ chalk.dim( 'Let\'s build and compile the files...' ) }` ); |
||
0 ignored issues
–
show
'template literal syntax' is only available in ES6 (use 'esversion: 6').
Generally using ECMAScript 6 specific syntax is fine if you are sure that it is already supported by all engines which are supposed to run this code. Further Reading: ![]() |
|||
114 | console.log( '\n✅ ', chalk.black.bgGreen( ' Compiled successfully! \n' ) ); |
||
0 ignored issues
–
show
|
|||
115 | console.log( |
||
0 ignored issues
–
show
|
|||
116 | chalk.dim( ' Note that the development build is not optimized. \n' ), |
||
117 | chalk.dim( ' To create a production build, use' ), |
||
118 | chalk.green( 'npm' ), |
||
119 | chalk.white( 'run build\n' ) |
||
120 | ); |
||
121 | return spinner.start( |
||
122 | `${ chalk.dim( 'Watching for changes... (Press CTRL + C to stop).' ) }` |
||
0 ignored issues
–
show
'template literal syntax' is only available in ES6 (use 'esversion: 6').
Generally using ECMAScript 6 specific syntax is fine if you are sure that it is already supported by all engines which are supposed to run this code. Further Reading: ![]() |
|||
123 | ); |
||
124 | } ); |
||
125 | } |
||
126 | |||
127 | build( config ); |
||
128 |