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

Pnpm #1269

Merged
merged 2 commits into from
Dec 18, 2021
Merged

Pnpm #1269

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
37 changes: 31 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 6.24.0
- name: Install Node.js 16.x
uses: actions/setup-node@v2
with:
node-version: '16'
cache: 'yarn'
cache: 'pnpm'

- name: Install dependencies
run: yarn --frozen-lockfile
run: pnpm install --frozen-lockfile

- name: Run lint
run: yarn lint
run: pnpm lint

test:
needs: lint
Expand All @@ -39,20 +43,41 @@ jobs:

- uses: actions/checkout@v2

- name: Install pnpm
uses: pnpm/action-setup@v2
if: matrix.node-version != '10'
with:
version: 6.24.0

- name: Install Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
if: matrix.node-version != '10'
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- name: Install old pnpm
uses: pnpm/action-setup@v2
if: matrix.node-version == '10'
with:
version: 5.18.4

# No cache support on GH actions for old pnpm
- name: Install Node.js without cache ${{ matrix.node-version }}
uses: actions/setup-node@v2
if: matrix.node-version == '10'
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'

- name: Install dependencies
run: yarn --frozen-lockfile
run: pnpm install --frozen-lockfile

- name: Run tests with coverage
run: yarn test:coverage
run: pnpm test:coverage

- name: Publish code coverage report
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '16'
uses: codecov/codecov-action@v2
with:
name: codecov

20 changes: 10 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ you add yourself to the list of contributors, found in [CONTRIBUTORS.md].
## How can I contribute to cssnano's code?

Since version 4, we develop in a monorepo. This is because a lot of transforms overlap with each other; it's
easier to test them together. Other than this, you'll need Node.js, yarn &
easier to test them together. Other than this, you'll need Node.js, pnpm &
git installed. Then, you can run these commands to get the repository set up:

```
git clone git@github.com:cssnano/cssnano.git
cd cssnano
yarn install
pnpm install
```

You can run the tests with:

```
yarn test
pnpm test
```

We recommend that you look in the issue tracker to find anything tagged
Expand All @@ -38,9 +38,9 @@ To help us generate the changelog, follow the [conventional commits](https://www
### Documentation

The documentation website is also included with the repository, under `/site`.
It runs [docusaurus](https://docusaurus.io) and requires a separate `yarn install`
It runs [docusaurus](https://docusaurus.io) and requires a separate `pnpm install`
to pull down the dependencies. You can then browse the documentation locally
by running `yarn start`.
by running `pnpm start`.

Note that some of the documentation is automatically generated and should not
be edited by hand.
Expand All @@ -53,7 +53,7 @@ with the description of the change and the affected packages.
To create a changeset run

```
yarn changeset
pnpm changeset
```

It's best to select the affected packages by hand rather than rely on the tools automatically
Expand All @@ -62,19 +62,19 @@ select the plugin and `cssnano-preset-default` by hand (as well as any other dep
To tag a release and generate the changelog, run:

```
yarn changeset version
pnpm changeset version
```

To publish release to npm, run:

```
yarn all-publish
pnpm all-publish
```

If you don't use the `package.json` script, do not forget to rebuild the packages first!

1. `yarn prepare`
2. `yarn changeset publish`
1. `pnpm prepare`
2. `pnpm changeset publish`

## Are there other ways of contributing?

Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"private": true,
"scripts": {
"lint": "eslint . --cache --ignore-path .gitignore --ext .js,.mjs",
"fixlint": "yarn lint -- --fix",
"prepare": "yarn workspaces run prepare",
"fixlint": "pnpm lint -- --fix",
"prepare": "pnpm run -r prepare",
"build:integration": "node ./util/buildFrameworks.mjs",
"pretest": "yarn lint",
"pretest": "pnpm lint",
"test:only": "uvu -r @babel/register packages \"__tests__.*\\.js$\"",
"test:coverage": "c8 yarn test:only",
"test": "yarn test:coverage",
"all-publish": "yarn prepare && yarn changeset publish"
"test:coverage": "c8 pnpm test:only",
"test": "pnpm test:coverage",
"all-publish": "pnpm prepare && pnpm changeset publish"
},
"workspaces": [
"./packages/*"
Expand Down
2 changes: 1 addition & 1 deletion packages/css-size/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"scripts": {
"prebuild": "rimraf dist",
"build": "babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\"",
"prepare": "yarn build"
"prepare": "pnpm build"
},
"files": [
"LICENSE-MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/cssnano-preset-advanced/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"prebuild": "rimraf dist",
"build": "babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\"",
"prepare": "yarn build"
"prepare": "pnpm build"
},
"files": [
"LICENSE-MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/cssnano-preset-default/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"prebuild": "rimraf dist",
"build": "babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\"",
"prepare": "yarn build"
"prepare": "pnpm build"
},
"files": [
"LICENSE-MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/cssnano-preset-lite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"prebuild": "rimraf dist",
"build": "babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\"",
"prepare": "yarn build"
"prepare": "pnpm build"
},
"files": [
"LICENSE-MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/cssnano-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"scripts": {
"prebuild": "rimraf dist",
"build": "babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\"",
"prepare": "yarn build"
"prepare": "pnpm build"
},
"homepage": "https://github.com/cssnano/cssnano",
"bugs": {
Expand Down
3 changes: 1 addition & 2 deletions packages/cssnano/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"bundle-size": "webpack --json --config src/__tests__/_webpack.config.js | webpack-bundle-size-analyzer",
"prebuild": "rimraf dist",
"build": "babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\"",
"prepare": "yarn build"
"prepare": "pnpm build"
},
"funding": {
"type": "opencollective",
Expand All @@ -25,7 +25,6 @@
"license": "MIT",
"dependencies": {
"cssnano-preset-default": "^5.1.9",
"is-resolvable": "^1.1.0",
"lilconfig": "^2.0.3",
"yaml": "^1.10.2"
},
Expand Down
14 changes: 13 additions & 1 deletion packages/cssnano/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,22 @@ import path from 'path';
import postcss from 'postcss';
import yaml from 'yaml';
import { lilconfigSync } from 'lilconfig';
import isResolvable from 'is-resolvable';

const cssnano = 'cssnano';

/*
* @param {string} moduleId
* @returns {boolean}
*/
function isResolvable(moduleId) {
try {
require.resolve(moduleId);
return true;
} catch (e) {
return false;
}
}

/*
* preset can be one of four possibilities:
* preset = 'default'
Expand Down
2 changes: 1 addition & 1 deletion packages/postcss-colormin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"scripts": {
"prebuild": "rimraf dist",
"build": "babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\"",
"prepare": "yarn build"
"prepare": "pnpm build"
},
"keywords": [
"color",
Expand Down
2 changes: 1 addition & 1 deletion packages/postcss-convert-values/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"scripts": {
"prebuild": "rimraf dist",
"build": "babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\"",
"prepare": "yarn build"
"prepare": "pnpm build"
},
"keywords": [
"css",
Expand Down
2 changes: 1 addition & 1 deletion packages/postcss-discard-comments/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"scripts": {
"prebuild": "rimraf dist",
"build": "babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\"",
"prepare": "yarn build"
"prepare": "pnpm build"
},
"keywords": [
"css",
Expand Down
2 changes: 1 addition & 1 deletion packages/postcss-discard-duplicates/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"scripts": {
"prebuild": "rimraf dist",
"build": "babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\"",
"prepare": "yarn build"
"prepare": "pnpm build"
},
"keywords": [
"css",
Expand Down
2 changes: 1 addition & 1 deletion packages/postcss-discard-empty/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"scripts": {
"prebuild": "rimraf dist",
"build": "babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\"",
"prepare": "yarn build"
"prepare": "pnpm build"
},
"keywords": [
"compress",
Expand Down
2 changes: 1 addition & 1 deletion packages/postcss-discard-overridden/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"scripts": {
"prebuild": "rimraf dist",
"build": "babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\"",
"prepare": "yarn build"
"prepare": "pnpm build"
},
"engines": {
"node": "^10 || ^12 || >=14.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/postcss-discard-unused/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"scripts": {
"prebuild": "rimraf dist",
"build": "babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\"",
"prepare": "yarn build"
"prepare": "pnpm build"
},
"keywords": [
"css",
Expand Down
2 changes: 1 addition & 1 deletion packages/postcss-merge-idents/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"scripts": {
"prebuild": "rimraf dist",
"build": "babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\"",
"prepare": "yarn build"
"prepare": "pnpm build"
},
"keywords": [
"css",
Expand Down
2 changes: 1 addition & 1 deletion packages/postcss-merge-longhand/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"scripts": {
"prebuild": "rimraf dist",
"build": "babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\"",
"prepare": "yarn build"
"prepare": "pnpm build"
},
"keywords": [
"css",
Expand Down
2 changes: 1 addition & 1 deletion packages/postcss-merge-rules/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"scripts": {
"prebuild": "rimraf dist",
"build": "babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\"",
"prepare": "yarn build"
"prepare": "pnpm build"
},
"keywords": [
"css",
Expand Down
2 changes: 1 addition & 1 deletion packages/postcss-minify-font-values/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"scripts": {
"prebuild": "rimraf dist",
"build": "babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\"",
"prepare": "yarn build"
"prepare": "pnpm build"
},
"engines": {
"node": "^10 || ^12 || >=14.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/postcss-minify-gradients/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"prebuild": "rimraf dist",
"build": "babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\"",
"prepare": "yarn build"
"prepare": "pnpm build"
},
"files": [
"LICENSE-MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/postcss-minify-params/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"scripts": {
"prebuild": "rimraf dist",
"build": "babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\"",
"prepare": "yarn build"
"prepare": "pnpm build"
},
"engines": {
"node": "^10 || ^12 || >=14.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/postcss-minify-selectors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"scripts": {
"prebuild": "rimraf dist",
"build": "babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\"",
"prepare": "yarn build"
"prepare": "pnpm build"
},
"keywords": [
"css",
Expand Down
2 changes: 1 addition & 1 deletion packages/postcss-normalize-charset/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"scripts": {
"prebuild": "rimraf dist",
"build": "babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\"",
"prepare": "yarn build"
"prepare": "pnpm build"
},
"engines": {
"node": "^10 || ^12 || >=14.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/postcss-normalize-display-values/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"prebuild": "rimraf dist",
"build": "babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\"",
"prepare": "yarn build"
"prepare": "pnpm build"
},
"files": [
"LICENSE-MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/postcss-normalize-positions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"scripts": {
"prebuild": "rimraf dist",
"build": "babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\"",
"prepare": "yarn build"
"prepare": "pnpm build"
},
"keywords": [
"css",
Expand Down
Loading