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

build(pnpm): yarn to pnpm #97

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Enhancement suggestions are tracked as [GitHub issues](https://github.com/Bedroc

### Your First Code Contribution

- Make sure you have yarn and node (>= 12) installed
- Make sure you have pnpm and node (>= 12) installed
- Your Pull Request must include both unit tests and functional (cypress) tests when possible.

### Improving The Documentation
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,22 @@ jobs:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Check out repo
uses: actions/checkout@v2
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 6
# Node is required for npm
- name: Set up Node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: "14"
# Install and build Docusaurus website
- name: Build Docusaurus website
run: |
yarn install --no-progress --frozen-lockfile
yarn lint docsite
yarn build docsite
yarn e2e docsite-e2e
pnpm install --no-progress --frozen-lockfile
pnpm lint docsite
pnpm build docsite
pnpm e2e docsite-e2e
- name: Deploy to GitHub Pages
if: success()
uses: crazy-max/ghaction-github-pages@v2
Expand Down
31 changes: 19 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@ jobs:
uses: nrwl/nx-set-shas@v2
with:
main-branch-name: 'master'
- uses: actions/setup-node@v2
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 6
- uses: actions/setup-node@v3
with:
node-version: '14'
cache: yarn
- run: yarn install --frozen-lockfile --non-interactive --no-progress --prefer-offline
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: npx nx affected --target=lint --parallel --max-parallel=3
- run: npx nx affected --target=build --parallel --max-parallel=3
- run: npx nx affected --target=test --parallel --max-parallel=2 --code-coverage
Expand All @@ -37,28 +41,31 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0
- run: |
git fetch --no-tags --prune origin master
- run: git fetch --no-tags --prune origin master
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v2
uses: nrwl/nx-set-shas@v4
with:
main-branch-name: 'master'
- uses: actions/setup-node@v2
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
node-version: '14'
cache: yarn
- run: yarn install --frozen-lockfile --non-interactive --no-progress --prefer-offline
version: 8
- uses: actions/setup-node@v4
with:
node-version: '16'
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: npx nx affected --base=origin/master --target=lint --parallel --max-parallel=3
- run: npx nx affected --base=origin/master --target=build --parallel --max-parallel=3
- run: npx nx affected --base=origin/master --target=test --parallel --max-parallel=2 --code-coverage
- run: npx nx affected --base=origin/master --target=e2e --parallel --max-parallel=2

- name: Clean before merge
run: yarn cleanBeforeMerge
run: pnpm cleanBeforeMerge

- name: Codecov upload
uses: codecov/codecov-action@v2
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,24 @@ jobs:
with:
fetch-depth: 0
ref: ${{ github.event.inputs.branch }}
- uses: actions/setup-node@v2
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
cache: yarn
version: 6
- uses: actions/setup-node@v3
with:
cache: pnpm
node-version: "14"
registry-url: https://registry.npmjs.org
- run: yarn install --frozen-lockfile --non-interactive --no-progress --prefer-offline
- run: pnpm install --frozen-lockfile
- name: Setup git user to "🤖 Release Bot"
run: git config user.email "-" && git config user.name "🤖 Release Bot"
- name: Version
id: version
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Use npx instead of yarn because yarn auto-magically sets NPM_* environment variables
# Use npx instead of pnpm because pnpm auto-magically sets NPM_* environment variables
# like NPM_CONFIG_REGISTRY so npm publish ends up ignoring the .npmrc file
# which is set up by `setup-node` action.
# run: npx nx affected --base=master --releaseAs=minor --target=version
Expand Down
30 changes: 19 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,26 @@ jobs:
uses: nrwl/nx-set-shas@v2
with:
main-branch-name: 'master'
- uses: actions/setup-node@v2
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 6
- uses: actions/setup-node@v3
with:
node-version: "14"
cache: yarn
cache: pnpm
- name: Install
shell: bash
run: yarn install --frozen-lockfile --non-interactive --no-progress --prefer-offline
run: pnpm install --frozen-lockfile
- name: Commit lint
shell: bash
run: yarn commitlint --from=last-release
run: pnpm commitlint --from=last-release
- name: Lint
run: yarn nx affected:lint --base=last-release
run: pnpm nx affected:lint --base=last-release
- name: Build
run: yarn nx affected:build --base=last-release
run: pnpm nx affected:build --base=last-release
- name: Unit tests
run: yarn nx affected:test --base=last-release --code-coverage
run: pnpm nx affected:test --base=last-release --code-coverage
- name: Codecov upload
uses: codecov/codecov-action@v2
with:
Expand All @@ -48,19 +52,23 @@ jobs:
with:
ref: 'master'
fetch-depth: 0
- uses: actions/setup-node@v2
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 6
- uses: actions/setup-node@v3
with:
cache: yarn
cache: pnpm
node-version: "14"
registry-url: https://registry.npmjs.org
- run: yarn install --frozen-lockfile --non-interactive --no-progress --prefer-offline
- run: pnpm install --frozen-lockfile
- name: Setup git user to "🤖 Release Bot"
run: git config user.email "-" && git config user.name "🤖 Release Bot"
- name: Version
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Use npx instead of yarn because yarn auto-magically sets NPM_* environment variables
# Use npx instead of pnpm because pnpm auto-magically sets NPM_* environment variables
# like NPM_CONFIG_REGISTRY so npm publish ends up ignoring the .npmrc file
# which is set up by `setup-node` action.
# run: npx nx affected --base=master --releaseAs=minor --target=version
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/out-tsc

# dependencies
/node_modules
node_modules

# IDEs and editors
/.idea
Expand All @@ -31,7 +31,7 @@
coverage-final.json
/libpeerconnection.log
npm-debug.log
yarn-error.log
pnpm-error.log
testem.log
/typings

Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
shamefully-hoist=true
2 changes: 2 additions & 0 deletions .nxignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# dependencies
node_modules
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,21 @@ The `demo` project is there to smoothe the dev experience
The `docsite` project is the one used on https://bedrockstreaming.github.io/forms/

In order to start on the project, you can start with the demo project:
`yarn start demo`
`pnpm start demo`

### Generate an application

Run `yarn nx g @nrwl/react:app my-app` to generate an application.
Run `pnpm nx g @nrwl/react:app my-app` to generate an application.

> You can use any of the plugins above to generate applications as well.

When using Nx, you can create multiple applications and libraries in the same workspace.

### Generate a library

Run `yarn nx g @nrwl/react:lib my-lib` to generate a react library.
Run `yarn nx g @nrwl/react:web my-lib` to generate a web library.
Run `yarn nx g @nrwl/react:node my-lib` to generate a node library.
Run `pnpm nx g @nrwl/react:lib my-lib` to generate a react library.
Run `pnpm nx g @nrwl/react:web my-lib` to generate a web library.
Run `pnpm nx g @nrwl/react:node my-lib` to generate a node library.

> You can also use any of the plugins above to generate libraries as well.

Expand All @@ -73,36 +73,36 @@ Libraries are shareable across libraries and applications. They can be imported
If you want the library to be publishable use:

```bash
yarn nx g @nrwl/react:lib my-lib --publishable --importPath="@bedrockstreaming/form-foo"
pnpm nx g @nrwl/react:lib my-lib --publishable --importPath="@bedrockstreaming/form-foo"
```

### Development server

Run `yarn nx serve my-app` for a dev server. Navigate to [http://localhost:4200/](http://localhost:4200/). The app will automatically reload if you change any of the source files.
Run `pnpm nx serve my-app` for a dev server. Navigate to [http://localhost:4200/](http://localhost:4200/). The app will automatically reload if you change any of the source files.

### Code scaffolding

Run `yarn nx g @nrwl/react:component my-component --project=my-app` to generate a new component.
Run `pnpm nx g @nrwl/react:component my-component --project=my-app` to generate a new component.

### Build

Run `yarn nx build my-app` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
Run `pnpm nx build my-app` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.

### Running unit tests

Run `yarn nx test my-app` to execute the unit tests via [Jest](https://jestjs.io).
Run `pnpm nx test my-app` to execute the unit tests via [Jest](https://jestjs.io).

Run `yarn nx affected:test` to execute the unit tests affected by a change.
Run `pnpm nx affected:test` to execute the unit tests affected by a change.

### Running end-to-end tests

Run `yarn nx e2e my-app` to execute the end-to-end tests via [Cypress](https://www.cypress.io).
Run `pnpm nx e2e my-app` to execute the end-to-end tests via [Cypress](https://www.cypress.io).

Run `yarn nx affected:e2e` to execute the end-to-end tests affected by a change.
Run `pnpm nx affected:e2e` to execute the end-to-end tests affected by a change.

### Understand your workspace

Run `yarn nx dep-graph` to see a diagram of the dependencies of your projects.
Run `pnpm nx dep-graph` to see a diagram of the dependencies of your projects.

### Further help

Expand Down
3 changes: 2 additions & 1 deletion apps/demo-e2e/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"lint": {
"executor": "@nrwl/linter:eslint",
"options": {
"lintFilePatterns": ["apps/demo-e2e/**/*.{js,ts}"]
"lintFilePatterns": ["apps/demo-e2e/**/*.{js,ts}"],
"exclude": ["**/node_modules/**"]
}
}
},
Expand Down
3 changes: 2 additions & 1 deletion apps/demo/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@
"lint": {
"executor": "@nrwl/linter:eslint",
"options": {
"lintFilePatterns": ["apps/demo/**/*.{ts,tsx,js,jsx}"]
"lintFilePatterns": ["apps/demo/**/*.{ts,tsx,js,jsx}"],
"exclude": ["**/node_modules/**"]
}
},
"test": {
Expand Down
3 changes: 2 additions & 1 deletion apps/docsite-e2e/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"lint": {
"executor": "@nrwl/linter:eslint",
"options": {
"lintFilePatterns": ["apps/docsite-e2e/**/*.{js,ts}"]
"lintFilePatterns": ["apps/docsite-e2e/**/*.{js,ts}"],
"exclude": ["**/node_modules/**"]
}
}
},
Expand Down
6 changes: 3 additions & 3 deletions apps/docsite/docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ There are two applications in this NX workspace `demo` and `docsite`. We are usi
Start the server

```bash
yarn start demo
pnpm start demo
```

Then start editing the libraries and demo app.
Expand All @@ -27,15 +27,15 @@ Then start editing the libraries and demo app.

### Generate an application

Run `yarn nx g @nrwl/react:app my-app` to generate an application.
Run `pnpm nx g @nrwl/react:app my-app` to generate an application.

> You can use any of the plugins above to generate applications as well.

When using Nx, you can create multiple applications and libraries in the same workspace.

### Generate a library

Run `yarn nx g @nrwl/react:lib my-lib` to generate a react library.
Run `pnpm nx g @nrwl/react:lib my-lib` to generate a react library.
Run `yarn nx g @nrwl/react:web my-lib` to generate a web library.
Run `yarn nx g @nrwl/react:node my-lib` to generate a node library.

Expand Down
3 changes: 2 additions & 1 deletion apps/docsite/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"lint": {
"executor": "@nrwl/linter:eslint",
"options": {
"lintFilePatterns": ["apps/docsite/**/*.{ts,tsx,js,jsx}"]
"lintFilePatterns": ["apps/docsite/**/*.{ts,tsx,js,jsx}"],
"exclude": ["**/node_modules/**"]
}
}
},
Expand Down
3 changes: 2 additions & 1 deletion libs/examples/birthdate/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"lint": {
"executor": "@nrwl/linter:eslint",
"options": {
"lintFilePatterns": ["libs/examples/birthdate/**/*.{ts,tsx,js,jsx}"]
"lintFilePatterns": ["libs/examples/birthdate/**/*.{ts,tsx,js,jsx}"],
"exclude": ["**/node_modules/**"]
}
},
"test": {
Expand Down
3 changes: 2 additions & 1 deletion libs/examples/styled-inputs/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"lint": {
"executor": "@nrwl/linter:eslint",
"options": {
"lintFilePatterns": ["libs/examples/styled-inputs/**/*.{ts,tsx,js,jsx}"]
"lintFilePatterns": ["libs/examples/styled-inputs/**/*.{ts,tsx,js,jsx}"],
"exclude": ["**/node_modules/**"]
}
},
"test": {
Expand Down
2 changes: 1 addition & 1 deletion libs/form-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@bedrockstreaming/form-builder",
"version": "0.8.4",
"dependencies": {
"react-hook-form": "7.27.0"
"react-hook-form": "7.48.2"
},
"peerDependencies": {
"react": "17.0.2"
Expand Down
3 changes: 2 additions & 1 deletion libs/form-builder/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"lint": {
"executor": "@nrwl/linter:eslint",
"options": {
"lintFilePatterns": ["libs/form-builder/**/*.{ts,tsx,js,jsx}"]
"lintFilePatterns": ["libs/form-builder/**/*.{ts,tsx,js,jsx}"],
"exclude": ["**/node_modules/**"]
}
},
"test": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface FormFieldProps {
dictionary: Dictionary;
validation?: Validations;
errors?: ErrorOption;
setFieldValue?: SetFieldValue<string | number>;
setFieldValue?: SetFieldValue<FieldValues>;
triggerValidationField?: (value: Path<FieldValues>) => void;
propRef?: Ref;
disabled?: boolean;
Expand Down
Loading
Loading