Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update template and dependencies for ServiceMax #2629

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions packages/react-scripts/config/jest/babelTransform.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,9 @@ const babelJest = require('babel-jest');
module.exports = babelJest.createTransformer({
presets: [require.resolve('babel-preset-react-app')],
babelrc: false,
plugins: [
['module-resolver', {
root: ['./src']
}]
],
});
9 changes: 8 additions & 1 deletion packages/react-scripts/config/webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ module.exports = {
/\.gif$/,
/\.jpe?g$/,
/\.png$/,
/\.scss$/,
],
loader: require.resolve('file-loader'),
options: {
Expand All @@ -192,6 +193,11 @@ module.exports = {
// @remove-on-eject-begin
babelrc: false,
presets: [require.resolve('babel-preset-react-app')],
plugins: [
['module-resolver', {
root: ['./src']
}]
],
// @remove-on-eject-end
// This is a feature of `babel-loader` for webpack (not Babel itself).
// It enables caching results in ./node_modules/.cache/babel-loader/
Expand All @@ -205,7 +211,7 @@ module.exports = {
// In production, we use a plugin to extract that CSS to a file, but
// in development "style" loader enables hot editing of CSS.
{
test: /\.css$/,
test: /\.scss$/,
use: [
require.resolve('style-loader'),
{
Expand All @@ -214,6 +220,7 @@ module.exports = {
importLoaders: 1,
},
},
require.resolve('sass-loader'),
{
loader: require.resolve('postcss-loader'),
options: {
Expand Down
14 changes: 13 additions & 1 deletion packages/react-scripts/config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ module.exports = {
/\.gif$/,
/\.jpe?g$/,
/\.png$/,
/\.scss$/,
],
loader: require.resolve('file-loader'),
options: {
Expand All @@ -190,6 +191,11 @@ module.exports = {
options: {
babelrc: false,
presets: [require.resolve('babel-preset-react-app')],
plugins: [
['module-resolver', {
root: ['./src']
}]
],
},
// @remove-on-eject-end
},
Expand All @@ -206,7 +212,7 @@ module.exports = {
// use the "style" loader inside the async code so CSS from them won't be
// in the main CSS file.
{
test: /\.css$/,
test: /\.scss$/,
loader: ExtractTextPlugin.extract(
Object.assign(
{
Expand All @@ -220,6 +226,12 @@ module.exports = {
sourceMap: true,
},
},
{
loader: require.resolve('sass-loader'),
options: {
sourceMap: true,
},
},
{
loader: require.resolve('postcss-loader'),
options: {
Expand Down
33 changes: 21 additions & 12 deletions packages/react-scripts/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "react-scripts",
"version": "1.0.6",
"description": "Configuration and scripts for Create React App.",
"repository": "facebookincubator/create-react-app",
"name": "svmx-react-scripts",
"version": "1.1.18",
"description": "ServiceMax Configuration and scripts for Create React App.",
"repository": "ServiceMax-Engineering/create-react-app",
"license": "BSD-3-Clause",
"engines": {
"node": ">=6"
Expand All @@ -20,36 +20,48 @@
"bin": {
"react-scripts": "./bin/react-scripts.js"
},
"homepage": "./",
"dependencies": {
"autoprefixer": "7.1.0",
"babel-core": "6.24.1",
"babel-eslint": "7.2.3",
"babel-jest": "20.0.3",
"babel-loader": "7.0.0",
"babel-preset-react-app": "^3.0.0",
"babel-plugin-module-resolver": "2.7.1",
"babel-preset-flow": "6.23.0",
"babel-preset-react-app": "3.0.0",
"babel-runtime": "6.23.0",
"case-sensitive-paths-webpack-plugin": "1.1.4",
"chalk": "1.1.3",
"css-loader": "0.28.1",
"dotenv": "4.0.0",
"enzyme": "2.9.0",
"eslint": "3.19.0",
"eslint-config-react-app": "^1.0.4",
"eslint-config-airbnb": "15.0.1",
"eslint-config-react-app": "1.0.4",
"eslint-import-resolver-babel-module": "3.0.0",
"eslint-loader": "1.7.1",
"eslint-plugin-flowtype": "2.33.0",
"eslint-plugin-import": "2.2.0",
"eslint-plugin-jsx-a11y": "5.0.3",
"eslint-plugin-react": "7.0.1",
"extract-text-webpack-plugin": "2.1.0",
"file-loader": "0.11.1",
"flow-bin": "0.48.0",
"fs-extra": "3.0.1",
"html-webpack-plugin": "2.28.0",
"jest": "20.0.3",
"node-sass": "4.5.3",
"object-assign": "4.1.1",
"postcss-flexbugs-fixes": "3.0.0",
"postcss-loader": "2.0.5",
"prettier": "1.4.4",
"prettier-eslint-cli": "4.1.1",
"promise": "7.1.1",
"react-dev-utils": "^2.0.1",
"react-error-overlay": "^1.0.6",
"react-dev-utils": "2.0.1",
"react-error-overlay": "1.0.6",
"react-test-renderer": "15.6.1",
"sass-loader": "6.0.6",
"style-loader": "0.17.0",
"sw-precache-webpack-plugin": "0.9.1",
"url-loader": "0.5.8",
Expand All @@ -58,10 +70,7 @@
"webpack-manifest-plugin": "1.1.0",
"whatwg-fetch": "2.0.3"
},
"devDependencies": {
"react": "^15.5.4",
"react-dom": "^15.5.4"
},
"devDependencies": {},
"optionalDependencies": {
"fsevents": "1.0.17"
}
Expand Down
10 changes: 7 additions & 3 deletions packages/react-scripts/scripts/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ module.exports = function(
)).name;
const ownPath = path.join(appPath, 'node_modules', ownPackageName);
const appPackage = require(path.join(appPath, 'package.json'));
const useYarn = fs.existsSync(path.join(appPath, 'yarn.lock'));
// ServiceMax Note: we prefer npm, for now
const useYarn = false; //fs.existsSync(path.join(appPath, 'yarn.lock'));

// Copy over some of the devDependencies
appPackage.dependencies = appPackage.dependencies || {};
Expand All @@ -47,6 +48,8 @@ module.exports = function(
build: 'react-scripts build',
test: 'react-scripts test --env=jsdom',
eject: 'react-scripts eject',
lint: 'NODE_ENV=development eslint js test *.js',
prettier: 'NODE_ENV=development prettier-eslint --write \"src/**/*.js\"',
};

fs.writeFileSync(
Expand Down Expand Up @@ -125,8 +128,9 @@ module.exports = function(
// Install react and react-dom for backward compatibility with old CRA cli
// which doesn't install react and react-dom along with react-scripts
// or template is presetend (via --internal-testing-template)
if (!isReactInstalled(appPackage) || template) {
console.log(`Installing react and react-dom using ${command}...`);
// ServiceMax Note: always do this because we need template dependencies
if (true || !isReactInstalled(appPackage) || template) {
console.log(`Installing template dependencies using ${command}...`);
console.log();

const proc = spawn.sync(command, args, { stdio: 'inherit' });
Expand Down
34 changes: 34 additions & 0 deletions packages/react-scripts/template/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"env": {
"browser": true
},
"extends": [
"react-app",
"airbnb"
],
"parser": "babel-eslint",
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true
},
"sourceType": "module"
},
"rules": {
"no-unused-vars": "warn",
"no-debugger": "warn",
"no-console": "warn",
"import/no-named-as-default": "off",
"import/prefer-default-export": "off",
"import/first": "off",
"react/jsx-filename-extension": "off",
"react/prefer-stateless-function": "off",
"react/jsx-closing-bracket-location": [1, "props-aligned"],
"react/require-default-props": "off"
},
"settings": {
"import/resolver": {
"babel-module": {}
}
}
}
9 changes: 9 additions & 0 deletions packages/react-scripts/template/.flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[ignore]

[include]

[libs]

[options]
module.system.node.resolve_dirname=node_modules
module.system.node.resolve_dirname=src
13 changes: 13 additions & 0 deletions packages/react-scripts/template/.template.dependencies.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"dependencies": {
"lodash": "4.17.4",
"prop-types": "15.5.10",
"react-redux": "5.0.5",
"react-router": "4.1.1",
"react-router-dom": "4.1.1",
"redux": "3.6.0",
"redux-mock-store": "1.2.3",
"redux-promise": "0.5.3",
"redux-thunk": "2.2.0"
}
}
Loading