Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
f2757aa
feat(envs): remove core envs from the manifest, load them as regular …
davidfirst Jul 2, 2026
c7dd1a7
fix(envs): load legacy core envs from installed packages instead of s…
davidfirst Jul 2, 2026
d9f77c0
fix(envs): enforce single instance for legacy core envs, silence expe…
davidfirst Jul 2, 2026
e6418b9
Merge branch 'master' into remove-core-envs-from-manifest
davidfirst Jul 2, 2026
c9eca3d
Merge branch 'master' into remove-core-envs-from-manifest
davidfirst Jul 2, 2026
a277cdb
feat(envs): add core EmptyEnv as the default env, restore react-free …
davidfirst Jul 2, 2026
3f5c24e
Merge branch 'remove-core-envs-from-manifest' of https://github.com/t…
davidfirst Jul 2, 2026
0607c7d
fix(envs): persist legacy core env config entries versionless, load e…
davidfirst Jul 3, 2026
b23b273
feat(envs): remove aspect and env envs from the core manifest
davidfirst Jul 6, 2026
94eddce
fix(workspace): resolve name-only legacy envs to their workspace vers…
davidfirst Jul 6, 2026
ac4b7d0
fix(generator): use the canonical symphony env id in the harmony work…
davidfirst Jul 6, 2026
ab21e34
refactor(compiler): avoid duplicate env resolution in missing-dists c…
davidfirst Jul 6, 2026
66fd06b
Merge branch 'master' into remove-core-envs-from-manifest
davidfirst Jul 6, 2026
5487276
fix(workspace): load versionless legacy env as the versioned workspac…
davidfirst Jul 6, 2026
684cdf6
fix(workspace): suppress legacy-env load failures only when the env p…
davidfirst Jul 6, 2026
47194d4
refactor(workspace): index-based dequeue in getGraphDescendants BFS
davidfirst Jul 6, 2026
3df0fcd
fix(react): avoid importing the react env in the apply-providers ui c…
davidfirst Jul 6, 2026
eedfdcd
fix(harmony): make load-aspect and unit tests work with the empty-env…
davidfirst Jul 6, 2026
efbc4e3
fix(envs): add a clear-error build() to the fallback compiler to sati…
davidfirst Jul 6, 2026
784c31a
fix(bitmap): remove stale legacy env configs resurrected by an earlie…
davidfirst Jul 6, 2026
d4c7969
fix(preview): skip env-template generation for envs without preview m…
davidfirst Jul 6, 2026
59ec61a
fix(workspace): skip env verification when setting a legacy core env
davidfirst Jul 6, 2026
df17985
Merge branch 'master' into remove-core-envs-from-manifest
davidfirst Jul 7, 2026
eafd77b
fix(envs): prefer the host component when fetching a legacy core env …
davidfirst Jul 7, 2026
b95165e
fix(envs): resolve variant-configured legacy core envs from the slot,…
davidfirst Jul 7, 2026
03511a4
fix(envs): match legacy core envs ignoring version in isEnvRegistered
davidfirst Jul 7, 2026
c91b190
fix(workspace): exclude seed ids from getDependentsIds results in cyc…
davidfirst Jul 7, 2026
edbdde7
fix(e2e): install legacy env packages in aspect-env and publish fixtures
davidfirst Jul 7, 2026
10a3995
fix(e2e): install the aspect env packages in the extensions-config fi…
davidfirst Jul 7, 2026
01ae6f4
fix(compiler): skip MissingDists issue when getCompiler returns undef…
davidfirst Jul 7, 2026
d269325
fix(e2e): install the node env package in the watch fixtures
davidfirst Jul 7, 2026
eacfcdf
fix(workspace): unwind the visiting set in resolveInstalledAspectRecu…
davidfirst Jul 7, 2026
dd6495d
refactor(envs): drop a stale eslint suppression comment
davidfirst Jul 7, 2026
f424a7a
fix(preview): treat legacy core envs as core in preview data calc and…
davidfirst Jul 7, 2026
1b5cc28
fix(install): avoid passing link deps to pnpm hoisted resolution, res…
davidfirst Jul 7, 2026
04b5578
fix(e2e): configure and install the node env in the app-root-componen…
davidfirst Jul 7, 2026
8464a63
fix(envs): use a cheap host lookup instead of listing all ids when re…
davidfirst Jul 7, 2026
a885155
fix(e2e): install the node env and strip ansi in the jest tester fixt…
davidfirst Jul 7, 2026
39351c4
fix(install): count non-loaded legacy core envs for the recurring-ins…
davidfirst Jul 7, 2026
ce0a7e2
fix(e2e): run a second install in app-root-components fixtures to app…
davidfirst Jul 7, 2026
d6e0cc5
fix(e2e): install the node env in test-harmony and validate fixtures
davidfirst Jul 7, 2026
2fe2be0
fix(e2e): run a second install in setNodeEnv to apply the env depende…
davidfirst Jul 7, 2026
cbde672
fix(e2e): install legacy env packages in env and reset command fixtures
davidfirst Jul 7, 2026
4163df4
docs(empty-env): add the aspect docs file
davidfirst Jul 7, 2026
37d3339
fix(e2e): install the node env in the scope-rename fixtures
davidfirst Jul 7, 2026
eac49fd
fix(e2e): install the node env and strip ansi in the merge-lanes loos…
davidfirst Jul 7, 2026
062ee3c
fix(compiler): skip env ids that are not on the workspace graph when …
davidfirst Jul 7, 2026
dc03518
fix(generator): merge builtin templates into a single slot registrati…
davidfirst Jul 7, 2026
dfa1e9a
fix(e2e): install legacy env packages and load ex-core templates via …
davidfirst Jul 7, 2026
288fd56
fix(envs): resolve variant-configured legacy core envs from the slot …
davidfirst Jul 7, 2026
8d88698
fix(e2e): run a second install after forking an env so its policies a…
davidfirst Jul 7, 2026
5d6c4f6
fix(scope): resolve and import only non-loaded aspects in getNonLoade…
davidfirst Jul 7, 2026
3480a1a
fix(deps): log the swallowed error when the env root dir cannot be de…
davidfirst Jul 7, 2026
ffeda69
fix(workspace): skip env-component fetch on env-set when the env is r…
davidfirst Jul 7, 2026
d312e5f
fix(envs): resolve versioned env ids registered versionless in the slot
davidfirst Jul 7, 2026
4c4cdf4
fix(generator): load template envs from the workspace instead of the …
davidfirst Jul 7, 2026
fcf852c
fix(e2e): install pinned envs and set the node env in multiple-envs, …
davidfirst Jul 7, 2026
8ed15ef
perf(envs): cache the legacy core envs ids list and set
davidfirst Jul 7, 2026
dca65ba
fix(workspace): resolve workspace aspects from their compiled workspa…
davidfirst Jul 7, 2026
829501b
fix(compiler): compile-and-retry aspects that fail loading on ts file…
davidfirst Jul 7, 2026
44619f9
fix(e2e): skip type-checking dev-repo fixtures in capsules, use core-…
davidfirst Jul 7, 2026
739d47e
fix(deps): anchor getRuntimeModulePath existence checks to the worksp…
davidfirst Jul 7, 2026
ec35199
fix(install): honor the scope-trust guard when reloading aspect plugi…
davidfirst Jul 7, 2026
bbbcac1
fix(workspace): load legacy core envs configured via envs-config with…
davidfirst Jul 7, 2026
8ff52c4
fix(envs): match versioned ids of versionless-registered envs in isEn…
davidfirst Jul 7, 2026
80b2a8e
fix(e2e): install pinned legacy envs and adjust default-env expectati…
davidfirst Jul 7, 2026
8781858
fix(workspace): require the compiled dist main when a stale source-ma…
davidfirst Jul 7, 2026
03bdd2c
fix(install): converge recurring-install for old-style workspace envs
davidfirst Jul 8, 2026
70a20c9
fix(e2e): install yarn-missing env peers, align old-envs install warn…
davidfirst Jul 8, 2026
0f48973
fix(workspace): match workspace aspects ignoring version when resolvi…
davidfirst Jul 8, 2026
449523c
fix(envs): match versionless env references against versioned slot re…
davidfirst Jul 8, 2026
e8d7c66
fix(generator): run recurring install during workspace generation to …
davidfirst Jul 8, 2026
40a6dbc
fix(e2e): use a workspace env in ci-commands env-set tests, explicit …
davidfirst Jul 8, 2026
123a5b3
fix(envs): return a copy of the legacy core envs ids list
davidfirst Jul 8, 2026
6d0af2d
fix(e2e): install the env chain in dev-deps and scope-aspect-capsule …
davidfirst Jul 8, 2026
53ad9f8
fix(e2e): skip type-checking node-env fixture in capsules, scope lint…
davidfirst Jul 8, 2026
e21c295
fix(e2e): revert env-chain install in scope-aspect-capsule fixture (t…
davidfirst Jul 8, 2026
0f796d9
fix(scope): break re-entrant aspect-load cycles with an in-flight guard
davidfirst Jul 8, 2026
9e969d2
fix(envs): recognize core envs in findFirstEnv before the core-aspect…
davidfirst Jul 8, 2026
f121f05
fix(e2e): remove accidentally committed .only from root-components
davidfirst Jul 8, 2026
3415ff8
chore: retrigger ci after transient bit.cloud 522
davidfirst Jul 8, 2026
caf30a0
fix(ci): cap node heap below the container memory limit in e2e runs
davidfirst Jul 8, 2026
698f97c
fix(workspace): widen the dist-main fallback to more source extensions
davidfirst Jul 8, 2026
fbe874f
fix(deps): anchor the bit-roots dir existence check to the workspace …
davidfirst Jul 8, 2026
2c95426
Revert "fix(ci): cap node heap below the container memory limit in e2…
davidfirst Jul 8, 2026
ff0a547
fix(workspace): try all parent chains when resolving installed aspects
davidfirst Jul 8, 2026
446416e
fix(envs): resolve versionless env references deterministically when …
davidfirst Jul 8, 2026
b34990a
fix(e2e): tolerate typescript 6 in tsconfig-mismatch fixtures, skip t…
davidfirst Jul 8, 2026
d4bb772
Merge remote-tracking branch 'origin/master' into remove-core-envs-fr…
davidfirst Jul 8, 2026
cd9e726
Merge remote-tracking branch 'origin/master' into remove-core-envs-fr…
davidfirst Jul 8, 2026
317f480
fix(scope): type loadCustomEnvs option as boolean
davidfirst Jul 8, 2026
3fae4bf
chore: update empty-env to core-aspect-env 1.0.0
davidfirst Jul 8, 2026
6de8740
fix(workspace): match installed root aspects ignoring version, restor…
davidfirst Jul 8, 2026
150dfe8
fix(e2e): switch to yarn only after installing the legacy env chain t…
davidfirst Jul 8, 2026
796f76c
fix(workspace): key in-flight aspect loads by full id, collapse versi…
davidfirst Jul 8, 2026
4fd87e8
refactor(workspace): type the aspect-sources result map explicitly
davidfirst Jul 8, 2026
5dd1c00
fix(envs): support mts/cts in the fallback typescript compiler
davidfirst Jul 9, 2026
7bad71b
chore: merge master into remove-core-envs-from-manifest
davidfirst Jul 9, 2026
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
14 changes: 14 additions & 0 deletions .bitmap
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,20 @@
"mainFile": "index.ts",
"rootDir": "scopes/workspace/eject"
},
"empty-env": {
"name": "empty-env",
"scope": "",
"version": "",
"defaultScope": "teambit.harmony",
"mainFile": "index.ts",
"rootDir": "scopes/harmony/empty-env",
"config": {
"teambit.harmony/envs/core-aspect-env@1.0.0": {},
"teambit.envs/envs": {
"env": "teambit.harmony/envs/core-aspect-env"
}
}
},
"entities/lane-diff": {
"name": "entities/lane-diff",
"scope": "teambit.lanes",
Expand Down
81 changes: 79 additions & 2 deletions components/legacy/e2e-helper/e2e-env-helper.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as path from 'path';
import fs from 'fs-extra';
import { getRootComponentDir } from '@teambit/workspace.root-components';
import type CommandHelper from './e2e-command-helper';
import type ExtensionsHelper from './e2e-extensions-helper';
Expand All @@ -14,6 +15,38 @@ type SetCustomEnvOpts = {
skipLink?: boolean;
};

/**
* env packages that the old-format env fixtures import. these envs used to be core aspects, so
* their packages were always available. now they need to be installed. the versions should match
* the pinned versions in legacy-core-envs.ts (scopes/envs/envs).
*/
const FIXTURE_ENV_BASE_PACKAGES: Record<string, string> = {
'@teambit/node': '@teambit/node@1.0.1042',
'@teambit/react': '@teambit/react@1.0.1042',
'@teambit/mdx': '@teambit/mdx@1.0.1043',
};

/**
* the env configured on the old-format env fixtures (see setCustomEnv). it used to be a core
* aspect, now its package must be installed for the fixture env to be compiled and loaded.
*/
const ENVS_ENV_PACKAGE = '@teambit/env@1.0.1042';

/**
* peers required by the published legacy env packages (via @teambit/cloud UI hooks) that yarn's
* hoisted linker doesn't auto-install (pnpm auto-installs peers). without them the env fails to
* load under yarn with "Cannot find module '@apollo/client'".
*/
export const NODE_ENV_HOISTED_PEERS = '@apollo/client@3.14.1';

/**
* the env configured on old-format aspect-style env fixtures (see setBabelWithTsHarmony). it used
* to be a core aspect, now its package must be installed for the fixture env to be loaded.
* the node env is a runtime dependency of the aspect env and must be installed at the root as
* well for the aspect env to load.
*/
const ASPECT_ENV_PACKAGES = ['@teambit/aspect@1.0.1042', '@teambit/node@1.0.1042'];

export const ENV_POLICY = {
peers: [
{
Expand Down Expand Up @@ -139,7 +172,7 @@ export default class EnvHelper {
},
},
});
this.command.install();
this.command.install([...ASPECT_ENV_PACKAGES, ...this.getFixtureEnvBasePackages(EXTENSIONS_BASE_FOLDER)].join(' '));
this.command.compile();
return EXTENSIONS_BASE_FOLDER;
}
Expand All @@ -154,18 +187,62 @@ export default new EmptyEnv();
this.fs.outputFile('empty-env/index.ts', `export { EmptyEnv } from './empty-env.bit-env';`);
this.command.addComponent('empty-env');
this.command.setEnv('empty-env', 'teambit.envs/env');
// teambit.envs/env is no longer a core aspect - install it so the .bit-env plugin compiles
this.command.install(ENVS_ENV_PACKAGE);
}

/**
* set the legacy `teambit.harmony/node` env on the given variant and install its package.
* this env used to be a core aspect so no installation was needed, now it must be installed
* (with the version pinned in legacy-core-envs.ts, see FIXTURE_ENV_BASE_PACKAGES).
* `extraPackages` is for peers the env package needs but the package manager doesn't
* auto-install (see NODE_ENV_HOISTED_PEERS for yarn).
*/
setNodeEnv(variantPattern = '*', extraPackages = '') {
this.extensions.addExtensionToVariant(variantPattern, 'teambit.harmony/node', {});
this.command.install(`${FIXTURE_ENV_BASE_PACKAGES['@teambit/node']} ${extraPackages}`.trim());
// the env is loaded only at the end of the first install. run a second install so its
// dependency policies (e.g. @types/jest as a dev dep) are applied to the components - the
// standard flow for old-style envs (see the "run bit install again" suggestion).
this.command.install();
}

/**
* install the packages of the legacy `teambit.harmony/aspect` env (and its node env runtime
* dependency). needed after configuring the aspect env on a component the old way (versionless).
*/
installAspectEnv() {
this.command.install(ASPECT_ENV_PACKAGES.join(' '));
}

setCustomEnv(extensionsBaseFolder = 'node-env', options: SetCustomEnvOpts = {}): string {
this.fixtures.copyFixtureExtensions(extensionsBaseFolder);
this.command.addComponent(extensionsBaseFolder);
this.extensions.addExtensionToVariant(extensionsBaseFolder, 'teambit.envs/env');
if (!options.skipLink) this.command.link();
if (!options.skipInstall) this.command.install();
if (!options.skipInstall) {
this.command.install([ENVS_ENV_PACKAGE, ...this.getFixtureEnvBasePackages(extensionsBaseFolder)].join(' '));
}
if (!options.skipCompile) this.command.compile();
return extensionsBaseFolder;
}

/**
* find which env packages the given fixture imports, so they can be installed (see
* FIXTURE_ENV_BASE_PACKAGES).
*/
getFixtureEnvBasePackages(extensionsBaseFolder: string): string[] {
const extensionDir = path.join(this.scopes.localPath, extensionsBaseFolder);
const allContent = fs
.readdirSync(extensionDir)
.filter((file) => file.endsWith('.ts'))
.map((file) => fs.readFileSync(path.join(extensionDir, file)).toString())
.join('\n');
return Object.keys(FIXTURE_ENV_BASE_PACKAGES)
.filter((pkg) => allContent.includes(`'${pkg}'`) || allContent.includes(`"${pkg}"`))
.map((pkg) => FIXTURE_ENV_BASE_PACKAGES[pkg]);
}
Comment thread
davidfirst marked this conversation as resolved.

/**
* This will generate env in the new format (using the *.bit-env.* plugin)
* @param extensionsBaseFolder
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// @ts-nocheck
// the e2e runs inside the bit repo, where core-aspect types (e.g. @teambit/compiler) resolve
// to the repo sources while the env tree in the capsule brings the published @teambit/builder.
// the two BuildContext types are structurally identical but nominally different - skip checking.
import { EnvsMain, EnvsAspect } from '@teambit/envs';
import { ReactAspect, ReactMain } from '@teambit/react';
import { BabelAspect, BabelMain } from '@teambit/babel';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// @ts-nocheck
// the e2e runs inside the bit repo, where core-aspect types (e.g. @teambit/compiler) resolve
// to the repo sources while the env tree in the capsule brings the published @teambit/builder.
// the two BuildContext types are structurally identical but nominally different - skip checking.
import { EnvsMain, EnvsAspect } from '@teambit/envs';
import { ReactAspect, ReactMain } from '@teambit/react';
import { BabelAspect, BabelMain } from '@teambit/babel';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// @ts-nocheck
// the e2e runs inside the bit repo, where core-aspect types (e.g. @teambit/envs) resolve to the
// repo sources while the env tree in the capsule brings the published packages. the types are
// structurally identical but nominally different - skip checking.
import { EnvsMain, EnvsAspect } from '@teambit/envs';
import { NodeMain, NodeAspect } from '@teambit/node';

Expand Down
2 changes: 1 addition & 1 deletion components/legacy/e2e-helper/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ export {
};

export { Helper, FileStatusWithoutChalk } from './e2e-helper';
export { ENV_POLICY } from './e2e-env-helper';
export { ENV_POLICY, NODE_ENV_HOISTED_PEERS } from './e2e-env-helper';
export { NpmCiRegistry, supportNpmCiRegistryTesting } from './npm-ci-registry';
4 changes: 2 additions & 2 deletions contrib/claude-skill-bit-cli/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ Subcommands: list, get, set, unset, replace, update
scope <sub-command> - manage component scope names and assignments
Subcommands: set, trust, rename, rename-owner, fork
eject-conf <pattern> - create component.json configuration files for components
local-only <sub-command> - manage components that exist only in the workspace
Subcommands: set, unset, list
aspect <sub-command> - manage component aspects and their configurations
Subcommands: list, list-core, get, set, unset, update
local-only <sub-command> - manage components that exist only in the workspace
Subcommands: set, unset, list

Collaboration & Remote
remote - manage remote scopes for self-hosted environments
Expand Down
3 changes: 3 additions & 0 deletions e2e/commands/reset.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ describe('bit reset command', function () {
helper.scopeHelper.setWorkspaceWithRemoteScope();
helper.fixtures.populateComponents(1);
helper.command.setEnv('comp1', 'teambit.react/react');
helper.command.install('@teambit/react@1.0.1042');
helper.command.snapAllComponentsWithoutBuild();
helper.command.snapAllComponentsWithoutBuild('--unmodified');
helper.command.resetAll();
Expand All @@ -325,6 +326,7 @@ describe('bit reset command', function () {
helper.scopeHelper.setWorkspaceWithRemoteScope();
helper.fixtures.populateComponents(1);
helper.command.setEnv('comp1', 'teambit.react/react');
helper.command.install('@teambit/react@1.0.1042 @teambit/node@1.0.1042');
helper.command.snapAllComponentsWithoutBuild();
helper.command.setEnv('comp1', 'teambit.harmony/node');
helper.command.snapAllComponentsWithoutBuild();
Expand All @@ -340,6 +342,7 @@ describe('bit reset command', function () {
helper.scopeHelper.setWorkspaceWithRemoteScope();
helper.fixtures.populateComponents(1);
helper.command.setEnv('comp1', 'teambit.react/react');
helper.command.install('@teambit/react@1.0.1042');
helper.command.snapAllComponentsWithoutBuild();
helper.command.dependenciesSet('comp1', 'lodash@4.17.21');
helper.command.snapAllComponentsWithoutBuild();
Expand Down
4 changes: 2 additions & 2 deletions e2e/commands/watch.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ chai.use(chaiFs);
helper.fixtures.populateComponentsTS();
helper.fixtures.createComponentBarFoo();
helper.fixtures.addComponentBarFoo();
helper.extensions.addExtensionToVariant('*', 'teambit.harmony/node', {});
helper.env.setNodeEnv();
});
describe('run bit watch', () => {
let watchRunner: WatchRunner;
Expand Down Expand Up @@ -113,7 +113,7 @@ chai.use(chaiFs);
before(async () => {
helper.scopeHelper.setWorkspaceWithRemoteScope({ initGit });
helper.fixtures.populateComponentsTS();
helper.extensions.addExtensionToVariant('*', 'teambit.harmony/node', {});
helper.env.setNodeEnv();
watchRunner = new WatchRunner(helper, true);
await watchRunner.watch();
allOutput = '';
Expand Down
5 changes: 5 additions & 0 deletions e2e/functionalities/dev-dependencies.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@ describe('dev-dependencies functionality', function () {
helper.extensions.addExtensionToVariant('*', envId);
helper.fixtures.populateComponents(1, false);
helper.fs.outputFile(`comp1/index.js`, `const isPositive = require('is-positive');`);
// the custom env composes @teambit/node, whose aspect chain also requires the react and
// aspect env packages from the workspace root (they used to be core aspects). install them
// so the env loads, then run another install so its dependency policies (is-positive as a
// dev dep) are applied to the components.
helper.command.install('@teambit/react@1.0.1042 @teambit/aspect@1.0.1042');
helper.command.install();
helper.command.tagWithoutBuild();
});
Expand Down
6 changes: 5 additions & 1 deletion e2e/functionalities/env-peer-deps-install.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ describe('env peer dependencies should be installed for created components', fun
describe('bit create react and then check-types', () => {
before(() => {
helper.scopeHelper.setWorkspaceWithRemoteScope();
helper.command.create('react', 'button');
// the react env is not a core aspect anymore, its template is loaded on demand via --env
helper.command.create('react', 'button', '--env teambit.react/react');
// the env is loaded only at the end of the install that installed it. run another install
// so its dependency policies (e.g. @types/react) are applied to the components.
helper.command.install();
});

it('should install env peer deps like @types/react in node_modules', () => {
Expand Down
4 changes: 3 additions & 1 deletion e2e/harmony/babel.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ describe('babel compiler', function () {
},
},
});
helper.command.install();
// the aspect and react envs used to be core aspects, now their packages must be installed
// for the babel-env fixture (which composes on the react env) to be compiled and loaded
helper.command.install('@teambit/aspect@1.0.1042 @teambit/node@1.0.1042 @teambit/react@1.0.1042');
helper.command.compile(); // compile the new env

helper.fs.outputFile('bar/foo.js', 'export function sayHello() { console.log("hello"); }; sayHello();');
Expand Down
32 changes: 27 additions & 5 deletions e2e/harmony/ci-commands.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,10 @@ describe('ci commands', function () {
before(() => {
helper.scopeHelper.setWorkspaceWithRemoteScope();
setupGitRemote();
// a workspace env is used for the env-set below: it loads deterministically (unlike an
// external env that must be fetched and built in a capsule), and it is NOT the default env
// (the default env config is normalized away on tag, so it won't propagate).
helper.env.setEmptyEnv();
const defaultBranch = setupComponentsAndInitialCommit();

// First PR commit + ci pr — lane is created with comp1's original (default) env.
Expand All @@ -460,7 +464,7 @@ describe('ci commands', function () {

// Main moves ahead: change comp1's env, tag, export, push.
helper.command.runCmd(`git checkout ${defaultBranch}`);
helper.command.setEnv('comp1', 'teambit.harmony/aspect');
helper.command.setEnv('comp1', 'empty-env');
helper.command.tagAllWithoutBuild();
helper.command.export();
helper.command.runCmd('git add .');
Expand All @@ -483,7 +487,7 @@ describe('ci commands', function () {
expect(
envData.config.env,
`expected comp1's env to be updated from main, got: ${JSON.stringify(envData.config)}`
).to.equal('teambit.harmony/aspect');
).to.equal(`${helper.scopes.remote}/empty-env`);
});
});

Expand Down Expand Up @@ -864,11 +868,29 @@ ${helper.scopes.remote}/comp3: 1.5.0`;
before(() => {
helper.scopeHelper.setWorkspaceWithRemoteScope();
setupGitRemote();
// a workspace env is used for the env-set below: it loads deterministically (unlike an
// external env that must be fetched and built in a capsule), and it is NOT the default env
// (the default env config is normalized away on tag).
helper.env.setEmptyEnv();
const defaultBranch = setupComponentsAndInitialCommit();

// Create lane and change env on comp1
// use the env on another component on main from the start, so the env is loaded (and
// registered) in every process. otherwise, during `bit ci merge` - which starts on main
// where no component uses this env - comp1 receives the env mid-process via the lane's
// merged config, when it's too late for the env to load, and the tag fails on an
// env data/config mismatch.
helper.command.setEnv('comp2', 'empty-env');
// skip the auto-tag so comp1 (a dependent of comp2) keeps its original version - the
// version assertions below expect the ci merge to create comp1's second version.
helper.command.tagAllWithoutBuild('--skip-auto-tag');
helper.command.export();
helper.command.runCmd('git add .');
helper.command.runCmd('git commit -m "chore: use the workspace env on comp2"');
helper.command.runCmd(`git push origin ${defaultBranch}`);

// Create lane and change env on comp1.
helper.command.createLane('config-lane');
helper.command.setEnv('comp1', 'teambit.harmony/aspect');
helper.command.setEnv('comp1', 'empty-env');
helper.command.snapAllComponentsWithoutBuild();
helper.command.export();

Expand All @@ -885,7 +907,7 @@ ${helper.scopes.remote}/comp3: 1.5.0`;
});
it('should preserve the env config from the lane', () => {
const envData = helper.command.showAspectConfig('comp1', 'teambit.envs/envs');
expect(envData.config.env).to.equal('teambit.harmony/aspect');
expect(envData.config.env).to.equal(`${helper.scopes.remote}/empty-env`);
});
it('should tag the component', () => {
expect(mergeOutput).to.include('Merged PR');
Expand Down
6 changes: 4 additions & 2 deletions e2e/harmony/compile.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('compile extension', function () {
let appOutput: string;
before(() => {
helper.scopeHelper.setWorkspaceWithRemoteScope();
helper.extensions.addExtensionToVariant('*', 'teambit.harmony/node', {});
helper.env.setNodeEnv();
appOutput = helper.fixtures.populateComponentsTS(3);
scopeBeforeTag = helper.scopeHelper.cloneWorkspace();
});
Expand Down Expand Up @@ -144,7 +144,7 @@ describe('compile extension', function () {
describe('component with unsupported compiler files', () => {
before(() => {
helper.scopeHelper.setWorkspaceWithRemoteScope();
helper.extensions.addExtensionToVariant('*', 'teambit.harmony/node', {});
helper.env.setNodeEnv();
helper.fixtures.populateComponentsTS(1);
helper.fs.outputFile('comp1/style.css', 'h1{}');
helper.fs.outputFile('comp1/types.d.ts', 'export const myField: number');
Expand Down Expand Up @@ -180,6 +180,7 @@ describe('compile extension', function () {
describe('component with nested directories', () => {
before(() => {
helper.scopeHelper.setWorkspaceWithRemoteScope({ addRemoteScopeAsDefaultScope: false });
helper.env.setNodeEnv();
helper.fixtures.populateComponentsTS(1);
helper.fs.outputFile('comp1/nested/foo.ts');
helper.command.compile();
Expand All @@ -195,6 +196,7 @@ describe('compile extension', function () {
describe('compile by directory path', () => {
before(() => {
helper.scopeHelper.setWorkspaceWithRemoteScope();
helper.env.setNodeEnv();
helper.fixtures.populateComponentsTS(3);
helper.command.move('comp1', 'nested/comp1');
helper.command.move('comp2', 'nested/comp2');
Expand Down
8 changes: 6 additions & 2 deletions e2e/harmony/create.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ describe('create extension', function () {
before(() => {
helper.scopeHelper.setWorkspaceWithRemoteScope();
helper.extensions.addExtensionToVariant('*', 'teambit.react/react', {});
// the react env is not a core aspect anymore, install it so it's recognized as the env
helper.command.install('@teambit/react@1.0.1042');
helper.command.create('bit-aspect', 'my-aspect', `--scope ${helper.scopes.remote}`);
});
it('should set the env according to the variant', () => {
Expand Down Expand Up @@ -208,11 +210,13 @@ describe('create extension', function () {
// create a new workspace that uses an external package manager
helper.scopeHelper.cleanWorkspace();
helper.command.init('--external-package-manager');
helper.command.create('module', 'simple');
// the node env is not a core aspect anymore, its template is loaded on demand via --env
helper.command.create('module', 'simple', '--env teambit.harmony/node');
pkgJson = helper.fs.readJsonFile('package.json');
});
it('should write dependencies of the component to package.json', () => {
expect(pkgJson.dependencies['@bitdev/node.node-env'] != null).to.eq(true);
// the env set via --env is written as a dependency with its pinned version
expect(pkgJson.dependencies['@teambit/node'] != null).to.eq(true);
});
it('should not write dependencies of the env to package.json', () => {
expect(pkgJson.dependencies.eslint == null).to.eq(true);
Expand Down
Loading