Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add custom transform #4

Merged
merged 6 commits into from
Jan 11, 2019

Conversation

fsdiogo
Copy link
Collaborator

@fsdiogo fsdiogo commented Jan 10, 2019

This PR adds the ability to customise transforms to be used to relocate the dropdown.

It will be used in ipfs/ipfs-webui#929.

/cc @olizilla

Copy link
Member

@olizilla olizilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice and simple 👍

Please add an example of a transform usage to the examples page. Can you add also add parcel@1.9.7 as a dev dependecy, looks like I missed that, and its needed to make npm start work out of the box.

@fsdiogo
Copy link
Collaborator Author

fsdiogo commented Jan 11, 2019

Done!

transforms

Also switched from babel-preset-react to @babel/preset-react because it was breaking the examples.

@olizilla
Copy link
Member

npm run build is failing for me. I have tried rimraffing my node_modules and re-installing

$ npm run build

> @tableflip/react-dropdown@1.1.1 build /Users/oli/Code/tableflip/react-dropdown
> run-s clean build:*


> @tableflip/react-dropdown@1.1.1 clean /Users/oli/Code/tableflip/react-dropdown
> rm -rf docs/* lib/*


> @tableflip/react-dropdown@1.1.1 build:js /Users/oli/Code/tableflip/react-dropdown
> babel src/index.js -o lib/index.js

Error: Requires Babel "^7.0.0-0", but was loaded with "6.26.3". If you are sure you have a compatible version of @babel/core, it is likely that something in your build process is loading the wrong version. Inspect the stack trace of this error to look for the first entry that doesn't mention "@babel/core" or "babel-core" to see what is calling Babel. (While processing preset: "/Users/oli/Code/tableflip/react-dropdown/node_modules/@babel/preset-react/lib/index.js")
    at throwVersionError (/Users/oli/Code/tableflip/react-dropdown/node_modules/@babel/helper-plugin-utils/lib/index.js:65:11)
    at Object.assertVersion (/Users/oli/Code/tableflip/react-dropdown/node_modules/@babel/helper-plugin-utils/lib/index.js:13:11)
    at _default (/Users/oli/Code/tableflip/react-dropdown/node_modules/@babel/preset-react/lib/index.js:61:7)
    at /Users/oli/Code/tableflip/react-dropdown/node_modules/@babel/helper-plugin-utils/lib/index.js:19:12
    at /Users/oli/Code/tableflip/react-dropdown/node_modules/babel-core/lib/transformation/file/options/option-manager.js:317:46
    at Array.map (<anonymous>)
    at OptionManager.resolvePresets (/Users/oli/Code/tableflip/react-dropdown/node_modules/babel-core/lib/transformation/file/options/option-manager.js:275:20)
    at OptionManager.mergePresets (/Users/oli/Code/tableflip/react-dropdown/node_modules/babel-core/lib/transformation/file/options/option-manager.js:264:10)
    at OptionManager.mergeOptions (/Users/oli/Code/tableflip/react-dropdown/node_modules/babel-core/lib/transformation/file/options/option-manager.js:249:14)
    at OptionManager.init (/Users/oli/Code/tableflip/react-dropdown/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
    at File.initOptions (/Users/oli/Code/tableflip/react-dropdown/node_modules/babel-core/lib/transformation/file/index.js:212:65)
    at new File (/Users/oli/Code/tableflip/react-dropdown/node_modules/babel-core/lib/transformation/file/index.js:135:24)
    at Pipeline.transform (/Users/oli/Code/tableflip/react-dropdown/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
    at transform (/Users/oli/Code/tableflip/react-dropdown/node_modules/babel-cli/lib/babel/util.js:50:22)
    at Object.compile (/Users/oli/Code/tableflip/react-dropdown/node_modules/babel-cli/lib/babel/util.js:59:12)
    at /Users/oli/Code/tableflip/react-dropdown/node_modules/babel-cli/lib/babel/file.js:142:23
    at Array.forEach (<anonymous>)
    at walk (/Users/oli/Code/tableflip/react-dropdown/node_modules/babel-cli/lib/babel/file.js:133:16)
    at files (/Users/oli/Code/tableflip/react-dropdown/node_modules/babel-cli/lib/babel/file.js:156:7)
    at module.exports (/Users/oli/Code/tableflip/react-dropdown/node_modules/babel-cli/lib/babel/file.js:184:5)
    at Object.<anonymous> (/Users/oli/Code/tableflip/react-dropdown/node_modules/babel-cli/lib/babel/index.js:129:1)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @tableflip/react-dropdown@1.1.1 build:js: `babel src/index.js -o lib/index.js`
npm ERR! Exit status 1

@fsdiogo
Copy link
Collaborator Author

fsdiogo commented Jan 11, 2019

Sorry, missed the babel-cli => @babel/cli. It should be working now!

@olizilla
Copy link
Member

almost... perhaps the lib dir needs to exist first?

> @tableflip/react-dropdown@1.1.1 build:js /Users/oli/Code/tableflip/react-dropdown
> babel src/index.js -o lib/index.js

{ Error: ENOENT: no such file or directory, open 'lib/index.js'
    at Object.openSync (fs.js:436:3)
    at Object.writeFileSync (fs.js:1168:35)
    at output (/Users/oli/Code/tableflip/react-dropdown/node_modules/@babel/cli/lib/babel/file.js:148:23)
    at /Users/oli/Code/tableflip/react-dropdown/node_modules/@babel/cli/lib/babel/file.js:234:9
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/Users/oli/Code/tableflip/react-dropdown/node_modules/@babel/cli/lib/babel/file.js:74:103)
    at _next (/Users/oli/Code/tableflip/react-dropdown/node_modules/@babel/cli/lib/babel/file.js:76:194)
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: 'lib/index.js' }

@fsdiogo
Copy link
Collaborator Author

fsdiogo commented Jan 11, 2019

Yeah, the folder had to exist.

Now using the -d option that creates the folder if it doesn't exist.

Copy link
Member

@olizilla olizilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@olizilla olizilla merged commit 6198ce4 into tableflip:master Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants