14 Commits

Author SHA1 Message Date
James M. Greene
45efe60937 Apply consistent spacing and use of single quotes 2022-09-11 10:23:22 -05:00
James M. Greene
35c001ded6 Dereference as 'path'
This minimizes the changes to the codebase, as well as slightly clarifying that its value may not remain the same as the 'pathname'
2022-09-11 10:23:22 -05:00
James M. Greene
27457957e6 Merge pull request #21 from AndrewLester/ssg-origin
Use GitHub Pages site origin for setting up SSG configs
2022-09-11 10:21:18 -05:00
AndrewLester
7ec0edaa8e Fix prepare output 2022-08-19 15:10:01 -05:00
AndrewLester
d48340abcd Use GitHub Pages site origin for setting up SSG configs 2022-08-19 14:33:39 -05:00
James M. Greene
f53b57ff56 Merge pull request #20 from actions/update-major-on-full-releases
Update major version only on full releases
2022-08-19 13:21:44 -05:00
James M. Greene
6d1d650751 Update major version only on full releases 2022-08-19 12:44:16 -05:00
James M. Greene
61fd3a3cc1 Merge pull request #19 from actions/no-trailing-slashes
[BREAKING] Remove the trailing slash from `base_url` and `base_path` outputs
2022-08-19 09:27:06 -05:00
James M. Greene
0ec542a837 Update distributables 2022-08-18 18:08:52 -05:00
James M. Greene
3a90973fd3 Use local module for removing trailing slash to reduce duplication 2022-08-18 18:08:30 -05:00
James M. Greene
dc5b850bfd breaking: Remove trailing slash from base_url and base_path outputs 2022-08-18 18:08:30 -05:00
James M. Greene
9a141972ca Merge pull request #18 from actions/dependabot/npm_and_yarn/actions/core-1.9.1
Bump @actions/core from 1.8.2 to 1.9.1
2022-08-18 18:06:10 -05:00
James M. Greene
7d9bb68583 Update distributables 2022-08-18 18:04:58 -05:00
dependabot[bot]
ec022f4ae9 Bump @actions/core from 1.8.2 to 1.9.1
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.8.2 to 1.9.1.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

---
updated-dependencies:
- dependency-name: "@actions/core"
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-18 19:59:15 +00:00
33 changed files with 958 additions and 185 deletions

View File

@@ -1,7 +1,7 @@
name: Release
on:
release:
types: [published]
types: [released]
workflow_dispatch:
inputs:
TAG_NAME:

View File

@@ -2,7 +2,7 @@
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][starter-workflows].
See [`set-pages-path.js`](src/set-pages-path.js) for more details on how we configure static site generators to work "out of the box" with GitHub Pages.
See [`set-pages-config.js`](src/set-pages-config.js) for more details on how we configure static site generators to work "out of the box" with GitHub Pages.
# Usage

View File

@@ -21,10 +21,10 @@ inputs:
required: false
outputs:
base_url:
description: 'GitHub Pages site full base URL. Examples: "https://octocat.github.io/my-repo/", "https://octocat.github.io/", "https://www.example.com/"'
description: 'GitHub Pages site full base URL. Examples: "https://octocat.github.io/my-repo", "https://octocat.github.io", "https://www.example.com"'
origin:
description: 'GitHub Pages site origin. Examples: "https://octocat.github.io", "https://www.example.com"'
host:
description: 'GitHub Pages site host. Examples: "octocat.github.io", "www.example.com"'
base_path:
description: 'GitHub Pages site full base path. Examples: "/my-repo/" or "/"'
description: 'GitHub Pages site full base path. Examples: "/my-repo" or ""'

798
dist/index.js vendored
View File

@@ -140,6 +140,7 @@ const file_command_1 = __nccwpck_require__(717);
const utils_1 = __nccwpck_require__(5278);
const os = __importStar(__nccwpck_require__(2037));
const path = __importStar(__nccwpck_require__(1017));
const uuid_1 = __nccwpck_require__(5840);
const oidc_utils_1 = __nccwpck_require__(8041);
/**
* The code to exit an action
@@ -169,7 +170,14 @@ function exportVariable(name, val) {
process.env[name] = convertedVal;
const filePath = process.env['GITHUB_ENV'] || '';
if (filePath) {
const delimiter = '_GitHubActionsFileCommandDelimeter_';
const delimiter = `ghadelimiter_${uuid_1.v4()}`;
// These should realistically never happen, but just in case someone finds a way to exploit uuid generation let's not allow keys or values that contain the delimiter.
if (name.includes(delimiter)) {
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
}
if (convertedVal.includes(delimiter)) {
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
}
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
file_command_1.issueCommand('ENV', commandValue);
}
@@ -425,6 +433,13 @@ Object.defineProperty(exports, "summary", ({ enumerable: true, get: function ()
*/
var summary_2 = __nccwpck_require__(1327);
Object.defineProperty(exports, "markdownSummary", ({ enumerable: true, get: function () { return summary_2.markdownSummary; } }));
/**
* Path exports
*/
var path_utils_1 = __nccwpck_require__(2981);
Object.defineProperty(exports, "toPosixPath", ({ enumerable: true, get: function () { return path_utils_1.toPosixPath; } }));
Object.defineProperty(exports, "toWin32Path", ({ enumerable: true, get: function () { return path_utils_1.toWin32Path; } }));
Object.defineProperty(exports, "toPlatformPath", ({ enumerable: true, get: function () { return path_utils_1.toPlatformPath; } }));
//# sourceMappingURL=core.js.map
/***/ }),
@@ -562,6 +577,71 @@ exports.OidcClient = OidcClient;
/***/ }),
/***/ 2981:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.toPlatformPath = exports.toWin32Path = exports.toPosixPath = void 0;
const path = __importStar(__nccwpck_require__(1017));
/**
* toPosixPath converts the given path to the posix form. On Windows, \\ will be
* replaced with /.
*
* @param pth. Path to transform.
* @return string Posix path.
*/
function toPosixPath(pth) {
return pth.replace(/[\\]/g, '/');
}
exports.toPosixPath = toPosixPath;
/**
* toWin32Path converts the given path to the win32 form. On Linux, / will be
* replaced with \\.
*
* @param pth. Path to transform.
* @return string Win32 path.
*/
function toWin32Path(pth) {
return pth.replace(/[/]/g, '\\');
}
exports.toWin32Path = toWin32Path;
/**
* toPlatformPath converts the given path to a platform-specific path. It does
* this by replacing instances of / and \ with the platform-specific path
* separator.
*
* @param pth The path to platformize.
* @return string The platform-specific path.
*/
function toPlatformPath(pth) {
return pth.replace(/[/\\]/g, path.sep);
}
exports.toPlatformPath = toPlatformPath;
//# sourceMappingURL=path-utils.js.map
/***/ }),
/***/ 1327:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
@@ -12060,13 +12140,13 @@ module.exports = setup;
if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
module.exports = __nccwpck_require__(8222);
} else {
module.exports = __nccwpck_require__(5332);
module.exports = __nccwpck_require__(4874);
}
/***/ }),
/***/ 5332:
/***/ 4874:
/***/ ((module, exports, __nccwpck_require__) => {
/**
@@ -14423,6 +14503,652 @@ if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) {
exports.debug = debug; // for test
/***/ }),
/***/ 5840:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
Object.defineProperty(exports, "v1", ({
enumerable: true,
get: function () {
return _v.default;
}
}));
Object.defineProperty(exports, "v3", ({
enumerable: true,
get: function () {
return _v2.default;
}
}));
Object.defineProperty(exports, "v4", ({
enumerable: true,
get: function () {
return _v3.default;
}
}));
Object.defineProperty(exports, "v5", ({
enumerable: true,
get: function () {
return _v4.default;
}
}));
Object.defineProperty(exports, "NIL", ({
enumerable: true,
get: function () {
return _nil.default;
}
}));
Object.defineProperty(exports, "version", ({
enumerable: true,
get: function () {
return _version.default;
}
}));
Object.defineProperty(exports, "validate", ({
enumerable: true,
get: function () {
return _validate.default;
}
}));
Object.defineProperty(exports, "stringify", ({
enumerable: true,
get: function () {
return _stringify.default;
}
}));
Object.defineProperty(exports, "parse", ({
enumerable: true,
get: function () {
return _parse.default;
}
}));
var _v = _interopRequireDefault(__nccwpck_require__(8628));
var _v2 = _interopRequireDefault(__nccwpck_require__(6409));
var _v3 = _interopRequireDefault(__nccwpck_require__(5122));
var _v4 = _interopRequireDefault(__nccwpck_require__(9120));
var _nil = _interopRequireDefault(__nccwpck_require__(5332));
var _version = _interopRequireDefault(__nccwpck_require__(1595));
var _validate = _interopRequireDefault(__nccwpck_require__(6900));
var _stringify = _interopRequireDefault(__nccwpck_require__(8950));
var _parse = _interopRequireDefault(__nccwpck_require__(2746));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/***/ }),
/***/ 4569:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _crypto = _interopRequireDefault(__nccwpck_require__(6113));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function md5(bytes) {
if (Array.isArray(bytes)) {
bytes = Buffer.from(bytes);
} else if (typeof bytes === 'string') {
bytes = Buffer.from(bytes, 'utf8');
}
return _crypto.default.createHash('md5').update(bytes).digest();
}
var _default = md5;
exports["default"] = _default;
/***/ }),
/***/ 5332:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _default = '00000000-0000-0000-0000-000000000000';
exports["default"] = _default;
/***/ }),
/***/ 2746:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _validate = _interopRequireDefault(__nccwpck_require__(6900));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function parse(uuid) {
if (!(0, _validate.default)(uuid)) {
throw TypeError('Invalid UUID');
}
let v;
const arr = new Uint8Array(16); // Parse ########-....-....-....-............
arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;
arr[1] = v >>> 16 & 0xff;
arr[2] = v >>> 8 & 0xff;
arr[3] = v & 0xff; // Parse ........-####-....-....-............
arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;
arr[5] = v & 0xff; // Parse ........-....-####-....-............
arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;
arr[7] = v & 0xff; // Parse ........-....-....-####-............
arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;
arr[9] = v & 0xff; // Parse ........-....-....-....-############
// (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes)
arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff;
arr[11] = v / 0x100000000 & 0xff;
arr[12] = v >>> 24 & 0xff;
arr[13] = v >>> 16 & 0xff;
arr[14] = v >>> 8 & 0xff;
arr[15] = v & 0xff;
return arr;
}
var _default = parse;
exports["default"] = _default;
/***/ }),
/***/ 814:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
exports["default"] = _default;
/***/ }),
/***/ 807:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = rng;
var _crypto = _interopRequireDefault(__nccwpck_require__(6113));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const rnds8Pool = new Uint8Array(256); // # of random values to pre-allocate
let poolPtr = rnds8Pool.length;
function rng() {
if (poolPtr > rnds8Pool.length - 16) {
_crypto.default.randomFillSync(rnds8Pool);
poolPtr = 0;
}
return rnds8Pool.slice(poolPtr, poolPtr += 16);
}
/***/ }),
/***/ 5274:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _crypto = _interopRequireDefault(__nccwpck_require__(6113));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function sha1(bytes) {
if (Array.isArray(bytes)) {
bytes = Buffer.from(bytes);
} else if (typeof bytes === 'string') {
bytes = Buffer.from(bytes, 'utf8');
}
return _crypto.default.createHash('sha1').update(bytes).digest();
}
var _default = sha1;
exports["default"] = _default;
/***/ }),
/***/ 8950:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _validate = _interopRequireDefault(__nccwpck_require__(6900));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Convert array of 16 byte values to UUID string format of the form:
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
*/
const byteToHex = [];
for (let i = 0; i < 256; ++i) {
byteToHex.push((i + 0x100).toString(16).substr(1));
}
function stringify(arr, offset = 0) {
// Note: Be careful editing this code! It's been tuned for performance
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
const uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one
// of the following:
// - One or more input array values don't map to a hex octet (leading to
// "undefined" in the uuid)
// - Invalid input values for the RFC `version` or `variant` fields
if (!(0, _validate.default)(uuid)) {
throw TypeError('Stringified UUID is invalid');
}
return uuid;
}
var _default = stringify;
exports["default"] = _default;
/***/ }),
/***/ 8628:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _rng = _interopRequireDefault(__nccwpck_require__(807));
var _stringify = _interopRequireDefault(__nccwpck_require__(8950));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// **`v1()` - Generate time-based UUID**
//
// Inspired by https://github.com/LiosK/UUID.js
// and http://docs.python.org/library/uuid.html
let _nodeId;
let _clockseq; // Previous uuid creation time
let _lastMSecs = 0;
let _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details
function v1(options, buf, offset) {
let i = buf && offset || 0;
const b = buf || new Array(16);
options = options || {};
let node = options.node || _nodeId;
let clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not
// specified. We do this lazily to minimize issues related to insufficient
// system entropy. See #189
if (node == null || clockseq == null) {
const seedBytes = options.random || (options.rng || _rng.default)();
if (node == null) {
// Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];
}
if (clockseq == null) {
// Per 4.2.2, randomize (14 bit) clockseq
clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;
}
} // UUID timestamps are 100 nano-second units since the Gregorian epoch,
// (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
// time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
// (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
let msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock
// cycle to simulate higher resolution clock
let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs)
const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression
if (dt < 0 && options.clockseq === undefined) {
clockseq = clockseq + 1 & 0x3fff;
} // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
// time interval
if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
nsecs = 0;
} // Per 4.2.1.2 Throw error if too many uuids are requested
if (nsecs >= 10000) {
throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");
}
_lastMSecs = msecs;
_lastNSecs = nsecs;
_clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch
msecs += 12219292800000; // `time_low`
const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
b[i++] = tl >>> 24 & 0xff;
b[i++] = tl >>> 16 & 0xff;
b[i++] = tl >>> 8 & 0xff;
b[i++] = tl & 0xff; // `time_mid`
const tmh = msecs / 0x100000000 * 10000 & 0xfffffff;
b[i++] = tmh >>> 8 & 0xff;
b[i++] = tmh & 0xff; // `time_high_and_version`
b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low`
b[i++] = clockseq & 0xff; // `node`
for (let n = 0; n < 6; ++n) {
b[i + n] = node[n];
}
return buf || (0, _stringify.default)(b);
}
var _default = v1;
exports["default"] = _default;
/***/ }),
/***/ 6409:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _v = _interopRequireDefault(__nccwpck_require__(5998));
var _md = _interopRequireDefault(__nccwpck_require__(4569));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const v3 = (0, _v.default)('v3', 0x30, _md.default);
var _default = v3;
exports["default"] = _default;
/***/ }),
/***/ 5998:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = _default;
exports.URL = exports.DNS = void 0;
var _stringify = _interopRequireDefault(__nccwpck_require__(8950));
var _parse = _interopRequireDefault(__nccwpck_require__(2746));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function stringToBytes(str) {
str = unescape(encodeURIComponent(str)); // UTF8 escape
const bytes = [];
for (let i = 0; i < str.length; ++i) {
bytes.push(str.charCodeAt(i));
}
return bytes;
}
const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
exports.DNS = DNS;
const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
exports.URL = URL;
function _default(name, version, hashfunc) {
function generateUUID(value, namespace, buf, offset) {
if (typeof value === 'string') {
value = stringToBytes(value);
}
if (typeof namespace === 'string') {
namespace = (0, _parse.default)(namespace);
}
if (namespace.length !== 16) {
throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');
} // Compute hash of namespace and value, Per 4.3
// Future: Use spread syntax when supported on all platforms, e.g. `bytes =
// hashfunc([...namespace, ... value])`
let bytes = new Uint8Array(16 + value.length);
bytes.set(namespace);
bytes.set(value, namespace.length);
bytes = hashfunc(bytes);
bytes[6] = bytes[6] & 0x0f | version;
bytes[8] = bytes[8] & 0x3f | 0x80;
if (buf) {
offset = offset || 0;
for (let i = 0; i < 16; ++i) {
buf[offset + i] = bytes[i];
}
return buf;
}
return (0, _stringify.default)(bytes);
} // Function#name is not settable on some platforms (#270)
try {
generateUUID.name = name; // eslint-disable-next-line no-empty
} catch (err) {} // For CommonJS default export support
generateUUID.DNS = DNS;
generateUUID.URL = URL;
return generateUUID;
}
/***/ }),
/***/ 5122:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _rng = _interopRequireDefault(__nccwpck_require__(807));
var _stringify = _interopRequireDefault(__nccwpck_require__(8950));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function v4(options, buf, offset) {
options = options || {};
const rnds = options.random || (options.rng || _rng.default)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
rnds[6] = rnds[6] & 0x0f | 0x40;
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
if (buf) {
offset = offset || 0;
for (let i = 0; i < 16; ++i) {
buf[offset + i] = rnds[i];
}
return buf;
}
return (0, _stringify.default)(rnds);
}
var _default = v4;
exports["default"] = _default;
/***/ }),
/***/ 9120:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _v = _interopRequireDefault(__nccwpck_require__(5998));
var _sha = _interopRequireDefault(__nccwpck_require__(5274));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const v5 = (0, _v.default)('v5', 0x50, _sha.default);
var _default = v5;
exports["default"] = _default;
/***/ }),
/***/ 6900:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _regex = _interopRequireDefault(__nccwpck_require__(814));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function validate(uuid) {
return typeof uuid === 'string' && _regex.default.test(uuid);
}
var _default = validate;
exports["default"] = _default;
/***/ }),
/***/ 1595:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _validate = _interopRequireDefault(__nccwpck_require__(6900));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function version(uuid) {
if (!(0, _validate.default)(uuid)) {
throw TypeError('Invalid UUID');
}
return parseInt(uuid.substr(14, 1), 16);
}
var _default = version;
exports["default"] = _default;
/***/ }),
/***/ 9432:
@@ -14712,7 +15438,7 @@ class ConfigParser {
throw 'Could not find a configuration object in the configuration file'
}
// A property may be nested in the configuration file. Split the property name with `.`
// A property may be nested in the configuration file. Split the property name with '.'
// then walk the configuration object one property at a time.
var depth = 0
const properties = propertyName.split('.')
@@ -14793,7 +15519,7 @@ class ConfigParser {
}
// Logging
core.info(`Injection successful, new configuration:`)
core.info('Injection successful, new configuration:')
core.info(this.configuration)
// Finally write the new configuration in the file
@@ -14845,12 +15571,17 @@ module.exports = { getContext }
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
const core = __nccwpck_require__(2186)
const removeTrailingSlash = __nccwpck_require__(9255)
function outputPagesBaseUrl(siteUrl) {
core.setOutput('base_url', siteUrl.href)
// Many static site generators do not want the trailing slash, and it is much easier to add than remove in a workflow
const baseUrl = removeTrailingSlash(siteUrl.href)
const basePath = removeTrailingSlash(siteUrl.pathname)
core.setOutput('base_url', baseUrl)
core.setOutput('origin', siteUrl.origin)
core.setOutput('host', siteUrl.host)
core.setOutput('base_path', siteUrl.pathname)
core.setOutput('base_path', basePath)
}
module.exports = outputPagesBaseUrl
@@ -14858,15 +15589,28 @@ module.exports = outputPagesBaseUrl
/***/ }),
/***/ 4770:
/***/ 9255:
/***/ ((module) => {
module.exports = function removeTrailingSlash(str) {
return str.endsWith('/') ? str.slice(0, -1) : str
}
/***/ }),
/***/ 6310:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
const core = __nccwpck_require__(2186)
const { ConfigParser } = __nccwpck_require__(8395)
const removeTrailingSlash = __nccwpck_require__(9255)
// Return the settings to be passed to a {ConfigParser} for a given static site generator,
// optional configuration file path, and a Pages path value to inject
function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, path }) {
// optional configuration file path, and a Pages siteUrl value to inject
function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, siteUrl }) {
let { pathname: path, origin } = siteUrl
switch (staticSiteGenerator) {
case 'nuxt':
return {
@@ -14883,9 +15627,7 @@ function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, pat
}
case 'next':
// Next does not want a trailing slash
if (path.endsWith('/')) {
path = path.slice(0, -1)
}
path = removeTrailingSlash(path)
return {
configurationFile: generatorConfigFile || './next.config.js',
@@ -14905,21 +15647,23 @@ function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, pat
blankConfigurationFile: __nccwpck_require__.ab + "gatsby.js",
properties: {
// Configure a path prefix
pathPrefix: path
pathPrefix: path,
// Configure a site url
'siteMetadata.siteUrl': origin
}
}
case 'sveltekit':
// SvelteKit does not want a trailing slash
if (path.endsWith('/')) {
path = path.slice(0, -1)
}
path = removeTrailingSlash(path)
return {
configurationFile: generatorConfigFile || './svelte.config.js',
blankConfigurationFile: __nccwpck_require__.ab + "sveltekit.js",
properties: {
// Configure a base path
'kit.paths.base': path
'kit.paths.base': path,
// Configure a prerender origin
'kit.prerender.origin': origin
}
}
default:
@@ -14928,10 +15672,10 @@ function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, pat
}
// Inject Pages configuration in a given static site generator's configuration file
function setPagesPath({ staticSiteGenerator, generatorConfigFile, path }) {
function setPagesConfig({ staticSiteGenerator, generatorConfigFile, siteUrl }) {
try {
// Parse the configuration file and try to inject the Pages configuration in it
const settings = getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, path })
const settings = getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, siteUrl })
new ConfigParser(settings).injectAll()
} catch (error) {
// Logging
@@ -14942,7 +15686,7 @@ function setPagesPath({ staticSiteGenerator, generatorConfigFile, path }) {
}
}
module.exports = { getConfigParserSettings, setPagesPath }
module.exports = { getConfigParserSettings, setPagesConfig }
/***/ }),
@@ -14955,6 +15699,14 @@ module.exports = require("assert");
/***/ }),
/***/ 6113:
/***/ ((module) => {
"use strict";
module.exports = require("crypto");
/***/ }),
/***/ 2361:
/***/ ((module) => {
@@ -16429,7 +17181,7 @@ const core = __nccwpck_require__(2186)
const { getContext } = __nccwpck_require__(1319)
const { findOrCreatePagesSite } = __nccwpck_require__(9432)
const { setPagesPath } = __nccwpck_require__(4770)
const { setPagesConfig } = __nccwpck_require__(6310)
const outputPagesBaseUrl = __nccwpck_require__(7527)
async function main() {
@@ -16440,7 +17192,7 @@ async function main() {
const siteUrl = new URL(pageObject.html_url)
if (staticSiteGenerator) {
setPagesPath({ staticSiteGenerator, generatorConfigFile, path: siteUrl.pathname })
setPagesConfig({ staticSiteGenerator, generatorConfigFile, siteUrl })
}
outputPagesBaseUrl(siteUrl)
core.exportVariable('GITHUB_PAGES', 'true')

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

13
dist/licenses.txt vendored
View File

@@ -608,3 +608,16 @@ 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.
uuid
MIT
The MIT License (MIT)
Copyright (c) 2010-2020 Robert Kieffer and other contributors
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.

33
package-lock.json generated
View File

@@ -9,7 +9,7 @@
"version": "1.0.0",
"license": "MIT",
"dependencies": {
"@actions/core": "^1.8.2",
"@actions/core": "^1.9.1",
"axios": "^0.27.2",
"axios-retry": "^3.2.5",
"espree": "^9.3.2",
@@ -22,11 +22,12 @@
}
},
"node_modules/@actions/core": {
"version": "1.8.2",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.8.2.tgz",
"integrity": "sha512-FXcBL7nyik8K5ODeCKlxi+vts7torOkoDAKfeh61EAkAy1HAvwn9uVzZBY0f15YcQTcZZ2/iSGBFHEuioZWfDA==",
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.9.1.tgz",
"integrity": "sha512-5ad+U2YGrmmiw6du20AQW5XuWo7UKN2052FjSV7MX+Wfjf8sCqcsZe62NfgHys4QI4/Y+vQvLKYL8jWtA1ZBTA==",
"dependencies": {
"@actions/http-client": "^2.0.1"
"@actions/http-client": "^2.0.1",
"uuid": "^8.3.2"
}
},
"node_modules/@actions/http-client": {
@@ -3476,6 +3477,14 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/uuid": {
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
"bin": {
"uuid": "dist/bin/uuid"
}
},
"node_modules/v8-to-istanbul": {
"version": "9.0.0",
"resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.0.0.tgz",
@@ -3595,11 +3604,12 @@
},
"dependencies": {
"@actions/core": {
"version": "1.8.2",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.8.2.tgz",
"integrity": "sha512-FXcBL7nyik8K5ODeCKlxi+vts7torOkoDAKfeh61EAkAy1HAvwn9uVzZBY0f15YcQTcZZ2/iSGBFHEuioZWfDA==",
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.9.1.tgz",
"integrity": "sha512-5ad+U2YGrmmiw6du20AQW5XuWo7UKN2052FjSV7MX+Wfjf8sCqcsZe62NfgHys4QI4/Y+vQvLKYL8jWtA1ZBTA==",
"requires": {
"@actions/http-client": "^2.0.1"
"@actions/http-client": "^2.0.1",
"uuid": "^8.3.2"
}
},
"@actions/http-client": {
@@ -6207,6 +6217,11 @@
"integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==",
"dev": true
},
"uuid": {
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
},
"v8-to-istanbul": {
"version": "9.0.0",
"resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.0.0.tgz",

View File

@@ -21,7 +21,7 @@
},
"homepage": "https://github.com/actions/configure-pages#readme",
"dependencies": {
"@actions/core": "^1.8.2",
"@actions/core": "^1.9.1",
"axios": "^0.27.2",
"axios-retry": "^3.2.5",
"espree": "^9.3.2",

View File

@@ -184,7 +184,7 @@ class ConfigParser {
throw 'Could not find a configuration object in the configuration file'
}
// A property may be nested in the configuration file. Split the property name with `.`
// A property may be nested in the configuration file. Split the property name with '.'
// then walk the configuration object one property at a time.
var depth = 0
const properties = propertyName.split('.')
@@ -265,7 +265,7 @@ class ConfigParser {
}
// Logging
core.info(`Injection successful, new configuration:`)
core.info('Injection successful, new configuration:')
core.info(this.configuration)
// Finally write the new configuration in the file

View File

@@ -14,79 +14,79 @@ const cases = [
//
{
property: 'property',
source: `export default {}`,
expected: `export default { property: "value" }`
source: 'export default {}',
expected: 'export default { property: "value" }'
},
{
property: 'property',
source: `export default { property: 0 }`, // property exists and is a number
expected: `export default { property: "value" }`
source: 'export default { property: 0 }', // property exists and is a number
expected: 'export default { property: "value" }'
},
{
property: 'property',
source: `export default { property: false }`, // property exists and is a boolean
expected: `export default { property: "value" }`
source: 'export default { property: false }', // property exists and is a boolean
expected: 'export default { property: "value" }'
},
{
property: 'property',
source: `export default { property: "test" }`, // property exists and is a string
expected: `export default { property: "value" }`
source: 'export default { property: "test" }', // property exists and is a string
expected: 'export default { property: "value" }'
},
{
property: 'property',
source: `export default { property: [1,2] }`, // property exists and is an array
expected: `export default { property: "value" }`
source: 'export default { property: [1,2] }', // property exists and is an array
expected: 'export default { property: "value" }'
},
{
property: 'property',
source: `export default { property: null }`, // property exists and is null
expected: `export default { property: "value" }`
source: 'export default { property: null }', // property exists and is null
expected: 'export default { property: "value" }'
},
{
property: 'property',
source: `export default { property: {}}`, // property exists and is an object
expected: `export default { property: "value" }`
source: 'export default { property: { } }', // property exists and is an object
expected: 'export default { property: "value" }'
},
// Deep properties (injection 1)
{
property: 'property.b.c',
source: `export default {}`,
expected: `export default { property: { b: { c: "value" }}}`
source: 'export default {}',
expected: 'export default { property: { b: { c: "value" } } }'
},
{
property: 'property.b.c',
source: `export default { property: 0 }`, // property exists and is a number
expected: `export default { property: { b: { c: "value" }}}`
source: 'export default { property: 0 }', // property exists and is a number
expected: 'export default { property: { b: { c: "value" } } }'
},
{
property: 'property.b.c',
source: `export default { property: {}}`, // property exists and is an object
expected: `export default { property: { b: { c: "value" }}}`
source: 'export default { property: { } }', // property exists and is an object
expected: 'export default { property: { b: { c: "value" } } }'
},
// Deep properties (injection 2)
{
property: 'property.b.c',
source: `export default { property: { b: 0 }}`, // property exists and is a number
expected: `export default { property: { b: { c: "value" }}}`
source: 'export default { property: { b: 0 } }', // property exists and is a number
expected: 'export default { property: { b: { c: "value" } } }'
},
{
property: 'property.b.c',
source: `export default { property: { b: {}}}`, // property exists and is an object
expected: `export default { property: { b: { c: "value" }}}`
source: 'export default { property: { b: { } } }', // property exists and is an object
expected: 'export default { property: { b: { c: "value" } } }'
},
{
property: 'property.b.c',
source: `export default { property: { b: { hello: 123}}}`, // property exists and is a non-empty object
expected: `export default { property: { b: { c: "value", hello: 123 }}}`
source: 'export default { property: { b: { hello: 123 } } }', // property exists and is a non-empty object
expected: 'export default { property: { b: { c: "value", hello: 123 } } }'
},
// Deep properties (existing properties)
{
property: 'a1.a2',
source: `export default { a2: false, a1: { a3: [12]}}`, // property exists and is a non-empty object
expected: `export default { a2: false, a1: { a2: "value", a3: [12]}}`
source: 'export default { a2: false, a1: { a3: [12] } }', // property exists and is a non-empty object
expected: 'export default { a2: false, a1: { a2: "value", a3: [12] } }'
},
//
@@ -94,23 +94,23 @@ const cases = [
//
{
property: 'property',
source: `const config = {}; export default config`,
expected: `const config = { property: "value"}; export default config`
source: 'const config = {}; export default config',
expected: 'const config = { property: "value"}; export default config'
},
{
property: 'property',
source: `var config = {}; export default config`,
expected: `var config = { property: "value"}; export default config`
source: 'var config = {}; export default config',
expected: 'var config = { property: "value"}; export default config'
},
{
property: 'a.b.c',
source: `var config = {}; export default config`,
expected: `var config = { a: { b: { c: "value"}}}; export default config`
source: 'var config = {}; export default config',
expected: 'var config = { a: { b: { c: "value" } } }; export default config'
},
{
property: 'a.b.c',
source: `var config = { a: { b: [], c: "hello"}}; export default config`,
expected: `var config = { a: { b: { c: "value"}, c: "hello"}}; export default config`
source: 'var config = { a: { b: [], c: "hello" } }; export default config',
expected: 'var config = { a: { b: { c: "value"}, c: "hello" } }; export default config'
},
//
@@ -118,18 +118,18 @@ const cases = [
//
{
property: 'property',
source: `module.exports = {}`,
expected: `module.exports = { property: "value"}`
source: 'module.exports = {}',
expected: 'module.exports = { property: "value"}'
},
{
property: 'property',
source: `module.exports = { p1: 0}`,
expected: `module.exports = { property: "value", p1: 0}`
source: 'module.exports = { p1: 0}',
expected: 'module.exports = { property: "value", p1: 0}'
},
{
property: 'a.b.c',
source: `module.exports = { p1: 0}`,
expected: `module.exports = { a: { b: { c: "value" }}, p1: 0}`
source: 'module.exports = { p1: 0}',
expected: 'module.exports = { a: { b: { c: "value" } }, p1: 0}'
},
//
@@ -137,23 +137,23 @@ const cases = [
//
{
property: 'property',
source: `const config = {}; module.exports = config`,
expected: `const config = { property: "value"}; module.exports = config`
source: 'const config = {}; module.exports = config',
expected: 'const config = { property: "value"}; module.exports = config'
},
{
property: 'property',
source: `var config = {}; module.exports = config`,
expected: `var config = { property: "value"}; module.exports = config`
source: 'var config = {}; module.exports = config',
expected: 'var config = { property: "value"}; module.exports = config'
},
{
property: 'a.b.c',
source: `var config = {}; module.exports = config`,
expected: `var config = { a: { b: { c: "value"}}}; module.exports = config`
source: 'var config = {}; module.exports = config',
expected: 'var config = { a: { b: { c: "value" } } }; module.exports = config'
},
{
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`
source: 'var config = { a: { b: [], c: "hello" } }; module.exports = config',
expected: 'var config = { a: { b: { c: "value"}, c: "hello" } }; module.exports = config'
}
]

View File

@@ -1,2 +1,2 @@
// Default Pages configuration for Gatsby
module.exports = { pathPrefix: '/docs/' }
module.exports = { siteMetadata: { siteUrl: 'https://configure-pages.github.io' }, pathPrefix: '/docs/' }

View File

@@ -1,7 +1,6 @@
module.exports = {
siteMetadata: {
title: `My Gatsby Site`,
siteUrl: `https://www.yourdomain.tld`,
title: 'My Gatsby Site'
},
plugins: [],
plugins: []
}

View File

@@ -1,8 +1,8 @@
module.exports = {
pathPrefix: "/docs/",
pathPrefix: '/docs/',
siteMetadata: {
title: `My Gatsby Site`,
siteUrl: `https://www.yourdomain.tld`,
siteUrl: 'https://configure-pages.github.io',
title: 'My Gatsby Site'
},
plugins: [],
plugins: []
}

View File

@@ -1,8 +1,8 @@
module.exports = {
pathPrefix: '/docs/',
siteMetadata: {
title: `My Gatsby Site`,
siteUrl: `https://www.yourdomain.tld`
siteUrl: 'https://configure-pages.github.io',
title: 'My Gatsby Site'
},
plugins: []
}

View File

@@ -1,8 +1,8 @@
export default {
pathPrefix: "/docs/",
pathPrefix: '/docs/',
siteMetadata: {
title: `My Gatsby Site`,
siteUrl: `https://www.yourdomain.tld`,
siteUrl: 'https://configure-pages.github.io',
title: 'My Gatsby Site'
},
plugins: [],
plugins: []
}

View File

@@ -1,7 +1,6 @@
module.exports = {
siteMetadata: {
title: `My Gatsby Site`,
siteUrl: `https://www.yourdomain.tld`
title: 'My Gatsby Site'
},
plugins: []
}

View File

@@ -1,7 +1,6 @@
export default {
siteMetadata: {
title: `My Gatsby Site`,
siteUrl: `https://www.yourdomain.tld`,
title: 'My Gatsby Site'
},
plugins: [],
plugins: []
}

View File

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

View File

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

View File

@@ -7,7 +7,7 @@ const getAllDynamicRoute = async function() {
module.exports = {
target: 'static',
router: {base: '/docs/'},
router: { base: '/docs/' },
mode: 'universal',
generate: {
async routes () {

View File

@@ -7,7 +7,7 @@ const getAllDynamicRoute = async function() {
export default {
target: 'static',
router: {base: '/docs/'},
router: { base: '/docs/' },
mode: 'universal',
generate: {
async routes () {

View File

@@ -20,25 +20,20 @@ module.exports = {
},
// Global CSS: https://go.nuxtjs.dev/config-css
css: [
],
css: [],
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: [
],
plugins: [],
// Auto import components: https://go.nuxtjs.dev/config-components
components: true,
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
buildModules: [
],
buildModules: [],
// Modules: https://go.nuxtjs.dev/config-modules
modules: [
],
modules: [],
// Build Configuration: https://go.nuxtjs.dev/config-build
build: {
}
build: {}
}

View File

@@ -1,7 +1,7 @@
module.exports = {
// Disable server-side rendering: https://go.nuxtjs.dev/ssr-mode
target: 'static',
router: { base: "/docs/" },
router: { base: '/docs/' },
ssr: false,
// Global page headers: https://go.nuxtjs.dev/config-head
@@ -22,25 +22,20 @@ module.exports = {
},
// Global CSS: https://go.nuxtjs.dev/config-css
css: [
],
css: [],
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: [
],
plugins: [],
// Auto import components: https://go.nuxtjs.dev/config-components
components: true,
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
buildModules: [
],
buildModules: [],
// Modules: https://go.nuxtjs.dev/config-modules
modules: [
],
modules: [],
// Build Configuration: https://go.nuxtjs.dev/config-build
build: {
}
build: {}
}

View File

@@ -1,7 +1,7 @@
export default {
// Disable server-side rendering: https://go.nuxtjs.dev/ssr-mode
target: 'static',
router: { base: "/docs/" },
router: { base: '/docs/' },
ssr: false,
// Global page headers: https://go.nuxtjs.dev/config-head
@@ -22,25 +22,20 @@ export default {
},
// Global CSS: https://go.nuxtjs.dev/config-css
css: [
],
css: [],
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: [
],
plugins: [],
// Auto import components: https://go.nuxtjs.dev/config-components
components: true,
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
buildModules: [
],
buildModules: [],
// Modules: https://go.nuxtjs.dev/config-modules
modules: [
],
modules: [],
// Build Configuration: https://go.nuxtjs.dev/config-build
build: {
}
build: {}
}

View File

@@ -20,25 +20,20 @@ export default {
},
// Global CSS: https://go.nuxtjs.dev/config-css
css: [
],
css: [],
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: [
],
plugins: [],
// Auto import components: https://go.nuxtjs.dev/config-components
components: true,
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
buildModules: [
],
buildModules: [],
// Modules: https://go.nuxtjs.dev/config-modules
modules: [
],
modules: [],
// Build Configuration: https://go.nuxtjs.dev/config-build
build: {
}
build: {}
}

View File

@@ -3,6 +3,7 @@ import adapter from '@sveltejs/adapter-auto'
export default {
kit: {
prerender: { origin: 'https://configure-pages.github.io' },
paths: { base: '/docs' },
adapter: adapter()
}

View File

@@ -3,6 +3,7 @@ import adapter from '@sveltejs/adapter-auto'
/** @type {import('@sveltejs/kit').Config} */
const config = {
kit: {
prerender: { origin: 'https://configure-pages.github.io' },
paths: { base: '/docs' },
adapter: adapter()
}

View File

@@ -4,7 +4,7 @@ const core = require('@actions/core')
const { getContext } = require('./context')
const { findOrCreatePagesSite } = require('./api-client')
const { setPagesPath } = require('./set-pages-path')
const { setPagesConfig } = require('./set-pages-config')
const outputPagesBaseUrl = require('./output-pages-base-url')
async function main() {
@@ -15,7 +15,7 @@ async function main() {
const siteUrl = new URL(pageObject.html_url)
if (staticSiteGenerator) {
setPagesPath({ staticSiteGenerator, generatorConfigFile, path: siteUrl.pathname })
setPagesConfig({ staticSiteGenerator, generatorConfigFile, siteUrl })
}
outputPagesBaseUrl(siteUrl)
core.exportVariable('GITHUB_PAGES', 'true')

View File

@@ -1,10 +1,15 @@
const core = require('@actions/core')
const removeTrailingSlash = require('./remove-trailing-slash')
function outputPagesBaseUrl(siteUrl) {
core.setOutput('base_url', siteUrl.href)
// Many static site generators do not want the trailing slash, and it is much easier to add than remove in a workflow
const baseUrl = removeTrailingSlash(siteUrl.href)
const basePath = removeTrailingSlash(siteUrl.pathname)
core.setOutput('base_url', baseUrl)
core.setOutput('origin', siteUrl.origin)
core.setOutput('host', siteUrl.host)
core.setOutput('base_path', siteUrl.pathname)
core.setOutput('base_path', basePath)
}
module.exports = outputPagesBaseUrl

View File

@@ -23,10 +23,10 @@ describe('outputPagesBaseUrl', () => {
outputPagesBaseUrl(new URL(baseUrl))
expect(core.setOutput).toHaveBeenCalledWith('base_url', baseUrl)
expect(core.setOutput).toHaveBeenCalledWith('base_url', 'https://octocat.github.io')
expect(core.setOutput).toHaveBeenCalledWith('origin', 'https://octocat.github.io')
expect(core.setOutput).toHaveBeenCalledWith('host', 'octocat.github.io')
expect(core.setOutput).toHaveBeenCalledWith('base_path', '/')
expect(core.setOutput).toHaveBeenCalledWith('base_path', '')
})
it('gets expected outputs for project site', async () => {
@@ -34,10 +34,10 @@ describe('outputPagesBaseUrl', () => {
outputPagesBaseUrl(new URL(baseUrl))
expect(core.setOutput).toHaveBeenCalledWith('base_url', baseUrl)
expect(core.setOutput).toHaveBeenCalledWith('base_url', 'https://octocat.github.io/my-repo')
expect(core.setOutput).toHaveBeenCalledWith('origin', 'https://octocat.github.io')
expect(core.setOutput).toHaveBeenCalledWith('host', 'octocat.github.io')
expect(core.setOutput).toHaveBeenCalledWith('base_path', '/my-repo/')
expect(core.setOutput).toHaveBeenCalledWith('base_path', '/my-repo')
})
it('gets expected outputs for site with custom domain name', async () => {
@@ -45,9 +45,9 @@ describe('outputPagesBaseUrl', () => {
outputPagesBaseUrl(new URL(baseUrl))
expect(core.setOutput).toHaveBeenCalledWith('base_url', baseUrl)
expect(core.setOutput).toHaveBeenCalledWith('base_url', 'https://www.example.com')
expect(core.setOutput).toHaveBeenCalledWith('origin', 'https://www.example.com')
expect(core.setOutput).toHaveBeenCalledWith('host', 'www.example.com')
expect(core.setOutput).toHaveBeenCalledWith('base_path', '/')
expect(core.setOutput).toHaveBeenCalledWith('base_path', '')
})
})

View File

@@ -0,0 +1,3 @@
module.exports = function removeTrailingSlash(str) {
return str.endsWith('/') ? str.slice(0, -1) : str
}

View File

@@ -1,9 +1,12 @@
const core = require('@actions/core')
const { ConfigParser } = require('./config-parser')
const removeTrailingSlash = require('./remove-trailing-slash')
// Return the settings to be passed to a {ConfigParser} for a given static site generator,
// optional configuration file path, and a Pages path value to inject
function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, path }) {
// optional configuration file path, and a Pages siteUrl value to inject
function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, siteUrl }) {
let { pathname: path, origin } = siteUrl
switch (staticSiteGenerator) {
case 'nuxt':
return {
@@ -20,9 +23,7 @@ function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, pat
}
case 'next':
// Next does not want a trailing slash
if (path.endsWith('/')) {
path = path.slice(0, -1)
}
path = removeTrailingSlash(path)
return {
configurationFile: generatorConfigFile || './next.config.js',
@@ -42,21 +43,23 @@ function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, pat
blankConfigurationFile: `${__dirname}/blank-configurations/gatsby.js`,
properties: {
// Configure a path prefix
pathPrefix: path
pathPrefix: path,
// Configure a site url
'siteMetadata.siteUrl': origin
}
}
case 'sveltekit':
// SvelteKit does not want a trailing slash
if (path.endsWith('/')) {
path = path.slice(0, -1)
}
path = removeTrailingSlash(path)
return {
configurationFile: generatorConfigFile || './svelte.config.js',
blankConfigurationFile: `${__dirname}/blank-configurations/sveltekit.js`,
properties: {
// Configure a base path
'kit.paths.base': path
'kit.paths.base': path,
// Configure a prerender origin
'kit.prerender.origin': origin
}
}
default:
@@ -65,10 +68,10 @@ function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, pat
}
// Inject Pages configuration in a given static site generator's configuration file
function setPagesPath({ staticSiteGenerator, generatorConfigFile, path }) {
function setPagesConfig({ staticSiteGenerator, generatorConfigFile, siteUrl }) {
try {
// Parse the configuration file and try to inject the Pages configuration in it
const settings = getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, path })
const settings = getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, siteUrl })
new ConfigParser(settings).injectAll()
} catch (error) {
// Logging
@@ -79,4 +82,4 @@ function setPagesPath({ staticSiteGenerator, generatorConfigFile, path }) {
}
}
module.exports = { getConfigParserSettings, setPagesPath }
module.exports = { getConfigParserSettings, setPagesConfig }

View File

@@ -2,7 +2,7 @@ const fs = require('fs')
const path = require('path')
const core = require('@actions/core')
const { getConfigParserSettings } = require('./set-pages-path')
const { getConfigParserSettings } = require('./set-pages-config')
const { ConfigParser } = require('./config-parser')
const { getTempFolder, compareFiles } = require('./test-helpers')
@@ -32,6 +32,9 @@ describe('configParser', () => {
// Get fixture files, excluding expected results
const configurationFiles = fs.readdirSync(fixtureFolder).filter(filename => !filename.includes('.expected.'))
// Create test siteUrl
const siteUrl = new URL('https://configure-pages.github.io/docs/')
// Iterate over the fixtures, outputting to default configuration file path
const defaultFileExtension = '.js'
configurationFiles
@@ -48,7 +51,7 @@ describe('configParser', () => {
}
// Get settings for the static site generator
const settings = getConfigParserSettings({ staticSiteGenerator, path: '/docs/' })
const settings = getConfigParserSettings({ staticSiteGenerator, siteUrl })
// Update the settings
settings.configurationFile = fixtureTargetFile
// Do the injection
@@ -84,7 +87,7 @@ describe('configParser', () => {
const settings = getConfigParserSettings({
staticSiteGenerator,
generatorConfigFile: fixtureTargetFile,
path: '/docs/'
siteUrl
})
// Do the injection