-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7ba5630
Showing
14 changed files
with
15,366 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
*.log | ||
.DS_Store | ||
.idea | ||
.env | ||
.sass-cache | ||
.venv | ||
.vscode | ||
*.code-workspace | ||
node_modules | ||
_internal | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
_internal | ||
./.eslintrc | ||
./.npmrc | ||
./.nvmrc | ||
commitlint.config.js | ||
/docs | ||
/website |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
save-exact=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v12.8.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# 0.0.2 - 08/11/2019 | ||
## Miscellaneous Updates | ||
* [[c8e508c0](https://github.com/reintroducing/rsr/commit/c8e508c0)] - `ci:` Add .npmignore (Matt Przybylski) | ||
* [[24fffed1](https://github.com/reintroducing/rsr/commit/24fffed1)] - `ci:` Add commitlint config (Matt Przybylski) | ||
* [[3917ada7](https://github.com/reintroducing/rsr/commit/3917ada7)] - added node_modules to gitignore (Matt Przybylski) | ||
* [[86dca724](https://github.com/reintroducing/rsr/commit/86dca724)] - added gitignore (Matt Przybylski) | ||
* [[2814c922](https://github.com/reintroducing/rsr/commit/2814c922)] - initial commit (Matt Przybylski) | ||
* [[c9399239](https://github.com/reintroducing/rsr/commit/c9399239)] - Initial commit (Matt Przybylski) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
To use: | ||
1) `npm link` first in the root. | ||
1) Now can run `rsr` command in terminal. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env node | ||
const arg = require('arg'); | ||
const chalk = require('chalk'); | ||
const spawn = require('cross-spawn'); | ||
|
||
const args = arg({ | ||
'--event': String, // rsr --event=start | ||
'-e': '--event', // rsr -e start | ||
}); | ||
const script = args['--event']; | ||
|
||
switch (script) { | ||
case 'start': | ||
case 'test': | ||
case 'build': | ||
spawn.sync( | ||
'node', | ||
[require.resolve(`../scripts/${script}`)], | ||
{stdio: 'inherit'} | ||
); | ||
break; | ||
|
||
default: | ||
console.log(chalk.red(`The script ${script} does not exist.`)); | ||
break; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
extends: ['@spothero/commitlint-config'] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,214 @@ | ||
const path = require('path'); | ||
const del = require('del'); | ||
const StyleLintPlugin = require('stylelint-webpack-plugin'); | ||
const HtmlWebpackPlugin = require('html-webpack-plugin'); | ||
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); | ||
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin'); | ||
const TerserPlugin = require('terser-webpack-plugin'); | ||
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; | ||
const eslintFriendlyFormatter = require('eslint-friendly-formatter'); | ||
const postCssImport = require('postcss-import'); | ||
const postcssPresetEnv = require('postcss-preset-env'); | ||
const flexbugsFixes = require('postcss-flexbugs-fixes'); | ||
|
||
module.exports = function(mode = 'development') { | ||
const isDev = (mode === 'development' || mode === 'test'); | ||
const dist = path.resolve(process.cwd(), 'dist'); | ||
const src = path.resolve(process.cwd(), 'src'); | ||
const entry = [`${src}/index.js`]; | ||
const stats = { | ||
children: false, | ||
chunkModules: false, | ||
chunks: false, | ||
colors: true, | ||
hash: false, | ||
modules: false, | ||
performance: false, | ||
timings: true, | ||
}; | ||
|
||
if (isDev) { | ||
entry.unshift('react-hot-loader/patch'); | ||
} | ||
|
||
del.sync(dist); | ||
|
||
return { | ||
mode: (isDev) | ||
? 'development' | ||
: 'production', | ||
target: 'web', | ||
devtool: (isDev) | ||
? 'cheap-module-source-map' | ||
: 'source-map', | ||
entry, | ||
output: { | ||
filename: `js/[name]${(isDev) ? '' : '-[hash]'}.js`, | ||
path: `${dist}`, | ||
...(isDev) && { | ||
publicPath: '/', | ||
}, | ||
}, | ||
plugins: [ | ||
new StyleLintPlugin(), | ||
// new StyleLintPlugin({ | ||
// // configBasedir: process.cwd(), | ||
// configBasedir: path.resolve(__dirname, '../'), | ||
// }), | ||
new HtmlWebpackPlugin({ | ||
filename: `${dist}/index.html`, | ||
template: `${src}/index.html`, | ||
}), | ||
new MiniCssExtractPlugin({ | ||
filename: `css/[name]${(isDev) ? '' : '-[hash]'}.css`, | ||
chunkFilename: (isDev) | ||
? 'css/[name]-[id].css' | ||
: 'css/[name]-[contenthash].css', | ||
}), | ||
new BundleAnalyzerPlugin({ | ||
analyzerMode: (isDev) ? 'static' : 'disabled', | ||
openAnalyzer: false, | ||
}), | ||
], | ||
resolve: { | ||
alias: { | ||
...(isDev) && { | ||
'react-dom': '@hot-loader/react-dom', | ||
}, | ||
}, | ||
modules: [ | ||
'node_modules', | ||
src, | ||
], | ||
extensions: [ | ||
'.js', | ||
'.jsx', | ||
'.json', | ||
], | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.jsx?$/, | ||
exclude: /node_modules/, | ||
use: [ | ||
'babel-loader', | ||
{ | ||
loader: 'eslint-loader', | ||
options: { | ||
formatter: eslintFriendlyFormatter, | ||
emitError: true, | ||
emitWarning: true, | ||
}, | ||
}, | ||
], | ||
}, | ||
{ | ||
test: /\.scss$/, | ||
use: [ | ||
{ | ||
loader: MiniCssExtractPlugin.loader, | ||
options: { | ||
hmr: isDev, | ||
publicPath: (resourcePath, context) => { | ||
return `${path.relative(dist, context)}/`; | ||
}, | ||
}, | ||
}, | ||
{ | ||
loader: 'css-loader', | ||
options: { | ||
importLoaders: 2, | ||
modules: { | ||
localIdentName: `[name]-[local]${(isDev) ? '' : '-[hash:base64]'}`, | ||
}, | ||
sourceMap: isDev, | ||
}, | ||
}, | ||
{ | ||
loader: 'postcss-loader', | ||
options: { | ||
plugins: [ | ||
postCssImport(), | ||
flexbugsFixes(), | ||
postcssPresetEnv(), | ||
], | ||
}, | ||
}, | ||
{ | ||
loader: 'sass-loader', | ||
options: { | ||
sourceMap: isDev, | ||
}, | ||
}, | ||
{ | ||
loader: 'sass-resources-loader', | ||
options: { | ||
resources: 'src/common/_resources.scss', | ||
}, | ||
}, | ||
], | ||
}, | ||
{ | ||
test: /\.(png|svg|jpe?g|gif)$/, | ||
use: [ | ||
{ | ||
loader: 'file-loader', | ||
options: { | ||
name: `[folder]/[name]${(isDev) ? '' : '-[contenthash]'}.[ext]`, | ||
outputPath: 'img', | ||
}, | ||
}, | ||
{ | ||
loader: 'image-webpack-loader', | ||
options: { | ||
disable: isDev, | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
stats, | ||
...(isDev) && { | ||
devServer: { | ||
historyApiFallback: true, | ||
hot: true, | ||
open: true, | ||
publicPath: '/', | ||
stats, | ||
writeToDisk: true, | ||
}, | ||
}, | ||
performance: { | ||
hints: false, | ||
}, | ||
optimization: { | ||
...(!isDev) && { | ||
minimizer: [ | ||
new OptimizeCssAssetsPlugin({ | ||
cssProcessorPluginOptions: { | ||
preset: ['default', { | ||
discardComments: { | ||
removeAll: true, | ||
}, | ||
}], | ||
}, | ||
}), | ||
new TerserPlugin({ | ||
parallel: true, | ||
sourceMap: true, | ||
terserOptions: { | ||
compress: { | ||
warnings: false, | ||
}, | ||
output: { | ||
comments: false, | ||
}, | ||
}, | ||
}), | ||
], | ||
}, | ||
}, | ||
}; | ||
} |
Oops, something went wrong.