Skip to content

Commit

Permalink
refactor(core): use .swcrc instead of Next's webpack.config.resolve f…
Browse files Browse the repository at this point in the history
…or path aliases
  • Loading branch information
DuCanhGH committed Mar 10, 2023
1 parent a580ebb commit 7e5a838
Show file tree
Hide file tree
Showing 23 changed files with 1,062 additions and 630 deletions.
5 changes: 5 additions & 0 deletions .changeset/rude-ravens-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ducanh2912/next-pwa": patch
---

refactor(core): use .swcrc instead of Next's webpack.config.resolve for path aliases
16 changes: 0 additions & 16 deletions .ncurc.js

This file was deleted.

3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"typescript.tsdk": "node_modules\\typescript\\lib"
}
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Note: please see packages/*/CHANGELOG.md for > 7.0.2 changelogs.

## [7.0.2](https://github.com/DuCanhGH/next-pwa/compare/v7.0.1...v7.0.2) (2022-12-06)


Expand Down
10 changes: 5 additions & 5 deletions examples/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@
},
"dependencies": {
"@ducanh2912/next-pwa": "latest",
"next": "13.2.4-canary.0",
"next": "13.2.4",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"@types/node": "18.14.4",
"@types/node": "18.15.0",
"@types/react": "18.0.28",
"@types/react-dom": "18.0.11",
"eslint": "8.35.0",
"eslint-config-next": "13.2.4-canary.0",
"typescript": "5.1.0-dev.20230302",
"webpack": "5.75.0"
"eslint-config-next": "13.2.4",
"typescript": "4.9.5",
"webpack": "5.76.0"
}
}
10 changes: 5 additions & 5 deletions examples/cookie/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
"dependencies": {
"@ducanh2912/next-pwa": "latest",
"cookies-next": "2.1.1",
"next": "13.2.4-canary.0",
"next": "13.2.4",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"@types/node": "18.14.4",
"@types/node": "18.15.0",
"@types/react": "18.0.28",
"@types/react-dom": "18.0.11",
"eslint": "8.35.0",
"eslint-config-next": "13.2.4-canary.0",
"typescript": "5.1.0-dev.20230302",
"webpack": "5.75.0"
"eslint-config-next": "13.2.4",
"typescript": "4.9.5",
"webpack": "5.76.0"
}
}
18 changes: 9 additions & 9 deletions examples/custom-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@
"@ducanh2912/next-pwa": "latest",
"@fastify/compress": "6.2.0",
"cross-env": "7.0.3",
"fastify": "4.13.0",
"next": "13.2.4-canary.0",
"fastify": "4.14.1",
"next": "13.2.4",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"@swc/core": "1.3.37",
"@types/node": "18.14.4",
"@swc/core": "1.3.39",
"@types/node": "18.15.0",
"@types/react": "18.0.28",
"@types/react-dom": "18.0.11",
"eslint": "8.35.0",
"eslint-config-next": "13.2.4-canary.0",
"nodemon": "2.0.20",
"rimraf": "4.1.3",
"eslint-config-next": "13.2.4",
"nodemon": "2.0.21",
"rimraf": "4.4.0",
"ts-node": "10.9.1",
"typescript": "5.1.0-dev.20230302",
"webpack": "5.75.0"
"typescript": "4.9.5",
"webpack": "5.76.0"
}
}
10 changes: 5 additions & 5 deletions examples/custom-worker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@
},
"dependencies": {
"@ducanh2912/next-pwa": "latest",
"next": "13.2.4-canary.0",
"next": "13.2.4",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"@types/node": "18.14.4",
"@types/node": "18.15.0",
"@types/react": "18.0.28",
"@types/react-dom": "18.0.11",
"eslint": "8.35.0",
"eslint-config-next": "13.2.4-canary.0",
"typescript": "5.1.0-dev.20230302",
"webpack": "5.75.0"
"eslint-config-next": "13.2.4",
"typescript": "5.0.1-rc",
"webpack": "5.76.0"
}
}
1 change: 0 additions & 1 deletion examples/custom-worker/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"strict": true,
"target": "esnext",
"incremental": true,
"baseUrl": ".",
"paths": {
"@shared/*": ["./shared/*"]
}
Expand Down
10 changes: 5 additions & 5 deletions examples/lifecycle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@
},
"dependencies": {
"@ducanh2912/next-pwa": "latest",
"next": "13.2.4-canary.0",
"next": "13.2.4",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"@types/node": "18.14.4",
"@types/node": "18.15.0",
"@types/react": "18.0.28",
"@types/react-dom": "18.0.11",
"eslint": "8.35.0",
"eslint-config-next": "13.2.4-canary.0",
"typescript": "5.1.0-dev.20230302",
"webpack": "5.75.0"
"eslint-config-next": "13.2.4",
"typescript": "4.9.5",
"webpack": "5.76.0"
}
}
14 changes: 7 additions & 7 deletions examples/next-i18next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@
"cross-env": "7.0.3",
"express": "4.18.2",
"fastify-compress": "4.1.0",
"i18next": "22.4.10",
"next": "13.2.4-canary.0",
"next-i18next": "13.1.4",
"i18next": "22.4.11",
"next": "13.2.4",
"next-i18next": "13.2.2",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-i18next": "12.2.0"
},
"devDependencies": {
"@types/node": "18.14.4",
"@types/node": "18.15.0",
"@types/react": "18.0.28",
"@types/react-dom": "18.0.11",
"eslint": "8.35.0",
"eslint-config-next": "13.2.4-canary.0",
"typescript": "5.1.0-dev.20230302",
"webpack": "5.75.0"
"eslint-config-next": "13.2.4",
"typescript": "4.9.5",
"webpack": "5.76.0"
}
}
10 changes: 5 additions & 5 deletions examples/next-image/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@
},
"dependencies": {
"@ducanh2912/next-pwa": "latest",
"next": "13.2.4-canary.0",
"next": "13.2.4",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"@types/node": "18.14.4",
"@types/node": "18.15.0",
"@types/react": "18.0.28",
"@types/react-dom": "18.0.11",
"eslint": "8.35.0",
"eslint-config-next": "13.2.4-canary.0",
"typescript": "5.1.0-dev.20230302",
"webpack": "5.75.0"
"eslint-config-next": "13.2.4",
"typescript": "4.9.5",
"webpack": "5.76.0"
}
}
10 changes: 5 additions & 5 deletions examples/offline-fallback-v2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@
},
"dependencies": {
"@ducanh2912/next-pwa": "latest",
"next": "13.2.4-canary.0",
"next": "13.2.4",
"react": "18.2.0",
"react-dom": "18.2.0",
"sharp": "0.31.3"
},
"devDependencies": {
"@types/node": "18.14.4",
"@types/node": "18.15.0",
"@types/react": "18.0.28",
"@types/react-dom": "18.0.11",
"eslint": "8.35.0",
"eslint-config-next": "13.2.4-canary.0",
"typescript": "5.1.0-dev.20230302",
"webpack": "5.75.0"
"eslint-config-next": "13.2.4",
"typescript": "4.9.5",
"webpack": "5.76.0"
}
}
10 changes: 5 additions & 5 deletions examples/web-push/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@
},
"dependencies": {
"@ducanh2912/next-pwa": "latest",
"next": "13.2.4-canary.0",
"next": "13.2.4",
"react": "18.2.0",
"react-dom": "18.2.0",
"web-push": "3.5.0"
},
"devDependencies": {
"@types/node": "18.14.4",
"@types/node": "18.15.0",
"@types/react": "18.0.28",
"@types/react-dom": "18.0.11",
"@types/web-push": "3.3.2",
"eslint": "8.35.0",
"eslint-config-next": "13.2.4-canary.0",
"typescript": "5.1.0-dev.20230302",
"webpack": "5.75.0"
"eslint-config-next": "13.2.4",
"typescript": "4.9.5",
"webpack": "5.76.0"
}
}
8 changes: 4 additions & 4 deletions examples/workboxless/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@next-pwa-example/workboxless",
"name": "@developing-next-pwa-example/workboxless",
"version": "0.1.0",
"private": true,
"scripts": {
Expand All @@ -10,14 +10,14 @@
},
"dependencies": {
"@ducanh2912/next-pwa-workboxless": "workspace:*",
"next": "13.2.4-canary.0",
"next": "13.2.4",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"@types/node": "18.14.4",
"@types/node": "18.15.0",
"@types/react": "18.0.28",
"@types/react-dom": "18.0.11",
"typescript": "5.1.0-dev.20230302"
"typescript": "4.9.5"
}
}
49 changes: 49 additions & 0 deletions ncu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// @ts-check
import fg from "fast-glob";
import ncu from "npm-check-updates";

/**
* @type {import("npm-check-updates").default}
*/
// @ts-expect-error Wrong type provided by npm-check-updates.
const run = ncu.run;

/**
* Update and then log updated dependencies.
*
* @param {import("npm-check-updates").RunOptions} runOptions
*/
const updateAndLog = async (runOptions) => {
const upgraded = await run(runOptions);
console.log(
`Upgraded dependencies for ${runOptions.packageFile ?? "./package.json"}:`,
upgraded
);
};

await Promise.all([
(
await fg("./**/package.json", {
ignore: ["examples/**", "**/node_modules/**"],
})
).map(
async (packageFile) =>
await updateAndLog({
packageFile,
upgrade: true,
target: (dependencyName) => {
if (dependencyName === "typescript") {
return "@next";
}
if (/^react(-dom)?$/.test(dependencyName)) {
return "@latest";
}
return "latest";
},
})
),
await updateAndLog({
packageFile: "examples/*/package.json",
upgrade: true,
}),
]);
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
],
"scripts": {
"build": "turbo run build --parallel --filter=!@next-pwa-example/*",
"deps": "ncu",
"deps:update-all": "pnpm deps -ws --root",
"deps": "node ncu.js",
"dev": "turbo run dev --parallel --filter=!@next-pwa-example/*",
"examples:build": "turbo run build --filter=@next-pwa-example/*",
"examples:dev": "turbo run dev --parallel --filter=@next-pwa-example/*",
Expand All @@ -28,27 +27,28 @@
"@changesets/cli": "2.26.0",
"@ducanh2912/next-pwa": "workspace:*",
"@ducanh2912/next-pwa-workboxless": "workspace:*",
"@types/node": "18.14.4",
"@types/node": "18.15.0",
"@types/shell-quote": "1.7.1",
"@typescript-eslint/eslint-plugin": "5.54.0",
"@typescript-eslint/parser": "5.54.0",
"@typescript-eslint/eslint-plugin": "5.54.1",
"@typescript-eslint/parser": "5.54.1",
"cross-env": "7.0.3",
"eslint": "8.35.0",
"eslint-config-prettier": "8.6.0",
"eslint-plugin-jsdoc": "40.0.0",
"eslint-config-prettier": "8.7.0",
"eslint-plugin-jsdoc": "40.0.1",
"eslint-plugin-simple-import-sort": "10.0.0",
"fast-glob": "3.2.12",
"husky": "8.0.3",
"lint-staged": "13.1.2",
"next": "13.2.4-canary.0",
"npm-check-updates": "16.7.10",
"next": "13.2.4",
"npm-check-updates": "16.7.12",
"prettier": "2.8.4",
"react": "18.2.0",
"react-dom": "18.2.0",
"rimraf": "4.1.3",
"rimraf": "4.4.0",
"shell-quote": "1.8.0",
"tslib": "2.5.0",
"turbo": "1.8.3",
"typescript": "5.1.0-dev.20230302",
"webpack": "5.75.0"
"typescript": "5.1.0-dev.20230310",
"webpack": "5.76.0"
}
}
Loading

0 comments on commit 7e5a838

Please sign in to comment.