Skip to content

Commit 264c412

Browse files
alexeyr-cialexeyrJudahmeek
authored
Add publint to CI (#1705)
* Add publint to CI --------- Co-authored-by: Alexey Romanov <[email protected]> Co-authored-by: Judah Meek <[email protected]>
1 parent e28e56a commit 264c412

File tree

4 files changed

+52
-9
lines changed

4 files changed

+52
-9
lines changed

.github/workflows/lint-js-and-ruby.yml

+8-7
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,18 @@ jobs:
8686
run: yarn start format.listDifferent
8787
- name: Type-check TypeScript
8888
run: yarn run type-check
89-
- name: Lint package publishing
89+
- name: Pack for attw and publint
90+
run: yarn pack -f react-on-rails.tgz
91+
- name: Lint package types
9092
# --profile because we don't care about node10
9193
# --ignore-rules CJS default export can't be resolved at the moment,
9294
# revisit in 15.0.0
93-
run: yarn run attw --pack . --profile node16 --ignore-rules cjs-only-exports-default
95+
run: yarn run attw react-on-rails.tgz --profile node16 --ignore-rules cjs-only-exports-default
96+
- name: Lint package publishing
97+
run: yarn run publint --strict react-on-rails.tgz
9498
# We only download and run Actionlint if there is any difference in GitHub Action workflows
9599
# https://github.com/rhysd/actionlint/blob/main/docs/usage.md#on-github-actions
96-
- name: Check for GitHub Actions changes
100+
- name: Check GitHub Action changes
97101
id: check-workflows
98102
run: |
99103
git fetch origin ${{ github.event.pull_request.base.sha }}
@@ -106,11 +110,8 @@ jobs:
106110
echo "Failed to parse Actionlint version"
107111
exit 1
108112
fi
109-
else
110-
echo "Failed to fetch latest Actionlint version"
111-
exit 1
113+
echo "actionlint_version=\"$actionlint_version\"" >> "$GITHUB_OUTPUT"
112114
fi
113-
echo "actionlint_version=\"$actionlint_version\"" >> "$GITHUB_OUTPUT"
114115
fi
115116
- name: Setup Actionlint
116117
if: steps.check-workflows.outputs.changed == 'true'

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "15.0.0-alpha.2",
44
"description": "react-on-rails JavaScript for react_on_rails Ruby gem",
55
"main": "node_package/lib/ReactOnRails.full.js",
6+
"type": "commonjs",
67
"exports": {
78
".": {
89
"react-server": "./node_package/lib/ReactOnRailsRSC.js",
@@ -48,6 +49,7 @@
4849
"nps": "^5.9.3",
4950
"prettier": "^3.5.2",
5051
"prop-types": "^15.8.1",
52+
"publint": "^0.3.8",
5153
"react": "^19.0.0",
5254
"react-dom": "^19.0.0",
5355
"react-on-rails-rsc": "19.0.0",

script/convert

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ File.rename(old_config, new_config)
1616
gsub_file_content("../Gemfile.development_dependencies", /gem "shakapacker", "[^"]*"/, 'gem "shakapacker", "6.6.0"')
1717

1818
# The below packages don't work on the oldest supported Node version and aren't needed there anyway
19-
gsub_file_content("../package.json", /"knip": "[^"]*",/, "")
2019
gsub_file_content("../package.json", %r{"@arethetypeswrong/cli": "[^"]*",}, "")
2120
gsub_file_content("../package.json", %r{"@testing-library/dom": "[^"]*",}, "")
2221
gsub_file_content("../package.json", %r{"@testing-library/react": "[^"]*",}, "")
22+
gsub_file_content("../package.json", /"knip": "[^"]*",/, "")
23+
gsub_file_content("../package.json", /"publint": "[^"]*",/, "")
2324

2425
gsub_file_content("../spec/dummy/package.json", /"shakapacker": "[^"]*",/, '"shakapacker": "6.6.0",')
2526

yarn.lock

+40-1
Original file line numberDiff line numberDiff line change
@@ -1366,6 +1366,11 @@
13661366
"@nodelib/fs.scandir" "2.1.3"
13671367
fastq "^1.6.0"
13681368

1369+
"@publint/pack@^0.1.2":
1370+
version "0.1.2"
1371+
resolved "https://registry.yarnpkg.com/@publint/pack/-/pack-0.1.2.tgz#1b9a9567423262093e4a73e77697b65bf622f8c9"
1372+
integrity sha512-S+9ANAvUmjutrshV4jZjaiG8XQyuJIZ8a4utWmN/vW1sgQ9IfBnPndwkmQYw53QmouOIytT874u65HEmu6H5jw==
1373+
13691374
"@sinclair/typebox@^0.27.8":
13701375
version "0.27.8"
13711376
resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e"
@@ -4532,6 +4537,11 @@ minimist@^1.2.0, minimist@^1.2.6, minimist@^1.2.8:
45324537
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c"
45334538
integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==
45344539

4540+
mri@^1.1.0:
4541+
version "1.2.0"
4542+
resolved "https://registry.yarnpkg.com/mri/-/mri-1.2.0.tgz#6721480fec2a11a4889861115a48b6cbe7cc8f0b"
4543+
integrity sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==
4544+
45354545
45364546
version "2.1.2"
45374547
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
@@ -4795,6 +4805,13 @@ p-try@^2.0.0:
47954805
resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6"
47964806
integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==
47974807

4808+
package-manager-detector@^0.2.9:
4809+
version "0.2.11"
4810+
resolved "https://registry.yarnpkg.com/package-manager-detector/-/package-manager-detector-0.2.11.tgz#3af0b34f99d86d24af0a0620603d2e1180d05c9c"
4811+
integrity sha512-BEnLolu+yuz22S56CU1SUKq3XC3PkwD5wv4ikR4MfGvnRVcmzXR9DwSlW2fEamyTPyXHomBJRzgapeuBvRNzJQ==
4812+
dependencies:
4813+
quansync "^0.2.7"
4814+
47984815
parent-module@^1.0.0:
47994816
version "1.0.1"
48004817
resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2"
@@ -4890,7 +4907,7 @@ picocolors@^1.0.0:
48904907
resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c"
48914908
integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==
48924909

4893-
picocolors@^1.1.0:
4910+
picocolors@^1.1.0, picocolors@^1.1.1:
48944911
version "1.1.1"
48954912
resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b"
48964913
integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==
@@ -5011,6 +5028,16 @@ psl@^1.1.33:
50115028
resolved "https://registry.yarnpkg.com/psl/-/psl-1.9.0.tgz#d0df2a137f00794565fcaf3b2c00cd09f8d5a5a7"
50125029
integrity sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==
50135030

5031+
publint@^0.3.8:
5032+
version "0.3.9"
5033+
resolved "https://registry.yarnpkg.com/publint/-/publint-0.3.9.tgz#4d0bea2fa6caf6b20f6940a121111287c7264868"
5034+
integrity sha512-irTwfRfYW38vomkxxoiZQtFtUOQKpz5m0p9Z60z4xpXrl1KmvSrX1OMARvnnolB5usOXeNfvLj6d/W3rwXKfBQ==
5035+
dependencies:
5036+
"@publint/pack" "^0.1.2"
5037+
package-manager-detector "^0.2.9"
5038+
picocolors "^1.1.1"
5039+
sade "^1.8.1"
5040+
50145041
punycode@^2.1.0, punycode@^2.1.1:
50155042
version "2.1.1"
50165043
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"
@@ -5026,6 +5053,11 @@ pure-rand@^6.0.0:
50265053
resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-6.0.4.tgz#50b737f6a925468679bff00ad20eade53f37d5c7"
50275054
integrity sha512-LA0Y9kxMYv47GIPJy6MI84fqTd2HmYZI83W/kM/SkKfDlajnZYfmXFTxkbY+xSBPkLJxltMa9hIkmdc29eguMA==
50285055

5056+
quansync@^0.2.7:
5057+
version "0.2.8"
5058+
resolved "https://registry.yarnpkg.com/quansync/-/quansync-0.2.8.tgz#2e893d17bb754ba0988ea399ff0bc5f2a8467793"
5059+
integrity sha512-4+saucphJMazjt7iOM27mbFCk+D9dd/zmgMDCzRZ8MEoBfYp7lAvoN38et/phRQF6wOPMy/OROBGgoWeSKyluA==
5060+
50295061
querystringify@^2.1.1:
50305062
version "2.2.0"
50315063
resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6"
@@ -5256,6 +5288,13 @@ run-parallel@^1.2.0:
52565288
dependencies:
52575289
queue-microtask "^1.2.2"
52585290

5291+
sade@^1.8.1:
5292+
version "1.8.1"
5293+
resolved "https://registry.yarnpkg.com/sade/-/sade-1.8.1.tgz#0a78e81d658d394887be57d2a409bf703a3b2701"
5294+
integrity sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==
5295+
dependencies:
5296+
mri "^1.1.0"
5297+
52595298
safe-array-concat@^1.0.1:
52605299
version "1.0.1"
52615300
resolved "https://registry.yarnpkg.com/safe-array-concat/-/safe-array-concat-1.0.1.tgz#91686a63ce3adbea14d61b14c99572a8ff84754c"

0 commit comments

Comments
 (0)