Skip to content

Commit

Permalink
feat: add additional scripts to init template (#2550)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesgeorge007 authored Mar 25, 2021
1 parent 68a6c67 commit 665d993
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/generators/init-template/default/package.json.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
module.exports = (isUsingDevServer) => {
const scripts = {
build: 'webpack --mode=production',
'build:dev': 'webpack --mode=development',
'build:prod': 'webpack --mode=production',
watch: 'webpack --watch',
};
if (isUsingDevServer) {
scripts.serve = 'webpack serve';
Expand Down
36 changes: 36 additions & 0 deletions test/init/__snapshots__/init.test.js.snap.webpack4
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ Object {
"name": "my-webpack-project",
"scripts": Object {
"build": "webpack --mode=production",
"build:dev": "webpack --mode=development",
"build:prod": "webpack --mode=production",
"serve": "webpack serve",
"watch": "webpack --watch",
},
"version": "1.0.0",
}
Expand All @@ -29,7 +32,10 @@ Object {
"name": "my-webpack-project",
"scripts": Object {
"build": "webpack --mode=production",
"build:dev": "webpack --mode=development",
"build:prod": "webpack --mode=production",
"serve": "webpack serve",
"watch": "webpack --watch",
},
"version": "1.0.0",
}
Expand Down Expand Up @@ -80,7 +86,10 @@ Object {
"name": "my-webpack-project",
"scripts": Object {
"build": "webpack --mode=production",
"build:dev": "webpack --mode=development",
"build:prod": "webpack --mode=production",
"serve": "webpack serve",
"watch": "webpack --watch",
},
"version": "1.0.0",
}
Expand Down Expand Up @@ -135,6 +144,9 @@ Object {
"name": "my-webpack-project",
"scripts": Object {
"build": "webpack --mode=production",
"build:dev": "webpack --mode=development",
"build:prod": "webpack --mode=production",
"watch": "webpack --watch",
},
"version": "1.0.0",
}
Expand Down Expand Up @@ -187,6 +199,9 @@ Object {
"name": "my-webpack-project",
"scripts": Object {
"build": "webpack --mode=production",
"build:dev": "webpack --mode=development",
"build:prod": "webpack --mode=production",
"watch": "webpack --watch",
},
"version": "1.0.0",
}
Expand Down Expand Up @@ -238,7 +253,10 @@ Object {
"name": "my-webpack-project",
"scripts": Object {
"build": "webpack --mode=production",
"build:dev": "webpack --mode=development",
"build:prod": "webpack --mode=production",
"serve": "webpack serve",
"watch": "webpack --watch",
},
"version": "1.0.0",
}
Expand All @@ -256,7 +274,10 @@ Object {
"name": "my-webpack-project",
"scripts": Object {
"build": "webpack --mode=production",
"build:dev": "webpack --mode=development",
"build:prod": "webpack --mode=production",
"serve": "webpack serve",
"watch": "webpack --watch",
},
"version": "1.0.0",
}
Expand All @@ -274,7 +295,10 @@ Object {
"name": "my-webpack-project",
"scripts": Object {
"build": "webpack --mode=production",
"build:dev": "webpack --mode=development",
"build:prod": "webpack --mode=production",
"serve": "webpack serve",
"watch": "webpack --watch",
},
"version": "1.0.0",
}
Expand All @@ -292,6 +316,9 @@ Object {
"name": "my-webpack-project",
"scripts": Object {
"build": "webpack --mode=production",
"build:dev": "webpack --mode=development",
"build:prod": "webpack --mode=production",
"watch": "webpack --watch",
},
"version": "1.0.0",
}
Expand Down Expand Up @@ -347,6 +374,9 @@ Object {
"name": "my-webpack-project",
"scripts": Object {
"build": "webpack --mode=production",
"build:dev": "webpack --mode=development",
"build:prod": "webpack --mode=production",
"watch": "webpack --watch",
},
"version": "1.0.0",
}
Expand Down Expand Up @@ -432,6 +462,9 @@ Object {
"name": "my-webpack-project",
"scripts": Object {
"build": "webpack --mode=production",
"build:dev": "webpack --mode=development",
"build:prod": "webpack --mode=production",
"watch": "webpack --watch",
},
"version": "1.0.0",
}
Expand Down Expand Up @@ -483,6 +516,9 @@ Object {
"name": "my-webpack-project",
"scripts": Object {
"build": "webpack --mode=production",
"build:dev": "webpack --mode=development",
"build:prod": "webpack --mode=production",
"watch": "webpack --watch",
},
"version": "1.0.0",
}
Expand Down
36 changes: 36 additions & 0 deletions test/init/__snapshots__/init.test.js.snap.webpack5
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ Object {
"name": "my-webpack-project",
"scripts": Object {
"build": "webpack --mode=production",
"build:dev": "webpack --mode=development",
"build:prod": "webpack --mode=production",
"serve": "webpack serve",
"watch": "webpack --watch",
},
"version": "1.0.0",
}
Expand All @@ -29,7 +32,10 @@ Object {
"name": "my-webpack-project",
"scripts": Object {
"build": "webpack --mode=production",
"build:dev": "webpack --mode=development",
"build:prod": "webpack --mode=production",
"serve": "webpack serve",
"watch": "webpack --watch",
},
"version": "1.0.0",
}
Expand Down Expand Up @@ -80,7 +86,10 @@ Object {
"name": "my-webpack-project",
"scripts": Object {
"build": "webpack --mode=production",
"build:dev": "webpack --mode=development",
"build:prod": "webpack --mode=production",
"serve": "webpack serve",
"watch": "webpack --watch",
},
"version": "1.0.0",
}
Expand Down Expand Up @@ -135,6 +144,9 @@ Object {
"name": "my-webpack-project",
"scripts": Object {
"build": "webpack --mode=production",
"build:dev": "webpack --mode=development",
"build:prod": "webpack --mode=production",
"watch": "webpack --watch",
},
"version": "1.0.0",
}
Expand Down Expand Up @@ -187,6 +199,9 @@ Object {
"name": "my-webpack-project",
"scripts": Object {
"build": "webpack --mode=production",
"build:dev": "webpack --mode=development",
"build:prod": "webpack --mode=production",
"watch": "webpack --watch",
},
"version": "1.0.0",
}
Expand Down Expand Up @@ -238,7 +253,10 @@ Object {
"name": "my-webpack-project",
"scripts": Object {
"build": "webpack --mode=production",
"build:dev": "webpack --mode=development",
"build:prod": "webpack --mode=production",
"serve": "webpack serve",
"watch": "webpack --watch",
},
"version": "1.0.0",
}
Expand All @@ -256,7 +274,10 @@ Object {
"name": "my-webpack-project",
"scripts": Object {
"build": "webpack --mode=production",
"build:dev": "webpack --mode=development",
"build:prod": "webpack --mode=production",
"serve": "webpack serve",
"watch": "webpack --watch",
},
"version": "1.0.0",
}
Expand All @@ -274,7 +295,10 @@ Object {
"name": "my-webpack-project",
"scripts": Object {
"build": "webpack --mode=production",
"build:dev": "webpack --mode=development",
"build:prod": "webpack --mode=production",
"serve": "webpack serve",
"watch": "webpack --watch",
},
"version": "1.0.0",
}
Expand All @@ -292,6 +316,9 @@ Object {
"name": "my-webpack-project",
"scripts": Object {
"build": "webpack --mode=production",
"build:dev": "webpack --mode=development",
"build:prod": "webpack --mode=production",
"watch": "webpack --watch",
},
"version": "1.0.0",
}
Expand Down Expand Up @@ -347,6 +374,9 @@ Object {
"name": "my-webpack-project",
"scripts": Object {
"build": "webpack --mode=production",
"build:dev": "webpack --mode=development",
"build:prod": "webpack --mode=production",
"watch": "webpack --watch",
},
"version": "1.0.0",
}
Expand Down Expand Up @@ -432,6 +462,9 @@ Object {
"name": "my-webpack-project",
"scripts": Object {
"build": "webpack --mode=production",
"build:dev": "webpack --mode=development",
"build:prod": "webpack --mode=production",
"watch": "webpack --watch",
},
"version": "1.0.0",
}
Expand Down Expand Up @@ -483,6 +516,9 @@ Object {
"name": "my-webpack-project",
"scripts": Object {
"build": "webpack --mode=production",
"build:dev": "webpack --mode=development",
"build:prod": "webpack --mode=production",
"watch": "webpack --watch",
},
"version": "1.0.0",
}
Expand Down

0 comments on commit 665d993

Please sign in to comment.