Skip to content
Merged
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
28 changes: 28 additions & 0 deletions tasks/bundle-own-deps.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env node
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';

// Like bundle-deps, this script modifies packages/react-scripts/package.json,
// copying own dependencies (those in the `packages` dir) to bundledDependencies

const fs = require('fs');
const path = require('path');

const packagesDir = path.join(__dirname, '../packages');
const pkgFilename = path.join(packagesDir, 'react-scripts/package.json');
const data = require(pkgFilename);

data.bundledDependencies = fs.readdirSync(packagesDir)
.filter((name) => data.dependencies[name]);

fs.writeFile(pkgFilename, JSON.stringify(data, null, 2), 'utf8', (err) => {
if (err) throw err;
console.log('bundled ' + data.bundledDependencies.length + ' dependencies.');
});
5 changes: 3 additions & 2 deletions tasks/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,9 @@ $root_path/node_modules/.bin/lerna bootstrap

cd $clean_path/packages/react-scripts

# This modifies package.json to copy all dependencies to bundledDependencies
node ./node_modules/.bin/bundle-deps
# Like bundle-deps, this script modifies packages/react-scripts/package.json,
# copying own dependencies (those in the `packages` dir) to bundledDependencies
node $clean_path/tasks/bundle-own-deps.js

# Finally, pack react-scripts
scripts_path=$clean_path/packages/react-scripts/`npm pack`
Expand Down