You've already forked hugo-extended
mirror of
https://github.com/jakejarvis/hugo-extended.git
synced 2026-06-12 06:25:27 -04:00
Switch to xo for linting
This commit is contained in:
+2
-2
@@ -11,7 +11,7 @@ const { hugoVersion } = JSON.parse(await fs.readFile(pkg));
|
|||||||
const destDir = path.join(fileURLToPath(new URL('../vendor/', import.meta.url)));
|
const destDir = path.join(fileURLToPath(new URL('../vendor/', import.meta.url)));
|
||||||
const binName = process.platform === 'win32' ? 'hugo.exe' : 'hugo';
|
const binName = process.platform === 'win32' ? 'hugo.exe' : 'hugo';
|
||||||
|
|
||||||
const extendedBin = (baseDownloadUrl) => new BinWrapper()
|
const extendedBin = baseDownloadUrl => new BinWrapper()
|
||||||
.src(`${baseDownloadUrl}hugo_extended_${hugoVersion}_darwin-universal.tar.gz`, 'darwin', 'arm64')
|
.src(`${baseDownloadUrl}hugo_extended_${hugoVersion}_darwin-universal.tar.gz`, 'darwin', 'arm64')
|
||||||
.src(`${baseDownloadUrl}hugo_extended_${hugoVersion}_darwin-universal.tar.gz`, 'darwin', 'x64')
|
.src(`${baseDownloadUrl}hugo_extended_${hugoVersion}_darwin-universal.tar.gz`, 'darwin', 'x64')
|
||||||
.src(`${baseDownloadUrl}hugo_extended_${hugoVersion}_linux-amd64.tar.gz`, 'linux', 'x64')
|
.src(`${baseDownloadUrl}hugo_extended_${hugoVersion}_linux-amd64.tar.gz`, 'linux', 'x64')
|
||||||
@@ -27,7 +27,7 @@ const extendedBin = (baseDownloadUrl) => new BinWrapper()
|
|||||||
.dest(destDir)
|
.dest(destDir)
|
||||||
.use(binName);
|
.use(binName);
|
||||||
|
|
||||||
const normalBin = (baseDownloadUrl) => new BinWrapper()
|
const normalBin = baseDownloadUrl => new BinWrapper()
|
||||||
.src(`${baseDownloadUrl}hugo_${hugoVersion}_darwin-universal.tar.gz`, 'darwin', 'arm64')
|
.src(`${baseDownloadUrl}hugo_${hugoVersion}_darwin-universal.tar.gz`, 'darwin', 'arm64')
|
||||||
.src(`${baseDownloadUrl}hugo_${hugoVersion}_darwin-universal.tar.gz`, 'darwin', 'x64')
|
.src(`${baseDownloadUrl}hugo_${hugoVersion}_darwin-universal.tar.gz`, 'darwin', 'x64')
|
||||||
.src(`${baseDownloadUrl}hugo_${hugoVersion}_dragonfly-amd64.tar.gz`, 'dragonflybsd', 'x64')
|
.src(`${baseDownloadUrl}hugo_${hugoVersion}_dragonfly-amd64.tar.gz`, 'dragonflybsd', 'x64')
|
||||||
|
|||||||
Generated
+8290
-2
File diff suppressed because it is too large
Load Diff
+35
-4
@@ -35,12 +35,12 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"bin-check": "^4.1.0",
|
"bin-check": "^4.1.0",
|
||||||
"eslint": "^8.40.0",
|
"uvu": "^0.5.6",
|
||||||
"uvu": "^0.5.6"
|
"xo": "^0.54.2"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "eslint .",
|
"lint": "xo",
|
||||||
"fix": "npm run lint -- --fix",
|
"fix": "xo --fix",
|
||||||
"uvu": "uvu test",
|
"uvu": "uvu test",
|
||||||
"test": "npm run lint && npm run uvu",
|
"test": "npm run lint && npm run uvu",
|
||||||
"postinstall": "node lib/install.js"
|
"postinstall": "node lib/install.js"
|
||||||
@@ -52,5 +52,36 @@
|
|||||||
],
|
],
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^14.14.0 || >=16.0.0"
|
"node": "^14.14.0 || >=16.0.0"
|
||||||
|
},
|
||||||
|
"xo": {
|
||||||
|
"space": true,
|
||||||
|
"rules": {
|
||||||
|
"arrow-body-style": "off",
|
||||||
|
"camelcase": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"properties": "never"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"capitalized-comments": "off",
|
||||||
|
"comma-dangle": [
|
||||||
|
"error",
|
||||||
|
"never"
|
||||||
|
],
|
||||||
|
"operator-linebreak": [
|
||||||
|
"error",
|
||||||
|
"after"
|
||||||
|
],
|
||||||
|
"object-curly-spacing": [
|
||||||
|
"error",
|
||||||
|
"always"
|
||||||
|
],
|
||||||
|
"space-before-function-paren": [
|
||||||
|
"error",
|
||||||
|
"never"
|
||||||
|
],
|
||||||
|
"unicorn/prefer-top-level-await": "off",
|
||||||
|
"unicorn/prevent-abbreviations": "off"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-17
@@ -1,13 +1,13 @@
|
|||||||
import process from 'node:process';
|
import process from 'node:process';
|
||||||
import binCheck from 'bin-check';
|
import binCheck from 'bin-check';
|
||||||
import { suite } from 'uvu';
|
import { suite } from 'uvu';
|
||||||
import * as assert from 'uvu/assert';
|
import * as assert from 'uvu/assert'; // eslint-disable-line n/file-extension-in-import
|
||||||
import hugoBin from '../index.js';
|
import hugoBin from '../index.js';
|
||||||
import hugoLib from '../lib/index.js';
|
import hugoLib from '../lib/index.js';
|
||||||
|
|
||||||
const worksSuite = suite('works');
|
const worksSuite = suite('works');
|
||||||
|
|
||||||
worksSuite('should return path to binary and work', async () => {
|
worksSuite('should return path to binary and work', async() => {
|
||||||
const works = await binCheck(hugoBin, ['version']);
|
const works = await binCheck(hugoBin, ['version']);
|
||||||
assert.is(works, true);
|
assert.is(works, true);
|
||||||
});
|
});
|
||||||
@@ -17,7 +17,6 @@ worksSuite.run();
|
|||||||
/**
|
/**
|
||||||
* Verify Custom/Enterprise Repository overwrite.
|
* Verify Custom/Enterprise Repository overwrite.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const customRepoSuite = suite('overwrites download repository');
|
const customRepoSuite = suite('overwrites download repository');
|
||||||
|
|
||||||
customRepoSuite.before.each(() => {
|
customRepoSuite.before.each(() => {
|
||||||
@@ -32,30 +31,29 @@ customRepoSuite('verify test env', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Default Repository - Test Cases
|
// Default Repository - Test Cases
|
||||||
|
customRepoSuite('should return default repository url - Repository: default - Extended: undefined', async() => {
|
||||||
customRepoSuite('should return default repository url - Repository: default - Extended: undefined', async () => {
|
|
||||||
const lib = await hugoLib(process.cwd());
|
const lib = await hugoLib(process.cwd());
|
||||||
const repoSources = lib._src.map((v) => v.url);
|
const repoSources = lib._src.map(v => v.url);
|
||||||
|
|
||||||
for (const sourceUrl of repoSources) {
|
for (const sourceUrl of repoSources) {
|
||||||
assert.is(sourceUrl.startsWith('https://github.com/'), true);
|
assert.is(sourceUrl.startsWith('https://github.com/'), true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
customRepoSuite('should return default repository url - Repository: default - Extended: empty', async () => {
|
customRepoSuite('should return default repository url - Repository: default - Extended: empty', async() => {
|
||||||
process.env.npm_config_hugo_bin_build_tags = '';
|
process.env.npm_config_hugo_bin_build_tags = '';
|
||||||
const lib = await hugoLib(process.cwd());
|
const lib = await hugoLib(process.cwd());
|
||||||
const repoSources = lib._src.map((v) => v.url);
|
const repoSources = lib._src.map(v => v.url);
|
||||||
|
|
||||||
for (const sourceUrl of repoSources) {
|
for (const sourceUrl of repoSources) {
|
||||||
assert.is(sourceUrl.startsWith('https://github.com/'), true);
|
assert.is(sourceUrl.startsWith('https://github.com/'), true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
customRepoSuite('should return default repository url - Repository: default - Extended: extended', async () => {
|
customRepoSuite('should return default repository url - Repository: default - Extended: extended', async() => {
|
||||||
process.env.npm_config_hugo_bin_build_tags = 'extended';
|
process.env.npm_config_hugo_bin_build_tags = 'extended';
|
||||||
const lib = await hugoLib(process.cwd());
|
const lib = await hugoLib(process.cwd());
|
||||||
const repoSources = lib._src.map((v) => v.url);
|
const repoSources = lib._src.map(v => v.url);
|
||||||
|
|
||||||
for (const sourceUrl of repoSources) {
|
for (const sourceUrl of repoSources) {
|
||||||
assert.is(sourceUrl.startsWith('https://github.com/'), true);
|
assert.is(sourceUrl.startsWith('https://github.com/'), true);
|
||||||
@@ -63,33 +61,32 @@ customRepoSuite('should return default repository url - Repository: default - Ex
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Custom/Enterprise Repository Test Cases
|
// Custom/Enterprise Repository Test Cases
|
||||||
|
customRepoSuite('should return custom repository url - Repository: custom - Extended: undefined', async() => {
|
||||||
customRepoSuite('should return custom repository url - Repository: custom - Extended: undefined', async () => {
|
|
||||||
process.env.npm_config_hugo_bin_download_repo = 'https://some1.example.com';
|
process.env.npm_config_hugo_bin_download_repo = 'https://some1.example.com';
|
||||||
const lib = await hugoLib(process.cwd());
|
const lib = await hugoLib(process.cwd());
|
||||||
const repoSources = lib._src.map((v) => v.url);
|
const repoSources = lib._src.map(v => v.url);
|
||||||
|
|
||||||
for (const sourceUrl of repoSources) {
|
for (const sourceUrl of repoSources) {
|
||||||
assert.is(sourceUrl.startsWith('https://some1.example.com/'), true);
|
assert.is(sourceUrl.startsWith('https://some1.example.com/'), true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
customRepoSuite('should return custom repository url - Repository: custom - Extended: empty', async () => {
|
customRepoSuite('should return custom repository url - Repository: custom - Extended: empty', async() => {
|
||||||
process.env.npm_config_hugo_bin_build_tags = '';
|
process.env.npm_config_hugo_bin_build_tags = '';
|
||||||
process.env.npm_config_hugo_bin_download_repo = 'https://some2.example.com';
|
process.env.npm_config_hugo_bin_download_repo = 'https://some2.example.com';
|
||||||
const lib = await hugoLib(process.cwd());
|
const lib = await hugoLib(process.cwd());
|
||||||
const repoSources = lib._src.map((v) => v.url);
|
const repoSources = lib._src.map(v => v.url);
|
||||||
|
|
||||||
for (const sourceUrl of repoSources) {
|
for (const sourceUrl of repoSources) {
|
||||||
assert.is(sourceUrl.startsWith('https://some2.example.com/'), true);
|
assert.is(sourceUrl.startsWith('https://some2.example.com/'), true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
customRepoSuite('should return custom repository url - Repository: custom - Extended: extended', async () => {
|
customRepoSuite('should return custom repository url - Repository: custom - Extended: extended', async() => {
|
||||||
process.env.npm_config_hugo_bin_build_tags = 'extended';
|
process.env.npm_config_hugo_bin_build_tags = 'extended';
|
||||||
process.env.npm_config_hugo_bin_download_repo = 'https://some3.example.com';
|
process.env.npm_config_hugo_bin_download_repo = 'https://some3.example.com';
|
||||||
const lib = await hugoLib(process.cwd());
|
const lib = await hugoLib(process.cwd());
|
||||||
const repoSources = lib._src.map((v) => v.url);
|
const repoSources = lib._src.map(v => v.url);
|
||||||
|
|
||||||
for (const sourceUrl of repoSources) {
|
for (const sourceUrl of repoSources) {
|
||||||
assert.is(sourceUrl.startsWith('https://some3.example.com/'), true);
|
assert.is(sourceUrl.startsWith('https://some3.example.com/'), true);
|
||||||
|
|||||||
Reference in New Issue
Block a user