Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.js
*.mjs
/package-lock.json
/node_modules/
/local/
54 changes: 26 additions & 28 deletions build-assets.mjs
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
#!/usr/bin/env node

import * as esbuild from 'esbuild'
import {
lessLoader
}
from 'esbuild-plugin-less';
import * as esbuild from 'esbuild';
import { lessLoader } from 'esbuild-plugin-less';
import {
writeFile,
opendir,
unlink
}
from 'node:fs/promises';
unlink,
} from 'node:fs/promises';
import console from 'node:console';
import process from 'node:process';
import path from 'node:path';
import parseArgs from 'minimist';

Expand All @@ -21,16 +19,16 @@ const config = {
],
assetNames: '[name]-[hash]',
entryNames: '[name]-[hash]',
format: 'esm',
outdir: 'root/assets',
bundle: true,
sourcemap: true,
inject: ['root/static/js/inject.mjs'],
loader: {
'.eot': 'file',
'.svg': 'file',
'.ttf': 'file',
'.woff': 'file',
format: 'esm',
outdir: 'root/assets',
bundle: true,
sourcemap: true,
inject: ['root/static/js/inject.mjs'],
loader: {
'.eot': 'file',
'.svg': 'file',
'.ttf': 'file',
'.woff': 'file',
'.woff2': 'file',
},
plugins: [
Expand All @@ -40,18 +38,18 @@ const config = {

setup(build) {
build.onResolve({
filter: /^\//
},
() => ({
external: true
}),
filter: /^\//,
},
() => ({
external: true,
}),
);

build.initialOptions.metafile = true;
build.onStart(() => {
console.log('building assets...')
console.log('building assets...');
});
build.onEnd(async result => {
build.onEnd(async (result) => {
const outputs = result?.metafile?.outputs;
if (outputs) {
const files = Object.keys(outputs).sort()
Expand All @@ -70,7 +68,7 @@ const config = {
}
});
}
},
}(),
],
};

Expand All @@ -86,7 +84,7 @@ if (args.minify) {
}
if (args.clean) {
for await (const file of await opendir(config.outdir, {
withFileTypes: true
withFileTypes: true,
})) {
const filePath = path.join(file.parentPath, file.name);
if (file.name.match(/^\./)) {
Expand All @@ -105,7 +103,7 @@ if (args.clean) {
const ctx = await esbuild.context(config);
if (args.watch) {
await ctx.watch();
const sig = await new Promise(resolve => {
const sig = await new Promise((resolve) => {
[
'SIGTERM',
'SIGQUIT',
Expand Down
44 changes: 28 additions & 16 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,31 +1,43 @@
import globals from "globals";
import pluginJs from "@eslint/js";
import globals from 'globals';
import stylistic from '@stylistic/eslint-plugin';
import js from '@eslint/js';

export default [{
ignores: ["root/assets/"],
},
export default [
{
languageOptions: {
globals: globals.browser,
}
ignores: ['root/assets/'],
},
{
files: ['build-assets.mjs'],
files: ['**/*.mjs'],
languageOptions: {
globals: globals.nodeBuiltin,
sourceType: 'module',
},
},
{
files: ['**/*.js'],
files: ['**/*.js'],
languageOptions: {
sourceType: 'commonjs',
}
},
},
{
files: ['**/*.mjs'],
files: ['root/**/*.mjs', 'root/**/*.js'],
languageOptions: {
sourceType: 'module',
}
globals: globals.browser,
},
},
js.configs.recommended,
stylistic.configs.customize({
semi: true,
}),
{
rules: {
'@stylistic/indent': ['error', 4],
'@stylistic/multiline-ternary': 'off',
'@stylistic/key-spacing': [
'error',
{
align: 'value',
},
],
},
},
pluginJs.configs.recommended,
];
5 changes: 2 additions & 3 deletions lib/MetaCPAN/Web/Controller/Feed.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ use namespace::autoclean;

BEGIN { extends 'MetaCPAN::Web::Controller' }

use DateTime ();
use HTML::Escape qw( escape_html );
use MetaCPAN::Web::RenderUtil qw( render_markdown );
use DateTime ();
use HTML::Escape qw( escape_html );
use MetaCPAN::Web::Types qw( ArrayRef DateTime Enum HashRef Str Undef Uri );
use Params::ValidationCompiler qw( validation_for );
use XML::FeedPP (); ## no perlimports
Expand Down
Loading
Loading