@dimensional-innovations/tool-config 1.0.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.
- package/LICENSE +21 -0
- package/README.md +646 -0
- package/bin/setup-tool-config.js +675 -0
- package/package.json +168 -0
- package/src/detectors.js +261 -0
- package/src/index.js +64 -0
- package/src/tools/eslint/index.js +287 -0
- package/src/tools/eslint/presets/base.js +82 -0
- package/src/tools/eslint/presets/environments/browser.js +16 -0
- package/src/tools/eslint/presets/environments/node.js +21 -0
- package/src/tools/eslint/presets/environments/universal.js +18 -0
- package/src/tools/eslint/presets/frameworks/angular.js +74 -0
- package/src/tools/eslint/presets/frameworks/astro.js +38 -0
- package/src/tools/eslint/presets/frameworks/node.js +57 -0
- package/src/tools/eslint/presets/frameworks/react.js +76 -0
- package/src/tools/eslint/presets/frameworks/solid.js +45 -0
- package/src/tools/eslint/presets/frameworks/svelte.js +78 -0
- package/src/tools/eslint/presets/frameworks/vanilla.js +16 -0
- package/src/tools/eslint/presets/frameworks/vue.js +125 -0
- package/src/tools/eslint/presets/imports.js +41 -0
- package/src/tools/eslint/presets/typescript.js +131 -0
- package/src/tools/prettier/README.md +398 -0
- package/src/tools/prettier/index.js +114 -0
- package/src/tools/prettier/presets/base.js +36 -0
- package/src/tools/prettier/presets/frameworks/astro.js +15 -0
- package/src/tools/prettier/presets/frameworks/react.js +15 -0
- package/src/tools/prettier/presets/frameworks/svelte.js +22 -0
- package/src/tools/prettier/presets/frameworks/vanilla.js +13 -0
- package/src/tools/prettier/presets/frameworks/vue.js +20 -0
- package/src/tools/prettier/presets/prettierignore.js +56 -0
- package/src/tools/semantic-release/CI_SETUP.md +66 -0
- package/src/tools/semantic-release/README.md +533 -0
- package/src/tools/semantic-release/index.js +130 -0
- package/src/tools/semantic-release/presets/default.js +37 -0
- package/src/tools/semantic-release/presets/library.js +58 -0
- package/src/tools/semantic-release/presets/monorepo.js +48 -0
- package/src/tools/semantic-release/templates/.gitlab-ci.yml +85 -0
- package/src/tools/semantic-release/templates/bitbucket-pipelines.yml +100 -0
- package/src/tools/semantic-release/templates/github-workflow.yml +107 -0
- package/src/tools/stylelint/README.md +425 -0
- package/src/tools/stylelint/index.js +191 -0
- package/src/tools/stylelint/presets/base.js +50 -0
- package/src/tools/stylelint/presets/css-modules.js +43 -0
- package/src/tools/stylelint/presets/frameworks/react.js +18 -0
- package/src/tools/stylelint/presets/frameworks/svelte.js +28 -0
- package/src/tools/stylelint/presets/frameworks/vanilla.js +14 -0
- package/src/tools/stylelint/presets/frameworks/vue.js +38 -0
- package/src/tools/stylelint/presets/scss.js +83 -0
- package/src/tools/stylelint/presets/tailwind.js +49 -0
- package/src/utils/package-reader.js +42 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* semantic-release configuration factory
|
|
3
|
+
*
|
|
4
|
+
* Creates semantic-release configurations with preset-based defaults.
|
|
5
|
+
* Supports standard releases, library publishing, and monorepo structures.
|
|
6
|
+
* Auto-detects Git provider (GitLab, GitHub, Bitbucket) from repository URL.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { detectGitProvider } from '../../detectors.js'
|
|
10
|
+
|
|
11
|
+
import createDefaultPreset from './presets/default.js'
|
|
12
|
+
import createLibraryPreset from './presets/library.js'
|
|
13
|
+
import createMonorepoPreset from './presets/monorepo.js'
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Create a semantic-release configuration
|
|
17
|
+
*
|
|
18
|
+
* @param {Object} options - Configuration options
|
|
19
|
+
* @param {string} [options.preset='default'] - Preset to use ('default', 'library', 'monorepo')
|
|
20
|
+
* @param {string} [options.gitProvider='auto'] - Git provider ('gitlab', 'github', 'bitbucket', 'auto', or null)
|
|
21
|
+
* @param {string} [options.cwd=process.cwd()] - Working directory for auto-detection
|
|
22
|
+
* @param {string[]} [options.branches] - Branches to release from (overrides preset)
|
|
23
|
+
* @param {Array} [options.plugins] - Plugins to use (overrides preset)
|
|
24
|
+
* @param {Object} [options.overrides] - Additional user overrides to merge into final config
|
|
25
|
+
* @returns {Object} semantic-release configuration object
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* // Use default preset with auto-detected Git provider
|
|
29
|
+
* export default createReleaseConfig();
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* // Use library preset with auto-detected Git provider
|
|
33
|
+
* export default createReleaseConfig({ preset: 'library' });
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* // Explicitly specify Git provider
|
|
37
|
+
* export default createReleaseConfig({
|
|
38
|
+
* preset: 'default',
|
|
39
|
+
* gitProvider: 'github'
|
|
40
|
+
* });
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* // Disable Git provider plugin
|
|
44
|
+
* export default createReleaseConfig({
|
|
45
|
+
* preset: 'default',
|
|
46
|
+
* gitProvider: null
|
|
47
|
+
* });
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* // With custom branches
|
|
51
|
+
* export default createReleaseConfig({
|
|
52
|
+
* preset: 'default',
|
|
53
|
+
* branches: ['main', 'next']
|
|
54
|
+
* });
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* // With plugin overrides
|
|
58
|
+
* export default createReleaseConfig({
|
|
59
|
+
* preset: 'library',
|
|
60
|
+
* plugins: [
|
|
61
|
+
* '@semantic-release/commit-analyzer',
|
|
62
|
+
* '@semantic-release/release-notes-generator',
|
|
63
|
+
* '@semantic-release/npm'
|
|
64
|
+
* ]
|
|
65
|
+
* });
|
|
66
|
+
*/
|
|
67
|
+
export function createReleaseConfig(options = {}) {
|
|
68
|
+
const {
|
|
69
|
+
preset = 'default',
|
|
70
|
+
gitProvider: explicitGitProvider = 'auto',
|
|
71
|
+
cwd = process.cwd(),
|
|
72
|
+
...userOverrides
|
|
73
|
+
} = options
|
|
74
|
+
|
|
75
|
+
// Auto-detect Git provider if needed
|
|
76
|
+
const gitProvider = explicitGitProvider === 'auto' ? detectGitProvider(cwd) : explicitGitProvider
|
|
77
|
+
|
|
78
|
+
// Log detected/configured provider
|
|
79
|
+
if (gitProvider) {
|
|
80
|
+
console.warn(`📦 semantic-release: Detected ${gitProvider} - using ${gitProvider} plugin`)
|
|
81
|
+
} else {
|
|
82
|
+
console.warn('📦 semantic-release: No Git provider detected - skipping provider plugin')
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Select preset and generate config
|
|
86
|
+
let config
|
|
87
|
+
switch (preset) {
|
|
88
|
+
case 'library': {
|
|
89
|
+
config = createLibraryPreset(gitProvider)
|
|
90
|
+
console.warn('📦 semantic-release: Using library preset')
|
|
91
|
+
break
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
case 'monorepo': {
|
|
95
|
+
config = createMonorepoPreset(gitProvider)
|
|
96
|
+
console.warn('📦 semantic-release: Using monorepo preset')
|
|
97
|
+
break
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
case 'default': {
|
|
101
|
+
config = createDefaultPreset(gitProvider)
|
|
102
|
+
console.warn('📦 semantic-release: Using default preset')
|
|
103
|
+
break
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
default: {
|
|
107
|
+
console.warn(`⚠️ Unknown preset "${preset}", using default preset`)
|
|
108
|
+
config = createDefaultPreset(gitProvider)
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Apply user overrides
|
|
113
|
+
// Special handling for arrays (branches, plugins)
|
|
114
|
+
if (userOverrides.branches) {
|
|
115
|
+
config.branches = userOverrides.branches
|
|
116
|
+
delete userOverrides.branches
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (userOverrides.plugins) {
|
|
120
|
+
config.plugins = userOverrides.plugins
|
|
121
|
+
delete userOverrides.plugins
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Apply remaining overrides
|
|
125
|
+
Object.assign(config, userOverrides)
|
|
126
|
+
|
|
127
|
+
return config
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export default createReleaseConfig
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default semantic-release configuration
|
|
3
|
+
*
|
|
4
|
+
* Standard release process with:
|
|
5
|
+
* - Automatic versioning based on conventional commits
|
|
6
|
+
* - Changelog generation
|
|
7
|
+
* - NPM publishing
|
|
8
|
+
* - Git hosting provider releases (GitLab, GitHub, etc.)
|
|
9
|
+
* - Git tagging
|
|
10
|
+
*
|
|
11
|
+
* @param {string} gitProvider - Git provider ('gitlab', 'github', 'bitbucket', or null)
|
|
12
|
+
* @returns {Object} semantic-release configuration
|
|
13
|
+
*/
|
|
14
|
+
export default function createDefaultPreset(gitProvider = null) {
|
|
15
|
+
const plugins = [
|
|
16
|
+
'@semantic-release/commit-analyzer',
|
|
17
|
+
'@semantic-release/release-notes-generator',
|
|
18
|
+
'@semantic-release/changelog',
|
|
19
|
+
'@semantic-release/npm'
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
// Add provider-specific plugin
|
|
23
|
+
if (gitProvider === 'gitlab') {
|
|
24
|
+
plugins.push('@semantic-release/gitlab')
|
|
25
|
+
} else if (gitProvider === 'github') {
|
|
26
|
+
plugins.push('@semantic-release/github')
|
|
27
|
+
}
|
|
28
|
+
// Bitbucket and others don't have official plugins
|
|
29
|
+
|
|
30
|
+
// Always add git plugin last
|
|
31
|
+
plugins.push('@semantic-release/git')
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
branches: ['main'],
|
|
35
|
+
plugins
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Library-specific semantic-release configuration
|
|
3
|
+
*
|
|
4
|
+
* Optimized for published NPM libraries:
|
|
5
|
+
* - Publishes to NPM registry
|
|
6
|
+
* - Creates Git provider releases without comments
|
|
7
|
+
* - Generates changelog
|
|
8
|
+
* - Tags releases in Git
|
|
9
|
+
*
|
|
10
|
+
* Differences from default:
|
|
11
|
+
* - Explicit pkgRoot configuration
|
|
12
|
+
* - Disabled provider comments (less noise for library releases)
|
|
13
|
+
* - Disabled released labels (library-specific optimization)
|
|
14
|
+
*
|
|
15
|
+
* @param {string} gitProvider - Git provider ('gitlab', 'github', 'bitbucket', or null)
|
|
16
|
+
* @returns {Object} semantic-release configuration
|
|
17
|
+
*/
|
|
18
|
+
export default function createLibraryPreset(gitProvider = null) {
|
|
19
|
+
const plugins = [
|
|
20
|
+
'@semantic-release/commit-analyzer',
|
|
21
|
+
'@semantic-release/release-notes-generator',
|
|
22
|
+
'@semantic-release/changelog',
|
|
23
|
+
[
|
|
24
|
+
'@semantic-release/npm',
|
|
25
|
+
{
|
|
26
|
+
pkgRoot: '.'
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
// Add provider-specific plugin with library-optimized settings
|
|
32
|
+
if (gitProvider === 'gitlab') {
|
|
33
|
+
plugins.push([
|
|
34
|
+
'@semantic-release/gitlab',
|
|
35
|
+
{
|
|
36
|
+
successComment: false,
|
|
37
|
+
releasedLabels: false
|
|
38
|
+
}
|
|
39
|
+
])
|
|
40
|
+
} else if (gitProvider === 'github') {
|
|
41
|
+
plugins.push([
|
|
42
|
+
'@semantic-release/github',
|
|
43
|
+
{
|
|
44
|
+
successComment: false,
|
|
45
|
+
releasedLabels: false
|
|
46
|
+
}
|
|
47
|
+
])
|
|
48
|
+
}
|
|
49
|
+
// Bitbucket and others don't have official plugins
|
|
50
|
+
|
|
51
|
+
// Always add git plugin last
|
|
52
|
+
plugins.push('@semantic-release/git')
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
branches: ['main'],
|
|
56
|
+
plugins
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Monorepo semantic-release configuration
|
|
3
|
+
*
|
|
4
|
+
* Optimized for monorepo structures with multiple packages:
|
|
5
|
+
* - Supports publishing multiple packages
|
|
6
|
+
* - Handles workspace dependencies
|
|
7
|
+
* - Per-package versioning
|
|
8
|
+
* - Generates aggregated changelog
|
|
9
|
+
*
|
|
10
|
+
* Configuration:
|
|
11
|
+
* - pkgRoot set to 'packages/*' for workspace structure
|
|
12
|
+
* - Suitable for lerna, pnpm workspaces, npm workspaces
|
|
13
|
+
*
|
|
14
|
+
* Note: You may need to run semantic-release separately for each package
|
|
15
|
+
* or use semantic-release-monorepo plugin for advanced scenarios
|
|
16
|
+
*
|
|
17
|
+
* @param {string} gitProvider - Git provider ('gitlab', 'github', 'bitbucket', or null)
|
|
18
|
+
* @returns {Object} semantic-release configuration
|
|
19
|
+
*/
|
|
20
|
+
export default function createMonorepoPreset(gitProvider = null) {
|
|
21
|
+
const plugins = [
|
|
22
|
+
'@semantic-release/commit-analyzer',
|
|
23
|
+
'@semantic-release/release-notes-generator',
|
|
24
|
+
'@semantic-release/changelog',
|
|
25
|
+
[
|
|
26
|
+
'@semantic-release/npm',
|
|
27
|
+
{
|
|
28
|
+
pkgRoot: 'packages/*'
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
// Add provider-specific plugin
|
|
34
|
+
if (gitProvider === 'gitlab') {
|
|
35
|
+
plugins.push('@semantic-release/gitlab')
|
|
36
|
+
} else if (gitProvider === 'github') {
|
|
37
|
+
plugins.push('@semantic-release/github')
|
|
38
|
+
}
|
|
39
|
+
// Bitbucket and others don't have official plugins
|
|
40
|
+
|
|
41
|
+
// Always add git plugin last
|
|
42
|
+
plugins.push('@semantic-release/git')
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
branches: ['main'],
|
|
46
|
+
plugins
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# GitLab CI/CD Template for @dimensional-innovations/tool-config
|
|
2
|
+
#
|
|
3
|
+
# Copy this file to your project root:
|
|
4
|
+
# cp node_modules/@dimensional-innovations/tool-config/src/tools/semantic-release/templates/.gitlab-ci.yml .gitlab-ci.yml
|
|
5
|
+
#
|
|
6
|
+
# Then configure these CI/CD variables in GitLab:
|
|
7
|
+
# - GL_TOKEN: GitLab Personal Access Token (for releases)
|
|
8
|
+
# - NPM_TOKEN: npm token (for publishing packages)
|
|
9
|
+
|
|
10
|
+
stages:
|
|
11
|
+
- lint
|
|
12
|
+
- test
|
|
13
|
+
- release
|
|
14
|
+
|
|
15
|
+
# Cache node_modules across jobs
|
|
16
|
+
cache:
|
|
17
|
+
key:
|
|
18
|
+
files:
|
|
19
|
+
- package-lock.json
|
|
20
|
+
paths:
|
|
21
|
+
- node_modules/
|
|
22
|
+
- .npm/
|
|
23
|
+
|
|
24
|
+
# Default settings for all jobs
|
|
25
|
+
default:
|
|
26
|
+
image: node:22-alpine
|
|
27
|
+
before_script:
|
|
28
|
+
- npm ci --cache .npm --prefer-offline
|
|
29
|
+
|
|
30
|
+
# Lint job - runs ESLint, Prettier, Stylelint
|
|
31
|
+
lint:
|
|
32
|
+
stage: lint
|
|
33
|
+
script:
|
|
34
|
+
- npm run lint
|
|
35
|
+
- npm run prettier
|
|
36
|
+
- npm run style || true # Allow failure if no CSS files
|
|
37
|
+
only:
|
|
38
|
+
- branches
|
|
39
|
+
- merge_requests
|
|
40
|
+
|
|
41
|
+
# Test job - runs test suite with coverage
|
|
42
|
+
test:
|
|
43
|
+
stage: test
|
|
44
|
+
script:
|
|
45
|
+
- npm run test:coverage
|
|
46
|
+
coverage: '/All files[^|]*\|[^|]*\s+([\d\.]+)/'
|
|
47
|
+
artifacts:
|
|
48
|
+
reports:
|
|
49
|
+
coverage_report:
|
|
50
|
+
coverage_format: cobertura
|
|
51
|
+
path: coverage/cobertura-coverage.xml
|
|
52
|
+
paths:
|
|
53
|
+
- coverage/
|
|
54
|
+
expire_in: 30 days
|
|
55
|
+
only:
|
|
56
|
+
- branches
|
|
57
|
+
- merge_requests
|
|
58
|
+
|
|
59
|
+
# Release job - runs semantic-release on main branch
|
|
60
|
+
release:
|
|
61
|
+
stage: release
|
|
62
|
+
script:
|
|
63
|
+
- npm run release
|
|
64
|
+
only:
|
|
65
|
+
- main
|
|
66
|
+
except:
|
|
67
|
+
- schedules
|
|
68
|
+
when: manual # Remove this line to make releases automatic
|
|
69
|
+
|
|
70
|
+
# Optional: Test on multiple Node versions
|
|
71
|
+
# test:node-20:
|
|
72
|
+
# extends: test
|
|
73
|
+
# image: node:20-alpine
|
|
74
|
+
|
|
75
|
+
# Optional: Deploy documentation
|
|
76
|
+
# pages:
|
|
77
|
+
# stage: deploy
|
|
78
|
+
# script:
|
|
79
|
+
# - npm run docs:build
|
|
80
|
+
# - mv docs public
|
|
81
|
+
# artifacts:
|
|
82
|
+
# paths:
|
|
83
|
+
# - public
|
|
84
|
+
# only:
|
|
85
|
+
# - main
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Bitbucket Pipelines Template for @dimensional-innovations/tool-config
|
|
2
|
+
#
|
|
3
|
+
# Copy this file to your project root:
|
|
4
|
+
# cp node_modules/@dimensional-innovations/tool-config/src/tools/semantic-release/templates/bitbucket-pipelines.yml bitbucket-pipelines.yml
|
|
5
|
+
#
|
|
6
|
+
# Then configure these repository variables in Bitbucket:
|
|
7
|
+
# - NPM_TOKEN: npm token (for publishing packages)
|
|
8
|
+
|
|
9
|
+
image: node:22
|
|
10
|
+
|
|
11
|
+
definitions:
|
|
12
|
+
caches:
|
|
13
|
+
npm: ~/.npm
|
|
14
|
+
|
|
15
|
+
pipelines:
|
|
16
|
+
default:
|
|
17
|
+
- step:
|
|
18
|
+
name: Lint
|
|
19
|
+
caches:
|
|
20
|
+
- npm
|
|
21
|
+
script:
|
|
22
|
+
- npm ci
|
|
23
|
+
- npm run lint
|
|
24
|
+
- npm run prettier
|
|
25
|
+
- npm run style || true # Allow failure if no CSS files
|
|
26
|
+
|
|
27
|
+
- step:
|
|
28
|
+
name: Test
|
|
29
|
+
caches:
|
|
30
|
+
- npm
|
|
31
|
+
script:
|
|
32
|
+
- npm ci
|
|
33
|
+
- npm run test:coverage
|
|
34
|
+
artifacts:
|
|
35
|
+
- coverage/**
|
|
36
|
+
|
|
37
|
+
branches:
|
|
38
|
+
main:
|
|
39
|
+
- step:
|
|
40
|
+
name: Lint
|
|
41
|
+
caches:
|
|
42
|
+
- npm
|
|
43
|
+
script:
|
|
44
|
+
- npm ci
|
|
45
|
+
- npm run lint
|
|
46
|
+
- npm run prettier
|
|
47
|
+
- npm run style || true
|
|
48
|
+
|
|
49
|
+
- step:
|
|
50
|
+
name: Test
|
|
51
|
+
caches:
|
|
52
|
+
- npm
|
|
53
|
+
script:
|
|
54
|
+
- npm ci
|
|
55
|
+
- npm run test:coverage
|
|
56
|
+
artifacts:
|
|
57
|
+
- coverage/**
|
|
58
|
+
|
|
59
|
+
- step:
|
|
60
|
+
name: Release
|
|
61
|
+
caches:
|
|
62
|
+
- npm
|
|
63
|
+
script:
|
|
64
|
+
- npm ci
|
|
65
|
+
- npm run release
|
|
66
|
+
trigger: manual # Remove this line to make releases automatic
|
|
67
|
+
|
|
68
|
+
pull-requests:
|
|
69
|
+
'**':
|
|
70
|
+
- step:
|
|
71
|
+
name: Lint & Test
|
|
72
|
+
caches:
|
|
73
|
+
- npm
|
|
74
|
+
script:
|
|
75
|
+
- npm ci
|
|
76
|
+
- npm run lint
|
|
77
|
+
- npm run prettier
|
|
78
|
+
- npm run style || true
|
|
79
|
+
- npm run test
|
|
80
|
+
# Optional: Test on multiple Node versions
|
|
81
|
+
# definitions:
|
|
82
|
+
# services:
|
|
83
|
+
# docker:
|
|
84
|
+
# memory: 2048
|
|
85
|
+
#
|
|
86
|
+
# pipelines:
|
|
87
|
+
# default:
|
|
88
|
+
# - parallel:
|
|
89
|
+
# - step:
|
|
90
|
+
# name: Test (Node 20)
|
|
91
|
+
# image: node:20
|
|
92
|
+
# script:
|
|
93
|
+
# - npm ci
|
|
94
|
+
# - npm test
|
|
95
|
+
# - step:
|
|
96
|
+
# name: Test (Node 22)
|
|
97
|
+
# image: node:22
|
|
98
|
+
# script:
|
|
99
|
+
# - npm ci
|
|
100
|
+
# - npm test
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# GitHub Actions Workflow Template for @dimensional-innovations/tool-config
|
|
2
|
+
#
|
|
3
|
+
# Copy this file to your project:
|
|
4
|
+
# mkdir -p .github/workflows
|
|
5
|
+
# cp node_modules/@dimensional-innovations/tool-config/src/tools/semantic-release/templates/github-workflow.yml .github/workflows/ci.yml
|
|
6
|
+
#
|
|
7
|
+
# Then configure these secrets in GitHub:
|
|
8
|
+
# - GITHUB_TOKEN: Automatically provided by GitHub Actions
|
|
9
|
+
# - NPM_TOKEN: npm token (for publishing packages)
|
|
10
|
+
|
|
11
|
+
name: CI/CD
|
|
12
|
+
|
|
13
|
+
on:
|
|
14
|
+
push:
|
|
15
|
+
branches: [main, develop]
|
|
16
|
+
pull_request:
|
|
17
|
+
branches: [main, develop]
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
lint:
|
|
21
|
+
name: Lint
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@v4
|
|
25
|
+
|
|
26
|
+
- name: Setup Node.js
|
|
27
|
+
uses: actions/setup-node@v4
|
|
28
|
+
with:
|
|
29
|
+
node-version: '22'
|
|
30
|
+
cache: 'npm'
|
|
31
|
+
|
|
32
|
+
- name: Install dependencies
|
|
33
|
+
run: npm ci
|
|
34
|
+
|
|
35
|
+
- name: Run ESLint
|
|
36
|
+
run: npm run lint
|
|
37
|
+
|
|
38
|
+
- name: Run Prettier
|
|
39
|
+
run: npm run prettier
|
|
40
|
+
|
|
41
|
+
- name: Run Stylelint
|
|
42
|
+
run: npm run style || true # Allow failure if no CSS files
|
|
43
|
+
|
|
44
|
+
test:
|
|
45
|
+
name: Test
|
|
46
|
+
runs-on: ubuntu-latest
|
|
47
|
+
steps:
|
|
48
|
+
- uses: actions/checkout@v4
|
|
49
|
+
|
|
50
|
+
- name: Setup Node.js
|
|
51
|
+
uses: actions/setup-node@v4
|
|
52
|
+
with:
|
|
53
|
+
node-version: '22'
|
|
54
|
+
cache: 'npm'
|
|
55
|
+
|
|
56
|
+
- name: Install dependencies
|
|
57
|
+
run: npm ci
|
|
58
|
+
|
|
59
|
+
- name: Run tests with coverage
|
|
60
|
+
run: npm run test:coverage
|
|
61
|
+
|
|
62
|
+
- name: Upload coverage to Codecov
|
|
63
|
+
uses: codecov/codecov-action@v4
|
|
64
|
+
with:
|
|
65
|
+
files: ./coverage/coverage-final.json
|
|
66
|
+
fail_ci_if_error: false
|
|
67
|
+
|
|
68
|
+
release:
|
|
69
|
+
name: Release
|
|
70
|
+
needs: [lint, test]
|
|
71
|
+
runs-on: ubuntu-latest
|
|
72
|
+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
|
|
73
|
+
steps:
|
|
74
|
+
- uses: actions/checkout@v4
|
|
75
|
+
with:
|
|
76
|
+
persist-credentials: false
|
|
77
|
+
|
|
78
|
+
- name: Setup Node.js
|
|
79
|
+
uses: actions/setup-node@v4
|
|
80
|
+
with:
|
|
81
|
+
node-version: '22'
|
|
82
|
+
cache: 'npm'
|
|
83
|
+
|
|
84
|
+
- name: Install dependencies
|
|
85
|
+
run: npm ci
|
|
86
|
+
|
|
87
|
+
- name: Release
|
|
88
|
+
env:
|
|
89
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
90
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
91
|
+
run: npm run release
|
|
92
|
+
# Optional: Test on multiple Node versions
|
|
93
|
+
# test-matrix:
|
|
94
|
+
# name: Test (Node ${{ matrix.node-version }})
|
|
95
|
+
# runs-on: ubuntu-latest
|
|
96
|
+
# strategy:
|
|
97
|
+
# matrix:
|
|
98
|
+
# node-version: [20, 22]
|
|
99
|
+
# steps:
|
|
100
|
+
# - uses: actions/checkout@v4
|
|
101
|
+
# - name: Setup Node.js ${{ matrix.node-version }}
|
|
102
|
+
# uses: actions/setup-node@v4
|
|
103
|
+
# with:
|
|
104
|
+
# node-version: ${{ matrix.node-version }}
|
|
105
|
+
# cache: 'npm'
|
|
106
|
+
# - run: npm ci
|
|
107
|
+
# - run: npm test
|