aboutsummaryrefslogtreecommitdiffstats
path: root/packages/monorepo-scripts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/monorepo-scripts')
-rw-r--r--packages/monorepo-scripts/CHANGELOG.json17
-rw-r--r--packages/monorepo-scripts/README.md4
-rw-r--r--packages/monorepo-scripts/package.json8
-rw-r--r--packages/monorepo-scripts/src/doc_gen_configs.ts16
-rw-r--r--packages/monorepo-scripts/src/find_unused_dependencies.ts2
-rw-r--r--packages/monorepo-scripts/src/prepublish_checks.ts2
-rw-r--r--packages/monorepo-scripts/src/publish.ts20
-rw-r--r--packages/monorepo-scripts/src/publish_release_notes.ts4
-rw-r--r--packages/monorepo-scripts/src/test_installation.ts21
-rw-r--r--packages/monorepo-scripts/src/utils/changelog_utils.ts3
-rw-r--r--packages/monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts17
-rw-r--r--packages/monorepo-scripts/src/utils/github_release_utils.ts20
-rw-r--r--packages/monorepo-scripts/src/utils/utils.ts2
13 files changed, 86 insertions, 50 deletions
diff --git a/packages/monorepo-scripts/CHANGELOG.json b/packages/monorepo-scripts/CHANGELOG.json
index 3b8684fab..170a97a33 100644
--- a/packages/monorepo-scripts/CHANGELOG.json
+++ b/packages/monorepo-scripts/CHANGELOG.json
@@ -1,5 +1,22 @@
[
{
+ "version": "1.0.6",
+ "changes": [
+ {
+ "note": "Render date formats in UTC to prevent conflicts when publishing in different timezones.",
+ "pr": 1143
+ },
+ {
+ "note": "Add AssetBuyerError to the IGNORED_EXCESSIVE_TYPES array",
+ "pr": 1139
+ },
+ {
+ "note": "Add ForwarderError to the IGNORED_EXCESSIVE_TYPES array",
+ "pr": 1147
+ }
+ ]
+ },
+ {
"timestamp": 1534210131,
"version": "1.0.5",
"changes": [
diff --git a/packages/monorepo-scripts/README.md b/packages/monorepo-scripts/README.md
index d979e27dc..0673098b5 100644
--- a/packages/monorepo-scripts/README.md
+++ b/packages/monorepo-scripts/README.md
@@ -47,13 +47,13 @@ yarn install
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
-PKG=@0xproject/monorepo-scripts yarn build
+PKG=@0x/monorepo-scripts yarn build
```
Or continuously rebuild on change:
```bash
-PKG=@0xproject/monorepo-scripts yarn watch
+PKG=@0x/monorepo-scripts yarn watch
```
### Clean
diff --git a/packages/monorepo-scripts/package.json b/packages/monorepo-scripts/package.json
index 83091ae84..a31085014 100644
--- a/packages/monorepo-scripts/package.json
+++ b/packages/monorepo-scripts/package.json
@@ -1,7 +1,7 @@
{
"private": true,
- "name": "@0xproject/monorepo-scripts",
- "version": "1.0.11",
+ "name": "@0x/monorepo-scripts",
+ "version": "1.0.13",
"engines": {
"node": ">=6.12"
},
@@ -11,7 +11,7 @@
"scripts": {
"build": "tsc -b",
"build:ci": "yarn build",
- "lint": "tslint --project .",
+ "lint": "tslint --format stylish --project .",
"clean": "shx rm -rf lib",
"test:publish": "run-s build script:publish",
"find_unused_deps": "run-s build script:find_unused_deps",
@@ -65,7 +65,7 @@
"semver": "5.5.0",
"semver-diff": "^2.1.0",
"semver-sort": "0.0.4",
- "typedoc": "0.12.0",
+ "typedoc": "0.13.0",
"yargs": "^10.0.3"
},
"publishConfig": {
diff --git a/packages/monorepo-scripts/src/doc_gen_configs.ts b/packages/monorepo-scripts/src/doc_gen_configs.ts
index e3ddeddc9..7a14f8664 100644
--- a/packages/monorepo-scripts/src/doc_gen_configs.ts
+++ b/packages/monorepo-scripts/src/doc_gen_configs.ts
@@ -16,8 +16,14 @@ export const docGenConfigs: DocGenConfigs = {
Schema:
'https://github.com/tdegrunt/jsonschema/blob/5c2edd4baba149964aec0f23c87ad12c25a50dfb/lib/index.d.ts#L49',
Uint8Array: 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array',
+ // HACK: CI can handle these without the namespace but some local setups (Jacob) require the namespace prefix
+ // This is duplicated until we can discover the source of the issue.
GanacheOpts: 'https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/ganache-core/index.d.ts#L8',
keystore: 'https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/eth-lightwallet/index.d.ts#L36',
+ 'Ganache.GanacheOpts':
+ 'https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/ganache-core/index.d.ts#L8',
+ 'lightwallet.keystore':
+ 'https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/eth-lightwallet/index.d.ts#L36',
},
// If a 0x package re-exports an external package, we should add a link to it's exported items here
EXTERNAL_EXPORT_TO_LINK: {
@@ -30,6 +36,7 @@ export const docGenConfigs: DocGenConfigs = {
// factory method which instantiates an instance of a class, but we don't want users instantiating it themselves
// and getting confused. Any class name in this list will not have it's constructor rendered in our docs.
CLASSES_WITH_HIDDEN_CONSTRUCTORS: [
+ 'AssetBuyer',
'ERC20ProxyWrapper',
'ERC20TokenWrapper',
'ERC721ProxyWrapper',
@@ -43,7 +50,14 @@ export const docGenConfigs: DocGenConfigs = {
// Some types are not explicitly part of the public interface like params, return values, etc... But we still
// want them exported. E.g error enum types that can be thrown by methods. These must be manually added to this
// config
- IGNORED_EXCESSIVE_TYPES: ['NonceSubproviderErrors', 'Web3WrapperErrors', 'ContractWrappersError', 'OrderError'],
+ IGNORED_EXCESSIVE_TYPES: [
+ 'NonceSubproviderErrors',
+ 'Web3WrapperErrors',
+ 'ContractWrappersError',
+ 'OrderError',
+ 'AssetBuyerError',
+ 'ForwarderWrapperError',
+ ],
// Some libraries only export types. In those cases, we cannot check if the exported types are part of the
// "exported public interface". Thus we add them here and skip those checks.
TYPES_ONLY_LIBRARIES: ['ethereum-types', 'types'],
diff --git a/packages/monorepo-scripts/src/find_unused_dependencies.ts b/packages/monorepo-scripts/src/find_unused_dependencies.ts
index 4bb4b7dc5..42b4b7890 100644
--- a/packages/monorepo-scripts/src/find_unused_dependencies.ts
+++ b/packages/monorepo-scripts/src/find_unused_dependencies.ts
@@ -7,7 +7,7 @@ import { constants } from './constants';
import { utils } from './utils/utils';
// For some reason, `depcheck` hangs on some packages. Add them here.
-const IGNORE_PACKAGES = ['@0xproject/sol-compiler'];
+const IGNORE_PACKAGES = ['@0x/sol-compiler'];
(async () => {
utils.log('*** NOTE: Not all deps listed here are actually not required. ***');
diff --git a/packages/monorepo-scripts/src/prepublish_checks.ts b/packages/monorepo-scripts/src/prepublish_checks.ts
index 683c26094..5f603ebc7 100644
--- a/packages/monorepo-scripts/src/prepublish_checks.ts
+++ b/packages/monorepo-scripts/src/prepublish_checks.ts
@@ -11,7 +11,7 @@ import { utils } from './utils/utils';
async function prepublishChecksAsync(): Promise<void> {
const shouldIncludePrivate = false;
- const updatedPublicPackages = await utils.getUpdatedPackagesAsync(shouldIncludePrivate);
+ const updatedPublicPackages = await utils.getPackagesToPublishAsync(shouldIncludePrivate);
await checkCurrentVersionMatchesLatestPublishedNPMPackageAsync(updatedPublicPackages);
await checkChangelogFormatAsync(updatedPublicPackages);
diff --git a/packages/monorepo-scripts/src/publish.ts b/packages/monorepo-scripts/src/publish.ts
index 646818c58..854a72b86 100644
--- a/packages/monorepo-scripts/src/publish.ts
+++ b/packages/monorepo-scripts/src/publish.ts
@@ -18,7 +18,7 @@ import { DocGenerateAndUploadUtils } from './utils/doc_generate_and_upload_utils
import { publishReleaseNotesAsync } from './utils/github_release_utils';
import { utils } from './utils/utils';
-const NPM_NAMESPACE = '@0xproject/';
+const NPM_NAMESPACE = '@0x/';
const TODAYS_TIMESTAMP = moment().unix();
async function confirmAsync(message: string): Promise<void> {
@@ -34,8 +34,12 @@ async function confirmAsync(message: string): Promise<void> {
(async () => {
// Fetch public, updated Lerna packages
const shouldIncludePrivate = true;
- const allUpdatedPackages = await utils.getUpdatedPackagesAsync(shouldIncludePrivate);
- const packagesWithDocs = getPackagesWithDocs(allUpdatedPackages);
+ const allPackagesToPublish = await utils.getPackagesToPublishAsync(shouldIncludePrivate);
+ if (_.isEmpty(allPackagesToPublish)) {
+ utils.log('No packages need publishing');
+ process.exit(0);
+ }
+ const packagesWithDocs = getPackagesWithDocs(allPackagesToPublish);
if (!configs.IS_LOCAL_PUBLISH) {
await confirmAsync(
@@ -45,12 +49,12 @@ async function confirmAsync(message: string): Promise<void> {
}
// Update CHANGELOGs
- const updatedPublicPackages = _.filter(allUpdatedPackages, pkg => !pkg.packageJson.private);
+ const updatedPublicPackages = _.filter(allPackagesToPublish, pkg => !pkg.packageJson.private);
const updatedPublicPackageNames = _.map(updatedPublicPackages, pkg => pkg.packageJson.name);
utils.log(`Will update CHANGELOGs and publish: \n${updatedPublicPackageNames.join('\n')}\n`);
const packageToNextVersion = await updateChangeLogsAsync(updatedPublicPackages);
- const updatedPrivatePackages = _.filter(allUpdatedPackages, pkg => pkg.packageJson.private);
+ const updatedPrivatePackages = _.filter(allPackagesToPublish, pkg => pkg.packageJson.private);
_.each(updatedPrivatePackages, pkg => {
const currentVersion = pkg.packageJson.version;
const packageName = pkg.packageJson.name;
@@ -96,7 +100,7 @@ function getPackagesWithDocs(allUpdatedPackages: Package[]): Package[] {
const packagesWithDocPages = packagesWithDocPagesStringIfExist.split(' ');
const updatedPackagesWithDocPages: Package[] = [];
_.each(allUpdatedPackages, pkg => {
- const nameWithoutPrefix = pkg.packageJson.name.replace('@0xproject/', '');
+ const nameWithoutPrefix = pkg.packageJson.name.replace('@0x/', '');
if (_.includes(packagesWithDocPages, nameWithoutPrefix)) {
updatedPackagesWithDocPages.push(pkg);
}
@@ -110,7 +114,7 @@ async function generateAndUploadDocJsonsAsync(
shouldUploadDocs: boolean,
): Promise<void> {
for (const pkg of packagesWithDocs) {
- const nameWithoutPrefix = pkg.packageJson.name.replace('@0xproject/', '');
+ const nameWithoutPrefix = pkg.packageJson.name.replace('@0x/', '');
const docGenerateAndUploadUtils = new DocGenerateAndUploadUtils(nameWithoutPrefix, isStaging, shouldUploadDocs);
await docGenerateAndUploadUtils.generateAndUploadDocsAsync();
}
@@ -130,7 +134,7 @@ async function confirmDocPagesRenderAsync(packagesWithDocs: Package[]): Promise<
_.each(packagesWithDocs, pkg => {
const name = pkg.packageJson.name;
- const nameWithoutPrefix = _.startsWith(name, NPM_NAMESPACE) ? name.split('@0xproject/')[1] : name;
+ const nameWithoutPrefix = _.startsWith(name, NPM_NAMESPACE) ? name.split('@0x/')[1] : name;
const link = `${constants.stagingWebsite}/docs/${nameWithoutPrefix}`;
// tslint:disable-next-line:no-floating-promises
opn(link);
diff --git a/packages/monorepo-scripts/src/publish_release_notes.ts b/packages/monorepo-scripts/src/publish_release_notes.ts
index 6090498e0..d2082521c 100644
--- a/packages/monorepo-scripts/src/publish_release_notes.ts
+++ b/packages/monorepo-scripts/src/publish_release_notes.ts
@@ -15,14 +15,14 @@ const args = yargs
'Space-separated list of packages to generated release notes for. If not supplied, it does all `Lerna updated` packages.',
type: 'string',
})
- .example('$0 --isDryRun true --packages "0x.js @0xproject/web3-wrapper"', 'Full usage example').argv;
+ .example('$0 --isDryRun true --packages "0x.js @0x/web3-wrapper"', 'Full usage example').argv;
(async () => {
const isDryRun = args.isDryRun;
let packages;
if (_.isUndefined(args.packages)) {
const shouldIncludePrivate = false;
- packages = await utils.getUpdatedPackagesAsync(shouldIncludePrivate);
+ packages = await utils.getPackagesToPublishAsync(shouldIncludePrivate);
} else {
const packageNames = args.packages.split(' ');
packages = await utils.getPackagesByNameAsync(packageNames);
diff --git a/packages/monorepo-scripts/src/test_installation.ts b/packages/monorepo-scripts/src/test_installation.ts
index be39b1878..96875d0f9 100644
--- a/packages/monorepo-scripts/src/test_installation.ts
+++ b/packages/monorepo-scripts/src/test_installation.ts
@@ -12,12 +12,7 @@ import { Package } from './types';
import { utils } from './utils/utils';
// Packages might not be runnable if they are command-line tools or only run in browsers.
-const UNRUNNABLE_PACKAGES = [
- '@0xproject/abi-gen',
- '@0xproject/sra-report',
- '@0xproject/react-shared',
- '@0xproject/react-docs',
-];
+const UNRUNNABLE_PACKAGES = ['@0x/abi-gen', '@0x/react-shared', '@0x/react-docs'];
const mkdirpAsync = promisify(mkdirp);
const rimrafAsync = promisify(rimraf);
@@ -104,13 +99,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 });
@@ -124,7 +116,7 @@ async function testInstallPackageAsync(
await writeFileAsync(indexFilePath, `import * as Package from '${packageName}';\nconsole.log(Package);\n`);
const tsConfig = {
compilerOptions: {
- typeRoots: ['node_modules/@0xproject/typescript-typings/types', 'node_modules/@types'],
+ typeRoots: ['node_modules/@0x/typescript-typings/types', 'node_modules/@types'],
module: 'commonjs',
target: 'es5',
lib: ['es2017', 'dom'],
@@ -132,6 +124,7 @@ async function testInstallPackageAsync(
noImplicitReturns: true,
pretty: true,
strict: true,
+ resolveJsonModule: true,
},
include: ['index.ts'],
};
diff --git a/packages/monorepo-scripts/src/utils/changelog_utils.ts b/packages/monorepo-scripts/src/utils/changelog_utils.ts
index 8058d222b..0b46bf670 100644
--- a/packages/monorepo-scripts/src/utils/changelog_utils.ts
+++ b/packages/monorepo-scripts/src/utils/changelog_utils.ts
@@ -19,7 +19,8 @@ CHANGELOG
export const changelogUtils = {
getChangelogMdTitle(versionChangelog: VersionChangelog): string {
- const date = moment(`${versionChangelog.timestamp}`, 'X').format('MMMM D, YYYY');
+ // Use UTC rather than the local machines time (formatted date time is +0:00)
+ const date = moment.utc(`${versionChangelog.timestamp}`, 'X').format('MMMM D, YYYY');
const title = `\n## v${versionChangelog.version} - _${date}_\n\n`;
return title;
},
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..1a4294e9c 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');
@@ -324,7 +331,7 @@ export class DocGenerateAndUploadUtils {
throw new Error(
`${this._packageName} package exports BUT does not need: \n${excessiveReferencesExceptIgnored.join(
'\n',
- )} \nin it\'s index.ts. Remove them then try again.`,
+ )} \nin it\'s index.ts. Remove them then try again OR if we still want them exported (e.g error enum types), then add them to the IGNORED_EXCESSIVE_TYPES array.`,
);
}
}
@@ -395,7 +402,7 @@ export class DocGenerateAndUploadUtils {
sanitizedExportPathToExportPath[sanitizedExportPath] = exportPath;
return sanitizedExportPath;
}
- const monorepoPrefix = '@0xproject/';
+ const monorepoPrefix = '@0x/';
if (_.startsWith(exportPath, monorepoPrefix)) {
const sanitizedExportPath = exportPath.split(monorepoPrefix)[1];
sanitizedExportPathToExportPath[sanitizedExportPath] = exportPath;
@@ -471,7 +478,7 @@ export class DocGenerateAndUploadUtils {
});
});
- // @0xproject/types & ethereum-types are examples of packages where their index.ts exports types
+ // @0x/types & ethereum-types are examples of packages where their index.ts exports types
// directly, meaning no internal paths will exist to follow. Other packages also have direct exports
// in their index.ts, so we always add it to the source files passed to TypeDoc
if (typeDocSourceIncludes.size === 0) {
diff --git a/packages/monorepo-scripts/src/utils/github_release_utils.ts b/packages/monorepo-scripts/src/utils/github_release_utils.ts
index 0f3485de0..7434d397e 100644
--- a/packages/monorepo-scripts/src/utils/github_release_utils.ts
+++ b/packages/monorepo-scripts/src/utils/github_release_utils.ts
@@ -12,7 +12,7 @@ import { utils } from './utils';
const publishReleaseAsync = promisify(publishRelease);
// tslint:disable-next-line:completed-docs
-export async function publishReleaseNotesAsync(updatedPublishPackages: Package[], isDryRun: boolean): Promise<void> {
+export async function publishReleaseNotesAsync(packagesToPublish: Package[], isDryRun: boolean): Promise<void> {
// Git push a tag representing this publish (publish-{commit-hash}) (truncate hash)
const result = await execAsync('git log -n 1 --pretty=format:"%H"', { cwd: constants.monorepoRootPath });
const latestGitCommit = result.stdout;
@@ -40,12 +40,8 @@ export async function publishReleaseNotesAsync(updatedPublishPackages: Package[]
let assets: string[] = [];
let aggregateNotes = '';
- _.each(updatedPublishPackages, pkg => {
- const notes = getReleaseNotesForPackage(pkg.packageJson.name, pkg.packageJson.version);
- if (_.isEmpty(notes)) {
- return; // don't include it
- }
- aggregateNotes += `### ${pkg.packageJson.name}@${pkg.packageJson.version}\n${notes}\n\n`;
+ _.each(packagesToPublish, pkg => {
+ aggregateNotes += getReleaseNotesForPackage(pkg.packageJson.name);
const packageAssets = _.get(pkg.packageJson, 'config.postpublish.assets');
if (!_.isUndefined(packageAssets)) {
@@ -92,8 +88,8 @@ function adjustAssetPaths(assets: string[]): string[] {
return finalAssets;
}
-function getReleaseNotesForPackage(packageName: string, version: string): string {
- const packageNameWithoutNamespace = packageName.replace('@0xproject/', '');
+function getReleaseNotesForPackage(packageName: string): string {
+ const packageNameWithoutNamespace = packageName.replace('@0x/', '');
const changelogJSONPath = path.join(
constants.monorepoRootPath,
'packages',
@@ -115,5 +111,9 @@ function getReleaseNotesForPackage(packageName: string, version: string): string
}
notes += `\n`;
});
- return notes;
+ if (_.isEmpty(notes)) {
+ return ''; // don't include it
+ }
+ const releaseNotesSection = `### ${packageName}@${latestLog.version}\n${notes}\n\n`;
+ return releaseNotesSection;
}
diff --git a/packages/monorepo-scripts/src/utils/utils.ts b/packages/monorepo-scripts/src/utils/utils.ts
index 5e2e877c7..44ff971e8 100644
--- a/packages/monorepo-scripts/src/utils/utils.ts
+++ b/packages/monorepo-scripts/src/utils/utils.ts
@@ -61,7 +61,7 @@ export const utils = {
});
return updatedPackages;
},
- async getUpdatedPackagesAsync(shouldIncludePrivate: boolean): Promise<Package[]> {
+ async getPackagesToPublishAsync(shouldIncludePrivate: boolean): Promise<Package[]> {
const updatedPublicPackages = await utils.getLernaUpdatedPackagesAsync(shouldIncludePrivate);
const updatedPackageNames = _.map(updatedPublicPackages, pkg => pkg.name);