test
This commit is contained in:
commit
6dd46a9961
13
.cnb.yml
Normal file
13
.cnb.yml
Normal file
@ -0,0 +1,13 @@
|
||||
# .cnb.yml
|
||||
$:
|
||||
vscode:
|
||||
- docker:
|
||||
image: docker.cnb.cool/kevisual/dev-env:latest
|
||||
services:
|
||||
- vscode
|
||||
- docker
|
||||
imports: https://cnb.cool/kevisual/env/-/blob/main/env.yml
|
||||
# 开发环境启动后会执行的任务
|
||||
stages:
|
||||
- name: pnpm install
|
||||
script: pnpm install
|
66
.gitignore
vendored
Normal file
66
.gitignore
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
node_modules
|
||||
|
||||
# mac
|
||||
.DS_Store
|
||||
|
||||
.env*
|
||||
!.env*example
|
||||
|
||||
dist
|
||||
build
|
||||
logs
|
||||
|
||||
.turbo
|
||||
|
||||
pack-dist
|
||||
|
||||
# astro
|
||||
.astro
|
||||
|
||||
# next
|
||||
.next
|
||||
|
||||
# nuxt
|
||||
.nuxt
|
||||
|
||||
# vercel
|
||||
.vercel
|
||||
|
||||
# vuepress
|
||||
.vuepress/dist
|
||||
|
||||
# coverage
|
||||
coverage/
|
||||
|
||||
# typescript
|
||||
*.tsbuildinfo
|
||||
|
||||
# debug logs
|
||||
*.log
|
||||
*.tmp
|
||||
|
||||
# vscode
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
|
||||
# idea
|
||||
.idea
|
||||
|
||||
# system
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
Desktop.ini
|
||||
|
||||
# temp files
|
||||
*.tmp
|
||||
*.temp
|
||||
|
||||
# local development
|
||||
*.local
|
||||
|
||||
public/r
|
||||
|
||||
.pnpm-store
|
3
.npmrc
Normal file
3
.npmrc
Normal file
@ -0,0 +1,3 @@
|
||||
//npm.xiongxiao.me/:_authToken=${ME_NPM_TOKEN}
|
||||
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
|
||||
ignore-workspace-root-check=true
|
24
bun.config.mjs
Normal file
24
bun.config.mjs
Normal file
@ -0,0 +1,24 @@
|
||||
// @ts-check
|
||||
import { resolvePath } from '@kevisual/use-config/env';
|
||||
import { execSync } from 'node:child_process';
|
||||
|
||||
const entry = 'src/index.ts';
|
||||
const naming = 'app';
|
||||
/**
|
||||
* @type {import('bun').BuildConfig}
|
||||
*/
|
||||
await Bun.build({
|
||||
target: 'node',
|
||||
format: 'esm',
|
||||
entrypoints: [resolvePath(entry, { meta: import.meta })],
|
||||
outdir: resolvePath('./dist', { meta: import.meta }),
|
||||
naming: {
|
||||
entry: `${naming}.js`,
|
||||
},
|
||||
external: [],
|
||||
env: 'KEVISUAL_*',
|
||||
});
|
||||
|
||||
// const cmd = `dts -i src/index.ts -o app.d.ts`;
|
||||
const cmd = `dts -i ${entry} -o ${naming}.d.ts`;
|
||||
execSync(cmd, { stdio: 'inherit' });
|
22
kevisual.json
Normal file
22
kevisual.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"sync": {
|
||||
".gitignore": {
|
||||
"url": "https://kevisual.xiongxiao.me/root/ai/code/config/gitignore/node.txt"
|
||||
},
|
||||
".npmrc": {
|
||||
"url": "https://kevisual.xiongxiao.me/root/ai/code/config/npm/.npmrc"
|
||||
},
|
||||
"tsconfig.json": {
|
||||
"url": "https://kevisual.xiongxiao.me/root/ai/code/config/ts/backend.json"
|
||||
},
|
||||
"bun.config.mjs": {
|
||||
"url": "https://kevisual.xiongxiao.me/root/ai/code/config/bun/bun.config.mjs"
|
||||
},
|
||||
".cnb.yml": {
|
||||
"url": "https://kevisual.xiongxiao.me/root/ai/code/config/cnb/dev.yml"
|
||||
},
|
||||
"package.json": {
|
||||
"url": "https://kevisual.xiongxiao.me/root/ai/code/config/npm/back-01-base/package.json"
|
||||
}
|
||||
}
|
||||
}
|
BIN
my_duckdb.db
Normal file
BIN
my_duckdb.db
Normal file
Binary file not shown.
BIN
my_duckdb.db.wal
Normal file
BIN
my_duckdb.db.wal
Normal file
Binary file not shown.
66
package.json
Normal file
66
package.json
Normal file
@ -0,0 +1,66 @@
|
||||
{
|
||||
"name": "demo-app",
|
||||
"version": "0.0.1",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"basename": "/root/demo-app",
|
||||
"app": {
|
||||
"key": "demo-app",
|
||||
"entry": "dist/app.js",
|
||||
"type": "system-app",
|
||||
"files": [
|
||||
"dist"
|
||||
]
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 bun --watch src/dev.ts ",
|
||||
"build": "rimraf dist && bun run bun.config.mjs",
|
||||
"test": "tsx test/**/*.ts",
|
||||
"clean": "rm -rf dist",
|
||||
"pub": "npm run build && envision pack -p -u",
|
||||
"cmd": "tsx cmd/index.ts "
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "abearxiong <xiongxiao@xiongxiao.me>",
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
"types": "types/index.d.ts",
|
||||
"files": [
|
||||
"dist",
|
||||
"src"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"dependencies": {
|
||||
"@duckdb/node-api": "1.3.0-alpha.21",
|
||||
"@kevisual/code-center-module": "0.0.19",
|
||||
"@kevisual/router": "0.0.21",
|
||||
"@kevisual/use-config": "^1.0.17",
|
||||
"cookie": "^1.0.2",
|
||||
"dayjs": "^1.11.13",
|
||||
"formidable": "^3.5.4",
|
||||
"lodash-es": "^4.17.21"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@kevisual/types": "^0.0.10",
|
||||
"@kevisual/use-config": "^1.0.17",
|
||||
"@types/bun": "^1.2.14",
|
||||
"@types/crypto-js": "^4.2.2",
|
||||
"@types/formidable": "^3.4.5",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"@types/node": "^22.15.21",
|
||||
"commander": "^14.0.0",
|
||||
"concurrently": "^9.1.2",
|
||||
"cross-env": "^7.0.3",
|
||||
"inquire": "^0.4.8",
|
||||
"ioredis": "^5.6.1",
|
||||
"nodemon": "^3.1.10",
|
||||
"pg": "^8.16.0",
|
||||
"rimraf": "^6.0.1",
|
||||
"sequelize": "^6.37.7",
|
||||
"tape": "^5.9.0",
|
||||
"typescript": "^5.8.3"
|
||||
},
|
||||
"packageManager": "pnpm@10.11.0"
|
||||
}
|
2617
pnpm-lock.yaml
generated
Normal file
2617
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
33
src/index.ts
Normal file
33
src/index.ts
Normal file
@ -0,0 +1,33 @@
|
||||
import { DuckDBInstance } from '@duckdb/node-api';
|
||||
|
||||
const instance = await DuckDBInstance.create('my_duckdb.db');
|
||||
|
||||
const connection = await instance.connect();
|
||||
|
||||
// await connection.run(`create or replace table target_table(i integer, v varchar)`);
|
||||
|
||||
// const appender = await connection.createAppender('target_table');
|
||||
|
||||
// appender.appendInteger(42);
|
||||
// appender.appendVarchar('duck');
|
||||
// appender.endRow();
|
||||
|
||||
// appender.appendInteger(123);
|
||||
// appender.appendVarchar('mallard');
|
||||
// appender.endRow();
|
||||
|
||||
// appender.flushSync();
|
||||
|
||||
// appender.appendInteger(17);
|
||||
// appender.appendVarchar('goose');
|
||||
// appender.endRow();
|
||||
// appender.flushSync();
|
||||
|
||||
|
||||
// appender.closeSync(); // also flushes
|
||||
|
||||
const reader = await connection.runAndReadAll('from target_table');
|
||||
|
||||
const rows = reader.getRowsJson();
|
||||
|
||||
console.log(rows);
|
18
tsconfig.json
Normal file
18
tsconfig.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"extends": "@kevisual/types/json/backend.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"typeRoots": [
|
||||
"./node_modules/@types",
|
||||
"./node_modules/@kevisual"
|
||||
],
|
||||
"paths": {
|
||||
"@/*": [
|
||||
"src/*"
|
||||
]
|
||||
},
|
||||
},
|
||||
"include": [
|
||||
"src/**/*",
|
||||
],
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user