|
1 | 1 | import * as express from 'express' |
2 | 2 | import * as fs from 'fs' |
3 | | -import { parallel, series, task } from 'gulp' |
| 3 | +import { series, task } from 'gulp' |
4 | 4 | import { rollup as lernaAliases } from 'lerna-alias' |
5 | 5 | import * as path from 'path' |
6 | 6 | import * as portfinder from 'portfinder' |
@@ -101,7 +101,10 @@ const performBrowserTest = async (publicDirectory: string, listenPort: number) = |
101 | 101 | const server = await startServer(publicDirectory, listenPort) |
102 | 102 |
|
103 | 103 | const browser = await puppeteer.launch({ |
104 | | - args: ['--single-process'], // Workaround for newPage hang in CircleCI: https://github.com/GoogleChrome/puppeteer/issues/1409#issuecomment-453845568 |
| 104 | + args: [ |
| 105 | + // Workaround for newPage hang in CircleCI: https://github.com/GoogleChrome/puppeteer/issues/1409#issuecomment-453845568 |
| 106 | + process.env.CI && '--single-process', |
| 107 | + ].filter(Boolean), |
105 | 108 | }) |
106 | 109 | const page = await browser.newPage() |
107 | 110 | let error: Error |
@@ -199,7 +202,45 @@ task('test:projects:rollup', async () => { |
199 | 202 | logger(`✔️Browser test was passed`) |
200 | 203 | }) |
201 | 204 |
|
| 205 | +task('test:projects:typings', async () => { |
| 206 | + const logger = log('test:projects:typings') |
| 207 | + |
| 208 | + const scaffoldPath = paths.base.bind(null, 'build/gulp/tasks/test-projects/typings') |
| 209 | + const tmpDirectory = tmp.dirSync({ prefix: 'stardust-' }).name |
| 210 | + |
| 211 | + logger(`✔️Temporary directory was created: ${tmpDirectory}`) |
| 212 | + |
| 213 | + const dependencies = [ |
| 214 | + '@types/react', |
| 215 | + '@types/react-dom', |
| 216 | + 'react', |
| 217 | + 'react-dom', |
| 218 | + 'typescript', |
| 219 | + ].join(' ') |
| 220 | + await runIn(tmpDirectory)(`yarn add ${dependencies}`) |
| 221 | + logger(`✔️Dependencies were installed`) |
| 222 | + |
| 223 | + const packedPackages = await packStardustPackages(logger) |
| 224 | + await addResolutionPathsForStardustPackages(tmpDirectory, packedPackages) |
| 225 | + await runIn(tmpDirectory)(`yarn add ${packedPackages['@stardust-ui/react']}`) |
| 226 | + logger(`✔️Stardust UI packages were added to dependencies`) |
| 227 | + |
| 228 | + fs.mkdirSync(path.resolve(tmpDirectory, 'src')) |
| 229 | + fs.copyFileSync(scaffoldPath('index.tsx'), path.resolve(tmpDirectory, 'src/index.tsx')) |
| 230 | + fs.copyFileSync(scaffoldPath('tsconfig.json'), path.resolve(tmpDirectory, 'tsconfig.json')) |
| 231 | + logger(`✔️Source and configs were copied`) |
| 232 | + |
| 233 | + await runIn(tmpDirectory)(`yarn tsc --noEmit`) |
| 234 | + logger(`✔️Example project was successfully built: ${tmpDirectory}`) |
| 235 | +}) |
| 236 | + |
202 | 237 | task( |
203 | 238 | 'test:projects', |
204 | | - series('dll', 'bundle:all-packages', parallel('test:projects:cra-ts', 'test:projects:rollup')), |
| 239 | + series( |
| 240 | + 'dll', |
| 241 | + 'bundle:all-packages', |
| 242 | + 'test:projects:cra-ts', |
| 243 | + 'test:projects:rollup', |
| 244 | + 'test:projects:typings', |
| 245 | + ), |
205 | 246 | ) |
0 commit comments