Skip to content

Commit

Permalink
chore: use yarn workspace based commit scopes
Browse files Browse the repository at this point in the history
  • Loading branch information
unicornware committed Sep 14, 2021
1 parent 3f55036 commit 889322b
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 70 deletions.
14 changes: 5 additions & 9 deletions .github/labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,8 @@
description: Application cache
color: 74cefc

- name: scope:cli
description: CLI application
color: 74cefc

- name: scope:deploy
description: Package deployment tasks
- name: scope:deploy-release
description: Package deployment and release tasks
color: 74cefc

- name: scope:deps
Expand All @@ -146,12 +142,12 @@
description: Lifecycle functions
color: 74cefc

- name: scope:node
- name: scope:grease
description: Node.js program
color: 74cefc

- name: scope:release
description: Package release tasks
- name: scope:grease-cli
description: CLI application
color: 74cefc

- name: scope:scripts
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ jobs:
- name: Check code style
run: yarn check:style
- name: Build Node.js program
run: yarn build:node
run: yarn build:grease
env:
NODE_OPTIONS: -r tsconfig-paths/register
14 changes: 7 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,13 @@ To prevent `yarn bootstrap` errors, you'll need to conditionally require the
4. Run your script:

```zsh
yarn build:node
yarn build:grease
```

_instead of_

```zsh
NODE_OPTIONS='-r tsconfig-paths/register' yarn build:node
NODE_OPTIONS='-r tsconfig-paths/register' yarn build:grease
```

## Contributing Code
Expand Down Expand Up @@ -372,11 +372,11 @@ Before releasing, the following steps must be completed:
correct workspace publish command
3. Decide what version bump the release needs (major, minor, patch)
- versioning
- `yarn release:node` (determines [bumps based on commits][16])
- `yarn release:node --first-release`
- `yarn release:node --release-as major`
- `yarn release:node --release-as minor`
- `yarn release:node --release-as patch`
- `yarn release:grease` (determines [bumps based on commits][16])
- `yarn release:grease --first-release`
- `yarn release:grease --release-as major`
- `yarn release:grease --release-as minor`
- `yarn release:grease --release-as patch`
- a new release will be drafted
4. Open a new pull request from `release/*` into `next`
- title the PR `release: <package.json#name>@<package.json#version>`
Expand Down
58 changes: 44 additions & 14 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const { Rule, RuleConfigTuple } = require('@commitlint/types')
const { Record } = require('typescript')
const { RuleConfigTuple } = require('@commitlint/types')
const { lstatSync, readdirSync } = require('fs')
const { resolve } = require('path')

/**
* @file Commitlint Configuration
Expand All @@ -9,30 +10,29 @@ const { Record } = require('typescript')

module.exports = {
/**
* @property {boolean} defaultIgnores - If true, enable default ignore rules
* Enable default ignore rules.
*/
defaultIgnores: true,

/**
* @property {Array<string>} extends - IDs of commitlint configurations
* IDs of commitlint configurations.
*/
extends: ['@commitlint/config-conventional'],

/**
* @property {string} formatter - Name of formatter package
* Name of formatter package.
*/
formatter: '@commitlint/format',

/**
* Functions that return true if commitlint should ignore the given message.
*
* @param {string} commit - The commit message
* @return {boolean} `true` if commitlint should ignore message
*/
ignores: [],

/**
* @property {Record<string, Rule>} rules - Rules to test commits against
* Rules to test commits against.
*
* @see https://commitlint.js.org/#/reference-rules
*/
rules: {
/**
Expand All @@ -41,31 +41,61 @@ module.exports = {
'scope-case': [2, 'always', 'kebab-case'],

/**
* Rules for valid commit scopes.
* Returns the rules for valid commit scopes.
*
* @return {RuleConfigTuple} Scope rules
*/
'scope-enum': () => {
/**
* Returns an array containing Yarn workspace directory names.
*
* @return {string[]} Array containing workspace directory names
*/
const workspaceDirectories = () => {
// Yarn project names
const projects = ['packages']

// Init array of workspace directory names
const workspaces = []

// Get subdirectories
projects.forEach(project => {
// Get path to Yarn project directory
const path = resolve(__dirname, project)

// Add subdirectories under Yarn project directory
readdirSync(path).forEach(workspace => {
if (!lstatSync(resolve(path, workspace)).isDirectory()) return
return workspaces.push(workspace)
})
})

// Return workspace directory names
return workspaces
}

const scopes = [
'deploy',
'deps',
'deps-dev',
'deps-peer',
'release',
'scripts',
'tests',
'typescript',
'workflows'
'yarn'
]

const scopes_package = ['cli', 'node']
const workspaces = workspaceDirectories()

return [
2,
'always',
[
...scopes,
...scopes_package,
...scopes_package.map(ps => scopes.map(s => `${ps}-${s}`)).flat()
...workspaces,
...workspaces.map(d => scopes.map(s => `${d}-${s}`)).flat(),
'workflows'
]
]
},
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
"fix:format": "prettier --write .",
"fix:style": "yarn check:style --fix --cache",
"test": "bash scripts/jest.sh",
"test:node": "yarn workspace @flex-development/grease test",
"build:node": "yarn workspace @flex-development/grease build",
"release:node": "yarn workspace @flex-development/grease release"
"test:grease": "yarn workspace @flex-development/grease test",
"build:grease": "yarn workspace @flex-development/grease build",
"release:grease": "yarn workspace @flex-development/grease release"
},
"devDependencies": {
"@babel/core": "7.15.4",
Expand Down
72 changes: 36 additions & 36 deletions packages/grease/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ All notable changes to this project will be documented in this file. See [standa

### :recycle: Code Improvements

* **node-typescript:** update `SemanticVersionUnstable` definition ([66538cb](https://github.com/flex-development/grease/commit/66538cb6ba9811da0f3f69843aa0d410416fb770))
* **node-typescript:** update `SemanticVersionTag` definition ([549bf6d](https://github.com/flex-development/grease/commit/549bf6d3c6b4a6a60645eb0180950c1f517340e5))
* **node:** update `grease` options ([1c4c898](https://github.com/flex-development/grease/commit/1c4c8986e11470f2da069c6f0a42a29b948cae3b))
* **grease-typescript:** update `SemanticVersionUnstable` definition ([66538cb](https://github.com/flex-development/grease/commit/66538cb6ba9811da0f3f69843aa0d410416fb770))
* **grease-typescript:** update `SemanticVersionTag` definition ([549bf6d](https://github.com/flex-development/grease/commit/549bf6d3c6b4a6a60645eb0180950c1f517340e5))
* **grease:** update `grease` options ([1c4c898](https://github.com/flex-development/grease/commit/1c4c8986e11470f2da069c6f0a42a29b948cae3b))


### :hammer: Build

* **node:** install `@flex-development/dtag@1.0.0` ([17d4afd](https://github.com/flex-development/grease/commit/17d4afd9ebd9e8fe5c6f7d30d295ccc6ae25b616))
* **grease:** install `@flex-development/dtag@1.0.0` ([17d4afd](https://github.com/flex-development/grease/commit/17d4afd9ebd9e8fe5c6f7d30d295ccc6ae25b616))


### :sparkles: Features

* **node:** `utils/getPrerelease` ([541a880](https://github.com/flex-development/grease/commit/541a8804f72e13fb8be543d74e32a7bfe9045d34))
* **node:** autodetect `prerelease` ([ea6c990](https://github.com/flex-development/grease/commit/ea6c990ba3b0098b705e01d00302440b9df7dab8))
* **grease:** `utils/getPrerelease` ([541a880](https://github.com/flex-development/grease/commit/541a8804f72e13fb8be543d74e32a7bfe9045d34))
* **grease:** autodetect `prerelease` ([ea6c990](https://github.com/flex-development/grease/commit/ea6c990ba3b0098b705e01d00302440b9df7dab8))


### :truck: Continuous Integration & Deployment
Expand All @@ -30,16 +30,16 @@ All notable changes to this project will be documented in this file. See [standa

### :pencil2: Housekeeping

* **node:** update package keywords ([8da62a3](https://github.com/flex-development/grease/commit/8da62a3a80c421c1998e1b8934c03f309cc90dd1))
* **grease:** update package keywords ([8da62a3](https://github.com/flex-development/grease/commit/8da62a3a80c421c1998e1b8934c03f309cc90dd1))
* **scripts:** update `build` script ([005e1c1](https://github.com/flex-development/grease/commit/005e1c1932bda4df1b07cd3f21fb8a79a69f9635))

### [1.0.2](https://github.com/flex-development/grease/compare/grease@1.0.1...grease@1.0.2) (2021-08-23)


### :book: Documentation

* **node:** update installation instructions ([32699c2](https://github.com/flex-development/grease/commit/32699c2a6bc05a06699c84bddb40f2b4fb191972))
* **node:** update `package.json#homepage` ([6630524](https://github.com/flex-development/grease/commit/6630524c727da612482c1d2f0e152c44b3b1ee42))
* **grease:** update installation instructions ([32699c2](https://github.com/flex-development/grease/commit/32699c2a6bc05a06699c84bddb40f2b4fb191972))
* **grease:** update `package.json#homepage` ([6630524](https://github.com/flex-development/grease/commit/6630524c727da612482c1d2f0e152c44b3b1ee42))


### [1.0.1](https://github.com/flex-development/grease/compare/grease@1.0.0...grease@1.0.1) (2021-08-23)
Expand All @@ -52,39 +52,39 @@ All notable changes to this project will be documented in this file. See [standa

### :bug: Fixes

* **node:** `CreateReleaseDTO#version` failure when `options.skip.tag` is `true` ([e8ede43](https://github.com/flex-development/grease/commit/e8ede4365c7194e3f73d05413fdcbc2fecd037b7))
* **grease:** `CreateReleaseDTO#version` failure when `options.skip.tag` is `true` ([e8ede43](https://github.com/flex-development/grease/commit/e8ede4365c7194e3f73d05413fdcbc2fecd037b7))

## 1.0.0 (2021-08-15)


### :sparkles: Features

* **node:** `GreaseOptions.gitdir` ([2e5894a](https://github.com/flex-development/grease/commit/2e5894a273d809a1f595a3e318f4e99656389f0c))
* **node:** `GreaseOptions.verify` ([2b697aa](https://github.com/flex-development/grease/commit/2b697aada7bbb6c5f593f6ac2e32ee187b760700))
* **node:** add `GreaseScripts.postrelease` ([105ec5b](https://github.com/flex-development/grease/commit/105ec5b5a95b545d4dae9a2e5accc00b95f1494c))
* **node:** release branch whitelist ([fc61afa](https://github.com/flex-development/grease/commit/fc61afacf4cb74d6c5173d7c97a0a82174a7ef56))
* **node:** validate release data during `greaser` lifecycle ([38bedbc](https://github.com/flex-development/grease/commit/38bedbcaca0c84812519b5c65a6f8f6802c7b50c))
* **grease:** `GreaseOptions.gitdir` ([2e5894a](https://github.com/flex-development/grease/commit/2e5894a273d809a1f595a3e318f4e99656389f0c))
* **grease:** `GreaseOptions.verify` ([2b697aa](https://github.com/flex-development/grease/commit/2b697aada7bbb6c5f593f6ac2e32ee187b760700))
* **grease:** add `GreaseScripts.postrelease` ([105ec5b](https://github.com/flex-development/grease/commit/105ec5b5a95b545d4dae9a2e5accc00b95f1494c))
* **grease:** release branch whitelist ([fc61afa](https://github.com/flex-development/grease/commit/fc61afacf4cb74d6c5173d7c97a0a82174a7ef56))
* **grease:** validate release data during `greaser` lifecycle ([38bedbc](https://github.com/flex-development/grease/commit/38bedbcaca0c84812519b5c65a6f8f6802c7b50c))


### :bug: Fixes

* `commitlint.config` ([8e65403](https://github.com/flex-development/grease/commit/8e65403f2290ad6269d8f36d3df9599e85f7d070))
* eslint typescript project settings ([5d34043](https://github.com/flex-development/grease/commit/5d34043d3a286673246f67789301fa7fbb30d100))
* **node:** `cannot read property 'options' of undefined` ([fbe5265](https://github.com/flex-development/grease/commit/fbe5265945f0ff1b986c1a05486f7a2a8014a6cc))
* **node:** `CreateReleaseDTO validation failure: [files,version]` ([20abaf1](https://github.com/flex-development/grease/commit/20abaf1c01c3e9101d7831d1679aede152e8c4ae))
* **node:** `CreateReleaseDTO validation failure: [version]` ([9cd322c](https://github.com/flex-development/grease/commit/9cd322c035c7e50e13b7d8a89c20d8cc21feaa8d))
* **node:** `CreateReleaseDTO#toString` ([a1a6f86](https://github.com/flex-development/grease/commit/a1a6f863f8185dbcdcf2ab8fc26f546b0ed1c45d))
* **node:** `CreateReleaseDTO#toString` ([4dfdbe4](https://github.com/flex-development/grease/commit/4dfdbe4ee1be6bf0bca4485ff66e341a5921abd0))
* **node:** `CreateReleaseDTO#toString` ([622d9ac](https://github.com/flex-development/grease/commit/622d9aca2c5044ff3cfc9ed1141b660b1787be34))
* **node:** `grease/main` runs `options.scripts.prerelease` twice ([4f90f0b](https://github.com/flex-development/grease/commit/4f90f0be1e348bf230ea34e1cc9a1191ece93fdc))
* **node:** `grease/main` runs `options.scripts.prerelease` twice ([c6c9db0](https://github.com/flex-development/grease/commit/c6c9db0e4b44a1694dbb16327ad8451485c58d21))
* **node:** `GreaseOptions.infile` decorator ([fd8aece](https://github.com/flex-development/grease/commit/fd8aeceda095c05708c4b62359b1c04ef1c1e7ef))
* **node:** `IsTargetBranchConstraint.validate` ([0a82c6e](https://github.com/flex-development/grease/commit/0a82c6e296d933fe6aefc3067ea922c1e59a0b0a))
* **node:** `package.json#types` ([a49eb3b](https://github.com/flex-development/grease/commit/a49eb3bdca948b6c659f1d8329da6e85410fd807))
* **node:** `standard-version/lib/run-lifecycle-script` usage ([36daabb](https://github.com/flex-development/grease/commit/36daabbbd1318e3c8fc057c6e4e37c17dd6e102e))
* **node:** `updaters_1.default is not a function` ([68ccc1f](https://github.com/flex-development/grease/commit/68ccc1fab3f2c5423b29fe452a7a26f6e44bf158))
* **node:** add `GreaseScripts.postdepchecker` ([8b3b8f4](https://github.com/flex-development/grease/commit/8b3b8f49cc58fab46b6059a1b3c2c9928e7a1786))
* **node:** release tagging ([91f560a](https://github.com/flex-development/grease/commit/91f560a5b00474f614831e451f069b04ebc495a1))
* **grease:** `cannot read property 'options' of undefined` ([fbe5265](https://github.com/flex-development/grease/commit/fbe5265945f0ff1b986c1a05486f7a2a8014a6cc))
* **grease:** `CreateReleaseDTO validation failure: [files,version]` ([20abaf1](https://github.com/flex-development/grease/commit/20abaf1c01c3e9101d7831d1679aede152e8c4ae))
* **grease:** `CreateReleaseDTO validation failure: [version]` ([9cd322c](https://github.com/flex-development/grease/commit/9cd322c035c7e50e13b7d8a89c20d8cc21feaa8d))
* **grease:** `CreateReleaseDTO#toString` ([a1a6f86](https://github.com/flex-development/grease/commit/a1a6f863f8185dbcdcf2ab8fc26f546b0ed1c45d))
* **grease:** `CreateReleaseDTO#toString` ([4dfdbe4](https://github.com/flex-development/grease/commit/4dfdbe4ee1be6bf0bca4485ff66e341a5921abd0))
* **grease:** `CreateReleaseDTO#toString` ([622d9ac](https://github.com/flex-development/grease/commit/622d9aca2c5044ff3cfc9ed1141b660b1787be34))
* **grease:** `grease/main` runs `options.scripts.prerelease` twice ([4f90f0b](https://github.com/flex-development/grease/commit/4f90f0be1e348bf230ea34e1cc9a1191ece93fdc))
* **grease:** `grease/main` runs `options.scripts.prerelease` twice ([c6c9db0](https://github.com/flex-development/grease/commit/c6c9db0e4b44a1694dbb16327ad8451485c58d21))
* **grease:** `GreaseOptions.infile` decorator ([fd8aece](https://github.com/flex-development/grease/commit/fd8aeceda095c05708c4b62359b1c04ef1c1e7ef))
* **grease:** `IsTargetBranchConstraint.validate` ([0a82c6e](https://github.com/flex-development/grease/commit/0a82c6e296d933fe6aefc3067ea922c1e59a0b0a))
* **grease:** `package.json#types` ([a49eb3b](https://github.com/flex-development/grease/commit/a49eb3bdca948b6c659f1d8329da6e85410fd807))
* **grease:** `standard-version/lib/run-lifecycle-script` usage ([36daabb](https://github.com/flex-development/grease/commit/36daabbbd1318e3c8fc057c6e4e37c17dd6e102e))
* **grease:** `updaters_1.default is not a function` ([68ccc1f](https://github.com/flex-development/grease/commit/68ccc1fab3f2c5423b29fe452a7a26f6e44bf158))
* **grease:** add `GreaseScripts.postdepchecker` ([8b3b8f4](https://github.com/flex-development/grease/commit/8b3b8f49cc58fab46b6059a1b3c2c9928e7a1786))
* **grease:** release tagging ([91f560a](https://github.com/flex-development/grease/commit/91f560a5b00474f614831e451f069b04ebc495a1))
* **scripts:** `check:style` ([eff36a2](https://github.com/flex-development/grease/commit/eff36a28f58f0df47e7d743f673473870a252d02))
* **typescript:** `@zerollup/ts-transform-paths` usage ([3febb13](https://github.com/flex-development/grease/commit/3febb13dd383214d240f118839fc7d0052cd3098))

Expand All @@ -94,12 +94,12 @@ All notable changes to this project will be documented in this file. See [standa
* `yarn set version 3.0.1` ([d3e9f8a](https://github.com/flex-development/grease/commit/d3e9f8ae00bdddd11f64849cfe9a20ec7bb872c0))
* add `publish:node` script ([3bbf8be](https://github.com/flex-development/grease/commit/3bbf8be104c85f30ee0674af96b252761a170018))
* add `scope:cache` label ([3d88b50](https://github.com/flex-development/grease/commit/3d88b50c95996d3b8794219b4ef2025645066fc5))
* **node-release:** allow users to download package from github ([796873b](https://github.com/flex-development/grease/commit/796873b1343c11eaabd68a7a7eeb50759ff56314))
* **node-scripts:** add release workflow script ([d15c166](https://github.com/flex-development/grease/commit/d15c166d75c60208b690e4d829c4d6065d2c62d3))
* **node-scripts:** update release workflow ([eb097c0](https://github.com/flex-development/grease/commit/eb097c0979a136892b6d2ac20d82c4ae5895be10))
* **node-scripts:** update release workflow ([78a4b6a](https://github.com/flex-development/grease/commit/78a4b6ab20dfd8f1f37fd87e1287370e97cc23c7))
* **node:** add `prepublish` script ([92c75a1](https://github.com/flex-development/grease/commit/92c75a157935246168ac8314c722dd24bf60dcd5))
* **node:** update `package.json#publishConfig` ([800d232](https://github.com/flex-development/grease/commit/800d2329212633c3974a9ec1b5bf33fda929fc34))
* **grease-release:** allow users to download package from github ([796873b](https://github.com/flex-development/grease/commit/796873b1343c11eaabd68a7a7eeb50759ff56314))
* **grease-scripts:** add release workflow script ([d15c166](https://github.com/flex-development/grease/commit/d15c166d75c60208b690e4d829c4d6065d2c62d3))
* **grease-scripts:** update release workflow ([eb097c0](https://github.com/flex-development/grease/commit/eb097c0979a136892b6d2ac20d82c4ae5895be10))
* **grease-scripts:** update release workflow ([78a4b6a](https://github.com/flex-development/grease/commit/78a4b6ab20dfd8f1f37fd87e1287370e97cc23c7))
* **grease:** add `prepublish` script ([92c75a1](https://github.com/flex-development/grease/commit/92c75a157935246168ac8314c722dd24bf60dcd5))
* **grease:** update `package.json#publishConfig` ([800d232](https://github.com/flex-development/grease/commit/800d2329212633c3974a9ec1b5bf33fda929fc34))
* P010-1 initial commit ([2f29aa3](https://github.com/flex-development/grease/commit/2f29aa3698cf31043389f43502b7423c2dd106af))
* P010-3 #done #time 15m ([25ac6a6](https://github.com/flex-development/grease/commit/25ac6a6bb0d0c7569c33200a614a03c523ed9f8c))
* replace `scope:grease-cli` with `scope:cli` ([1d609e9](https://github.com/flex-development/grease/commit/1d609e9ac2a411106a1eb425c683b257de71fc3e))
Expand Down

0 comments on commit 889322b

Please sign in to comment.