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

Switch package manager from yarn to npm #187

Merged
merged 3 commits into from
Dec 5, 2020
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
33 changes: 13 additions & 20 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,34 +16,27 @@ commands:
postinstall:
type: steps
default: []
yarn:
type: string
default: '^1.22.5'
steps:
- run:
name: Upgrade yarn for current user
command: cd ~ && yarn policies set-version << parameters.yarn >>

- restore_cache:
keys:
- v2.2-dependencies-{{ .Environment.CI_CACHE_KEY }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "yarn.lock" }}-{{ .Branch }}
- v2.2-dependencies-{{ .Environment.CI_CACHE_KEY }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "yarn.lock" }}-
- v2.2-dependencies-{{ .Environment.CI_CACHE_KEY }}-{{ .Environment.CIRCLE_JOB }}-
- v2.3-dependencies-{{ .Environment.CI_CACHE_KEY }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "package-lock.json" }}-{{ .Branch }}
- v2.3-dependencies-{{ .Environment.CI_CACHE_KEY }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "package-lock.json" }}-
- v2.3-dependencies-{{ .Environment.CI_CACHE_KEY }}-{{ .Environment.CIRCLE_JOB }}-

- run: yarn install
- run: npm ci
- steps: << parameters.postinstall >>

- save_cache:
key: v2.2-dependencies-{{ .Environment.CI_CACHE_KEY }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "yarn.lock" }}-{{ .Branch }}
key: v2.3-dependencies-{{ .Environment.CI_CACHE_KEY }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "package-lock.json" }}-{{ .Branch }}
paths:
- ~/.cache/yarn
- ~/.npm

audit:
steps:
- checkout
- install:
postinstall:
- run: yarn audit
- run: npm audit

test:
steps:
Expand All @@ -54,27 +47,27 @@ commands:

- run:
name: Prettier formatting
command: yarn check:format
command: npm run check:format

- run:
name: TypeScript type checking
command: yarn check:ts
command: npm run check:ts

- run:
name: ESLint
command: yarn lint:js
command: npm run lint:js

- run:
name: stylelint
command: yarn lint:css
command: npm run lint:css

- run:
name: Jest
command: yarn test:unit:coverage --ci --maxWorkers=2 --reporters=default --reporters=jest-junit
command: npm run test:unit:coverage -- --ci --maxWorkers=2 --reporters=default --reporters=jest-junit
environment:
JEST_JUNIT_OUTPUT_DIR: tmp/test-results

- run: yarn codecov
- run: npx codecov

- store_test_results:
path: tmp/test-results
Expand Down
27 changes: 20 additions & 7 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,51 @@ Thank you for taking the time to read how to contribute to Marp for VS Code! Thi

We are following [**the contributing guideline of Marp team projects**](https://github.com/marp-team/.github/blob/master/CONTRIBUTING.md). _You have to read this before starting work._

## Setup repository

The most important difference of Marp for VS Code from common Marp team packages is **using npm package manager instead of yarn**.

```bash
git clone https://github.com/marp-team/marp-vscode.git
cd ./marp-vscode

npm install
```

We had met the trouble of VSIX packaging with yarn many times. [An opened issue in vscode-vsce](https://github.com/microsoft/vscode-vsce/issues/432) is not so received attentions from developers in spite of that many extension authors are using yarn.

Thus, using `npm` is the safest way to develop stable VS Code extension continuously for now.

## Development

Typically using VS Code's debugger is good. See launch configurations on [`.vscode/launch.json`](../.vscode/launch.json)

### Launch configurations

- **Build and run**: Compile TypeScript and run compiled extension.
- **Run**: Only run compiled extension. It's useful running together with `yarn watch`. Recommend to execute `Restart Debugging` manually when updated source code.
- **Run**: Only run compiled extension. It's useful running together with `npm run watch`. Recommend to execute `Restart Debugging` manually when updated source code.
- **Run with extensions**: Run compiled extension with enabled other installed extensions. It's useful to validate the race condition.

### Unit testing

Marp team adopts [Jest](https://jestjs.io/) as test runner. This repository can run unit test by `yarn test:unit`.
Marp team adopts [Jest](https://jestjs.io/) as test runner. This repository can run unit test by `npm run test:unit`.

```bash
yarn test:unit
npm run test:unit
```

> _NOTE:_ It seems to be difficult to run VSCode's E2E test on Jest. We're welcome to contribute for supporting E2E tests.

### Package VSIX

```bash
yarn package
npm run package
```

> _NOTE:_ Packaging tasks will run `vsce` via `npx` to avoid some troubles while bundling. (e.g. [#35](https://github.com/marp-team/marp-vscode/pull/35), [#57](https://github.com/marp-team/marp-vscode/issues/57))

## Release

### Publish to Visual Studio Marketplace (_For maintainer_)

A way to release is different from other projects of Marp Team targeted to npm.

Just run `yarn vsce:publish [major|minor|patch]` at the latest `master` branch. It can [bump version](https://github.com/marp-team/.github/blob/master/CONTRIBUTING.md#bump-version) and release to Marketplace at once. Don't forget `git push && git push --tags`!
Just run `npm run vsce:publish [major|minor|patch]` at the latest `master` branch. It can [bump version](https://github.com/marp-team/.github/blob/master/CONTRIBUTING.md#bump-version) and release to Marketplace at once. Don't forget `git push && git push --tags`!
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- No longer required restarting VS Code after changing `markdown.marp.chromePath` configuration
- Upgrade development Node LTS to 14 ([#186](https://github.com/marp-team/marp-vscode/pull/186))
- Upgrade dependent packages to the latest version ([#186](https://github.com/marp-team/marp-vscode/pull/186))
- Switch package manager from yarn to npm ([#187](https://github.com/marp-team/marp-vscode/pull/187))

## v0.16.0 - 2020-10-19

Expand Down
Loading