-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5357 from apollographql/hello-react-apollo
Merge React Apollo hooks into Apollo Client
- Loading branch information
Showing
65 changed files
with
8,734 additions
and
2,798 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// The Apollo Client source that is published to npm is located in the | ||
// "dist" directory. This utility script is called just before deploying | ||
// Apollo Client, to make sure the "dist" directory is prepared for publishing. | ||
// | ||
// This script will: | ||
// | ||
// - Copy the current root package.json into "dist" after adjusting it for | ||
// publishing. | ||
// - Copy the supporting files from the root into "dist" (e.g. `README.MD`, | ||
// `LICENSE`, etc.) | ||
|
||
const packageJson = require('../package.json'); | ||
const fs = require('fs'); | ||
|
||
// The root package.json is marked as private to prevent publishing | ||
// from happening in the root of the project. This sets the package back to | ||
// public so it can be published from the "dist" directory. | ||
packageJson.private = false; | ||
|
||
// Remove package.json items that we don't need to publish | ||
delete packageJson.scripts; | ||
delete packageJson.bundlesize; | ||
|
||
// The root package.json points to the CJS/ESM source in "dist", to support | ||
// on-going package development (e.g. running tests, supporting npm link, etc.). | ||
// When publishing from "dist" however, we need to update the package.json | ||
// to point to the files within the same directory. | ||
const distPackageJson = JSON.stringify( | ||
packageJson, | ||
(_key, value) => ( | ||
typeof value === 'string' ? value.replace(/\.\/dist\//, '') : value | ||
), | ||
2 | ||
); | ||
|
||
// Save the modified package.json to "dist" | ||
fs.writeFileSync(`${__dirname}/../dist/package.json`, distPackageJson); | ||
|
||
// Copy supporting files into "dist" | ||
const srcDir = `${__dirname}/..`; | ||
const destDir = `${srcDir}/dist`; | ||
fs.copyFileSync(`${srcDir}/README.md`, `${destDir}/README.md`); | ||
fs.copyFileSync(`${srcDir}/LICENSE`, `${destDir}/LICENSE`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.