From 777fc620ff0967355dceacdea60c5becc86549df Mon Sep 17 00:00:00 2001 From: Duong Pham Date: Wed, 12 Feb 2020 22:31:43 +0700 Subject: [PATCH] fix: tsconfig for elements to build storybook --- packages/cognito-auth/src/scripts/check-version.js | 2 -- packages/elements/package.json | 3 +-- packages/elements/tsconfig.json | 5 ++++- packages/foundations-ts-definitions/scripts/bump-version.js | 5 +---- packages/foundations-ts-definitions/scripts/check-version.js | 2 -- 5 files changed, 6 insertions(+), 11 deletions(-) diff --git a/packages/cognito-auth/src/scripts/check-version.js b/packages/cognito-auth/src/scripts/check-version.js index 3f71748e00..85f05caf99 100644 --- a/packages/cognito-auth/src/scripts/check-version.js +++ b/packages/cognito-auth/src/scripts/check-version.js @@ -2,8 +2,6 @@ const { npm_package_version: currentPackageVersion, npm_package_name: npmPackage const { runCommand } = require('../../../scripts/release/utils') const remotePackageVersion = runCommand('yarn', ['info', npmPackageName, 'version']) - .toString() - .trim() const compareVersions = require('compare-versions') if (remotePackageVersion === '') { diff --git a/packages/elements/package.json b/packages/elements/package.json index de2ac9712c..cde03a5f63 100644 --- a/packages/elements/package.json +++ b/packages/elements/package.json @@ -20,8 +20,7 @@ "module": "dist/elements.esm.js", "typings": "dist/index.d.ts", "scripts": { - "build-storybook": "build-storybook -o out", - "build:prod": "rimraf dist && rimraf out && cross-env NODE_ENV=production tsdx build --format=cjs,esm,umd && rollup -c && build-storybook", + "build:prod": "rimraf dist && rimraf out && cross-env NODE_ENV=production tsdx build --format=cjs,esm,umd && rollup -c && build-storybook -o out", "release:prod": "node ../../scripts/release/release-npm.js @reapit/elements && gh-pages -d out", "start:dev": "start-storybook -p 6006", "start:prod": "cross-env NODE_ENV=development tsdx watch", diff --git a/packages/elements/tsconfig.json b/packages/elements/tsconfig.json index 4a37db9cd7..619343faf1 100644 --- a/packages/elements/tsconfig.json +++ b/packages/elements/tsconfig.json @@ -6,9 +6,12 @@ "moduleResolution": "node", "types": ["jest", "node", "react"], "baseUrl": "./", + "paths": { + "@/*": ["src/*"], + "@reapit/cognito-auth": ["../cognito-auth/src"] + }, "lib": ["es2015", "es2017", "dom", "es5", "es6", "esnext"], "outDir": "public", - "rootDir": "src", "sourceRoot": "/" }, "include": ["src"] diff --git a/packages/foundations-ts-definitions/scripts/bump-version.js b/packages/foundations-ts-definitions/scripts/bump-version.js index 0d4d6d148d..1aaf6d6cbc 100644 --- a/packages/foundations-ts-definitions/scripts/bump-version.js +++ b/packages/foundations-ts-definitions/scripts/bump-version.js @@ -7,10 +7,7 @@ const { npm_package_name } = process.env const packageJsonPath = path.resolve(__dirname, '../package.json') module.exports = () => { - const remotePackageVersionStdOut = runCommand('yarn', ['info', npm_package_name, 'version']) - .toString() - .trim() - .split('\n') + const remotePackageVersionStdOut = runCommand('yarn', ['info', npm_package_name, 'version']).split('\n') let remotePackageVersion = '' // Ex of remotePackageVersionStdOut: ['0.0.0'] diff --git a/packages/foundations-ts-definitions/scripts/check-version.js b/packages/foundations-ts-definitions/scripts/check-version.js index f1bef1169e..21445574d4 100644 --- a/packages/foundations-ts-definitions/scripts/check-version.js +++ b/packages/foundations-ts-definitions/scripts/check-version.js @@ -2,8 +2,6 @@ const { runCommand } = require('../../../scripts/release/utils') const { npm_package_version: currentPackageVersion, npm_package_name: npmPackageName } = process.env const remotePackageVersion = runCommand('yarn', ['info', npmPackageName, 'version']) - .toString() - .trim() const compareVersions = require('compare-versions') if (!remotePackageVersion) {