mirror of
https://github.com/by-jp/www.byjp.me.git
synced 2025-08-09 22:16:07 +01:00
[Indiekit] Make tests pass
My previous forking from @indiekit/preset-hugo left some failing tests — this commit fixes those.
This commit is contained in:
parent
f90ecd1dcd
commit
6851285e75
5 changed files with 151 additions and 24 deletions
|
@ -1,14 +1,8 @@
|
||||||
const env = (await (
|
|
||||||
import('dotenv')
|
|
||||||
.then(dotenv => dotenv.config().parsed)
|
|
||||||
.catch(() => process.env)
|
|
||||||
)) || {};
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
application: {
|
application: {
|
||||||
name: "IndieKit byJP",
|
name: "IndieKit byJP",
|
||||||
mongodbUrl: env.MONGO_URL,
|
mongodbUrl: process.env.MONGO_URL,
|
||||||
port: env.PORT ?? 8088,
|
port: process.env.PORT ?? 8808,
|
||||||
timeZone: 'Europe/London',
|
timeZone: 'Europe/London',
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
|
@ -29,7 +23,7 @@ export default {
|
||||||
"@indiekit/post-type-reply"
|
"@indiekit/post-type-reply"
|
||||||
],
|
],
|
||||||
publication: {
|
publication: {
|
||||||
me: env.SITE,
|
me: process.env.SITE,
|
||||||
enrichPostData: true,
|
enrichPostData: true,
|
||||||
postTypes: {
|
postTypes: {
|
||||||
event: {
|
event: {
|
||||||
|
|
|
@ -5,7 +5,7 @@ const defaults = {
|
||||||
frontMatterFormat: "yaml",
|
frontMatterFormat: "yaml",
|
||||||
};
|
};
|
||||||
|
|
||||||
export default class HugoPreset {
|
export default class ByJPPreset {
|
||||||
constructor(options = {}) {
|
constructor(options = {}) {
|
||||||
this.name = "byJP preset";
|
this.name = "byJP preset";
|
||||||
this.options = { ...defaults, ...options };
|
this.options = { ...defaults, ...options };
|
||||||
|
|
129
indiekit/packages/indiekit-preset-byjp/package-lock.json
generated
Normal file
129
indiekit/packages/indiekit-preset-byjp/package-lock.json
generated
Normal file
|
@ -0,0 +1,129 @@
|
||||||
|
{
|
||||||
|
"name": "indiekit-preset-byjp",
|
||||||
|
"version": "1.0.0-beta.10-jp1",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"": {
|
||||||
|
"name": "indiekit-preset-byjp",
|
||||||
|
"version": "1.0.0-beta.10-jp1",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@iarna/toml": "^2.2.5",
|
||||||
|
"@indiekit-test/fixtures": "file:../../helpers/fixtures",
|
||||||
|
"camelcase-keys": "^9.0.0",
|
||||||
|
"plur": "^5.1.0",
|
||||||
|
"yaml": "^2.4.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=20"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"../../helpers/fixtures": {
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/@iarna/toml": {
|
||||||
|
"version": "2.2.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/@iarna/toml/-/toml-2.2.5.tgz",
|
||||||
|
"integrity": "sha512-trnsAYxU3xnS1gPHPyU961coFyLkh4gAD/0zQ5mymY4yOZ+CYvsPqUbOFSw0aDM4y0tV7tiFxL/1XfXPNC6IPg=="
|
||||||
|
},
|
||||||
|
"node_modules/@indiekit-test/fixtures": {
|
||||||
|
"resolved": "../../helpers/fixtures",
|
||||||
|
"link": true
|
||||||
|
},
|
||||||
|
"node_modules/camelcase": {
|
||||||
|
"version": "8.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-8.0.0.tgz",
|
||||||
|
"integrity": "sha512-8WB3Jcas3swSvjIeA2yvCJ+Miyz5l1ZmB6HFb9R1317dt9LCQoswg/BGrmAmkWVEszSrrg4RwmO46qIm2OEnSA==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=16"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/camelcase-keys": {
|
||||||
|
"version": "9.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-9.1.3.tgz",
|
||||||
|
"integrity": "sha512-Rircqi9ch8AnZscQcsA1C47NFdaO3wukpmIRzYcDOrmvgt78hM/sj5pZhZNec2NM12uk5vTwRHZ4anGcrC4ZTg==",
|
||||||
|
"dependencies": {
|
||||||
|
"camelcase": "^8.0.0",
|
||||||
|
"map-obj": "5.0.0",
|
||||||
|
"quick-lru": "^6.1.1",
|
||||||
|
"type-fest": "^4.3.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=16"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/irregular-plurals": {
|
||||||
|
"version": "3.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/irregular-plurals/-/irregular-plurals-3.5.0.tgz",
|
||||||
|
"integrity": "sha512-1ANGLZ+Nkv1ptFb2pa8oG8Lem4krflKuX/gINiHJHjJUKaJHk/SXk5x6K3J+39/p0h1RQ2saROclJJ+QLvETCQ==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/map-obj": {
|
||||||
|
"version": "5.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/map-obj/-/map-obj-5.0.0.tgz",
|
||||||
|
"integrity": "sha512-2L3MIgJynYrZ3TYMriLDLWocz15okFakV6J12HXvMXDHui2x/zgChzg1u9mFFGbbGWE+GsLpQByt4POb9Or+uA==",
|
||||||
|
"engines": {
|
||||||
|
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/plur": {
|
||||||
|
"version": "5.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/plur/-/plur-5.1.0.tgz",
|
||||||
|
"integrity": "sha512-VP/72JeXqak2KiOzjgKtQen5y3IZHn+9GOuLDafPv0eXa47xq0At93XahYBs26MsifCQ4enGKwbjBTKgb9QJXg==",
|
||||||
|
"dependencies": {
|
||||||
|
"irregular-plurals": "^3.3.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/quick-lru": {
|
||||||
|
"version": "6.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-6.1.2.tgz",
|
||||||
|
"integrity": "sha512-AAFUA5O1d83pIHEhJwWCq/RQcRukCkn/NSm2QsTEMle5f2hP0ChI2+3Xb051PZCkLryI/Ir1MVKviT2FIloaTQ==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/type-fest": {
|
||||||
|
"version": "4.26.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.26.1.tgz",
|
||||||
|
"integrity": "sha512-yOGpmOAL7CkKe/91I5O3gPICmJNLJ1G4zFYVAsRHg7M64biSnPtRj0WNQt++bRkjYOqjWXrhnUw1utzmVErAdg==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=16"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/yaml": {
|
||||||
|
"version": "2.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.5.1.tgz",
|
||||||
|
"integrity": "sha512-bLQOjaX/ADgQ20isPJRvF0iRUHIxVhYvr53Of7wGcWlO2jvtUlH5m87DsmulFVxRpNLOnI4tB6p/oh8D7kpn9Q==",
|
||||||
|
"bin": {
|
||||||
|
"yaml": "bin.mjs"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 14"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,18 +1,21 @@
|
||||||
{
|
{
|
||||||
"name": "indiekit-preset-byjp",
|
"name": "indiekit-preset-byjp",
|
||||||
"version": "1.0.0-beta.10",
|
"version": "1.0.0-beta.10-jp1",
|
||||||
"description": "Hugo publication preset for Indiekit",
|
"description": "Hugo publication preset for Indiekit",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"indiekit",
|
"indiekit",
|
||||||
"indiekit-plugin",
|
"indiekit-plugin",
|
||||||
"indieweb",
|
"indieweb",
|
||||||
"micropub",
|
"micropub",
|
||||||
"jekyll"
|
"hugo"
|
||||||
],
|
],
|
||||||
"homepage": "https://getindiekit.com",
|
"scripts": {
|
||||||
|
"test": "node --test --test-reporter=spec"
|
||||||
|
},
|
||||||
|
"homepage": "https://www.byjp.me",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Paul Robert Lloyd",
|
"name": "JP Hastings-Edrei",
|
||||||
"url": "https://paulrobertlloyd.com"
|
"url": "https://www.byjp.me"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
|
@ -26,16 +29,17 @@
|
||||||
"index.js"
|
"index.js"
|
||||||
],
|
],
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/getindiekit/indiekit/issues"
|
"url": "https://github.com/by-jp/www.byjp.me/issues"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/getindiekit/indiekit.git",
|
"url": "https://github.com/by-jp/www.byjp.me.git",
|
||||||
"directory": "packages/preset-hugo"
|
"directory": "indiekit/packages/indiekit-preset-byjp"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@iarna/toml": "^2.2.5",
|
"@iarna/toml": "^2.2.5",
|
||||||
"camelcase-keys": "^9.0.0",
|
"camelcase-keys": "^9.0.0",
|
||||||
|
"@indiekit-test/fixtures": "file:../../helpers/fixtures",
|
||||||
"plur": "^5.1.0",
|
"plur": "^5.1.0",
|
||||||
"yaml": "^2.4.0"
|
"yaml": "^2.4.0"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import { strict as assert } from "node:assert";
|
import { strict as assert } from "node:assert";
|
||||||
import { describe, it } from "node:test";
|
import { describe, it } from "node:test";
|
||||||
import { Indiekit } from "@indiekit/indiekit";
|
import { Indiekit } from "@indiekit/indiekit";
|
||||||
import HugoPreset from "../index.js";
|
import ByJPPreset from "../index.js";
|
||||||
|
|
||||||
describe("preset-hugo", async () => {
|
describe("preset-byjp", async () => {
|
||||||
const hugo = new HugoPreset();
|
const hugo = new ByJPPreset();
|
||||||
const indiekit = await Indiekit.initialize({
|
const indiekit = await Indiekit.initialize({
|
||||||
config: {
|
config: {
|
||||||
publication: {
|
publication: {
|
||||||
|
@ -22,12 +22,12 @@ describe("preset-hugo", async () => {
|
||||||
hugo.init(bootstrappedConfig);
|
hugo.init(bootstrappedConfig);
|
||||||
|
|
||||||
it("Initiates plug-in", async () => {
|
it("Initiates plug-in", async () => {
|
||||||
assert.equal(indiekit.publication.preset.info.name, "Hugo");
|
assert.equal(indiekit.publication.preset.info.name, "byJP");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Gets plug-in info", () => {
|
it("Gets plug-in info", () => {
|
||||||
assert.equal(hugo.name, "Hugo preset");
|
assert.equal(hugo.name, "byJP preset");
|
||||||
assert.equal(hugo.info.name, "Hugo");
|
assert.equal(hugo.info.name, "byJP");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Gets plug-in installation prompts", () => {
|
it("Gets plug-in installation prompts", () => {
|
||||||
|
|
Loading…
Reference in a new issue