Browse Source

update build settings

Yuki Takei 4 years ago
parent
commit
a098ab372a

+ 1 - 1
packages/app/.gitignore

@@ -13,7 +13,7 @@
 
 # dist (for GROWI v4.x and below)
 /public/*.chunk.js
-/public/*.chunk.js.LICENSE
+/public/*.chunk.js.LICENSE.txt
 /public/*.bundle.js
 /public/manifest.json
 /public/dll

+ 1 - 0
packages/core/.gitignore

@@ -0,0 +1 @@
+/dist

+ 6 - 4
packages/core/package.json

@@ -6,11 +6,13 @@
   "keywords": [
     "growi"
   ],
-  "main": "src/index.js",
-  "files": [
-    "src"
-  ],
+  "main": "dist/cjs/index.js",
+  "module": "dist/esm/index.js",
+  "files": ["dist"],
   "scripts": {
+    "build": "run-p build:*",
+    "build:cjs": "tsc -p tsconfig.build.cjs.json && tsc-alias -p tsconfig.build.cjs.json",
+    "build:esm": "tsc -p tsconfig.build.esm.json && tsc-alias -p tsconfig.build.esm.json",
     "lint:js": "eslint **/*.{js,ts}",
     "lint:styles": "stylelint src/styles/scss/**/*.scss",
     "lint": "npm-run-all -p lint:*",

+ 1 - 1
packages/core/tsconfig.base.json

@@ -6,6 +6,6 @@
     "src"
   ],
   "exclude": [
-    "**/*.test.ts"
+    "src/test"
   ]
 }

+ 17 - 0
packages/core/tsconfig.build.cjs.json

@@ -0,0 +1,17 @@
+{
+  "extends": "./tsconfig.base.json",
+  "compilerOptions": {
+    "rootDir": "./src",
+    "outDir": "dist/cjs",
+    "declaration": true,
+    "noResolve": false,
+    "preserveConstEnums": true,
+    "sourceMap": true,
+    "noEmit": false,
+    "inlineSources": true,
+
+    "baseUrl": ".",
+    "paths": {
+    }
+  }
+}

+ 19 - 0
packages/core/tsconfig.build.esm.json

@@ -0,0 +1,19 @@
+{
+  "extends": "./tsconfig.base.json",
+  "compilerOptions": {
+    "module": "esnext",
+
+    "rootDir": "./src",
+    "outDir": "dist/esm",
+    "declaration": true,
+    "noResolve": false,
+    "preserveConstEnums": true,
+    "sourceMap": true,
+    "noEmit": false,
+    "inlineSources": true,
+
+    "baseUrl": ".",
+    "paths": {
+    }
+  }
+}

+ 1 - 0
packages/plugin-attachment-refs/.gitignore

@@ -0,0 +1 @@
+/dist

+ 6 - 7
packages/plugin-attachment-refs/package.json

@@ -7,14 +7,13 @@
     "growi",
     "growi-plugin"
   ],
-  "main": "index.js",
-  "files": [
-    "src"
-  ],
+  "main": "dist/cjs/index.js",
+  "module": "dist/esm/index.js",
+  "files": ["dist"],
   "scripts": {
-    "build": "yarn tsc && tsc-alias -p tsconfig.build.json",
-    "tsc": "tsc -p tsconfig.build.json",
-    "tsc:w": "yarn tsc -w",
+    "build": "run-p build:*",
+    "build:cjs": "tsc -p tsconfig.build.cjs.json && tsc-alias -p tsconfig.build.cjs.json",
+    "build:esm": "tsc -p tsconfig.build.esm.json && tsc-alias -p tsconfig.build.esm.json",
     "lint:js": "eslint **/*.{js,jsx,ts,tsx}",
     "lint:styles": "stylelint src/**/*.scss",
     "lint": "run-p lint:*",

+ 11 - 0
packages/plugin-attachment-refs/tsconfig.base.json

@@ -0,0 +1,11 @@
+{
+  "extends": "../../tsconfig.base.json",
+  "compilerOptions": {
+  },
+  "include": [
+    "src"
+  ],
+  "exclude": [
+    "src/test"
+  ]
+}

+ 17 - 0
packages/plugin-attachment-refs/tsconfig.build.cjs.json

@@ -0,0 +1,17 @@
+{
+  "extends": "./tsconfig.base.json",
+  "compilerOptions": {
+    "rootDir": "./src",
+    "outDir": "dist/cjs",
+    "declaration": true,
+    "noResolve": false,
+    "preserveConstEnums": true,
+    "sourceMap": true,
+    "noEmit": false,
+    "inlineSources": true,
+
+    "baseUrl": ".",
+    "paths": {
+    }
+  }
+}

+ 19 - 0
packages/plugin-attachment-refs/tsconfig.build.esm.json

@@ -0,0 +1,19 @@
+{
+  "extends": "./tsconfig.base.json",
+  "compilerOptions": {
+    "module": "esnext",
+
+    "rootDir": "./src",
+    "outDir": "dist/esm",
+    "declaration": true,
+    "noResolve": false,
+    "preserveConstEnums": true,
+    "sourceMap": true,
+    "noEmit": false,
+    "inlineSources": true,
+
+    "baseUrl": ".",
+    "paths": {
+    }
+  }
+}

+ 1 - 0
packages/plugin-lsx/.gitignore

@@ -0,0 +1 @@
+/dist

+ 6 - 7
packages/plugin-lsx/package.json

@@ -7,14 +7,13 @@
     "growi",
     "growi-plugin"
   ],
-  "main": "src/index.js",
-  "files": [
-    "src"
-  ],
+  "main": "dist/cjs/index.js",
+  "module": "dist/esm/index.js",
+  "files": ["dist"],
   "scripts": {
-    "build": "yarn tsc && tsc-alias -p tsconfig.build.json",
-    "tsc": "tsc -p tsconfig.build.json",
-    "tsc:w": "yarn tsc -w",
+    "build": "run-p build:*",
+    "build:cjs": "tsc -p tsconfig.build.cjs.json && tsc-alias -p tsconfig.build.cjs.json",
+    "build:esm": "tsc -p tsconfig.build.esm.json && tsc-alias -p tsconfig.build.esm.json",
     "lint:js": "eslint **/*.{js,jsx,ts,tsx}",
     "lint:styles": "stylelint src/**/*.scss",
     "lint": "run-p lint:*",

+ 11 - 0
packages/plugin-lsx/tsconfig.base.json

@@ -0,0 +1,11 @@
+{
+  "extends": "../../tsconfig.base.json",
+  "compilerOptions": {
+  },
+  "include": [
+    "src"
+  ],
+  "exclude": [
+    "src/test"
+  ]
+}

+ 17 - 0
packages/plugin-lsx/tsconfig.build.cjs.json

@@ -0,0 +1,17 @@
+{
+  "extends": "./tsconfig.base.json",
+  "compilerOptions": {
+    "rootDir": "./src",
+    "outDir": "dist/cjs",
+    "declaration": true,
+    "noResolve": false,
+    "preserveConstEnums": true,
+    "sourceMap": true,
+    "noEmit": false,
+    "inlineSources": true,
+
+    "baseUrl": ".",
+    "paths": {
+    }
+  }
+}

+ 19 - 0
packages/plugin-lsx/tsconfig.build.esm.json

@@ -0,0 +1,19 @@
+{
+  "extends": "./tsconfig.base.json",
+  "compilerOptions": {
+    "module": "esnext",
+
+    "rootDir": "./src",
+    "outDir": "dist/esm",
+    "declaration": true,
+    "noResolve": false,
+    "preserveConstEnums": true,
+    "sourceMap": true,
+    "noEmit": false,
+    "inlineSources": true,
+
+    "baseUrl": ".",
+    "paths": {
+    }
+  }
+}

+ 1 - 0
packages/plugin-pukiwiki-like-linker/.gitignore

@@ -0,0 +1 @@
+/dist

+ 6 - 7
packages/plugin-pukiwiki-like-linker/package.json

@@ -7,14 +7,13 @@
     "growi",
     "growi-plugin"
   ],
-  "main": "src/index.js",
-  "files": [
-    "src"
-  ],
+  "main": "dist/cjs/index.js",
+  "module": "dist/esm/index.js",
+  "files": ["dist"],
   "scripts": {
-    "build": "yarn tsc && tsc-alias -p tsconfig.build.json",
-    "tsc": "tsc -p tsconfig.build.json",
-    "tsc:w": "yarn tsc -w",
+    "build": "run-p build:*",
+    "build:cjs": "tsc -p tsconfig.build.cjs.json && tsc-alias -p tsconfig.build.cjs.json",
+    "build:esm": "tsc -p tsconfig.build.esm.json && tsc-alias -p tsconfig.build.esm.json",
     "lint:js": "eslint **/*.{js,ts}",
     "lint": "run-p lint:*",
     "test": ""

+ 11 - 0
packages/plugin-pukiwiki-like-linker/tsconfig.base.json

@@ -0,0 +1,11 @@
+{
+  "extends": "../../tsconfig.base.json",
+  "compilerOptions": {
+  },
+  "include": [
+    "src"
+  ],
+  "exclude": [
+    "src/test"
+  ]
+}

+ 17 - 0
packages/plugin-pukiwiki-like-linker/tsconfig.build.cjs.json

@@ -0,0 +1,17 @@
+{
+  "extends": "./tsconfig.base.json",
+  "compilerOptions": {
+    "rootDir": "./src",
+    "outDir": "dist/cjs",
+    "declaration": true,
+    "noResolve": false,
+    "preserveConstEnums": true,
+    "sourceMap": true,
+    "noEmit": false,
+    "inlineSources": true,
+
+    "baseUrl": ".",
+    "paths": {
+    }
+  }
+}

+ 19 - 0
packages/plugin-pukiwiki-like-linker/tsconfig.build.esm.json

@@ -0,0 +1,19 @@
+{
+  "extends": "./tsconfig.base.json",
+  "compilerOptions": {
+    "module": "esnext",
+
+    "rootDir": "./src",
+    "outDir": "dist/esm",
+    "declaration": true,
+    "noResolve": false,
+    "preserveConstEnums": true,
+    "sourceMap": true,
+    "noEmit": false,
+    "inlineSources": true,
+
+    "baseUrl": ".",
+    "paths": {
+    }
+  }
+}

+ 2 - 4
packages/ui/package.json

@@ -6,10 +6,8 @@
   "keywords": [
     "growi"
   ],
-  "main": "src/index.js",
-  "files": [
-    "src"
-  ],
+  "module": "dist/esm/index.js",
+  "files": ["dist"],
   "scripts": {
     "lint:js": "eslint **/*.{js,jsx,ts,tsx}",
     "lint:styles": "stylelint src/styles/scss/**/*.scss",

+ 17 - 0
packages/ui/tsconfig.base.json

@@ -0,0 +1,17 @@
+{
+  "extends": "../../tsconfig.base.json",
+  "compilerOptions": {
+    "module": "esnext",
+    "jsx": "react",
+    "noFallthroughCasesInSwitch": true,
+    "noUnusedLocals": true,
+    "noUnusedParameters": true,
+    "strict": true,
+  },
+  "include": [
+    "src"
+  ],
+  "exclude": [
+    "src/test"
+  ]
+}

+ 2 - 2
packages/plugin-pukiwiki-like-linker/tsconfig.build.json → packages/ui/tsconfig.build.json

@@ -1,8 +1,8 @@
 {
-  "extends": "./tsconfig.json",
+  "extends": "./tsconfig.base.json",
   "compilerOptions": {
     "rootDir": "./src",
-    "outDir": "dist",
+    "outDir": "dist/esm",
     "declaration": true,
     "noResolve": false,
     "preserveConstEnums": true,

+ 1 - 7
packages/ui/tsconfig.json

@@ -1,12 +1,6 @@
 {
-  "extends": "../../tsconfig.base.json",
+  "extends": "./tsconfig.base.json",
   "compilerOptions": {
-    "module": "esnext",
-    "jsx": "react",
-    "noFallthroughCasesInSwitch": true,
-    "noUnusedLocals": true,
-    "noUnusedParameters": true,
-    "strict": true,
     "baseUrl": ".",
     "paths": {
       "~/*": ["./src/*"],