ai-localize-aws-cloudfront 2.0.5 → 2.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/LICENSE +21 -0
- package/README.md +84 -0
- package/package.json +15 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# ai-localize-aws-cloudfront
|
|
2
2
|
|
|
3
|
+
## 2.0.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Added `repository`, `homepage`, `bugs`, `author` fields to `package.json` for npm registry display.
|
|
8
|
+
- Added `sideEffects: false` to enable tree-shaking in bundlers.
|
|
9
|
+
- Added `prepublishOnly` script to ensure the package is built before publishing.
|
|
10
|
+
|
|
11
|
+
## 2.0.6
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Add per-package README.md files so each package displays documentation on npmjs.com
|
|
16
|
+
- Update README version badge to 2.0.6
|
|
17
|
+
|
|
3
18
|
## 2.0.3
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-2026 ai-localize-core contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# ai-localize-aws-cloudfront
|
|
2
|
+
|
|
3
|
+
> AWS S3 asset upload + CloudFront cache invalidation for the [ai-localize-core](https://github.com/ai-localize/ai-localize-core) platform.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/ai-localize-aws-cloudfront)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## What it does
|
|
11
|
+
|
|
12
|
+
- **`S3Uploader`** — uploads static assets to an S3 bucket with content-hash deduplication
|
|
13
|
+
- **`CloudFrontInvalidator`** — invalidates CloudFront distribution paths after upload
|
|
14
|
+
- **`CdnMigrator`** — orchestrates the full CDN migration: upload → replace legacy URLs → invalidate
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install ai-localize-aws-cloudfront
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Configuration
|
|
23
|
+
|
|
24
|
+
Add the `aws` block to `ai-localize.config.json`:
|
|
25
|
+
|
|
26
|
+
```json
|
|
27
|
+
{
|
|
28
|
+
"aws": {
|
|
29
|
+
"region": "us-east-1",
|
|
30
|
+
"bucket": "my-assets-bucket",
|
|
31
|
+
"distributionId": "E1ABCDEFGHIJKL",
|
|
32
|
+
"cdnBaseUrl": "https://d123.cloudfront.net",
|
|
33
|
+
"legacyCdnPattern": "https://old-cdn.company.com",
|
|
34
|
+
"assetsPrefix": "static-assets/v1",
|
|
35
|
+
"profile": "my-aws-profile"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Or via environment variables:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
AWS_S3_BUCKET=my-assets-bucket
|
|
44
|
+
AWS_CF_DISTRIBUTION_ID=E1ABCDEFGHIJKL
|
|
45
|
+
AI_LOCALIZE_CDN_BASE_URL=https://d123.cloudfront.net
|
|
46
|
+
AI_LOCALIZE_LEGACY_CDN_PATTERN=https://old-cdn.company.com
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Usage
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
import { S3Uploader, CloudFrontInvalidator, CdnMigrator } from 'ai-localize-aws-cloudfront';
|
|
53
|
+
|
|
54
|
+
// Upload assets
|
|
55
|
+
const uploader = new S3Uploader(config.aws);
|
|
56
|
+
const uploadedAssets = await uploader.upload('./public');
|
|
57
|
+
|
|
58
|
+
// Invalidate CloudFront
|
|
59
|
+
const invalidator = new CloudFrontInvalidator(config.aws);
|
|
60
|
+
await invalidator.invalidate(uploadedAssets.map(a => '/' + a.s3Key));
|
|
61
|
+
|
|
62
|
+
// Or use the all-in-one migrator
|
|
63
|
+
const migrator = new CdnMigrator(config);
|
|
64
|
+
const result = await migrator.migrate({ assetsDir: './public', invalidate: true });
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## CLI equivalent
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# One-step migration
|
|
71
|
+
npx ai-localize migrate-cdn --assets-dir ./public --invalidate
|
|
72
|
+
|
|
73
|
+
# Separate steps
|
|
74
|
+
npx ai-localize upload-assets --assets-dir ./public --output manifest.json
|
|
75
|
+
npx ai-localize replace-cdn --manifest manifest.json
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Part of ai-localize-core
|
|
81
|
+
|
|
82
|
+
Install the CLI for the complete toolset: `npm install -g ai-localize-cli`
|
|
83
|
+
|
|
84
|
+
MIT © ai-localize-core contributors
|
package/package.json
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-localize-aws-cloudfront",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.7",
|
|
4
4
|
"description": "S3 upload, CloudFront invalidation and CDN URL migration for ai-localize-core",
|
|
5
|
+
"author": "ai-localize-core contributors",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/ai-localize/ai-localize-core.git",
|
|
10
|
+
"directory": "packages/aws-cloudfront"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://github.com/ai-localize/ai-localize-core/tree/main/packages/aws-cloudfront#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/ai-localize/ai-localize-core/issues"
|
|
15
|
+
},
|
|
5
16
|
"main": "./dist/index.js",
|
|
6
17
|
"module": "./dist/index.mjs",
|
|
7
18
|
"types": "./dist/index.d.ts",
|
|
19
|
+
"sideEffects": false,
|
|
8
20
|
"files": [
|
|
9
21
|
"dist",
|
|
10
22
|
"README.md",
|
|
@@ -37,8 +49,8 @@
|
|
|
37
49
|
"@aws-sdk/client-cloudfront": "^3.511.0",
|
|
38
50
|
"@aws-sdk/lib-storage": "^3.511.0",
|
|
39
51
|
"mime-types": "^2.1.35",
|
|
40
|
-
"ai-localize-shared": "2.0.
|
|
41
|
-
"ai-localize-codemods": "2.0.
|
|
52
|
+
"ai-localize-shared": "2.0.7",
|
|
53
|
+
"ai-localize-codemods": "2.0.7"
|
|
42
54
|
},
|
|
43
55
|
"devDependencies": {
|
|
44
56
|
"@types/mime-types": "^2.1.4",
|
|
@@ -46,7 +58,6 @@
|
|
|
46
58
|
"typescript": "^5.3.3",
|
|
47
59
|
"vitest": "^1.2.1"
|
|
48
60
|
},
|
|
49
|
-
"license": "MIT",
|
|
50
61
|
"publishConfig": {
|
|
51
62
|
"access": "public"
|
|
52
63
|
},
|