+// @ts-check
import path from 'path'
import ts from 'rollup-plugin-typescript2'
import replace from '@rollup/plugin-replace'
import commonjs from '@rollup/plugin-commonjs'
import pascalcase from 'pascalcase'
-const pkg = require('./package.json')
+if (!process.env.TARGET) {
+ throw new Error('TARGET package must be specified via --environment flag.')
+}
+
+const packagesDir = path.resolve(__dirname, 'packages')
+const packageDir = path.resolve(packagesDir, process.env.TARGET)
+
+const pkg = require(path.resolve(packageDir, `package.json`))
const name = pkg.name
function getAuthors(pkg) {
const tsPlugin = ts({
check: !hasTSChecked,
- tsconfig: path.resolve(__dirname, 'tsconfig.json'),
+ tsconfig: path.resolve(__dirname, './tsconfig.json'),
cacheRoot: path.resolve(__dirname, 'node_modules/.rts2_cache'),
tsconfigOverride: {
compilerOptions: {
declaration: shouldEmitDeclarations,
declarationMap: shouldEmitDeclarations,
},
- exclude: ['__tests__', 'test-dts'],
+ exclude: ['packages/*/__tests__', 'packages/*/test-dts'],
},
})
// we only need to check TS and generate declarations once for each build.
{
- "include": ["src/global.d.ts", "src/**/*.ts", "__tests__/**/*.ts"],
+ "include": [
+ "packages/pinia/src/global.d.ts",
+ "packages/*/src/**/*.ts",
+ "packages/*/__tests__/**/*.ts"
+ ],
"compilerOptions": {
"baseUrl": ".",
"rootDir": ".",
"outDir": "dist",
"sourceMap": false,
"noEmit": true,
+ "paths": {
+ "@pinia/*": ["packages/*/src"],
+ "pinia": ["packages/pinia/src"]
+ },
"target": "esnext",
"module": "esnext",