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

refactor: support pnpm #315

Merged
merged 8 commits into from
Mar 24, 2023
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
5 changes: 3 additions & 2 deletions .gitattributes

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

8 changes: 5 additions & 3 deletions .github/workflows/aws-arch-pricing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@ jobs:
uses: actions/checkout@v3
with:
ref: mainline
- name: Install pnpm
run: npm install -g pnpm
- name: Install dependencies
run: yarn install --check-files --frozen-lockfile
run: pnpm i --frozen-lockfile
- name: Fetch Pricing Manifest
working-directory: packages/aws-arch
run: npx projen fetch-pricing-manifest
run: pnpm projen fetch-pricing-manifest
- name: Build
working-directory: packages/aws-arch
run: npx nx run build
run: pnpm build
- id: create_patch
name: Find mutations
run: |-
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Install pnpm
run: npm install -g pnpm
- name: Install dependencies
run: yarn install --check-files --frozen-lockfile
run: pnpm i --frozen-lockfile
- name: Synth Project
run: npx projen
run: pnpm projen
- name: Build
run: yarn build
run: pnpm build
- name: Check for mutations
run: git diff --ignore-space-at-eol --exit-code
16 changes: 9 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,16 @@ jobs:
run: |-
git config user.name "github-actions"
git config user.email "github-actions@github.com"
- name: Install pnpm
run: npm install -g pnpm
- name: Install dependencies
run: yarn install --check-files --frozen-lockfile
run: pnpm i --frozen-lockfile
- name: Synth Project
run: npx projen
run: pnpm projen
- name: Build
run: yarn build
run: pnpm build
- name: Release
run: npx nx run-many --target=release:mainline --all --parallel=4 --output-style stream --nx-bail
run: pnpm run-many --target=release:mainline --all --parallel=4 --output-style stream --nx-bail
- name: Check for mutations
run: git diff --ignore-space-at-eol --exit-code
- name: Check for new commits
Expand Down Expand Up @@ -92,7 +94,7 @@ jobs:
path: dist
- name: Release
working-directory: dist/packages
run: for d in *; do cd $d && ( [ -d "dist/js" ] && npx -p publib@latest publib-npm || echo "Ignore `basename $PWD` - no dist/js" ) && cd ..; done;
run: for d in *; do cd $d && ( [ -d "dist/js" ] && pnpx -p publib@latest publib-npm || echo "Ignore `basename $PWD` - no dist/js" ) && cd ..; done;
env:
NPM_DIST_TAG: latest
NPM_REGISTRY: registry.npmjs.org
Expand All @@ -119,7 +121,7 @@ jobs:
path: dist
- name: Release
working-directory: dist/packages
run: for d in *; do cd $d && ( [ -d "dist/java" ] && npx -p publib@latest publib-maven || echo "Ignore `basename $PWD` - no dist/java" ) && cd ..; done;
run: for d in *; do cd $d && ( [ -d "dist/java" ] && pnpx -p publib@latest publib-maven || echo "Ignore `basename $PWD` - no dist/java" ) && cd ..; done;
env:
MAVEN_ENDPOINT: https://aws.oss.sonatype.org
MAVEN_GPG_PRIVATE_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
Expand Down Expand Up @@ -148,7 +150,7 @@ jobs:
path: dist
- name: Release
working-directory: dist/packages
run: for d in *; do cd $d && ( [ -d "dist/python" ] && npx -p publib@latest publib-pypi || echo "Ignore `basename $PWD` - no dist/python" ) && cd ..; done;
run: for d in *; do cd $d && ( [ -d "dist/python" ] && pnpx -p publib@latest publib-pypi || echo "Ignore `basename $PWD` - no dist/python" ) && cd ..; done;
env:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/upgrade-mainline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ jobs:
uses: actions/checkout@v2
with:
ref: mainline
- name: Install pnpm
run: npm install -g pnpm
- name: Install dependencies
run: yarn install --check-files --frozen-lockfile
run: pnpm i --frozen-lockfile
- name: Upgrade dependencies
run: npx projen upgrade-deps
run: pnpm projen upgrade-deps
- name: Build
run: npx nx run-many --target=build --all --parallel=4 --output-style stream
run: pnpm build
- id: create_patch
name: Find mutations
run: |-
Expand Down
8 changes: 8 additions & 0 deletions .gitignore

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

14 changes: 2 additions & 12 deletions .projen/deps.json

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

1 change: 1 addition & 0 deletions .projen/files.json

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

46 changes: 28 additions & 18 deletions .projen/tasks.json

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

18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,34 @@ AWS Prototyping SDK (PDK) is a package which contains useful CDK and Projen cons

Ensure you have the following packages installed globally:

* [yarn](https://classic.yarnpkg.com/lang/en/docs/install/#mac-stable)
* [pnpm](https://pnpm.io/installation)
* [node > 14](https://nodejs.org/en/download/package-manager/) (or use [nvm](https://github.com/nvm-sh/nvm#installing-and-updating) to install)
* [Python >= 3.7](https://www.python.org/downloads/)
* [Java >= 8](https://aws.amazon.com/fr/corretto/) and [Maven >= 3.6](https://maven.apache.org/download.cgi)

```bash
# from root directory of this package
yarn
pnpm i
```

## Usage of projen/nx

This package is built using [projen](https://github.com/projen/projen) and [nx](https://nx.dev/getting-started/intro) as such all tasks should be invoked
via either:

- `npx nx run-many --target=<task> --all` - executes the `<task>` on every package, in dependency order.
- `npx nx run <package_name>:<task>` - executes the `<task>` on the specified `<package_name>`.
- `pnpx nx run-many --target=<task> --all` - executes the `<task>` on every package, in dependency order.
- `pnpx nx run <package_name>:<task>` - executes the `<task>` on the specified `<package_name>`.

To build the full project, run `npx nx run-many --target=build --all`
To build the full project, run `pnpx nx run-many --target=build --all`

Any change to `projects/*` or `.projenrc.ts` requires a synth to be executed. To do this, run: `npx projen` from the root directory.
Any change to `projects/*` or `.projenrc.ts` requires a synth to be executed. To do this, run: `pnpx projen` from the root directory.

## Nx workspace script alias
In addition to the above `npx nx <command>` format to execute commands, the workspace package contains useful alias for common tasks.
In addition to the above `pnpx nx <command>` format to execute commands, the workspace package contains useful alias for common tasks.

Executing `yarn <task>` for common tasks will execute `npx nx run-many --target=<task> --output-style=stream --nx-bail`, such as `yarn build` will execute `npx nx run-many --target=build --output-style=stream --nx-bail` across all packages.
Executing `pnpm <task>` for common tasks will execute `pnpx nx run-many --target=<task> --output-style=stream --nx-bail`, such as `pnpm build` will execute `pnpx nx run-many --target=build --output-style=stream --nx-bail` across all packages.

All nx run-many alias scripts access additional arguments, such as to only run on specific projects you can use `yarn build --projects=proj1,proj2`.
All nx run-many alias scripts access additional arguments, such as to only run on specific projects you can use `pnpm build --projects=proj1,proj2`.
> See [Nx Run-Many options](https://nx.dev/packages/nx/documents/run-many#options) for details.

## Documentation
Expand Down
Loading