Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2325 from trufflesuite/org-scoping
Browse files Browse the repository at this point in the history
Start switching to org-scoped packages
  • Loading branch information
gnidan committed Aug 22, 2019
2 parents d8279c9 + d327273 commit c84abb0
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 27 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# truffle-solidity-utils
# @truffle/solidity-utils
Utilities for solidity contracts

# API
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
var SolidityUtils = {

getCharacterOffsetToLineAndColumnMapping: function(source) {
var mapping = [];

Expand Down Expand Up @@ -31,7 +30,7 @@ var SolidityUtils = {
},

getHumanReadableSourceMap: function(sourceMap) {
var map = sourceMap.split(';');
var map = sourceMap.split(";");

var last = {};

Expand All @@ -43,12 +42,12 @@ var SolidityUtils = {
jump: last.jump
};

current = current.split(':');
current = current.split(":");

if (current[0] && current[0] !== '-1' && current[0].length) {
if (current[0] && current[0] !== "-1" && current[0].length) {
ret.start = parseInt(current[0]);
}
if (current[1] && current[1] !== '-1' && current[1].length) {
if (current[1] && current[1] !== "-1" && current[1].length) {
ret.length = parseInt(current[1]);
}
if (current[2] /*&& current[2] !== '-1'*/ && current[2].length) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "truffle-solidity-utils",
"name": "@truffle/solidity-utils",
"version": "1.2.3",
"description": "Utilities for Solidity contracts",
"main": "index.js",
"scripts": {},
"repository": "https://github.com/trufflesuite/truffle/tree/master/packages/truffle-solidity-utils",
"repository": "https://github.com/trufflesuite/truffle/tree/master/packages/solidity-utils",
"keywords": [
"ethereum",
"truffle",
Expand All @@ -14,9 +14,9 @@
"author": "Tim Coulter <tim.coulter@consensys.net>",
"license": "MIT",
"bugs": {
"url": "https://github.com/trufflesuite/truffle-solidity-utils/issues"
"url": "https://github.com/trufflesuite/truffle/issues"
},
"homepage": "https://github.com/trufflesuite/truffle-solidity-utils#readme",
"homepage": "https://github.com/trufflesuite/truffle/tree/master/packages/solidity-utils#readme",
"publishConfig": {
"access": "public"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/truffle-compile/test/test_ordering.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ describe("Compile - solidity ^0.4.0", function() {
assert.deepEqual(abi, expectedOrder);
});

// Ported from `truffle-solidity-utils`
// Ported from `@truffle/solidity-utils`
it("orders the ABI of a contract without functions", async function() {
var sources = {};
// ComplexOrdered.sol includes contract `Empty`
Expand Down
1 change: 0 additions & 1 deletion packages/truffle-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
"truffle-provisioner": "^0.1.5",
"truffle-require": "^2.0.18",
"truffle-resolver": "^5.0.15",
"truffle-solidity-utils": "^1.2.3",
"truffle-workflow-compile": "^2.1.2",
"universal-analytics": "^0.4.17",
"web3": "1.2.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/truffle-debugger/lib/solidity/selectors/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import debugModule from "debug";
const debug = debugModule("debugger:solidity:selectors");

import { createSelectorTree, createLeaf } from "reselect-tree";
import SolidityUtils from "truffle-solidity-utils";
import SolidityUtils from "@truffle/solidity-utils";
import CodeUtils from "truffle-code-utils";

import { findRange } from "lib/ast/map";
Expand Down
2 changes: 1 addition & 1 deletion packages/truffle-debugger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"truffle-decode-utils": "^1.0.16",
"truffle-decoder": "^3.0.9",
"truffle-expect": "^0.0.9",
"truffle-solidity-utils": "^1.2.3",
"@truffle/solidity-utils": "^1.2.3",
"web3": "1.2.1",
"web3-eth-abi": "1.2.1"
},
Expand Down
28 changes: 16 additions & 12 deletions scripts/npm-access.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,24 @@ const getPkgPermissions = userOrOrg => {
return JSON.parse(stringResponse);
};

const truffleSuiteOrgPermissionsObject = getPkgPermissions("trufflesuite");
const orgs = ["trufflesuite", "truffle"];

const getNpmUsername = () => {
const bufferResponse = execSync("npm whoami");
return bufferResponse.toString();
};
for (let org of orgs) {
const permissions = getPkgPermissions(org);

const getNpmUsername = () => {
const bufferResponse = execSync("npm whoami");
return bufferResponse.toString();
};

const username = getNpmUsername();
const username = getNpmUsername();

const userPermissionsObject = getPkgPermissions(username);
const userPermissionsObject = getPkgPermissions(username);

for (const pkg in truffleSuiteOrgPermissionsObject) {
if (!userPermissionsObject[pkg])
throw new Error(`You don't have permissions to publish ${pkg}`);
if (truffleSuiteOrgPermissionsObject[pkg] !== userPermissionsObject[pkg])
throw new Error(`Missing correct 'read-write' access to ${pkg}`);
for (const pkg in permissions) {
if (!userPermissionsObject[pkg])
throw new Error(`You don't have permissions to publish ${pkg}`);
if (permissions[pkg] !== userPermissionsObject[pkg])
throw new Error(`Missing correct 'read-write' access to ${pkg}`);
}
}
2 changes: 1 addition & 1 deletion scripts/publish-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -ex

npm login
node ./scripts/npm-access.js
lerna publish
lerna publish -- --access=public
git checkout master
git merge develop
git push origin master
Expand Down

0 comments on commit c84abb0

Please sign in to comment.