diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-07-24 22:08:07 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-07-24 22:08:17 +0800 |
commit | 24aa5cd1bf38197a72be32a53f2e4a7c9aaf58ef (patch) | |
tree | eeb3de2f83aafbc9cd9ec22029a04265131992dd /packages/monorepo-scripts | |
parent | f699da90ba1658d50f251f988b27508cbf66b64c (diff) | |
download | dexon-0x-contracts-24aa5cd1bf38197a72be32a53f2e4a7c9aaf58ef.tar dexon-0x-contracts-24aa5cd1bf38197a72be32a53f2e4a7c9aaf58ef.tar.gz dexon-0x-contracts-24aa5cd1bf38197a72be32a53f2e4a7c9aaf58ef.tar.bz2 dexon-0x-contracts-24aa5cd1bf38197a72be32a53f2e4a7c9aaf58ef.tar.lz dexon-0x-contracts-24aa5cd1bf38197a72be32a53f2e4a7c9aaf58ef.tar.xz dexon-0x-contracts-24aa5cd1bf38197a72be32a53f2e4a7c9aaf58ef.tar.zst dexon-0x-contracts-24aa5cd1bf38197a72be32a53f2e4a7c9aaf58ef.zip |
Make the test:installation work with the local npm registry
Diffstat (limited to 'packages/monorepo-scripts')
-rw-r--r-- | packages/monorepo-scripts/package.json | 1 | ||||
-rw-r--r-- | packages/monorepo-scripts/src/test_installation.ts | 17 |
2 files changed, 13 insertions, 5 deletions
diff --git a/packages/monorepo-scripts/package.json b/packages/monorepo-scripts/package.json index 997338ff0..c11249feb 100644 --- a/packages/monorepo-scripts/package.json +++ b/packages/monorepo-scripts/package.json @@ -42,6 +42,7 @@ "typescript": "2.7.1" }, "dependencies": { + "@lerna/batch-packages": "^3.0.0-beta.18", "@types/depcheck": "^0.6.0", "async-child-process": "^1.1.1", "chalk": "^2.3.0", diff --git a/packages/monorepo-scripts/src/test_installation.ts b/packages/monorepo-scripts/src/test_installation.ts index 52868483f..a9610e5ee 100644 --- a/packages/monorepo-scripts/src/test_installation.ts +++ b/packages/monorepo-scripts/src/test_installation.ts @@ -10,20 +10,27 @@ import { utils } from './utils/utils'; (async () => { const monorepoRootPath = path.join(__dirname, '../../..'); - const packages = utils.getPackages(monorepoRootPath); + const packages = utils.getTopologicallySortedPackages(monorepoRootPath); const installablePackages = _.filter( packages, pkg => !pkg.packageJson.private && !_.isUndefined(pkg.packageJson.main) && pkg.packageJson.main.endsWith('.js'), ); + utils.log('Testing packages:'); + _.map(installablePackages, pkg => utils.log(`* ${pkg.packageJson.name}`)); for (const installablePackage of installablePackages) { + const changelogPath = path.join(installablePackage.location, 'CHANGELOG.json'); + const lastChangelogVersion = JSON.parse(fs.readFileSync(changelogPath).toString())[0].version; const packageName = installablePackage.packageJson.name; - const packageVersion = installablePackage.packageJson.version; utils.log(`Testing ${packageName}`); const testDirectory = path.join(monorepoRootPath, '../test-env'); fs.mkdirSync(testDirectory); - let result = await execAsync('yarn init --yes', { cwd: testDirectory }); - utils.log(`Installing ${packageName}@${packageVersion}`); - result = await execAsync(`yarn add ${packageName}@${packageVersion}`, { cwd: testDirectory }); + await execAsync('yarn init --yes', { cwd: testDirectory }); + const npmrcFilePath = path.join(testDirectory, '.npmrc'); + fs.writeFileSync(npmrcFilePath, `registry=http://localhost:4873`); + utils.log(`Installing ${packageName}@${lastChangelogVersion}`); + await execAsync(`npm install --save ${packageName}@${lastChangelogVersion} --registry=http://localhost:4873`, { + cwd: testDirectory, + }); const indexFilePath = path.join(testDirectory, 'index.ts'); fs.writeFileSync(indexFilePath, `import * as Package from '${packageName}';\n`); const tsConfig = { |