diff options
author | Fabio Berger <me@fabioberger.com> | 2018-07-26 20:14:14 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-07-26 20:14:14 +0800 |
commit | e320f343f8d18a301bc1d74dcb2816e3d1e3be6f (patch) | |
tree | 52b58aa0dd2095b1c2b0f5c577fb33351d095aa4 | |
parent | f6cc7d9c3cb9bbfc3ad5c2ba7a5c0495016e082a (diff) | |
download | dexon-sol-tools-e320f343f8d18a301bc1d74dcb2816e3d1e3be6f.tar.gz dexon-sol-tools-e320f343f8d18a301bc1d74dcb2816e3d1e3be6f.tar.zst dexon-sol-tools-e320f343f8d18a301bc1d74dcb2816e3d1e3be6f.zip |
Add support for testing installations post-publish as well
-rw-r--r-- | package.json | 1 | ||||
-rw-r--r-- | packages/monorepo-scripts/src/test_installation.ts | 6 |
2 files changed, 5 insertions, 2 deletions
diff --git a/package.json b/package.json index 40050fd2e..d4a21402f 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "prettier:ci": "prettier --list-different '**/*.{ts,tsx,json,md}' --config .prettierrc", "report_coverage": "lcov-result-merger 'packages/*/coverage/lcov.info' | coveralls", "test:installation": "node ./packages/monorepo-scripts/lib/test_installation.js", + "test:installation:local": "IS_LOCAL_PUBLISH=true node ./packages/monorepo-scripts/lib/test_installation.js", "run:publish": "run-s install:all build:monorepo_scripts script:prepublish_checks rebuild:no_website script:publish", "run:publish:local": "IS_LOCAL_PUBLISH=true yarn run:publish", "script:prepublish_checks": "node ./packages/monorepo-scripts/lib/prepublish_checks.js", diff --git a/packages/monorepo-scripts/src/test_installation.ts b/packages/monorepo-scripts/src/test_installation.ts index a9610e5ee..12c0e7603 100644 --- a/packages/monorepo-scripts/src/test_installation.ts +++ b/packages/monorepo-scripts/src/test_installation.ts @@ -9,6 +9,8 @@ import * as rimraf from 'rimraf'; import { utils } from './utils/utils'; (async () => { + const IS_LOCAL_PUBLISH = process.env.IS_LOCAL_PUBLISH === 'true'; + const registry = IS_LOCAL_PUBLISH ? 'http://localhost:4873' : 'https://registry.npmjs.org'; const monorepoRootPath = path.join(__dirname, '../../..'); const packages = utils.getTopologicallySortedPackages(monorepoRootPath); const installablePackages = _.filter( @@ -26,9 +28,9 @@ import { utils } from './utils/utils'; fs.mkdirSync(testDirectory); await execAsync('yarn init --yes', { cwd: testDirectory }); const npmrcFilePath = path.join(testDirectory, '.npmrc'); - fs.writeFileSync(npmrcFilePath, `registry=http://localhost:4873`); + fs.writeFileSync(npmrcFilePath, `registry=${registry}`); utils.log(`Installing ${packageName}@${lastChangelogVersion}`); - await execAsync(`npm install --save ${packageName}@${lastChangelogVersion} --registry=http://localhost:4873`, { + await execAsync(`npm install --save ${packageName}@${lastChangelogVersion} --registry=${registry}`, { cwd: testDirectory, }); const indexFilePath = path.join(testDirectory, 'index.ts'); |