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
5 changes: 5 additions & 0 deletions .changeset/create-oidc-docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@lg-tools/create': patch
---

Add CLI output and documentation for npm trusted publishing (OIDC) initial publish requirement
38 changes: 38 additions & 0 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,44 @@ If you want to stop publishing to and/or reading from your local Verdaccio serve
- If you are using any `leafygreen-ui` dependencies in your new component, add the dependency to the component directory's `tsconfig.json`.
- Run `pnpm run init` to link all packages before starting development

## Publishing a new package

This repository uses [npm trusted publishing with OIDC](https://docs.npmjs.com/trusted-publishers) for secure automated releases. However, new packages require a manual first publish before automation can take over.

### Initial Publish (Required for New Packages)

When you create a new package, you must manually publish the first version:

1. **Build the package**

```bash
pnpm build --filter="<package-name>"
```

2. **Publish to npm**

```bash
cd <directory>/<package-name>
npm publish --access public
```

3. **Configure trusted publisher** on [npmjs.com](https://www.npmjs.com):
- Navigate to your package → Settings → Trusted Publishers
- Add a trusted publisher:
- **Repository**: `mongodb/leafygreen-ui`
- **Workflow**: `release.yml`

### Subsequent Releases

After the initial publish and trusted publisher configuration, all future releases are handled automatically:

1. Add a changeset: `pnpm changeset`
2. Merge your PR to `main`
3. The "Version Packages" PR will be created automatically
4. Merge the "Version Packages" PR to publish to npm

For more details on changesets and versioning, see the [README](./README.md#committing).

## Marking a Storybook story to be imported in mongodb.design

The mongodb.design website will automatically import the `*.story.tsx` file from its installed package directory to render its live example. By default, the first exported story from the `*.story.tsx` file will be rendered. To specify a different story to be rendered, define the following in the Storybook file's Meta object:
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,9 @@ Note: it's important to follow the kebab-casing convention described above.

### Initial Release

The starting version in the generated `package.json` will be 0.0.1, but this will not be published to npm automatically. A new package is only published after its first changeset is added and the resulting "Version Packages" pull request is merged into the `main` branch.
The starting version in the generated `package.json` will be 0.0.1, but this will not be published to npm automatically.
**Note: You must manually publish the first version** of your new package before the automated release workflow can take over.
See [DEVELOPER.md](./DEVELOPER.md#publishing-a-new-package) for detailed instructions.

Note: The `create-package` script automatically generates a starter changeset file. By default this is marked as a **minor** release, which will lead to an initial release of 0.1.0. If you'd like the initial release to be a **major** version (1.0.0), this starter changeset file must be manually edited.

Expand Down
5 changes: 5 additions & 0 deletions tools/create/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ Use from `@lg-tools/cli`:
lg create <package-name>
```

## Initial Publish Required

After creating a new package, **you must manually publish the first version** before the automated release workflow can take over.
See [DEVELOPER.md](../../DEVELOPER.md#publishing-a-new-package) for detailed instructions.

## Options

### Scope
Expand Down
4 changes: 4 additions & 0 deletions tools/create/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import chalk from 'chalk';

import { getComponentRootDirectory } from './utils/getComponentRootDirectory';
import { getScope } from './utils/getScope';
import { printInitialPublishInstructions } from './utils/printInitialPublishInstructions';
import { CreatePackageOptions } from './create.types';
import { createChangeset } from './createChangeset';
import { createComponent } from './createComponent';
Expand Down Expand Up @@ -41,5 +42,8 @@ export function createPackage(name: string, options: CreatePackageOptions) {
name,
scope,
});

// Print instructions for initial publish
printInitialPublishInstructions();
}
}
10 changes: 10 additions & 0 deletions tools/create/src/utils/printInitialPublishInstructions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* eslint-disable no-console */
import chalk from 'chalk';

export function printInitialPublishInstructions() {
console.log(`
${chalk.yellow.bold('⚠️ Manual first publish required')}
You must manually publish the first version before automated releases can take over.
See ${chalk.cyan('README.md#initial-release')} for instructions.
`);
}
Loading