fix(core): Update dependencies, code style and project config; add pnpm overrides and ignore AI folders

This commit is contained in:
2025-11-20 08:10:17 +00:00
parent f2bf3f1314
commit 871f0e0b78
9 changed files with 2445 additions and 2567 deletions

View File

@@ -1,12 +1,12 @@
# @push.rocks/smarts3 🚀
**Mock S3 made simple** - A powerful Node.js TypeScript package for creating a local S3 endpoint that simulates AWS S3 operations using mapped local directories. Perfect for development and testing!
**Mock S3 made simple** - A powerful Node.js TypeScript package for creating a local S3 endpoint that simulates AWS S3 operations using mapped local directories. Perfect for development and testing!
## 🌟 Features
- 🏃 **Lightning-fast local S3 simulation** - No more waiting for cloud operations during development
- 🔄 **Full AWS S3 API compatibility** - Drop-in replacement for S3 in your tests
- 📂 **Local directory mapping** - Your buckets live right on your filesystem
- 📂 **Local directory mapping** - Your buckets live right on your filesystem
- 🧪 **Perfect for testing** - Reliable, repeatable tests without cloud dependencies
- 🎯 **TypeScript-first** - Built with TypeScript for excellent type safety and IDE support
- 🔧 **Zero configuration** - Works out of the box with sensible defaults
@@ -37,7 +37,7 @@ import { Smarts3 } from '@push.rocks/smarts3';
// Start your local S3 server
const s3Server = await Smarts3.createAndStart({
port: 3000,
cleanSlate: true // Start with empty buckets
cleanSlate: true, // Start with empty buckets
});
// Create a bucket
@@ -61,8 +61,8 @@ import { Smarts3 } from '@push.rocks/smarts3';
// Configuration options
const config = {
port: 3000, // Port to run the server on (default: 3000)
cleanSlate: true // Clear all data on start (default: false)
port: 3000, // Port to run the server on (default: 3000)
cleanSlate: true, // Clear all data on start (default: false)
};
// Create and start in one go
@@ -108,7 +108,7 @@ await baseDir.fastStore('path/to/file.txt', 'Hello, S3! 🎉');
// Upload with more control
await baseDir.fastPut({
path: 'documents/important.pdf',
contents: Buffer.from(yourPdfData)
contents: Buffer.from(yourPdfData),
});
```
@@ -133,7 +133,7 @@ Browse your bucket contents:
// List all files in the bucket
const files = await baseDir.listFiles();
files.forEach(file => {
files.forEach((file) => {
console.log(`📄 ${file.name} (${file.size} bytes)`);
});
@@ -169,7 +169,7 @@ describe('S3 Operations', () => {
beforeAll(async () => {
s3Server = await Smarts3.createAndStart({
port: 9999,
cleanSlate: true
cleanSlate: true,
});
});
@@ -196,7 +196,7 @@ describe('S3 Operations', () => {
before(async () => {
s3Server = await Smarts3.createAndStart({
port: 9999,
cleanSlate: true
cleanSlate: true,
});
});
@@ -229,16 +229,16 @@ const s3Client = new S3Client({
region: 'us-east-1',
credentials: {
accessKeyId: config.accessKey,
secretAccessKey: config.accessSecret
secretAccessKey: config.accessSecret,
},
forcePathStyle: true
forcePathStyle: true,
});
// Use AWS SDK as normal
const command = new PutObjectCommand({
Bucket: 'my-bucket',
Key: 'test-file.txt',
Body: 'Hello from AWS SDK!'
Body: 'Hello from AWS SDK!',
});
await s3Client.send(command);
@@ -256,7 +256,7 @@ export async function setupTestEnvironment() {
// Start S3 server for CI tests
const s3 = await Smarts3.createAndStart({
port: process.env.S3_PORT || 3000,
cleanSlate: true
cleanSlate: true,
});
// Create test buckets
@@ -282,7 +282,7 @@ async function startDevelopmentServer() {
// Start your API server
const app = express();
app.post('/upload', async (req, res) => {
// Your upload logic using local S3
});
@@ -300,7 +300,7 @@ import { Smarts3 } from '@push.rocks/smarts3';
async function testDataMigration() {
const s3 = await Smarts3.createAndStart({ cleanSlate: true });
// Create source and destination buckets
const sourceBucket = await s3.createBucket('legacy-data');
const destBucket = await s3.createBucket('new-data');
@@ -310,10 +310,16 @@ async function testDataMigration() {
const smartbucket = new SmartBucket(config);
const source = await smartbucket.getBucket('legacy-data');
const sourceDir = await source.getBaseDirectory();
// Add test files
await sourceDir.fastStore('user-1.json', JSON.stringify({ id: 1, name: 'Alice' }));
await sourceDir.fastStore('user-2.json', JSON.stringify({ id: 2, name: 'Bob' }));
await sourceDir.fastStore(
'user-1.json',
JSON.stringify({ id: 1, name: 'Alice' }),
);
await sourceDir.fastStore(
'user-2.json',
JSON.stringify({ id: 2, name: 'Bob' }),
);
// Run your migration logic
await runMigration(config);
@@ -322,7 +328,7 @@ async function testDataMigration() {
const dest = await smartbucket.getBucket('new-data');
const destDir = await dest.getBaseDirectory();
const migratedFiles = await destDir.listFiles();
console.log(`✅ Migrated ${migratedFiles.length} files successfully!`);
}
```
@@ -335,9 +341,9 @@ When integrating with different S3 clients, you can customize the connection det
```typescript
const customDescriptor = await s3Server.getS3Descriptor({
endpoint: 'localhost', // Custom endpoint
port: 3001, // Different port
useSsl: false, // SSL configuration
endpoint: 'localhost', // Custom endpoint
port: 3001, // Different port
useSsl: false, // SSL configuration
// Add any additional options your S3 client needs
});
```
@@ -347,7 +353,7 @@ const customDescriptor = await s3Server.getS3Descriptor({
```typescript
const config = {
port: parseInt(process.env.S3_PORT || '3000'),
cleanSlate: process.env.NODE_ENV === 'test'
cleanSlate: process.env.NODE_ENV === 'test',
};
const s3Server = await Smarts3.createAndStart(config);
@@ -370,7 +376,7 @@ const s3Server = await Smarts3.createAndStart(config);
```typescript
interface ISmarts3ContructorOptions {
port?: number; // Server port (default: 3000)
port?: number; // Server port (default: 3000)
cleanSlate?: boolean; // Clear storage on start (default: false)
}
```
@@ -408,7 +414,7 @@ interface ISmarts3ContructorOptions {
## License and Legal Information
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
@@ -423,4 +429,4 @@ Registered at District court Bremen HRB 35230 HB, Germany
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.