Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

refactor!: make it all one package #45

Merged
merged 7 commits into from
Aug 12, 2024
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
5 changes: 5 additions & 0 deletions .changeset/breezy-nails-love.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@scalar/snippetz': minor
---

refactor!: move everything into a single package with multiple entrypoints
27 changes: 13 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,19 @@
[![Contributors](https://img.shields.io/github/contributors/scalar/snippetz)](https://github.com/scalar/snippetz/graphs/contributors)
[![GitHub License](https://img.shields.io/github/license/scalar/snippetz)](https://github.com/scalar/snippetz/blob/main/LICENSE)
[![Version](https://img.shields.io/npm/v/%40scalar/snippetz)](https://www.npmjs.com/package/@scalar/snippetz)
[![Discord](https://img.shields.io/discord/1135330207960678410?style=flat&color=5865F2)](https://discord.gg/8HeZcRGPFS)

> [!WARNING]
> This package is in early development. Don’t use it in production!
[![Discord](https://img.shields.io/discord/1135330207960678410?style=flat&color=5865F2)](https://discord.gg/scalar)

A modern way to generate code examples for different languages.

## Installation

```
```bash
npm install @scalar/snippetz
```

## Usage

```js
```ts
import { snippetz } from '@scalar/snippetz'

const snippet = snippetz().print('node', 'undici', {
Expand All @@ -39,7 +36,7 @@ const snippet = snippetz().print('node', 'undici', {

### Get all plugins

```js
```ts
import { snippetz } from '@scalar/snippetz'

const snippet = snippetz().plugins()
Expand All @@ -56,7 +53,7 @@ const snippet = snippetz().plugins()

### Check if a plugin is loaded

```js
```ts
import { snippetz } from '@scalar/snippetz'

const snippet = snippetz().hasPlugin('node', 'undici')
Expand All @@ -66,10 +63,12 @@ const snippet = snippetz().hasPlugin('node', 'undici')
// true
```

### Use just one plugin
### Lean usage

```js
import { undici } from '@scalar/snippetz-plugin-undici'
You can also just use one specific plugin to keep your bundle size small.

```ts
import { undici } from '@scalar/snippetz/plugins/node/undici'

const source = undici({
url: 'https://example.com',
Expand All @@ -86,10 +85,12 @@ console.log(source.code)

## Community

We are API nerds. You too? Let’s chat on Discord: <https://discord.gg/8HeZcRGPFS>
We are API nerds. You too? Let’s chat on Discord: <https://discord.gg/scalar>

## Contributors

Contributions are welcome! Read [`CONTRIBUTING`](https://github.com/scalar/snippetz/blob/main/CONTRIBUTING).

<!-- readme: collaborators,contributors -start -->
<table>
<tbody>
Expand All @@ -113,8 +114,6 @@ We are API nerds. You too? Let’s chat on Discord: <https://discord.gg/8HeZcRGP
</table>
<!-- readme: collaborators,contributors -end -->

Contributions are welcome! Read [`CONTRIBUTING`](https://github.com/scalar/snippetz/blob/main/CONTRIBUTING).

## License

The source code in this repository is licensed under [MIT](https://github.com/scalar/snippetz/blob/main/LICENSE).
9 changes: 0 additions & 9 deletions demo/CHANGELOG.md

This file was deleted.

1 change: 0 additions & 1 deletion demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
},
"dependencies": {
"@scalar/snippetz": "workspace:*",
"@scalar/snippetz-core": "workspace:*",
"vue": "^3.4.35"
},
"devDependencies": {
Expand Down
3 changes: 1 addition & 2 deletions demo/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script setup lang="ts">
import CodeExample from './components/CodeExample.vue'
import { snippetz } from '@scalar/snippetz'
import { type ClientId, type TargetId } from '@scalar/snippetz-core'
import { snippetz, type ClientId, type TargetId } from '@scalar/snippetz'
import { ref } from 'vue'

const selectedTarget = ref<TargetId>('node')
Expand Down
2 changes: 1 addition & 1 deletion demo/src/components/CodeExample.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
objectToString,
type ClientId,
type TargetId,
} from '@scalar/snippetz-core'
} from '@scalar/snippetz/core'
import { getHighlighter } from 'shikiji'

const props = defineProps<{
Expand Down
3 changes: 0 additions & 3 deletions demo/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,4 @@ import { defineConfig } from 'vitest/config'

export default defineConfig({
plugins: [vue()],
resolve: {
dedupe: ['vue'],
},
})
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
"devDependencies": {
"@changesets/cli": "^2.27.7",
"@vitest/ui": "^2.0.5",
"rollup": "^4.19.2",
"tsc-alias": "^1.8.10",
"tslib": "^2.6.3",
"turbo": "^2.0.11",
"typescript": "^5.5.4",
"vite": "^5.3.5",
Expand Down
32 changes: 0 additions & 32 deletions packages/snippetz-core/CHANGELOG.md

This file was deleted.

39 changes: 0 additions & 39 deletions packages/snippetz-core/package.json

This file was deleted.

2 changes: 0 additions & 2 deletions packages/snippetz-core/src/index.ts

This file was deleted.

3 changes: 0 additions & 3 deletions packages/snippetz-core/src/utils/index.ts

This file was deleted.

12 changes: 0 additions & 12 deletions packages/snippetz-core/tsconfig.build.json

This file was deleted.

5 changes: 0 additions & 5 deletions packages/snippetz-core/tsconfig.json

This file was deleted.

36 changes: 0 additions & 36 deletions packages/snippetz-core/vite.config.ts

This file was deleted.

19 changes: 0 additions & 19 deletions packages/snippetz-plugin-js-fetch/CHANGELOG.md

This file was deleted.

40 changes: 0 additions & 40 deletions packages/snippetz-plugin-js-fetch/package.json

This file was deleted.

12 changes: 0 additions & 12 deletions packages/snippetz-plugin-js-fetch/tsconfig.build.json

This file was deleted.

5 changes: 0 additions & 5 deletions packages/snippetz-plugin-js-fetch/tsconfig.json

This file was deleted.

22 changes: 0 additions & 22 deletions packages/snippetz-plugin-js-fetch/vite.config.ts

This file was deleted.

Loading