Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Nargonath committed May 4, 2019
2 parents 25c413f + 334680e commit 0df32ac
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.11.1
8.15.0
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ As of now (20/04/2018), `create-react-app` (more precisely `react-scripts`) does

# Prerequisites

Supports `react-scripts >= 1.0.x`, hence it supports the newest version `2.x.x`.
Supports `react-scripts >= 1.0.x`, hence it supports the newest version `3.x.x`.

# Installation

Expand Down
12 changes: 4 additions & 8 deletions scripts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ const {
} = require('../utils/cliHandler');
const { getReactScriptsVersion, isEjected } = require('../utils');

const { major, minor, patch } = getReactScriptsVersion(reactScriptsVersion);
const { major, concatenatedVersion } = getReactScriptsVersion(reactScriptsVersion);

const paths = isEjected ? importCwd('./config/paths') : importCwd('react-scripts/config/paths');
const webpack = importCwd('webpack');

const config =
major >= 2 && minor >= 1 && patch >= 2
concatenatedVersion >= 212
? (isEjected
? importCwd('./config/webpack.config')
: importCwd('react-scripts/config/webpack.config'))('development')
Expand Down Expand Up @@ -65,12 +65,8 @@ if (major >= 2) {
// 2.0.1 => 3
// 2.0.2 => 3
// 2.0.3 => 3
// 2.0.4 => 2
// 2.1.0 => 2
// 2.1.1 => 2
// 2.1.2 => 2
// 2.1.3 => 2
const oneOfIndex = minor === 0 && patch < 4 && patch >= 1 ? 3 : 2;
// 2.0.4 to 3.0.0 => 2
const oneOfIndex = concatenatedVersion === 200 || concatenatedVersion >= 204 ? 2 : 3;
config.module.rules[oneOfIndex].oneOf[0].options.name = `media/[name].[hash:8].[ext]`;
config.module.rules[oneOfIndex].oneOf[7].options.name = `media/[name].[hash:8].[ext]`;
} else {
Expand Down
7 changes: 7 additions & 0 deletions utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const DEFAULT_VERSION = {
major: 2,
minor: 1,
patch: 2,
concatenatedVersion: 212,
};

exports.isEjected = fs.pathExistsSync(path.join(process.cwd(), 'config/paths.js'));
Expand All @@ -19,6 +20,9 @@ exports.getReactScriptsVersion = function getReactScriptsVersion(cliVersion) {
major: Number(semver.major(cliVersion)),
minor: Number(semver.minor(cliVersion)),
patch: Number(semver.patch(cliVersion)),
concatenatedVersion: Number(
`${semver.major(cliVersion)}${semver.minor(cliVersion)}${semver.patch(cliVersion)}`
),
};
return versions;
}
Expand All @@ -33,6 +37,9 @@ exports.getReactScriptsVersion = function getReactScriptsVersion(cliVersion) {
major: Number(semver.major(version)),
minor: Number(semver.minor(version)),
patch: Number(semver.patch(version)),
concatenatedVersion: Number(
`${semver.major(version)}${semver.minor(version)}${semver.patch(version)}`
),
};
return versions;
};

0 comments on commit 0df32ac

Please sign in to comment.