Skip to content
Merged
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
37 changes: 0 additions & 37 deletions .eslintrc

This file was deleted.

40 changes: 40 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/* eslint-disable import/no-commonjs */

/**
* @type {import('eslint').Linter.Config}
*/
const config = {
extends: ['algolia', 'algolia/jest'],
rules: {
'no-continue': 'off',
'valid-jsdoc': 'off',
'require-await': 'off',
},
overrides: [
{
files: ['**/*.ts'],
extends: ['algolia/typescript'],
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module',
project: './tsconfig.json',
},
rules: {
'consistent-return': 'off',
'no-dupe-class-members': 'off',
'import/extensions': [
'error',
{
ignorePackages: true,
pattern: {
js: 'always',
ts: 'never',
},
},
],
},
},
],
};

module.exports = config;
2 changes: 1 addition & 1 deletion elastic-apm-node.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable import/no-commonjs, @typescript-eslint/no-var-requires */
/* eslint-disable import/no-commonjs */
module.exports = {
active: true,
serviceName: 'jsdelivr-npm-search',
Expand Down
19 changes: 12 additions & 7 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
// eslint-disable-next-line import/no-commonjs
module.exports = {
transform: {
'^.+\\.[jt]sx?$': 'ts-jest',
'^.+\\.[jt]sx?$': [
'ts-jest',
{
diagnostics: false,
tsconfig: `tsconfig.json`,
},
],
},
testMatch: ['<rootDir>/src/**/*.test.[jt]s'],
// By default, ignore the slow and flaky tests testing external APIs. Those
// will be run specifically with `yarn run test:api-control`
testPathIgnorePatterns: ['api-control'],
globals: {
'ts-jest': {
diagnostics: false,
tsconfig: `tsconfig.json`,
},
},

testEnvironment: 'node',
modulePaths: ['src'],

snapshotFormat: {
escapeString: true,
printBasicPrototype: true,
},
};
36 changes: 18 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,47 +42,47 @@
"nano": "^10.1.2",
"nice-package": "3.1.2",
"numeral": "2.0.6",
"object-sizeof": "1.6.3",
"object-sizeof": "2.6.3",
"p-queue": "6.6.2",
"promise-rat-race": "1.5.1",
"throttled-queue": "^2.1.4",
"traverse": "0.6.6",
"traverse": "0.6.7",
"truncate-utf8-bytes": "1.0.2"
},
"devDependencies": {
"@semantic-release/changelog": "6.0.1",
"@semantic-release/changelog": "6.0.3",
"@semantic-release/git": "10.0.1",
"@types/escape-html": "1.0.2",
"@types/hosted-git-info": "3.0.2",
"@types/jest": "28.1.7",
"@types/escape-html": "1.0.3",
"@types/hosted-git-info": "3.0.4",
"@types/jest": "28.1.8",
"@types/lodash": "4.14.184",
"@types/ms": "0.7.31",
"@types/ms": "0.7.33",
"@types/numeral": "2.0.2",
"@types/traverse": "0.6.32",
"@types/traverse": "0.6.34",
"@types/truncate-utf8-bytes": "1.0.0",
"@typescript-eslint/eslint-plugin": "5.33.1",
"@typescript-eslint/parser": "5.33.1",
"@typescript-eslint/eslint-plugin": "6.9.0",
"@typescript-eslint/parser": "6.9.0",
"dotenv": "16.0.1",
"eslint": "8.22.0",
"eslint-config-algolia": "20.0.0",
"eslint-config-algolia": "22.0.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-eslint-comments": "3.2.0",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-jasmine": "4.1.3",
"eslint-plugin-jest": "26.8.2",
"eslint-plugin-jsdoc": "39.3.6",
"eslint-plugin-prettier": "4.2.1",
"eslint-plugin-jsdoc": "46.8.2",
"eslint-plugin-prettier": "5.0.1",
"eslint-plugin-react": "7.30.1",
"husky": "8.0.1",
"jest": "28.1.3",
"jest": "29.7.0",
"lint-staged": "13.0.3",
"pre-commit": "1.2.2",
"prettier": "2.7.1",
"prettier": "3.0.3",
"renovate-config-algolia": "2.1.10",
"semantic-release": "19.0.3",
"ts-jest": "28.0.8",
"semantic-release": "22.0.5",
"ts-jest": "29.1.1",
"ts-node": "10.9.1",
"typescript": "4.7.4",
"typescript": "5.2.2",
"validator": "13.7.0"
},
"engines": {
Expand Down
50 changes: 0 additions & 50 deletions scripts/publish-check.js

This file was deleted.

49 changes: 49 additions & 0 deletions scripts/publish-check.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@

/* eslint-disable no-console */
/* eslint-disable no-process-exit */

import { Writable } from 'node:stream';

import semanticRelease from 'semantic-release';

console.log('Analyzing commits since last version...');

const stream = new Writable({
write(_chunk, _encoding, callback) {
setImmediate(callback);
},
});

// Execute semantic-release with only the commit-analyzer step, to see if
// a new release is needed
const { nextRelease } = await semanticRelease(
{
dryRun: true,
plugins: ['@semantic-release/commit-analyzer'],
verifyConditions: [],
analyzeCommits: ['@semantic-release/commit-analyzer'],
verifyRelease: [],
generateNotes: [],
prepare: [],
publish: [],
addChannel: [],
success: [],
fail: [],
},
// Redirect output to new streams, to make the script silent
{
stdout: stream,
stderr: stream,
}
);

// Exit with 0 if a new version must be released, 1 if nothing to do
if (nextRelease?.version) {
console.log(
`Commits analyzed warrant a release of version ${nextRelease.version}`
);
process.exit(0);
}
console.log('No new version to publish');
process.exit(1);

File renamed without changes.
Loading