Skip to content

Commit

Permalink
Merge pull request #607 from marp-team/migrate-to-npm
Browse files Browse the repository at this point in the history
Switch package manager from yarn to npm
  • Loading branch information
yhatt authored Oct 5, 2024
2 parents 62e9b60 + 2f97e3f commit 3b32d04
Show file tree
Hide file tree
Showing 16 changed files with 18,956 additions and 9,078 deletions.
45 changes: 15 additions & 30 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,58 +28,44 @@ executors:
commands:
install:
parameters:
force:
type: boolean
default: false
postinstall:
type: steps
default: []
yarn:
type: string
default: '^1.22.22'
steps:
- run:
name: Upgrade yarn for current user
command: cd ~ && yarn policies set-version << parameters.yarn >>

- restore_cache:
keys:
- v2.4-dependencies-{{ .Environment.CIRCLE_JOB }}-{{ checksum "yarn.lock" }}-{{ .Branch }}
- v2.4-dependencies-{{ .Environment.CIRCLE_JOB }}-{{ checksum "yarn.lock" }}-
- v2.4-dependencies-{{ .Environment.CIRCLE_JOB }}-
- v3-dependencies-{{ .Environment.CIRCLE_JOB }}-{{ checksum "package-lock.json" }}-{{ .Branch }}
- v3-dependencies-{{ .Environment.CIRCLE_JOB }}-{{ checksum "package-lock.json" }}-
- v3-dependencies-{{ .Environment.CIRCLE_JOB }}-

- run: |
yarn install --frozen-lockfile <<# parameters.force >>--ignore-engines<</ parameters.force >>
yarn patch-package
npm ci
npx patch-package
- steps: << parameters.postinstall >>

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

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

prepare:
parameters:
browser:
type: boolean
default: false
force:
type: boolean
default: false
steps:
- run: node --version

- checkout
- install:
force: << parameters.force >>
- install

- when:
condition: << parameters.browser >>
Expand All @@ -90,25 +76,25 @@ commands:
steps:
- 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

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

Expand All @@ -127,7 +113,7 @@ commands:
- checkout
- install

- run: yarn build
- run: npm run build

- persist_to_workspace:
root: ~/marp-cli
Expand Down Expand Up @@ -199,7 +185,6 @@ jobs:
version: '18.20'
steps:
- prepare:
force: true
browser: true
- lint
- test
Expand Down
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
!LICENSE
!marp-cli.js
!package.json
!yarn.lock
!package-lock.json
6 changes: 3 additions & 3 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ We are following [**the contributing guideline of Marp team projects**][team-con

```bash
# Build (Bundle and minify)
yarn build
npm run build

# Watch (Bundle only)
yarn watch
npm run watch
```

### Use built version
Expand All @@ -36,7 +36,7 @@ Standalone binaries created by [pkg](https://github.com/zeit/pkg) will output to

```bash
# Build & create standalone binaries
yarn build:standalone
npm run build:standalone
```

```bash
Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/github-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ on:
# For debugging standalone packages
workflow_dispatch:

env:
YARN_VERSION: '^1.22.22'

jobs:
github-release:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -42,13 +39,12 @@ jobs:
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Install yarn
run: cd $HOME && yarn policies set-version $YARN_VERSION
- run: yarn install --frozen-lockfile
cache: 'npm'
- run: npm ci
- name: Build and create standalone binaries
run: yarn build:standalone
run: npm run build:standalone
- name: Create package
run: yarn standalone:pack
run: npm run standalone:pack
env:
MATRIX_OS: ${{ matrix.os }}
- uses: actions/upload-artifact@v4
Expand Down
20 changes: 7 additions & 13 deletions .github/workflows/test-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ on:
# group: ${{ github.workflow }}-${{ (github.ref_name == 'main' && github.run_id) || format('{0}-{1}', github.actor, github.head_ref || github.ref_name) }}
# cancel-in-progress: true

env:
YARN_VERSION: '^1.22.22'

jobs:
win-test:
runs-on: windows-latest
Expand All @@ -22,9 +19,6 @@ jobs:
- '^18.20.4'
- '20.17.0'
- '^22.8.0'
include:
- node-version: '^18.20.4'
force: true

steps:
# - name: Output concurrency group
Expand All @@ -36,22 +30,22 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: yarn
cache: npm

- name: Install dependencies with yarn
- name: Install dependencies
run: |
yarn install --frozen-lockfile ${{ matrix.force && '--ignore-engines' || '' }}
yarn patch-package
npm ci
npx patch-package
# Retry tests up to 3 times due to flaky tests on Windows CI
# https://stackoverflow.com/a/59365905
- name: Jest
env:
CI: true
run: >-
yarn test:coverage --ci -i --reporters=default --reporters=jest-junit --forceExit ||
yarn test:coverage --ci -i --reporters=default --reporters=jest-junit --forceExit --no-cache ||
yarn test:coverage --ci -i --reporters=default --reporters=jest-junit --forceExit --no-cache
npm run test:coverage -- --ci -i --reporters=default --reporters=jest-junit --forceExit ||
npm run test:coverage -- --ci -i --reporters=default --reporters=jest-junit --forceExit --no-cache ||
npm run test:coverage -- --ci -i --reporters=default --reporters=jest-junit --forceExit --no-cache
- uses: actions/upload-artifact@v4
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ tmp/
types/
node_modules/**
!/test/_files/node_modules/ignore.*
yarn.lock

########## gitignore.io ##########
# Created by https://www.gitignore.io/api/node,windows,macos,linux,sublimetext,emacs,vim,visualstudiocode
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
- Upgrade development Node.js LTS to v20.17.0 ([#591](https://github.com/marp-team/marp-cli/pull/591))
- Upgrade dependent packages to the latest versions ([#591](https://github.com/marp-team/marp-cli/pull/591), [#598](https://github.com/marp-team/marp-cli/pull/598))
- Migrate ESLint config to flat config ([#606](https://github.com/marp-team/marp-cli/pull/606))
- Switch package manager from yarn to npm ([#607](https://github.com/marp-team/marp-cli/pull/607))

### Fixed

Expand Down
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@ RUN addgroup -S marp && adduser -S -g marp marp \
&& mkdir -p /home/marp/app /home/marp/.cli \
&& chown -R marp:marp /home/marp

# Install node dependencies, and create v8 cache by running Marp CLI once
USER marp
ENV CHROME_PATH /usr/bin/chromium-browser

WORKDIR /home/marp/.cli
COPY --chown=marp:marp . .
RUN yarn install --production --frozen-lockfile && yarn cache clean && node marp-cli.js --version
RUN npm ci && npm cache clean --force && node marp-cli.js --version

# Setup workspace for user
USER root
Expand Down
2 changes: 1 addition & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ export default tseslint.config(
reportUnusedDisableDirectives: 'error',
},
languageOptions: {
ecmaVersion: 'latest',
parserOptions: {
ecmaFeatures: { jsx: true },
ecmaVersion: 'latest',
},
globals: {
...globals.node,
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const esModules = [
'p-locate',
'path-exists',
'path-type',
'pkg-up',
'package-up',
'slash',
'strip-ansi',
'unicorn-magic',
Expand Down
Loading

0 comments on commit 3b32d04

Please sign in to comment.