diff options
author | Fabio Berger <me@fabioberger.com> | 2018-10-16 23:58:24 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-10-16 23:58:24 +0800 |
commit | c333d093b585fa0250a6973f2d396eb3cf227334 (patch) | |
tree | a00b3d77fb78c744ee0fee2b57ef25ce775b087d /packages/monorepo-scripts | |
parent | 1cfcc82ea9869e14c1a1b78e1376c89fdbeb91f4 (diff) | |
parent | 72f5719b3412da7840a7b85e4dce512ecbaece4d (diff) | |
download | dexon-sol-tools-c333d093b585fa0250a6973f2d396eb3cf227334.tar dexon-sol-tools-c333d093b585fa0250a6973f2d396eb3cf227334.tar.gz dexon-sol-tools-c333d093b585fa0250a6973f2d396eb3cf227334.tar.bz2 dexon-sol-tools-c333d093b585fa0250a6973f2d396eb3cf227334.tar.lz dexon-sol-tools-c333d093b585fa0250a6973f2d396eb3cf227334.tar.xz dexon-sol-tools-c333d093b585fa0250a6973f2d396eb3cf227334.tar.zst dexon-sol-tools-c333d093b585fa0250a6973f2d396eb3cf227334.zip |
merge development
Diffstat (limited to 'packages/monorepo-scripts')
-rw-r--r-- | packages/monorepo-scripts/src/test_installation.ts | 12 | ||||
-rw-r--r-- | packages/monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts | 11 |
2 files changed, 14 insertions, 9 deletions
diff --git a/packages/monorepo-scripts/src/test_installation.ts b/packages/monorepo-scripts/src/test_installation.ts index be39b1878..a642498ac 100644 --- a/packages/monorepo-scripts/src/test_installation.ts +++ b/packages/monorepo-scripts/src/test_installation.ts @@ -104,13 +104,10 @@ async function testInstallPackageAsync( const packageName = installablePackage.packageJson.name; utils.log(`Testing ${packageName}@${lastChangelogVersion}`); const packageDirName = path.join(...(packageName + '-test').split('/')); - const testDirectory = path.join( - monorepoRootPath, - 'packages', - 'monorepo-scripts', - '.installation-test', - packageDirName, - ); + // NOTE(fabio): The `testDirectory` needs to be somewhere **outside** the monorepo root directory. + // Otherwise, it will have access to the hoisted `node_modules` directory and the Typescript missing + // type errors will not be caught. + const testDirectory = path.join(monorepoRootPath, '..', '.installation-test', packageDirName); await rimrafAsync(testDirectory); await mkdirpAsync(testDirectory); await execAsync('yarn init --yes', { cwd: testDirectory }); @@ -132,6 +129,7 @@ async function testInstallPackageAsync( noImplicitReturns: true, pretty: true, strict: true, + resolveJsonModule: true, }, include: ['index.ts'], }; diff --git a/packages/monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts b/packages/monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts index de52b3a47..4fea94414 100644 --- a/packages/monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts +++ b/packages/monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts @@ -1,4 +1,4 @@ -import { readFileSync, writeFileSync } from 'fs'; +import { existsSync, readFileSync, writeFileSync } from 'fs'; import * as _ from 'lodash'; import * as path from 'path'; import { exec as execAsync } from 'promisify-child-process'; @@ -103,6 +103,9 @@ export class DocGenerateAndUploadUtils { switch (node.kind) { case ts.SyntaxKind.ExportDeclaration: { const exportClause = (node as any).exportClause; + if (_.isUndefined(exportClause)) { + return; + } const exportPath = exportClause.parent.moduleSpecifier.text; _.each(exportClause.elements, element => { const exportItem = element.name.escapedText; @@ -187,7 +190,11 @@ export class DocGenerateAndUploadUtils { const typeDocExtraFileIncludes: string[] = this._getTypeDocFileIncludesForPackage(); // In order to avoid TS errors, we need to pass TypeDoc the package's global.d.ts file - typeDocExtraFileIncludes.push(path.join(this._packagePath, 'src', 'globals.d.ts')); + // if it exists. + const globalTypeDefinitionsPath = path.join(this._packagePath, 'src', 'globals.d.ts'); + if (existsSync(globalTypeDefinitionsPath)) { + typeDocExtraFileIncludes.push(globalTypeDefinitionsPath); + } utils.log(`GENERATE_UPLOAD_DOCS: Generating Typedoc JSON for ${this._packageName}...`); const jsonFilePath = path.join(this._packagePath, 'generated_docs', 'index.json'); |