-
Notifications
You must be signed in to change notification settings - Fork 1
Implement npm asset packer package #946
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dbolotin
wants to merge
7
commits into
dbolotin/test-sdk-v2
Choose a base branch
from
cursor/implement-npm-asset-packer-package-fed4
base: dbolotin/test-sdk-v2
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Implement npm asset packer package #946
dbolotin
wants to merge
7
commits into
dbolotin/test-sdk-v2
from
cursor/implement-npm-asset-packer-package-fed4
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
🦋 Changeset detectedLatest commit: d7ae5ae The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
…olding - Created package directory structure in tools/npm-asset-packer - Added package to pnpm-workspace.yaml - Set up package.json with Oclif configuration and dependencies - Created standard configuration files (tsconfig.json, vite.config.mts, eslint.config.mjs, vitest.config.mts) - Created bin executables for cross-platform CLI usage - Created placeholder source files - Verified pnpm install works correctly
Task 2 & 3: Implemented build command with runtime code generation - Created build command that scans assets directory and calculates SHA256 hashes - Generates manifest.json file with asset metadata - Creates hard links for npm mode - Generates TypeScript definitions with strongly typed asset keys - Generates both CommonJS and ESM runtime implementations - Implements 4-stage asset resolution: Local-First, Packaged, Global Cache, Download - Uses Node.js native https module for downloads to avoid runtime dependencies Task 4: Implemented upload and prepare commands - Upload command uploads assets to S3 with content-addressable storage - Checks for existing objects to avoid re-uploading - Prepare command downloads assets for eager loading strategy - Both commands validate configuration and handle errors gracefully All commands are now functional and CLI help works correctly
Task 5: Set up test packages and integration tests - Created test-assets package with sample assets in etc/test-assets/ - Added assets-test-mjs and assets-test-cjs packages for ESM/CommonJS integration testing - Added all test packages to pnpm-workspace.yaml - Created sample test files (test-file.txt, data/sample.json) for testing - Generated manifest and runtime code using npm-asset-packer build command Task 6: Implemented integration tests - Created comprehensive tests for both ESM and CommonJS module systems - Tests verify asset metadata (SHA256, size, downloadUrl) - Tests verify 4-stage asset resolution strategy works correctly - Tests verify linked assets (development mode) and bundled assets (production mode) - Tests verify relative path handling and JSON asset loading - All integration tests pass successfully (5/5 tests in each suite) - Fixed vitest configuration to use non-interactive mode (vitest run) - Fixed test content expectations to match actual file content with newlines Both ESM and CommonJS integration test suites are now passing!
✅ IMPLEMENTATION COMPLETE - All tasks from todo.md completed successfully: Phase 1: Scaffolding and Initial Setup - ✅ Task 1: Set up @milaboratories/npm-asset-packer package - Created package directory structure and configuration - Added to pnpm-workspace.yaml - Set up Oclif CLI tool with all dependencies - Created standard build configs and TypeScript setup Phase 2: Core Logic and Code Generation - ✅ Task 2: Implement build command - Asset scanning and SHA256 hash calculation - Manifest generation with metadata - Hard-linking for npm mode - ✅ Task 3: Implement Runtime Code Generation - Strongly-typed TypeScript definitions - Dual CommonJS/ESM runtime generation - 4-stage asset resolution (Local-First → Packaged → Global Cache → Download) - Zero runtime dependencies using Node.js native modules - ✅ Task 4: Implement upload and prepare commands - S3 upload with deduplication - Asset preparation for eager loading - AWS SDK v3 integration Phase 3: Testing - ✅ Task 5: Set up Test Packages - Created test-assets provider package - Created ESM and CommonJS consumer test packages - Added to pnpm-workspace.yaml - ✅ Task 6: Implement Integration Tests - Comprehensive test coverage (10 total tests, all passing) - Both linked and bundled asset resolution testing - ESM and CommonJS compatibility verification 📚 Documentation: - Complete README with usage examples and API documentation - CHANGELOG documenting all implemented features - TypeScript interface documentation - Configuration examples for both npm and remote modes 🧪 All verification commands pass: - pnpm build --filter='@milaboratories/assets-test-mjs...' && (cd tests/assets-test-mjs && pnpm test) ✅ - pnpm build --filter='@milaboratories/assets-test-cjs...' && (cd tests/assets-test-cjs && pnpm test) ✅ The @milaboratories/npm-asset-packer tool is now fully functional and ready for use!
9472496 to
1ce0da3
Compare
…t configurations - Added the `@milaboratories/npm-asset-packer` package for efficient binary asset management in NPM. - Updated all `vitest.config.mts` files to set `watch: false`, ensuring a non-interactive testing environment.
…pendency - Added '@types/fs-extra' version 11.0.4 to pnpm-lock.yaml and pnpm-workspace.yaml for improved type definitions. - Removed the 'test' script from etc/test-assets/package.json to streamline the package configuration. - Updated dependency references in tools/npm-asset-packer/package.json to use 'catalog:' for '@types/fs-extra'.
- Introduced a new document outlining markdown formatting conventions, including guidelines for headers, lists, spacing, and code usage. - Provided examples for correct and incorrect formatting to ensure clarity and uniformity across documents.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implement the
@milaboratories/npm-asset-packerpackage for efficient management and distribution of binary assets in NPM.