Skip to content

Commit 642f048

Browse files
committed
Fix: NPM CI #1
1 parent 7d26242 commit 642f048

File tree

8 files changed

+63
-36
lines changed

8 files changed

+63
-36
lines changed

.github/workflows/release.yml

+22-2
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,43 @@ jobs:
1515
packages: write
1616
pull-requests: write
1717
steps:
18+
- name: Git config
19+
run: git config --global core.autocrlf input
20+
1821
- name: Checkout Repo
1922
uses: actions/checkout@v4
2023
with:
2124
fetch-depth: 0
2225

2326
- name: Setup Node.js
2427
uses: actions/setup-node@v3
25-
28+
29+
- name: Get npm cache directory
30+
id: npm-cache-dir
31+
shell: bash
32+
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
33+
34+
- uses: actions/cache@v4
35+
id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
36+
with:
37+
path: ${{ steps.npm-cache-dir.outputs.dir }}
38+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
39+
restore-keys: |
40+
${{ runner.os }}-node-
41+
2642
- name: Install Dependencies
27-
run: npm ci
43+
run: |
44+
npm ci
45+
git status --porcelain
46+
git diff HEAD
2847
2948
- name: Create Release Pull Request or Publish to npm
3049
id: changesets
3150
uses: changesets/action@v1
3251
with:
3352
commit: "Chore: Version Packages"
3453
publish: npm run publish
54+
version: npm run version && npm ci
3555
setupGitUser: true
3656
createGithubReleases: true
3757
env:

__tests__/__fixtures__/package-lock.json

+3-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

__tests__/__fixtures__/package.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
{
2-
"name": "csstype-fixtures",
3-
"private": true,
4-
"dependencies": {
5-
"csstype": "file:../..",
6-
"oldcsstype": "npm:csstype@^2.6.21"
7-
}
8-
}
1+
{
2+
"name": "csstype-fixtures",
3+
"private": true,
4+
"dependencies": {
5+
"csstype": "file:../..",
6+
"oldcsstype": "npm:csstype@^2.6.21"
7+
}
8+
}

__tests__/package-lock.json

+3-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

__tests__/package.json

+22-22
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
{
2-
"name": "csstype-test",
3-
"private": true,
4-
"dependencies": {
5-
"csstype": "file:..",
6-
"typescript3.5": "npm:typescript@~3.5.0",
7-
"typescript3.6": "npm:typescript@~3.6.0",
8-
"typescript3.7": "npm:typescript@~3.7.0",
9-
"typescript3.8": "npm:typescript@~3.8.0",
10-
"typescript3.9": "npm:typescript@~3.9.0",
11-
"typescript4.0": "npm:typescript@~4.0.0",
12-
"typescript4.1": "npm:typescript@~4.1.0",
13-
"typescript4.2": "npm:typescript@~4.2.0",
14-
"typescript4.3": "npm:typescript@~4.3.0",
15-
"typescript4.4": "npm:typescript@~4.4.0",
16-
"typescript4.5": "npm:typescript@~4.5.0",
17-
"typescript4.6": "npm:typescript@~4.6.0",
18-
"typescript4.7": "npm:typescript@~4.7.0",
19-
"typescript4.8": "npm:typescript@~4.8.0",
20-
"typescript4.9": "npm:typescript@~4.9.0"
21-
}
22-
}
1+
{
2+
"name": "csstype-test",
3+
"private": true,
4+
"dependencies": {
5+
"csstype": "file:..",
6+
"typescript3.5": "npm:typescript@~3.5.0",
7+
"typescript3.6": "npm:typescript@~3.6.0",
8+
"typescript3.7": "npm:typescript@~3.7.0",
9+
"typescript3.8": "npm:typescript@~3.8.0",
10+
"typescript3.9": "npm:typescript@~3.9.0",
11+
"typescript4.0": "npm:typescript@~4.0.0",
12+
"typescript4.1": "npm:typescript@~4.1.0",
13+
"typescript4.2": "npm:typescript@~4.2.0",
14+
"typescript4.3": "npm:typescript@~4.3.0",
15+
"typescript4.4": "npm:typescript@~4.4.0",
16+
"typescript4.5": "npm:typescript@~4.5.0",
17+
"typescript4.6": "npm:typescript@~4.6.0",
18+
"typescript4.7": "npm:typescript@~4.7.0",
19+
"typescript4.8": "npm:typescript@~4.8.0",
20+
"typescript4.9": "npm:typescript@~4.9.0"
21+
}
22+
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
},
4545
"scripts": {
4646
"prepublish": "npm install --prefix __tests__ && npm install --prefix __tests__/__fixtures__",
47-
"prepublishOnly": "tsc && npm run test:src && npm run build && ts-node --files prepublish.ts",
47+
"prepublishOnly": "tsc && npm run test:src && npm run build && git status --porcelain && git diff HEAD && ts-node --files prepublish.ts",
4848
"update": "ts-node --files update.ts",
4949
"build": "ts-node --files build.ts --start",
5050
"watch": "ts-node --files build.ts --watch",

prepublish.ts

+1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ const result = spawnSync('git', ['status', '--porcelain'], { encoding: 'utf-8' }
44

55
if (result.stdout !== '') {
66
console.error('Your working directory needs to be clean!');
7+
console.log(`output: ${result.stdout}`);
78
process.exit(1);
89
}

update.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ import * as packageJson from './package.json';
66
import { FLOW_FILENAME, getJsonAsync, questionAsync, spawnAsync, TYPESCRIPT_FILENAME, writeFileAsync } from './utils';
77

88
async function update() {
9-
if ((await spawnAsync('git', 'status', '--porcelain')) !== '') {
9+
const result = await spawnAsync('git', 'status', '--porcelain');
10+
if (result !== '') {
1011
console.error('Your working directory needs to be clean!');
12+
console.log(`output: ${result}`);
1113
process.exit(1);
1214
}
1315

0 commit comments

Comments
 (0)