Add @openzeppelin/contracts as alternative package name (#1840)

* Rename package and repository name from docs and scripts

* undo root package rename

* add @openzeppelin/contracts as subpackage with release automation

* synchronize @openzeppelin/contracts version

* remove private field from package.json

* make file patterns absolute

* change wording of a comment

* use a saner version script
This commit is contained in:
Santiago Palladino
2019-07-26 16:01:04 -03:00
committed by Francisco Giordano
parent e869b37d0b
commit b8c8308d77
22 changed files with 149 additions and 81 deletions

View File

@ -30,18 +30,30 @@ push_release_branch_and_tag() {
git push upstream "$(current_release_branch)" "$(current_version)"
}
publish() {
dist_tag="$1"
log "Publishing openzeppelin-solidity on npm"
npm publish --tag "$dist_tag" --otp "$(prompt_otp)"
log "Publishing @openzeppelin/contracts on npm"
env ALREADY_COMPILED= \ # avoid re-compiling
npm publish contracts --tag "$dist_tag" --otp "$(prompt_otp)"
if [[ "$dist_tag" == "latest" ]]; then
otp="$(prompt_otp)"
npm dist-tag rm --otp "$otp" openzeppelin-solidity next
npm dist-tag rm --otp "$otp" @openzeppelin/contracts next
fi
}
push_and_publish() {
dist_tag="$1"
log "Pushing release branch and tags to upstream"
push_release_branch_and_tag
log "Publishing package on npm"
npm publish --tag "$dist_tag" --otp "$(prompt_otp)"
if [[ "$dist_tag" == "latest" ]]; then
npm dist-tag rm --otp "$(prompt_otp)" openzeppelin-solidity next
fi
publish "$dist_tag"
}
prompt_otp() {

View File

@ -0,0 +1,18 @@
#!/usr/bin/env node
// Synchronizes the versions in ethpm.json and contracts/package.json with the
// one in package.json.
// This is run automatically when npm version is run.
const fs = require('fs');
const cp = require('child_process');
setVersion('contracts/package.json');
setVersion('ethpm.json');
function setVersion(file) {
const json = JSON.parse(fs.readFileSync(file));
json.version = process.env.npm_package_version;
fs.writeFileSync(file, JSON.stringify(json, null, 2) + '\n');
cp.execFileSync('git', ['add', file]);
}

View File

@ -1,16 +0,0 @@
#!/usr/bin/env node
// Synchronizes ethpm.json version number with package.json.
// This is run automatically when npm version is run.
const fs = require('fs');
const cp = require('child_process');
const pkg = require('../../package.json');
const ethpm = require('../../ethpm.json');
ethpm.version = pkg.version;
fs.writeFileSync('ethpm.json', JSON.stringify(ethpm, null, 2) + '\n');
cp.execSync('git add ethpm.json');

6
scripts/release/version.sh Executable file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -o errexit
scripts/release/update-changelog-release-date.js
scripts/release/synchronize-versions.js