Skip to content

Commit

Permalink
fix(js): allow publishable library to run release command
Browse files Browse the repository at this point in the history
  • Loading branch information
xiongemi committed Jan 28, 2025
1 parent e0c49d3 commit ce3fe9e
Show file tree
Hide file tree
Showing 6 changed files with 501 additions and 492 deletions.
45 changes: 45 additions & 0 deletions e2e/release/src/publishable-libraries-release.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import {
cleanupProject,
newProject,
runCLI,
runCommandAsync,
uniq,
} from '@nx/e2e/utils';

describe('publishable libraries release', () => {
beforeAll(() => {
newProject({
packages: ['@nx/js'],
});
});
afterAll(() => cleanupProject());

it('should be able release publishable js library', async () => {
// Normalize git committer information so it is deterministic in snapshots
await runCommandAsync(`git config user.email "[email protected]"`);
await runCommandAsync(`git config user.name "Test"`);
// Create a baseline version tag
await runCommandAsync(`git tag v0.0.0`);

const jsLib = uniq('js-lib');
runCLI(
`generate @nx/js:lib ${jsLib} --publishable --importPath=@proj/${jsLib}`
);

// We need a valid git origin to exist for the commit references to work (and later the test for createRelease)
await runCommandAsync(
`git remote add origin https://github.com/nrwl/fake-repo.git`
);

let versionOutput = runCLI(`release --first-release`);
versionOutput = runCLI(`release patch`);

expect(versionOutput).toContain('Executing pre-version command');
});

it('should run nx-release-publish target for all publishable libraries', async () => {
expect(() => {
runCLI(`run-many -t nx-release-publish`);
}).not.toThrow();
});
});
Loading

0 comments on commit ce3fe9e

Please sign in to comment.