Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
eba20d7
branch created
brauliodiez Mar 15, 2019
8713992
partial upgrade, need manual include webpack-cli
brauliodiez Mar 15, 2019
e7e2370
migration in progress
brauliodiez Mar 19, 2019
96861ae
perf config
brauliodiez Mar 19, 2019
246eab9
sample app added
brauliodiez Mar 19, 2019
466dd45
work in progress hoc
brauliodiez Mar 19, 2019
87b6010
work in progress
brauliodiez Mar 19, 2019
3933278
peer dependecy added not working yet
brauliodiez Mar 19, 2019
72699b6
added alias to example to avoid having two react
brauliodiez Mar 19, 2019
e9ca9d3
config updated
brauliodiez Mar 20, 2019
2b1de3d
refactor config and added delay pending check
brauliodiez Mar 20, 2019
f4a8b88
cleaning up code
brauliodiez Mar 20, 2019
cf64578
update remove boolean explicit comparison
brauliodiez Mar 21, 2019
81a3ac5
fix existings hoc specs
nasdan Mar 21, 2019
fe82a6d
fix typo
nasdan Mar 21, 2019
c589cee
examples uploaded, not working
brauliodiez Mar 21, 2019
3c8d32d
add specs simulating progress with event emitter
nasdan Mar 21, 2019
2b74aee
Added delay specs. not working yet
nasdan Mar 22, 2019
189bbed
Fix autoclrf
nasdan Mar 22, 2019
65c66d5
sample areas working
brauliodiez Mar 22, 2019
ca01439
delay param fixed
brauliodiez Mar 22, 2019
e45f6b4
added comments
brauliodiez Mar 22, 2019
9d2110e
fixed config
brauliodiez Mar 22, 2019
2b80613
initial load plus fixes
brauliodiez Mar 22, 2019
82d51ed
Merge branch '#45-hooks-implementation' into v2/testing-hooks
brauliodiez Mar 23, 2019
e23fdd8
Merge pull request #46 from Lemoncode/v2/testing-hooks
brauliodiez Mar 23, 2019
8fc6fd0
starting hooks testing
brauliodiez Mar 23, 2019
877c472
testing timeout, almost there
brauliodiez Mar 24, 2019
95cda42
test passing but warning
brauliodiez Mar 24, 2019
d76dd61
timeout cases covered but got act warning
brauliodiez Mar 24, 2019
8ccf1b9
refactored setupconfig
brauliodiez Mar 26, 2019
31a5481
hoc testing passing
brauliodiez Mar 26, 2019
9e3f46f
HOC sample completed
brauliodiez Mar 26, 2019
df64fc2
rename example to examples
brauliodiez Mar 26, 2019
94a66f5
typescript work in progress
brauliodiez Mar 26, 2019
1e18e94
fix setupConfig
brauliodiez Mar 27, 2019
c14e1d5
fixed track promise
brauliodiez Mar 27, 2019
29fcf7a
Merge pull request #47 from Lemoncode/#45-hooks-implementation
brauliodiez Mar 27, 2019
41f1b4c
updated tests
brauliodiez Mar 27, 2019
5004a32
typescript error duplicated
brauliodiez Mar 27, 2019
f4632bf
finx optional param
brauliodiez Mar 27, 2019
3092394
First approach to a better build system
fjcalzado Mar 28, 2019
d448eb5
Update examples dependency route
fjcalzado Apr 1, 2019
8a8dfb3
Fix issues with react copies due to examples linking build files as d…
fjcalzado Apr 1, 2019
131fda8
Replace toMatch by toEqual
nasdan Apr 3, 2019
229c7e3
Merge pull request #56 from Lemoncode/#48-review-build-config
brauliodiez Apr 8, 2019
6f628b9
updated gitIgnore
brauliodiez Apr 8, 2019
fd9f72b
Add beta version
nasdan Apr 8, 2019
3b505d8
2.0.0-beta.1
nasdan Apr 8, 2019
f4b2b35
Fix prerelease step
nasdan Apr 8, 2019
5ac8fd2
Merge branch 'version-2.0' into feature/52-fix-hoc-specs
nasdan Apr 15, 2019
f8bd9c9
Fix hoc spec
nasdan Apr 15, 2019
2ebc0f7
updated pcakge.jhson
brauliodiez Apr 15, 2019
0fbe1a9
removing lechuguitas
brauliodiez Apr 15, 2019
43c249a
Merge branch 'version-2.0' into feature/52-fix-hoc-specs
nasdan Apr 15, 2019
f251e27
Remove double quotes
nasdan Apr 15, 2019
6f81e0d
Merge pull request #57 from Lemoncode/feature/52-fix-hoc-specs
brauliodiez Apr 15, 2019
d1afd42
updated readme
brauliodiez Apr 16, 2019
bede1b1
Merge branch 'version-2.0' of https://github.com/Lemoncode/react-prom…
brauliodiez Apr 16, 2019
c0487b4
updated package.json
brauliodiez Apr 16, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 25 additions & 11 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,29 +1,43 @@
{
"env": {
// Compatibility Profile. ES5 output and CommonJS module format.
"commonjs": {
// Compatibility Profile.
// ES5 output and CommonJS module format.
"es5_cjs": {
"presets": [
["env", {
"useBuiltIns": false
}],
"react"
"@babel/preset-env",
"@babel/preset-react"
]
},
// Future Profile. ES6 output and module syntax.
// Future Profile.
// ES6 output with no module transformation (ES Modules syntax).
"es": {
"presets": [
["env", {
"useBuiltIns": false,
["@babel/preset-env", {
"modules": false,
"targets": {
"node": "6.5"
}
}],
"react"
"@babel/preset-react"
]
},
// Bundled Profile.
// ES5 output and UMD module format.
"umd": {
"presets": [
["@babel/preset-env", {
"modules": false,
}],
"@babel/preset-react"
]
},
// Jest Profile.
// To be used by jest tests.
"test": {
"presets": ["env", "react"]
"presets": [
"@babel/preset-env",
"@babel/preset-react"
]
}
}
}
34 changes: 26 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
node_modules
.DS_Store
dist/
typings/
*.orig
# Common aux folders
.awcache/
.vscode/
.idea/
*/src/**/*.js.map
yarn.lock
*.log
.cache/

# Dependencies & Build
node_modules/
build/
lib/
dist/
es/

# Aux files
*.cer
*.log
*/src/**/*.orig
*/src/**/*.js.map

# Win
desktop.ini

# MacOs
.DS_Store

# Yarn
yarn.lock

# NPM
package-lock.json
65 changes: 48 additions & 17 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,48 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Jest single run",
"program": "${workspaceRoot}/node_modules/jest/bin/jest.js",
"args": [
"--verbose",
"-i"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
},
]
}

{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Jest single run",
"program": "${workspaceRoot}/node_modules/jest/bin/jest.js",
"args": [
"--verbose",
"-i",
"--no-cache"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
},
{
"type": "node",
"request": "launch",
"name": "Jest watch run",
"program": "${workspaceRoot}/node_modules/jest/bin/jest.js",
"args": [
"--verbose",
"-i",
"--no-cache",
"--watchAll"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
},
{
"type": "node",
"request": "launch",
"name": "Jest current file",
"program": "${workspaceRoot}/node_modules/jest/bin/jest.js",
"args": [
"${fileBasename}",
"--verbose",
"-i",
"--no-cache",
"--watchAll"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
]
}
2 changes: 2 additions & 0 deletions config/test/polyfills.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Polyfill requestAnimationFrame required by React >=16.0.0
require('raf/polyfill');
File renamed without changes.
25 changes: 25 additions & 0 deletions config/webpack/helpers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const path = require('path');

// String helpers
const capitalizeString = s => s.charAt(0).toUpperCase() + s.slice(1);
const camelCaseString = dashedName => dashedName.split("-").map(
(s, i) => i > 0 ? capitalizeString(s) : s
).join("");

// Name helpers
const packageName = process.env.npm_package_name;
const packageNameCamelCase = camelCaseString(packageName);
const version = JSON.stringify(process.env.npm_package_version).replace(/"/g, '');
const getBundleFileName = min => `${packageName}-${version}${min ? ".min" : ''}.js`;

// Path helpers
const rootPath = path.resolve(__dirname, "../..");
const resolveFromRootPath = (...args) => path.join(rootPath, ...args);

// Export constants
exports.srcPath = resolveFromRootPath("src");
exports.buildPath = resolveFromRootPath("build",);
exports.distPath = resolveFromRootPath("build", "dist");
exports.version = version;
exports.packageNameCamelCase = packageNameCamelCase;
exports.getBundleFileName = getBundleFileName;
30 changes: 30 additions & 0 deletions config/webpack/webpack.common.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const helpers = require('./helpers');

module.exports = (env, argv) => {
const minimizeBundle = Boolean(argv['optimize-minimize']);

return {
entry: ['./src/index.js'],
output: {
path: helpers.distPath,
filename: helpers.getBundleFileName(minimizeBundle),
library: helpers.packageNameCamelCase,
libraryTarget: 'umd',
},
externals: {
react: 'react',
},
optimization: {
minimize: minimizeBundle,
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
},
],
},
};
};
7 changes: 7 additions & 0 deletions config/webpack/webpack.dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const merge = require('webpack-merge');
const commonConfig = require('./webpack.common.js');

module.exports = (env, argv) => merge(commonConfig(env, argv), {
mode: 'development',
devtool: 'inline-source-map',
});
17 changes: 17 additions & 0 deletions config/webpack/webpack.prod.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const merge = require('webpack-merge');
const commonConfig = require('./webpack.common.js');
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
const CompressionPlugin = require('compression-webpack-plugin');

module.exports = (env, argv) => merge(commonConfig(env, argv), {
mode: 'production',
devtool: 'none',
plugins: [
new BundleAnalyzerPlugin({
analyzerMode: "static",
openAnalyzer: false,
reportFilename: "report/report.html",
}),
new CompressionPlugin(),
],
});
11 changes: 11 additions & 0 deletions examples/00-example-basic/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"presets": [
"@babel/preset-react",
[
"@babel/preset-env",
{
"useBuiltIns": "entry"
}
]
]
}
34 changes: 34 additions & 0 deletions examples/00-example-basic/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "webpack-by-example",
"version": "1.0.0",
"description": "In this sample we are going to setup a web project that can be easily managed\r by webpack.",
"main": "index.js",
"scripts": {
"start": "webpack-dev-server --mode development --open",
"build": "rimraf dist && webpack --mode development",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"@babel/cli": "^7.2.3",
"@babel/core": "^7.4.0",
"@babel/preset-env": "^7.4.0",
"@babel/preset-react": "^7.0.0",
"babel-loader": "^8.0.5",
"css-loader": "^2.1.1",
"html-webpack-plugin": "^3.2.0",
"mini-css-extract-plugin": "^0.5.0",
"rimraf": "^2.6.3",
"style-loader": "^0.23.1",
"webpack": "^4.29.6",
"webpack-cli": "^3.3.0",
"webpack-dev-server": "^3.2.1"
},
"dependencies": {
"react": "^16.8.4",
"react-dom": "^16.8.4",
"react-loader-spinner": "^2.3.0",
"react-promise-tracker": "file:../../build"
}
}
12 changes: 12 additions & 0 deletions examples/00-example-basic/src/api/fetch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export const fetchWithDelay = (url) => {
const promise = new Promise((resolve, reject) => {
setTimeout(() => {
resolve(fetch(url, {
method: 'GET',
})
.then((response) => response.json()));
}, 3000)
});

return promise;
}
9 changes: 9 additions & 0 deletions examples/00-example-basic/src/api/postAPI.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { fetchWithDelay } from './fetch';
const url = 'https://jsonplaceholder.typicode.com/posts';

const fetchPosts = () => fetchWithDelay(url)
.then((posts) => posts.slice(0, 10));

export const postAPI = {
fetchPosts,
};
8 changes: 8 additions & 0 deletions examples/00-example-basic/src/api/userAPI.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { fetchWithDelay } from './fetch';
const url = 'https://jsonplaceholder.typicode.com/users';

const fetchUsers = () => fetchWithDelay(url);

export const userAPI = {
fetchUsers,
};
11 changes: 11 additions & 0 deletions examples/00-example-basic/src/app.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.tables {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
}

.tables > div {
flex-basis: 50%;
margin-left: 1rem;
margin-right: 1rem;
}
Loading