Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions .github/workflows/extract.yml

This file was deleted.

37 changes: 37 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Lint

on:
push:
branches: [main]
pull_request:

jobs:
type-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- run: bun install
- run: bun run type-check

lint-eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- run: bun install
- run: bun run lint-eslint

lint-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- run: bun install
- run: bun run lint-format
11 changes: 11 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ jobs:
node-version: "20"
registry-url: "https://registry.npmjs.org"

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Install dependencies
run: bun install

- name: Build
run: bun run build

- name: Compare local and published versions
id: check
run: |
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Test

on:
push:
branches: [main]
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- run: bun install
- run: bun run test
2 changes: 1 addition & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ jobs:

- run: bun install

- run: bun run bin/cli.js validate-schema --folder examples/v1
- run: bun run bin/cli.ts validate-schema --folder examples/v1
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ Desktop.ini
*.swp
*.swo
node_modules/
dist/
*.tgz
4 changes: 4 additions & 0 deletions .oxfmtrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"printWidth": 80,
"trailingComma": "all"
}
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,32 @@ npx @metabase/representations extract-schema --folder ./schemas

Omit `--folder` to extract into the current directory.

### Generating entity IDs

Print one or more 21-character NanoID entity IDs (one per line):

```sh
npx @metabase/representations generate-entity-id
npx @metabase/representations generate-entity-id --count 5
```

### Generating UUIDs

Print one or more v4 UUIDs (one per line):

```sh
npx @metabase/representations generate-uuid
npx @metabase/representations generate-uuid --count 5
```

### Programmatic

```js
import { validateSchema } from "@metabase/representations";
import {
generateEntityId,
generateUuid,
validateSchema,
} from "@metabase/representations";

const { results, passed, failed } = validateSchema({
folder: "./my-export",
Expand All @@ -71,6 +93,9 @@ for (const result of results) {
console.log(result.file, result.errors);
}
}

const entityId = generateEntityId(); // "LZfXLFzPPR4NNrgjlWDxn"
const uuid = generateUuid(); // "1d4e9fdf-49ae-4fbe-ae27-05e7c6a5cfe8"
```

## Publishing to NPM
Expand Down
79 changes: 0 additions & 79 deletions bin/cli.js

This file was deleted.

Loading
Loading