-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[icon-builder] Update to generate standalone package #6104
Conversation
Once this is published, I'll update the docs site to use the packaged icons, and remove any icons from The docs will also need to reference the fact that the icons are now separate, and describe the naming convention. Thinking about it, the build dir needs a README too for npmjs.com to display. One thing we need to decide on is the package name. It's |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The icon-builder
is quite an old piece of code from material-ui.That remembers me the beginning 😬 .
packages/icon-builder/LICENSE
Outdated
@@ -0,0 +1,21 @@ | |||
The MIT License (MIT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about using the one at the root?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this a separate package technically? (And not like the files ever going to change). I can have the script reach outside it's walls for it though if you prefer.
"prebuild": "rimraf js jsx", | ||
"build": "node build.js --output-dir ../../src/svg-icons --svg-dir ./node_modules/material-design-icons --glob '/**/production/*_24px.svg' --mui-require relative --renameFilter ./filters/rename/material-design-icons.js", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"name": "material-ui-icon-builder", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about renaming the folder: material-ui-svg-icons
as well as the name
here?
I don't think that we need to expose the builder tools. Shouldn't they be internal scripts that help us publishing it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that we need to expose the builder tools. Shouldn't they be internal scripts that help us publishing it?
Sorry, I don't understand. That's exactly what they are.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, but the branding & documentation make me think otherwise:
This tool generates Material-UI SvgIcon components for a set of svg icons.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I see what you're getting at now. (It seemed - especially given your later comment about needing a React peerDepenency in this package's package.json
- that you thought the scripts were being published as part of the npm package).
However, from the way they were written, it does appear that the intention was that this would be a toolset for users to be able to generate other icon libraries - in fact, I came across this one in the wild while looking at possible names for the generated icon set.
That we've now repurposed it to create a standalone build of the Material Design icons that happens to be published from here is kind of incidental to that I think, but tell me if I'm wrong - I often am!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it does appear that the intention was that this would be a toolset for users to be able to generate other icon libraries
I agree with your analyze. I have come up with the same conclusion. As I was saying, I don't think that we should worry about that tool. It could be a devDependency or implemented here, that don't make much difference.
That's not our end goal. Our end goal is to published svg icons that can be used with material-ui.
By the way, I think that the generated icons should be stored in git. That would make thing simpler for using them with the documentation. Otherwise, we could be using Lerna to link them when developing.
packages/icon-builder/package.json
Outdated
"name": "material-ui-icon-builder", | ||
"version": "0.2.0-alpha.1", | ||
"description": "Material Design Svg Icons converted to Material-UI React components.", | ||
"author": "Hai Nguyen", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Material-UI Team
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
"devDependencies": { | ||
"babel-cli": "^6.6.5", | ||
"grunt": "^0.4.5", | ||
"babel-cli": "^6.0.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we miss a yarn.lock
file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no idea!
What is it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We used yarn over npm to install our dependencies on cicleci. I can take care of that.
}, | ||
"peerDependencies": {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we need a peer dependency on material-ui rather than a dependency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad 👍 .
packages/icon-builder/test/index.js
Outdated
@@ -120,14 +118,14 @@ describe('--svg-dir, --innerPath, --fileSuffix', function() { | |||
}); | |||
|
|||
after(function() { | |||
temp.cleanupSync(); | |||
// temp.cleanupSync(); | |||
}); | |||
|
|||
it('script outputs to directory', function(done) { | |||
builder.main(options, function() { | |||
assert.ok(fs.lstatSync(tempPath).isDirectory()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hate assert.ok
. I don't think that truthy is good enough for tests. We need precision.
If you don't mind:
assert.strictEqual(fs.lstatSync(tempPath).isDirectory(), true);
packages/icon-builder/test/index.js
Outdated
@@ -186,15 +184,14 @@ describe('--mui-require', function() { | |||
var relativeOptions = _.extend({}, options, { muiRequire: 'relative' }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohh var, it's some old school Javascript 🙈 .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha, that's what I thought! But I wasn't going to start battle at this point.
There's lots about this package that is "old-school" (two-year-old school, crazy isn't it?!)
packages/icon-builder/test/index.js
Outdated
@@ -120,14 +118,14 @@ describe('--svg-dir, --innerPath, --fileSuffix', function() { | |||
}); | |||
|
|||
after(function() { | |||
temp.cleanupSync(); | |||
// temp.cleanupSync(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know what it is for, but we can either remove it or uncomment it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It shouldn't be commented out - I was trying to view any artifacts from a failing test. I'll fix it.
Fixed the tests. |
@oliviertassinari I think this is done, other than:
|
That's a good one. What's wrong with following the They all follow two patterns:
|
Well then perhaps we have the npm build script generate |
If there's no additional feedback, lets go ahead and merge - the important work is done. (Although it would be nice to get some feedback on the target package name). |
👍 , we can agree on the name later. |
Closes #6074.
npm run build
now follows a similar pattern the the Material-UI build process:The icon file names are
PascalCase
in in a single flattened directoryThe generated icons use an absolute path for the import, and the package.json has a dependancy in
material-ui@>1.0.0
.Finally, the dependencies are updated, and some missing ones added.