@toruslabs/torus-scripts
Vite+ config fragments for libraries, React, and Node packages. The presets do not install framework build plugins.
Install
Install @toruslabs/torus-scripts and vite-plus in your project.
Build presets
@toruslabs/torus-scripts/library:libraryPreset({ entry: "src/index.ts" })for ESM library builds.@toruslabs/torus-scripts/react:reactPreset()selects the automatic JSX runtime. Add@vitejs/plugin-reactfor Fast Refresh or its transforms.@toruslabs/torus-scripts/node:nodePreset({ entry: "src/index.ts" })targets Node and keeps dependencies external. Use a separate build for decorator metadata.
Compile Vue single-file components with @vitejs/plugin-vue in your project. Use libraryPreset({ entry: "src/index.ts" }) for the pack.
These fragments do not set CSS injection, browser targets, assets, SSR transforms, or use client. Set these options in your project.
Format
formatPreset() is at @toruslabs/torus-scripts/fmt. It sets 150 columns, double quotes, semicolons, ES5 trailing commas, and import sorting. It does not sort exports.
import { formatPreset } from "@toruslabs/torus-scripts/fmt";
import { defineConfig } from "vite-plus";
export default defineConfig({ fmt: formatPreset() });
Lint
Install one of @toruslabs/oxlint-config-typescript, @toruslabs/oxlint-config-react, @toruslabs/oxlint-config-vue, or @toruslabs/oxlint-config-node. The TypeScript preset checks both JavaScript and TypeScript. React, Vue, and Node extend it. This package does not export /lint or /vue-lint.
The Vue preset enables only the Vize template rules in vueTemplateRules, and fixture tests prove each one. It uses the Vize Oxlint plugin through vp lint and vp check. These commands can skip a .vue file that has no <script> block, so they do not check template-only files. The preset's native no-unused-vars options report unused arguments and caught errors in .ts files, but vp lint does not report that rule for .vue script blocks. Run a separate check for these gaps and verify it in your project.
React and Vue each export an optional tailwindLintPreset({ entryPoint: "src/styles.css" }) fragment. Install oxlint-tailwindcss if you use this fragment. Vue projects import it from @toruslabs/oxlint-config-vue, not the React package.
Do not combine the fragment and a framework preset with a plain object spread. { ...vueLintPreset(), ...tailwindLintPreset({ entryPoint }) } replaces jsPlugins, rules, and settings. This removes the Vize rules and oxlint-plugin-vize, or the React Hooks rules, and lint can still exit 0. Merge each field:
import { tailwindLintPreset, vueLintPreset } from "@toruslabs/oxlint-config-vue";
import { defineConfig } from "vite-plus";
const framework = vueLintPreset();
const tailwind = tailwindLintPreset({ entryPoint: "src/styles.css" });
export default defineConfig({
lint: {
...framework,
jsPlugins: [...(framework.jsPlugins ?? []), ...(tailwind.jsPlugins ?? [])],
rules: { ...framework.rules, ...tailwind.rules },
settings: { ...framework.settings, ...tailwind.settings },
},
});
For React, import reactLintPreset and tailwindLintPreset from @toruslabs/oxlint-config-react and merge the same fields. Tailwind class checks run on JS, TS, JSX, and TSX, including supported Vue script blocks; they do not check Vue template classes or CSS files.
The old @toruslabs/eslint-config-* packages are removed. Do not treat an Oxlint rule as equal to an old ESLint rule until you test it in your project.
Upgrade from the old CLI
The package includes an agent skill at skills/migrating-to-torus-cli/SKILL.md. In a consumer project, read it at node_modules/@toruslabs/torus-scripts/skills/migrating-to-torus-cli/SKILL.md. To make it available as a project skill in Cursor, copy it to .cursor/skills/migrating-to-torus-cli/SKILL.md in that project. Keep the skill and this README from the same package version.
Run torus-scripts-upgrade <path> to inspect an old project without changing files. It reports unsupported custom behavior and exits nonzero for those cases. Run vp migrate at the workspace root, not inside each package, and review its changes. The diagnostic does not run vp migrate for you.
Replace the old commands:
torus-scripts build→ definepackin the consumer'svite.config.ts, then runvp pack.torus-scripts lint→ select an Oxlint package, set rootlintandfmtconfig, then runvp check.torus-scripts start→ set the consumer's Vite+ dev task. No shared dev server ships.torus-scripts release→ use Changesets at the repository root.- Lerna workspace tasks → run
vp run -r buildwith explicit build tasks.
TypeScript profiles
@toruslabs/config exports tsconfig.base.json, tsconfig.library.json, and tsconfig.node.json. Replace tsconfig.default.json or tsconfig.build.json with the matching profile.