]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
build: fix build
authorEduardo San Martin Morote <posva13@gmail.com>
Tue, 17 Aug 2021 15:00:10 +0000 (17:00 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Tue, 17 Aug 2021 15:00:10 +0000 (17:00 +0200)
rollup.config.js
tsconfig.json

index 7754aad664c54c205a028252e7621e19d56065c5..8b9712d5980e01f6619cc81b7301c26561380263 100644 (file)
@@ -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.
index 375779fd41fbad039def6ebe5fbc1087d7480d00..54c0e07349fd4d587768e7ca04b1764ba94db620 100644 (file)
@@ -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",