trufflesuite / truffle-artifactor

A contract packager for Ethereum and Javascript (formerly ether-pudding)
MIT License
254 stars 54 forks source link

Cannot artifacts.require npm module name with '/' #74

Closed makoto closed 6 years ago

makoto commented 6 years ago

Hello.

We used to name our package as dnssec-oracle and was able to load as an artifact at migration. However, it starts failing when we renamed to @ensdomains/dnssec-oracle to name space our package with organisation name. When I manually copy the files from node_modeules/@ensdomains/dnssec-oracle to node_modeules/dnssec-oracle I was able to load it again. Is this something can be fixed or we should not have / as package name?

makoto@Makotos-MacBook-Air: [~/work/ens/dnsprove-js -  (dnsprove)] $ ls node_modules/@ensdomains/dnssec-oracle/contracts/RSASHA1Algorithm.sol
node_modules/@ensdomains/dnssec-oracle/contracts/RSASHA1Algorithm.sol
makoto@Makotos-MacBook-Air: [~/work/ens/dnsprove-js -  (dnsprove)] $ ls node_modules/dnssec-oracle/contracts/RSASHA1Algorithm.sol
node_modules/dnssec-oracle/contracts/RSASHA1Algorithm.sol
makoto@Makotos-MacBook-Air: [~/work/ens/dnsprove-js -  (dnsprove)] $ node inspect node_modules/.bin/truffle migrate
< Debugger listening on ws://127.0.0.1:9229/12a647df-fb0d-45da-a906-0db3172da72b
< For help see https://nodejs.org/en/docs/inspector
< Debugger attached.
debug> c
Break on start in node_modules/truffle/build/cli.bundled.js:1
> 1 (function (exports, require, module, __filename, __dirname) { 
  2 
  3 /******/ (function(modules) { // webpackBootstrap
< Using network 'development'.
< Running migration: 2_deploy_contracts.js
break in migrations/2_deploy_contracts.js:1
> 1 debugger
  2 var rsasha1   = artifacts.require("@ensdomains/dnssec-oracle/contracts/RSASHA1Algorithm");
  3 var rsasha256 = artifacts.require("@ensdomains/dnssec-oracle/contracts/RSASHA256Algorithm.sol");
debug> repl
Press Ctrl + C to leave debug repl
> artifacts.require("@ensdomains/dnssec-oracle/contracts/RSASHA1Algorithm")
Error: Could not find artifacts for @ensdomains/dnssec-oracle/contracts/RSASHA1Algorithm from any sources
    at Resolver.require (/Users/makoto/work/ens/dnsprove-js/node_modules/truffle/build/cli.bundled.js:63317:9)
    at Object.require (/Users/makoto/work/ens/dnsprove-js/node_modules/truffle/build/cli.bundled.js:75276:36)
    at ResolverIntercept.require (/Users/makoto/work/ens/dnsprove-js/node_modules/truffle/build/cli.bundled.js:218313:32)
    at eval (eval at <anonymous> (/Users/makoto/work/ens/dnsprove-js/migrations/2_deploy_contracts.js:1:1), <anonymous>:1:11)
    at /Users/makoto/work/ens/dnsprove-js/migrations/2_deploy_contracts.js:1:1
    at ContextifyScript.Script.runInContext (vm.js:59:29)
    at ContextifyScript.Script.runInNewContext (vm.js:65:15)
    at /Users/makoto/work/ens/dnsprove-js/node_modules/truffle/build/cli.bundled.js:121314:14
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)
> artifacts.require("dnssec-oracle/contracts/RSASHA1Algorithm")
[Function: TruffleContract]
makoto commented 6 years ago

I just found ethpm page about the package naming standard [a-zA-Z][-_a-zA-Z0-9]{0,255}

looks like / is not acceptable as a package name.

makoto commented 6 years ago

I will actually reopen the issue, as I found out that many projects such as Aragon does use / as names space https://www.npmjs.com/search?q=aragon

0xean commented 6 years ago

+1 on this, we would like to be able to use a slash if possible as well.