Skip to content

Commit 1acd333

Browse files
committed
chore: code cleanup
1 parent af4df1f commit 1acd333

File tree

23 files changed

+325
-429
lines changed

23 files changed

+325
-429
lines changed

.github/workflows/auto-publish.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ jobs:
2424
with:
2525
node-version: '18'
2626
registry-url: 'https://registry.npmjs.org'
27-
28-
- name: Setup Docker Buildx
29-
uses: docker/setup-buildx-action@v3
3027

3128
- name: Install dependencies
3229
run: npm install

.github/workflows/test.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ jobs:
1717
uses: actions/setup-node@v4
1818
with:
1919
node-version: '18'
20-
21-
- name: Setup Docker Buildx
22-
uses: docker/setup-buildx-action@v3
2320

2421
- name: Install dependencies
2522
run: npm install

.npmignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
vlt-lock.json
2+
vlt.json
3+
contributing.md
4+
packages/
5+
scripts/
6+
.github/

CONTRIBUTING.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Contributing
2+
3+
## Development
4+
5+
### Prerequisites
6+
7+
- Node.js 18+
8+
- `tar` command (available on macOS/Linux by default)
9+
- npm account with publishing permissions
10+
11+
### Scripts
12+
13+
```bash
14+
# Check for new versions
15+
npm run check-version
16+
17+
# Extract binaries from GitHub releases
18+
npm run extract-binaries
19+
20+
# Build everything (check + extract)
21+
npm run build
22+
23+
# Test all binaries
24+
npm run test
25+
26+
# Publish all packages to npm
27+
npm run publish-all
28+
```
29+
30+
### Versioning
31+
32+
Set the versions across all packages & update the root's dependency specs
33+
34+
```bash
35+
$ npm run version --ws --iwr 0.24.1-pre.2
36+
```
37+
38+
> Note: `npm` will error because of the optional deps `"os"` & `"cpu"` definitions. You can safely ignore this error as the operation will still successfully update the `package.json
39+
40+
### Publishing
41+
42+
Setting a `--tag` may not be desired depending on if its a prerelease
43+
44+
```bash
45+
$ npm publish --ws --iwr --tag latest --access public
46+
```
47+
48+
### GitHub Actions
49+
50+
Two workflows are included:
51+
52+
1. **`auto-publish.yml`**: Runs daily and on pushes to main, automatically publishes new versions
53+
2. **`test.yml`**: Manual testing workflow that builds but doesn't publish
54+
55+
To set up automated publishing, add these secrets to your GitHub repository:
56+
57+
- `NPM_TOKEN`: Your npm authentication token with publish permissions

README.md

Lines changed: 15 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
A package wrapper for [libsql-server](https://github.com/tursodatabase/libsql) (`sqld`) with platform-specific binaries.
44

5-
This package automatically downloads and publishes the latest `libsql-server` releases from the official Docker container, making them available as npm packages with platform-specific binaries.
5+
This package automatically downloads and publishes the latest `libsql-server` releases from the [official GitHub releases](https://github.com/tursodatabase/libsql/releases?q=libsql-server-), making them available as npm packages with platform-specific binaries.
66

77
## Installation
88

@@ -42,150 +42,34 @@ vlx sqld --help
4242
vlx sqld --db-path ./my-database.db
4343
```
4444

45-
### Programmatic API
46-
47-
```javascript
48-
const sqld = require('sqld');
49-
50-
// Execute sqld synchronously
51-
try {
52-
const result = sqld.execSync(['--help']);
53-
console.log(result.toString());
54-
} catch (error) {
55-
console.error('Error:', error.message);
56-
}
57-
58-
// Execute sqld asynchronously
59-
const child = sqld.exec(['--db-path', './my-database.db']);
60-
61-
child.stdout.on('data', (data) => {
62-
console.log('stdout:', data.toString());
63-
});
64-
65-
child.stderr.on('data', (data) => {
66-
console.error('stderr:', data.toString());
67-
});
68-
69-
child.on('exit', (code) => {
70-
console.log('Process exited with code:', code);
71-
});
72-
73-
// Get the binary path
74-
const binaryPath = sqld.getBinaryPath();
75-
console.log('Binary located at:', binaryPath);
76-
77-
// Get the platform package name
78-
const platformPackage = sqld.getPlatformPackage();
79-
console.log('Using platform package:', platformPackage);
80-
```
81-
8245
## How It Works
8346

84-
This project uses a multi-package approach:
47+
This project uses a simple platform-specific binary distribution approach:
8548

86-
1. **Main Package (`sqld`)**: Contains the Node.js wrapper and CLI interface
87-
2. **Platform Packages**: Contains the actual binaries for each platform:
88-
- `@sqld/darwin-arm64`
89-
- `@sqld/darwin-x64`
90-
- `@sqld/linux-arm64`
91-
- `@sqld/linux-x64`
49+
1. **Platform Detection**: The package manager automatically installs only the compatible platform package based on your OS and architecture
50+
2. **Direct Binary Access**: Each platform package directly provides the `sqld` binary through its `bin` field
51+
3. **No Wrapper**: No JavaScript wrapper or bootstrap code - the platform packages directly expose the native `sqld` binary
9252

93-
The main package declares the platform packages as optional dependencies. When you install `sqld`, your package manager will only install the package that matches your current platform.
53+
### Automated Updates
9454

95-
## Automated Updates
55+
The project automatically checks for new `libsql-server` releases daily using GitHub Actions:
9656

97-
This project automatically checks for new `libsql-server` releases daily using GitHub Actions:
98-
99-
1. **Daily Check**: Runs at 9 AM UTC to check for new releases
100-
2. **Binary Extraction**: Downloads the Docker container and extracts platform-specific binaries
57+
1. **Daily Check**: Runs at 9 AM UTC to check for new releases from the [libsql GitHub repository](https://github.com/tursodatabase/libsql/releases?q=libsql-server-)
58+
2. **Binary Extraction**: Downloads platform-specific tarballs and extracts the `sqld` binaries
10159
3. **Testing**: Verifies that all binaries work correctly
102-
4. **Publishing**: Automatically publishes new versions to `npmjs.com`
60+
4. **Publishing**: Automatically publishes new versions to npm
10361
5. **Git Commit**: Commits the updated binaries to the repository
10462

105-
## Development
106-
107-
### Prerequisites
108-
109-
- Node.js 18+
110-
- `vlt` (`npm i -g vlt`)
111-
112-
### Scripts
113-
114-
```bash
115-
# Check for new versions
116-
vlr check-version
117-
118-
# Extract binaries from Docker containers
119-
vlr extract-binaries
120-
121-
# Build everything (check + extract)
122-
vlr build
123-
124-
# Test all binaries
125-
clr test
126-
127-
# Publish all packages to npm
128-
vlr publish-all
129-
```
130-
131-
### Manual Testing
132-
133-
You can test the build process manually:
134-
135-
```bash
136-
# Install dependencies
137-
vlt install
138-
139-
# Extract the latest binaries
140-
vlr extract-binaries
141-
142-
# Test that everything works
143-
vlr test
144-
145-
# Test the CLI
146-
./bin/sqld --help
147-
```
148-
149-
### GitHub Actions
150-
151-
Two workflows are included:
152-
153-
1. **`auto-publish.yml`**: Runs daily and on pushes to main, automatically publishes new versions
154-
2. **`test.yml`**: Manual testing workflow that builds but doesn't publish
155-
156-
To set up automated publishing, add these secrets to your GitHub repository:
157-
158-
- `NPM_TOKEN`: Your npm authentication token with publish permissions
159-
160-
## Project Structure
161-
162-
```
163-
sqld/
164-
├── package.json # Main package configuration
165-
├── lib/index.js # Node.js API
166-
├── bin/sqld # CLI wrapper
167-
├── scripts/
168-
│ ├── check-version.js # Check for new releases
169-
│ ├── extract-binaries.js # Extract binaries from Docker
170-
│ ├── build.js # Build orchestration
171-
│ ├── publish-all.js # Publish all packages
172-
│ └── test.js # Test all binaries
173-
├── packages/
174-
│ ├── darwin-arm64/ # macOS ARM64 package
175-
│ ├── darwin-x64/ # macOS x64 package
176-
│ ├── linux-arm64/ # Linux ARM64 package
177-
│ └── linux-x64/ # Linux x64 package
178-
└── .github/workflows/ # GitHub Actions
179-
```
63+
The project uses the following release artifacts for each platform:
64+
- **macOS ARM64**: `libsql-server-aarch64-apple-darwin.tar.xz`
65+
- **macOS x64**: `libsql-server-x86_64-apple-darwin.tar.xz`
66+
- **Linux ARM64**: `libsql-server-aarch64-unknown-linux-gnu.tar.xz`
67+
- **Linux x64**: `libsql-server-x86_64-unknown-linux-gnu.tar.xz`
18068

18169
## License
18270

18371
MIT
18472

185-
## Contributing
186-
187-
Contributions are welcome! Please feel free to submit a Pull Request.
188-
18973
## Related Projects
19074

19175
- [libsql](https://github.com/tursodatabase/libsql) - The original libSQL project

bin/sqld

Lines changed: 0 additions & 22 deletions
This file was deleted.

lib/index.js

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)