fix(package): declare npm publication metadata
Link the package to its public source, issue tracker, and documentation so npm Trusted Publishing can validate provenance and consumers receive canonical project links. Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
2 files changed
+41
No files matched your search
@@ -0,0 +1,33 @@
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { resolve } from 'node:path';
|
||||
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
interface PackageMetadata {
|
||||
readonly repository?: {
|
||||
readonly type?: string;
|
||||
readonly url?: string;
|
||||
};
|
||||
readonly bugs?: {
|
||||
readonly url?: string;
|
||||
};
|
||||
readonly homepage?: string;
|
||||
}
|
||||
|
||||
const packageJson = JSON.parse(readFileSync(resolve(process.cwd(), 'package.json'), 'utf8')) as PackageMetadata;
|
||||
|
||||
describe('package publication metadata', () => {
|
||||
it('links npm provenance to the public GitHub repository', () => {
|
||||
expect(packageJson.repository).toEqual({
|
||||
type: 'git',
|
||||
url: 'git+https://github.com/Expressive-Tea/green-tea.git',
|
||||
});
|
||||
});
|
||||
|
||||
it('links npm consumers to support and documentation', () => {
|
||||
expect(packageJson.bugs).toEqual({
|
||||
url: 'https://github.com/Expressive-Tea/green-tea/issues',
|
||||
});
|
||||
expect(packageJson.homepage).toBe('https://green-tea.expressive-tea.io/docs/');
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user