mirror of
https://github.com/Dan6erbond/sk-auth.git
synced 2025-05-07 01:15:31 +02:00
use svelte build way
This commit is contained in:
parent
ec0ad24b39
commit
828feb7ecc
6
.gitignore
vendored
6
.gitignore
vendored
@ -76,4 +76,8 @@ typings/
|
||||
.fusebox/
|
||||
|
||||
# Build output
|
||||
dist/*
|
||||
/index.*ts
|
||||
/index.*js
|
||||
/providers
|
||||
/client
|
||||
/types
|
||||
|
@ -3441,12 +3441,6 @@ simple-swizzle@^0.2.2:
|
||||
cookie "^0.4.1"
|
||||
jsonwebtoken "^8.5.1"
|
||||
|
||||
"sk-auth@file:../":
|
||||
version "0.3.7"
|
||||
dependencies:
|
||||
cookie "^0.4.1"
|
||||
jsonwebtoken "^8.5.1"
|
||||
|
||||
slash@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634"
|
||||
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"internal": true,
|
||||
"main": "../dist/client/index.js",
|
||||
"module": "../dist/client/index.esm.js",
|
||||
"types": "../dist/client/index.d.ts"
|
||||
}
|
33
package.json
33
package.json
@ -2,14 +2,23 @@
|
||||
"name": "sk-auth",
|
||||
"version": "0.3.7",
|
||||
"description": "Authentication library for use with SvelteKit featuring built-in OAuth providers and zero restriction customization!",
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/index.esm.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"module": "index.mjs",
|
||||
"main": "index",
|
||||
"types": "types/index.d.ts",
|
||||
"exports": {
|
||||
".": "./dist/index.js",
|
||||
"./client": "./dist/client/index.js",
|
||||
"./providers": "./dist/providers/index.js",
|
||||
"./package.json": "./package.json"
|
||||
"./package.json": "./package.json",
|
||||
".": {
|
||||
"import": "./index.mjs",
|
||||
"require": "./index.js"
|
||||
},
|
||||
"./providers": {
|
||||
"import": "./providers/index.mjs",
|
||||
"require": "./providers/index.js"
|
||||
},
|
||||
"./client": {
|
||||
"import": "./client/index.mjs",
|
||||
"require": "./client/index.js"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
@ -18,7 +27,8 @@
|
||||
"README.md"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "rollup --config",
|
||||
"build": "rollup -c && npm run tsd",
|
||||
"tsd": "tsc -p ./src --emitDeclarationOnly",
|
||||
"dev": "rollup --config --watch",
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"lint": "prettier --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .",
|
||||
@ -51,20 +61,15 @@
|
||||
"@types/jsonwebtoken": "^8.5.1",
|
||||
"@typescript-eslint/eslint-plugin": "^4.23.0",
|
||||
"@typescript-eslint/parser": "^4.23.0",
|
||||
"build-esm": "^4.2.2",
|
||||
"esbuild": "^0.12.1",
|
||||
"eslint": "^7.26.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"prettier": "^2.3.0",
|
||||
"rollup": "^2.48.0",
|
||||
"rollup-plugin-esbuild": "^4.2.3",
|
||||
"rollup-plugin-multi-input": "^1.3.0",
|
||||
"svelte": "^3.38.2",
|
||||
"tslib": "^2.2.0",
|
||||
"typescript": "^4.2.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@sveltejs/kit": "next",
|
||||
"build-esm": "^4.2.2"
|
||||
"@sveltejs/kit": "next"
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"internal": true,
|
||||
"main": "../dist/providers/index.js",
|
||||
"module": "../dist/providers/index.esm.js",
|
||||
"types": "../dist/providers/index.d.ts"
|
||||
}
|
@ -1,57 +1,43 @@
|
||||
import multiInput from "rollup-plugin-multi-input";
|
||||
import packageJson from "./package.json";
|
||||
import esbuild from "rollup-plugin-esbuild";
|
||||
import typescript from "@rollup/plugin-typescript";
|
||||
import fs from 'fs';
|
||||
import typescript from '@rollup/plugin-typescript';
|
||||
import pkg from "./package.json";
|
||||
|
||||
const ts_plugin = typescript({ include: 'src/**', typescript: require('typescript') });
|
||||
|
||||
function config(dir) {
|
||||
const _dir = dir ? dir + '/' : '';
|
||||
return {
|
||||
input: `src/${_dir}index.ts`,
|
||||
output: [
|
||||
{
|
||||
file: `${_dir}index.mjs`,
|
||||
format: 'esm'
|
||||
},
|
||||
{
|
||||
file: `${_dir}index.js`,
|
||||
format: 'cjs'
|
||||
}
|
||||
],
|
||||
plugins: [
|
||||
typescript({ include: 'src/**', typescript: require('typescript') }),
|
||||
{
|
||||
writeBundle() {
|
||||
if (dir) {
|
||||
fs.writeFileSync(`${_dir}/package.json`, JSON.stringify({
|
||||
main: './index',
|
||||
module: './index.mjs',
|
||||
types: './index.d.ts'
|
||||
}, null, ' '));
|
||||
}
|
||||
fs.writeFileSync(`${_dir}index.d.ts`, `export * from '../types/${_dir}index';`);
|
||||
}
|
||||
}
|
||||
],
|
||||
external: [...Object.keys(pkg.dependencies)]
|
||||
}
|
||||
}
|
||||
|
||||
const globals = {
|
||||
...packageJson.dependencies,
|
||||
...packageJson.devDependencies,
|
||||
};
|
||||
|
||||
/** @type {import('rollup').RollupOptions} */
|
||||
const baseConfig = {
|
||||
input: ["src/**/*.ts"],
|
||||
output: {
|
||||
dir: "dist",
|
||||
sourcemap: true,
|
||||
},
|
||||
plugins: [
|
||||
esbuild(),
|
||||
typescript({
|
||||
emitDeclarationOnly: true,
|
||||
sourceMap: false,
|
||||
}),
|
||||
],
|
||||
external: [
|
||||
...Object.keys(globals),
|
||||
"@sveltejs/kit/assets/runtime/app/navigation",
|
||||
"@sveltejs/kit/assets/runtime/app/stores",
|
||||
],
|
||||
};
|
||||
|
||||
/** @type {Array.<import('rollup').RollupOptions>} */
|
||||
export default [
|
||||
{
|
||||
...baseConfig,
|
||||
output: {
|
||||
...baseConfig.output,
|
||||
format: "cjs",
|
||||
},
|
||||
plugins: [...baseConfig.plugins, multiInput()],
|
||||
},
|
||||
{
|
||||
...baseConfig,
|
||||
output: {
|
||||
...baseConfig.output,
|
||||
format: "esm",
|
||||
},
|
||||
plugins: [
|
||||
...baseConfig.plugins,
|
||||
multiInput({
|
||||
/** @param {string} output */
|
||||
transformOutputPath: (output) =>
|
||||
`${output.split(".").slice(0, -1).join(".")}.esm.${output.split(".").slice(-1)}`,
|
||||
}),
|
||||
],
|
||||
},
|
||||
];
|
||||
export default [config(), config('providers'), config('client')]
|
11
src/tsconfig.json
Normal file
11
src/tsconfig.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"include": [
|
||||
"."
|
||||
],
|
||||
"compilerOptions": {
|
||||
"target": "ESNext",
|
||||
"types": [],
|
||||
"baseUrl": ".",
|
||||
}
|
||||
}
|
@ -6,6 +6,7 @@
|
||||
"moduleResolution": "node",
|
||||
"noImplicitAny": false,
|
||||
"declaration": true,
|
||||
"declarationDir": "types",
|
||||
"removeComments": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
@ -13,9 +14,7 @@
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"sourceMap": true,
|
||||
"baseUrl": "./",
|
||||
"outDir": "./dist"
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["**/node_modules", "**/dist", "./app", "**/*.md", "**/rollup.config.js"]
|
||||
"exclude": ["**/node_modules", "./app", "**/*.md", "**/rollup.config.js"]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user