-
Notifications
You must be signed in to change notification settings - Fork 0
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: svg sprite generation #1
Open
amtins
wants to merge
20
commits into
main
Choose a base branch
from
feat/sprite-generator
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+4,638
−0
Open
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
a9e21de
feat: svg sprite generation
amtins f9b1014
chore: add .nvmrc file to specify node version
amtins 281e393
fix(template): footer link pointing to wrong repo
amtins 7f65cc9
chore(svg-icons): rename output directory
amtins 99c4494
chore(license): content update
amtins 6785d64
chore(package): update license type
amtins 626beb6
chore(npm): add videojs-standard
amtins c5d8867
chore(npm): add husky
amtins eb3e5ed
style(cli): comply with linter
amtins d7a122a
style(index): comply with linter
amtins 1d0c65e
style(svgo-clean-config): comply with linter
amtins f9e9548
style(svgo-config): comply with linter
amtins 26b7345
style(svg-config-file): comply with linter
amtins 78733aa
style(vjs-sprite): comply with linter
amtins 232e33d
style(svg-config-file): comply with linter
amtins 0de1dac
chore(npm): lint errors
amtins dac47dd
chore(npm): vjsstandard ignore file
amtins f29f9ac
style(svg-sprite-config): use quotes instead double quotes
amtins f4872bf
chore(npm): fix start script path
amtins 0845a00
fix(icons): use the X icon for twitter
amtins File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
vjs-sprite-tmp_* | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
npm run lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v18.20.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Copyright Brightcove, Inc. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#! /usr/bin/env node | ||
|
||
import process from 'process'; | ||
import path from 'path'; | ||
import fs from 'fs'; | ||
// meh https://github.com/yargs/yargs/issues/1854#issuecomment-787509517 | ||
import yargs from 'yargs'; | ||
import { hideBin } from 'yargs/helpers'; | ||
import { generateSvgSprite, parseConfigFile } from '../src/vjs-sprite.js'; | ||
import svgConfigTemplate from '../template/svg.config.file.js'; | ||
|
||
// eslint-disable-next-line no-unused-expressions | ||
yargs(hideBin(process.argv)) | ||
.scriptName('vjs-svg-sprite') | ||
.usage('$0 <command> [argument]') | ||
|
||
.command({ | ||
command: 'create [configFile]', | ||
describe: 'create a config file', | ||
builder: { | ||
configFile: { | ||
type: 'string', | ||
describe: 'the config file used to build the svg sprite', | ||
default: 'vjs-icons-config.json' | ||
} | ||
}, | ||
handler: (argv) => { | ||
const configFile = path.join(process.cwd(), argv.configFile); | ||
const configTemplate = JSON.stringify(svgConfigTemplate, null, 2); | ||
|
||
fs.writeFileSync(configFile, configTemplate); | ||
} | ||
}) | ||
|
||
.command({ | ||
command: 'generate [configFile]', | ||
describe: 'generate the svg sprite', | ||
builder: { | ||
configFile: { | ||
type: 'string', | ||
demandOption: true, | ||
describe: 'the config file used build the svg sprite' | ||
}, | ||
svgSpriteConfigFile: { | ||
type: 'string', | ||
describe: 'the config file that overrides the default svg-sprite configuration' | ||
}, | ||
svgoConfigFile: { | ||
type: 'string', | ||
describe: 'the config file that overrides the default svgo configuration applied to each icon' | ||
}, | ||
svgoCleanSpriteConfigFile: { | ||
type: 'string', | ||
describe: 'the config file that overrides the default svgo configuration applied to the sprite' | ||
}, | ||
debug: { | ||
type: 'boolean', | ||
default: false, | ||
describe: 'activate the debug mode' | ||
} | ||
}, | ||
handler: (argv) => { | ||
if (argv.svgSpriteConfigFile) { | ||
throw new Error('svgSpriteConfigFile is not implemented yet'); | ||
} | ||
|
||
if (argv.svgoConfigFile) { | ||
throw new Error('svgoConfigFile is not implemented yet'); | ||
} | ||
|
||
if (argv.svgoCleanSpriteConfigFile) { | ||
throw new Error('svgoCleanSpriteConfigFile is not implemented yet'); | ||
} | ||
|
||
if (argv.debug) { | ||
throw new Error('debug is not implemented yet'); | ||
} | ||
|
||
const configFile = path.join(process.cwd(), argv.configFile); | ||
const svgIconsConfig = parseConfigFile(configFile); | ||
|
||
generateSvgSprite(process.cwd(), svgIconsConfig); | ||
} | ||
}) | ||
.help() | ||
.argv; |
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Do we want to include
dist
in this 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.
Ideally, yes, in order to replace the player.js import with the file generated by this project. A bit like videojs-icons.css