refactor: update package.json recommendations

This commit is contained in:
Rainer Killinger
2022-07-05 13:04:07 +02:00
parent e2e0e8aa70
commit 40cb266d09

View File

@@ -222,31 +222,31 @@ export function checkPackages(
): void { ): void {
if (typeof expected === 'undefined') { if (typeof expected === 'undefined') {
return; return;
} }
if (typeof acutal === 'undefined') { if (typeof acutal === 'undefined') {
reportPackage(expected, development); reportPackage(expected, development);
return; return;
} }
for (let npmPackage of expected) { for (let npmPackage of expected) {
const [name, expectedVersion] = npmPackage.split(':'); const [name, expectedVersion] = npmPackage.split(':');
const installedVersion = acutal[name]; const installedVersion = acutal[name];
if (typeof installedVersion === 'undefined') { if (typeof installedVersion === 'undefined') {
reportPackage(npmPackage, development); reportPackage(npmPackage, development);
continue; continue;
} }
if (typeof expectedVersion === 'undefined') { if (typeof expectedVersion === 'undefined') {
continue; continue;
} }
if (typeof valid(expectedVersion) === 'string' && !satisfies(installedVersion, expectedVersion)) { if (typeof valid(expectedVersion) === 'string' && !satisfies(installedVersion, expectedVersion)) {
npmPackage = npmPackage.replace(':', '@'); npmPackage = npmPackage.replace(':', '@');
consoleWarn( consoleWarn(
`Version '${installedVersion}' of ${ `Version '${installedVersion}' of ${
development ? 'dev ' : ' ' development ? 'dev ' : ' '
}dependency '${name}' does not satisfy constraint '${expectedVersion}'. }dependency '${name}' does not satisfy constraint '${expectedVersion}'.
Please install with 'npm install --save-exact ${development ? '--save-dev ' : ''}${npmPackage}'.`, Please install with 'npm install --save-exact ${development ? '--save-dev ' : ''}${npmPackage}'.`,
); );
}
} }
}
} }
/** /**
@@ -796,7 +796,7 @@ export function getRules(configuration: Configuration): Rules {
} }
if (configuration.forPackaging) { if (configuration.forPackaging) {
scripts.prepublishOnly = 'npm ci && npm run build'; scripts.prepublishOnly = 'npm ci && npm run build && npm run test';
files.push(path.join('templates', '.npmignore')); files.push(path.join('templates', '.npmignore'));
} else { } else {
@@ -805,7 +805,7 @@ export function getRules(configuration: Configuration): Rules {
} }
if (configuration.serverSide) { if (configuration.serverSide) {
dependencies.push('@types/node:^10.0.0'); devDependencies.push('@types/node:^14.0.0');
} }
if (configuration.standardBuild || configuration.hasCli) { if (configuration.standardBuild || configuration.hasCli) {
@@ -820,9 +820,9 @@ export function getRules(configuration: Configuration): Rules {
} }
if (configuration.standardDocumentation) { if (configuration.standardDocumentation) {
devDependencies.push('typedoc'); devDependencies.push('typedoc:0.22.x');
scripts.documentation = scripts.documentation =
'typedoc --includeDeclarations --mode modules --out docs --readme README.md --listInvalidSymbolLinks --entryPointStrategy expand src'; 'typedoc --out docs --readme README.md --listInvalidSymbolLinks --entryPointStrategy expand src';
} }
for (const ignoreScript of configuration.ignoreScripts) { for (const ignoreScript of configuration.ignoreScripts) {