Skip to content

Commit

Permalink
Merge pull request #9 from underscope/chore/bump-deps
Browse files Browse the repository at this point in the history
Maintenence & improved dev setup
  • Loading branch information
underscope authored Oct 22, 2024
2 parents 8aa44a6 + cd74535 commit 50396d3
Show file tree
Hide file tree
Showing 172 changed files with 5,387 additions and 5,135 deletions.
9 changes: 5 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
EXAMPLE_API_PORT=

# storage
ACCESS_KEY_ID=
SECRET_ACCESS_KEY=
REGION=
BUCKET=
S3_ENDPOINT=
S3_BUCKET=
S3_REGION=
S3_ACCESS_KEY_ID=
S3_SECRET_ACCESS_KEY=
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

13 changes: 0 additions & 13 deletions .eslintrc

This file was deleted.

1 change: 0 additions & 1 deletion .github/FUNDING.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set node
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 22.x

- name: Setup
run: npm i -g @antfu/ni
Expand All @@ -35,7 +35,7 @@ jobs:
- name: Set node
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 22.x

- name: Setup
run: npm i -g @antfu/ni
Expand Down
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ Utility for managing published Tailor content. Provides ability to:
- ✅ sign ContentElement assets for delivery
- 🚧 cache presigned Repository instance



Initialize garment by providing storage provider configuration.

```js
Expand All @@ -29,7 +27,7 @@ const garment = new Garment({
### Fetching resources

Retrieve the list of published repositories
```js
```js
garment.source().list()
```

Expand All @@ -52,7 +50,7 @@ of:
- `uid`
- `type` - Activity, Content Container or Content Element
- `parentId`
- `positionInAggregate` - location within the aggregate array;
- `positionInAggregate` - location within the aggregate array;
if denormalized object

```js
Expand Down Expand Up @@ -89,8 +87,8 @@ To get a list of all of the ancestors, use `getAncestors(uid)` method.
Content graph makes it simple to resolve where specific `Content Container` or
`Content Element` is, so we can retrieve only content items we need (and we
can more easily navigate within a aggregate structure; e.g. if we want to
get a specific `Content Element` which might be located in a
`Content Container`). To resolve `Content Container` or a `Content Element`
get a specific `Content Element` which might be located in a
`Content Container`). To resolve `Content Container` or a `Content Element`
location, use:

```js
Expand Down
12 changes: 0 additions & 12 deletions build.config.ts

This file was deleted.

24 changes: 24 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import dotenv from 'dotenv'

dotenv.config({ path: '.env' })

const app = {
port: process.env.EXAMPLE_API_PORT || 3030,
}

export const storage = {
provider: 'aws',
bucket: process.env.S3_BUCKET || 'test-bucket',
aws: {
endpoint: process.env.S3_ENDPOINT || 'http://localhost:4566',
region: process.env.S3_REGION || 'us-east-1',
keyId: process.env.S3_ACCESS_KEY_ID || 'test-key-id',
secretKey: process.env.S3_SECRET_ACCESS_KEY || 'test-secret',
forcePathStyle: true,
},
}

export default {
...app,
storage,
}
8 changes: 8 additions & 0 deletions docker-compose.dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
services:
localstack-garment:
image: localstack/localstack
ports:
- '127.0.0.1:4566:4566'
environment:
- SERVICES=s3:4566
- DEFAULT_REGION=us-east-1
16 changes: 16 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// @ts-check
import antfu from '@antfu/eslint-config'

export default antfu({
type: 'lib',
ignores: ['seed/content/**'],
rules: {
'@typescript-eslint/explicit-function-return-type': 'off',
'antfu/no-import-dist': 'off',
'antfu/no-top-level-await': 'off',
'no-console': 'off',
'node/prefer-global/buffer': 'off',
'node/prefer-global/process': 'off',
'ts/no-unsafe-function-type': 'off',
},
})
20 changes: 0 additions & 20 deletions examples/api/config.js

This file was deleted.

13 changes: 8 additions & 5 deletions examples/api/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
const express = require('express')
const { Garment } = require('../../dist/index.cjs')
import { Garment } from '@tailor-cms/garment'
import express from 'express'

import config from '../../config.js'

const app = express()
const config = require('./config')

const { log } = console

const garment = new Garment(config.storage)
Expand All @@ -13,12 +15,13 @@ app.get('/', async (_, res) => {
})

app.get('/repository/:id', async ({ params, query }, res) => {
const public = !!query.public
const signAssets = !!query.public
const opts = { eager: !!query.eager }
const repository = query.snapshot
? await garment.snapshot().get(params.id, query.snapshot, opts)
: await garment.source().get(params.id, opts)
if (public) await repository.makePublic()
if (signAssets)
await repository.makePublic()
res.json({
size: repository.size,
location: repository.path,
Expand Down
Loading

0 comments on commit 50396d3

Please sign in to comment.