Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3ab667049a | |||
| 871f0e0b78 |
7
.gitignore
vendored
7
.gitignore
vendored
@@ -3,7 +3,6 @@
|
|||||||
# artifacts
|
# artifacts
|
||||||
coverage/
|
coverage/
|
||||||
public/
|
public/
|
||||||
pages/
|
|
||||||
|
|
||||||
# installs
|
# installs
|
||||||
node_modules/
|
node_modules/
|
||||||
@@ -17,4 +16,8 @@ node_modules/
|
|||||||
dist/
|
dist/
|
||||||
dist_*/
|
dist_*/
|
||||||
|
|
||||||
# custom
|
# AI
|
||||||
|
.claude/
|
||||||
|
.serena/
|
||||||
|
|
||||||
|
#------# custom
|
||||||
22
changelog.md
22
changelog.md
@@ -1,6 +1,17 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2025-11-20 - 2.2.7 - fix(core)
|
||||||
|
Update dependencies, code style and project config; add pnpm overrides and ignore AI folders
|
||||||
|
|
||||||
|
- Bump devDependencies and runtime dependencies (@git.zone/*, @push.rocks/*, @tsclass/tsclass, s3rver) to newer compatible versions
|
||||||
|
- Add pnpm.overrides entry to package.json and normalize repository URL format
|
||||||
|
- Code style and formatting fixes in TypeScript sources (ts/index.ts, ts/00_commitinfo_data.ts): whitespace, trailing commas, parameter formatting and minor API-return typing preserved
|
||||||
|
- tsconfig.json: simplify compiler options and compact exclude list
|
||||||
|
- Update .gitignore to add AI-related folders (.claude/, .serena/) to avoid accidental commits
|
||||||
|
- Documentation and changelog formatting tweaks (readme.md, changelog.md, npmextra.json) — whitespace/newline cleanups and expanded changelog entries
|
||||||
|
|
||||||
## 2025-08-16 - 2.2.6 - fix(Smarts3)
|
## 2025-08-16 - 2.2.6 - fix(Smarts3)
|
||||||
|
|
||||||
Allow overriding S3 descriptor; update dependencies, test config and documentation
|
Allow overriding S3 descriptor; update dependencies, test config and documentation
|
||||||
|
|
||||||
- ts/index.ts: getS3Descriptor now accepts an optional Partial<IS3Descriptor> to override defaults (backwards compatible)
|
- ts/index.ts: getS3Descriptor now accepts an optional Partial<IS3Descriptor> to override defaults (backwards compatible)
|
||||||
@@ -11,12 +22,14 @@ Allow overriding S3 descriptor; update dependencies, test config and documentati
|
|||||||
- added project config files: .claude/settings.local.json and .serena/project.yml
|
- added project config files: .claude/settings.local.json and .serena/project.yml
|
||||||
|
|
||||||
## 2024-11-06 - 2.2.5 - fix(ci)
|
## 2024-11-06 - 2.2.5 - fix(ci)
|
||||||
|
|
||||||
Corrected docker image URLs in Gitea workflows to match the correct domain format.
|
Corrected docker image URLs in Gitea workflows to match the correct domain format.
|
||||||
|
|
||||||
- Updated IMAGE environment variable in .gitea/workflows/default_nottags.yaml
|
- Updated IMAGE environment variable in .gitea/workflows/default_nottags.yaml
|
||||||
- Updated IMAGE environment variable in .gitea/workflows/default_tags.yaml
|
- Updated IMAGE environment variable in .gitea/workflows/default_tags.yaml
|
||||||
|
|
||||||
## 2024-11-06 - 2.2.4 - fix(core)
|
## 2024-11-06 - 2.2.4 - fix(core)
|
||||||
|
|
||||||
Improve code style and update dependencies
|
Improve code style and update dependencies
|
||||||
|
|
||||||
- Updated @push.rocks/tapbundle to version ^5.4.3 in package.json.
|
- Updated @push.rocks/tapbundle to version ^5.4.3 in package.json.
|
||||||
@@ -24,29 +37,34 @@ Improve code style and update dependencies
|
|||||||
- Improved code consistency in ts/00_commitinfo_data.ts, ts/plugins.ts, and test/test.ts.
|
- Improved code consistency in ts/00_commitinfo_data.ts, ts/plugins.ts, and test/test.ts.
|
||||||
|
|
||||||
## 2024-11-06 - 2.2.3 - fix(core)
|
## 2024-11-06 - 2.2.3 - fix(core)
|
||||||
|
|
||||||
Fix endpoint address from 'localhost' to '127.0.0.1' for better compatibility in Smarts3.getS3Descriptor
|
Fix endpoint address from 'localhost' to '127.0.0.1' for better compatibility in Smarts3.getS3Descriptor
|
||||||
|
|
||||||
- Corrected the endpoint address in Smarts3.getS3Descriptor to ensure proper functioning across different environments.
|
- Corrected the endpoint address in Smarts3.getS3Descriptor to ensure proper functioning across different environments.
|
||||||
|
|
||||||
## 2024-11-06 - 2.2.2 - fix(core)
|
## 2024-11-06 - 2.2.2 - fix(core)
|
||||||
|
|
||||||
Fixed function call for fastPut in the test suite to ensure proper file upload handling.
|
Fixed function call for fastPut in the test suite to ensure proper file upload handling.
|
||||||
|
|
||||||
- Updated dependencies in package.json to newer versions.
|
- Updated dependencies in package.json to newer versions.
|
||||||
- Corrected the function call in test suite for file upload.
|
- Corrected the function call in test suite for file upload.
|
||||||
|
|
||||||
## 2024-10-26 - 2.2.1 - fix(core)
|
## 2024-10-26 - 2.2.1 - fix(core)
|
||||||
|
|
||||||
Fix import and typings for improved compatibility
|
Fix import and typings for improved compatibility
|
||||||
|
|
||||||
- Corrected the type signature for `getS3Descriptor` to return `IS3Descriptor`.
|
- Corrected the type signature for `getS3Descriptor` to return `IS3Descriptor`.
|
||||||
- Fixed import structure and updated dependencies for consistent namespace usage across plugins.
|
- Fixed import structure and updated dependencies for consistent namespace usage across plugins.
|
||||||
|
|
||||||
## 2024-10-26 - 2.2.0 - feat(ci)
|
## 2024-10-26 - 2.2.0 - feat(ci)
|
||||||
|
|
||||||
Migrate CI/CD workflow from GitLab CI to Gitea CI
|
Migrate CI/CD workflow from GitLab CI to Gitea CI
|
||||||
|
|
||||||
- Added new Gitea CI workflows for both non-tag and tag-based pushes
|
- Added new Gitea CI workflows for both non-tag and tag-based pushes
|
||||||
- Removed existing GitLab CI configuration
|
- Removed existing GitLab CI configuration
|
||||||
|
|
||||||
## 2024-05-29 - 2.1.1 - Updates and minor changes
|
## 2024-05-29 - 2.1.1 - Updates and minor changes
|
||||||
|
|
||||||
Updates and changes based on minor configuration improvements and organizational shifts.
|
Updates and changes based on minor configuration improvements and organizational shifts.
|
||||||
|
|
||||||
- Updated description file.
|
- Updated description file.
|
||||||
@@ -55,22 +73,26 @@ Updates and changes based on minor configuration improvements and organizational
|
|||||||
- Shifted to new organizational scheme.
|
- Shifted to new organizational scheme.
|
||||||
|
|
||||||
## 2022-07-30 - 2.1.0 - Core improvements and fixes
|
## 2022-07-30 - 2.1.0 - Core improvements and fixes
|
||||||
|
|
||||||
Minor improvements and important core changes.
|
Minor improvements and important core changes.
|
||||||
|
|
||||||
- Removed tslint from the core setup.
|
- Removed tslint from the core setup.
|
||||||
|
|
||||||
## 2022-07-30 - 2.0.2 - Bucket creation improvement
|
## 2022-07-30 - 2.0.2 - Bucket creation improvement
|
||||||
|
|
||||||
Enhanced file structure management.
|
Enhanced file structure management.
|
||||||
|
|
||||||
- Improved bucket creation to store locally within the .nogit directory.
|
- Improved bucket creation to store locally within the .nogit directory.
|
||||||
|
|
||||||
## 2022-04-14 - 2.0.0 to 2.0.1 - Structural updates and fixes
|
## 2022-04-14 - 2.0.0 to 2.0.1 - Structural updates and fixes
|
||||||
|
|
||||||
This release focused on core updates and structural changes.
|
This release focused on core updates and structural changes.
|
||||||
|
|
||||||
- Reformatted the project structure.
|
- Reformatted the project structure.
|
||||||
- Core updates with minor fixes.
|
- Core updates with minor fixes.
|
||||||
|
|
||||||
## 2021-12-20 - 1.0.10 - ESM Transition
|
## 2021-12-20 - 1.0.10 - ESM Transition
|
||||||
|
|
||||||
Breaking changes and minor fixes, transitioning to ES Modules.
|
Breaking changes and minor fixes, transitioning to ES Modules.
|
||||||
|
|
||||||
- BREAKING CHANGE: Transitioned core setup to ESM.
|
- BREAKING CHANGE: Transitioned core setup to ESM.
|
||||||
23
package.json
23
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@push.rocks/smarts3",
|
"name": "@push.rocks/smarts3",
|
||||||
"version": "2.2.6",
|
"version": "2.2.7",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "A Node.js TypeScript package to create a local S3 endpoint for simulating AWS S3 operations using mapped local directories for development and testing purposes.",
|
"description": "A Node.js TypeScript package to create a local S3 endpoint for simulating AWS S3 operations using mapped local directories for development and testing purposes.",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
@@ -14,10 +14,10 @@
|
|||||||
"buildDocs": "tsdoc"
|
"buildDocs": "tsdoc"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@git.zone/tsbuild": "^2.2.0",
|
"@git.zone/tsbuild": "^3.1.0",
|
||||||
"@git.zone/tsbundle": "^2.1.0",
|
"@git.zone/tsbundle": "^2.5.2",
|
||||||
"@git.zone/tsrun": "^1.3.3",
|
"@git.zone/tsrun": "^2.0.0",
|
||||||
"@git.zone/tstest": "^2.3.2",
|
"@git.zone/tstest": "^3.0.0",
|
||||||
"@types/node": "^22.9.0"
|
"@types/node": "^22.9.0"
|
||||||
},
|
},
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
@@ -36,10 +36,10 @@
|
|||||||
"readme.md"
|
"readme.md"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@push.rocks/smartbucket": "^3.0.23",
|
"@push.rocks/smartbucket": "^3.3.10",
|
||||||
"@push.rocks/smartfile": "^11.0.21",
|
"@push.rocks/smartfile": "^11.2.7",
|
||||||
"@push.rocks/smartpath": "^6.0.0",
|
"@push.rocks/smartpath": "^6.0.0",
|
||||||
"@tsclass/tsclass": "^9.2.0",
|
"@tsclass/tsclass": "^9.3.0",
|
||||||
"@types/s3rver": "^3.7.0",
|
"@types/s3rver": "^3.7.0",
|
||||||
"s3rver": "^3.7.1"
|
"s3rver": "^3.7.1"
|
||||||
},
|
},
|
||||||
@@ -64,10 +64,13 @@
|
|||||||
"homepage": "https://code.foss.global/push.rocks/smarts3#readme",
|
"homepage": "https://code.foss.global/push.rocks/smarts3#readme",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://code.foss.global/push.rocks/smarts3.git"
|
"url": "https://code.foss.global/push.rocks/smarts3.git"
|
||||||
},
|
},
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://code.foss.global/push.rocks/smarts3/issues"
|
"url": "https://code.foss.global/push.rocks/smarts3/issues"
|
||||||
},
|
},
|
||||||
"packageManager": "pnpm@10.14.0+sha512.ad27a79641b49c3e481a16a805baa71817a04bbe06a38d17e60e2eaee83f6a146c6a688125f5792e48dd5ba30e7da52a5cda4c3992b9ccf333f9ce223af84748"
|
"packageManager": "pnpm@10.14.0+sha512.ad27a79641b49c3e481a16a805baa71817a04bbe06a38d17e60e2eaee83f6a146c6a688125f5792e48dd5ba30e7da52a5cda4c3992b9ccf333f9ce223af84748",
|
||||||
|
"pnpm": {
|
||||||
|
"overrides": {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
4878
pnpm-lock.yaml
generated
4878
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
32
readme.md
32
readme.md
@@ -37,7 +37,7 @@ import { Smarts3 } from '@push.rocks/smarts3';
|
|||||||
// Start your local S3 server
|
// Start your local S3 server
|
||||||
const s3Server = await Smarts3.createAndStart({
|
const s3Server = await Smarts3.createAndStart({
|
||||||
port: 3000,
|
port: 3000,
|
||||||
cleanSlate: true // Start with empty buckets
|
cleanSlate: true, // Start with empty buckets
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create a bucket
|
// Create a bucket
|
||||||
@@ -62,7 +62,7 @@ import { Smarts3 } from '@push.rocks/smarts3';
|
|||||||
// Configuration options
|
// Configuration options
|
||||||
const config = {
|
const config = {
|
||||||
port: 3000, // Port to run the server on (default: 3000)
|
port: 3000, // Port to run the server on (default: 3000)
|
||||||
cleanSlate: true // Clear all data on start (default: false)
|
cleanSlate: true, // Clear all data on start (default: false)
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create and start in one go
|
// Create and start in one go
|
||||||
@@ -108,7 +108,7 @@ await baseDir.fastStore('path/to/file.txt', 'Hello, S3! 🎉');
|
|||||||
// Upload with more control
|
// Upload with more control
|
||||||
await baseDir.fastPut({
|
await baseDir.fastPut({
|
||||||
path: 'documents/important.pdf',
|
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
|
// List all files in the bucket
|
||||||
const files = await baseDir.listFiles();
|
const files = await baseDir.listFiles();
|
||||||
|
|
||||||
files.forEach(file => {
|
files.forEach((file) => {
|
||||||
console.log(`📄 ${file.name} (${file.size} bytes)`);
|
console.log(`📄 ${file.name} (${file.size} bytes)`);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -169,7 +169,7 @@ describe('S3 Operations', () => {
|
|||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
s3Server = await Smarts3.createAndStart({
|
s3Server = await Smarts3.createAndStart({
|
||||||
port: 9999,
|
port: 9999,
|
||||||
cleanSlate: true
|
cleanSlate: true,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -196,7 +196,7 @@ describe('S3 Operations', () => {
|
|||||||
before(async () => {
|
before(async () => {
|
||||||
s3Server = await Smarts3.createAndStart({
|
s3Server = await Smarts3.createAndStart({
|
||||||
port: 9999,
|
port: 9999,
|
||||||
cleanSlate: true
|
cleanSlate: true,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -229,16 +229,16 @@ const s3Client = new S3Client({
|
|||||||
region: 'us-east-1',
|
region: 'us-east-1',
|
||||||
credentials: {
|
credentials: {
|
||||||
accessKeyId: config.accessKey,
|
accessKeyId: config.accessKey,
|
||||||
secretAccessKey: config.accessSecret
|
secretAccessKey: config.accessSecret,
|
||||||
},
|
},
|
||||||
forcePathStyle: true
|
forcePathStyle: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Use AWS SDK as normal
|
// Use AWS SDK as normal
|
||||||
const command = new PutObjectCommand({
|
const command = new PutObjectCommand({
|
||||||
Bucket: 'my-bucket',
|
Bucket: 'my-bucket',
|
||||||
Key: 'test-file.txt',
|
Key: 'test-file.txt',
|
||||||
Body: 'Hello from AWS SDK!'
|
Body: 'Hello from AWS SDK!',
|
||||||
});
|
});
|
||||||
|
|
||||||
await s3Client.send(command);
|
await s3Client.send(command);
|
||||||
@@ -256,7 +256,7 @@ export async function setupTestEnvironment() {
|
|||||||
// Start S3 server for CI tests
|
// Start S3 server for CI tests
|
||||||
const s3 = await Smarts3.createAndStart({
|
const s3 = await Smarts3.createAndStart({
|
||||||
port: process.env.S3_PORT || 3000,
|
port: process.env.S3_PORT || 3000,
|
||||||
cleanSlate: true
|
cleanSlate: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create test buckets
|
// Create test buckets
|
||||||
@@ -312,8 +312,14 @@ async function testDataMigration() {
|
|||||||
const sourceDir = await source.getBaseDirectory();
|
const sourceDir = await source.getBaseDirectory();
|
||||||
|
|
||||||
// Add test files
|
// Add test files
|
||||||
await sourceDir.fastStore('user-1.json', JSON.stringify({ id: 1, name: 'Alice' }));
|
await sourceDir.fastStore(
|
||||||
await sourceDir.fastStore('user-2.json', JSON.stringify({ id: 2, name: 'Bob' }));
|
'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
|
// Run your migration logic
|
||||||
await runMigration(config);
|
await runMigration(config);
|
||||||
@@ -347,7 +353,7 @@ const customDescriptor = await s3Server.getS3Descriptor({
|
|||||||
```typescript
|
```typescript
|
||||||
const config = {
|
const config = {
|
||||||
port: parseInt(process.env.S3_PORT || '3000'),
|
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);
|
const s3Server = await Smarts3.createAndStart(config);
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@push.rocks/smarts3',
|
name: '@push.rocks/smarts3',
|
||||||
version: '2.2.6',
|
version: '2.2.7',
|
||||||
description: 'A Node.js TypeScript package to create a local S3 endpoint for simulating AWS S3 operations using mapped local directories for development and testing purposes.'
|
description: 'A Node.js TypeScript package to create a local S3 endpoint for simulating AWS S3 operations using mapped local directories for development and testing purposes.'
|
||||||
}
|
}
|
||||||
|
|||||||
12
ts/index.ts
12
ts/index.ts
@@ -8,7 +8,9 @@ export interface ISmarts3ContructorOptions {
|
|||||||
|
|
||||||
export class Smarts3 {
|
export class Smarts3 {
|
||||||
// STATIC
|
// STATIC
|
||||||
public static async createAndStart(optionsArg: ConstructorParameters<typeof Smarts3>[0]) {
|
public static async createAndStart(
|
||||||
|
optionsArg: ConstructorParameters<typeof Smarts3>[0],
|
||||||
|
) {
|
||||||
const smartS3Instance = new Smarts3(optionsArg);
|
const smartS3Instance = new Smarts3(optionsArg);
|
||||||
await smartS3Instance.start();
|
await smartS3Instance.start();
|
||||||
return smartS3Instance;
|
return smartS3Instance;
|
||||||
@@ -43,7 +45,7 @@ export class Smarts3 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async getS3Descriptor(
|
public async getS3Descriptor(
|
||||||
optionsArg?: Partial<plugins.tsclass.storage.IS3Descriptor>
|
optionsArg?: Partial<plugins.tsclass.storage.IS3Descriptor>,
|
||||||
): Promise<plugins.tsclass.storage.IS3Descriptor> {
|
): Promise<plugins.tsclass.storage.IS3Descriptor> {
|
||||||
return {
|
return {
|
||||||
...{
|
...{
|
||||||
@@ -53,12 +55,14 @@ export class Smarts3 {
|
|||||||
port: this.options.port,
|
port: this.options.port,
|
||||||
useSsl: false,
|
useSsl: false,
|
||||||
},
|
},
|
||||||
...(optionsArg? optionsArg : {})
|
...(optionsArg ? optionsArg : {}),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public async createBucket(bucketNameArg: string) {
|
public async createBucket(bucketNameArg: string) {
|
||||||
const smartbucketInstance = new plugins.smartbucket.SmartBucket(await this.getS3Descriptor());
|
const smartbucketInstance = new plugins.smartbucket.SmartBucket(
|
||||||
|
await this.getS3Descriptor(),
|
||||||
|
);
|
||||||
const bucket = await smartbucketInstance.createBucket(bucketNameArg);
|
const bucket = await smartbucketInstance.createBucket(bucketNameArg);
|
||||||
return bucket;
|
return bucket;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"experimentalDecorators": true,
|
|
||||||
"useDefineForClassFields": false,
|
|
||||||
"target": "ES2022",
|
"target": "ES2022",
|
||||||
"module": "NodeNext",
|
"module": "NodeNext",
|
||||||
"moduleResolution": "NodeNext",
|
"moduleResolution": "NodeNext",
|
||||||
@@ -10,7 +8,5 @@
|
|||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"paths": {}
|
"paths": {}
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": ["dist_*/**/*.d.ts"]
|
||||||
"dist_*/**/*.d.ts"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user