@tarsilla/commit-wizard 1.0.4 โ†’ 1.1.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/README.md CHANGED
@@ -25,7 +25,7 @@ yarn add --dev @tarsilla/commit-wizard
25
25
 
26
26
  ## Usage
27
27
 
28
- ### Commitizen
28
+ ### commitizen
29
29
 
30
30
  Create a `.czrc` file in your project root with the following content:
31
31
 
@@ -37,7 +37,7 @@ Create a `.czrc` file in your project root with the following content:
37
37
 
38
38
  When you run `npx git-cz`, Commitizen will present you with an interactive prompt to format your commit messages.
39
39
 
40
- ### Commitlint
40
+ ### commitlint
41
41
 
42
42
  Create a `commitlint.config.mjs` file in your project root with the following content:
43
43
 
@@ -50,7 +50,7 @@ export default {
50
50
  Commitlint enforces commit message conventions by using the conventional commits preset.
51
51
  It is recommended to run commitlint during your commit process, ex. using husky (e.g. see [.husky/commit-msg](src/commitlint/commit-msg)).
52
52
 
53
- ### Semantic-release
53
+ ### semantic-release
54
54
 
55
55
  Create a `.releaserc.cjs` file in your project root with the following content:
56
56
 
@@ -65,7 +65,7 @@ module.exports = {
65
65
  The semantic-release configuration automates version management and changelog generation.
66
66
  It is recommended to configure CI/CD to run semantic-release, ex. using github actions (e.g. see [.github/workflows/npm-publish.yml](src/semantic-release/npm-publish.yml)).
67
67
 
68
- ## Customization
68
+ ## Configuration Options
69
69
 
70
70
  You can override default settings by creating a `commit-wizard.config.json` file in your project root.
71
71
  The plugin accepts an object of type `CommitWizardOptions`:
@@ -74,8 +74,8 @@ The plugin accepts an object of type `CommitWizardOptions`:
74
74
  |----------|--------|--------------------------------------------------------------|-------------|
75
75
  | maxLineLength | number | The maximum length of the commit message. If not provided, the plugin will run with the default settings. | 120 |
76
76
 
77
-
78
77
  Example `commit-wizard.config.json`:
78
+
79
79
  ```json
80
80
  {
81
81
  "maxLineLength": 100
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/commitizen/prompter.ts","../../src/configLoader/configLoader.ts","../../src/commitizen/index.ts"],"sourcesContent":["import { Commitizen, Prompter, Question } from 'commitizen';\n\nimport CommitWizardOptions from '../types/CommitWizardOptions.js';\n\nexport type CommitAnswers = {\n type: string;\n scope: string;\n subject: string;\n confirmCommit: string;\n};\n\nfunction getCommitMessage({ answers }: { answers: CommitAnswers }) {\n const scopeText = answers.scope ? `(${answers.scope})` : '';\n if (answers.type === 'break') {\n const message = `feat${scopeText}!: ${answers.subject}`;\n return message;\n }\n const message = `${answers.type}${scopeText}: ${answers.subject}`;\n return message;\n}\n\nfunction getMaxSubject({ answers, maxLineLength }: { answers: CommitAnswers; maxLineLength: number }) {\n const scopeText = answers.scope ? `(${answers.scope})` : '';\n // +2 accounts for \": \" after type and scope.\n const prefixLength = (answers.type ? answers.type.length : 0) + scopeText.length + 2;\n const maxSubject = maxLineLength - prefixLength;\n return maxSubject;\n}\n\nfunction prompter({ maxLineLength }: CommitWizardOptions): Prompter {\n return {\n prompter: function (cz: Commitizen, commit: (message: string) => void) {\n const questions: Question<CommitAnswers> = [\n {\n type: 'list',\n name: 'type',\n message: \"Select the type of change that you're committing:\",\n choices: [\n { value: 'feat', name: '๐Ÿš€ feat: A new feature' },\n { value: 'fix', name: '๐Ÿ› fix: A bug fix' },\n { value: 'docs', name: '๐Ÿ“š docs: Documentation only changes' },\n {\n value: 'style',\n name: '๐ŸŽจ style: Changes that do not affect the meaning of the code (white-space, formatting, etc)',\n },\n { value: 'refactor', name: '๐Ÿ”จ refactor: A code change that neither fixes a bug nor adds a feature' },\n { value: 'perf', name: 'โšก๏ธ perf: A code change that improves performance' },\n { value: 'test', name: '๐Ÿ” test: Adding missing tests or correcting existing tests' },\n { value: 'build', name: '๐Ÿ“ฆ build: Changes that affect the build system or external dependencies' },\n { value: 'ci', name: '๐Ÿค– ci: Changes to our CI configuration files and scripts' },\n { value: 'chore', name: \"๐Ÿงน chore: Other changes that don't modify src or test files\" },\n { value: 'break', name: '๐Ÿ’ฅ break: A change that breaks existing functionality' },\n { value: 'revert', name: 'โช revert: Reverts a previous commit' },\n ],\n },\n {\n type: 'input',\n name: 'scope',\n message: 'What is the scope of this change (e.g. component or file name): (press enter to skip)',\n },\n {\n type: 'input',\n name: 'subject',\n message: (answers) => {\n const maxSubject = getMaxSubject({ answers, maxLineLength });\n return `Write a short, imperative tense description of the change (max ${maxSubject} chars):`;\n },\n validate: (input, answers) => {\n if (!input.trim()) {\n // \\u001b[31m is red\n return `\\u001b[31mSubject is required\\u001b[39m`;\n }\n const maxSubject = getMaxSubject({ answers: answers!, maxLineLength });\n if (input.length <= maxSubject) {\n return true;\n }\n // \\u001b[31m is red\n return `\\u001b[31mSubject length must be less than or equal to ${maxSubject} characters. Current length is ${input.length} characters.\\u001b[39m`;\n },\n transformer: (input, answers) => {\n const maxSubject = getMaxSubject({ answers, maxLineLength });\n const remaining = maxSubject - input.length;\n if (remaining < 0) {\n // Red if remaining < 0: \\u001b[31m is red, \\u001b[39m resets the color.\n return `\\n\\u001b[31m(${input.length}) ${input}\\u001b[39m`;\n }\n // Green if valid: \\u001b[32m is green, \\u001b[39m resets the color.\n return `\\n\\u001b[32m(${input.length}) ${input}\\u001b[39m`;\n },\n },\n {\n type: 'list',\n name: 'confirmCommit',\n choices: [\n { value: 'yes', name: 'Yes' },\n { value: 'no', name: 'Abort commit' },\n ],\n default: 0,\n message(answers) {\n const SEP = '--------------------------------------------------------';\n const message = getCommitMessage({ answers });\n console.info(`\\n${SEP}\\n\\n${message}\\n\\n${SEP}\\n`);\n return 'Are you sure you want to proceed with the commit above?';\n },\n },\n ];\n\n cz.prompt(questions).then((answers) => {\n if (answers.confirmCommit === 'no') {\n console.info('Commit aborted.');\n } else {\n const message = getCommitMessage({ answers });\n commit(message);\n }\n });\n },\n };\n}\n\nexport default prompter;\n","import fs from 'fs';\nimport path from 'path';\n\nimport CommitWizardOptions from '../types/CommitWizardOptions.js';\n\nconst config: CommitWizardOptions = {\n maxLineLength: 120,\n};\nconst file = 'commit-wizard.config.json';\n\nfunction configLoader(): CommitWizardOptions {\n const configPath = path.resolve(process.cwd(), file);\n\n if (!fs.existsSync(configPath)) {\n return config;\n }\n\n const loadedConfig = require(configPath);\n return { ...config, ...loadedConfig };\n}\n\nexport default configLoader;\n","import commitizenPrompter from './prompter.js';\nimport configLoader from '../configLoader/configLoader.js';\nimport CommitWizardOptions from '../types/CommitWizardOptions.js';\n\nconst loadedConfig: CommitWizardOptions = configLoader();\nconst prompter = commitizenPrompter(loadedConfig);\n\nexport default prompter;\n"],"names":["getCommitMessage","answers","scopeText","scope","type","subject","getMaxSubject","maxLineLength","length","config","prompter","cz","commit","questions","name","message","choices","value","validate","input","trim","maxSubject","transformer","default","SEP","console","info","prompt","then","confirmCommit","commitizenPrompter","configPath","path","resolve","process","cwd","fs","existsSync","loadedConfig","require","configLoader"],"mappings":"sCAWA,SAASA,GAAiBC,QAAEA,IAC1B,MAAMC,EAAYD,EAAQE,MAAQ,IAAIF,EAAQE,SAAW,GACzD,GAAqB,UAAjBF,EAAQG,KAAkB,CAE5B,MADgB,OAAOF,OAAeD,EAAQI,SAEhD,CAEA,MADgB,GAAGJ,EAAQG,OAAOF,MAAcD,EAAQI,SAE1D,CAEA,SAASC,GAAcL,QAAEA,EAAOM,cAAEA,IAChC,MAAML,EAAYD,EAAQE,MAAQ,IAAIF,EAAQE,SAAW,GAIzD,OADmBI,IADGN,EAAQG,KAAOH,EAAQG,KAAKI,OAAS,GAAKN,EAAUM,OAAS,EAGrF,CCtBA,MAAMC,EAA8B,CAClCF,cAAe,KCFjB,MACMG,EFwBN,UAAkBH,cAAEA,IAClB,MAAO,CACLG,SAAU,SAAUC,EAAgBC,GAClC,MAAMC,EAAqC,CACzC,CACET,KAAM,OACNU,KAAM,OACNC,QAAS,oDACTC,QAAS,CACP,CAAEC,MAAO,OAAQH,KAAM,8BACvB,CAAEG,MAAO,MAAOH,KAAM,0BACtB,CAAEG,MAAO,OAAQH,KAAM,2CACvB,CACEG,MAAO,QACP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,EAGT,MAAM6B,EAAeC,QAAQR,GAC7B,MAAO,IAAKtB,KAAW6B,EACzB,CCf0CE"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/commitizen/prompter.ts","../../src/config-loader/configLoader.ts","../../src/commitizen/index.ts"],"sourcesContent":["import { Commitizen, Prompter, Question } from 'commitizen';\n\nimport CommitWizardOptions from '../types/CommitWizardOptions.js';\n\nexport type CommitAnswers = {\n type: string;\n scope: string;\n subject: string;\n confirmCommit: string;\n};\n\nfunction getCommitMessage({ answers }: { answers: CommitAnswers }) {\n const scopeText = answers.scope ? `(${answers.scope})` : '';\n if (answers.type === 'break') {\n const message = `feat${scopeText}!: ${answers.subject}`;\n return message;\n }\n const message = `${answers.type}${scopeText}: ${answers.subject}`;\n return message;\n}\n\nfunction getMaxSubject({ answers, maxLineLength }: { answers: CommitAnswers; maxLineLength: number }) {\n const scopeText = answers.scope ? `(${answers.scope})` : '';\n // +2 accounts for \": \" after type and scope.\n const prefixLength = (answers.type ? answers.type.length : 0) + scopeText.length + 2;\n const maxSubject = maxLineLength - prefixLength;\n return maxSubject;\n}\n\nfunction prompter({ maxLineLength }: CommitWizardOptions): Prompter {\n return {\n prompter: function (cz: Commitizen, commit: (message: string) => void) {\n const questions: Question<CommitAnswers> = [\n {\n type: 'list',\n name: 'type',\n message: \"Select the type of change that you're committing:\",\n choices: [\n { value: 'feat', name: '๐Ÿš€ feat: A new feature' },\n { value: 'fix', name: '๐Ÿ› fix: A bug fix' },\n { value: 'docs', name: '๐Ÿ“š docs: Documentation only changes' },\n {\n value: 'style',\n name: '๐ŸŽจ style: Changes that do not affect the meaning of the code (white-space, formatting, etc)',\n },\n { value: 'refactor', name: '๐Ÿ”จ refactor: A code change that neither fixes a bug nor adds a feature' },\n { value: 'perf', name: 'โšก๏ธ perf: A code change that improves performance' },\n { value: 'test', name: '๐Ÿ” test: Adding missing tests or correcting existing tests' },\n { value: 'build', name: '๐Ÿ“ฆ build: Changes that affect the build system or external dependencies' },\n { value: 'ci', name: '๐Ÿค– ci: Changes to our CI configuration files and scripts' },\n { value: 'chore', name: \"๐Ÿงน chore: Other changes that don't modify src or test files\" },\n { value: 'break', name: '๐Ÿ’ฅ break: A change that breaks existing functionality' },\n { value: 'revert', name: 'โช revert: Reverts a previous commit' },\n ],\n },\n {\n type: 'input',\n name: 'scope',\n message: 'What is the scope of this change (e.g. component or file name): (press enter to skip)',\n },\n {\n type: 'input',\n name: 'subject',\n message: (answers) => {\n const maxSubject = getMaxSubject({ answers, maxLineLength });\n return `Write a short, imperative tense description of the change (max ${maxSubject} chars):`;\n },\n validate: (input, answers) => {\n if (!input.trim()) {\n // \\u001b[31m is red\n return `\\u001b[31mSubject is required\\u001b[39m`;\n }\n const maxSubject = getMaxSubject({ answers: answers!, maxLineLength });\n if (input.length <= maxSubject) {\n return true;\n }\n // \\u001b[31m is red\n return `\\u001b[31mSubject length must be less than or equal to ${maxSubject} characters. Current length is ${input.length} characters.\\u001b[39m`;\n },\n transformer: (input, answers) => {\n const maxSubject = getMaxSubject({ answers, maxLineLength });\n const remaining = maxSubject - input.length;\n if (remaining < 0) {\n // Red if remaining < 0: \\u001b[31m is red, \\u001b[39m resets the color.\n return `\\n\\u001b[31m(${input.length}) ${input}\\u001b[39m`;\n }\n // Green if valid: \\u001b[32m is green, \\u001b[39m resets the color.\n return `\\n\\u001b[32m(${input.length}) ${input}\\u001b[39m`;\n },\n },\n {\n type: 'list',\n name: 'confirmCommit',\n choices: [\n { value: 'yes', name: 'Yes' },\n { value: 'no', name: 'Abort commit' },\n ],\n default: 0,\n message(answers) {\n const SEP = '--------------------------------------------------------';\n const message = getCommitMessage({ answers });\n console.info(`\\n${SEP}\\n\\n${message}\\n\\n${SEP}\\n`);\n return 'Are you sure you want to proceed with the commit above?';\n },\n },\n ];\n\n cz.prompt(questions).then((answers) => {\n if (answers.confirmCommit === 'no') {\n console.info('Commit aborted.');\n } else {\n const message = getCommitMessage({ answers });\n commit(message);\n }\n });\n },\n };\n}\n\nexport default prompter;\n","import fs from 'fs';\nimport path from 'path';\n\nimport CommitWizardOptions from '../types/CommitWizardOptions.js';\n\nconst config: CommitWizardOptions = {\n maxLineLength: 120,\n};\nconst file = 'commit-wizard.config.json';\n\nfunction configLoader(): CommitWizardOptions {\n const configPath = path.resolve(process.cwd(), file);\n\n if (!fs.existsSync(configPath)) {\n return config;\n }\n\n const loadedConfig = require(configPath);\n return { ...config, ...loadedConfig };\n}\n\nexport default configLoader;\n","import commitizenPrompter from './prompter.js';\nimport configLoader from '../config-loader/configLoader.js';\nimport CommitWizardOptions from '../types/CommitWizardOptions.js';\n\nconst loadedConfig: CommitWizardOptions = configLoader();\nconst prompter = commitizenPrompter(loadedConfig);\n\nexport default prompter;\n"],"names":["getCommitMessage","answers","scopeText","scope","type","subject","getMaxSubject","maxLineLength","length","config","prompter","cz","commit","questions","name","message","choices","value","validate","input","trim","maxSubject","transformer","default","SEP","console","info","prompt","then","confirmCommit","commitizenPrompter","configPath","path","resolve","process","cwd","fs","existsSync","loadedConfig","require","configLoader"],"mappings":"sCAWA,SAASA,GAAiBC,QAAEA,IAC1B,MAAMC,EAAYD,EAAQE,MAAQ,IAAIF,EAAQE,SAAW,GACzD,GAAqB,UAAjBF,EAAQG,KAAkB,CAE5B,MADgB,OAAOF,OAAeD,EAAQI,SAEhD,CAEA,MADgB,GAAGJ,EAAQG,OAAOF,MAAcD,EAAQI,SAE1D,CAEA,SAASC,GAAcL,QAAEA,EAAOM,cAAEA,IAChC,MAAML,EAAYD,EAAQE,MAAQ,IAAIF,EAAQE,SAAW,GAIzD,OADmBI,IADGN,EAAQG,KAAOH,EAAQG,KAAKI,OAAS,GAAKN,EAAUM,OAAS,EAGrF,CCtBA,MAAMC,EAA8B,CAClCF,cAAe,KCFjB,MACMG,EFwBN,UAAkBH,cAAEA,IAClB,MAAO,CACLG,SAAU,SAAUC,EAAgBC,GAClC,MAAMC,EAAqC,CACzC,CACET,KAAM,OACNU,KAAM,OACNC,QAAS,oDACTC,QAAS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,IAEJ,EAEJ,CEhHiBe,CDKjB,WACE,MAAMC,EAAaC,EAAKC,QAAQC,QAAQC,MAH7B,6BAKX,IAAKC,EAAGC,WAAWN,GACjB,OAAOtB,EAGT,MAAM6B,EAAeC,QAAQR,GAC7B,MAAO,IAAKtB,KAAW6B,EACzB,CCf0CE"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/configLoader/configLoader.ts","../../src/commitlint/index.ts","../../src/commitlint/userConfig.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nimport CommitWizardOptions from '../types/CommitWizardOptions.js';\n\nconst config: CommitWizardOptions = {\n maxLineLength: 120,\n};\nconst file = 'commit-wizard.config.json';\n\nfunction configLoader(): CommitWizardOptions {\n const configPath = path.resolve(process.cwd(), file);\n\n if (!fs.existsSync(configPath)) {\n return config;\n }\n\n const loadedConfig = require(configPath);\n return { ...config, ...loadedConfig };\n}\n\nexport default configLoader;\n","import { UserConfig } from '@commitlint/types';\n\nimport commitlintUserConfig from './userConfig.js';\nimport configLoader from '../configLoader/configLoader.js';\nimport CommitWizardOptions from '../types/CommitWizardOptions.js';\n\nconst loadedConfig: CommitWizardOptions = configLoader();\nconst userConfig: UserConfig = commitlintUserConfig(loadedConfig);\n\nexport default userConfig;\n","import { UserConfig } from '@commitlint/types';\n\nimport CommitWizardOptions from '../types/CommitWizardOptions.js';\n\nfunction userConfig({ maxLineLength }: CommitWizardOptions): UserConfig {\n return {\n extends: ['@commitlint/config-conventional'],\n parserPreset: {\n parserOpts: {\n headerPattern: /^(?<type>\\w+)(?<exclamation1>!?)(?:\\((?<scope>[^)]+)\\)(?<exclamation2>!?))?: (?<subject>.+)$/,\n headerCorrespondence: ['type', 'exclamation1', 'scope', 'exclamation2', 'subject'],\n },\n },\n rules: {\n 'header-max-length': [2, 'always', maxLineLength] as [number, 'always' | 'never', number],\n },\n };\n}\n\nexport default userConfig;\n"],"names":["config","maxLineLength","userConfig","extends","parserPreset","parserOpts","headerPattern","RegExp","headerCorrespondence","rules","commitlintUserConfig","configPath","path","resolve","process","cwd","fs","existsSync","loadedConfig","require","configLoader"],"mappings":"sCAKA,MAAMA,EAA8B,CAClCC,cAAe,KCAjB,MACMC,ECHN,UAAoBD,cAAEA,IACpB,MAAO,CACLE,QAAS,CAAC,mCACVC,aAAc,CACZC,WAAY,CACVC,cAAeC,OAAA,mGACfC,qBAAsB,CAAC,OAAQ,eAAgB,QAAS,eAAgB,aAG5EC,MAAO,CACL,oBAAqB,CAAC,EAAG,SAAUR,IAGzC,CDV+BS,CDG/B,WACE,MAAMC,EAAaC,EAAKC,QAAQC,QAAQC,MAH7B,6BAKX,IAAKC,EAAGC,WAAWN,GACjB,OAAOX,EAGT,MAAMkB,EAAeC,QAAQR,GAC7B,MAAO,IAAKX,KAAWkB,EACzB,CCb0CE"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/config-loader/configLoader.ts","../../src/commitlint/index.ts","../../src/commitlint/userConfig.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nimport CommitWizardOptions from '../types/CommitWizardOptions.js';\n\nconst config: CommitWizardOptions = {\n maxLineLength: 120,\n};\nconst file = 'commit-wizard.config.json';\n\nfunction configLoader(): CommitWizardOptions {\n const configPath = path.resolve(process.cwd(), file);\n\n if (!fs.existsSync(configPath)) {\n return config;\n }\n\n const loadedConfig = require(configPath);\n return { ...config, ...loadedConfig };\n}\n\nexport default configLoader;\n","import { UserConfig } from '@commitlint/types';\n\nimport commitlintUserConfig from './userConfig.js';\nimport configLoader from '../config-loader/configLoader.js';\nimport CommitWizardOptions from '../types/CommitWizardOptions.js';\n\nconst loadedConfig: CommitWizardOptions = configLoader();\nconst userConfig: UserConfig = commitlintUserConfig(loadedConfig);\n\nexport default userConfig;\n","import { UserConfig } from '@commitlint/types';\n\nimport CommitWizardOptions from '../types/CommitWizardOptions.js';\n\nfunction userConfig({ maxLineLength }: CommitWizardOptions): UserConfig {\n return {\n extends: ['@commitlint/config-conventional'],\n parserPreset: {\n parserOpts: {\n headerPattern: /^(?<type>\\w+)(?<exclamation1>!?)(?:\\((?<scope>[^)]+)\\)(?<exclamation2>!?))?: (?<subject>.+)$/,\n headerCorrespondence: ['type', 'exclamation1', 'scope', 'exclamation2', 'subject'],\n },\n },\n rules: {\n 'header-max-length': [2, 'always', maxLineLength] as [number, 'always' | 'never', number],\n },\n };\n}\n\nexport default userConfig;\n"],"names":["config","maxLineLength","userConfig","extends","parserPreset","parserOpts","headerPattern","RegExp","headerCorrespondence","rules","commitlintUserConfig","configPath","path","resolve","process","cwd","fs","existsSync","loadedConfig","require","configLoader"],"mappings":"sCAKA,MAAMA,EAA8B,CAClCC,cAAe,KCAjB,MACMC,ECHN,UAAoBD,cAAEA,IACpB,MAAO,CACLE,QAAS,CAAC,mCACVC,aAAc,CACZC,WAAY,CACVC,cAAeC,OAAA,mGACfC,qBAAsB,CAAC,OAAQ,eAAgB,QAAS,eAAgB,aAG5EC,MAAO,CACL,oBAAqB,CAAC,EAAG,SAAUR,IAGzC,CDV+BS,CDG/B,WACE,MAAMC,EAAaC,EAAKC,QAAQC,QAAQC,MAH7B,6BAKX,IAAKC,EAAGC,WAAWN,GACjB,OAAOX,EAGT,MAAMkB,EAAeC,QAAQR,GAC7B,MAAO,IAAKX,KAAWkB,EACzB,CCb0CE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarsilla/commit-wizard",
3
- "version": "1.0.4",
3
+ "version": "1.1.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -1,5 +1,5 @@
1
1
  import commitizenPrompter from './prompter.js';
2
- import configLoader from '../configLoader/configLoader.js';
2
+ import configLoader from '../config-loader/configLoader.js';
3
3
  import CommitWizardOptions from '../types/CommitWizardOptions.js';
4
4
 
5
5
  const loadedConfig: CommitWizardOptions = configLoader();
@@ -1,7 +1,7 @@
1
1
  import { UserConfig } from '@commitlint/types';
2
2
 
3
3
  import commitlintUserConfig from './userConfig.js';
4
- import configLoader from '../configLoader/configLoader.js';
4
+ import configLoader from '../config-loader/configLoader.js';
5
5
  import CommitWizardOptions from '../types/CommitWizardOptions.js';
6
6
 
7
7
  const loadedConfig: CommitWizardOptions = configLoader();
@@ -0,0 +1,28 @@
1
+ name: CodeQL Analyze
2
+ description: Github action to execute CodeQL analyze as part of a github workflow
3
+ inputs:
4
+ language:
5
+ required: true
6
+ build-mode:
7
+ required: true
8
+ out:
9
+ required: true
10
+ default: reports
11
+ runs:
12
+ using: composite
13
+ steps:
14
+ - name: Initialize CodeQL
15
+ uses: github/codeql-action/init@v3
16
+ with:
17
+ languages: ${{ inputs.language }}
18
+ build-mode: ${{ inputs.build-mode }}
19
+ - name: Run CodeQL Analysis
20
+ uses: github/codeql-action/analyze@v3
21
+ with:
22
+ category: /language:${{ inputs.language }}
23
+ output: ${{ github.workspace }}/${{ inputs.out }}/codeql-results.sarif
24
+ - name: Upload CodeQL report
25
+ uses: actions/upload-artifact@master
26
+ with:
27
+ name: CodeQL report
28
+ path: ${{ github.workspace }}/${{ inputs.out }}
@@ -0,0 +1,30 @@
1
+ name: OWASP Dependency-Check
2
+ description: Github action to execute OWASP dependency check as part of a github workflow
3
+ inputs:
4
+ project:
5
+ required: true
6
+ path:
7
+ required: true
8
+ format:
9
+ required: true
10
+ out:
11
+ required: true
12
+ default: reports
13
+ suppression:
14
+ required: false
15
+ runs:
16
+ using: composite
17
+ steps:
18
+ - name: Run OWASP Dependency-Check
19
+ uses: ./src/github-actions/code-analysis/base/owasp/owasp
20
+ with:
21
+ project: ${{ inputs.project }}
22
+ path: ${{ inputs.path }}
23
+ format: ${{ inputs.format }}
24
+ out: ${{ inputs.out }}
25
+ suppression: ${{ inputs.suppression }}
26
+ - name: Upload OWASP report
27
+ uses: actions/upload-artifact@master
28
+ with:
29
+ name: OWASP report
30
+ path: ${{ github.workspace }}/${{ inputs.out }}
@@ -0,0 +1,5 @@
1
+ FROM owasp/dependency-check-action:latest
2
+ RUN apk add --no-cache bash
3
+ COPY entrypoint.sh /entrypoint.sh
4
+ RUN chmod +x /entrypoint.sh
5
+ ENTRYPOINT ["/entrypoint.sh"]
@@ -0,0 +1,23 @@
1
+ name: OWASP Dependency-Check
2
+ description: Github action to execute OWASP dependency check as part of a github workflow
3
+ inputs:
4
+ project:
5
+ required: true
6
+ path:
7
+ required: true
8
+ format:
9
+ required: true
10
+ out:
11
+ required: true
12
+ default: reports
13
+ suppression:
14
+ required: false
15
+ runs:
16
+ using: docker
17
+ image: Dockerfile
18
+ args:
19
+ - ${{ inputs.project }}
20
+ - ${{ inputs.path }}
21
+ - ${{ inputs.format }}
22
+ - ${{ inputs.out }}
23
+ - ${{ inputs.suppression }}
@@ -0,0 +1,19 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ # Build base command array.
5
+ args=(--project "${INPUT_PROJECT}" \
6
+ --scan "$GITHUB_WORKSPACE/${INPUT_PATH}" \
7
+ --format "${INPUT_FORMAT}" \
8
+ --out "$GITHUB_WORKSPACE/${INPUT_OUT}" \
9
+ --noupdate \
10
+ --enableRetired \
11
+ --failOnCVSS 7)
12
+
13
+ # If the suppression boolean is true, append the flag.
14
+ if [ "${INPUT_SUPPRESSION}" = "true" ]; then
15
+ args+=(--suppression suppressions.xml)
16
+ fi
17
+
18
+ # Execute OWASP Dependency-Check with the built arguments.
19
+ /usr/share/dependency-check/bin/dependency-check.sh ${args[@]}
@@ -0,0 +1,15 @@
1
+ name: Snyk Code Test
2
+ description: Github action to execute Snyk code test as part of a github workflow
3
+ inputs:
4
+ token:
5
+ required: true
6
+ runs:
7
+ using: composite
8
+ steps:
9
+ - name: Run Snyk Code Test
10
+ uses: snyk/actions/node@master
11
+ with:
12
+ command: code test
13
+ args: --severity-threshold=high
14
+ env:
15
+ SNYK_TOKEN: ${{ inputs.token }}
@@ -0,0 +1,24 @@
1
+ name: Snyk Test
2
+ description: Github action to execute Snyk test as part of a github workflow
3
+ inputs:
4
+ project:
5
+ required: true
6
+ token:
7
+ required: true
8
+ runs:
9
+ using: composite
10
+ steps:
11
+ - name: Run Snyk Test
12
+ uses: snyk/actions/node@master
13
+ env:
14
+ SNYK_TOKEN: ${{ inputs.token }}
15
+ with:
16
+ command: test
17
+ args: --severity-threshold=high
18
+ - name: Run Snyk Monitor
19
+ uses: snyk/actions/node@master
20
+ with:
21
+ command: monitor
22
+ args: --project-name="${{ inputs.project }}"
23
+ env:
24
+ SNYK_TOKEN: ${{ inputs.token }}
@@ -0,0 +1,19 @@
1
+ name: OWASP Dependency-Check
2
+ description: Github action to execute OWASP dependency check as part of a github workflow for NodeJS projects
3
+ runs:
4
+ using: composite
5
+ steps:
6
+ - name: Setup Node.js
7
+ uses: actions/setup-node@v4
8
+ with:
9
+ node-version: 22.x
10
+ registry-url: https://registry.npmjs.org
11
+ - name: Install dependencies
12
+ run: npm ci
13
+ shell: bash
14
+ - name: Run CodeQL Analysis
15
+ uses: ./src/github-actions/code-analysis/base/codeql
16
+ with:
17
+ language: javascript-typescript
18
+ build-mode: none
19
+ out: reports
@@ -0,0 +1,24 @@
1
+ name: OWASP Dependency-Check
2
+ description: Github action to execute OWASP dependency check as part of a github workflow for NodeJS projects
3
+ inputs:
4
+ suppression:
5
+ required: false
6
+ runs:
7
+ using: composite
8
+ steps:
9
+ - name: Setup Node.js
10
+ uses: actions/setup-node@v4
11
+ with:
12
+ node-version: 22.x
13
+ registry-url: https://registry.npmjs.org
14
+ - name: Install dependencies
15
+ run: npm ci
16
+ shell: bash
17
+ - name: Run OWASP Dependency-Check
18
+ uses: ./src/github-actions/code-analysis/base/owasp
19
+ with:
20
+ project: ${{ github.repository }}
21
+ path: .
22
+ format: HTML
23
+ out: reports
24
+ suppression: ${{ inputs.suppression }}
@@ -0,0 +1,20 @@
1
+ name: Snyk Test
2
+ description: Github action to execute Snyk test as part of a github workflow for NodeJS projects
3
+ inputs:
4
+ token:
5
+ required: true
6
+ runs:
7
+ using: composite
8
+ steps:
9
+ - name: Setup Node.js
10
+ uses: actions/setup-node@v4
11
+ with:
12
+ node-version: 22.x
13
+ registry-url: https://registry.npmjs.org
14
+ - name: Install dependencies
15
+ run: npm ci
16
+ shell: bash
17
+ - name: Run Snyk Code Test
18
+ uses: ./src/github-actions/code-analysis/base/snyk/code-test/node
19
+ with:
20
+ token: ${{ inputs.token }}
@@ -0,0 +1,21 @@
1
+ name: Snyk Test
2
+ description: Github action to execute Snyk test as part of a github workflow for NodeJS projects
3
+ inputs:
4
+ token:
5
+ required: true
6
+ runs:
7
+ using: composite
8
+ steps:
9
+ - name: Setup Node.js
10
+ uses: actions/setup-node@v4
11
+ with:
12
+ node-version: 22.x
13
+ registry-url: https://registry.npmjs.org
14
+ - name: Install dependencies
15
+ run: npm ci
16
+ shell: bash
17
+ - name: Run Snyk Test
18
+ uses: ./src/github-actions/code-analysis/base/snyk/test/node
19
+ with:
20
+ project: ${{ github.repository }}
21
+ token: ${{ inputs.token }}
@@ -0,0 +1,34 @@
1
+ name: Deploy to Github Pages
2
+ description: Github action to deploy to github pages as part of a github workflow for NodeJS projects
3
+ inputs:
4
+ path:
5
+ description: Specifies the path of the static assets after building
6
+ required: true
7
+ install:
8
+ description: Specifies the command to run the installation.
9
+ required: true
10
+ build:
11
+ description: Specifies the command to run after install for the build
12
+ required: true
13
+ outputs:
14
+ page_url:
15
+ description: The URL of the page
16
+ value: ${{ steps.deploy.outputs.page_url }}
17
+ runs:
18
+ using: composite
19
+ steps:
20
+ - name: Install
21
+ shell: bash
22
+ run: ${{ inputs.install_command }}
23
+ - name: Build
24
+ shell: bash
25
+ run: ${{ inputs.build }}
26
+ - name: Upload files
27
+ uses: actions/upload-pages-artifact@v3
28
+ with:
29
+ path: ${{ inputs.path }}
30
+ - id: deploy
31
+ name: Deploy to GitHub Pages
32
+ uses: actions/deploy-pages@v4
33
+ with:
34
+ token: ${{ github.token }}
@@ -0,0 +1,26 @@
1
+ name: Deploy Storybook to Github Pages
2
+ description: Github action to deploy storybook to github pages as part of a github workflow for NodeJS projects
3
+ inputs:
4
+ path:
5
+ description: Specifies the path of the static assets after building
6
+ required: true
7
+ install:
8
+ description: Specifies the command to run the installation.
9
+ required: true
10
+ build:
11
+ description: Specifies the command to run after install for the build
12
+ required: true
13
+ runs:
14
+ using: composite
15
+ steps:
16
+ - name: Setup Node.js
17
+ uses: actions/setup-node@v4
18
+ with:
19
+ node-version: 22.x
20
+ registry-url: https://registry.npmjs.org
21
+ - name: Deploy Storybook to Github Pages
22
+ uses: ./src/github-actions/deploy/github-pages/base
23
+ with:
24
+ path: storybook-static
25
+ install: npm ci
26
+ build: npm run build-storybook
@@ -0,0 +1,25 @@
1
+ name: NPM Publish
2
+ description: Github action to publish to npm as part of a github workflow for NodeJS projects
3
+ inputs:
4
+ npm-token:
5
+ required: true
6
+ runs:
7
+ using: composite
8
+ steps:
9
+ - name: Setup Node.js
10
+ uses: actions/setup-node@v4
11
+ with:
12
+ node-version: 22.x
13
+ registry-url: https://registry.npmjs.org
14
+ - name: Install dependencies
15
+ shell: bash
16
+ run: npm ci
17
+ - name: Build
18
+ shell: bash
19
+ run: npm run build
20
+ - name: Publish to NPM
21
+ shell: bash
22
+ run: npx semantic-release
23
+ env:
24
+ GITHUB_TOKEN: ${{ github.token }}
25
+ NPM_TOKEN: ${{ inputs.npm-token }}
@@ -1,42 +0,0 @@
1
- name: Publish to npm
2
-
3
- on:
4
- workflow_run:
5
- workflows: ["Code Analysis"]
6
- types:
7
- - completed
8
-
9
- permissions:
10
- contents: read # for checkout
11
-
12
- jobs:
13
- publish:
14
- name: Publish
15
- runs-on: ubuntu-latest
16
- permissions:
17
- contents: write # to be able to publish a GitHub release
18
- issues: write # to be able to comment on released issues
19
- pull-requests: write # to be able to comment on released pull requests
20
- id-token: write # to enable use of OIDC for npm provenance
21
-
22
- steps:
23
- - name: Checkout code
24
- uses: actions/checkout@v4
25
-
26
- - name: Setup Node.js
27
- uses: actions/setup-node@v4
28
- with:
29
- node-version: '22.x'
30
- registry-url: 'https://registry.npmjs.org'
31
-
32
- - name: Install dependencies
33
- run: npm ci
34
-
35
- - name: Build
36
- run: npm run build
37
-
38
- - name: Publish to npm
39
- env:
40
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
42
- run: npx semantic-release