@dynamods/dynamo-pm-wizard
v0.0.29
Published
Dynamo Package Manager Publish Wizard
Keywords
Readme
Package Publish Wizard
Overview
The Package Publish Wizard is a React-based UI component designed to facilitate the creation and management of packages in Dynamo. It is hosted inside the Dynamo Package Manager and provides an intuitive interface for users to create, update, and publish packages.
A package in Dynamo is a structured collection of files and folders that extends Dynamo's capabilities. The wizard enables users to create a package from scratch or update an existing package. Packages can be stored locally or published online. Once a package is published, only the original creator can update it, ensuring controlled versioning.
Features
- Create a new package: Initialize a package with metadata, dependencies, and contents.
- Update an existing package: Modify and increment the version of an already published package.
- Local package management: Save and manage packages directly on disk.
- Online publishing: Upload and maintain packages via the Dynamo Package Manager.
- Version control: Ensure package integrity with incremental versioning.
Installation
Ensure you have Node.js and npm installed before proceeding.
npm installRunning the Project
To start the development server:
npm startThis runs the project using Vite.
To build the project:
npm run buildThis compiles the application and processes it for production use. bundle.js and index.html will be exported in the dist folder. Only use the index.html for Dynamo.
To clean the build directory:
npm run cleanDynamo Integration
The react component is hosted inside Dynamo in a WebView2 wpf component. Due to a known limitation of 2Mb, we serve a single file injecting the resulting bundle.js inside the index.html file.
- use 'inline-bundle.js' to inject the bundle.js into the index.html. The resulting file also contains the embeddesFonts location - make sure this is well coordinated with the location on Dynamo's side
Running Tests
The project includes both unit and end-to-end tests.
To run unit tests:
npm run test:unitTo run all tests:
npm run testLinting - ignore
To check for linting errors:
npm run lint:checkTo automatically fix linting issues:
npm run lint:fixLicense Compliance
This project uses Autodesk's adsk-npm-license-puller to manage dependencies. To generate direct and transitive dependency reports:
npm run licenseVersioning
To increment the package version (patch release):
npm run version:patchDeployment - Release Process
The Package Publish Wizard is consumed by Dynamo as the public npm package @dynamods/dynamo-pm-wizard.
The internal CI can't reach npmjs.org, and the wizard's dependencies are internal, so it can't be built on public GitHub. A release is therefore built here and published from the public, publish-only repository DynamoDS/PackagePublishWizard:
- The release build packs the wizard (
npm pack) with the new version. - It creates the GitHub release
v<version>on DynamoDS/PackagePublishWizard and attaches the tarball. - That repository's Publish release workflow checks the tarball and publishes it to npmjs.org.
Publish repository settings
The publish workflow is controlled by two settings on DynamoDS/PackagePublishWizard, under Settings → Secrets and variables → Actions. Neither is stored in a repository file, so changing one doesn't go through a PR. Note who changed it and why in the release's Jira issue.
| Setting | Kind | Production value | What it does |
| --- | --- | --- | --- |
| PUBLISH_DRY_RUN | Repository variable | false | true makes the workflow run npm publish --dry-run and send no token, so nothing is published. Only the exact value true does this: any other value, or no variable at all, publishes for real. Use it to test a workflow change (see Testing the publish workflow). |
| NPM_TOKEN | DynamoDS organization secret | a valid npm token | The npm token used to publish. It needs write access to @dynamods/dynamo-pm-wizard. A repository secret with the same name would override the organization one. |
To check or change the variable (needs write access to the repository):
gh variable list --repo DynamoDS/PackagePublishWizard
gh variable set PUBLISH_DRY_RUN --body false --repo DynamoDS/PackagePublishWizardgh variable list shows when the variable was last changed. A secret's value can't be read back; only an organization admin can see when NPM_TOKEN was last updated.
Before you start: check the previous release was closed out
Each item below is a step from the previous release's close-out (see After the release). If one was skipped, do it now, before cutting the branch:
- No open version PR. There is no open PR titled "Release version to ''" on this repository. If one is open, review and merge it first.
- Master holds the latest published version. The
versioninpipeline.ymlon master equalsnpm view @dynamods/dynamo-pm-wizard version. If master is behind, the release rebuilds a version that's already published, and the publish fails. - The release branch name is free. Patch releases reuse the same name (e.g.
release/0.0.x-patch), and the branch is normally deleted when the version PR merges. If it still exists, delete it. - The publish repo is ready. On DynamoDS/PackagePublishWizard:
PUBLISH_DRY_RUNisfalse(gh variable list --repo DynamoDS/PackagePublishWizard).- No workflow change, such as a Dependabot bump, has merged without a dry run (see Testing the publish workflow).
- The npm token is still valid. npm tokens last 90 days at most. If the
NPM_TOKENsecret is near its expiry, ask its owner to replace it first. When a token can't publish, npm returnsE404(notE401) for this scoped package.
Releasing
- Make sure that the latest changes are reviewed and merged to the
masterbranch. - Create a new release branch based on the master branch. The new release branch needs to be named using the following convention:
- Start the branch name with
release/ - If it is a major release, follow it by the major numeric version and the keyword
-major. Example: release/2-major - If it is a minor release, follow it by the major versions and a variable minor version denoted by
xfollowed by the keyword-minor. Example: release/2.x-minor - If it is a patch release, follow it by the major, minor numeric versions and a variable patch version denoted by
xfollowed by the keyword-patch. Example: release/2.1.x-patch
- Start the branch name with
- In CloudBees CI, select the branch and click Build Now. A build started by the branch push stops itself; the release build has to be started by hand.
(Note: The version of the package depends upon the version specified in the pipeline.yml file, the version in the branch name is purely for record-keeping. pipeline.yml must hold the latest published version, because the build adds one to it.)
If the build fails after the version was bumped but before the GitHub release was created, don't build again. Download dynamo-pm-wizard.tgz from the build's artifacts and create the release by hand:
gh release create v<version> dynamo-pm-wizard.tgz --repo DynamoDS/PackagePublishWizard --target masterIf the Publish release workflow fails (for example, an expired token), fix the cause and re-run it with gh workflow run npm-publish.yml --repo DynamoDS/PackagePublishWizard -f tag=v<version>. Don't rebuild the release branch.
After the release: close it out the same day
None of these steps blocks the release itself, but the next release depends on them. Do them right away rather than leaving them for whoever releases next:
- Verify the publish. The Publish release workflow succeeded, and the version is on npmjs.org and on the internal mirror Dynamo builds from. The mirror can take about 30 minutes:
npm view @dynamods/dynamo-pm-wizard@<version> version --prefer-online --registry https://npm.autodesk.com/artifactory/api/npm/autodesk-npm-virtual/ - Merge the version PR. The build service user opens "Release version to ''" from the release branch to master. Review and merge it so that master holds the released version. Merging deletes the release branch; check that it did.
- Update Dynamo. Once the mirror shows the new version, open a Dynamo PR that bumps
PackageVersionforNpmRunBuildPMWizardinsrc/DynamoCoreWpf/DynamoCoreWpf.csproj. Never bump it before the version is published: Dynamo's build fails if it can't download the package. - Triage the publish repo's PRs. Review open Dependabot PRs on DynamoDS/PackagePublishWizard. Dry-run any that change the workflow (see below) before the next release depends on them.
- Leave the switches in their production state. If
PUBLISH_DRY_RUNwas changed for testing, set it back tofalse. - Update the Jira issues the release ships. For each issue fixed in this version, add a comment naming the version and the Dynamo PR that consumes it, then move the issue to Testing. These issues are usually on the Archilizer sprint board, not the Eidos kanban board.
Testing the publish workflow
To try a workflow change without publishing, set PUBLISH_DRY_RUN to true, re-run the workflow against an existing release, then set it back:
gh variable set PUBLISH_DRY_RUN --body true --repo DynamoDS/PackagePublishWizard
gh workflow run npm-publish.yml --repo DynamoDS/PackagePublishWizard -f tag=v<latest version>
gh variable set PUBLISH_DRY_RUN --body false --repo DynamoDS/PackagePublishWizardA dry run never sends the token, so it can't tell you whether the token still works.
Release types
It is mandatory to include at-least one of the release types in the branch name.
- Use patch for a new patch release (backwards-compatible bug fixes, security patches).
- Use minor for a new minor release (add functionality in a backwards-compatible manner).
- Use major for a new major release (incompatible API changes/breaking changes).
Examples: | Branch Name | Current Version | New Version | | --------------------- | ------------- | ------------- | | release/4.6.x-patch | 4.6.1 | 4.6.2 | | release/4.x-minor | 4.6.2 | 4.7.0 | | release/5-major | 4.7.0 | 5.0.0 |
Learn more about semantic versioning
Package Publish Wizard - Usage
The package is public and can be installed using npm:
npm install @dynamods/dynamo-pm-wizard@latestIn the above command latest can be replaced by a specific version to fetch it.
Dependencies
Core Dependencies
- React 18.3.1 - Core library for building UI components
- React Hook Form - Form validation and management
- Sass - Stylesheet preprocessor for styling
- Weave MUI Components - UI components for a consistent design system
- React-Intl - Internationalization support
Weave MUI Library
Weave MUI is an internal Autodesk library, thus we need to make sure to include an .npmrc file with the following content:
@adsk:registry=https://npm.autodesk.com/artifactory/api/npm/autodesk-npm/
registry=https://npm.autodesk.com/artifactory/api/npm/autodesk-npm-virtual/Can only be used when under Autodesk environment (Autodesk computer or VPN).
Development Dependencies
- Vite - Build and development server
- Jest - Testing framework
- ESLint - Linter for maintaining code quality
- TypeScript - Strongly-typed JavaScript
Contribution
To contribute to the project:
- Clone the repository.
- Install dependencies:
npm install - Create a new feature branch.
- Submit a pull request after implementing changes.
Author
Developed by Autodesk Inc.
License
This project is licensed under the ISC License.
