Skip to content

Commit

Permalink
chore: release 0.17.1
Browse files Browse the repository at this point in the history
* fix: use Pinst to disable Husky in published NPM package

* fix: ensure we always publish to the correct repository

* chore: bump version, update CHANGELOG.md

* fix: ignore peer dependencies when running Syncpack

* refactor: move format check step to only run on CI

* refactor: always format w/ `pretty-quick` for consistency

* refactor: run Syncpack directly instead of using `yarn dlx`

* chore: de-duplicate yarn.lock

* chore: update yarn.lock with weird changes from tests

* refactor: move CRA test into dedicated/isolated directory

* refactor: remove cra-test from root worktree

* ci: temporarily disable CRA test until we can improve it
  • Loading branch information
jesse-savary authored Jul 19, 2022
1 parent 49f5714 commit 74dfa56
Show file tree
Hide file tree
Showing 11 changed files with 13,045 additions and 509 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ jobs:
- name: Install Dependencies
run: yarn install --immutable

- name: Check Formatting
run: yarn format --check

- name: Build mst-gql
run: yarn build

Expand All @@ -34,5 +37,5 @@ jobs:
- name: Test Example 6 (Hasura)
run: yarn test:example-6

- name: Test CRA (Create React App)
run: yarn test:cra
# - name: Test CRA (Create React App)
# run: yarn test:cra
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ tmp_schema.json
.parcel-cache

# create-react-app test folder
tests/cra-test
tests/cra-test/cra-tmp

# IntelliJ IDEA project files
.idea
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
yarn pretty-quick --staged
yarn dlx syncpack format
yarn syncpack format
2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ defaultSemverRangePrefix: ""

nodeLinker: node-modules

npmRegistryServer: "https://registry.yarnpkg.com"
npmPublishRegistry: "https://registry.yarnpkg.com"

yarnPath: .yarn/releases/yarn-3.2.1.cjs

Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 0.17.1

- Use [Pinst](https://www.npmjs.com/package/pinst) to fix `postinstall` scripts running when installing mst-gql

## 0.17.0

- Passing the `--header` flag multiple times is now supported
Expand Down
27 changes: 17 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,28 @@
"name": "mst-gql",
"description": "Bindings for mobx-state-tree and GraphQL",
"license": "MIT",
"version": "0.17.0",
"version": "0.17.1",
"author": "Michel Weststrate",
"homepage": "https://github.com/mobxjs/mst-gql#readme",
"bugs": "https://github.com/mobxjs/mst-gql/issues",
"scripts": {
"build": "microbundle --no-compress --external mobx,mobx-react,mobx-state-tree,graphql-tag,graphql,react,react-dom,graphql-request",
"fix-mismatches": "yarn dlx syncpack fix-mismatches --prod --dev",
"fix-mismatches": "syncpack fix-mismatches --prod --dev",
"postinstall": "husky install",
"format": "prettier --write '**/*'",
"list-mismatches": "yarn dlx syncpack list-mismatches",
"test": "yarn test:mst-gql && yarn test:example-2 && yarn test:example-6 && yarn test:cra && yarn format --check",
"test:cra": "cd ./tests && ./test-cra.sh && rm -rf cra-test",
"format": "pretty-quick",
"list-mismatches": "syncpack list-mismatches",
"test": "yarn test:mst-gql && yarn test:example-2 && yarn test:example-6 && yarn format",
"test:cra": "./tests/cra-test/test-cra.sh",
"test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand",
"test:example-2": "cd examples/2-scaffolding && yarn start",
"test:example-6": "cd examples/6-scaffolding-ts-hasura && yarn start",
"test:mst-gql": "jest test",
"watch": "jest test --watch"
"watch": "jest test --watch",
"prepack": "pinst --disable",
"postpack": "pinst --enable"
},
"publishConfig": {
"registry": "https://registry.yarnpkg.com"
},
"workspaces": [
"examples/1-getting-started",
Expand All @@ -27,8 +32,7 @@
"examples/4-apollo-tutorial/client",
"examples/4-apollo-tutorial/server",
"examples/5-nextjs",
"examples/6-scaffolding-ts-hasura",
"tests/cra-test/cra-app"
"examples/6-scaffolding-ts-hasura"
],
"dependencies": {
"ansi-colors": "^4.1.3",
Expand Down Expand Up @@ -69,11 +73,13 @@
"mobx-react": "^7.5.0",
"mobx-state-tree": "^5.1.5",
"node-gyp": "^9.0.0",
"pinst": "3.0.0",
"prettier": "^2.6.2",
"pretty-quick": "^3.1.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"subscriptions-transport-ws": "^0.11.0",
"syncpack": "8.2.4",
"typescript": "^4.7.3"
},
"peerDependencies": {
Expand Down Expand Up @@ -118,7 +124,8 @@
"devDependencies",
"peerDependencies",
"resolutions"
]
],
"peer": false
},
"types": "./dist/mst-gql.d.ts",
"umd:main": "dist/mst-gql.umd.js"
Expand Down
1 change: 1 addition & 0 deletions tests/cra-test/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
16 changes: 16 additions & 0 deletions tests/cra-test/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "cra-test",
"packageManager": "[email protected]",
"private": true,
"workspaces": [
"cra-tmp/cra-app"
],
"dependencies": {
"graphql": "16.5.0",
"graphql-request": "4.3.0",
"graphql-tag": "2.12.6",
"mobx": "6.6.1",
"mobx-react": "7.5.2",
"mobx-state-tree": "5.1.5"
}
}
23 changes: 13 additions & 10 deletions tests/test-cra.sh → tests/cra-test/test-cra.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,30 @@
# Note: the generated cra-test directory should not be checked into git.
#

rm -rf cra-test
# Navigate into the current directory so that nothing explodes
cd "${0%/*}"

mkdir cra-test
cd cra-test
# Cleanup and create a fresh directory to work with
rm -rf cra-tmp
mkdir cra-tmp
cd cra-tmp

yarn create-react-app cra-app --template typescript
yarn create react-app cra-app --template typescript
cd cra-app
cp ../../../examples/6-scaffolding-ts-hasura/schema.graphql .
cp ../../../../examples/6-scaffolding-ts-hasura/schema.graphql .
yarn add mobx mobx-state-tree mobx-react graphql graphql-tag graphql-request

# Add current mst-gql version as relative dependency
yarn add mst-gql@portal:../../../
yarn add mst-gql@portal:../../../../


# Add some code to import the generated files
perl -0777 -pi.original -e 's|(import.*?./App.css.*?;)|\1\nimport {RootStore} from "./model/RootStore";\nconst rootStore = RootStore.create({})|sm' src/App.tsx

# now generate models
npx mst-gql --format ts --outDir src/model schema.graphql
yarn mst-gql --format ts --outDir src/model schema.graphql
# Compile it
npx tsc --extendedDiagnostics
yarn tsc --extendedDiagnostics

# run the project and check if runs all right. Not sure how portable or exact this is, but seems to work
rm -f out
Expand All @@ -42,7 +45,7 @@ do
if [[ ! -z ${failed} ]]; then
echo
echo "App failed to compile"
pid=`ps -ef | grep tests/cra-test/cra-app | grep -v grep | awk '{print $2}' -`
pid=`ps -ef | grep tests/cra-test/cra-tmp/cra-app | grep -v grep | awk '{print $2}' -`
kill -9 $pid > /dev/null 2>&1
exit
fi
Expand All @@ -51,7 +54,7 @@ do
if [ "$no_issues" -eq "1" ]; then
echo
echo "App ran successfully!"
pid=`ps -ef | grep tests/cra-test/cra-app | grep -v grep | awk '{print $2}' -`
pid=`ps -ef | grep tests/cra-test/cra-tmp/cra-app | grep -v grep | awk '{print $2}' -`
kill -9 $pid > /dev/null 2>&1
exit
fi
Expand Down
Loading

0 comments on commit 74dfa56

Please sign in to comment.