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

allow specification of package.main in template.json #8539

Merged
merged 1 commit into from
Feb 29, 2020

Conversation

EvanBoyle
Copy link
Contributor

Fixes #8373

I'm creating a template to work with pulumi. Pulumi programs need to have a main specified in the package.json in order to work (example). CRA currently blacklists/sanitizes main declarations which is preventing the generation of fully functional apps.

This change allows specification of the main field in template.json.

Testing was done by modifying the typescript template to include a main, and then running:

$ yarn create-react-app foo --template file:./packages/cra-template-typescript

which resulted in:

$ create-react-cloud evanboyle$ cat foo/package.json 
{
  "name": "foo",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.3.2",
    "@testing-library/user-event": "^7.1.2",
    "@types/jest": "^24.0.0",
    "@types/node": "^12.0.0",
    "@types/react": "^16.9.0",
    "@types/react-dom": "^16.9.0",
    "react": "^16.12.0",
    "react-dom": "^16.12.0",
    "react-scripts": "/Users/evanboyle/code/create-react-cloud/packages/react-scripts/react-scripts-3.4.0.tgz",
    "typescript": "~3.7.2"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "main": "indes.js"
}

@facebook-github-bot
Copy link

Hi @EvanBoyle!

Thank you for your pull request and welcome to our community.We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file.

In order for us to review and merge your code, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@EvanBoyle
Copy link
Contributor Author

CLA signed.

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@EvanBoyle
Copy link
Contributor Author

@ianschmitz would you mind taking a look at this?

@ianschmitz ianschmitz added this to the 3.4.1 milestone Feb 28, 2020
@ianschmitz
Copy link
Contributor

Looks good. @mrmckeb any concerns?

Copy link
Contributor

@mrmckeb mrmckeb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, @ianschmitz!

@mrmckeb mrmckeb merged commit 8ba0ccb into facebook:master Feb 29, 2020
@lock lock bot locked and limited conversation to collaborators Mar 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow "main" field in template.js to populate destination template's package.json
4 participants