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

reduce npm run invocations #893

Merged
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
5 changes: 4 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"ecmaVersion": 2022,
"sourceType": "module"
},
"ignorePatterns": ["**/dist/*"],
"rules": {
"quotes": ["error", "single"],
"comma-dangle": ["error", "always-multiline"],
Expand All @@ -21,7 +22,9 @@
"overrides": [
{
"files": [
"**/*.ts"
"**/*.ts",
"**/*.mts",
"**/*.cts"
],
"extends": [
"plugin:@typescript-eslint/eslint-recommended",
Expand Down
10 changes: 0 additions & 10 deletions .github/bin/clean.sh

This file was deleted.

38 changes: 38 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: lint
on:
push:
branches:
- 'main'
pull_request:
workflow_dispatch:
inputs:
build_and_test_all_packages:
type: boolean
description: Lint all packages
required: true

concurrency:
group: branch-node--lint--${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions/setup-node@v3
with:
node-version: 18

- name: npm ci
run: |
npm ci --ignore-scripts

- name: lint
run: npm run lint
8 changes: 2 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
required: true

concurrency:
group: branch-node-${{ github.ref }}
group: branch-node--test--${{ github.ref }}
cancel-in-progress: true

defaults:
Expand Down Expand Up @@ -66,18 +66,14 @@ jobs:
GITHUB_ACTION_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Build, lint and PostCSS Tape tests must all work and pass :
# Build and PostCSS Tape tests must all work and pass :
# - with exact dependencies from package-lock.json
# - without requiring postinstall scripts from dependencies to run
- name: build
run: |
npm run build --if-present $MODIFIED_WORKSPACES
if: matrix.is_base_node_version && matrix.is_base_os_version

- name: lint
run: npm run lint --if-present $MODIFIED_WORKSPACES
if: matrix.is_base_node_version && matrix.is_base_os_version

- name: docs
run: npm run docs --if-present $MODIFIED_WORKSPACES
if: matrix.is_base_node_version && matrix.is_base_os_version
Expand Down
9 changes: 2 additions & 7 deletions cli/csstools-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,11 @@
"@csstools/base-cli": "0.1.0"
},
"scripts": {
"prebuild": "npm run clean",
"build": "rollup -c ../../rollup/default.mjs && npm run set-cli-file-permissions",
"clean": "node -e \"fs.rmSync('./dist', { recursive: true, force: true }); fs.mkdirSync('./dist');\"",
"csstools-cli": "csstools-cli",
"lint": "npm run lint:eslint && npm run lint:package-json",
"lint:eslint": "eslint ./src --ext .js --ext .ts --ext .mjs --no-error-on-unmatched-pattern",
"lint:package-json": "node ../../.github/bin/format-package-json.mjs",
"prepublishOnly": "npm run clean && npm run build && npm run test",
"lint": "node ../../.github/bin/format-package-json.mjs",
"prepublishOnly": "npm run build && npm run test",
"set-cli-file-permissions": "chmod a+x ./dist/cli.cjs",
"stryker": "stryker run --logLevel error",
"test": "exit 0",
"test:cli": "bash ./test/cli/test.sh"
},
Expand Down
19 changes: 0 additions & 19 deletions cli/csstools-cli/stryker.conf.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"private": true,
"description": "Can you use custom-media, design-tokens and global-data together?",
"scripts": {
"build": "postcss style.css -o ./result.css",
"watch": "postcss style.css -w -o ./result.css",
"build": "postcss style.css -o ./dist/result.css",
"watch": "postcss style.css -w -o ./dist/result.css",
"test": "node ./test.mjs"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import assert from 'assert';
import fs from 'fs/promises';

const result = await fs.readFile('./result.css');
const result = await fs.readFile('./dist/result.css');
const expect = await fs.readFile('./expect.css');

assert.equal(result.toString(), expect.toString());
2 changes: 1 addition & 1 deletion e2e/postcss-cli/commonjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"description": "Can you use postcss-cli with one of our plugins?",
"scripts": {
"build": "postcss style.css -o ./result.css",
"build": "postcss style.css -o ./dist/result.css",
"test": "node ./test.mjs"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion e2e/postcss-cli/commonjs/test.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import assert from 'assert';
import fs from 'fs/promises';

const result = await fs.readFile('./result.css');
const result = await fs.readFile('./dist/result.css');
const expect = await fs.readFile('./expect.css');

assert.equal(result.toString(), expect.toString());
File renamed without changes.
2 changes: 1 addition & 1 deletion e2e/postcss-cli/esm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"description": "Can you use postcss-cli with one of our plugins?",
"scripts": {
"build": "postcss style.css -o ./result.css",
"build": "postcss style.css -o ./dist/result.css",
"test": "node ./test.mjs"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion e2e/postcss-cli/esm/test.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import assert from 'assert';
import fs from 'fs/promises';

const result = await fs.readFile('./result.css');
const result = await fs.readFile('./dist/result.css');
const expect = await fs.readFile('./expect.css');

assert.equal(result.toString(), expect.toString());
2 changes: 0 additions & 2 deletions e2e/typescript/commonjs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
index.cjs
index.d.cts
7 changes: 7 additions & 0 deletions e2e/typescript/commonjs/dist/index.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const assert = require('assert');
const plugin = require('postcss-preset-env');
plugin({ preserve: true });
assert.ok(plugin.postcss, 'should have "postcss flag"');
assert.equal(typeof plugin, 'function', 'should return a function');
2 changes: 1 addition & 1 deletion e2e/typescript/commonjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"description": "Can you use PostCSS with one of our plugins from a Typescript file?",
"scripts": {
"build": "tsc",
"test": "node ./index.cjs"
"test": "node ./dist/index.cjs"
},
"devDependencies": {
"postcss-preset-env": "file:../../../plugin-packs/postcss-preset-env",
Expand Down
4 changes: 2 additions & 2 deletions e2e/typescript/commonjs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"allowJs": false,
"allowSyntheticDefaultImports": true,
"declaration": true,
"declarationDir": ".",
"declarationDir": "./dist",
"lib": ["es2020"],
"module": "CommonJS",
"moduleResolution": "classic",
"outDir": ".",
"outDir": "./dist",
"target": "es2020",
"strict": true
},
Expand Down
2 changes: 0 additions & 2 deletions e2e/typescript/esm--node-next/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
index.mjs
index.d.mts
1 change: 1 addition & 0 deletions e2e/typescript/esm--node-next/dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
4 changes: 2 additions & 2 deletions e2e/typescript/esm--node-next/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"allowJs": false,
"allowSyntheticDefaultImports": true,
"declaration": true,
"declarationDir": ".",
"declarationDir": "./dist",
"lib": ["es2020"],
"module": "ES6",
"moduleResolution": "nodenext",
"outDir": ".",
"outDir": "./dist",
"target": "es2020",
"strict": true
},
Expand Down
2 changes: 0 additions & 2 deletions e2e/typescript/esm/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
index.mjs
index.d.mts
1 change: 1 addition & 0 deletions e2e/typescript/esm/dist/index.d.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
5 changes: 5 additions & 0 deletions e2e/typescript/esm/dist/index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import assert from 'assert';
import plugin from 'postcss-preset-env';
plugin({ preserve: true });
assert.ok(plugin.postcss, 'should have "postcss flag"');
assert.equal(typeof plugin, 'function', 'should return a function');
2 changes: 1 addition & 1 deletion e2e/typescript/esm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"description": "Can you use PostCSS with one of our plugins from a Typescript file?",
"scripts": {
"build": "tsc",
"test": "node ./index.mjs"
"test": "node ./dist/index.mjs"
},
"devDependencies": {
"postcss-preset-env": "file:../../../plugin-packs/postcss-preset-env",
Expand Down
4 changes: 2 additions & 2 deletions e2e/typescript/esm/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"allowJs": false,
"allowSyntheticDefaultImports": true,
"declaration": true,
"declarationDir": ".",
"declarationDir": "./dist",
"lib": ["es2020"],
"module": "ES6",
"moduleResolution": "node",
"outDir": ".",
"outDir": "./dist",
"target": "es2020",
"strict": true
},
Expand Down
11 changes: 3 additions & 8 deletions experimental/css-has-pseudo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,11 @@
"@csstools/postcss-tape": "*"
},
"scripts": {
"prebuild": "npm run clean",
"build": "rollup -c ../../rollup/default.mjs",
"clean": "node -e \"fs.rmSync('./dist', { recursive: true, force: true }); fs.mkdirSync('./dist');\"",
"lint": "npm run lint:eslint && npm run lint:package-json",
"lint:eslint": "eslint ./src --ext .js --ext .ts --ext .mjs --no-error-on-unmatched-pattern",
"lint:package-json": "node ../../.github/bin/format-package-json.mjs",
"prepublishOnly": "npm run clean && npm run build && npm run test",
"lint": "node ../../.github/bin/format-package-json.mjs",
"prepublishOnly": "npm run build && npm run test",
"stryker": "stryker run --logLevel error",
"test": "node .tape.mjs && npm run test:exports",
"test:exports": "node ./test/_import.mjs && node ./test/_require.cjs",
"test": "node .tape.mjs && node ./test/_import.mjs && node ./test/_require.cjs",
"test:rewrite-expects": "REWRITE_EXPECTS=true node .tape.mjs"
},
"homepage": "https://github.com/csstools/postcss-plugins/tree/main/experimental/css-has-pseudo#readme",
Expand Down
11 changes: 3 additions & 8 deletions experimental/postcss-nesting/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,11 @@
"@csstools/postcss-tape": "*"
},
"scripts": {
"prebuild": "npm run clean",
"build": "rollup -c ../../rollup/default.mjs",
"clean": "node -e \"fs.rmSync('./dist', { recursive: true, force: true }); fs.mkdirSync('./dist');\"",
"docs": "node ../../.github/bin/generate-docs/install.mjs",
"lint": "npm run lint:eslint && npm run lint:package-json",
"lint:eslint": "eslint ./src --ext .js --ext .ts --ext .mjs --no-error-on-unmatched-pattern",
"lint:package-json": "node ../../.github/bin/format-package-json.mjs",
"prepublishOnly": "npm run clean && npm run build && npm run test",
"test": "node .tape.mjs && npm run test:exports",
"test:exports": "node ./test/_import.mjs && node ./test/_require.cjs",
"lint": "node ../../.github/bin/format-package-json.mjs",
"prepublishOnly": "npm run build && npm run test",
"test": "node .tape.mjs && node ./test/_import.mjs && node ./test/_require.cjs",
"test:rewrite-expects": "REWRITE_EXPECTS=true node .tape.mjs"
},
"homepage": "https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-nesting#readme",
Expand Down
8 changes: 2 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,9 @@
},
"scripts": {
"build": "npm run build --workspaces --if-present",
"clean": "bash ./.github/bin/clean.sh",
"clean": "npm run clean --workspaces --if-present",
"docs": "npm run docs --workspaces --if-present",
"lint": "npm run lint --workspaces --if-present && npm run lint:rollup-config && npm run lint:executable-files && npm run lint:licenses",
"lint:executable-files": "bash .github/bin/detect-executable-files/detect-executable-files.sh",
"lint:glue-scripts": "eslint ./.github/bin --ext .js --ext .ts --ext .mjs --no-error-on-unmatched-pattern",
"lint:licenses": "node .github/bin/license/check-license.mjs",
"lint:rollup-config": "eslint ./rollup --ext .js --ext .ts --ext .mjs --no-error-on-unmatched-pattern",
"lint": "npm run lint --workspaces --if-present && eslint ./ --ext .js --ext .mjs --ext .cjs --ext .ts --ext .mts --no-error-on-unmatched-pattern && bash .github/bin/detect-executable-files/detect-executable-files.sh && node .github/bin/license/check-license.mjs",
"new-plugin": "node ./.github/bin/new-plugin.mjs",
"release-plan": "node .github/bin/release-plan/release-plan.mjs",
"release-plan:dry-run": "node .github/bin/release-plan/release-plan.mjs --dry-run",
Expand Down
9 changes: 3 additions & 6 deletions packages/base-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,10 @@
"postcss": "^8.4"
},
"scripts": {
"prebuild": "npm run clean",
"prebuild": "node -e \"fs.rmSync('./dist', { recursive: true, force: true }); fs.mkdirSync('./dist');\"",
"build": "tsc",
"clean": "node -e \"fs.rmSync('./dist', { recursive: true, force: true }); fs.mkdirSync('./dist');\"",
"lint": "npm run lint:eslint && npm run lint:package-json",
"lint:eslint": "eslint ./src --ext .js --ext .ts --ext .mjs --no-error-on-unmatched-pattern",
"lint:package-json": "node ../../.github/bin/format-package-json.mjs",
"prepublishOnly": "npm run clean && npm run build && npm run test",
"lint": "node ../../.github/bin/format-package-json.mjs",
"prepublishOnly": "npm run build && npm run test",
"stryker": "stryker run --logLevel error",
"test": "node ./test/test.mjs"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/base-cli/stryker.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"coverageAnalysis": "perTest",
"tempDirName": "../../.stryker-tmp",
"commandRunner": {
"command": "npm run test"
"command": "node ./test/test.mjs"
},
"buildCommand": "npm run build",
"buildCommand": "tsc",
"thresholds": {
"high": 100,
"low": 100,
Expand Down
11 changes: 3 additions & 8 deletions packages/cascade-layer-name-parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,11 @@
"@csstools/css-tokenizer": "^2.0.0"
},
"scripts": {
"prebuild": "npm run clean",
"build": "rollup -c ../../rollup/default.mjs",
"clean": "node -e \"fs.rmSync('./dist', { recursive: true, force: true }); fs.mkdirSync('./dist');\"",
"lint": "npm run lint:eslint && npm run lint:package-json",
"lint:eslint": "eslint ./src --ext .js --ext .ts --ext .mjs --no-error-on-unmatched-pattern",
"lint:package-json": "node ../../.github/bin/format-package-json.mjs",
"prepublishOnly": "npm run clean && npm run build && npm run test",
"lint": "node ../../.github/bin/format-package-json.mjs",
"prepublishOnly": "npm run build && npm run test",
"stryker": "stryker run --logLevel error",
"test": "node ./test/test.mjs",
"test:exports": "node ./test/_import.mjs && node ./test/_require.cjs",
"test": "node ./test/test.mjs && node ./test/_import.mjs && node ./test/_require.cjs",
"test:rewrite-expects": "REWRITE_EXPECTS=true node ./test/test.mjs"
},
"homepage": "https://github.com/csstools/postcss-plugins/tree/main/packages/cascade-layer-name-parser#readme",
Expand Down
4 changes: 2 additions & 2 deletions packages/cascade-layer-name-parser/stryker.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"mutate": [
"src/**/*.ts"
],
"buildCommand": "npm run build",
"buildCommand": "rollup -c ../../rollup/default.mjs",
"testRunner": "command",
"coverageAnalysis": "perTest",
"tempDirName": "../../.stryker-tmp",
"commandRunner": {
"command": "npm run test"
"command": "node ./test/test.mjs"
},
"thresholds": {
"high": 100,
Expand Down
Loading