Skip to content

Commit

Permalink
Merge branch 'epic/update-dependencies' into alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
dkoo committed Jun 25, 2024
2 parents 399ef4b + dcd4d33 commit ea75c88
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 56 deletions.
13 changes: 1 addition & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,6 @@ Will validate TypeScript code in the project. This requires a `tsconfig.json` fi
}
```

### proxy

Allows you to proxy NPM CLI commands through this repository's dependencies, so if a repository consumes the `newspack-scripts` NPM package, it can access any executables installed as a dependency in [package.json](https://github.com/Automattic/newspack-scripts/blob/trunk/package.json). e.g. `newspack-scripts proxy semantic-release --dry-run` will run `semantic-release --dry-run` but using the executable from `newspack-scripts` instead of whatever repository you're running the command from. This allows for more flexible use of NPM commands where the prefab configs and scripts this repo provides are too opinionated or aren't sufficient.

Other examples:

- `newspack-scripts proxy eslint 'src/**/*.{js,jsx,ts,tsx}'` will lint all JS/JSX/TS/TSX files inside the `./src` directory.
- `newspack-scripts proxy stylelint 'src/**/*.scss'` will lint all SCSS files inside the `./src` directory.

---

## Semantic Release
Expand Down Expand Up @@ -163,10 +154,8 @@ module.exports = {

### stylelint

Use this package's stylelint executable and config file when running it, e.g.:

```shell
newspack-scripts proxy stylelint '**/*.scss' --customSyntax postcss-scss --config=./node_modules/newspack-scripts/config/stylelint.config.js
newspack-scripts wp-scripts lint-style '**/*.scss' --customSyntax postcss-scss
```

_Note: Due to issue with dependency resolving, you might end up a different version of `prettier` in project's `node_modules` and `node_modules/newspack-scripts/node_modules`. See https://github.com/Automattic/newspack-scripts/issues/1 for more information._
Expand Down
24 changes: 5 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"postcss": "^8.4.38",
"postcss-focus-within": "^5.0.4",
"postcss-scss": "^4.0.9",
"prettier": "^3.3.2",
"prettier": "npm:wp-prettier@^3.0.3",
"semantic-release": "^19.0.5",
"semantic-release-version-bump": "^1.4.1",
"stylelint": "^14.2.0",
Expand Down Expand Up @@ -84,4 +84,4 @@
"extends @wordpress/browserslist-config"
],
"prettier": "@wordpress/prettier-config"
}
}
51 changes: 28 additions & 23 deletions scripts/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,22 @@ if ( shouldPublishOnNPM ) {
utils.log( `Will publish on npm` );
}

const getConfig = ( { gitBranchName } ) => {
const branchType = gitBranchName.split( '/' )[ 0 ];
const getConfig = ({ gitBranchName }) => {
const branchType = gitBranchName.split("/")[0];
const githubConfig = {
assets: [
{
path: `./release/${process.env.CIRCLE_PROJECT_REPONAME}.zip`,
label: `${process.env.CIRCLE_PROJECT_REPONAME}.zip`,
},
],
};

// Only post GH PR comments for alpha, hotfix/*, and release branches.
if ( ! ["alpha", "hotfix", "release"].includes(branchType) ) {
githubConfig.successComment = false;
githubConfig.failComment = false;
}

const config = {
dryRun: otherArgs.dryRun,
Expand All @@ -28,52 +42,43 @@ const getConfig = ( { gitBranchName } ) => {

branches: [
// `release` branch is published on the main distribution channel (a new version on GH).
'release',
"release",
// `alpha` branch – for regular pre-releases.
{
name: 'alpha',
name: "alpha",
prerelease: true,
},
// `hotfix/*` branches – for releases outside of the release schedule.
{
name: 'hotfix/*',
name: "hotfix/*",
// With `prerelease: true`, the `name` would be used for the pre-release tag. A name with a `/`
// is not valid, though. See https://semver.org/#spec-item-9.
prerelease: '${name.replace(/\\//g, "-")}',
},
// `epic/*` branches – for beta testing/QA pre-release builds.
{
name: 'epic/*',
name: "epic/*",
// With `prerelease: true`, the `name` would be used for the pre-release tag. A name with a `/`
// is not valid, though. See https://semver.org/#spec-item-9.
prerelease: '${name.replace(/\\//g, "-")}',
},
],
prepare: [ '@semantic-release/changelog', '@semantic-release/npm' ],
prepare: ["@semantic-release/changelog", "@semantic-release/npm"],
plugins: [
'@semantic-release/commit-analyzer',
'@semantic-release/release-notes-generator',
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
// Whether to publish on npm.
'@semantic-release/npm',
"@semantic-release/npm",
{
npmPublish: shouldPublishOnNPM,
},
],
'semantic-release-version-bump',
"semantic-release-version-bump",
// Add the built ZIP archive to GH release.
[
'@semantic-release/github',
{
assets: [
{
path: `./release/${ process.env.CIRCLE_PROJECT_REPONAME }.zip`,
label: `${ process.env.CIRCLE_PROJECT_REPONAME }.zip`,
},
],
// Only post GH PR comments for alpha, hotfix/*, and release branches.
successComment: [ 'alpha', 'hotfix', 'release' ].includes( branchType ),
},
"@semantic-release/github",
githubConfig,
],
],
};
Expand Down Expand Up @@ -109,7 +114,7 @@ const getConfig = ( { gitBranchName } ) => {
path: '@semantic-release/git',
assets,
message:
'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}',
'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}',
} );
} else {
utils.log(
Expand Down

0 comments on commit ea75c88

Please sign in to comment.