Skip to content

Commit aac7fe6

Browse files
authored
chore: setup changeset (#307)
* chore: setup changeset * update token name
1 parent 69f80fd commit aac7fe6

File tree

7 files changed

+1120
-52
lines changed

7 files changed

+1120
-52
lines changed

.changeset/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.changeset/config.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@2.0.0/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "public",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": []
11+
}

.github/workflows/release.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
8+
jobs:
9+
release:
10+
name: Release
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout Repo
14+
uses: actions/checkout@master
15+
with:
16+
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
17+
fetch-depth: 0
18+
19+
- name: Setup Node.js 16.x
20+
uses: actions/setup-node@master
21+
with:
22+
node-version: 16.x
23+
24+
- name: Get yarn cache
25+
uses: c-hive/gha-yarn-cache@v2
26+
27+
- name: Install Dependencies using Yarn
28+
run: yarn --ignore-engines
29+
30+
- name: Create Release Pull Request or Publish to npm
31+
id: changesets
32+
uses: changesets/action@master
33+
with:
34+
publish: npm run release
35+
commit: "release: update package versions"
36+
title: "Upcoming Release Changes"
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

package.json

+6-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
"build": "babel src --ignore src/__tests__ --out-dir dist/ ; cp src/index.js dist/index.js.flow ; cp src/index.d.ts dist/",
2727
"watch": "babel resources/watch.js | node",
2828
"testonly": "jest src",
29-
"preversion": ". ./resources/checkgit.sh && npm test",
30-
"prepublish": ". ./resources/prepublish.sh"
29+
"prerelease": ". ./resources/prepublish.sh",
30+
"release": "changeset publish"
3131
},
3232
"files": [
3333
"index.js",
@@ -43,10 +43,14 @@
4343
"@babel/node": "7.7.0",
4444
"@babel/preset-env": "7.7.1",
4545
"@babel/preset-flow": "7.0.0",
46+
"@changesets/cli": "^2.22.0",
4647
"babel-eslint": "10.0.3",
4748
"eslint": "6.6.0",
4849
"flow-bin": "0.112.0",
4950
"jest": "24.9.0",
5051
"sane": "4.1.0"
52+
},
53+
"publishConfig": {
54+
"access": "public"
5155
}
5256
}

resources/checkgit.sh

-27
This file was deleted.

resources/prepublish.sh

+2-19
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,3 @@
1-
# Because of a long-running npm issue (https://github.com/npm/npm/issues/3059)
2-
# prepublish runs after `npm install` and `npm pack`.
3-
# In order to only run prepublish before `npm publish`, we have to check argv.
4-
if node -e "process.exit(($npm_config_argv).original.length > 0 && ($npm_config_argv).original[0].indexOf('pu') === 0)"; then
5-
exit 0;
6-
fi
7-
8-
# Publishing to NPM is currently supported by Travis CI, which ensures that all
9-
# tests pass first and the deployed module contains the correct file structure.
10-
# In order to prevent inadvertently circumventing this, we ensure that a CI
11-
# environment exists before continuing.
12-
if [ "$CI" != true ]; then
13-
echo "\n\n\n \033[101;30m Only Travis CI can publish to NPM. \033[0m" 1>&2;
14-
echo " Ensure git is left is a good state by backing out any commits and deleting any tags." 1>&2;
15-
echo " Then read CONTRIBUTING.md to learn how to publish to NPM.\n\n\n" 1>&2;
16-
exit 1;
17-
fi;
18-
191
# Build before publishing
202
npm run build;
213

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

0 commit comments

Comments
 (0)