diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-03-30 01:02:46 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-03-30 01:02:46 +0800 |
commit | 665011174bab7cfc6ec53e0044d60e1463222aee (patch) | |
tree | 44bc55bd390044d6cbfe8e0f7dddb621a8be7249 /packages/monorepo-scripts/src | |
parent | d106079d9b69191d9cdc6d9323dbae3e4b45daf2 (diff) | |
parent | c4dd9658e791a9f821ea3b6eb4326bcba53b081a (diff) | |
download | dexon-sol-tools-665011174bab7cfc6ec53e0044d60e1463222aee.tar dexon-sol-tools-665011174bab7cfc6ec53e0044d60e1463222aee.tar.gz dexon-sol-tools-665011174bab7cfc6ec53e0044d60e1463222aee.tar.bz2 dexon-sol-tools-665011174bab7cfc6ec53e0044d60e1463222aee.tar.lz dexon-sol-tools-665011174bab7cfc6ec53e0044d60e1463222aee.tar.xz dexon-sol-tools-665011174bab7cfc6ec53e0044d60e1463222aee.tar.zst dexon-sol-tools-665011174bab7cfc6ec53e0044d60e1463222aee.zip |
Merge branch 'development' into feature/website/wallet-wrap
* development: (35 commits)
Fix CHANGELOG
Update Yarn.lock
Standardize changelog dates and format
Fix stubbing of a non-existent property
Remove redundant cast
Move common types out of web3 types
Add monorepo_scripts to npmignore
Add typeRoots
Add clean-state tests
Remove nested .gitignore files since `yarn publish` gets confused by them and ignores their contents on the top-level scope
Remove WETH hack now that updated WETH address is in TokenRegistry
Revert TokenRegistry address on Kovan
Improve rounding error message
Portal fill with mixed decimals
Add error popover if TokenRegistry on network user is browsing on don't include the requisite default tokens for 0x Portal to function
Set timeout for compiler tests
Remove redundant types
Add missing param comments
Fix a comment
Add a comment
...
Diffstat (limited to 'packages/monorepo-scripts/src')
-rw-r--r-- | packages/monorepo-scripts/src/globals.d.ts | 19 | ||||
-rw-r--r-- | packages/monorepo-scripts/src/test_installation.ts | 58 |
2 files changed, 77 insertions, 0 deletions
diff --git a/packages/monorepo-scripts/src/globals.d.ts b/packages/monorepo-scripts/src/globals.d.ts index 757ae4097..1d49559f2 100644 --- a/packages/monorepo-scripts/src/globals.d.ts +++ b/packages/monorepo-scripts/src/globals.d.ts @@ -6,3 +6,22 @@ declare module 'es6-promisify'; declare module 'semver-sort' { const desc: (versions: string[]) => string[]; } + +declare interface LernaPackage { + location: string; + package: { + private?: boolean; + name: string; + main?: string; + config?: { + additionalTsTypings?: string[]; + }; + }; +} +declare function lernaGetPackages(path: string): LernaPackage[]; +// lerna-get-packages declarations +declare module 'lerna-get-packages' { + export = lernaGetPackages; +} + +declare module 'promisify-child-process'; diff --git a/packages/monorepo-scripts/src/test_installation.ts b/packages/monorepo-scripts/src/test_installation.ts new file mode 100644 index 000000000..195b64b2a --- /dev/null +++ b/packages/monorepo-scripts/src/test_installation.ts @@ -0,0 +1,58 @@ +#!/usr/bin/env node + +import * as fs from 'fs'; +import lernaGetPackages = require('lerna-get-packages'); +import * as _ from 'lodash'; +import * as path from 'path'; +import { exec as execAsync } from 'promisify-child-process'; +import * as rimraf from 'rimraf'; + +import { utils } from './utils'; + +(async () => { + const monorepoRootPath = path.join(__dirname, '../../..'); + const lernaPackages = lernaGetPackages(monorepoRootPath); + const installablePackages = _.filter( + lernaPackages, + lernaPackage => + !lernaPackage.package.private && + !_.isUndefined(lernaPackage.package.main) && + lernaPackage.package.main.endsWith('.js'), + ); + for (const installableLernaPackage of installablePackages) { + const packagePath = installableLernaPackage.location; + const packageName = installableLernaPackage.package.name; + utils.log(`Testing ${packageName}`); + let result = await execAsync('npm pack', { cwd: packagePath }); + const packedPackageFileName = result.stdout.trim(); + const testDirectory = path.join(monorepoRootPath, '../test-env'); + fs.mkdirSync(testDirectory); + result = await execAsync('yarn init --yes', { cwd: testDirectory }); + utils.log(`Installing ${packedPackageFileName}`); + result = await execAsync(`yarn add ${packagePath}/${packedPackageFileName}`, { cwd: testDirectory }); + const indexFilePath = path.join(testDirectory, 'index.ts'); + fs.writeFileSync(indexFilePath, `import * as Package from '${packageName}'`); + const tsConfig = { + compilerOptions: { + typeRoots: ['node_modules/@0xproject/typescript-typings/types', 'node_modules/@types'], + module: 'commonjs', + target: 'es5', + lib: ['es2017', 'dom'], + declaration: true, + noImplicitReturns: true, + pretty: true, + strict: true, + }, + include: ['index.ts'], + }; + const tsconfigFilePath = path.join(testDirectory, 'tsconfig.json'); + fs.writeFileSync(tsconfigFilePath, JSON.stringify(tsConfig, null, 4)); + utils.log(`Compiling ${packageName}`); + await execAsync('../node_modules/typescript/bin/tsc', { cwd: testDirectory }); + utils.log(`Successfully compiled with ${packageName} as a dependency`); + rimraf.sync(testDirectory); + } +})().catch(err => { + utils.log(err.stdout); + process.exit(1); +}); |