@rtorcato/js-tooling 1.0.6

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 (59) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +129 -0
  3. package/dist/cli/commands/setup.js +218 -0
  4. package/dist/cli/generators/build.js +90 -0
  5. package/dist/cli/generators/git.js +133 -0
  6. package/dist/cli/generators/github-actions.js +261 -0
  7. package/dist/cli/generators/index.js +53 -0
  8. package/dist/cli/generators/linting.js +43 -0
  9. package/dist/cli/generators/package-json.js +162 -0
  10. package/dist/cli/generators/readme.js +224 -0
  11. package/dist/cli/generators/testing.js +78 -0
  12. package/dist/cli/generators/tsconfig.js +28 -0
  13. package/dist/cli/index.js +53 -0
  14. package/dist/cli/utils/install.js +28 -0
  15. package/package.json +160 -0
  16. package/scripts/README.md +8 -0
  17. package/scripts/commitmessage.sh +44 -0
  18. package/scripts/helloworld.sh +5 -0
  19. package/tooling/biome/biome.jsonc +47 -0
  20. package/tooling/commitlint/commitlint.mjs +4 -0
  21. package/tooling/esbuild/build-sample.mjs +21 -0
  22. package/tooling/esbuild/index.mjs +102 -0
  23. package/tooling/eslint/README.md +3 -0
  24. package/tooling/eslint/base.mjs +122 -0
  25. package/tooling/eslint/nextjs.mjs +22 -0
  26. package/tooling/eslint/package.json +35 -0
  27. package/tooling/eslint/types.d.ts +58 -0
  28. package/tooling/jest-presets/browser/jest-preset.mjs +14 -0
  29. package/tooling/jest-presets/node/jest-preset.mjs +13 -0
  30. package/tooling/nextjs/next.config.js +4 -0
  31. package/tooling/oxc/.gitkeep +0 -0
  32. package/tooling/oxc/README.md +1 -0
  33. package/tooling/playwright/playwright.config.ts +0 -0
  34. package/tooling/prettier/index.mjs +36 -0
  35. package/tooling/rolldown/.gitkeep +0 -0
  36. package/tooling/rollup/.gitkeep +0 -0
  37. package/tooling/semantic-release/docker.mjs +59 -0
  38. package/tooling/semantic-release/github.mjs +74 -0
  39. package/tooling/semantic-release/index.mjs +75 -0
  40. package/tooling/tsdown/.gitkeep +0 -0
  41. package/tooling/tsup/index.ts +50 -0
  42. package/tooling/tsup/tsconfig.cjs.json +7 -0
  43. package/tooling/tsup/tsconfig.esm.json +9 -0
  44. package/tooling/tsup/tsconfig.json +11 -0
  45. package/tooling/tsup/tsconfig.types.json +9 -0
  46. package/tooling/typescript/README.md +52 -0
  47. package/tooling/typescript/reset.d.ts +9 -0
  48. package/tooling/typescript/tsconfig.base.json +78 -0
  49. package/tooling/typescript/tsconfig.build.json +11 -0
  50. package/tooling/typescript/tsconfig.express.json +9 -0
  51. package/tooling/typescript/tsconfig.next.json +19 -0
  52. package/tooling/typescript/tsconfig.node.json +9 -0
  53. package/tooling/typescript/tsconfig.react.json +14 -0
  54. package/tooling/typescript/tsconfig.test.json +8 -0
  55. package/tooling/vellite/.gitkeep +0 -0
  56. package/tooling/vite/.gitkeep +0 -0
  57. package/tooling/vitest/vitest.config.mjs +22 -0
  58. package/tooling/vitest/vitest.config.react.mjs +27 -0
  59. package/tooling/vitest/vitest.setup.mjs +3 -0
@@ -0,0 +1,4 @@
1
+ export default {
2
+ extends: ['@commitlint/config-conventional'],
3
+ ignores: [(commit) => commit.includes('[skip ci]')],
4
+ }
@@ -0,0 +1,21 @@
1
+ /*
2
+ Sample call to build.mjs in root of project.
3
+
4
+ */
5
+
6
+ import { buildCode, getEntrypointFolders } from './index.mjs'
7
+ // import { buildCode, getEntrypointFolders } from '@rtorcato/js-tooling/esbuild/index.mjs'
8
+
9
+ const folders = await getEntrypointFolders('src')
10
+ const libEntryPointsArrays = await Promise.all(folders.map((folder) => getEntryPoints(folder)))
11
+ const libEntryPoints = libEntryPointsArrays.flat()
12
+ const allEntryPoints = [
13
+ 'src/index.ts', // Main entry point
14
+ ...libEntryPoints,
15
+ // ...exampleEntryPoints,
16
+ ]
17
+ // Run the build function
18
+ buildCode(allEntryPoints).catch((e) => {
19
+ console.error(e)
20
+ process.exit(1)
21
+ })
@@ -0,0 +1,102 @@
1
+ import * as fs from 'node:fs/promises'
2
+ import * as path from 'node:path'
3
+ import * as esbuild from 'esbuild'
4
+ import { nodeExternalsPlugin } from 'esbuild-node-externals'
5
+
6
+ // EXAMPLE ENTRY POINTS
7
+ // const folders = await getEntrypointFolders('src')
8
+ // const libEntryPointsArrays = await Promise.all(folders.map((folder) => getEntryPoints(folder)))
9
+ // const libEntryPoints = libEntryPointsArrays.flat()
10
+ // const allEntryPoints = [
11
+ // 'src/index.ts', // Main entry point
12
+ // ...libEntryPoints,
13
+ // // ...exampleEntryPoints,
14
+ // ]
15
+
16
+ export async function buildCode(entryPoints = []) {
17
+ const isProduction = process.env['NODE_ENV'] === 'production'
18
+ console.log(`Building...${isProduction ? '(production)' : '(development)'}`)
19
+ console.log('All entry points:', entryPoints)
20
+ if (entryPoints && entryPoints.length > 0) {
21
+ const buildPrefs = {
22
+ entryPoints: entryPoints, // Array of entry points to build
23
+ outdir: 'dist', // Output directory
24
+ platform: 'node', // Use 'browser' for browser builds
25
+ // outbase: 'src', // Base directory for output files
26
+ sourcemap: !isProduction, // Generate sourcemaps in development mode
27
+ minify: isProduction, // Minify in production mode
28
+ logLevel: 'info', // Set log level to 'info'
29
+ splitting: true, // Enable code splitting
30
+ format: 'esm', // Use 'cjs' as 'cjs' for CommonJS format
31
+ target: ['esnext'], // Specify ECMAScript target version
32
+ bundle: true, // Bundle all dependencies into the output
33
+ chunkNames: 'chunks/[name]-[hash]', // Define chunk naming pattern
34
+ // external: ['react', 'react-dom'], // Add other external dependencies here
35
+ // plugins: [
36
+ // {
37
+ // name: 'make-all-packages-external',
38
+ // setup(build) {
39
+ // let filter = /^[^.\/]|^\.[^.\/]|^\.\.[^\/]/; // Must not start with "/" or "./" or "../"
40
+ // build.onResolve({ filter }, args => ({ path: args.path, external: true }));
41
+ // },
42
+ // },
43
+ // ],
44
+ plugins: [nodeExternalsPlugin()],
45
+ }
46
+ await esbuild.build(buildPrefs)
47
+ } else {
48
+ console.log('No entry points provided. Skipping build.')
49
+ }
50
+ }
51
+ /**
52
+ * Returns a list of entry point files in a directory.
53
+ *
54
+ * Scans the given directory and returns all files that:
55
+ * - End with the specified file extension (default: ".ts")
56
+ * - Are not test files (by default, excludes files containing ".test.")
57
+ *
58
+ * @param {string} dir - The directory to search (e.g., 'src')
59
+ * @param {string} [fileExtension='.ts'] - The file extension to match (e.g., '.ts', '.tsx')
60
+ * @param {boolean} [excludeTestFiles=true] - Whether to exclude test files (files containing '.test.')
61
+ * @returns {Promise<string[]>} - Array of entry point file paths (e.g., ['src/arrays/index.ts', ...])
62
+ */
63
+ export async function getEntryPoints(dir, fileExtension = '.ts', excludeTestFiles = true) {
64
+ try {
65
+ const entries = await fs.readdir(dir, { withFileTypes: true })
66
+ return entries
67
+ .filter(
68
+ (entry) =>
69
+ entry.isFile() &&
70
+ entry.name.endsWith(fileExtension) &&
71
+ (!excludeTestFiles || !entry.name.includes('.test.'))
72
+ )
73
+ .map((entry) => path.join(dir, entry.name))
74
+ } catch (error) {
75
+ // @ts-expect-error
76
+ if (error.code === 'ENOENT') {
77
+ console.warn(`Directory ${dir} does not exist.`)
78
+ return []
79
+ }
80
+ throw error
81
+ }
82
+ }
83
+ /**
84
+ * Returns a list of all subdirectories in the given directory that contain an index.ts file.
85
+ * @param {string} dir - The directory to search (e.g., 'src')
86
+ * @returns {Promise<string[]>} - Array of entrypoint folder paths (e.g., ['src/arrays', 'src/strings'])
87
+ */
88
+ export async function getEntrypointFolders(dir) {
89
+ const entries = await fs.readdir(dir, { withFileTypes: true })
90
+ const folders = entries.filter((e) => e.isDirectory())
91
+ const entryFolders = []
92
+ for (const folder of folders) {
93
+ const indexPath = path.join(dir, folder.name, 'index.ts')
94
+ try {
95
+ await fs.access(indexPath)
96
+ entryFolders.push(path.join(dir, folder.name))
97
+ } catch {
98
+ // index.ts does not exist, skip
99
+ }
100
+ }
101
+ return entryFolders
102
+ }
@@ -0,0 +1,3 @@
1
+ # `@turbo/eslint-config`
2
+
3
+ Collection of internal eslint configurations.
@@ -0,0 +1,122 @@
1
+ /// <reference types="./types.d.ts" />
2
+
3
+ import eslint from '@eslint/js'
4
+ import tsPlugin from '@typescript-eslint/eslint-plugin'
5
+ import importPlugin from 'eslint-plugin-import'
6
+ import jestPlugin from 'eslint-plugin-jest'
7
+ import tseslint from 'typescript-eslint'
8
+
9
+ // import path from 'path';
10
+ // import url from 'url';
11
+
12
+ // const __filename = url.fileURLToPath(import.meta.url);
13
+ // const __dirname = path.dirname(__filename);
14
+
15
+ /**
16
+ * All packages that leverage t3-env should use this rule
17
+ */
18
+ export const restrictEnvAccess = tseslint.config({
19
+ files: ['**/*.js', '**/*.ts', '**/*.tsx'],
20
+ rules: {
21
+ 'no-restricted-properties': [
22
+ 'error',
23
+ {
24
+ object: 'process',
25
+ property: 'env',
26
+ message: "Use `import { env } from '~/env'` instead to ensure validated types.",
27
+ },
28
+ ],
29
+ 'no-restricted-imports': [
30
+ 'error',
31
+ {
32
+ name: 'process',
33
+ importNames: ['env'],
34
+ message: "Use `import { env } from '~/env'` instead to ensure validated types.",
35
+ },
36
+ ],
37
+ },
38
+ })
39
+
40
+ export default tseslint.config(
41
+ {
42
+ // Globally ignored files
43
+ ignores: [
44
+ //
45
+ '**/*.config.js',
46
+ '.turbo',
47
+ 'dist',
48
+ 'build',
49
+ '.react-email',
50
+ 'not-used',
51
+ 'out', //for next js static builds
52
+ '.next',
53
+ 'pnpm-lock.yaml',
54
+ 'node_modules',
55
+ '.react-email',
56
+ ],
57
+ },
58
+ {
59
+ files: ['**/*.js', '**/*.ts', '**/*.tsx'],
60
+ plugins: {
61
+ import: importPlugin,
62
+ '@typescript-eslint': tsPlugin,
63
+ jest: jestPlugin,
64
+ },
65
+ extends: [
66
+ //
67
+ eslint.configs.recommended,
68
+ ...tseslint.configs.recommended,
69
+ ...tseslint.configs.recommendedTypeChecked,
70
+ ...tseslint.configs.stylisticTypeChecked,
71
+ // ...jestPlugin.configs['flat/recommended'],
72
+ // turbo,
73
+ // vitest,
74
+ // airbnb,
75
+ // "eslint:recommended",
76
+ // 'airbnb-typescript',
77
+ // 'plugin:jest/recommended',
78
+ //"plugin:prettier/recommended", // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
79
+ // eslintConfigPrettier,
80
+ ],
81
+ rules: {
82
+ 'no-console': 'warn',
83
+ '@typescript-eslint/no-unsafe-assignment': 'error',
84
+ '@typescript-eslint/no-explicit-any': 'off',
85
+ '@typescript-eslint/consistent-type-definitions': 'off',
86
+ 'tailwindcss/no-custom-classname': 'off',
87
+ '@typescript-eslint/no-unsafe-return': 'off',
88
+ '@typescript-eslint/no-unsafe-call': 'off',
89
+ '@typescript-eslint/no-unsafe-member-access': 'off',
90
+ // "jest/no-disabled-tests": "warn",
91
+ // "jest/no-focused-tests": "error",
92
+ // "jest/no-identical-title": "error",
93
+ // "jest/prefer-to-have-length": "warn",
94
+ // "jest/valid-expect": "error"
95
+ //
96
+ '@typescript-eslint/no-unused-vars': [
97
+ 'error',
98
+ { argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
99
+ ],
100
+ '@typescript-eslint/consistent-type-imports': [
101
+ 'warn',
102
+ { prefer: 'type-imports', fixStyle: 'separate-type-imports' },
103
+ ],
104
+ '@typescript-eslint/no-misused-promises': [2, { checksVoidReturn: { attributes: false } }],
105
+ '@typescript-eslint/no-unnecessary-condition': [
106
+ 'error',
107
+ {
108
+ allowConstantLoopConditions: true,
109
+ },
110
+ ],
111
+ '@typescript-eslint/no-non-null-assertion': 'error',
112
+ 'import/consistent-type-specifier-style': ['error', 'prefer-top-level'],
113
+ },
114
+ },
115
+ {
116
+ linterOptions: { reportUnusedDisableDirectives: true },
117
+ // languageOptions: { parserOptions: { project: ['./tsconfig.json', './**/*/tsconfig.json'] } },
118
+ languageOptions: {
119
+ parserOptions: { project: true }, //, tsconfigRootDir: __dirname
120
+ },
121
+ }
122
+ )
@@ -0,0 +1,22 @@
1
+ import nextPlugin from '@next/eslint-plugin-next'
2
+
3
+ /** @type {Awaited<import('typescript-eslint').Config>} */
4
+ export default [
5
+ {
6
+ files: ['**/*.ts', '**/*.tsx'],
7
+ plugins: {
8
+ '@next/next': nextPlugin,
9
+ },
10
+ rules: {
11
+ ...nextPlugin.configs.recommended.rules,
12
+ ...nextPlugin.configs['core-web-vitals'].rules,
13
+ // TypeError: context.getAncestors is not a function
14
+ '@next/next/no-duplicate-head': 'off',
15
+ '@next/next/no-page-custom-font': 'off',
16
+ //
17
+ '@next/next/no-img-element': 'off',
18
+ '@next/next/no-html-link-for-pages': 'off',
19
+ 'react/jsx-key': 'off',
20
+ },
21
+ },
22
+ ]
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@dropwallet/eslint-config",
3
+ "private": true,
4
+ "version": "0.3.0",
5
+ "type": "module",
6
+ "exports": {
7
+ "./base": "./base.js",
8
+ "./nextjs": "./nextjs.js"
9
+ },
10
+ "scripts": {
11
+ "clean": "rm -rf .turbo node_modules",
12
+ "format": "prettier --check . --ignore-path ../../.gitignore",
13
+ "typecheck": "tsc --noEmit"
14
+ },
15
+ "dependencies": {
16
+ "@next/eslint-plugin-next": "^14.2.3",
17
+ "eslint-config-airbnb": "^19.0.4",
18
+ "eslint-config-prettier": "9.1.0",
19
+ "eslint-config-turbo": "^1.13.3",
20
+ "eslint-plugin-import": "^2.29.1",
21
+ "eslint-plugin-jest": "28.5.0",
22
+ "eslint-plugin-jsx-a11y": "^6.8.0",
23
+ "eslint-plugin-react": "^7.34.1",
24
+ "eslint-plugin-react-hooks": "^4.6.2",
25
+ "eslint-plugin-vitest": "0.5.4",
26
+ "typescript-eslint": "7.9.0"
27
+ },
28
+ "devDependencies": {
29
+ "@dropwallet/tsconfig": "workspace:*",
30
+ "@eslint/js": "9.2.0",
31
+ "eslint": "9.2.0",
32
+ "prettier": "^3.2.5",
33
+ "typescript": "^5.4.5"
34
+ }
35
+ }
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Since the ecosystem hasn't fully migrated to ESLint's new FlatConfig system yet,
3
+ * we "need" to type some of the plugins manually :(
4
+ */
5
+
6
+ declare module '@eslint/js' {
7
+ // Why the hell doesn't eslint themselves export their types?
8
+ import type { Linter } from 'eslint'
9
+
10
+ export const configs: {
11
+ readonly recommended: { readonly rules: Readonly<Linter.RulesRecord> }
12
+ readonly all: { readonly rules: Readonly<Linter.RulesRecord> }
13
+ }
14
+ }
15
+
16
+ declare module 'eslint-plugin-import' {
17
+ import type { Linter, Rule } from 'eslint'
18
+
19
+ export const configs: {
20
+ recommended: { rules: Linter.RulesRecord }
21
+ }
22
+ export const rules: Record<string, Rule.RuleModule>
23
+ }
24
+
25
+ declare module 'eslint-plugin-react' {
26
+ import type { Linter, Rule } from 'eslint'
27
+
28
+ export const configs: {
29
+ recommended: { rules: Linter.RulesRecord }
30
+ all: { rules: Linter.RulesRecord }
31
+ 'jsx-runtime': { rules: Linter.RulesRecord }
32
+ }
33
+ export const rules: Record<string, Rule.RuleModule>
34
+ }
35
+
36
+ declare module 'eslint-plugin-react-hooks' {
37
+ import type { Linter, Rule } from 'eslint'
38
+
39
+ export const configs: {
40
+ recommended: {
41
+ rules: {
42
+ 'rules-of-hooks': Linter.RuleEntry
43
+ 'exhaustive-deps': Linter.RuleEntry
44
+ }
45
+ }
46
+ }
47
+ export const rules: Record<string, Rule.RuleModule>
48
+ }
49
+
50
+ declare module '@next/eslint-plugin-next' {
51
+ import type { Linter, Rule } from 'eslint'
52
+
53
+ export const configs: {
54
+ recommended: { rules: Linter.RulesRecord }
55
+ 'core-web-vitals': { rules: Linter.RulesRecord }
56
+ }
57
+ export const rules: Record<string, Rule.RuleModule>
58
+ }
@@ -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,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,4 @@
1
+ /** @type {import('next').NextConfig} */
2
+ module.exports = {
3
+ output: 'standalone',
4
+ }
File without changes
@@ -0,0 +1 @@
1
+ https://oxc.rs
File without changes
@@ -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
File without changes
File without changes
@@ -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,74 @@
1
+ export default {
2
+ branches: [
3
+ '+([0-9])?(.{+([0-9]),x}).x',
4
+ 'main', // → stable
5
+ 'next',
6
+ 'release',
7
+ 'next-major', // → next-major branch = next-major tag
8
+ { name: 'dev', prerelease: true }, // → dev branch = dev tag
9
+ { name: 'beta', prerelease: true }, // → beta branch = beta tag
10
+ { name: 'alpha', prerelease: true }, // → alpha branch = alpha tag
11
+ ],
12
+ repositoryUrl: `https://github.com/${process.env.GITHUB_REPOSITORY}.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: 'chore', release: 'patch' }, // Chore changes
28
+ { type: 'update', release: 'patch' },
29
+ { type: 'refactor', release: 'patch' },
30
+ { type: 'revert', release: 'patch' },
31
+ { type: 'style', release: false },
32
+ { type: 'test', release: false },
33
+ ],
34
+ parserOpts: {
35
+ noteKeywords: ['BREAKING CHANGE', 'BREAKING CHANGES', 'BREAKING'],
36
+ },
37
+ },
38
+ ],
39
+ '@semantic-release/release-notes-generator',
40
+ // Release notes generator plugin to generate release notes
41
+ [
42
+ '@semantic-release/github',
43
+ {
44
+ assets: ['CHANGELOG.md', 'package.json', 'README.md'],
45
+ message: 'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}',
46
+ },
47
+ ],
48
+ [
49
+ '@semantic-release/changelog',
50
+ {
51
+ changelogFile: 'CHANGELOG.md',
52
+ },
53
+ ],
54
+ ['@semantic-release/npm', { npmPublish: true, pkgRoot: '.' }],
55
+ // NPM plugin to publish the package
56
+ [
57
+ '@semantic-release/git',
58
+ {
59
+ assets: ['package.json', 'CHANGELOG.md'],
60
+ message: 'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}',
61
+ // Skip hooks by disabling Husky
62
+ skipCommitHooks: true,
63
+ prepareCmd: 'pnpm exec biome format package.json',
64
+ },
65
+ ],
66
+ ],
67
+ }
68
+
69
+ // [
70
+ // '@semantic-release/exec',
71
+ // {
72
+ // prepareCmd: 'pnpm exec biome format',
73
+ // },
74
+ // ],
@@ -0,0 +1,75 @@
1
+ export default {
2
+ branches: [
3
+ '+([0-9])?(.{+([0-9]),x}).x',
4
+ 'main', // → stable
5
+ 'next',
6
+ 'release',
7
+ 'next-major', // → next-major branch = next-major tag
8
+ { name: 'dev', prerelease: true }, // → dev branch = dev tag
9
+ { name: 'beta', prerelease: true }, // → beta branch = beta tag
10
+ { name: 'alpha', prerelease: true }, // → alpha branch = alpha tag
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: 'chore', release: 'patch' }, // Chore changes
28
+ { type: 'update', release: 'patch' },
29
+ { type: 'refactor', release: 'patch' },
30
+ { type: 'revert', release: 'patch' },
31
+ { type: 'style', release: false },
32
+ { type: 'test', release: false },
33
+ ],
34
+ parserOpts: {
35
+ noteKeywords: ['BREAKING CHANGE', 'BREAKING CHANGES', 'BREAKING'],
36
+ },
37
+ },
38
+ ],
39
+ '@semantic-release/release-notes-generator',
40
+ // Release notes generator plugin to generate release notes
41
+ [
42
+ '@semantic-release/gitlab',
43
+ {
44
+ assets: ['dist/*.js', 'dist/*.js.map', 'CHANGELOG.md', 'package.json', 'README.md'],
45
+ message: 'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}',
46
+ gitlabUrl: 'https://gitlab.com',
47
+ },
48
+ ],
49
+ [
50
+ '@semantic-release/changelog',
51
+ {
52
+ changelogFile: 'CHANGELOG.md',
53
+ },
54
+ ],
55
+ ['@semantic-release/npm', { npmPublish: true, pkgRoot: '.' }],
56
+ // NPM plugin to publish the package
57
+ [
58
+ '@semantic-release/git',
59
+ {
60
+ assets: ['package.json', 'CHANGELOG.md'],
61
+ message: 'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}',
62
+ // Skip hooks by disabling Husky
63
+ skipCommitHooks: true,
64
+ prepareCmd: 'pnpm exec biome format package.json',
65
+ },
66
+ ],
67
+ ],
68
+ }
69
+
70
+ // [
71
+ // '@semantic-release/exec',
72
+ // {
73
+ // prepareCmd: 'pnpm exec biome format',
74
+ // },
75
+ // ],
File without changes