Skip to content

Commit

Permalink
config & package changes to book chapters
Browse files Browse the repository at this point in the history
  • Loading branch information
delgermurun committed Oct 10, 2019
1 parent a00a9f7 commit e99d3b7
Show file tree
Hide file tree
Showing 133 changed files with 72,073 additions and 56,943 deletions.
1 change: 0 additions & 1 deletion app/components/common/ActiveLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ const ActiveLink = ({

const trimmingLength = 20;

// TODO: solve TS warning
return (
<Link href={href} as={as}>
<a
Expand Down
12 changes: 6 additions & 6 deletions app/next.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const dotenv = require("dotenv");
const fs = require("fs");
const webpack = require("webpack");
const dotenv = require('dotenv');
const fs = require('fs');
const webpack = require('webpack');

var current = { ...process.env };
const result = dotenv.config();
Expand All @@ -10,7 +10,7 @@ if (!result.error) {

var blueprint = { NODE_ENV: process.env.NODE_ENV };
try {
blueprint = { ...blueprint, ...dotenv.parse(fs.readFileSync("./.env.blueprint", "utf8")) };
blueprint = { ...blueprint, ...dotenv.parse(fs.readFileSync('./.env.blueprint', 'utf8')) };
} catch (err) {
console.log(err);
}
Expand All @@ -27,11 +27,11 @@ const config = {
...config.plugins,

// Read the .env file
new webpack.DefinePlugin(rules)
new webpack.DefinePlugin(rules),
];

return config;
}
},
};

module.exports = config;
12 changes: 6 additions & 6 deletions book/1-end/app/next.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const dotenv = require("dotenv");
const fs = require("fs");
const webpack = require("webpack");
const dotenv = require('dotenv');
const fs = require('fs');
const webpack = require('webpack');

var current = { ...process.env };
const result = dotenv.config();
Expand All @@ -10,7 +10,7 @@ if (!result.error) {

var blueprint = { NODE_ENV: process.env.NODE_ENV };
try {
blueprint = { ...blueprint, ...dotenv.parse(fs.readFileSync("./.env.blueprint", "utf8")) };
blueprint = { ...blueprint, ...dotenv.parse(fs.readFileSync('./.env.blueprint', 'utf8')) };
} catch (err) {
console.log(err);
}
Expand All @@ -27,11 +27,11 @@ const config = {
...config.plugins,

// Read the .env file
new webpack.DefinePlugin(rules)
new webpack.DefinePlugin(rules),
];

return config;
}
},
};

module.exports = config;
2 changes: 2 additions & 0 deletions book/10-begin/app/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
17 changes: 8 additions & 9 deletions book/10-begin/app/next.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
const dotenv = require('dotenv');
const fs = require('fs');
const withTypescript = require('@zeit/next-typescript');
const webpack = require('webpack');


var current = { ...process.env };
const result = dotenv.config();
if (!result.error) {
Expand All @@ -18,21 +16,22 @@ try {
}
const rules = Object.keys(blueprint).reduce((obj, key) => {
obj[`process.env.${key}`] = JSON.stringify(current[key]);
return obj
return obj;
}, {});

const config = {
webpack: config => {
config.plugins = config.plugins || []
config.plugins = config.plugins || [];

config.plugins = [
...config.plugins,

// Read the .env file
new webpack.DefinePlugin(rules)
]
new webpack.DefinePlugin(rules),
];

return config
}
return config;
},
};
module.exports = withTypescript(config);

module.exports = config;
22 changes: 11 additions & 11 deletions book/10-begin/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"@material-ui/core": "4.1.3",
"@material-ui/styles": "^4.1.2",
"@types/node": "12.0.10",
"@zeit/next-typescript": "1.1.1",
"dotenv": "^8.0.0",
"downshift": "3.2.10",
"express": "4.17.1",
Expand All @@ -31,17 +30,18 @@
"keycode": "^2.2.0",
"lodash": "4.17.11",
"marked": "0.6.3",
"mobx": "5.10.1",
"mobx-react": "6.1.1",
"mobx": "5.14.0",
"mobx-react": "6.1.3",
"moment": "2.24.0",
"next": "8.1.0",
"next": "9.1.1",
"nprogress": "0.2.0",
"react": "16.8.6",
"react-dom": "16.8.6",
"react": "16.10.2",
"react-dom": "16.10.2",
"react-jss": "8.6.1",
"react-mentions": "3.0.2",
"react-stripe-checkout": "2.6.3",
"socket.io-client": "^2.2.0",
"typescript": "3.5.2"
"typescript": "3.6.3"
},
"devDependencies": {
"@types/express": "4.17.0",
Expand All @@ -51,15 +51,15 @@
"@types/lodash": "4.14.135",
"@types/marked": "0.6.5",
"@types/material-ui": "0.21.6",
"@types/next": "8.0.5",
"@types/nprogress": "0.2.0",
"@types/react": "16.8.22",
"@types/react-dom": "16.8.4",
"@types/react-jss": "8.6.3",
"@types/socket.io-client": "^1.4.32",
"@types/styled-jsx": "2.2.8",
"jest": "24.8.0",
"nodemon": "^1.19.1",
"ts-node": "8.3.0",
"ts-node": "8.4.1",
"ts-node-dev": "^1.0.0-pre.40",
"tslint": "5.18.0"
"tslint": "5.20.0"
}
}
22 changes: 20 additions & 2 deletions book/10-begin/app/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,25 @@
"skipLibCheck": true,
"baseUrl": ".",
"typeRoots": ["./node_modules/@types"],
"lib": ["dom", "es2015", "es2016"]
"lib": ["dom", "es2017"],
"strict": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"isolatedModules": true
},
"exclude": ["production-server", ".next", "next.config.js"]
"include": [
"next-env.d.ts",
"./**/*.tsx",
"./**/*.ts"
],
"exclude": [
"dist",
"production-server",
".next",
"out",
"next.config.js",
"node_modules"
]
}
Loading

0 comments on commit e99d3b7

Please sign in to comment.