mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-06-06 13:53:54 +02:00
copy plugin sources
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
import { builtinModules } from "module";
|
||||
|
||||
import typescript from "@rollup/plugin-typescript";
|
||||
import resolve from "@rollup/plugin-node-resolve";
|
||||
// import terser from "@rollup/plugin-terser";
|
||||
|
||||
/**
|
||||
* Create a base rollup config
|
||||
* @param {Record<string,any>} pkg Imported package.json
|
||||
* @param {string[]} external Imported package.json
|
||||
* @returns {import('rollup').RollupOptions}
|
||||
*/
|
||||
export function createConfig({ pkg, external = [] }) {
|
||||
return [
|
||||
{
|
||||
input: "index.ts",
|
||||
external: Object.keys(pkg.dependencies || {})
|
||||
.concat(Object.keys(pkg.peerDependencies || {}))
|
||||
.concat(builtinModules)
|
||||
.concat(external),
|
||||
onwarn: (warning) => {
|
||||
throw Object.assign(new Error(), warning);
|
||||
},
|
||||
strictDeprecations: true,
|
||||
output: {
|
||||
file: pkg.module,
|
||||
format: "es",
|
||||
sourcemap: true,
|
||||
},
|
||||
plugins: [typescript({ sourceMap: true })],
|
||||
},
|
||||
{
|
||||
input: "index.ts",
|
||||
onwarn: (warning) => {
|
||||
throw Object.assign(new Error(), warning);
|
||||
},
|
||||
strictDeprecations: true,
|
||||
output: {
|
||||
file: pkg.browser,
|
||||
format: "es",
|
||||
sourcemap: true,
|
||||
entryFileNames: "[name].min.js",
|
||||
},
|
||||
plugins: [
|
||||
resolve(),
|
||||
// terser(),
|
||||
typescript({ sourceMap: true }),
|
||||
],
|
||||
},
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
[package]
|
||||
name = "tauri-plugin-{{name}}"
|
||||
version = "0.1.0"
|
||||
edition.workspace = true
|
||||
authors.workspace = true
|
||||
license.workspace = true
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
tauri.workspace = true
|
||||
log.workspace = true
|
||||
thiserror.workspace = true
|
||||
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "tauri-plugin-{{name}}-api",
|
||||
"version": "0.0.0",
|
||||
"license": "MIT or APACHE-2.0",
|
||||
"type": "module",
|
||||
"browser": "dist/index.min.js",
|
||||
"module": "dist/index.mjs",
|
||||
"types": "dist/index.d.ts",
|
||||
"exports": {
|
||||
"import": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"browser": "./dist/index.min.js"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rollup -c"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"!dist/**/*.map",
|
||||
"README.md",
|
||||
"LICENSE"
|
||||
],
|
||||
"devDependencies": {
|
||||
"tslib": "^2.4.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "^1.2.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { readFileSync } from "fs";
|
||||
|
||||
import { createConfig } from "../../../shared/rollup.config.mjs";
|
||||
|
||||
export default createConfig({
|
||||
pkg: JSON.parse(
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8")
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
||||
+1
@@ -0,0 +1 @@
|
||||
../../../shared/tsconfig.json
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"extends": "../../../tsconfig.base.json",
|
||||
"include": ["*.ts", "types/**/*"]
|
||||
}
|
||||
Reference in New Issue
Block a user