Skip to content

Commit

Permalink
Merge pull request #767 from vrk-kpa/fix/yarn-to-npm
Browse files Browse the repository at this point in the history
[Fix] Switch from yarn to npm
  • Loading branch information
Riippi authored Sep 15, 2023
2 parents 5cb59e2 + 79a5bac commit c92f04a
Show file tree
Hide file tree
Showing 11 changed files with 22,575 additions and 10,844 deletions.
28 changes: 14 additions & 14 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,39 +14,39 @@ commands:
command: node --version
- restore_cache: # special step to restore the dependency cache
# Read about caching dependencies: https://circleci.com/docs/2.0/caching/
name: Restore Yarn Package Cache
name: Restore NPM Package Cache
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- npm-packages-{{ checksum "package-lock.json" }}
- run:
name: Install Dependencies
command: yarn install --frozen-lockfile
command: npm ci
- save_cache: # special step to save the dependency cache
name: Save Yarn Package Cache
key: yarn-packages-{{ checksum "yarn.lock" }}
name: Save NPM Package Cache
key: npm-packages-{{ checksum "package-lock.json" }}
paths:
- ~/.cache/yarn
- ~/.cache/npm
build:
steps:
- run: yarn styleguide:build
- run: npm run styleguide:build
test:
steps:
- run:
name: Install JUnit coverage reporter
command: yarn add --dev jest-junit
command: npm install --dev jest-junit
- run:
name: Install TSLint JUnit Formatter
command: yarn add --dev tslint-junit-formatter
command: npm install --dev tslint-junit-formatter
- run: # run tests
name: Run tests with JUnit as reporter
command: yarn test -- --ci --runInBand --reporters=default --reporters=jest-junit
command: npm run test -- --ci --runInBand --reporters=default --reporters=jest-junit
environment:
JEST_JUNIT_OUTPUT: 'reports/junit/js-test-results.xml'
- run:
name: 'JavaScript and TypeScript Linter'
command: yarn eslint --config .eslintrc src/**/*.tsx -- --format junit -o reports/junit/js-lint-results.xml
command: npx eslint --config .eslintrc src/**/*.tsx --format junit -o reports/junit/js-lint-results.xml
- run:
name: 'Prettier check'
command: yarn prettier:check
command: npm run prettier:check
- store_artifacts: # special step to save test results as as artifact
# Upload test summary for display in Artifacts: https://circleci.com/docs/2.0/artifacts/
path: reports/junit
Expand Down Expand Up @@ -78,14 +78,14 @@ jobs:
- checkout_and_cache
- build
- pre_deploy
- run: yarn deploy
- run: npm run deploy
deploy_dev:
executor: build-executor
steps:
- checkout_and_cache
- build
- pre_deploy
- run: yarn deploy-dev
- run: npm run deploy-dev

workflows:
version: 2
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.DS_Store
*.log
0-stage
yarn.lock

# build output
dist
Expand All @@ -14,7 +15,6 @@ styleguide

# dependencies
node_modules
package-lock.json

# editors
.idea
Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
. "$(dirname "$0")/_/husky.sh"
. "$(dirname "$0")/common.sh"

yarn pre-commit
npm run pre-commit
2 changes: 1 addition & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
. "$(dirname "$0")/_/husky.sh"
. "$(dirname "$0")/common.sh"

yarn pre-push
npm run pre-push
6 changes: 3 additions & 3 deletions .styleguidist/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Works with [React >= 16.8.0](https://github.com/facebook/react) (React 18 suppor
To install the component library

```bash
yarn add suomifi-ui-components
npm install suomifi-ui-components
```

Include **required** fonts as best suited for your project. You can, for example, use the following import with your global css.
Expand All @@ -42,15 +42,15 @@ You should also install the following peer dependencies.
- The aim is to keep dependencies up to date and use the latest available versions. We encourage you to use the latest available versions of peer dependencies.

```bash
yarn add styled-components
npm install styled-components
```

- If using TypeScript, version 3.8 or above is required.

- In case TypeScript is used and skipLibCheck compiler option is set to false, also add typings for [styled-components](https://www.npmjs.com/package/@types/styled-components/) as well as [react](https://www.npmjs.com/package/@types/react) and [react-dom](https://www.npmjs.com/package/@types/react-dom) as required by the React version used.

```bash
yarn add @types/styled-components @types/react @types/react-dom
npm install @types/styled-components @types/react @types/react-dom
```

## 🔨 Usage
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ We will review your pull request and either merge it, request changes to it, or

1. Fork the repository and create your branch from proper branch.

2. Run `yarn` in the repository root.
2. Run `npm install` in the repository root.

3. If you’ve fixed a bug or added code that should be tested, add tests!

4. Ensure the test suite passes (`yarn test`)
4. Ensure the test suite passes (`npm run test`)

5. Run `yarn test -u` to update jest snapshots. Commit any changes.
5. Run `npm run test -u` to update jest snapshots. Commit any changes.

6. Make sure your code lints (`yarn test:lint`). Tip: Lint runs automatically when you build.
6. Make sure your code lints (`npm run test:lint`). Tip: Lint runs automatically when you build.

### Development workflow

Expand Down
22 changes: 11 additions & 11 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@

For testing: [React-testing-library](https://github.com/kentcdodds/react-testing-library) run by [Jest](https://github.com/facebook/jest) with [ts-jest](https://github.com/kulshekhar/ts-jest) (code coverage with built-in [Istanbul](https://github.com/istanbuljs)). Code style with [Prettier](https://github.com/prettier/prettier).

After cloning suomifi-ui-components, run `yarn` to fetch its dependencies. Then, you can run several commands:
After cloning suomifi-ui-components, run `npm install` to fetch its dependencies. Then, you can run several commands:

1. `yarn start` runs Styleguidist for displaying components stories.
1. `npm run start` runs Styleguidist for displaying components stories.

2. `yarn test` runs written tests.
2. `npm run test` runs written tests.

3. `yarn lint` checks TypeScript code for readability, maintainability, and functionality errors.
3. `npm run lint` checks TypeScript code for readability, maintainability, and functionality errors.

4. `yarn prettier:check` checks the code style.
4. `npm run prettier:check` checks the code style.

5. `yarn prettier` write the code style fixes to all src-files.
5. `npm run prettier` write the code style fixes to all src-files.

6. `yarn validate` runs the complete test suite.
6. `npm run validate` runs the complete test suite.

7. `yarn build` compiles TypeScript code to the dist directory.
7. `npm run build` compiles TypeScript code to the dist directory.

8. `yarn styleguide:build` compiles static version of Styleguide to the styleguide directory.
8. `npm run styleguide:build` compiles static version of Styleguide to the styleguide directory.

9. `yarn bundle-analyzer` shows analyzation of bundle size.
9. `npm run bundle-analyzer` shows analyzation of bundle size.

❗️After you pull changes from the repo, remember to run `yarn` to make sure that you have all the needed dependencies installed on your setup.
❗️After you pull changes from the repo, remember to run `npm install` to make sure that you have all the needed dependencies installed on your setup.

## Source

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Works with [React >= 16.8.0](https://github.com/facebook/react) (React 18 suppor
To install the component library

```bash
yarn add suomifi-ui-components
npm install suomifi-ui-components
```

Include **required** fonts as best suited for your project. You can, for example, use the following import with your global css.
Expand All @@ -48,15 +48,15 @@ You should also install the following peer dependencies.
- The aim is to keep dependencies up to date and use the latest available versions. We encourage you to use the latest available versions of peer dependencies.

```bash
yarn add styled-components
npm install styled-components
```

- If using TypeScript, version 3.8 or above is required.

- In case TypeScript is used and skipLibCheck compiler option is set to false, also add typings for [styled-components](https://www.npmjs.com/package/@types/styled-components/) as well as [react](https://www.npmjs.com/package/@types/react) and [react-dom](https://www.npmjs.com/package/@types/react-dom) as required by the React version used.

```bash
yarn add @types/styled-components @types/react @types/react-dom
npm install @types/styled-components @types/react @types/react-dom
```

## 🔨 Usage
Expand Down
Loading

0 comments on commit c92f04a

Please sign in to comment.