Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

fix: remove 'skipLibCheck' flag requirement from client's projects #367

Merged
merged 8 commits into from
Oct 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
### Fixes
- Fix for cropped rounded corners in `Menu` component @Bugaa92 ([#360](https://github.com/stardust-ui/react/pull/360))
- Remove hardcoded `status` size calculations in `Avatar` component @Bugaa92 ([#358](https://github.com/stardust-ui/react/pull/358))
- Remove necessity to use `skipLibCheck` flag for client's typescript projects that consume Stardust @kuzhelov ([#367](https://github.com/stardust-ui/react/pull/367))

### Features
- Add `target` prop to `Popup` @kuzhelog ([#356](https://github.com/stardust-ui/react/pull/356))
Expand Down
68 changes: 0 additions & 68 deletions build/gulp/plugins/gulp-use-relative-import-paths.ts

This file was deleted.

9 changes: 2 additions & 7 deletions build/gulp/tasks/dist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import config from '../../../config'
const { paths } = config
const g = require('gulp-load-plugins')()
const { log, PluginError } = g.util
import gulpUseRelativeImportPaths from '../plugins/gulp-use-relative-import-paths'

// ----------------------------------------
// Clean
Expand All @@ -30,9 +29,7 @@ task('build:dist:commonjs', () => {
const types = src(paths.base('types/**'))

return merge2([
dts
.pipe(gulpUseRelativeImportPaths({ forImportStartsWith: 'src', paths }))
.pipe(dest(paths.dist('commonjs'))),
dts.pipe(dest(paths.dist('commonjs'))),
js.pipe(dest(paths.dist('commonjs'))),
types.pipe(dest(paths.dist('types'))),
])
Expand All @@ -47,9 +44,7 @@ task('build:dist:es', () => {
const types = src(paths.base('types/**'))

return merge2([
dts
.pipe(gulpUseRelativeImportPaths({ forImportStartsWith: 'src', paths }))
.pipe(dest(paths.dist('es'))),
dts.pipe(dest(paths.dist('es'))),
js.pipe(dest(paths.dist('es'))),
types.pipe(dest(paths.dist('types'))),
])
Expand Down
25 changes: 5 additions & 20 deletions build/gulp/tasks/test-projects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,6 @@ const createReactApp = async (atTempDirectory: string, appName: string): Promise
return appProjectPath
}

const enableTsCompilerFlagSync = (tsconfigPath: string, flag: string) => {
const tsConfigAsJson = JSON.parse(`${fs.readFileSync(tsconfigPath)}`)
if (!tsConfigAsJson.compilerOptions) {
tsConfigAsJson.compilerOptions = {}
}

tsConfigAsJson.compilerOptions[flag] = true

fs.writeFileSync(tsconfigPath, JSON.stringify(tsConfigAsJson))
}

// Tests the following scenario
// - Create a new react test app
// - Add Stardust as a app's dependency
Expand Down Expand Up @@ -108,7 +97,9 @@ export default App;
//////// CREATE TEST REACT APP ///////
log('STEP 1. Create test React project with TSX scripts..')

const testAppPath = paths.withRootAt(await createReactApp(tmp.dirSync().name, 'test-app'))
const testAppPath = paths.withRootAt(
await createReactApp(tmp.dirSync({ prefix: 'stardust-' }).name, 'test-app'),
)

const runInTestApp = runIn(testAppPath())
log(`Test React project is successfully created: ${testAppPath()}`)
Expand All @@ -119,18 +110,12 @@ export default App;
await runInTestApp(`yarn add ${paths.base(stardustPackageFilename)}`)
log("Stardust is successfully added as test project's dependency.")

//////// ENABLE SKIP LIB CHECK FLAG ///////
log("STEP 3. Enable 'skipLibCheck' flag for test project's TS compiler")

const tsconfigPath = testAppPath('tsconfig.json')
enableTsCompilerFlagSync(tsconfigPath, 'skipLibCheck')

//////// REFERENCE STARDUST COMPONENTS IN TEST APP's MAIN FILE ///////
log("STEP 4. Reference Stardust components in test project's App.tsx")
log("STEP 3. Reference Stardust components in test project's App.tsx")
fs.writeFileSync(testAppPath('src', 'App.tsx'), appTSX)

//////// BUILD TEST PROJECT ///////
log('STEP 5. Build test project..')
log('STEP 4. Build test project..')
await runInTestApp(`yarn build`)

log('Test project is built successfully!')
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
"ts-node": "^6.1.0",
"tslint": "^5.10.0",
"tslint-config-airbnb": "^5.9.2",
"typescript": "^3.0.1",
"typescript": "~3.1.0",
"webpack": "^3.5.4",
"webpack-dev-middleware": "^1.12.0",
"webpack-hot-middleware": "^2.18.2"
Expand Down
4 changes: 2 additions & 2 deletions src/lib/factories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface ICreateShorthandOptions {
defaultProps?: IProps

/** Override props object or function (called with regular props) */
overrideProps?: IProps | ((props: IProps) => IProps)
overrideProps?: IProps & ((props: IProps) => IProps) | IProps

/** Whether or not automatic key generation is allowed */
generateKey?: boolean
Expand Down Expand Up @@ -86,7 +86,7 @@ export function createShorthand(
let { overrideProps } = options
overrideProps =
typeof overrideProps === 'function'
? overrideProps({ ...defaultProps, ...usersProps })
? (overrideProps as Function)({ ...defaultProps, ...usersProps })
: overrideProps || {}

// Merge props
Expand Down
4 changes: 2 additions & 2 deletions types/theme.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export interface IThemePrepared {
}

export interface IThemeComponentStylesInput {
[key: string]: IComponentPartStylesInput
[key: string]: IComponentPartStylesInput | undefined

Accordion?: IComponentPartStylesInput
Attachment?: IComponentPartStylesInput
Expand Down Expand Up @@ -199,7 +199,7 @@ export interface IThemeComponentStylesInput {
}

export interface IThemeComponentStylesPrepared {
[key: string]: IComponentPartStylesPrepared
[key: string]: IComponentPartStylesPrepared | undefined

Accordion?: IComponentPartStylesPrepared
Attachment?: IComponentPartStylesPrepared
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9341,10 +9341,10 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=

typescript@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.0.1.tgz#43738f29585d3a87575520a4b93ab6026ef11fdb"
integrity sha512-zQIMOmC+372pC/CCVLqnQ0zSBiY7HHodU7mpQdjiZddek4GMj31I3dUJ7gAs9o65X7mnRma6OokOkc6f9jjfBg==
typescript@~3.1.0:
version "3.1.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.1.3.tgz#01b70247a6d3c2467f70c45795ef5ea18ce191d5"
integrity sha512-+81MUSyX+BaSo+u2RbozuQk/UWx6hfG0a5gHu4ANEM4sU96XbuIyAB+rWBW1u70c6a5QuZfuYICn3s2UjuHUpA==

ua-parser-js@^0.7.18:
version "0.7.18"
Expand Down