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

(fix) Switch to use NPM instead of yarn #2

Closed
wants to merge 7 commits into from
Closed
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
27 changes: 0 additions & 27 deletions .github/actions/setup/action.yml

This file was deleted.

30 changes: 21 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@ jobs:
uses: actions/checkout@v3

- name: Setup
uses: ./.github/actions/setup
uses: actions/setup-node@v4
with:
node-version: 18
- run: npm ci

- name: Lint files
run: yarn lint
run: npm run lint

- name: Typecheck files
run: yarn typecheck
run: npm run typecheck

test:
runs-on: ubuntu-latest
Expand All @@ -30,10 +33,13 @@ jobs:
uses: actions/checkout@v3

- name: Setup
uses: ./.github/actions/setup
uses: actions/setup-node@v4
with:
node-version: 18
- run: npm ci

- name: Run unit tests
run: yarn test --maxWorkers=2 --coverage
run: npm run test --maxWorkers=2 --coverage

build-library:
runs-on: ubuntu-latest
Expand All @@ -42,10 +48,13 @@ jobs:
uses: actions/checkout@v3

- name: Setup
uses: ./.github/actions/setup
uses: actions/setup-node@v4
with:
node-version: 18
- run: npm ci

- name: Build package
run: yarn prepare
run: npm run build

build-web:
runs-on: ubuntu-latest
Expand All @@ -54,8 +63,11 @@ jobs:
uses: actions/checkout@v3

- name: Setup
uses: ./.github/actions/setup
uses: actions/setup-node@v4
with:
node-version: 18
- run: npm ci

- name: Build example for Web
run: |
yarn example expo export:web
npm run example expo export:web
10 changes: 0 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,13 @@ example/vendor/
#
node_modules/
npm-debug.log
yarn-debug.log
yarn-error.log

# BUCK
buck-out/
\.buckd/
android/app/libs
android/keystores/debug.keystore

# Yarn
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# Expo
.expo/

Expand Down
541 changes: 0 additions & 541 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

This file was deleted.

28 changes: 0 additions & 28 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

This file was deleted.

874 changes: 0 additions & 874 deletions .yarn/releases/yarn-3.6.1.cjs

This file was deleted.

10 changes: 0 additions & 10 deletions .yarnrc.yml

This file was deleted.

38 changes: 18 additions & 20 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,17 @@ We want this community to be friendly and respectful to each other. Please follo

## Development workflow

This project is a monorepo managed using [Yarn workspaces](https://yarnpkg.com/features/workspaces). It contains the following packages:
It contains the following packages:

- The library package in the root directory.
- An example app in the `example/` directory.

To get started with the project, run `yarn` in the root directory to install the required dependencies for each package:
To get started with the project, run `npm install` in the root directory to install the required dependencies for each package:

```sh
yarn
npm install
```

> Since the project relies on Yarn workspaces, you cannot use [`npm`](https://github.com/npm/cli) for development.

The [example app](/example/) demonstrates usage of the library. You need to run it to test any changes you make.

It is configured to use the local version of the library, so any changes you make to the library's source code will be reflected in the example app. Changes to the library's JavaScript code will be reflected in the example app without a rebuild, but native code changes will require a rebuild of the example app.
Expand All @@ -28,44 +26,44 @@ You can use various commands from the root directory to work with the project.
To start the packager:

```sh
yarn example start
npm run example start
```

To run the example app on Android:

```sh
yarn example android
npm run example android
```

To run the example app on iOS:

```sh
yarn example ios
npm run example ios
```

To run the example app on Web:

```sh
yarn example web
npm run example web
```

Make sure your code passes TypeScript and ESLint. Run the following to verify:

```sh
yarn typecheck
yarn lint
npm run typecheck
npm run lint
```

To fix formatting errors, run the following:

```sh
yarn lint --fix
npm run lint --fix
```

Remember to add tests for your change if possible. Run the unit tests by:

```sh
yarn test
npm run test
```

### Linting and tests
Expand All @@ -80,13 +78,13 @@ Our pre-commit hooks verify that the linter and tests pass when committing.

The `package.json` file contains various scripts for common tasks:

- `yarn`: setup project by installing dependencies.
- `yarn typecheck`: type-check files with TypeScript.
- `yarn lint`: lint files with ESLint.
- `yarn test`: run unit tests with Jest.
- `yarn example start`: start the Metro server for the example app.
- `yarn example android`: run the example app on Android.
- `yarn example ios`: run the example app on iOS.
- `npm install`: setup project by installing dependencies.
- `npm run typecheck`: type-check files with TypeScript.
- `npm run lint`: lint files with ESLint.
- `npm run test`: run unit tests with Jest.
- `npm run example start`: start the Metro server for the example app.
- `npm run example android`: run the example app on Android.
- `npm run example ios`: run the example app on iOS.

### Sending a pull request

Expand Down
8 changes: 5 additions & 3 deletions example/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@sellpy/react-native-scroll-anchor-example",
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"main": "./App.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
Expand All @@ -18,9 +18,11 @@
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@expo/webpack-config": "^18.0.1",
"@expo/webpack-config": "^19.0.1",
"@types/react": "^18.2.75",
"babel-loader": "^8.1.0",
"babel-plugin-module-resolver": "^5.0.0"
"babel-plugin-module-resolver": "^5.0.0",
"typescript": "^5.4.5"
},
"private": true
}
9 changes: 2 additions & 7 deletions lefthook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@ pre-commit:
parallel: true
commands:
lint:
glob: "*.{js,ts,jsx,tsx}"
glob: '*.{js,ts,jsx,tsx}'
run: npx eslint {staged_files}
types:
glob: "*.{js,ts, jsx, tsx}"
glob: '*.{js,ts, jsx, tsx}'
run: npx tsc --noEmit
commit-msg:
parallel: true
commands:
commitlint:
run: npx commitlint --edit
Loading
Loading