Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: setup changeset #307

Merged
merged 2 commits into from
Apr 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
39 changes: 39 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Release

on:
push:
branches:
- "main"

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@master
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- name: Setup Node.js 16.x
uses: actions/setup-node@master
with:
node-version: 16.x

- name: Get yarn cache
uses: c-hive/gha-yarn-cache@v2

- name: Install Dependencies using Yarn
run: yarn --ignore-engines

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@master
with:
publish: npm run release
commit: "release: update package versions"
title: "Upcoming Release Changes"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"build": "babel src --ignore src/__tests__ --out-dir dist/ ; cp src/index.js dist/index.js.flow ; cp src/index.d.ts dist/",
"watch": "babel resources/watch.js | node",
"testonly": "jest src",
"preversion": ". ./resources/checkgit.sh && npm test",
"prepublish": ". ./resources/prepublish.sh"
"prerelease": ". ./resources/prepublish.sh",
"release": "changeset publish"
},
"files": [
"index.js",
Expand All @@ -43,10 +43,14 @@
"@babel/node": "7.7.0",
"@babel/preset-env": "7.7.1",
"@babel/preset-flow": "7.0.0",
"@changesets/cli": "^2.22.0",
"babel-eslint": "10.0.3",
"eslint": "6.6.0",
"flow-bin": "0.112.0",
"jest": "24.9.0",
"sane": "4.1.0"
},
"publishConfig": {
"access": "public"
}
}
27 changes: 0 additions & 27 deletions resources/checkgit.sh

This file was deleted.

21 changes: 2 additions & 19 deletions resources/prepublish.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
# Because of a long-running npm issue (https://github.com/npm/npm/issues/3059)
# prepublish runs after `npm install` and `npm pack`.
# In order to only run prepublish before `npm publish`, we have to check argv.
if node -e "process.exit(($npm_config_argv).original.length > 0 && ($npm_config_argv).original[0].indexOf('pu') === 0)"; then
exit 0;
fi

# Publishing to NPM is currently supported by Travis CI, which ensures that all
# tests pass first and the deployed module contains the correct file structure.
# In order to prevent inadvertently circumventing this, we ensure that a CI
# environment exists before continuing.
if [ "$CI" != true ]; then
echo "\n\n\n \033[101;30m Only Travis CI can publish to NPM. \033[0m" 1>&2;
echo " Ensure git is left is a good state by backing out any commits and deleting any tags." 1>&2;
echo " Then read CONTRIBUTING.md to learn how to publish to NPM.\n\n\n" 1>&2;
exit 1;
fi;

# Build before publishing
npm run build;

Expand All @@ -29,4 +11,5 @@ cp dist/* .
node -e "var package = require('./package.json'); \
delete package.scripts; \
delete package.devDependencies; \
require('fs').writeFileSync('package.json', JSON.stringify(package, null, 2));"
delete package.publishConfig; \
require('fs').writeFileSync('dist/package.json', JSON.stringify(package, null, 2));"
Loading