Skip to content
Draft
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
52 changes: 52 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Build

on: [push, pull_request]

jobs:
build:
name: Type-check & build
runs-on: ubuntu-latest
permissions: {}
env:
# We don't want Puppeteer to automatically download a browser when dependencies are being installed
PUPPETEER_SKIP_DOWNLOAD: 'true'

steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
with:
persist-credentials: false

- name: Install pnpm
uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271

- name: Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e
with:
node-version: '22.18.0'
cache: pnpm

- name: Install pnpm Dependencies
run: pnpm install --frozen-lockfile

- name: Type-check
run: pnpm type-check

- name: Build (emit JS + type declarations)
run: pnpm build

- name: Verify packaged output
run: |
pnpm pack --out webpack-encore.tgz
contents=$(tar -tzf webpack-encore.tgz)
for file in \
package/dist/index.js \
package/dist/index.d.ts \
package/dist/bin/encore.js \
package/dist/lib/plugins/plugin-priorities.js \
package/dist/lib/plugins/plugin-priorities.d.ts; do
echo "$contents" | grep -qxF "$file" || {
echo "::error::Missing $file in the package tarball"
exit 1
}
done
4 changes: 2 additions & 2 deletions .github/workflows/format.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271

- name: Node ${{matrix.node-versions}}
- name: Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e
with:
node-version: '22.13.0'
node-version: '22.18.0'
cache: pnpm

- name: Install pnpm Dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271

- name: Node ${{matrix.node-versions}}
- name: Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e
with:
node-version: '22.13.0'
node-version: '22.18.0'
cache: pnpm

- name: Install pnpm Dependencies
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/testing_apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,17 @@ jobs:

- run: npm i -g corepack && corepack enable

- name: Node ${{matrix.node-versions}}
- name: Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e
with:
node-version: '22.18.0'
cache: ${{ matrix.app.pkg_manager }}
cache-dependency-path: ${{ matrix.app.working_directory }}/${{ env.LOCKFILE }}

- name: Installing dependencies
run: |
pnpm install --frozen-lockfile

- name: Packing Encore
run: pnpm pack --out webpack-encore.tgz

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_modules/
npm-debug.log*
/test_tmp
/dist

webpack-encore.tgz
7 changes: 6 additions & 1 deletion .oxfmtrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{
"$schema": "./node_modules/oxfmt/configuration_schema.json",
"ignorePatterns": [".github/PULL_REQUEST_TEMPLATE.md", "fixtures/**", "test_apps/**"],
"ignorePatterns": [
".github/PULL_REQUEST_TEMPLATE.md",
"fixtures/**",
"test_apps/**",
"dist/**"
],
"singleQuote": true,
"semi": true,
"trailingComma": "es5",
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 7.2.0

- Migrate internal code to TypeScript, ship package with type definitions (better DX and IDE support!)

## 7.1.0

- Add support for `sass-loader` ^17.0.0
Expand Down
0 bin/encore.js → bin/encore.ts
100755 → 100644
File renamed without changes.
22 changes: 21 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import jsdoc from 'eslint-plugin-jsdoc';
import nodePlugin from 'eslint-plugin-n';
import vitestPlugin from 'eslint-plugin-vitest';
import globals from 'globals';
import tseslint from 'typescript-eslint';

export default [
js.configs.recommended,
Expand Down Expand Up @@ -58,7 +59,6 @@ export default [
],
'n/no-unsupported-features/node-builtins': ['error'],
'n/no-deprecated-api': 'error',
'n/no-missing-import': 'error',
'n/no-missing-require': 'off',
'n/no-unpublished-bin': 'error',
'n/no-unpublished-import': 'error',
Expand All @@ -84,6 +84,26 @@ file that was distributed with this source code.`,
},
},
},
{
files: ['**/*.ts'],
languageOptions: {
parser: tseslint.parser,
},
rules: {
// The TypeScript compiler reports unused symbols; the core rule
// produces false positives on type-only syntax.
'no-unused-vars': 'off',
// In TypeScript files, types live in the signature, not in JSDoc.
// JSDoc is kept only for prose descriptions, so neither the tags nor
// their types are required, and parameter names (e.g. destructured
// option bags) are validated by tsc rather than the JSDoc plugin.
'jsdoc/require-param': 'off',
'jsdoc/require-param-type': 'off',
'jsdoc/require-returns': 'off',
'jsdoc/require-returns-type': 'off',
'jsdoc/check-param-names': 'off',
},
},
{
files: ['test/**/*'],
languageOptions: {
Expand Down
Loading