diff --git a/.github/workflows/lint-js-and-ruby.yml b/.github/workflows/lint-js-and-ruby.yml index 7e72b4e07..30beaa7e6 100644 --- a/.github/workflows/lint-js-and-ruby.yml +++ b/.github/workflows/lint-js-and-ruby.yml @@ -86,14 +86,18 @@ jobs: run: yarn start format.listDifferent - name: Type-check TypeScript run: yarn run type-check - - name: Lint package publishing + - name: Pack for attw and publint + run: yarn pack -f react-on-rails.tgz + - name: Lint package types # --profile because we don't care about node10 # --ignore-rules CJS default export can't be resolved at the moment, # revisit in 15.0.0 - run: yarn run attw --pack . --profile node16 --ignore-rules cjs-only-exports-default + run: yarn run attw react-on-rails.tgz --profile node16 --ignore-rules cjs-only-exports-default + - name: Lint package publishing + run: yarn run publint --strict react-on-rails.tgz # We only download and run Actionlint if there is any difference in GitHub Action workflows # https://github.com/rhysd/actionlint/blob/main/docs/usage.md#on-github-actions - - name: Check for GitHub Actions changes + - name: Check GitHub Action changes id: check-workflows run: | git fetch origin ${{ github.event.pull_request.base.sha }} @@ -106,11 +110,8 @@ jobs: echo "Failed to parse Actionlint version" exit 1 fi - else - echo "Failed to fetch latest Actionlint version" - exit 1 + echo "actionlint_version=\"$actionlint_version\"" >> "$GITHUB_OUTPUT" fi - echo "actionlint_version=\"$actionlint_version\"" >> "$GITHUB_OUTPUT" fi - name: Setup Actionlint if: steps.check-workflows.outputs.changed == 'true' diff --git a/package.json b/package.json index edb0855a4..b7b4807f8 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "15.0.0-alpha.2", "description": "react-on-rails JavaScript for react_on_rails Ruby gem", "main": "node_package/lib/ReactOnRails.full.js", + "type": "commonjs", "exports": { ".": { "react-server": "./node_package/lib/ReactOnRailsRSC.js", @@ -48,6 +49,7 @@ "nps": "^5.9.3", "prettier": "^3.5.2", "prop-types": "^15.8.1", + "publint": "^0.3.8", "react": "^19.0.0", "react-dom": "^19.0.0", "react-on-rails-rsc": "19.0.0", diff --git a/script/convert b/script/convert index bfb4be064..a0c7310d1 100755 --- a/script/convert +++ b/script/convert @@ -16,10 +16,11 @@ File.rename(old_config, new_config) gsub_file_content("../Gemfile.development_dependencies", 'gem "shakapacker", "8.0.0"', 'gem "shakapacker", "6.6.0"') # The below packages don't work on the oldest supported Node version and aren't needed there anyway -gsub_file_content("../package.json", /"knip": "[^"]*",/, "") gsub_file_content("../package.json", %r{"@arethetypeswrong/cli": "[^"]*",}, "") gsub_file_content("../package.json", %r{"@testing-library/dom": "[^"]*",}, "") gsub_file_content("../package.json", %r{"@testing-library/react": "[^"]*",}, "") +gsub_file_content("../package.json", /"knip": "[^"]*",/, "") +gsub_file_content("../package.json", /"publint": "[^"]*",/, "") gsub_file_content("../spec/dummy/package.json", '"shakapacker": "8.0.0",', '"shakapacker": "6.6.0",') diff --git a/yarn.lock b/yarn.lock index cda8b0565..06384097e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1366,6 +1366,11 @@ "@nodelib/fs.scandir" "2.1.3" fastq "^1.6.0" +"@publint/pack@^0.1.2": + version "0.1.2" + resolved "https://registry.yarnpkg.com/@publint/pack/-/pack-0.1.2.tgz#1b9a9567423262093e4a73e77697b65bf622f8c9" + integrity sha512-S+9ANAvUmjutrshV4jZjaiG8XQyuJIZ8a4utWmN/vW1sgQ9IfBnPndwkmQYw53QmouOIytT874u65HEmu6H5jw== + "@sinclair/typebox@^0.27.8": version "0.27.8" 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: resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== +mri@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/mri/-/mri-1.2.0.tgz#6721480fec2a11a4889861115a48b6cbe7cc8f0b" + integrity sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA== + ms@2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" @@ -4795,6 +4805,13 @@ p-try@^2.0.0: resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== +package-manager-detector@^0.2.9: + version "0.2.11" + resolved "https://registry.yarnpkg.com/package-manager-detector/-/package-manager-detector-0.2.11.tgz#3af0b34f99d86d24af0a0620603d2e1180d05c9c" + integrity sha512-BEnLolu+yuz22S56CU1SUKq3XC3PkwD5wv4ikR4MfGvnRVcmzXR9DwSlW2fEamyTPyXHomBJRzgapeuBvRNzJQ== + dependencies: + quansync "^0.2.7" + parent-module@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" @@ -4890,7 +4907,7 @@ picocolors@^1.0.0: resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== -picocolors@^1.1.0: +picocolors@^1.1.0, picocolors@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b" integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA== @@ -5011,6 +5028,16 @@ psl@^1.1.33: resolved "https://registry.yarnpkg.com/psl/-/psl-1.9.0.tgz#d0df2a137f00794565fcaf3b2c00cd09f8d5a5a7" integrity sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag== +publint@^0.3.8: + version "0.3.9" + resolved "https://registry.yarnpkg.com/publint/-/publint-0.3.9.tgz#4d0bea2fa6caf6b20f6940a121111287c7264868" + integrity sha512-irTwfRfYW38vomkxxoiZQtFtUOQKpz5m0p9Z60z4xpXrl1KmvSrX1OMARvnnolB5usOXeNfvLj6d/W3rwXKfBQ== + dependencies: + "@publint/pack" "^0.1.2" + package-manager-detector "^0.2.9" + picocolors "^1.1.1" + sade "^1.8.1" + punycode@^2.1.0, punycode@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" @@ -5026,6 +5053,11 @@ pure-rand@^6.0.0: resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-6.0.4.tgz#50b737f6a925468679bff00ad20eade53f37d5c7" integrity sha512-LA0Y9kxMYv47GIPJy6MI84fqTd2HmYZI83W/kM/SkKfDlajnZYfmXFTxkbY+xSBPkLJxltMa9hIkmdc29eguMA== +quansync@^0.2.7: + version "0.2.8" + resolved "https://registry.yarnpkg.com/quansync/-/quansync-0.2.8.tgz#2e893d17bb754ba0988ea399ff0bc5f2a8467793" + integrity sha512-4+saucphJMazjt7iOM27mbFCk+D9dd/zmgMDCzRZ8MEoBfYp7lAvoN38et/phRQF6wOPMy/OROBGgoWeSKyluA== + querystringify@^2.1.1: version "2.2.0" resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6" @@ -5256,6 +5288,13 @@ run-parallel@^1.2.0: dependencies: queue-microtask "^1.2.2" +sade@^1.8.1: + version "1.8.1" + resolved "https://registry.yarnpkg.com/sade/-/sade-1.8.1.tgz#0a78e81d658d394887be57d2a409bf703a3b2701" + integrity sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A== + dependencies: + mri "^1.1.0" + safe-array-concat@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/safe-array-concat/-/safe-array-concat-1.0.1.tgz#91686a63ce3adbea14d61b14c99572a8ff84754c"