106 Commits

Author SHA1 Message Date
James M. Greene
23968016b8 Merge pull request #70 from actions/dependabot/npm_and_yarn/axios-1.3.3
Bump axios from 1.3.0 to 1.3.3
2023-02-16 06:49:36 -06:00
github-actions[bot]
3d4ee3e950 Update distributables after Dependabot 🤖 2023-02-16 12:48:56 +00:00
dependabot[bot]
cdda64832d Bump axios from 1.3.0 to 1.3.3
Bumps [axios](https://github.com/axios/axios) from 1.3.0 to 1.3.3.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v1.3.0...v1.3.3)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-16 12:48:25 +00:00
James M. Greene
38eb20d0ee Merge pull request #66 from actions/dependabot/npm_and_yarn/prettier-2.8.4
Bump prettier from 2.7.1 to 2.8.4
2023-02-16 06:41:19 -06:00
dependabot[bot]
36b9431494 Bump prettier from 2.7.1 to 2.8.4
Bumps [prettier](https://github.com/prettier/prettier) from 2.7.1 to 2.8.4.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.7.1...2.8.4)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-16 12:38:21 +00:00
James M. Greene
179e061a24 Merge pull request #65 from actions/dependabot/npm_and_yarn/eslint-8.34.0
Bump eslint from 8.33.0 to 8.34.0
2023-02-16 06:37:29 -06:00
dependabot[bot]
175172ab3d Bump eslint from 8.33.0 to 8.34.0
Bumps [eslint](https://github.com/eslint/eslint) from 8.33.0 to 8.34.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.33.0...v8.34.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-16 12:36:11 +00:00
James M. Greene
685a74a557 Merge pull request #61 from actions/dependabot/npm_and_yarn/vercel/ncc-0.36.1
Bump @vercel/ncc from 0.34.0 to 0.36.1
2023-02-16 06:35:22 -06:00
dependabot[bot]
84be8935f1 Bump @vercel/ncc from 0.34.0 to 0.36.1
Bumps [@vercel/ncc](https://github.com/vercel/ncc) from 0.34.0 to 0.36.1.
- [Release notes](https://github.com/vercel/ncc/releases)
- [Commits](https://github.com/vercel/ncc/compare/0.34.0...0.36.1)

---
updated-dependencies:
- dependency-name: "@vercel/ncc"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-16 12:28:06 +00:00
James M. Greene
24bc4a64af Merge pull request #59 from actions/dependabot/npm_and_yarn/espree-9.4.1
Bump espree from 9.4.0 to 9.4.1
2023-02-16 06:27:22 -06:00
github-actions[bot]
ea72118a93 Update distributables after Dependabot 🤖 2023-02-16 12:26:05 +00:00
dependabot[bot]
f98f257726 Bump espree from 9.4.0 to 9.4.1
Bumps [espree](https://github.com/eslint/espree) from 9.4.0 to 9.4.1.
- [Release notes](https://github.com/eslint/espree/releases)
- [Changelog](https://github.com/eslint/espree/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/espree/compare/v9.4.0...v9.4.1)

---
updated-dependencies:
- dependency-name: espree
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-16 12:25:35 +00:00
James M. Greene
995b240285 Merge pull request #69 from actions/rebuild-dependabot-prs
Add workflow to rebuild Dependabot PRs
2023-02-16 06:24:14 -06:00
James M. Greene
c6c1171c00 Add workflow to rebuild Dependabot PRs 2023-02-15 19:08:30 -06:00
James M. Greene
37538b280c Merge pull request #56 from actions/dependabot/npm_and_yarn/axios-1.3.0
Bump axios from 0.27.2 to 1.3.0
2023-02-01 11:22:00 -06:00
James M. Greene
8d642d8eae Update distributables 2023-02-01 11:21:15 -06:00
dependabot[bot]
9b8d2f4ab2 Bump axios from 0.27.2 to 1.3.0
Bumps [axios](https://github.com/axios/axios) from 0.27.2 to 1.3.0.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v0.27.2...v1.3.0)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-01 17:19:53 +00:00
James M. Greene
e2f34b1f92 Merge pull request #58 from actions/dependabot/npm_and_yarn/jest-29.4.1
Bump jest from 28.1.1 to 29.4.1
2023-02-01 11:19:26 -06:00
dependabot[bot]
7aebbf763e Bump jest from 28.1.1 to 29.4.1
Bumps [jest](https://github.com/facebook/jest/tree/HEAD/packages/jest) from 28.1.1 to 29.4.1.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/commits/v29.4.1/packages/jest)

---
updated-dependencies:
- dependency-name: jest
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-01 17:18:41 +00:00
James M. Greene
6a2b91eafe Merge pull request #57 from actions/dependabot/npm_and_yarn/eslint-plugin-github-4.6.0
Bump eslint-plugin-github from 4.3.7 to 4.6.0
2023-02-01 11:17:49 -06:00
dependabot[bot]
939d05ad85 Bump eslint-plugin-github from 4.3.7 to 4.6.0
Bumps [eslint-plugin-github](https://github.com/github/eslint-plugin-github) from 4.3.7 to 4.6.0.
- [Release notes](https://github.com/github/eslint-plugin-github/releases)
- [Commits](https://github.com/github/eslint-plugin-github/compare/v4.3.7...v4.6.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-github
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-01 17:16:27 +00:00
James M. Greene
0ca1df54d4 Merge pull request #55 from actions/dependabot/npm_and_yarn/eslint-config-prettier-8.6.0
Bump eslint-config-prettier from 8.5.0 to 8.6.0
2023-02-01 11:15:11 -06:00
dependabot[bot]
5c42783e5b Bump eslint-config-prettier from 8.5.0 to 8.6.0
Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 8.5.0 to 8.6.0.
- [Release notes](https://github.com/prettier/eslint-config-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/eslint-config-prettier/compare/v8.5.0...v8.6.0)

---
updated-dependencies:
- dependency-name: eslint-config-prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-01 17:14:28 +00:00
James M. Greene
13d4de8a28 Merge pull request #54 from actions/dependabot/npm_and_yarn/eslint-8.33.0
Bump eslint from 8.23.1 to 8.33.0
2023-02-01 11:08:42 -06:00
James M. Greene
5aa8bf5ac6 Merge branch 'main' into dependabot/npm_and_yarn/eslint-8.33.0 2023-02-01 11:08:09 -06:00
James M. Greene
1d79de2fe7 Merge pull request #53 from actions/test-set-pages-config
Update tests to actually invoke the desired method instead of replicating it
2023-02-01 11:00:46 -06:00
dependabot[bot]
5a80553d12 Bump eslint from 8.23.1 to 8.33.0
Bumps [eslint](https://github.com/eslint/eslint) from 8.23.1 to 8.33.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.23.1...v8.33.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-01 17:00:40 +00:00
James M. Greene
7eb7a15548 Merge branch 'main' into test-set-pages-config 2023-02-01 11:00:11 -06:00
James M. Greene
b8c94fdc9e Merge pull request #52 from actions/dependabot-npm-updates
Add npm to Dependabot update list
2023-02-01 10:59:58 -06:00
James M. Greene
9b358e73bb Update tests to actually invoke the desired method instead of replicating it 2023-01-30 23:51:40 -06:00
James M. Greene
13e6bc7a20 Add npm to Dependabot update list 2023-01-30 22:11:54 -06:00
James M. Greene
3c444c051b Merge pull request #50 from actions/fix-enablement
Fix `enablement` logic in v3
2023-01-30 12:34:00 -06:00
James M. Greene
12fd9a085c Update distributables 2023-01-30 12:29:45 -06:00
James M. Greene
a8216d627c Fix enablement logic for v3 2023-01-30 12:29:09 -06:00
James M. Greene
5992ce8fd5 Merge pull request #48 from actions/do-not-enable-by-default
Update default behavior to NOT attempt to create/enable the Pages site
2023-01-18 15:13:37 -06:00
James M. Greene
c8deda3832 Update distributables 2023-01-18 15:03:42 -06:00
James M. Greene
5d8963e8a5 Update default behavior to NOT attempt to create/enable the Pages site 2023-01-18 15:03:22 -06:00
James M. Greene
529ba710d5 Merge pull request #47 from actions/dependabot/github_actions/actions/publish-action-0.2.2
Bump actions/publish-action from 0.2.1 to 0.2.2
2023-01-18 14:56:58 -06:00
dependabot[bot]
29e9dd5abe Bump actions/publish-action from 0.2.1 to 0.2.2
Bumps [actions/publish-action](https://github.com/actions/publish-action) from 0.2.1 to 0.2.2.
- [Release notes](https://github.com/actions/publish-action/releases)
- [Commits](https://github.com/actions/publish-action/compare/v0.2.1...v0.2.2)

---
updated-dependencies:
- dependency-name: actions/publish-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-18 20:56:23 +00:00
James M. Greene
c450a282d7 Merge pull request #45 from actions/dependabot/npm_and_yarn/json5-1.0.2
Bump json5 from 1.0.1 to 1.0.2
2023-01-18 14:55:38 -06:00
dependabot[bot]
6567d4c154 Bump json5 from 1.0.1 to 1.0.2
Bumps [json5](https://github.com/json5/json5) from 1.0.1 to 1.0.2.
- [Release notes](https://github.com/json5/json5/releases)
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
- [Commits](https://github.com/json5/json5/compare/v1.0.1...v1.0.2)

---
updated-dependencies:
- dependency-name: json5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-18 20:53:57 +00:00
James M. Greene
aba1aa6bab Merge pull request #46 from actions/dependabot-config
Add Dependabot config for Actions usage updates
2023-01-13 16:37:40 -06:00
James M. Greene
6a80311a73 Comply with Prettier expectations 2023-01-13 16:34:06 -06:00
James M. Greene
380c12d4cc Add Dependabot config for Actions usage updates 2023-01-13 15:59:46 -06:00
James M. Greene
c5a3e1159e Merge pull request #43 from actions/warn-unsupported-exts
Warn about unsupported file extensions after erring
2022-11-23 09:32:16 -06:00
James M. Greene
a069fede0c Update distributables after updating deps 2022-11-22 23:17:34 -06:00
James M. Greene
2f460cfbe0 Update distributables 2022-11-22 23:11:12 -06:00
James M. Greene
e5c1ee9f14 Reformat 2022-11-22 23:10:56 -06:00
James M. Greene
7fea7010df Minor revisions 2022-11-22 23:10:56 -06:00
James M. Greene
34521f23a5 Add warn for unsupported extensions 2022-11-22 23:10:37 -06:00
James M. Greene
d84b27279d Merge pull request #42 from actions/JamesMGreene-patch-1
Update to the latest `actions/publish-action`
2022-11-22 22:29:53 -06:00
James M. Greene
5650def507 Update to the latest actions/publish-action
To avoid Actions core deprecation messages.

https://github.com/actions/publish-action/releases/tag/v0.2.1
2022-11-22 22:29:07 -06:00
James M. Greene
0c2178e929 Merge pull request #41 from actions/alt-blank-extensions
Test: Better support alternative file extensions for blank config files
2022-11-22 21:35:02 -06:00
James M. Greene
948e60fb96 Reformat 2022-11-22 21:34:10 -06:00
James M. Greene
1305a1ba92 Better support alternative file extensions for blank config files in the tests 2022-11-22 21:30:53 -06:00
James M. Greene
b94e9adb36 Merge pull request #38 from actions/support-wrapped-exports
Support wrapped exports
2022-11-21 16:57:31 -06:00
James M. Greene
fc8c2c4e6e Update the distributables 2022-11-21 13:12:55 -06:00
James M. Greene
e978eba337 Add support for indirect config declarator in chained declaration statement 2022-11-21 13:12:45 -06:00
James M. Greene
343cb08233 Add tests for when multiple declarations are chained together 2022-11-21 12:36:09 -06:00
James M. Greene
f87a94c875 Update the distributables 2022-11-21 12:15:34 -06:00
James M. Greene
7eb40247a7 Format 2022-11-21 12:14:59 -06:00
James M. Greene
86f141f32d Add support for 'Indirect module export with a wrapping call at the export' 2022-11-21 12:12:47 -06:00
James M. Greene
76b6a8292e Small corrections 2022-11-21 12:08:39 -06:00
James M. Greene
8e221f24db Add support for 'Indirect module export with a wrapping call at the definition' 2022-11-21 12:05:26 -06:00
James M. Greene
d897860efd Add support for 'Indirect default export with a wrapping call at the export' 2022-11-21 11:34:58 -06:00
James M. Greene
24270f0cca Add support for 'Indirect default export with a wrapping call at the definition' 2022-11-21 11:04:42 -06:00
James M. Greene
0c3c14948a Merge branch 'main' into support-wrapped-exports 2022-11-18 01:02:58 -06:00
James M. Greene
b0c19d0de9 Merge pull request #37 from actions/merge-pr-33
Merge PR #33
2022-11-18 01:01:12 -06:00
James M. Greene
51323db177 Fix the Next.js tests 2022-11-18 00:57:58 -06:00
James M. Greene
3d9811d6e2 Update distributables 2022-11-18 00:56:40 -06:00
James M. Greene
9c3b6344a2 Merge branch 'main' into patch-1 2022-11-18 00:50:11 -06:00
James M. Greene
97fb35057c Add comment 2022-11-18 00:50:00 -06:00
James M. Greene
c917d1c3cd Merge pull request #35 from actions/bump-actions
Bump actions
2022-11-18 00:46:30 -06:00
James M. Greene
ffa824f004 Start making some of those tests pass 2022-11-18 00:45:01 -06:00
James M. Greene
d4a76d1ee1 Add unit tests to verify support for function-wrapped exports 2022-11-18 00:29:31 -06:00
Yoann Chaudet
bd8a5da49f Bump actions 2022-10-31 16:34:08 -07:00
Kapil Koju
5cb77813a2 Add back experimental.images.unoptimized for old NextJS 2022-10-24 23:46:06 -04:00
Kapil Koju
2094727a1b Fix nextjs images.unoptimized config path name
`images.unoptimized` is no longer in `experimental` and is stable with NextJS `v12.3.0`.
https://nextjs.org/docs/api-reference/next/image#unoptimized
2022-10-24 23:09:43 -04:00
Mingzi
d875fa8dc1 Merge pull request #31 from rentziass/rentziass/update-actions-core
Update @actions/core to 1.10.0
2022-10-06 09:56:39 -07:00
Francesco Renzi
67f329fcfd Update @actions/core to 1.10.0 2022-10-06 11:08:55 +01:00
James M. Greene
2ce6d5eaa1 Merge pull request #27 from actions/fix-readme-links
Fix non-Code links in README
2022-09-26 12:01:36 -05:00
James M. Greene
bb6976f8d1 Merge branch 'main' into fix-readme-links 2022-09-26 11:00:10 -05:00
James M. Greene
f2098a32c3 Merge pull request #26 from actions/unused-deps
Clean up some unused dependencies
2022-09-26 10:59:55 -05:00
James M. Greene
7fa35a05fd Merge branch 'main' into unused-deps 2022-09-26 10:58:37 -05:00
James M. Greene
c3113876b0 Merge pull request #25 from actions/eslint-roller
Add ESLint
2022-09-26 10:52:23 -05:00
James M. Greene
af5f3c3f72 Merge branch 'main' into eslint-roller 2022-09-21 16:18:10 -05:00
James M. Greene
ad83b485e7 Merge pull request #24 from actions/i-feel-pretty
Expand Prettier usage
2022-09-21 16:17:21 -05:00
James M. Greene
a84400a87f Fix non-Code links in README 2022-09-19 10:50:02 -05:00
James M. Greene
7a0a617c8a Remove unused dependencies 2022-09-16 23:20:01 -05:00
James M. Greene
062df390be Make ESLint fail hard on semi-colon usage 2022-09-16 23:00:18 -05:00
James M. Greene
7619de7040 Simplify ESLint ignore pattern 2022-09-16 22:55:06 -05:00
James M. Greene
66e9ac3c2e Add an 'all' script and simplify 'prepare' 2022-09-16 22:54:24 -05:00
James M. Greene
4012a9fa87 Correct Actions input parameter name 2022-09-16 22:43:42 -05:00
James M. Greene
4a12ff50fb Update distributables 2022-09-16 22:41:27 -05:00
James M. Greene
a07391ec25 Don't lint during prepare 2022-09-16 22:03:34 -05:00
James M. Greene
2491ca8488 Reformat ESLint config 2022-09-16 22:03:15 -05:00
James M. Greene
875ec87ff9 Remove stray line break 2022-09-16 22:01:13 -05:00
James M. Greene
4eadc891b5 Add Actions workflow to verify lint status 2022-09-16 21:57:04 -05:00
James M. Greene
c4feb8d01e Ignore ESLint rule about condition looping condition for now 2022-09-16 21:56:47 -05:00
James M. Greene
1f9ca39237 Fix bad reference in string interpolation
Regression from https://github.com/actions/configure-pages/pull/21
2022-09-16 21:54:58 -05:00
James M. Greene
1cefe6fc7c Remove unnecessary try/catch 2022-09-16 21:50:49 -05:00
James M. Greene
25a1ec8799 Add eslint configuration and scripts 2022-09-16 21:48:52 -05:00
James M. Greene
b9c4ac6c14 Minor workflow improvements 2022-09-16 20:48:19 -05:00
James M. Greene
6e4f93b15d Add eslint dependency and plugins 2022-09-16 20:47:23 -05:00
James M. Greene
069c984c5e Let Prettier reformat all of the things 2022-09-16 20:37:18 -05:00
James M. Greene
b030b061cb Allow prettier to check more files that it's capable of handling 2022-09-16 20:35:47 -05:00
36 changed files with 10331 additions and 4457 deletions

17
.eslintrc.json Normal file
View File

@@ -0,0 +1,17 @@
{
"env": {
"commonjs": true,
"es2021": true,
"node": true,
"jest": true
},
"plugins": ["github"],
"extends": ["eslint:recommended", "prettier", "plugin:github/internal"],
"parserOptions": {
"ecmaVersion": 12
},
"rules": {
"semi": ["error", "never"]
},
"ignorePatterns": ["/dist/", "/src/fixtures/", "/src/blank-configurations/"]
}

11
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'weekly'
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: 'weekly'

View File

@@ -1,6 +1,6 @@
---
name-template: "v$RESOLVED_VERSION"
tag-template: "v$RESOLVED_VERSION"
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
template: |
# Changelog
@@ -8,33 +8,33 @@ template: |
See details of [all code changes](https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION) since previous release.
categories:
- title: "🚀 Features"
- title: '🚀 Features'
labels:
- "feature"
- "enhancement"
- title: "🐛 Bug Fixes"
- 'feature'
- 'enhancement'
- title: '🐛 Bug Fixes'
labels:
- "fix"
- "bugfix"
- "bug"
- title: "🧰 Maintenance"
- 'fix'
- 'bugfix'
- 'bug'
- title: '🧰 Maintenance'
labels:
- "infrastructure"
- "automation"
- "documentation"
- title: "🏎 Performance"
label: "performance"
change-template: "- $TITLE @$AUTHOR (#$NUMBER)"
- 'infrastructure'
- 'automation'
- 'documentation'
- title: '🏎 Performance'
label: 'performance'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
version-resolver:
major:
labels:
- "type: breaking"
- 'type: breaking'
minor:
labels:
- "type: enhancement"
- 'type: enhancement'
patch:
labels:
- "type: bug"
- "type: maintenance"
- "type: documentation"
- 'type: bug'
- 'type: maintenance'
- 'type: documentation'
default: patch

View File

@@ -1,4 +1,4 @@
name: Checking formatting
name: Check formatting
on:
push:
@@ -17,11 +17,12 @@ concurrency:
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.JS
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x

View File

@@ -11,7 +11,7 @@ jobs:
draft-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

35
.github/workflows/lint.yml vendored Normal file
View File

@@ -0,0 +1,35 @@
name: Lint code
on:
push:
branches:
- main
pull_request:
permissions:
contents: read
# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- name: Check out repo
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: npm
- name: Install dependencies
run: npm ci
- name: Run linter
run: npm run lint:check

View File

@@ -0,0 +1,48 @@
name: Rebuild distributables for Dependabot PRs
on:
push:
branches:
- 'dependabot/npm**'
permissions:
contents: write
# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
jobs:
rebuild-dist:
if: ${{ github.event.sender.login == 'dependabot[bot]' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.PAGES_AUTOMATION_PAT }}
- name: Setup Node.JS
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Rebuild the dist/ directory
run: npm run prepare
- name: Commit any differences present in the dist/ directory
run: |
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after rebuild in dist folder. Committing..."
git add dist/
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git commit -m "Update distributables after Dependabot 🤖"
echo "Pushing branch ${{ github.ref_name }}"
git push origin ${{ github.ref_name }}
fi

View File

@@ -5,7 +5,7 @@ on:
workflow_dispatch:
inputs:
TAG_NAME:
description: "Tag name that the major tag will point to"
description: 'Tag name that the major tag will point to'
required: true
env:
@@ -24,7 +24,7 @@ jobs:
steps:
- name: Update the ${{ env.TAG_NAME }} tag
id: update-major-tag
uses: actions/publish-action@v0.1.0
uses: actions/publish-action@v0.2.2
with:
source-tag: ${{ env.TAG_NAME }}
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}

5
.prettierignore Normal file
View File

@@ -0,0 +1,5 @@
# Ignore build artifacts
/dist/
# Ignore all Markdown files
*.md

View File

@@ -26,7 +26,7 @@ The scripts and documentation in this project are released under the [MIT Licens
<!-- references -->
[starter-workflows]: https://github.com/actions/starter-workflows/tree/main/pages
[release-list]: /releases
[release-list]: https://github.com/actions/configure-pages/releases
[draft-release]: .github/workflows/draft-release.yml
[release]: .github/workflows/release.yml
[release-workflow-runs]: /actions/workflows/release.yml
[release-workflow-runs]: https://github.com/actions/configure-pages/actions/workflows/release.yml

View File

@@ -16,8 +16,8 @@ inputs:
default: ${{ github.token }}
required: true
enablement:
description: 'Should a Pages site be enabled for the repository if not so already?'
default: 'true'
description: 'Should a Pages site be enabled for the repository if not so already? This will only work with user-to-server tokens.'
default: 'false'
required: false
outputs:
base_url:

7541
dist/index.js vendored

File diff suppressed because it is too large Load Diff

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

44
dist/licenses.txt vendored
View File

@@ -110,25 +110,13 @@ SOFTWARE.
axios
MIT
Copyright (c) 2014-present Matt Zabriskie
# Copyright (c) 2014-present Matt Zabriskie & Collaborators
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
combined-stream
@@ -572,6 +560,30 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
proxy-from-env
MIT
The MIT License
Copyright (C) 2016-2018 Rob Wu <rob@robwu.nl>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
supports-color
MIT
MIT License

6475
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -5,9 +5,12 @@
"description": "A GitHub Action to enable Pages and extract various metadata about a site. It can also be used to configure various static site generators we support as starter workflows.",
"main": "./dist/index.js",
"scripts": {
"format": "prettier --write 'src/**/*.js'",
"format:check": "prettier --check 'src/**/*.js'",
"prepare": "npm run format && ncc build src/index.js -o dist --source-map --license licenses.txt",
"all": "npm run format && npm run lint && npm run prepare && npm run test",
"format": "prettier --write .",
"format:check": "prettier --check .",
"lint": "DEBUG=eslint:cli-engine eslint --fix .",
"lint:check": "DEBUG=eslint:cli-engine eslint .",
"prepare": "ncc build src/index.js -o dist --source-map --license licenses.txt",
"test": "jest"
},
"repository": {
@@ -21,15 +24,16 @@
},
"homepage": "https://github.com/actions/configure-pages#readme",
"dependencies": {
"@actions/core": "^1.9.1",
"axios": "^0.27.2",
"axios-retry": "^3.2.5",
"espree": "^9.3.2",
"string-format": "^1.0.0"
"@actions/core": "^1.10.0",
"axios": "^1.3.3",
"espree": "^9.4.1"
},
"devDependencies": {
"@vercel/ncc": "^0.34.0",
"jest": "^28.1.1",
"prettier": "^2.7.1"
"@vercel/ncc": "^0.36.1",
"eslint": "^8.34.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-github": "^4.6.0",
"jest": "^29.4.1",
"prettier": "^2.8.4"
}
}

View File

@@ -33,21 +33,17 @@ async function enablePagesSite({ repositoryNwo, githubToken }) {
}
async function getPagesSite({ repositoryNwo, githubToken }) {
try {
const pagesEndpoint = `${getApiBaseUrl()}/repos/${repositoryNwo}/pages`
const pagesEndpoint = `${getApiBaseUrl()}/repos/${repositoryNwo}/pages`
const response = await axios.get(pagesEndpoint, {
headers: {
Accept: 'application/vnd.github.v3+json',
Authorization: `Bearer ${githubToken}`
}
})
const response = await axios.get(pagesEndpoint, {
headers: {
Accept: 'application/vnd.github.v3+json',
Authorization: `Bearer ${githubToken}`
}
})
const pageObject = response.data
return pageObject
} catch (error) {
throw error
}
const pageObject = response.data
return pageObject
}
async function findOrCreatePagesSite({ repositoryNwo, githubToken, enablement = true }) {

View File

@@ -9,7 +9,7 @@ Pages's path based routing (and work).
Supported configuration initializations:
(1) Default export:
(1) Direct default export:
export default {
// configuration object here
@@ -21,19 +21,69 @@ Supported configuration initializations:
// configuration object here
}
(3) Indirect module export:
(3) Indirect default export:
const config = // configuration object here
const config = {
// configuration object here
}
export default config
(4) Indirect module export:
const config = {
// configuration object here
}
module.exports = config
(5) Direct default export with wrapping call:
export default defineConfig({
// configuration object here
})
(6) Direct module export with wrapping call:
module.exports = defineConfig({
// configuration object here
})
(7) Indirect default export with wrapping call at the definition:
const config = defineConfig({
// configuration object here
})
export default config
(8) Indirect default export with wrapping call at the export:
const config = {
// configuration object here
}
export default defineConfig(config)
(9) Indirect module export with wrapping call at the definition:
const config = defineConfig({
// configuration object here
})
module.exports = config
(10) Indirect module export with wrapping call at the export:
const config = {
// configuration object here
}
module.exports = defineConfig(config)
*/
class ConfigParser {
// Ctor
// - configurationFile: path to the configuration file
// - blankConfigurationFile: a blank configuration file to use if non was previously found
constructor({ configurationFile, blankConfigurationFile, properties }) {
constructor({ configurationFile, blankConfigurationFile, allowWrappingCall = false, properties }) {
// Save field
this.configurationFile = configurationFile
this.allowWrappingCall = allowWrappingCall === true
this.properties = properties
// If the configuration file does not exist, initialize it with the blank configuration file
@@ -49,12 +99,43 @@ class ConfigParser {
this.configuration = fs.readFileSync(this.configurationFile, 'utf8')
}
findTopLevelVariableDeclarator(ast, identifierName) {
let targetDeclarator
ast.body.find(
node =>
node.type === 'VariableDeclaration' &&
node.declarations &&
node.declarations.length > 0 &&
node.declarations.find(declarator => {
if (
declarator.type === 'VariableDeclarator' &&
declarator.id &&
declarator.id.type === 'Identifier' &&
declarator.id.name === identifierName
) {
targetDeclarator = declarator
return true
}
})
)
return targetDeclarator
}
// Find the configuration object in an AST.
// Look for a default export, a direct module export or an indirect module
// export (in that order).
// Look for, in order:
// - a direct default export
// - a direct default export with a wrapping call
// - an indirect default export
// - an indirect default export with a wrapping call at the definition
// - an indirect default export with a wrapping call at the export
// - a direct module export
// - a direct module export with a wrapping call
// - an indirect module export
// - an indirect module export with a wrapping call at the definition
// - an indirect module export with a wrapping call at the export
//
// Return the configuration object or null.
findConfigurationObject(ast) {
findConfigurationObject(ast, allowWrappingCall = false) {
// Try to find a default export
var defaultExport = ast.body.find(node => node.type === 'ExportDefaultDeclaration')
@@ -64,21 +145,61 @@ class ConfigParser {
return defaultExport.declaration
}
// Direct default export with a wrapping call
else if (
allowWrappingCall &&
defaultExport &&
defaultExport.declaration.type === 'CallExpression' &&
defaultExport.declaration.arguments.length > 0 &&
defaultExport.declaration.arguments[0] &&
defaultExport.declaration.arguments[0].type === 'ObjectExpression'
) {
core.info('Found configuration object in direct default export declaration with a wrapping call')
return defaultExport.declaration.arguments[0]
}
// Indirect default export
else if (defaultExport && defaultExport.declaration.type === 'Identifier') {
const identifierName = defaultExport.declaration.name
const identifierDefinition = ast.body.find(
node =>
node.type === 'VariableDeclaration' &&
node.declarations.length == 1 &&
node.declarations[0].type === 'VariableDeclarator' &&
node.declarations[0].id.type === 'Identifier' &&
node.declarations[0].id.name === identifierName &&
node.declarations[0].init.type === 'ObjectExpression'
)
if (identifierDefinition) {
const identifierDeclarator = this.findTopLevelVariableDeclarator(ast, identifierName)
const identifierInitialization = identifierDeclarator && identifierDeclarator.init
if (identifierInitialization && identifierInitialization.type === 'ObjectExpression') {
core.info('Found configuration object in indirect default export declaration')
return identifierDefinition.declarations[0].init
return identifierInitialization
}
// Indirect default export with a wrapping call at the definition
else if (
allowWrappingCall &&
identifierInitialization &&
identifierInitialization.type === 'CallExpression' &&
identifierInitialization.arguments.length > 0 &&
identifierInitialization.arguments[0] &&
identifierInitialization.arguments[0].type === 'ObjectExpression'
) {
core.info(
'Found configuration object in indirect default export declaration with a wrapping call at the definition'
)
return identifierInitialization.arguments[0]
}
}
// Indirect default export with a wrapping call at the export
else if (
allowWrappingCall &&
defaultExport &&
defaultExport.declaration.type === 'CallExpression' &&
defaultExport.declaration.arguments.length > 0 &&
defaultExport.declaration.arguments[0] &&
defaultExport.declaration.arguments[0].type === 'Identifier'
) {
const identifierName = defaultExport.declaration.arguments[0].name
const identifierDeclarator = this.findTopLevelVariableDeclarator(ast, identifierName)
const identifierInitialization = identifierDeclarator && identifierDeclarator.init
if (identifierInitialization && identifierInitialization.type === 'ObjectExpression') {
core.info(
'Found configuration object in indirect default export declaration with a wrapping call at the export'
)
return identifierInitialization
}
}
@@ -101,21 +222,57 @@ class ConfigParser {
return moduleExport.expression.right
}
// Direct default export with a wrapping call
else if (
allowWrappingCall &&
moduleExport &&
moduleExport.expression.right.type === 'CallExpression' &&
moduleExport.expression.right.arguments.length > 0 &&
moduleExport.expression.right.arguments[0] &&
moduleExport.expression.right.arguments[0].type === 'ObjectExpression'
) {
core.info('Found configuration object in direct module export with a wrapping call')
return moduleExport.expression.right.arguments[0]
}
// Indirect module export
else if (moduleExport && moduleExport.expression.right.type === 'Identifier') {
const identifierName = moduleExport && moduleExport.expression.right.name
const identifierDefinition = ast.body.find(
node =>
node.type === 'VariableDeclaration' &&
node.declarations.length == 1 &&
node.declarations[0].type === 'VariableDeclarator' &&
node.declarations[0].id.type === 'Identifier' &&
node.declarations[0].id.name === identifierName &&
node.declarations[0].init.type === 'ObjectExpression'
)
if (identifierDefinition) {
const identifierDeclarator = this.findTopLevelVariableDeclarator(ast, identifierName)
const identifierInitialization = identifierDeclarator && identifierDeclarator.init
if (identifierInitialization && identifierInitialization.type === 'ObjectExpression') {
core.info('Found configuration object in indirect module export')
return identifierDefinition.declarations[0].init
return identifierInitialization
}
// Indirect module export with a wrapping call at the definition
else if (
allowWrappingCall &&
identifierInitialization &&
identifierInitialization.type === 'CallExpression' &&
identifierInitialization.arguments.length > 0 &&
identifierInitialization.arguments[0] &&
identifierInitialization.arguments[0].type === 'ObjectExpression'
) {
core.info('Found configuration object in indirect module export with a wrapping call at the definition')
return identifierInitialization.arguments[0]
}
}
// Indirect module export with a wrapping call at the export
else if (
allowWrappingCall &&
moduleExport &&
moduleExport.expression.right.type === 'CallExpression' &&
moduleExport.expression.right.arguments.length > 0 &&
moduleExport.expression.right.arguments[0] &&
moduleExport.expression.right.arguments[0].type === 'Identifier'
) {
const identifierName = moduleExport.expression.right.arguments[0].name
const identifierDeclarator = this.findTopLevelVariableDeclarator(ast, identifierName)
const identifierInitialization = identifierDeclarator && identifierDeclarator.init
if (identifierInitialization && identifierInitialization.type === 'ObjectExpression') {
core.info('Found configuration object in indirect module export declaration with a wrapping call at the export')
return identifierInitialization
}
}
@@ -179,7 +336,7 @@ class ConfigParser {
const ast = espree.parse(this.configuration, espreeOptions)
// Find the configuration object
var configurationObject = this.findConfigurationObject(ast)
var configurationObject = this.findConfigurationObject(ast, this.allowWrappingCall)
if (!configurationObject) {
throw 'Could not find a configuration object in the configuration file'
}
@@ -189,6 +346,7 @@ class ConfigParser {
var depth = 0
const properties = propertyName.split('.')
var lastNode = configurationObject
// eslint-disable-next-line no-constant-condition
while (true) {
// Find the node for the current property
var propertyNode = this.findProperty(lastNode, properties[depth])

View File

@@ -10,7 +10,7 @@ const tempFolder = getTempFolder()
// Cases to test
const cases = [
//
// Default export
// Direct default export
//
{
property: 'property',
@@ -97,11 +97,13 @@ const cases = [
source: 'const config = {}; export default config',
expected: 'const config = { property: "value"}; export default config'
},
// with more than 1 declaration chained together
{
property: 'property',
source: 'var config = {}; export default config',
expected: 'var config = { property: "value"}; export default config'
source: 'var temp = {}, config = {}; export default config',
expected: 'var temp = {}, config = { property: "value"}; export default config'
},
// deeper
{
property: 'a.b.c',
source: 'var config = {}; export default config',
@@ -140,11 +142,13 @@ const cases = [
source: 'const config = {}; module.exports = config',
expected: 'const config = { property: "value"}; module.exports = config'
},
// with more than 1 declaration chained together
{
property: 'property',
source: 'var config = {}; module.exports = config',
expected: 'var config = { property: "value"}; module.exports = config'
source: 'var temp = {}, config = {}; module.exports = config',
expected: 'var temp = {}, config = { property: "value"}; module.exports = config'
},
// deeper
{
property: 'a.b.c',
source: 'var config = {}; module.exports = config',
@@ -154,6 +158,109 @@ const cases = [
property: 'a.b.c',
source: 'var config = { a: { b: [], c: "hello" } }; module.exports = config',
expected: 'var config = { a: { b: { c: "value"}, c: "hello" } }; module.exports = config'
},
//
// Direct default export with wrapping call
//
{
property: 'property',
source: 'import { defineConfig } from "astro/config"; export default defineConfig({ p1: 0 })',
expected: 'import { defineConfig } from "astro/config"; export default defineConfig({ property: "value", p1: 0 })',
allowWrappingCall: true
},
//
// Direct module exports with wrapping call
//
{
property: 'property',
source: 'const { defineConfig } = require("astro/config"); module.exports = defineConfig({ p1: 0 })',
expected:
'const { defineConfig } = require("astro/config"); module.exports = defineConfig({ property: "value", p1: 0 })',
allowWrappingCall: true
},
//
// Indirect default export with wrapping call at the definition
//
{
property: 'property',
source: 'import { defineConfig } from "astro/config"; const config = defineConfig({}); export default config',
expected:
'import { defineConfig } from "astro/config"; const config = defineConfig({ property: "value" }); export default config',
allowWrappingCall: true
},
// with more than 1 declaration chained together
{
property: 'property',
source:
'import { defineConfig } from "astro/config"; const temp = {}, config = defineConfig({}); export default config',
expected:
'import { defineConfig } from "astro/config"; const temp = {}, config = defineConfig({ property: "value" }); export default config',
allowWrappingCall: true
},
//
// Indirect default export with wrapping call at the export
//
{
property: 'property',
source: 'import { defineConfig } from "astro/config"; const config = {}; export default defineConfig(config)',
expected:
'import { defineConfig } from "astro/config"; const config = { property: "value" }; export default defineConfig(config)',
allowWrappingCall: true
},
// with more than 1 declaration chained together
{
property: 'property',
source:
'import { defineConfig } from "astro/config"; const temp = {}, config = {}; export default defineConfig(config)',
expected:
'import { defineConfig } from "astro/config"; const temp = {}, config = { property: "value" }; export default defineConfig(config)',
allowWrappingCall: true
},
//
// Indirect module exports with wrapping call at the definition
//
{
property: 'property',
source:
'const { defineConfig } = require("astro/config"); const config = defineConfig({}); module.exports = config',
expected:
'const { defineConfig } = require("astro/config"); const config = defineConfig({ property: "value"}); module.exports = config',
allowWrappingCall: true
},
// with more than 1 declaration chained together
{
property: 'property',
source:
'const { defineConfig } = require("astro/config"); const temp = {}, config = defineConfig({}); module.exports = config',
expected:
'const { defineConfig } = require("astro/config"); const temp = {}, config = defineConfig({ property: "value"}); module.exports = config',
allowWrappingCall: true
},
//
// Indirect module exports with wrapping call at the export
//
{
property: 'property',
source:
'const { defineConfig } = require("astro/config"); const config = {}; module.exports = defineConfig(config)',
expected:
'const { defineConfig } = require("astro/config"); const config = { property: "value"}; module.exports = defineConfig(config)',
allowWrappingCall: true
},
// with more than 1 declaration chained together
{
property: 'property',
source:
'const { defineConfig } = require("astro/config"); const temp = {}, config = {}; module.exports = defineConfig(config)',
expected:
'const { defineConfig } = require("astro/config"); const temp = {}, config = { property: "value"}; module.exports = defineConfig(config)',
allowWrappingCall: true
}
]
@@ -168,7 +275,7 @@ describe('config-parser', () => {
jest.spyOn(core, 'debug').mockImplementation(jest.fn())
})
cases.forEach(({ property, source, expected }, index) => {
cases.forEach(({ property, source, expected, allowWrappingCall = false }, index) => {
it(`injects path properly for case #${index}`, () => {
// Write the source file
const sourceFile = `${tempFolder}/source.js`
@@ -180,7 +287,8 @@ describe('config-parser', () => {
// Update the settings and do the injection
new ConfigParser({
configurationFile: sourceFile
configurationFile: sourceFile,
allowWrappingCall
}).inject(property, 'value')
// Compare the files

View File

@@ -7,7 +7,7 @@ function getRequiredVars() {
githubToken: core.getInput('token'),
staticSiteGenerator: core.getInput('static_site_generator'),
generatorConfigFile: core.getInput('generator_config_file'),
enablement: core.getInput('enablement') !== 'false'
enablement: core.getInput('enablement') === 'true'
}
}

View File

@@ -1,3 +1,3 @@
// Default Pages configuration for Next
const nextConfig = { experimental: { images: { unoptimized: true } }, basePath: '/docs' }
const nextConfig = { images: { unoptimized: true }, experimental: { images: { unoptimized: true } }, basePath: '/docs' }
module.exports = nextConfig

View File

@@ -1,7 +1,7 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
swcMinify: true
}
module.exports = nextConfig

View File

@@ -1,5 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
images: { unoptimized: true },
experimental: { images: { unoptimized: true } },
basePath: '/docs',
reactStrictMode: true,

View File

@@ -1,5 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
images: { unoptimized: true },
experimental: { images: { unoptimized: true } },
basePath: '/docs',
reactStrictMode: true,

View File

@@ -1,5 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
images: { unoptimized: true },
experimental: { images: { unoptimized: true } },
basePath: '/docs',
reactStrictMode: true,

View File

@@ -1,7 +1,7 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
swcMinify: true
}
export default nextConfig

View File

@@ -1,15 +1,15 @@
const getAllDynamicRoute = async function() {
const getAllDynamicRoute = async function () {
const routes = await (async () => {
return ['/posts/hello-world', '/posts/hello-again'];
})();
return routes;
};
return ['/posts/hello-world', '/posts/hello-again']
})()
return routes
}
module.exports = {
mode: 'universal',
generate: {
async routes () {
return getAllDynamicRoute();
async routes() {
return getAllDynamicRoute()
}
}
};
}

View File

@@ -1,17 +1,17 @@
const getAllDynamicRoute = async function() {
const getAllDynamicRoute = async function () {
const routes = await (async () => {
return ['/posts/hello-world', '/posts/hello-again'];
})();
return routes;
};
return ['/posts/hello-world', '/posts/hello-again']
})()
return routes
}
module.exports = {
target: 'static',
router: { base: '/docs/' },
mode: 'universal',
generate: {
async routes () {
return getAllDynamicRoute();
async routes() {
return getAllDynamicRoute()
}
}
};
}

View File

@@ -1,17 +1,17 @@
const getAllDynamicRoute = async function() {
const getAllDynamicRoute = async function () {
const routes = await (async () => {
return ['/posts/hello-world', '/posts/hello-again'];
})();
return routes;
};
return ['/posts/hello-world', '/posts/hello-again']
})()
return routes
}
export default {
target: 'static',
router: { base: '/docs/' },
mode: 'universal',
generate: {
async routes () {
return getAllDynamicRoute();
async routes() {
return getAllDynamicRoute()
}
}
};
}

View File

@@ -1,15 +1,15 @@
const getAllDynamicRoute = async function() {
const getAllDynamicRoute = async function () {
const routes = await (async () => {
return ['/posts/hello-world', '/posts/hello-again'];
})();
return routes;
};
return ['/posts/hello-world', '/posts/hello-again']
})()
return routes
}
export default {
mode: 'universal',
generate: {
async routes () {
return getAllDynamicRoute();
async routes() {
return getAllDynamicRoute()
}
}
};
}

View File

@@ -14,9 +14,7 @@ module.exports = {
{ hid: 'description', name: 'description', content: '' },
{ name: 'format-detection', content: 'telephone=no' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
]
link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }]
},
// Global CSS: https://go.nuxtjs.dev/config-css

View File

@@ -16,9 +16,7 @@ module.exports = {
{ hid: 'description', name: 'description', content: '' },
{ name: 'format-detection', content: 'telephone=no' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
]
link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }]
},
// Global CSS: https://go.nuxtjs.dev/config-css

View File

@@ -16,9 +16,7 @@ export default {
{ hid: 'description', name: 'description', content: '' },
{ name: 'format-detection', content: 'telephone=no' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
]
link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }]
},
// Global CSS: https://go.nuxtjs.dev/config-css

View File

@@ -14,9 +14,7 @@ export default {
{ hid: 'description', name: 'description', content: '' },
{ name: 'format-detection', content: 'telephone=no' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
]
link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }]
},
// Global CSS: https://go.nuxtjs.dev/config-css

View File

@@ -2,6 +2,8 @@ const core = require('@actions/core')
const { ConfigParser } = require('./config-parser')
const removeTrailingSlash = require('./remove-trailing-slash')
const SUPPORTED_FILE_EXTENSIONS = ['.js', '.cjs', '.mjs']
// Return the settings to be passed to a {ConfigParser} for a given static site generator,
// optional configuration file path, and a Pages siteUrl value to inject
function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, siteUrl }) {
@@ -34,7 +36,9 @@ function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, sit
// Disable server side image optimization too
// https://nextjs.org/docs/api-reference/next/image#unoptimized
'experimental.images.unoptimized': true
'experimental.images.unoptimized': true,
// No longer experimental as of Next.js v12.3.0
'images.unoptimized': true
}
}
case 'gatsby':
@@ -74,11 +78,22 @@ function setPagesConfig({ staticSiteGenerator, generatorConfigFile, siteUrl }) {
const settings = getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, siteUrl })
new ConfigParser(settings).injectAll()
} catch (error) {
const isSupportedFileExtension = SUPPORTED_FILE_EXTENSIONS.some(ext => generatorConfigFile.endsWith(ext))
// Logging
core.warning(
`We were unable to determine how to inject the site metadata into your config. Generated URLs may be incorrect. The base URL for this site should be ${path}. Please ensure your framework is configured to generate relative links appropriately.`,
error
)
if (!isSupportedFileExtension) {
core.warning(
`Unsupported configuration file extension. Currently supported extensions: ${SUPPORTED_FILE_EXTENSIONS.map(
ext => JSON.stringify(ext)
).join(', ')}`,
error
)
} else {
core.warning(
`We were unable to determine how to inject the site metadata into your config. Generated URLs may be incorrect. The base URL for this site should be ${siteUrl}. Please ensure your framework is configured to generate relative links appropriately.`,
error
)
}
}
}

View File

@@ -2,8 +2,7 @@ const fs = require('fs')
const path = require('path')
const core = require('@actions/core')
const { getConfigParserSettings } = require('./set-pages-config')
const { ConfigParser } = require('./config-parser')
const { setPagesConfig } = require('./set-pages-config')
const { getTempFolder, compareFiles } = require('./test-helpers')
// Get the temp folder
@@ -11,6 +10,13 @@ const tempFolder = getTempFolder()
const SUPPORTED_GENERATORS = ['next', 'nuxt', 'gatsby', 'sveltekit']
const SUPPORTED_FILE_EXTENSIONS = ['.js', '.cjs', '.mjs']
const IS_BLANK_CONFIG_FILE_REGEX = new RegExp(
'^blank\\.(' + SUPPORTED_FILE_EXTENSIONS.map(ext => ext.slice(1)).join('|') + ')$'
)
function isBlankConfigFileName(fileName) {
return IS_BLANK_CONFIG_FILE_REGEX.test(fileName)
}
// Test suite
describe('configParser', () => {
@@ -44,18 +50,18 @@ describe('configParser', () => {
// Copy the source fixture to a temp file
const fixtureSourceFile = `${fixtureFolder}/${configurationFile}`
const fixtureTargetFile = `${tempFolder}/${configurationFile}`
if (configurationFile !== 'blank.js') {
if (!isBlankConfigFileName(configurationFile)) {
fs.copyFileSync(fixtureSourceFile, fixtureTargetFile)
} else if (fs.existsSync(fixtureTargetFile)) {
fs.rmSync(fixtureTargetFile)
}
// Get settings for the static site generator
const settings = getConfigParserSettings({ staticSiteGenerator, siteUrl })
// Update the settings
settings.configurationFile = fixtureTargetFile
// Do the injection
new ConfigParser(settings).injectAll()
// Do the injections for the static site generator
setPagesConfig({
staticSiteGenerator,
generatorConfigFile: fixtureTargetFile,
siteUrl
})
// Read the expected file
const expectedFile = `${fixtureFolder}/${path.basename(
@@ -64,7 +70,7 @@ describe('configParser', () => {
)}.expected${defaultFileExtension}`
// Compare the actual and expected files
compareFiles(settings.configurationFile, expectedFile)
compareFiles(fixtureTargetFile, expectedFile)
})
})
@@ -77,22 +83,19 @@ describe('configParser', () => {
// Copy the source fixture to a temp file
const fixtureSourceFile = `${fixtureFolder}/${configurationFile}`
const fixtureTargetFile = `${tempFolder}/${configurationFile}`
if (configurationFile !== 'blank.js') {
if (!isBlankConfigFileName(configurationFile)) {
fs.copyFileSync(fixtureSourceFile, fixtureTargetFile)
} else if (fs.existsSync(fixtureTargetFile)) {
fs.rmSync(fixtureTargetFile)
}
// Get settings for the static site generator
const settings = getConfigParserSettings({
// Do the injections for the static site generator
setPagesConfig({
staticSiteGenerator,
generatorConfigFile: fixtureTargetFile,
siteUrl
})
// Do the injection
new ConfigParser(settings).injectAll()
// Read the expected file
const expectedFile = `${fixtureFolder}/${path.basename(
configurationFile,
@@ -100,7 +103,7 @@ describe('configParser', () => {
)}.expected${fileExtension}`
// Compare the actual and expected files
compareFiles(settings.configurationFile, expectedFile)
compareFiles(fixtureTargetFile, expectedFile)
})
})
})