Skip to content

Commit

Permalink
chore: migrate to npm
Browse files Browse the repository at this point in the history
  • Loading branch information
tido64 committed Mar 1, 2022
1 parent 4fe26b6 commit 93c1606
Show file tree
Hide file tree
Showing 17 changed files with 17,308 additions and 10,693 deletions.
2 changes: 2 additions & 0 deletions .changeset/two-days-flash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
1 change: 0 additions & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
- .github/**/*
- .gitignore
- .npmrc
- .yarnrc
- package.json
- scripts/**/*
'feature: cli':
Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,24 @@ jobs:
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Cache /.yarn-offline-mirror
- name: Cache /.npm
uses: actions/[email protected]
with:
path: .yarn-offline-mirror
key: ${{ hashFiles('yarn.lock') }}
path: .npm
key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }}
- name: Configure npm cache
run: npm config --location project set cache=.npm
- name: Install package dependencies
run: yarn ci
run: npm ci
- name: Build and test packages
run: yarn build:ci
run: npm run build:ci
- name: Bundle packages
run: yarn bundle:ci
run: npm run bundle:ci
- name: Create release PR or publish to npm
uses: changesets/action@v1
with:
publish: yarn publish:changesets
version: yarn version:changesets
publish: npm run publish:changesets
version: npm run version:changesets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
68 changes: 36 additions & 32 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,39 +14,37 @@ jobs:
with:
fetch-depth: 0
- name: Ensure rnx-kit packages come from our repository
run: |
if grep rnx-kit yarn.lock; then
exit 1
fi
run: node scripts/validate-package-lock.mjs
- name: Deduplicate packages
run: |
npx yarn-deduplicate --list --fail
- name: Cache /.yarn-offline-mirror
run: npm find-dupes --no-audit --no-fund
- name: Cache /.npm
uses: actions/[email protected]
with:
path: .yarn-offline-mirror
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }}-5
path: .npm
key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }}
- name: Configure npm cache
run: npm config --location project set cache=.npm
- name: Install package dependencies
run: yarn ci
run: npm ci
env:
CI_SKIP_GO: 1
- name: Check for change files
run: yarn change:check --since origin/${{ github.base_ref }}
run: npm run change:check --since origin/${{ github.base_ref }}
- name: Format
run: yarn format
run: npm run format
- name: Report formatting changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git diff | yarn suggestion-bot -m 'Code formatting differences were found – did you forget to run `yarn format`?'
git diff | npm run suggestion-bot -m 'Code formatting differences were found – did you forget to run `npm run format`?'
git checkout .
- name: Align dependencies
run: yarn rnx-dep-check --write
run: npm run rnx-dep-check --write
- name: Report dep-check changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git diff | yarn suggestion-bot -m 'Dependencies are potentially misaligned – run `yarn rnx-dep-check` locally for more details'
git diff | npm run suggestion-bot -m 'Dependencies are potentially misaligned – run `npm run rnx-dep-check` locally for more details'
git checkout .
build:
name: "Build"
Expand All @@ -67,27 +65,29 @@ jobs:
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Cache /.yarn-offline-mirror
- name: Cache /.npm
uses: actions/[email protected]
with:
path: .yarn-offline-mirror
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }}-5
path: .npm
key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }}
- name: Configure npm cache
run: npm config --location project set cache=.npm
- name: Install package dependencies
run: yarn ci
run: npm ci
- name: Build and test packages
run: yarn build:ci
run: npm run build:ci
- name: Ensure READMEs are up-to-date
if: ${{ matrix.node-version == 14 && matrix.os == 'ubuntu-latest' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
yarn update-readme
git diff | yarn suggestion-bot -m 'Changes were found in READMEs – did you forget to run `yarn update-readme`?'
npm run update-readme
git diff | npm run suggestion-bot -m 'Changes were found in READMEs – did you forget to run `npm run update-readme`?'
- name: Bundle packages
run: yarn bundle:ci
run: npm run bundle:ci
- name: Bundle test app with esbuild
run: |
yarn bundle+esbuild
npm run bundle+esbuild
shell: bash
working-directory: packages/test-app
build-android:
Expand All @@ -107,13 +107,15 @@ jobs:
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Cache /.yarn-offline-mirror
- name: Cache /.npm
uses: actions/[email protected]
with:
path: .yarn-offline-mirror
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }}-5
path: .npm
key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }}
- name: Configure npm cache
run: npm config --location project set cache=.npm
- name: Install npm dependencies
run: yarn ci
run: npm ci
env:
CI_SKIP_GO: 1
- name: Build Android app
Expand All @@ -132,13 +134,15 @@ jobs:
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Cache /.yarn-offline-mirror
- name: Cache /.npm
uses: actions/[email protected]
with:
path: .yarn-offline-mirror
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }}-5
path: .npm
key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }}
- name: Configure npm cache
run: npm config --location project set cache=.npm
- name: Install npm dependencies
run: yarn ci
run: npm ci
env:
CI_SKIP_GO: 1
- name: Install Pods
Expand Down
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
*.log
*.tgz
*.xcworkspace/
.DS_Store
.gradle/
.idea/
Pods/
coverage/
.yarnrc
/packages/*/bin/
/packages/*/dist/
/packages/*/lib/
/scripts/bin/
/scripts/lib/
Pods/
coverage/
local.properties
node_modules/
!**/__fixtures__/**/node_modules/
.DS_Store
yarn.lock
5 changes: 3 additions & 2 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
shared-workspace-shrinkwrap = true
link-workspace-packages = true
ignore-scripts=true
lockfile-version=3
prefer-dedupe=true
1 change: 0 additions & 1 deletion .yarnrc

This file was deleted.

36 changes: 18 additions & 18 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ additional questions or comments.

- Node LTS (see [releases](https://nodejs.org/en/about/releases/) for specific
versions)
- [Yarn Classic](https://classic.yarnpkg.com/)
- [npm](https://docs.npmjs.com/cli/v8/commands/npm) 8.3+

### Optional

Expand All @@ -56,10 +56,10 @@ additional questions or comments.

## Build

We use Yarn to install npm dependencies. From the repo root, run:
We use npm to install dependencies. From the repo root, run:

```sh
yarn
npm install
```

This will also take care of building any tools that you might need. Once it's
Expand All @@ -69,20 +69,20 @@ interested in.
If you want to build all packages, you should run:

```
yarn build
npm run build
```

Otherwise, you can specify which package to build, e.g. `@rnx-kit/cli`:

```sh
yarn build-scope @rnx-kit/cli
npm run build-scope @rnx-kit/cli
```

Alternatively, you can navigate to the package folder and run:

```sh
cd packages/cli
yarn build --dependencies
npm run build --dependencies
```

Both the repository level `build-scope` and the package local
Expand All @@ -92,14 +92,14 @@ package.
Below is a table of commonly used commands and what they do depending on your
current working directory.

| Command | Repository Level | Package Level |
| :-------------------------- | :---------------------------------------------------- | :-------------------------------------------------- |
| `yarn build` | Builds **all** packages in the repository | Builds the **current** package only |
| `yarn build --dependencies` | -- | Builds the **current** package and its dependencies |
| `yarn build-scope` | Builds the **specified** package and its dependencies | -- |
| `yarn format` | Formats **all** packages in the repository | Formats the **current** package only |
| `yarn lint` | Lints **all** packages in the repository | Lints the **current** package only |
| `yarn test` | Tests **all** packages in the repository | Tests the **current** package only |
| Command | Repository Level | Package Level |
| :----------------------------- | :---------------------------------------------------- | :-------------------------------------------------- |
| `npm run build` | Builds **all** packages in the repository | Builds the **current** package only |
| `npm run build --dependencies` | -- | Builds the **current** package and its dependencies |
| `npm run build-scope` | Builds the **specified** package and its dependencies | -- |
| `npm run format` | Formats **all** packages in the repository | Formats the **current** package only |
| `npm run lint` | Lints **all** packages in the repository | Lints the **current** package only |
| `npm test` | Tests **all** packages in the repository | Tests the **current** package only |

## Adding a new package

Expand All @@ -109,7 +109,7 @@ have introduced a small script to easily allow for new packages generation.
Simply run

```sh
yarn new-package newPackageName
npm run new-package newPackageName
```

To generate a sample project for you to use; this is based on
Expand All @@ -121,7 +121,7 @@ Each package in this monorepo contains a change log. The log is built from
change descriptions submitted with each PR.

```
$ yarn change
$ npm run change
Checking for changes against "origin/main"
fetching latest from remotes "origin/main"
Expand Down Expand Up @@ -155,5 +155,5 @@ package and publish it to `npm`.
Most files are formatted with [Prettier](https://prettier.io/). We also use
[ESLint](https://eslint.org/) to lint all JavaScript code.

You can trigger formatting by running `yarn format`, and linting with
`yarn lint`.
You can trigger formatting by running `npm run format`, and linting with
`npm run lint`.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ Most packages are designed to be used on their own, having a documented API, a
suite of tests, and a log of changes. Packages are updated and released
individually, as features are added and fixes are made.

<!-- The following table can be updated by running `yarn update-readme` -->
<!-- The following table can be updated by running `npm run update-readme` -->
<!-- @rnx-kit start -->

| Name | Description |
Expand Down
Loading

0 comments on commit 93c1606

Please sign in to comment.