install-vue-canary
Advanced tools
Comparing version 0.0.4 to 0.0.5
23
index.js
@@ -148,7 +148,28 @@ #!/usr/bin/env node | ||
} else if (pm === 'npm') { | ||
// NPM requires exact version (won't work without version or `@latest`) | ||
const { stdout } = await execa('npm', ['info', '@vue/canary@latest', 'version', '--json'], { stdio: 'pipe' }) | ||
const latest = JSON.parse(stdout) | ||
const OVERRIDES_WITH_EXACT_VERSIONS = Object.fromEntries( | ||
Object.entries(CANARY_OVERRIDES).map(([k, v]) => [k, `${v}@${latest}`]) | ||
) | ||
pkg.overrides = { | ||
...pkg.overrides, | ||
...CANARY_OVERRIDES | ||
...OVERRIDES_WITH_EXACT_VERSIONS | ||
} | ||
log.info(`Updated ${pico.cyan('overrides')} in ${pico.yellow('package.json')}`) | ||
// NPM requires direct dependencies to be rewritten too | ||
let hasDependenciesBeenRewritten = false | ||
const vuePackages = Object.keys(OVERRIDES_WITH_EXACT_VERSIONS) | ||
for (const name of vuePackages) { | ||
for (const depType of ['dependencies', 'devDependencies', 'optionalDependencies']) { | ||
if (pkg[depType]?.[name]) { | ||
pkg[depType][name] = OVERRIDES_WITH_EXACT_VERSIONS[name] | ||
hasDependenciesBeenRewritten = true | ||
} | ||
} | ||
} | ||
if (hasDependenciesBeenRewritten) { | ||
log.info(`Updated dependency versions in ${pico.yellow('package.json')}`) | ||
} | ||
} else if (pm === 'yarn' || pm === 'cnpm') { | ||
@@ -155,0 +176,0 @@ pkg.resolutions = { |
{ | ||
"name": "install-vue-canary", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Install the canary version of Vue in the project", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -8,3 +8,3 @@ # install-vue-canary | ||
```sh | ||
npx install-vue-canary | ||
npx install-vue-canary@latest | ||
``` | ||
@@ -15,3 +15,3 @@ | ||
```sh | ||
npx install-vue-canary --with mynpm | ||
npx install-vue-canary@latest --with mynpm | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8734
183