chore: use rollup-plugin-dts

This commit is contained in:
Christian Kaisermann 2022-04-05 17:21:01 +02:00
parent a8b5df0442
commit e91e822df1
6 changed files with 14718 additions and 7317 deletions

1
.gitignore vendored
View File

@ -2,4 +2,3 @@ node_modules
*.log *.log
/coverage/ /coverage/
/dist/ /dist/
/types/

14752
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
"version": "3.3.13", "version": "3.3.13",
"main": "dist/runtime.cjs.js", "main": "dist/runtime.cjs.js",
"module": "dist/runtime.esm.js", "module": "dist/runtime.esm.js",
"types": "types/runtime/index.d.ts", "types": "dist/runtime.d.ts",
"bin": { "bin": {
"svelte-i18n": "dist/cli.js" "svelte-i18n": "dist/cli.js"
}, },
@ -22,9 +22,8 @@
"node": ">= 11.15.0" "node": ">= 11.15.0"
}, },
"scripts": { "scripts": {
"clean": "rm -rf dist/ types/", "clean": "rm -rf dist/",
"build": "rollup -c", "build": "rollup -c",
"build:types": "tsc -p src/runtime --emitDeclarationOnly",
"dev": "rollup -c -w", "dev": "rollup -c -w",
"test": "cross-env NODE_ICU_DATA=node_modules/full-icu jest", "test": "cross-env NODE_ICU_DATA=node_modules/full-icu jest",
"test:ci": "npm run test -- --silent", "test:ci": "npm run test -- --silent",
@ -32,13 +31,11 @@
"format": "prettier --loglevel silent --write \"{src,test}/**/*.ts\"", "format": "prettier --loglevel silent --write \"{src,test}/**/*.ts\"",
"release": " git add package.json && git commit -m \"chore(release): v$npm_package_version :tada:\"", "release": " git add package.json && git commit -m \"chore(release): v$npm_package_version :tada:\"",
"prebuild": "yarn clean", "prebuild": "yarn clean",
"postbuild": "yarn build:types",
"version": "conventional-changelog -p angular -i CHANGELOG.md -s -r 1 && git add CHANGELOG.md", "version": "conventional-changelog -p angular -i CHANGELOG.md -s -r 1 && git add CHANGELOG.md",
"prepublishOnly": "npm run test && npm run build" "prepublishOnly": "npm run test && npm run build"
}, },
"files": [ "files": [
"dist/", "dist/"
"types/"
], ],
"husky": { "husky": {
"hooks": { "hooks": {
@ -95,6 +92,7 @@
"rollup": "^2.27.1", "rollup": "^2.27.1",
"rollup-plugin-auto-external": "^2.0.0", "rollup-plugin-auto-external": "^2.0.0",
"rollup-plugin-commonjs": "^10.1.0", "rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-dts": "^4.2.0",
"rollup-plugin-terser": "^7.0.2", "rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.27.2", "rollup-plugin-typescript2": "^0.27.2",
"sass": "^1.26.11", "sass": "^1.26.11",

View File

@ -2,12 +2,14 @@ import commonjs from '@rollup/plugin-commonjs';
import ts from '@rollup/plugin-typescript'; import ts from '@rollup/plugin-typescript';
import { terser } from 'rollup-plugin-terser'; import { terser } from 'rollup-plugin-terser';
import autoExternal from 'rollup-plugin-auto-external'; import autoExternal from 'rollup-plugin-auto-external';
import dts from 'rollup-plugin-dts';
import pkg from './package.json'; import pkg from './package.json';
const PROD = !process.env.ROLLUP_WATCH; const PROD = !process.env.ROLLUP_WATCH;
export default [ export default [
// bundle runtime
{ {
input: 'src/runtime/index.ts', input: 'src/runtime/index.ts',
external: [ external: [
@ -21,6 +23,13 @@ export default [
], ],
plugins: [commonjs(), autoExternal(), ts(), PROD && terser()], plugins: [commonjs(), autoExternal(), ts(), PROD && terser()],
}, },
// bundle types for runtime
{
input: 'src/runtime/index.ts',
output: [{ file: pkg.types, format: 'es' }],
plugins: [dts()],
},
// build CLI
{ {
input: 'src/cli/index.ts', input: 'src/cli/index.ts',
output: [ output: [

View File

@ -7,8 +7,7 @@ import type {
TimeFormatter, TimeFormatter,
DateFormatter, DateFormatter,
NumberFormatter, NumberFormatter,
MissingKeyHandler, } from '../../../src/runtime/types';
} from '../../../src/runtime/types/index';
import { import {
$format, $format,
$formatTime, $formatTime,

7258
yarn.lock

File diff suppressed because it is too large Load Diff