Skip to content

Commit 923e2cf

Browse files
committed
Updates based on PR feedback
1 parent 52b36f3 commit 923e2cf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+121
-72
lines changed

docusaurus/docs/adding-typescript.md

Lines changed: 4 additions & 3 deletions

docusaurus/docs/getting-started.md

Lines changed: 23 additions & 3 deletions
Lines changed: 20 additions & 0 deletions
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "cra-template-typescript",
3+
"version": "1.0.0",
4+
"keywords": [
5+
"react",
6+
"create-react-app",
7+
"template",
8+
"typescript"
9+
],
10+
"description": "The base TypeScript template for Create React App.",
11+
"repository": {
12+
"type": "git",
13+
"url": "https://github.com/facebook/create-react-app.git",
14+
"directory": "packages/cra-template-typescript"
15+
},
16+
"license": "MIT",
17+
"engines": {
18+
"node": ">=8"
19+
},
20+
"bugs": {
21+
"url": "https://github.com/facebook/create-react-app/issues"
22+
},
23+
"files": [
24+
"template",
25+
"template.json"
26+
]
27+
}

packages/cra-template/README.md

Lines changed: 10 additions & 0 deletions

packages/cra-template/package.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"name": "cra-template",
3+
"version": "1.0.0",
4+
"keywords": [
5+
"react",
6+
"create-react-app",
7+
"template"
8+
],
9+
"description": "The base template for Create React App.",
10+
"repository": {
11+
"type": "git",
12+
"url": "https://github.com/facebook/create-react-app.git",
13+
"directory": "packages/cra-template"
14+
},
15+
"license": "MIT",
16+
"engines": {
17+
"node": ">=8"
18+
},
19+
"bugs": {
20+
"url": "https://github.com/facebook/create-react-app/issues"
21+
},
22+
"files": [
23+
"template",
24+
"template.json"
25+
]
26+
}

packages/create-react-app-template-typescript/package.json

Lines changed: 0 additions & 27 deletions
This file was deleted.

packages/create-react-app-template/package.json

Lines changed: 0 additions & 26 deletions
This file was deleted.

packages/create-react-app/createReactApp.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ const program = new commander.Command(packageJson.name)
7878
)
7979
.option(
8080
'--template <path-to-template>',
81-
'specify or use a non-standard template'
81+
'specify a template for the created project'
8282
)
8383
.option('--use-npm')
8484
.option('--use-pnp')
@@ -443,14 +443,18 @@ function run(
443443
)
444444
.then(({ isOnline, packageInfo, templateInfo }) => {
445445
let packageVersion = packageInfo.version;
446+
const templatesVersionMinimum = '3.3.0';
446447

447448
// Assume compatibility if we can't test the version.
448449
if (!semver.valid(packageVersion)) {
449-
packageVersion = '3.2.0';
450+
packageVersion = templatesVersionMinimum;
450451
}
451452

452453
// Only support templates when used alongside new react-scripts versions.
453-
const supportsTemplates = semver.gte(packageVersion, '3.2.0');
454+
const supportsTemplates = semver.gte(
455+
packageVersion,
456+
templatesVersionMinimum
457+
);
454458
if (supportsTemplates) {
455459
allDependencies.push(templateToInstall);
456460
} else if (template) {
@@ -628,7 +632,7 @@ function getInstallPackage(version, originalDirectory) {
628632
}
629633

630634
function getTemplateInstallPackage(template, originalDirectory) {
631-
let templateToInstall = 'create-react-app-template';
635+
let templateToInstall = 'cra-template';
632636
if (template) {
633637
if (template.match(/^file:/)) {
634638
templateToInstall = `file:${path.resolve(
@@ -642,7 +646,7 @@ function getTemplateInstallPackage(template, originalDirectory) {
642646
// for tar.gz or alternative paths
643647
templateToInstall = template;
644648
} else if (!template.startsWith(templateToInstall)) {
645-
// Add prefix `create-react-app-template` to non-prefixed templates.
649+
// Add prefix `cra-template` to non-prefixed templates.
646650
templateToInstall += `-${template}`;
647651
}
648652
}

packages/react-scripts/config/paths.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ if (
132132
!reactScriptsLinked &&
133133
__dirname.indexOf(path.join('packages', 'react-scripts', 'config')) !== -1
134134
) {
135-
const templatePath = '../create-react-app-template/template';
135+
const templatePath = '../cra-template/template';
136136
module.exports = {
137137
dotenv: resolveOwn(`${templatePath}/.env`),
138138
appPath: resolveApp('.'),

packages/react-scripts/scripts/init.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,7 @@ module.exports = function(
151151
const readme = fs.readFileSync(path.join(appPath, 'README.md'), 'utf8');
152152
fs.writeFileSync(
153153
path.join(appPath, 'README.md'),
154-
readme
155-
.replace(/npm start/g, 'yarn start')
156-
.replace(/npm test/g, 'yarn test')
157-
.replace(/npm run build/g, 'yarn build')
158-
.replace(/npm run eject/g, 'yarn eject'),
154+
readme.replace(/(npm run |npm )/g, 'yarn '),
159155
'utf8'
160156
);
161157
} catch (err) {

tasks/e2e-installs.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,6 @@ exists tsconfig.json
162162
exists src/react-app-env.d.ts
163163
checkTypeScriptDependencies
164164

165-
node node_modules/react-scripts/scripts/utils/verifyTypeScriptSetup.js
166-
167165
# Check that the TypeScript template passes smoke tests, build, and normal tests
168166
yarn start --smoke-test
169167
yarn build

0 commit comments

Comments
 (0)