From: Eduardo San Martin Morote Date: Tue, 17 Aug 2021 15:00:10 +0000 (+0200) Subject: build: fix build X-Git-Tag: @pinia/nuxt@0.0.1~29 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5eccd8f982cb0c0668559ec06403fa51f9bd9ef5;p=thirdparty%2Fvuejs%2Fpinia.git build: fix build --- diff --git a/rollup.config.js b/rollup.config.js index 7754aad6..8b9712d5 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,3 +1,4 @@ +// @ts-check import path from 'path' import ts from 'rollup-plugin-typescript2' import replace from '@rollup/plugin-replace' @@ -5,7 +6,14 @@ import resolve from '@rollup/plugin-node-resolve' 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) { @@ -95,7 +103,7 @@ function createConfig(format, output, plugins = []) { 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: { @@ -103,7 +111,7 @@ function createConfig(format, output, plugins = []) { 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. diff --git a/tsconfig.json b/tsconfig.json index 375779fd..54c0e073 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,11 +1,19 @@ { - "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",