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
18 changes: 18 additions & 0 deletions tools/generators/prepare-initial-release/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
readJson,
updateJson,
ProjectGraph,
workspaceRoot,
} from '@nrwl/devkit';
import * as devkit from '@nrwl/devkit';
import * as childProcess from 'child_process';
Expand Down Expand Up @@ -120,6 +121,10 @@ describe('prepare-initial-release generator', () => {
expect(execSyncSpy.mock.calls.flat()).toMatchInlineSnapshot(`
Array [
"yarn change --message 'feat: release preview package' --type minor --package @proj/react-one-preview",
Object {
"cwd": "${workspaceRoot}",
"stdio": "inherit",
},
]
`);
});
Expand Down Expand Up @@ -285,7 +290,20 @@ describe('prepare-initial-release generator', () => {
expect(execSyncSpy.mock.calls.flat()).toMatchInlineSnapshot(`
Array [
"yarn change --message 'feat: release stable' --type minor --package @proj/react-one",
Object {
"cwd": "${workspaceRoot}",
"stdio": "inherit",
},
"yarn change --message 'feat: add @proj/react-one to suite' --type minor --package @proj/react-components",
Object {
"cwd": "${workspaceRoot}",
"stdio": "inherit",
},
"yarn lage generate-api --to @proj/react-components",
Object {
"cwd": "${workspaceRoot}",
"stdio": "inherit",
},
]
`);
expect(installPackagesTaskSpy).toHaveBeenCalled();
Expand Down
11 changes: 9 additions & 2 deletions tools/generators/prepare-initial-release/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
installPackagesTask,
readJson,
stripIndents,
workspaceRoot,
} from '@nrwl/devkit';

import * as tsquery from '@phenomnomnominal/tsquery';
Expand Down Expand Up @@ -236,9 +237,10 @@ async function stableRelease(tree: Tree, options: NormalizedSchema) {
tree.rename(options.projectConfig.root, newPackage.root);

return (_tree: Tree) => {
installPackagesTask(tree, true);
Comment thread
Hotell marked this conversation as resolved.
generateChangefileTask(tree, newPackage.name, { message: 'feat: release stable' });
generateChangefileTask(tree, suitePackageName, { message: `feat: add ${newPackage.name} to suite` });
installPackagesTask(tree);
generateApiMarkdownTask(tree, suitePackageName);
};
}

Expand Down Expand Up @@ -280,7 +282,12 @@ async function getProjectThatNeedsToBeUpdated(tree: Tree, options: NormalizedSch

function generateChangefileTask(tree: Tree, projectName: string, options: { message: string }) {
const cmd = `yarn change --message '${options.message}' --type minor --package ${projectName}`;
return execSync(cmd);
return execSync(cmd, { cwd: workspaceRoot, stdio: 'inherit' });
}

function generateApiMarkdownTask(tree: Tree, projectName: string) {
const cmd = `yarn lage generate-api --to ${projectName}`;
return execSync(cmd, { cwd: workspaceRoot, stdio: 'inherit' });
}

function assertProject(tree: Tree, options: NormalizedSchema) {
Expand Down