@rtorcato/repo-tooling 2.59.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/AGENTS.md +113 -0
  2. package/LICENSE +21 -0
  3. package/README.md +201 -0
  4. package/dist/cli/commands/doctor.js +336 -0
  5. package/dist/cli/commands/fix-targets.js +192 -0
  6. package/dist/cli/commands/fix.js +440 -0
  7. package/dist/cli/commands/setup-presets.js +281 -0
  8. package/dist/cli/commands/setup.js +501 -0
  9. package/dist/cli/generators/agent-rules.js +103 -0
  10. package/dist/cli/generators/badges.js +88 -0
  11. package/dist/cli/generators/build.js +216 -0
  12. package/dist/cli/generators/bun.js +25 -0
  13. package/dist/cli/generators/community-health.js +145 -0
  14. package/dist/cli/generators/docs-site.js +436 -0
  15. package/dist/cli/generators/git.js +164 -0
  16. package/dist/cli/generators/github-actions.js +35 -0
  17. package/dist/cli/generators/github-workflows.js +24 -0
  18. package/dist/cli/generators/gitlab-ci.js +10 -0
  19. package/dist/cli/generators/index.js +123 -0
  20. package/dist/cli/generators/linting.js +54 -0
  21. package/dist/cli/generators/misc.js +298 -0
  22. package/dist/cli/generators/nx.js +16 -0
  23. package/dist/cli/generators/package-json.js +317 -0
  24. package/dist/cli/generators/pnpm-workspace.js +126 -0
  25. package/dist/cli/generators/postcss.js +24 -0
  26. package/dist/cli/generators/readme.js +268 -0
  27. package/dist/cli/generators/security.js +156 -0
  28. package/dist/cli/generators/skills-install.js +70 -0
  29. package/dist/cli/generators/tailwind.js +34 -0
  30. package/dist/cli/generators/testing.js +88 -0
  31. package/dist/cli/generators/treeshake.js +148 -0
  32. package/dist/cli/generators/tsconfig.js +27 -0
  33. package/dist/cli/generators/turborepo.js +35 -0
  34. package/dist/cli/generators/typedoc.js +40 -0
  35. package/dist/cli/index.js +332 -0
  36. package/dist/cli/utils/copy-preset.js +98 -0
  37. package/dist/cli/utils/detect-language.js +22 -0
  38. package/dist/cli/utils/format.js +32 -0
  39. package/dist/cli/utils/install.js +28 -0
  40. package/dist/cli/utils/lockfile.js +84 -0
  41. package/dist/languages/js/checks.js +949 -0
  42. package/dist/languages/js/ci.js +251 -0
  43. package/dist/languages/js/fixers.js +735 -0
  44. package/dist/languages/registry.js +37 -0
  45. package/dist/languages/swift/checks.js +127 -0
  46. package/dist/languages/swift/ci.js +165 -0
  47. package/dist/languages/swift/fixers.js +102 -0
  48. package/dist/languages/swift/git-hooks.js +63 -0
  49. package/dist/languages/swift/gitignore.js +43 -0
  50. package/dist/languages/swift/scaffold.js +244 -0
  51. package/package.json +461 -0
  52. package/tooling/biome/README.md +90 -0
  53. package/tooling/biome/biome.json +63 -0
  54. package/tooling/bun/bunfig.toml +14 -0
  55. package/tooling/changesets/README.md +35 -0
  56. package/tooling/changesets/config.json +11 -0
  57. package/tooling/claude/repo-tooling.md +87 -0
  58. package/tooling/commitlint/commitlint.d.mts +4 -0
  59. package/tooling/commitlint/commitlint.mjs +40 -0
  60. package/tooling/cypress/cypress.config.d.mts +4 -0
  61. package/tooling/cypress/cypress.config.mjs +11 -0
  62. package/tooling/docusaurus/index.d.mts +17 -0
  63. package/tooling/docusaurus/index.mjs +38 -0
  64. package/tooling/docusaurus/sync-changelog.mjs +42 -0
  65. package/tooling/docusaurus/theme-tokens.css +79 -0
  66. package/tooling/docusaurus/theme.css +378 -0
  67. package/tooling/esbuild/index.d.mts +6 -0
  68. package/tooling/esbuild/index.mjs +102 -0
  69. package/tooling/eslint/base.d.mts +6 -0
  70. package/tooling/eslint/base.mjs +122 -0
  71. package/tooling/eslint/nextjs.d.mts +4 -0
  72. package/tooling/eslint/nextjs.mjs +22 -0
  73. package/tooling/eslint/types.d.ts +58 -0
  74. package/tooling/github-actions/workflows/cloudflare-pages.yml +42 -0
  75. package/tooling/github-actions/workflows/docker-publish.yml +44 -0
  76. package/tooling/github-actions/workflows/preview-deployments.yml +54 -0
  77. package/tooling/github-actions/workflows/vercel-deploy.yml +40 -0
  78. package/tooling/jest-presets/browser/jest-preset.d.mts +4 -0
  79. package/tooling/jest-presets/browser/jest-preset.mjs +14 -0
  80. package/tooling/jest-presets/node/jest-preset.d.mts +4 -0
  81. package/tooling/jest-presets/node/jest-preset.mjs +13 -0
  82. package/tooling/mcp/mcp.json.example +27 -0
  83. package/tooling/nx/nx.json +24 -0
  84. package/tooling/oxlint/README.md +25 -0
  85. package/tooling/oxlint/oxlintrc.json +28 -0
  86. package/tooling/playwright/playwright.config.d.mts +4 -0
  87. package/tooling/playwright/playwright.config.mjs +19 -0
  88. package/tooling/prettier/index.d.mts +4 -0
  89. package/tooling/prettier/index.mjs +36 -0
  90. package/tooling/release-please/.release-please-manifest.json +3 -0
  91. package/tooling/release-please/release-please-config.json +9 -0
  92. package/tooling/rolldown/rolldown.config.d.mts +18 -0
  93. package/tooling/rolldown/rolldown.config.mjs +59 -0
  94. package/tooling/rollup/rollup.config.d.mts +20 -0
  95. package/tooling/rollup/rollup.config.mjs +70 -0
  96. package/tooling/semantic-release/docker.d.mts +4 -0
  97. package/tooling/semantic-release/docker.mjs +59 -0
  98. package/tooling/semantic-release/github.d.mts +4 -0
  99. package/tooling/semantic-release/github.mjs +79 -0
  100. package/tooling/semantic-release/index.d.mts +4 -0
  101. package/tooling/semantic-release/index.mjs +80 -0
  102. package/tooling/swift/periphery.yml +4 -0
  103. package/tooling/swift/swiftlint.yml +23 -0
  104. package/tooling/tests/exports-resolution.d.mts +14 -0
  105. package/tooling/tests/exports-resolution.mjs +68 -0
  106. package/tooling/tests/ssr-safety.d.mts +14 -0
  107. package/tooling/tests/ssr-safety.mjs +53 -0
  108. package/tooling/tsup/index.d.mts +8 -0
  109. package/tooling/tsup/index.mjs +33 -0
  110. package/tooling/typedoc/typedoc.json +7 -0
  111. package/tooling/typescript/README.md +49 -0
  112. package/tooling/typescript/reset.d.ts +9 -0
  113. package/tooling/typescript/tsconfig.base.json +84 -0
  114. package/tooling/typescript/tsconfig.build.json +11 -0
  115. package/tooling/typescript/tsconfig.bun.json +9 -0
  116. package/tooling/typescript/tsconfig.express.json +9 -0
  117. package/tooling/typescript/tsconfig.next.json +20 -0
  118. package/tooling/typescript/tsconfig.node.json +9 -0
  119. package/tooling/typescript/tsconfig.react.json +15 -0
  120. package/tooling/typescript/tsconfig.test.json +8 -0
  121. package/tooling/typescript/v1/tsconfig.base.json +81 -0
  122. package/tooling/typescript/v1/tsconfig.express.json +9 -0
  123. package/tooling/typescript/v1/tsconfig.next.json +19 -0
  124. package/tooling/typescript/v1/tsconfig.node.json +9 -0
  125. package/tooling/typescript/v1/tsconfig.react.json +14 -0
  126. package/tooling/typescript/v1/tsconfig.test.json +8 -0
  127. package/tooling/vite/vite.config.d.mts +4 -0
  128. package/tooling/vite/vite.config.mjs +18 -0
  129. package/tooling/vitest/jsdom-shims.d.mts +1 -0
  130. package/tooling/vitest/jsdom-shims.mjs +58 -0
  131. package/tooling/vitest/vitest.config.d.mts +4 -0
  132. package/tooling/vitest/vitest.config.mjs +25 -0
  133. package/tooling/vitest/vitest.config.react.d.mts +4 -0
  134. package/tooling/vitest/vitest.config.react.mjs +27 -0
  135. package/tooling/vitest/vitest.setup.d.mts +1 -0
  136. package/tooling/vitest/vitest.setup.mjs +3 -0
@@ -0,0 +1,42 @@
1
+ # Deploy a static build to Cloudflare Pages on push to main.
2
+ # Secrets: CLOUDFLARE_API_TOKEN, CLOUDFLARE_ACCOUNT_ID
3
+ # Set your Pages project name below (replace YOUR_PROJECT) and the build
4
+ # output dir if it isn't `dist`.
5
+ name: ☁️ Cloudflare Pages Deploy
6
+
7
+ on:
8
+ push:
9
+ branches: [main]
10
+ workflow_dispatch:
11
+
12
+ permissions:
13
+ contents: read
14
+ deployments: write
15
+
16
+ jobs:
17
+ deploy:
18
+ runs-on: ubuntu-latest
19
+ steps:
20
+ - name: Checkout
21
+ uses: actions/checkout@v4
22
+
23
+ - name: Setup Node.js
24
+ uses: actions/setup-node@v4
25
+ with:
26
+ node-version-file: .nvmrc
27
+
28
+ - name: Setup pnpm
29
+ uses: pnpm/action-setup@v4
30
+
31
+ - name: Install dependencies
32
+ run: pnpm install --frozen-lockfile
33
+
34
+ - name: Build
35
+ run: pnpm build
36
+
37
+ - name: Deploy to Cloudflare Pages
38
+ uses: cloudflare/wrangler-action@v3
39
+ with:
40
+ apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
41
+ accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
42
+ command: pages deploy dist --project-name=YOUR_PROJECT
@@ -0,0 +1,44 @@
1
+ # Build and publish a Docker image to GHCR on tag push.
2
+ # Requires a Dockerfile at the repo root. No extra secrets needed —
3
+ # GITHUB_TOKEN authenticates to ghcr.io for the current repository.
4
+ name: 🐳 Docker Publish
5
+
6
+ on:
7
+ push:
8
+ tags: ['v*']
9
+ workflow_dispatch:
10
+
11
+ permissions:
12
+ contents: read
13
+ packages: write
14
+
15
+ jobs:
16
+ docker:
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - name: Checkout
20
+ uses: actions/checkout@v4
21
+
22
+ - name: Set up Docker Buildx
23
+ uses: docker/setup-buildx-action@v3
24
+
25
+ - name: Log in to GHCR
26
+ uses: docker/login-action@v3
27
+ with:
28
+ registry: ghcr.io
29
+ username: ${{ github.actor }}
30
+ password: ${{ secrets.GITHUB_TOKEN }}
31
+
32
+ - name: Extract image metadata
33
+ id: meta
34
+ uses: docker/metadata-action@v5
35
+ with:
36
+ images: ghcr.io/${{ github.repository }}
37
+
38
+ - name: Build and push
39
+ uses: docker/build-push-action@v6
40
+ with:
41
+ context: .
42
+ push: true
43
+ tags: ${{ steps.meta.outputs.tags }}
44
+ labels: ${{ steps.meta.outputs.labels }}
@@ -0,0 +1,54 @@
1
+ # Per-PR preview deploy to Vercel. Posts a preview URL for every pull request
2
+ # so reviewers can click through the change before merge.
3
+ # Secrets: VERCEL_TOKEN, VERCEL_ORG_ID, VERCEL_PROJECT_ID
4
+ name: 🔍 Preview Deployment
5
+
6
+ on:
7
+ pull_request:
8
+ branches: [main]
9
+
10
+ permissions:
11
+ contents: read
12
+ pull-requests: write
13
+
14
+ env:
15
+ VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
16
+ VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
17
+
18
+ jobs:
19
+ preview:
20
+ runs-on: ubuntu-latest
21
+ steps:
22
+ - name: Checkout
23
+ uses: actions/checkout@v4
24
+
25
+ - name: Setup Node.js
26
+ uses: actions/setup-node@v4
27
+ with:
28
+ node-version-file: .nvmrc
29
+
30
+ - name: Install Vercel CLI
31
+ run: npm install --global vercel@latest
32
+
33
+ - name: Pull Vercel environment
34
+ run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
35
+
36
+ - name: Build project artifacts
37
+ run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
38
+
39
+ - name: Deploy preview
40
+ id: deploy
41
+ run: |
42
+ url=$(vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }})
43
+ echo "url=$url" >> "$GITHUB_OUTPUT"
44
+
45
+ - name: Comment preview URL on the PR
46
+ uses: actions/github-script@v7
47
+ with:
48
+ script: |
49
+ await github.rest.issues.createComment({
50
+ owner: context.repo.owner,
51
+ repo: context.repo.repo,
52
+ issue_number: context.issue.number,
53
+ body: `🔍 Preview deployed: ${{ steps.deploy.outputs.url }}`,
54
+ })
@@ -0,0 +1,40 @@
1
+ # Production deploy to Vercel on push to main.
2
+ # Secrets: VERCEL_TOKEN, VERCEL_ORG_ID, VERCEL_PROJECT_ID
3
+ # (Project Settings → Tokens, and `vercel link` writes the org/project IDs.)
4
+ name: ▲ Vercel Deploy
5
+
6
+ on:
7
+ push:
8
+ branches: [main]
9
+ workflow_dispatch:
10
+
11
+ permissions:
12
+ contents: read
13
+
14
+ env:
15
+ VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
16
+ VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
17
+
18
+ jobs:
19
+ deploy:
20
+ runs-on: ubuntu-latest
21
+ steps:
22
+ - name: Checkout
23
+ uses: actions/checkout@v4
24
+
25
+ - name: Setup Node.js
26
+ uses: actions/setup-node@v4
27
+ with:
28
+ node-version-file: .nvmrc
29
+
30
+ - name: Install Vercel CLI
31
+ run: npm install --global vercel@latest
32
+
33
+ - name: Pull Vercel environment
34
+ run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
35
+
36
+ - name: Build project artifacts
37
+ run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
38
+
39
+ - name: Deploy to production
40
+ run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
@@ -0,0 +1,4 @@
1
+ import type { Config } from 'jest'
2
+
3
+ declare const config: Config
4
+ export default config
@@ -0,0 +1,14 @@
1
+ module.exports = {
2
+ roots: ['<rootDir>'],
3
+ testEnvironment: 'jsdom',
4
+ transform: {
5
+ '^.+\\.tsx?$': 'ts-jest',
6
+ },
7
+ moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
8
+ modulePathIgnorePatterns: [
9
+ '<rootDir>/test/__fixtures__',
10
+ '<rootDir>/node_modules',
11
+ '<rootDir>/dist',
12
+ ],
13
+ preset: 'ts-jest',
14
+ }
@@ -0,0 +1,4 @@
1
+ import type { Config } from 'jest'
2
+
3
+ declare const config: Config
4
+ export default config
@@ -0,0 +1,13 @@
1
+ module.exports = {
2
+ roots: ['<rootDir>'],
3
+ transform: {
4
+ '^.+\\.tsx?$': 'ts-jest',
5
+ },
6
+ moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
7
+ modulePathIgnorePatterns: [
8
+ '<rootDir>/test/__fixtures__',
9
+ '<rootDir>/node_modules',
10
+ '<rootDir>/dist',
11
+ ],
12
+ preset: 'ts-jest',
13
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ // Model Context Protocol servers for this project.
3
+ //
4
+ // This is a TEMPLATE (.mcp.json.example) — it is never loaded, so comments are
5
+ // safe here. To activate: copy it to `.mcp.json`, remove the comments (real
6
+ // .mcp.json is strict JSON), and fill in the servers you actually want.
7
+ //
8
+ // cp .mcp.json.example .mcp.json
9
+ //
10
+ // Only add servers you need — most GitHub work is already covered by the `gh`
11
+ // CLI, so a GitHub MCP server is usually redundant.
12
+ //
13
+ // Example entries (uncomment and adapt in the real .mcp.json):
14
+ //
15
+ // "mcpServers": {
16
+ // "filesystem": {
17
+ // "command": "npx",
18
+ // "args": ["-y", "@modelcontextprotocol/server-filesystem", "."]
19
+ // },
20
+ // "postgres": {
21
+ // "command": "npx",
22
+ // "args": ["-y", "@modelcontextprotocol/server-postgres"],
23
+ // "env": { "DATABASE_URL": "${DATABASE_URL}" }
24
+ // }
25
+ // }
26
+ "mcpServers": {}
27
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/nrwl/nx/master/packages/nx/schemas/nx-schema.json",
3
+ "namedInputs": {
4
+ "default": ["{projectRoot}/**/*", "sharedGlobals"],
5
+ "production": ["default"],
6
+ "sharedGlobals": []
7
+ },
8
+ "targetDefaults": {
9
+ "build": {
10
+ "dependsOn": ["^build"],
11
+ "outputs": ["{projectRoot}/dist"],
12
+ "cache": true
13
+ },
14
+ "lint": { "cache": true },
15
+ "typecheck": {
16
+ "dependsOn": ["^build"],
17
+ "cache": true
18
+ },
19
+ "test": {
20
+ "dependsOn": ["^build"],
21
+ "cache": true
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,25 @@
1
+ # Oxlint preset
2
+
3
+ Shared [Oxlint](https://oxc.rs/docs/guide/usage/linter.html) configuration for projects using `@rtorcato/repo-tooling`.
4
+
5
+ Oxlint is a Rust-based linter that's 50–100× faster than ESLint. It is intentionally **additive** to Biome — Biome handles formatting and the broad lint baseline, Oxlint adds a faster pass for the type-aware and import rules Biome doesn't cover yet.
6
+
7
+ ## Usage
8
+
9
+ ```bash
10
+ npx @rtorcato/repo-tooling copy oxlint
11
+ ```
12
+
13
+ This drops `.oxlintrc.json` at the project root, extending the conventions in this preset. Run it with:
14
+
15
+ ```bash
16
+ pnpm oxlint
17
+ # or
18
+ npx oxlint
19
+ ```
20
+
21
+ ## Notes
22
+
23
+ - Oxlint shares its rule catalog with ESLint's plugins (`typescript`, `unicorn`, `oxc`, `import`), so most ESLint rules you know already work here.
24
+ - The preset disables Biome-overlapping rules to keep CI noise down — Biome stays the source of truth for formatting and the baseline lint set.
25
+ - For projects without Biome, you can run Oxlint standalone and re-enable the `style` and `pedantic` categories.
@@ -0,0 +1,28 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/oxc-project/oxc/main/npm/oxlint/configuration_schema.json",
3
+ "categories": {
4
+ "correctness": "error",
5
+ "perf": "warn",
6
+ "suspicious": "warn",
7
+ "pedantic": "off",
8
+ "style": "off",
9
+ "restriction": "off",
10
+ "nursery": "off"
11
+ },
12
+ "plugins": ["typescript", "unicorn", "oxc", "import"],
13
+ "rules": {
14
+ "no-console": "warn",
15
+ "no-debugger": "error",
16
+ "no-empty": "warn",
17
+ "no-unused-vars": "off",
18
+ "@typescript-eslint/no-unused-vars": [
19
+ "warn",
20
+ { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" }
21
+ ],
22
+ "unicorn/filename-case": "off",
23
+ "unicorn/no-null": "off",
24
+ "unicorn/prevent-abbreviations": "off",
25
+ "import/no-default-export": "off"
26
+ },
27
+ "ignorePatterns": ["node_modules", "dist", "build", "coverage", ".next", "*.d.ts"]
28
+ }
@@ -0,0 +1,4 @@
1
+ import type { PlaywrightTestConfig } from '@playwright/test'
2
+
3
+ declare const config: PlaywrightTestConfig
4
+ export default config
@@ -0,0 +1,19 @@
1
+ import { defineConfig, devices } from '@playwright/test'
2
+
3
+ export default defineConfig({
4
+ testDir: './tests/e2e',
5
+ fullyParallel: true,
6
+ forbidOnly: !!process.env.CI,
7
+ retries: process.env.CI ? 2 : 0,
8
+ workers: process.env.CI ? 1 : undefined,
9
+ reporter: 'html',
10
+ use: {
11
+ baseURL: process.env.PLAYWRIGHT_BASE_URL ?? 'http://localhost:3000',
12
+ trace: 'on-first-retry',
13
+ },
14
+ projects: [
15
+ { name: 'chromium', use: { ...devices['Desktop Chrome'] } },
16
+ { name: 'firefox', use: { ...devices['Desktop Firefox'] } },
17
+ { name: 'webkit', use: { ...devices['Desktop Safari'] } },
18
+ ],
19
+ })
@@ -0,0 +1,4 @@
1
+ import type { Config } from 'prettier'
2
+
3
+ declare const config: Config
4
+ export default config
@@ -0,0 +1,36 @@
1
+ // import { fileURLToPath } from "url";
2
+
3
+ /** @typedef {import("prettier").Config} PrettierConfig */
4
+ /** @typedef {import("prettier-plugin-tailwindcss").PluginOptions} TailwindConfig */
5
+ /** @typedef {import("@ianvs/prettier-plugin-sort-imports").PluginConfig} SortImportsConfig */
6
+
7
+ /** @type { PrettierConfig | SortImportsConfig } */
8
+ const config = {
9
+ singleQuote: true,
10
+ semi: false,
11
+ // we only need prettier plugin for tailwind if we are not in vscode and don't use tailwind plugin
12
+ // plugins: ['@ianvs/prettier-plugin-sort-imports', 'prettier-plugin-tailwindcss'],
13
+ plugins: ['@ianvs/prettier-plugin-sort-imports'],
14
+ // tailwindConfig: fileURLToPath(new URL('../../packages/ui/tailwind/web.ts', import.meta.url)),
15
+ // tailwindFunctions: ['cn', 'cva'],
16
+ importOrder: [
17
+ //
18
+ '<TYPES>',
19
+ '^(react/(.*)$)|^(react$)|^(react-native(.*)$)',
20
+ '^(next/(.*)$)|^(next$)',
21
+ '^(expo(.*)$)|^(expo$)',
22
+ '<THIRD_PARTY_MODULES>',
23
+ '',
24
+ '<TYPES>^@acme',
25
+ '^@acme/(.*)$',
26
+ '',
27
+ '<TYPES>^[.|..|~]',
28
+ '^~/',
29
+ '^[../]',
30
+ '^[./]',
31
+ ],
32
+ importOrderParserPlugins: ['typescript', 'jsx', 'decorators-legacy'],
33
+ importOrderTypeScriptVersion: '4.4.0',
34
+ }
35
+
36
+ export default config
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.0.0"
3
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
3
+ "packages": {
4
+ ".": {
5
+ "release-type": "node",
6
+ "changelog-path": "CHANGELOG.md"
7
+ }
8
+ }
9
+ }
@@ -0,0 +1,18 @@
1
+ import type { RolldownOptions } from 'rolldown'
2
+
3
+ export interface GetConfigOptions {
4
+ /** Library entry point. Default: `src/index.ts`. */
5
+ input?: string
6
+ /** Output directory for the bundle. Default: `dist`. */
7
+ outDir?: string
8
+ /** Emit sourcemaps. Default: `true`. */
9
+ sourcemap?: boolean
10
+ /** Which ids to leave external. Default: every bare (non-relative) import. */
11
+ external?: RolldownOptions['external']
12
+ }
13
+
14
+ /** Build the ESM + CJS Rolldown config for a TypeScript library. */
15
+ export declare function getConfig(options?: GetConfigOptions): RolldownOptions
16
+
17
+ declare const config: RolldownOptions
18
+ export default config
@@ -0,0 +1,59 @@
1
+ import { defineConfig } from 'rolldown'
2
+
3
+ /**
4
+ * Rolldown config factory for TypeScript libraries.
5
+ *
6
+ * Rolldown is the Rust-based, Rollup-API-compatible bundler (the one Vite uses
7
+ * internally). Mirrors the rollup preset's intent — unbundled per-file output
8
+ * (`preserveModules`), dual ESM + CJS, and every bare import left external so
9
+ * dependencies aren't inlined — but needs no `@rollup/plugin-typescript`:
10
+ * Rolldown transpiles TypeScript natively.
11
+ *
12
+ * Consumers scaffold a `rolldown.config.mjs` that re-exports the default:
13
+ *
14
+ * export { default } from '@rtorcato/repo-tooling/rolldown'
15
+ *
16
+ * …or customize the entry / output:
17
+ *
18
+ * import { getConfig } from '@rtorcato/repo-tooling/rolldown'
19
+ * export default getConfig({ input: 'src/main.ts' })
20
+ *
21
+ * Type declarations (`.d.ts`) are not emitted here — run `tsc --emitDeclarationOnly`
22
+ * (or Rolldown's experimental `dts` output) alongside the bundle.
23
+ *
24
+ * @param {import('./rolldown.config.d.mts').GetConfigOptions} [options]
25
+ */
26
+ export function getConfig(options = {}) {
27
+ const { input = 'src/index.ts', outDir = 'dist', sourcemap = true, external = isBareImport } = options
28
+
29
+ return defineConfig({
30
+ input,
31
+ external,
32
+ output: [
33
+ {
34
+ dir: outDir,
35
+ format: 'esm',
36
+ entryFileNames: '[name].mjs',
37
+ preserveModules: true,
38
+ sourcemap,
39
+ },
40
+ {
41
+ dir: outDir,
42
+ format: 'cjs',
43
+ entryFileNames: '[name].cjs',
44
+ preserveModules: true,
45
+ exports: 'named',
46
+ sourcemap,
47
+ },
48
+ ],
49
+ })
50
+ }
51
+
52
+ // Treat every non-relative, non-absolute id as an external dependency so the
53
+ // library ships thin and deps resolve from the consumer's node_modules.
54
+ // (`\0`-prefixed ids are virtual modules — never externalize those.)
55
+ function isBareImport(id) {
56
+ return !id.startsWith('.') && !id.startsWith('/') && !id.startsWith('\0')
57
+ }
58
+
59
+ export default getConfig()
@@ -0,0 +1,20 @@
1
+ import type { RollupOptions } from 'rollup'
2
+
3
+ export interface GetConfigOptions {
4
+ /** Library entry point. Default: `src/index.ts`. */
5
+ input?: string
6
+ /** Output directory for JS + declarations. Default: `dist`. */
7
+ outDir?: string
8
+ /** Emit sourcemaps. Default: `true`. */
9
+ sourcemap?: boolean
10
+ /** Which ids to leave external. Default: every bare (non-relative) import. */
11
+ external?: RollupOptions['external']
12
+ /** Path to the tsconfig plugin-typescript should use. Default: `./tsconfig.json`. */
13
+ tsconfig?: string
14
+ }
15
+
16
+ /** Build the ESM + CJS Rollup configs for a TypeScript library. */
17
+ export declare function getConfig(options?: GetConfigOptions): RollupOptions[]
18
+
19
+ declare const config: RollupOptions[]
20
+ export default config
@@ -0,0 +1,70 @@
1
+ import typescript from '@rollup/plugin-typescript'
2
+
3
+ /**
4
+ * Rollup config factory for TypeScript libraries.
5
+ *
6
+ * Mirrors the tsup preset: unbundled per-file output (`preserveModules`),
7
+ * dual ESM + CJS, `.d.ts` declarations emitted once from the ESM pass, and
8
+ * every bare import left external so dependencies aren't inlined.
9
+ *
10
+ * Consumers scaffold a `rollup.config.mjs` that re-exports the default:
11
+ *
12
+ * export { default } from '@rtorcato/repo-tooling/rollup'
13
+ *
14
+ * …or customize the entry / output:
15
+ *
16
+ * import { getConfig } from '@rtorcato/repo-tooling/rollup'
17
+ * export default getConfig({ input: 'src/main.ts' })
18
+ *
19
+ * @param {import('./rollup.config.d.mts').GetConfigOptions} [options]
20
+ */
21
+ export function getConfig(options = {}) {
22
+ const {
23
+ input = 'src/index.ts',
24
+ outDir = 'dist',
25
+ sourcemap = true,
26
+ external = isBareImport,
27
+ tsconfig = './tsconfig.json',
28
+ } = options
29
+
30
+ // Declarations are emitted once, from the ESM pass — plugin-typescript
31
+ // requires declarationDir to sit inside the output dir, and running it in
32
+ // both passes would double-write the same .d.ts files.
33
+ const esm = {
34
+ input,
35
+ external,
36
+ output: {
37
+ dir: outDir,
38
+ format: 'es',
39
+ entryFileNames: '[name].mjs',
40
+ preserveModules: true,
41
+ sourcemap,
42
+ },
43
+ plugins: [typescript({ tsconfig, declaration: true, declarationDir: outDir, rootDir: 'src' })],
44
+ }
45
+
46
+ const cjs = {
47
+ input,
48
+ external,
49
+ output: {
50
+ dir: outDir,
51
+ format: 'cjs',
52
+ entryFileNames: '[name].cjs',
53
+ preserveModules: true,
54
+ exports: 'named',
55
+ sourcemap,
56
+ },
57
+ plugins: [typescript({ tsconfig, declaration: false })],
58
+ }
59
+
60
+ return [esm, cjs]
61
+ }
62
+
63
+ // Treat every non-relative, non-absolute id as an external dependency so the
64
+ // library ships thin and deps resolve from the consumer's node_modules.
65
+ // (`\0`-prefixed ids are Rollup's virtual modules — never externalize those.)
66
+ function isBareImport(id) {
67
+ return !id.startsWith('.') && !id.startsWith('/') && !id.startsWith('\0')
68
+ }
69
+
70
+ export default getConfig()
@@ -0,0 +1,4 @@
1
+ import type { Options } from 'semantic-release'
2
+
3
+ declare const config: Options
4
+ export default config
@@ -0,0 +1,59 @@
1
+ export default {
2
+ branches: [
3
+ '+([0-9])?(.{+([0-9]),x}).x',
4
+ 'main',
5
+ 'ci-testing',
6
+ 'next',
7
+ 'release',
8
+ 'next-major',
9
+ { name: 'beta', prerelease: true },
10
+ { name: 'alpha', prerelease: true },
11
+ ],
12
+ repositoryUrl: `https://gitlab-ci-token:${process.env.GITLAB_TOKEN}@gitlab.com/${process.env.CI_PROJECT_NAMESPACE}/${process.env.CI_PROJECT_NAME}.git`,
13
+ plugins: [
14
+ [
15
+ '@semantic-release/commit-analyzer',
16
+ {
17
+ preset: 'conventionalcommits',
18
+ releaseRules: [
19
+ { breaking: true, release: 'major' }, // Major release for breaking changes
20
+ { type: 'feat', release: 'minor' }, // Minor release for features
21
+ { type: 'fix', release: 'patch' }, // Patch release for bug fixes
22
+ {
23
+ type: 'docs', // Documentation changes
24
+ scope: 'README', // Specific scope for README changes
25
+ release: false, // no Patch release for README changes
26
+ },
27
+ { type: 'refactor', release: 'patch' },
28
+ { type: 'revert', release: 'patch' },
29
+ { type: 'style', release: false },
30
+ { type: 'test', release: false },
31
+ // { type: 'chore', release: 'patch' }, // Chore changes
32
+ ],
33
+ parserOpts: {
34
+ noteKeywords: ['BREAKING CHANGE', 'BREAKING CHANGES', 'BREAKING'],
35
+ },
36
+ },
37
+ ],
38
+ '@semantic-release/release-notes-generator',
39
+ // Release notes generator plugin to generate release notes
40
+ [
41
+ '@semantic-release/gitlab',
42
+ {
43
+ assets: ['dist/*.js', 'dist/*.js.map', 'CHANGELOG.md', 'package.json', 'README.md'],
44
+ message: 'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}',
45
+ gitlabUrl: 'https://gitlab.com',
46
+ },
47
+ ],
48
+ [
49
+ '@semantic-release/exec',
50
+ {
51
+ prepareCmd: `
52
+ docker push registry.gitlab.com/${CI_PROJECT_PATH}:${nextRelease.version} &&
53
+ docker tag registry.gitlab.com/${CI_PROJECT_PATH}:${nextRelease.version} registry.gitlab.com/${CI_PROJECT_PATH}:latest &&
54
+ docker push registry.gitlab.com/${CI_PROJECT_PATH}:latest
55
+ `,
56
+ },
57
+ ],
58
+ ],
59
+ }
@@ -0,0 +1,4 @@
1
+ import type { Options } from 'semantic-release'
2
+
3
+ declare const config: Options
4
+ export default config