The Wayback Machine - https://web.archive.org/web/20230517004734/https://github.com/teambit/bit/commit/e092c091ad6a958786639567c1becf6ad7edb347
Skip to content
Permalink
Browse files Browse the repository at this point in the history
enable tree shaking for Ramda to avoid loading the entire lib (#4405)
This is done by adding babel-plugin-ramda to the babel config.
  • Loading branch information
davidfirst committed Jun 9, 2021
1 parent a604c99 commit e092c09
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
1 change: 1 addition & 0 deletions babel.config.js
Expand Up @@ -16,6 +16,7 @@ module.exports = function (api) {
],
];
const plugins = [
'ramda',
[
'@babel/plugin-transform-modules-commonjs',
{
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -273,6 +273,7 @@
"@typescript-eslint/parser": "4.15.1",
"@typescript-eslint/typescript-estree": "4.15.1",
"babel-eslint": "9.0.0",
"babel-plugin-ramda": "2.0.0",
"babel-plugin-transform-typescript-metadata": "0.3.1",
"chai": "4.3.0",
"chai-arrays": "1.1.0",
Expand Down
5 changes: 2 additions & 3 deletions scopes/pipelines/builder/build-pipeline-order.ts
@@ -1,4 +1,3 @@
import R from 'ramda';
import { Graph } from 'cleargraph';
import TesterAspect from '@teambit/tester';
import { EnvDefinition, Environment } from '@teambit/envs';
Expand Down Expand Up @@ -66,7 +65,7 @@ export function calculatePipelineOrder(
pipelineEnvs.push({ env: envDefinition, pipeline });
});

const flattenedPipeline: BuildTask[] = R.flatten(pipelineEnvs.map((pipelineEnv) => pipelineEnv.pipeline));
const flattenedPipeline: BuildTask[] = pipelineEnvs.map((pipelineEnv) => pipelineEnv.pipeline).flat();
flattenedPipeline.forEach((task) => addDependenciesToGraph(graphs, flattenedPipeline, task));

const dataPerLocation: DataPerLocation[] = graphs.map(({ location, graph }) => {
Expand Down Expand Up @@ -176,7 +175,7 @@ which is invalid. the dependency must be located earlier or in the same location

function getPipelineForEnv(taskSlot: TaskSlot, env: Environment, pipeNameOnEnv: string): BuildTask[] {
const buildTasks: BuildTask[] = env[pipeNameOnEnv] ? env[pipeNameOnEnv]() : [];
const slotsTasks = R.flatten(taskSlot.values());
const slotsTasks = taskSlot.values().flat();
const tasksAtStart: BuildTask[] = [];
const tasksAtEnd: BuildTask[] = [];
slotsTasks.forEach((task) => {
Expand Down
5 changes: 2 additions & 3 deletions scopes/pkg/pkg/publisher.ts
Expand Up @@ -10,7 +10,6 @@ import { BitError } from '@teambit/bit-error';
import { Scope } from '@teambit/legacy/dist/scope';
import mapSeries from 'p-map-series';
import execa from 'execa';
import R from 'ramda';
import { PkgAspect } from './pkg.aspect';

export type PublisherOptions = {
Expand Down Expand Up @@ -57,8 +56,8 @@ export class Publisher {
if (this.options.dryRun) publishParams.push('--dry-run');
const extraArgs = this.getExtraArgsFromConfig(capsule.component);
if (extraArgs && Array.isArray(extraArgs) && extraArgs?.length) {
const extraArgsSplit = extraArgs.map((arg) => arg.split(' '));
publishParams.push(...R.flatten(extraArgsSplit));
const extraArgsSplit = extraArgs.map((arg) => arg.split(' ')).flat();
publishParams.push(...extraArgsSplit);
}
const publishParamsStr = publishParams.join(' ');
const cwd = capsule.path;
Expand Down
3 changes: 1 addition & 2 deletions scopes/workspace/eject/components-ejector.ts
Expand Up @@ -8,7 +8,6 @@
* removing the component files, so then it's easier to rollback.
*/
import { Workspace } from '@teambit/workspace';
import R from 'ramda';
import { Consumer } from '@teambit/legacy/dist/consumer';
import { BitId, BitIds } from '@teambit/legacy/dist/bit-id';
import defaultErrorHandler from '@teambit/legacy/dist/cli/default-error-handler';
Expand Down Expand Up @@ -86,7 +85,7 @@ export class ComponentsEjector {

async decideWhichComponentsToEject(): Promise<void> {
this.logger.setStatusLine('Eject: getting the components status');
if (R.isEmpty(this.componentsIds)) return;
if (!this.componentsIds.length) return;
const remotes = await getScopeRemotes(this.consumer.scope);
const hubExportedComponents = new BitIds();
this.componentsIds.forEach((bitId) => {
Expand Down
3 changes: 2 additions & 1 deletion src/scope/models/model-component.ts
@@ -1,4 +1,5 @@
import { clone, equals, forEachObjIndexed, isEmpty } from 'ramda';
import { clone, equals, forEachObjIndexed } from 'ramda';
import { isEmpty } from 'lodash';
import * as semver from 'semver';
import { versionParser, isHash, isTag } from '@teambit/component-version';
import { v4 } from 'uuid';
Expand Down

0 comments on commit e092c09

Please sign in to comment.