From 8d1ab12be3d009cbd490a3c7a016ed6a14932dd5 Mon Sep 17 00:00:00 2001 From: Dipu Raj Date: Mon, 20 Jul 2020 23:21:43 +0530 Subject: [PATCH] first commit --- .github/FUNDING.yml | 12 + .github/ISSUE_TEMPLATE/bug_report.md | 38 + .github/ISSUE_TEMPLATE/feature_request.md | 20 + .github/pull_request_template.md | 27 + .gitignore | 38 + .npmignore | 64 ++ .travis.yml | 5 + CODE_OF_CONDUCT.md | 76 ++ CONTRIBUTING.md | 39 + LICENSE | 22 + README.md | 105 ++ index.js | 3 + lib/cli.js | 35 + lib/create-plugin.js | 64 ++ lib/get-defaults.js | 58 ++ lib/get-params.js | 111 +++ lib/get-templates.js | 15 + lib/validate-params.js | 41 + package-lock.json | 929 ++++++++++++++++++ package.json | 56 ++ templates/javascript_css/.gitignore | 36 + templates/javascript_css/.npmignore | 64 ++ templates/javascript_css/CONTRIBUTING.md | 41 + templates/javascript_css/LICENSE | 1 + templates/javascript_css/README.md | 74 ++ templates/javascript_css/examples/index.html | 41 + templates/javascript_css/gulpfile.js | 122 +++ templates/javascript_css/karma.conf.js | 76 ++ templates/javascript_css/package.json | 56 ++ .../src/css/jquery-plugin-boilerplate.css | 20 + .../src/js/jquery-plugin-boilerplate.js | 91 ++ .../javascript_css/test/test-template.html | 11 + templates/javascript_css/test/test.js | 41 + templates/javascript_sass/.gitignore | 36 + templates/javascript_sass/.npmignore | 64 ++ templates/javascript_sass/CONTRIBUTING.md | 41 + templates/javascript_sass/LICENSE | 1 + templates/javascript_sass/README.md | 74 ++ templates/javascript_sass/examples/index.html | 41 + templates/javascript_sass/gulpfile.js | 125 +++ templates/javascript_sass/karma.conf.js | 76 ++ templates/javascript_sass/package.json | 58 ++ .../src/js/jquery-plugin-boilerplate.js | 91 ++ .../src/scss/jquery-plugin-boilerplate.scss | 20 + .../javascript_sass/test/test-template.html | 11 + templates/javascript_sass/test/test.js | 41 + templates/templates.json | 12 + 47 files changed, 3123 insertions(+) create mode 100644 .github/FUNDING.yml create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/pull_request_template.md create mode 100644 .gitignore create mode 100644 .npmignore create mode 100644 .travis.yml create mode 100644 CODE_OF_CONDUCT.md create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE create mode 100644 README.md create mode 100755 index.js create mode 100644 lib/cli.js create mode 100644 lib/create-plugin.js create mode 100644 lib/get-defaults.js create mode 100644 lib/get-params.js create mode 100644 lib/get-templates.js create mode 100644 lib/validate-params.js create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 templates/javascript_css/.gitignore create mode 100644 templates/javascript_css/.npmignore create mode 100644 templates/javascript_css/CONTRIBUTING.md create mode 100644 templates/javascript_css/LICENSE create mode 100644 templates/javascript_css/README.md create mode 100644 templates/javascript_css/examples/index.html create mode 100644 templates/javascript_css/gulpfile.js create mode 100644 templates/javascript_css/karma.conf.js create mode 100644 templates/javascript_css/package.json create mode 100644 templates/javascript_css/src/css/jquery-plugin-boilerplate.css create mode 100644 templates/javascript_css/src/js/jquery-plugin-boilerplate.js create mode 100644 templates/javascript_css/test/test-template.html create mode 100644 templates/javascript_css/test/test.js create mode 100644 templates/javascript_sass/.gitignore create mode 100644 templates/javascript_sass/.npmignore create mode 100644 templates/javascript_sass/CONTRIBUTING.md create mode 100644 templates/javascript_sass/LICENSE create mode 100644 templates/javascript_sass/README.md create mode 100644 templates/javascript_sass/examples/index.html create mode 100644 templates/javascript_sass/gulpfile.js create mode 100644 templates/javascript_sass/karma.conf.js create mode 100644 templates/javascript_sass/package.json create mode 100644 templates/javascript_sass/src/js/jquery-plugin-boilerplate.js create mode 100644 templates/javascript_sass/src/scss/jquery-plugin-boilerplate.scss create mode 100644 templates/javascript_sass/test/test-template.html create mode 100644 templates/javascript_sass/test/test.js create mode 100644 templates/templates.json diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..766132c --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: ['https://www.paypal.me/dipuraj'] diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..dd84ea7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,38 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Version [e.g. 22] + +**Smartphone (please complete the following information):** + - Device: [e.g. iPhone6] + - OS: [e.g. iOS8.1] + - Browser [e.g. stock browser, safari] + - Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..bbcbbe7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..68b2678 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,27 @@ +### Fixes: + - + - + - + +### Changes: + - + - + - + + +### Thank you for your contribution! + +Please note the following points for pull request + +- Make sure that the pull request is not a duplicate. +- Follow the same code style as the library. +- Pull request should target the `dev` branch. +- Don't alter the licence headers. +- Run the test suites in the `test` directory first by running `npm test` or `gulp test`. +- Don't modify any files in the `dist` directory. +- Link any issue that is related to the pull request. +- Provide a description of your changes. + +IMPORTANT: Please review the [CONTRIBUTING.md](../CONTRIBUTING.md) file for detailed contributing guidelines. + +**YOU CAN REMOVE THIS PR TEMPLATE BEFORE SUBMITTING** diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..44f0e65 --- /dev/null +++ b/.gitignore @@ -0,0 +1,38 @@ +# See https://help.github.com/ignore-files/ for more about ignoring files. + +# dependencies +/node_modules/ +/bower_components/ +/vendor/ +/public/ + +# builds +build +dist + +# misc +.DS_Store +.env +.env.local +.env.development.local +.env.test.local +.env.production.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# IDE Files +#------------------------- +/nbproject/ +.idea/* +.vscode/* + +## Sublime Text cache files +*.tmlanguage.cache +*.tmPreferences.cache +*.stTheme.cache +*.sublime-workspace +*.sublime-project +/nbproject/private/ +/ref.txt diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..b1cef55 --- /dev/null +++ b/.npmignore @@ -0,0 +1,64 @@ +.*.swp +._* +.DS_Store +.git +.github +.hg +.lock-wscript +.svn +.wafpickle-* +CVS +npm-debug.log + +*.seed +*.log +*.csv +*.dat +*.out +*.pid +*.gz +*.orig +*.jql.js + +work +build +src +test +spec +pids +logs +results +coverage +lib-cov +html-report +xunit.xml + +# IDE Files +#------------------------- +/nbproject/* +.idea/* +.vscode/* +.project +.idea +.settings +.iml + +## Sublime Text cache files +*.tmlanguage.cache +*.tmPreferences.cache +*.stTheme.cache +*.sublime-workspace +*.sublime-project + +ehthumbs.db +Icon? +Thumbs.db +.AppleDouble +.LSOverride +.Spotlight-V100 +.Trashes + +/ref.txt +/node_modules/ +/bower_components/ +/vendor/ diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..6b59b30 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,5 @@ +language: node_js +cache: yarn +node_js: + - 12 + - 10 diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..eaaecf4 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,76 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at dipumedayil@gmail.com. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..378248a --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,39 @@ +# Contributing + +## How can I contribute? +- Fix a bug you found or already reported on the repository. +- Add new features to the project. +- Create new templates +- Add new test cases. +- Add documentation. +- [Donate](https://www.paypal.me/dipuraj) money for the project on [![Paypal](https://img.shields.io/badge/PayPal-dipuraj-blue.svg)](https://www.paypal.me/dipuraj) + +## How to contribute code? +Here are the basic steps to get started contributing code: + +1. Fork the repository. +2. Install the dependencies, run `npm install`. +3. Start the project, run `npm start`. +4. Replicate the issue you're trying to fix or spec out the feature you're trying to add. +5. Modify the code to fix the bug or to add the feature. +6. Verify that your fix or feature works. +7. Run the test cases by running `npm test`, you can also add more test cases based on your new change. +8. Commit your changes with an informative description. +9. Open a pull request to the repository with your new commit and a descriptive message about what the PR does. + +Thank you for your contribution! + +##### Notes for pull request +- Follow the same code style as the library. +- Run the test suites in the `test` directory first by running `npm test`. +- Don't alter the licence headers. + +## Reporting bugs +#### Make sure it is a bug related to this project +Before reporting the bug, please make sure that the bug is in the project and not from your own code or any other library used. + +#### Try the latest version +Bugs in the older versions of the project may have already been fixed. +In order to avoid reporting known issues, make sure you are always testing against the latest release. +Also make sure the problem hasn't already been reported on the repository. +If not, create a new issue there and include your test case. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d6afa2d --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2020 Dipu Raj +http://techlaboratory.net + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..55445fb --- /dev/null +++ b/README.md @@ -0,0 +1,105 @@ +# create-jquery-plugin +#### CLI for creating ready-to-start modern jQuery Plugins +###### Inspired from [create-react-library](https://www.npmjs.com/package/create-react-library) and [create-react-app](https://github.com/facebook/create-react-app) + + +[![Build Status](https://travis-ci.org/techlab/create-jquery-plugin.svg?branch=master)](https://travis-ci.org/techlab/create-jquery-plugin) +[![npm version](https://badge.fury.io/js/create-jquery-plugin.svg)](https://www.npmjs.com/package/create-jquery-plugin) +[![Npm Downloadsl](https://badgen.net/npm/dm/create-jquery-plugin?icon=npm)](https://www.npmjs.com/package/create-jquery-plugin) +[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/techlab/create-jquery-plugin/master/LICENSE) +[![GitHub Repo](https://badgen.net/badge/icon/create-jquery-plugin?icon=github&label=&color=0da4d3)](https://github.com/techlab/create-jquery-plugin) +[![Donate on Paypal](https://img.shields.io/badge/PayPal-dipuraj-blue.svg)](https://www.paypal.me/dipuraj) + + +**create-jquery-plugin** is a CLI tool for creating a ready-to-start jQuery plugin development environment with modern configurations. +It will create a development environment with a pre-configured build system. So you can get started immediately with your plugin development. +Also, it is easily customizable that allows you to add or remove any tools or setup. +The development setup will include the boilerplate project for the jQuery plugin development, pre-configured gulp tasks for JavaScript transpile, +CSS/SCSS building, test/lint scripts, hot loading, example page, readme, etc. + ++ [Homepage and Documentation](http://techlaboratory.net/create-jquery-plugin) ++ [GitHub Repository](https://github.com/techlab/create-jquery-plugin) ++ [GitHub Issues](https://github.com/techlab/create-jquery-plugin/issues) + +Usage +----- + +The command will walk you through a few simple prompts and creates a ready to start local development setup for your new jQuery plugin. + +```bash +npx create-jquery-plugin +``` + +Or, fast track with default settings, just pass your plugin name. +```bash +npx create-jquery-plugin jquery-my-plugin +``` + +It will create a directory with the name of your package with all the tools installed. + + +How to start the development +----- +To start the development process, `cd` to your new plugin directory and run `npm start` or `yarn start`. +For example, if your new plugin is "jquery-my-plugin", just run + +```bash +cd jquery-my-plugin +npm start +``` + +It will open the `example/index.html` file with [Browserify](http://browserify.org/) sync. You can start coding on the directory `src`, the example page will hot load as you make changes. + +Features +----- +- Easy-to-use CLI. +- CSS and SCSS templates. +- Creates ready-to-start local development environment. +- Unit testing with [Jasmine](https://jasmine.github.io/) and [Karma](https://karma-runner.github.io/). + +Directory structure +----- +The project boilerplate is from https://github.com/techlab/jquery-plugin-boilerplate +``` +jquery-my-plugin +├── examples +│ └── index.html +├── node_modules +├── src +│ ├── js +│ │ └── jquery-plugin-boilerplate.js +│ └── scss +│ └── jquery-plugin-boilerplate.scss +├── test +│ ├── test-template.html +│ └── test.js +├── .gitignore +├── .npmignore +├── CONTRIBUTING.md +├── gulpfile.js +├── karma.conf.js +├── LICENSE +├── package.json +└── README.md +``` + +User Guide +---- +Please find more detailed instructions and documentation [here](http://techlaboratory.net/create-jquery-plugin). + +Acknowledgements +--- +Grateful to the authors and contributers of [create-react-library](https://www.npmjs.com/package/create-react-library) and [create-react-app](https://github.com/facebook/create-react-app) from which this project is inspired. +Thankful to the [jquery-plugin-boilerplate](https://github.com/techlab/jquery-plugin-boilerplate) for providing the project templates. Also, thanks to the authors and contributors of the amazing Node.js tools used in this project. + +License +---- +Open source software licensed as [MIT](https://github.com/techlab/create-jquery-plugin/blob/master/LICENSE) + +Contribute +---- +If you like the project please support with your contribution. + +[Donate on Paypal](https://www.paypal.me/dipuraj) + +Thank you and Happy Coding :) diff --git a/index.js b/index.js new file mode 100755 index 0000000..8fa685c --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +#!/usr/bin/env node + +require('./lib/cli') diff --git a/lib/cli.js b/lib/cli.js new file mode 100644 index 0000000..1b44dba --- /dev/null +++ b/lib/cli.js @@ -0,0 +1,35 @@ +'use strict' + +const chalk = require('chalk') +const getParams = require('./get-params') +const createPlugin = require('./create-plugin') +const { name, description, version } = require('../package') + +module.exports = async () => { + // Welcome message + console.log(` +${chalk.yellow.bold(name)}${chalk.dim(`@${version}`)} +${chalk.italic(description)}`) + + // Get the package settings + const params = await getParams() + // console.log(params); process.exit(1); + + + await createPlugin(params) + + // Result message + console.log(` +${chalk.green.bold(`Your jQuery plugin has been created at`)} ${chalk.dim.bold(params.dest)}. +To get started, run: ${chalk.cyan(`cd ${params.shortName} && ${params.manager} start`)} + +Happy Coding +`) + + return params +} + +module.exports().catch((err) => { + console.error(err) + process.exit(1) +}) diff --git a/lib/create-plugin.js b/lib/create-plugin.js new file mode 100644 index 0000000..1ec09d6 --- /dev/null +++ b/lib/create-plugin.js @@ -0,0 +1,64 @@ +'use strict' + +const chalk = require('chalk') +const handlebars = require('handlebars') +const execa = require('execa') +const fs = require('fs') +const globby = require('globby') +const mkdirp = require('make-dir') +const ora = require('ora') +const path = require('path') +const pEachSeries = require('p-each-series') +const { validateManager } = require('./validate-params') + +module.exports = async (params) => { + const dest = path.join(process.cwd(), params.shortName) + params.dest = dest + + const source = path.join(__dirname, '..', 'templates', params.templateFolder) + const files = await globby(source.replace(/\\/g, '/'), { + dot: true + }) + + console.log(` +${chalk.dim.bold(`Creating jQuery plugin`)} ${chalk.green.bold(params.name)}`) + + // Create project folder + await mkdirp(dest) + + // Copy template files + { + const promise = pEachSeries(files, async (file) => { + const fileRelativePath = path.relative(source, file).replace(/\\/g, '/') + const destFilePath = path.join(dest, fileRelativePath).replace(/jquery-plugin-boilerplate/gi, params.fileName) + const destFileDir = path.parse(destFilePath).dir + await mkdirp(destFileDir) + const template = handlebars.compile(fs.readFileSync(file, 'utf8')) + const content = template({ + ...params + }) + fs.writeFileSync(destFilePath, content, 'utf8') + return fileRelativePath + }) + ora.promise(promise, `Copy ${chalk.cyan(params.template)} template to ${chalk.cyan(params.shortName)}`) + await promise + } + + // Init git repository + { + const promise = execa('git', ['init'], { cwd: dest }) + ora.promise(promise, `Initialize git (${chalk.cyan(`git init`)}).`) + await promise + } + + // Install dependencies + if (await validateManager(params.manager) === true) { + const promise = execa(params.manager, ['install'], { cwd: dest }) + ora.promise(promise, `Install dependencies (${chalk.cyan(`${params.manager} install`)}). This will take a moment...`) + await promise + } else { + ora(`Install dependencies error => ${chalk.cyan(`${params.manager}`)} not installed. Please install ${chalk.cyan(`${params.manager}`)} and then run ${chalk.cyan(`${params.manager} install`)} on your project directory`).fail(); + } + + return dest +} diff --git a/lib/get-defaults.js b/lib/get-defaults.js new file mode 100644 index 0000000..5ae788a --- /dev/null +++ b/lib/get-defaults.js @@ -0,0 +1,58 @@ +'use strict' + +const getGitConfigPath = require('git-config-path') +const parseGitConfig = require('parse-git-config') +const Conf = require('conf') + +module.exports.getDefaults = async () => { + const config = new Conf() + const defaults = { + name: null, + description: 'Made with create-jquery-plugin', + version: '1.0.0', + author: config.get('author'), + repo: null, + license: config.get('license', 'MIT'), + manager: config.get('manager', 'npm'), + template: config.get('template', 'JavaScript with CSS') + } + + try { + // Get the git user details + if (!config.get('author')) { + const gitConfigPath = getGitConfigPath('global') + if (gitConfigPath) { + const gitConfig = parseGitConfig.sync({ path: gitConfigPath }) + if (gitConfig.user && gitConfig.user.email) { + defaults.author = '' + if (gitConfig.user.name) { + defaults.author += gitConfig.user.name + } + if (gitConfig.user.email) { + defaults.author += ` <${gitConfig.user.email}>` + } + if (gitConfig.user.url) { + defaults.author += ` (${gitConfig.user.url})` + } + + config.set('author', defaults.author) + } + } + } + } catch (err) {} + + return defaults +} + +module.exports.setDefaults = async (params) => { + const config = new Conf() + config.set('author', params.author) + config.set('license', params.license) + config.set('manager', params.manager) + config.set('template', params.template) +} + +module.exports.clearDefaults = async () => { + const config = new Conf() + config.clear() +} diff --git a/lib/get-params.js b/lib/get-params.js new file mode 100644 index 0000000..0749623 --- /dev/null +++ b/lib/get-params.js @@ -0,0 +1,111 @@ +'use strict' + +const chalk = require('chalk') +const inquirer = require('inquirer') +const camelCase = require('camelcase') + +const { validateName } = require('./validate-params') +const { getDefaults, setDefaults } = require('./get-defaults') +const { getTemplateNames, getTemplateFolder } = require('./get-templates') + +module.exports = async () => { + const templatesNames = await getTemplateNames() + const defaults = await getDefaults() + let params = defaults + let args = process.argv.slice(2) + + if (args.length === 1) { + // If the package name is provided, create with defaults + const packageName = args[0] + const resPkg = await validateName(packageName) + if (resPkg === true) { + params.name = packageName + } else { + console.log(` +${chalk.cyan(packageName)} => ${chalk.red(resPkg)} +`) + process.exit(1) + } + } else { + console.log(` +${chalk.dim.italic(`Walk you through creating your jQuery plugin.`)} +${chalk.dim(`Press ^C at any time to quit.`)} + +${chalk.dim.italic(`Recommended "Package Name" format is`)} ${chalk.cyan.italic(`jquery-my-plugin`)}. ${chalk.dim.italic(`Ex.`)} ${chalk.cyan.italic(`jquery-smart-wizard`)}.`) + + // Start the prompt + params = await inquirer.prompt([ + { + type: 'input', + name: 'name', + message: 'Package Name', + validate: (name) => { + return validateName(name) + }, + default: defaults.name + }, + { + type: 'input', + name: 'description', + message: 'Description', + default: defaults.description + }, + { + type: 'input', + name: 'version', + message: 'Version', + default: defaults.version + }, + { + type: 'input', + name: 'author', + message: "Author", + default: defaults.author + }, + { + type: 'input', + name: 'repo', + message: 'Repository', + default: defaults.repo + }, + { + type: 'input', + name: 'license', + message: 'License', + default: defaults.license + }, + { + type: 'list', + name: 'manager', + message: 'Package Manager', + choices: ['npm', 'yarn'], + default: defaults.manager + }, + { + type: 'list', + name: 'template', + message: 'Template', + choices: templatesNames, + default: defaults.template + } + ]) + } + + // Handle scoped package names + const parts = params.name.split('/') + params.shortName = parts[parts.length - 1] + + // Resolve file, function and class names for the plugin + params.fileName = params.shortName + + params.functionName = camelCase(params.shortName.replace('jquery','')) + params.className = params.shortName.replace('jquery','').toLowerCase().replace(/(?:^|[\s-/])\w/g, function (match) { + return match.toUpperCase(); + }).replace(/-/g, ''); + + // Get template folder + params.templateFolder = await getTemplateFolder(params.template) + + setDefaults(params) + return params +} diff --git a/lib/get-templates.js b/lib/get-templates.js new file mode 100644 index 0000000..d82cb4f --- /dev/null +++ b/lib/get-templates.js @@ -0,0 +1,15 @@ +'use strict' + +const { templates } = require('../templates/templates') + +module.exports.getTemplateNames = async () => { + return templates.map(function(elem) { + return elem.name; + }); +} + +module.exports.getTemplateFolder = async (template) => { + return templates.filter(function(elem) { + return elem.name == template + })[0].folder; +} diff --git a/lib/validate-params.js b/lib/validate-params.js new file mode 100644 index 0000000..203b348 --- /dev/null +++ b/lib/validate-params.js @@ -0,0 +1,41 @@ +'use strict' + +const which = require('which') +const path = require('path') +const fs = require("fs"); +const validateNpmName = require('validate-npm-package-name') + +module.exports.validateName = async (name) => { + if (name) { + const validate = validateNpmName(name) + if (validate.validForNewPackages) { + if (fs.existsSync(path.resolve(process.cwd(), name))) { + return 'The directory already exists' + } + return true + } else { + if (validate.errors) { + return validate.errors.join(', ') + } + if (validate.warnings) { + return validate.warnings.join(', ') + } + } + } else { + return 'Please enter a name for your Package' + } + + return false +} + +module.exports.validateManager = async (manager) => { + if (manager) { + if (which.sync(manager, { nothrow: true })) { + return true + } else { + return manager + ' not installed' + } + } else { + return 'Please select your Package Manager' + } +} diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..5f52183 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,929 @@ +{ + "name": "create-jquery-plugin", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@nodelib/fs.scandir": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz", + "integrity": "sha512-eGmwYQn3gxo4r7jdQnkrrN6bY478C3P+a/y72IJukF8LjB6ZHeB3c+Ehacj3sYeSmUXGlnA67/PmbM9CVwL7Dw==", + "requires": { + "@nodelib/fs.stat": "2.0.3", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.3.tgz", + "integrity": "sha512-bQBFruR2TAwoevBEd/NWMoAAtNGzTRgdrqnYCc7dhzfoNvqPzLyqlEQnzZ3kVnNrSp25iyxE00/3h2fqGAGArA==" + }, + "@nodelib/fs.walk": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.4.tgz", + "integrity": "sha512-1V9XOY4rDW0rehzbrcqAmHnz8e7SKvX27gh8Gt2WgB0+pdzdiLV83p72kZPU+jvMbS1qU5mauP2iOvO8rhmurQ==", + "requires": { + "@nodelib/fs.scandir": "2.1.3", + "fastq": "^1.6.0" + } + }, + "@types/color-name": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", + "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==" + }, + "ajv": { + "version": "6.12.3", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.3.tgz", + "integrity": "sha512-4K0cK3L1hsqk9xIb2z9vs/XU+PGJZ9PNpJRDS9YLzmNdX6jmVPfamLvTJr0aDAusnHyCHO6MjzlkAsgtqp9teA==", + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ansi-escapes": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.1.tgz", + "integrity": "sha512-JWF7ocqNrp8u9oqpgV+wH5ftbt+cfvv+PTjOvKLT3AdYly/LmORARfEVT1iyjwN+4MqE5UmVKoAdIBqeoCHgLA==", + "requires": { + "type-fest": "^0.11.0" + } + }, + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" + }, + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==" + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "requires": { + "fill-range": "^7.0.1" + } + }, + "builtins": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/builtins/-/builtins-1.0.3.tgz", + "integrity": "sha1-y5T662HIaWRR2zZTThQi+U8K7og=" + }, + "camelcase": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.0.0.tgz", + "integrity": "sha512-8KMDF1Vz2gzOq54ONPJS65IvTUaB1cHJ2DMM7MbPmLZljDH1qpzzLsWdiN9pHh6qvkRVDTi/07+eNGch/oLU4w==" + }, + "chalk": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", + "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "chardet": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==" + }, + "cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "requires": { + "restore-cursor": "^3.1.0" + } + }, + "cli-spinners": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.3.0.tgz", + "integrity": "sha512-Xs2Hf2nzrvJMFKimOR7YR0QwZ8fc0u98kdtwN1eNAZzNQgH3vK2pXzff6GJtKh7S5hoJ87ECiAiZFS2fb5Ii2w==" + }, + "cli-width": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz", + "integrity": "sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==" + }, + "clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=" + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "commander": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz", + "integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==" + }, + "conf": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/conf/-/conf-7.0.1.tgz", + "integrity": "sha512-UFA9EPFKK+tedCjz4JKQSxAN0/0r0rjURdq9N805JXWOhFzmr7fTLmG1cnsHCvyYYd65wRjf0KB8zg+WPelkvA==", + "requires": { + "ajv": "^6.12.2", + "debounce-fn": "^4.0.0", + "dot-prop": "^5.2.0", + "env-paths": "^2.2.0", + "json-schema-typed": "^7.0.3", + "make-dir": "^3.1.0", + "onetime": "^5.1.0", + "pkg-up": "^3.1.0", + "semver": "^7.3.2", + "write-file-atomic": "^3.0.3" + } + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "debounce-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/debounce-fn/-/debounce-fn-4.0.0.tgz", + "integrity": "sha512-8pYCQiL9Xdcg0UPSD3d+0KMlOjp+KGU5EPwYddgzQ7DATsg4fuUDjQtsYLmWjnk2obnNHgV3vE2Y4jejSOJVBQ==", + "requires": { + "mimic-fn": "^3.0.0" + }, + "dependencies": { + "mimic-fn": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-3.0.0.tgz", + "integrity": "sha512-PiVO95TKvhiwgSwg1IdLYlCTdul38yZxZMIcnDSFIBUm4BNZha2qpQ4GpJ++15bHoKDtrW2D69lMfFwdFYtNZQ==" + } + } + }, + "defaults": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", + "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", + "requires": { + "clone": "^1.0.2" + } + }, + "dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "requires": { + "path-type": "^4.0.0" + } + }, + "dot-prop": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.2.0.tgz", + "integrity": "sha512-uEUyaDKoSQ1M4Oq8l45hSE26SnTxL6snNnqvK/VWx5wJhmff5z0FUVJDKDanor/6w3kzE3i7XZOk+7wC0EXr1A==", + "requires": { + "is-obj": "^2.0.0" + } + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "requires": { + "once": "^1.4.0" + } + }, + "env-paths": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.0.tgz", + "integrity": "sha512-6u0VYSCo/OW6IoD5WCLLy9JUGARbamfSavcNXry/eu8aHVFei6CD3Sw+VGX5alea1i9pgPHW0mbu6Xj0uBh7gA==" + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + }, + "execa": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/execa/-/execa-4.0.3.tgz", + "integrity": "sha512-WFDXGHckXPWZX19t1kCsXzOpqX9LWYNqn4C+HqZlk/V0imTkzJZqf87ZBhvpHaftERYknpk0fjSylnXVlVgI0A==", + "requires": { + "cross-spawn": "^7.0.0", + "get-stream": "^5.0.0", + "human-signals": "^1.1.1", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.0", + "onetime": "^5.1.0", + "signal-exit": "^3.0.2", + "strip-final-newline": "^2.0.0" + }, + "dependencies": { + "get-stream": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz", + "integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==", + "requires": { + "pump": "^3.0.0" + } + } + } + }, + "external-editor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", + "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", + "requires": { + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", + "tmp": "^0.0.33" + } + }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + }, + "fast-glob": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.4.tgz", + "integrity": "sha512-kr/Oo6PX51265qeuCYsyGypiO5uJFgBS0jksyG7FUeCyQzNwYnzrNIMR1NXfkZXsMYXYLRAHgISHBz8gQcxKHQ==", + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.0", + "merge2": "^1.3.0", + "micromatch": "^4.0.2", + "picomatch": "^2.2.1" + } + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + }, + "fastq": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.8.0.tgz", + "integrity": "sha512-SMIZoZdLh/fgofivvIkmknUXyPnvxRE3DhtZ5Me3Mrsk5gyPL42F0xr51TdRXskBxHfMp+07bcYzfsYEsSQA9Q==", + "requires": { + "reusify": "^1.0.4" + } + }, + "figures": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", + "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", + "requires": { + "escape-string-regexp": "^1.0.5" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "requires": { + "locate-path": "^3.0.0" + } + }, + "git-config-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/git-config-path/-/git-config-path-2.0.0.tgz", + "integrity": "sha512-qc8h1KIQbJpp+241id3GuAtkdyJ+IK+LIVtkiFTRKRrmddDzs3SI9CvP1QYmWBFvm1I/PWRwj//of8bgAc0ltA==" + }, + "glob-parent": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", + "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", + "requires": { + "is-glob": "^4.0.1" + } + }, + "globby": { + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.1.tgz", + "integrity": "sha512-iH9RmgwCmUJHi2z5o2l3eTtGBtXek1OYlHrbcxOYugyHLmAsZrPj43OtHThd62Buh/Vv6VyCBD2bdyWcGNQqoQ==", + "requires": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.1.1", + "ignore": "^5.1.4", + "merge2": "^1.3.0", + "slash": "^3.0.0" + } + }, + "handlebars": { + "version": "4.7.6", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.6.tgz", + "integrity": "sha512-1f2BACcBfiwAfStCKZNrUCgqNZkGsAT7UM3kkYtXuLo0KnaVfjKOyf7PRzB6++aK9STyT1Pd2ZCPe3EGOXleXA==", + "requires": { + "minimist": "^1.2.5", + "neo-async": "^2.6.0", + "source-map": "^0.6.1", + "uglify-js": "^3.1.4", + "wordwrap": "^1.0.0" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + }, + "human-signals": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", + "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==" + }, + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "ignore": { + "version": "5.1.8", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", + "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==" + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=" + }, + "ini": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==" + }, + "inquirer": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.3.2.tgz", + "integrity": "sha512-DF4osh1FM6l0RJc5YWYhSDB6TawiBRlbV9Cox8MWlidU218Tb7fm3lQTULyUJDfJ0tjbzl0W4q651mrCCEM55w==", + "requires": { + "ansi-escapes": "^4.2.1", + "chalk": "^4.1.0", + "cli-cursor": "^3.1.0", + "cli-width": "^3.0.0", + "external-editor": "^3.0.3", + "figures": "^3.0.0", + "lodash": "^4.17.16", + "mute-stream": "0.0.8", + "run-async": "^2.4.0", + "rxjs": "^6.6.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0", + "through": "^2.3.6" + } + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" + }, + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-interactive": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz", + "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==" + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" + }, + "is-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", + "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==" + }, + "is-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", + "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==" + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + }, + "json-schema-typed": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/json-schema-typed/-/json-schema-typed-7.0.3.tgz", + "integrity": "sha512-7DE8mpG+/fVw+dTpjbxnx47TaMnDfOI1jwft9g1VybltZCduyRQPJPvc+zzKY9WPHxhPWczyFuYa6I8Mw4iU5A==" + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "lodash": { + "version": "4.17.19", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", + "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==" + }, + "log-symbols": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-3.0.0.tgz", + "integrity": "sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ==", + "requires": { + "chalk": "^2.4.2" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "requires": { + "semver": "^6.0.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" + } + } + }, + "merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" + }, + "merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==" + }, + "micromatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", + "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", + "requires": { + "braces": "^3.0.1", + "picomatch": "^2.0.5" + } + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" + }, + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" + }, + "mute-stream": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==" + }, + "neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==" + }, + "npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "requires": { + "path-key": "^3.0.0" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz", + "integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==", + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "ora": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/ora/-/ora-4.0.4.tgz", + "integrity": "sha512-77iGeVU1cIdRhgFzCK8aw1fbtT1B/iZAvWjS+l/o1x0RShMgxHUZaD2yDpWsNCPwXg9z1ZA78Kbdvr8kBmG/Ww==", + "requires": { + "chalk": "^3.0.0", + "cli-cursor": "^3.1.0", + "cli-spinners": "^2.2.0", + "is-interactive": "^1.0.0", + "log-symbols": "^3.0.0", + "mute-stream": "0.0.8", + "strip-ansi": "^6.0.0", + "wcwidth": "^1.0.1" + }, + "dependencies": { + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + } + } + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" + }, + "p-each-series": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-each-series/-/p-each-series-2.1.0.tgz", + "integrity": "sha512-ZuRs1miPT4HrjFa+9fRfOFXxGJfORgelKV9f9nNOWw2gl6gVsRaVDOQP0+MI0G0wGKns1Yacsu0GjOFbTK0JFQ==" + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" + }, + "parse-git-config": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/parse-git-config/-/parse-git-config-3.0.0.tgz", + "integrity": "sha512-wXoQGL1D+2COYWCD35/xbiKma1Z15xvZL8cI25wvxzled58V51SJM04Urt/uznS900iQor7QO04SgdfT/XlbuA==", + "requires": { + "git-config-path": "^2.0.0", + "ini": "^1.3.5" + } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=" + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" + }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==" + }, + "picomatch": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", + "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==" + }, + "pkg-up": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-3.1.0.tgz", + "integrity": "sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA==", + "requires": { + "find-up": "^3.0.0" + } + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" + }, + "restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "requires": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + } + }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==" + }, + "run-async": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", + "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==" + }, + "run-parallel": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.1.9.tgz", + "integrity": "sha512-DEqnSRTDw/Tc3FXf49zedI638Z9onwUotBMiUFKmrO2sdFKIbXamXGQ3Axd4qgphxKB4kw/qP1w5kTxnfU1B9Q==" + }, + "rxjs": { + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.0.tgz", + "integrity": "sha512-3HMA8z/Oz61DUHe+SdOiQyzIf4tOx5oQHmMir7IZEu6TMqCLHT4LRcmNaUS0NwOz8VLvmmBduMsoaUvMaIiqzg==", + "requires": { + "tslib": "^1.9.0" + } + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "semver": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", + "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==" + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" + }, + "signal-exit": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==" + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==" + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + }, + "string-width": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", + "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "requires": { + "ansi-regex": "^5.0.0" + } + }, + "strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==" + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "requires": { + "has-flag": "^4.0.0" + } + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" + }, + "tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "requires": { + "os-tmpdir": "~1.0.2" + } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "requires": { + "is-number": "^7.0.0" + } + }, + "tslib": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz", + "integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==" + }, + "type-fest": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.11.0.tgz", + "integrity": "sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ==" + }, + "typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "requires": { + "is-typedarray": "^1.0.0" + } + }, + "uglify-js": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.10.0.tgz", + "integrity": "sha512-Esj5HG5WAyrLIdYU74Z3JdG2PxdIusvj6IWHMtlyESxc7kcDz7zYlYjpnSokn1UbpV0d/QX9fan7gkCNd/9BQA==", + "optional": true + }, + "uri-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "requires": { + "punycode": "^2.1.0" + } + }, + "validate-npm-package-name": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-3.0.0.tgz", + "integrity": "sha1-X6kS2B630MdK/BQN5zF/DKffQ34=", + "requires": { + "builtins": "^1.0.3" + } + }, + "wcwidth": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=", + "requires": { + "defaults": "^1.0.3" + } + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "requires": { + "isexe": "^2.0.0" + } + }, + "wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=" + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "write-file-atomic": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", + "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", + "requires": { + "imurmurhash": "^0.1.4", + "is-typedarray": "^1.0.0", + "signal-exit": "^3.0.2", + "typedarray-to-buffer": "^3.1.5" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..9951d41 --- /dev/null +++ b/package.json @@ -0,0 +1,56 @@ +{ + "name": "create-jquery-plugin", + "version": "1.0.0", + "description": "CLI for creating ready-to-start modern jQuery Plugins", + "main": "index.js", + "bin": { + "create-jquery-plugin": "./index.js" + }, + "scripts": { + "start": "node .", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/techlab/create-jquery-plugin.git" + }, + "keywords": [ + "create-jquery-plugin", + "cli", + "jquery", + "jquery-plugin", + "jquery-plugin-boilerplate", + "package", + "plugin", + "util", + "gulp", + "example" + ], + "author": { + "name": "Dipu Raj", + "email": "hello.techlab@gmail.com", + "url": "http://dipu.me" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/techlab/create-jquery-plugin/issues" + }, + "homepage": "http://techlaboratory.net/create-jquery-plugin", + "dependencies": { + "camelcase": "^6.0.0", + "chalk": "^4.1.0", + "commander": "^5.1.0", + "conf": "^7.0.1", + "execa": "^4.0.3", + "git-config-path": "^2.0.0", + "globby": "^11.0.1", + "handlebars": "^4.7.6", + "inquirer": "^7.3.2", + "make-dir": "^3.1.0", + "ora": "^4.0.4", + "p-each-series": "^2.1.0", + "parse-git-config": "^3.0.0", + "validate-npm-package-name": "^3.0.0", + "which": "^2.0.2" + } +} diff --git a/templates/javascript_css/.gitignore b/templates/javascript_css/.gitignore new file mode 100644 index 0000000..967d232 --- /dev/null +++ b/templates/javascript_css/.gitignore @@ -0,0 +1,36 @@ +# See https://help.github.com/ignore-files/ for more about ignoring files. + +# dependencies +node_modules +node_modules +bower_components +vendor +public + +# builds +build +dist +.rpt2_cache + +# misc +.DS_Store +.env +.env.local +.env.development.local +.env.test.local +.env.production.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# editor files +/nbproject/ +/nbproject/private/ +.idea/* +.vscode/* +*.tmlanguage.cache +*.tmPreferences.cache +*.stTheme.cache +*.sublime-workspace +*.sublime-project diff --git a/templates/javascript_css/.npmignore b/templates/javascript_css/.npmignore new file mode 100644 index 0000000..b1cef55 --- /dev/null +++ b/templates/javascript_css/.npmignore @@ -0,0 +1,64 @@ +.*.swp +._* +.DS_Store +.git +.github +.hg +.lock-wscript +.svn +.wafpickle-* +CVS +npm-debug.log + +*.seed +*.log +*.csv +*.dat +*.out +*.pid +*.gz +*.orig +*.jql.js + +work +build +src +test +spec +pids +logs +results +coverage +lib-cov +html-report +xunit.xml + +# IDE Files +#------------------------- +/nbproject/* +.idea/* +.vscode/* +.project +.idea +.settings +.iml + +## Sublime Text cache files +*.tmlanguage.cache +*.tmPreferences.cache +*.stTheme.cache +*.sublime-workspace +*.sublime-project + +ehthumbs.db +Icon? +Thumbs.db +.AppleDouble +.LSOverride +.Spotlight-V100 +.Trashes + +/ref.txt +/node_modules/ +/bower_components/ +/vendor/ diff --git a/templates/javascript_css/CONTRIBUTING.md b/templates/javascript_css/CONTRIBUTING.md new file mode 100644 index 0000000..f41e40f --- /dev/null +++ b/templates/javascript_css/CONTRIBUTING.md @@ -0,0 +1,41 @@ +# Contributing + +## How can I contribute? +- Fix a bug you found or already reported. +- Add new features to the project. +- Create new themes +- Add new test cases. +- Add documentation. +- Add a demo page. + +## How to contribute code? +Here are the basic steps to get started contributing code: + +1. Fork the repository. +2. Install the dependencies, run `npm install`. +3. Start the project, run `npm start`. +4. Replicate the issue you're trying to fix or spec out the feature you're trying to add. +5. Modify the code to fix the bug or to add the feature. All changes should happen in the relevant `src/` files. +6. Verify that your fix or feature works. +7. Run the test cases by running `npm test`, you can also add more test cases based on your new change. +8. Build the code by running `npm run build`. +9. Commit your changes with an informative description. +10. Open a pull request with a descriptive message about what the PR does. + +Thank you for your contribution! + +##### Notes for pull request +- Follow the same code style as the library. +- Run the test suites in the `test` directory first by running `npm test`. +- Don't modify any files in the `dist` directory. +- Don't alter the licence headers. + +## Reporting bugs +#### Make sure it is a bug related to this project +Before reporting the bug, please make sure that the bug is in the project and not from your own code or any other library used. + +#### Try the latest version +Bugs in the older versions of the project may have already been fixed. +In order to avoid reporting known issues, make sure you are always testing against the latest release. +Also make sure the problem hasn't already been reported on the GitHub Issues Tracker. +If not, create a new issue there and include your test case. diff --git a/templates/javascript_css/LICENSE b/templates/javascript_css/LICENSE new file mode 100644 index 0000000..676b0eb --- /dev/null +++ b/templates/javascript_css/LICENSE @@ -0,0 +1 @@ +{{license}} diff --git a/templates/javascript_css/README.md b/templates/javascript_css/README.md new file mode 100644 index 0000000..2e224d8 --- /dev/null +++ b/templates/javascript_css/README.md @@ -0,0 +1,74 @@ +# {{name}} +#### {{description}} + +[![npm version](https://badge.fury.io/js/{{name}}.svg)](https://www.npmjs.com/package/{{name}}) + +Requirements +----- + + [jQuery](http://jquery.com/) + + +Installation +----- + +### [NPM](https://www.npmjs.com/package/{{name}}) +```bash +npm install {{name}} +``` + +### [Yarn](https://yarn.pm/{{name}}) +```bash +yarn add {{name}} +``` + +### [CDN - jsDelivr](https://www.jsdelivr.com/package/npm/{{name}}) +```html + + + + + +``` + +### [CDN - UNPKG](https://unpkg.com/browse/{{name}}/) +```html + + + + + +``` + +Usage +----- + +Include CSS +```html + +``` + +HTML +```html +
+``` + +Include jQuery +```html + +``` + +Include Plugin JS +```html + +``` +Initialize the Plugin +```js +$('#element').{{functionName}}(); +``` + +License +---- +{{license}} + + +Created with :green_heart: [create-jquery-plugin](https://www.npmjs.com/package/create-jquery-plugin) diff --git a/templates/javascript_css/examples/index.html b/templates/javascript_css/examples/index.html new file mode 100644 index 0000000..1a74711 --- /dev/null +++ b/templates/javascript_css/examples/index.html @@ -0,0 +1,41 @@ + + + + {{name}} Example + + + + + + + +
+
+
+
+

Plugin Element 1

+

Plugin Element 2

+
+
+
+ + + + + + + + + + + diff --git a/templates/javascript_css/gulpfile.js b/templates/javascript_css/gulpfile.js new file mode 100644 index 0000000..24a7baa --- /dev/null +++ b/templates/javascript_css/gulpfile.js @@ -0,0 +1,122 @@ +// Include the required tools used on tasks +var gulp = require('gulp'), + jshint = require('gulp-jshint'), + rename = require('gulp-rename'), + uglify = require('gulp-uglify'), + saveLicense = require('uglify-save-license'), + babel = require("gulp-babel"), + postcss = require('gulp-postcss'), + cleanCSS = require('gulp-clean-css'), + cssbeautify = require('gulp-cssbeautify'), + autoprefixer = require('autoprefixer'), + del = require('del'); + +var Server = require('karma').Server; +var browserSync = require('browser-sync').create(); +var reload = browserSync.reload; + +// Specify the Source files +var SRC_JS = 'src/js/*.js'; +var SRC_CSS = 'src/css/*.css'; + +// Specify the Destination folders +var DEST_JS = 'dist/js'; +var DEST_CSS = 'dist/css'; + +// BUILD JS +function build_js(cb) { + gulp.src(SRC_JS) + .pipe(babel({ + presets: ['@babel/env'] + })) + .pipe(gulp.dest(DEST_JS)) + .pipe(uglify({ + output: { + comments: saveLicense + } + })) + .pipe(rename({ + suffix: '.min' + })) + .pipe(gulp.dest(DEST_JS)); + + cb(); +} + +// BUILD CSS +function build_css(cb) { + gulp.src(SRC_CSS) + .pipe(postcss( [autoprefixer()] )) + .pipe(cssbeautify({ autosemicolon: true })) + .pipe(gulp.dest(DEST_CSS)) + .pipe(cleanCSS({compatibility: 'ie8'})) + .pipe(rename({suffix: '.min'})) + .pipe(gulp.dest(DEST_CSS)); + + cb(); +} + +// LINT +function lint_js(cb) { + gulp.src(SRC_JS) + .pipe(jshint({ "esversion": 8 })) + .pipe(jshint.reporter('default')); + + cb(); +} + +// CLEAN +function clean_js(cb) { + del.sync([DEST_JS]); + + cb(); +} + +function clean_css(cb) { + del.sync([DEST_CSS]); + + cb(); +} + +// WATCH +function watch(cb) { + gulp.watch(SRC_JS, build_js); + gulp.watch(SRC_CSS, build_css); + + cb(); +} + +// SERVE +function serve(cb) { + // Serve files from the root of this project + browserSync.init({ + server: { + baseDir: ["examples", "dist"], + index: "index.html" + } + }); + + gulp.watch(SRC_JS, build_js).on("change", reload); + gulp.watch(SRC_CSS, build_css).on("change", reload); + + cb(); +} + +// TEST +function test(cb) { + new Server({ + configFile: __dirname + '/karma.conf.js', + singleRun: true + }, done).start(); + + cb(); +} + +// EXPORT methods +exports.clean = gulp.parallel(clean_js, clean_css); +exports.build = gulp.parallel(gulp.series(clean_js, lint_js, build_js), gulp.series(clean_css, build_css)); +exports.lint = lint_js; +exports.watch = watch; +exports.test = test; +exports.serve = serve; +exports.default = serve; diff --git a/templates/javascript_css/karma.conf.js b/templates/javascript_css/karma.conf.js new file mode 100644 index 0000000..4faa22b --- /dev/null +++ b/templates/javascript_css/karma.conf.js @@ -0,0 +1,76 @@ +// Karma configuration + +module.exports = function(config) { + config.set({ + + // base path that will be used to resolve all patterns (eg. files, exclude) + basePath: '', + + + // frameworks to use + // available frameworks: https://npmjs.org/browse/keyword/karma-adapter + frameworks: ['jasmine-jquery','jasmine'], + + + // list of files / patterns to load in the browser + files: [ + 'test/*.js', + 'https://code.jquery.com/jquery-3.4.1.min.js', + 'src/js/*.js', + { + pattern: 'test/*.html', + watched: true, + served: true, + included: false + } + ], + + + // list of files to exclude + exclude: [ + ], + + + // preprocess matching files before serving them to the browser + // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor + preprocessors: { + }, + + + // test results reporter to use + // possible values: 'dots', 'progress' + // available reporters: https://npmjs.org/browse/keyword/karma-reporter + reporters: ['spec'], + + + // web server port + port: 9876, + + + // enable / disable colors in the output (reporters and logs) + colors: true, + + + // level of logging + // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG + logLevel: config.LOG_INFO, + + + // enable / disable watching file and executing tests whenever any file changes + autoWatch: false, + + + // start these browsers + // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher + browsers: ['ChromeHeadless', 'FirefoxHeadless'], + + + // Continuous Integration mode + // if true, Karma captures browsers, runs the tests and exits + singleRun: true, + + // Concurrency level + // how many browser should be started simultaneous + concurrency: Infinity + }) +} diff --git a/templates/javascript_css/package.json b/templates/javascript_css/package.json new file mode 100644 index 0000000..39f9102 --- /dev/null +++ b/templates/javascript_css/package.json @@ -0,0 +1,56 @@ +{ + "name": "{{name}}", + "version": "{{version}}", + "description": "{{{description}}}", + "homepage": "", + "license": "{{license}}", + "author": "{{{author}}}", + "repository": "{{repo}}", + "dependencies": { + "jquery": ">=1.9.0" + }, + "scripts": { + "start": "gulp build && gulp serve", + "watch": "gulp watch", + "test": "./node_modules/karma/bin/karma start --single-run", + "build": "gulp build", + "clean": "gulp clean", + "lint": "gulp lint" + }, + "keywords": [ + "util", + "create-jquery-plugin", + "cli", + "jquery", + "jquery-plugin", + "jquery-plugin-boilerplate", + "gulp", + "example" + ], + "devDependencies": { + "@babel/core": "^7.8.3", + "@babel/preset-env": "^7.8.3", + "autoprefixer": "^9.7.4", + "browser-sync": "^2.26.7", + "del": "^5.1.0", + "gulp": "^4.0.2", + "gulp-babel": "^8.0.0", + "gulp-clean-css": "^4.2.0", + "gulp-cssbeautify": "^2.0.1", + "gulp-jasmine": "^4.0.0", + "gulp-jshint": "^2.1.0", + "gulp-postcss": "^8.0.0", + "gulp-rename": "^2.0.0", + "gulp-uglify": "^3.0.2", + "jasmine-core": "^3.5.0", + "jasmine-jquery": "^2.1.1", + "jshint": "^2.11.0", + "karma": "^4.4.1", + "karma-chrome-launcher": "^3.1.0", + "karma-firefox-launcher": "^1.3.0", + "karma-jasmine": "^3.1.0", + "karma-jasmine-jquery": "^0.1.1", + "karma-spec-reporter": "0.0.32", + "uglify-save-license": "^0.4.1" + } +} diff --git a/templates/javascript_css/src/css/jquery-plugin-boilerplate.css b/templates/javascript_css/src/css/jquery-plugin-boilerplate.css new file mode 100644 index 0000000..0e24686 --- /dev/null +++ b/templates/javascript_css/src/css/jquery-plugin-boilerplate.css @@ -0,0 +1,20 @@ +/*! + * {{name}} {{version}} + * {{{description}}} + * + * Created by {{{author}}} + * + * @license {{license}} + */ + +.my-style1 { + background-color: green; + color: #fff; + padding: 10px; +} + +.my-style2 { + background-color: red; + color: #000; + padding: 10px; +} diff --git a/templates/javascript_css/src/js/jquery-plugin-boilerplate.js b/templates/javascript_css/src/js/jquery-plugin-boilerplate.js new file mode 100644 index 0000000..1fbcd8e --- /dev/null +++ b/templates/javascript_css/src/js/jquery-plugin-boilerplate.js @@ -0,0 +1,91 @@ +/*! + * {{name}} {{version}} + * {{{description}}} + * + * Created by {{{author}}} + * + * @license {{license}} + */ + +(function (factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['jquery'], factory); + } else if (typeof module === 'object' && module.exports) { + // Node/CommonJS + module.exports = function( root, jQuery ) { + if ( jQuery === undefined ) { + // require('jQuery') returns a factory that requires window to + // build a jQuery instance, we normalize how we use modules + // that require this pattern but the window provided is a noop + // if it's defined (how jquery works) + if ( typeof window !== 'undefined' ) { + jQuery = require('jquery'); + } + else { + jQuery = require('jquery')(root); + } + } + factory(jQuery); + return jQuery; + }; + } else { + // Browser globals + factory(jQuery); + } +}(function ($) { + "use strict"; + + // Default Options + var defaults = { + // TODO: ADD YOUR DEFAULT OPTIONS HERE + myStyle: 'my-style1' + }; + + class {{className}} { + + constructor(element, options) { + // Merge user settings with default + this.options = $.extend(true, {}, defaults, options); + // Main container element + this.main = $(element); + + // Initial load + this._init(); + } + + // Initial Method + _init() { + // Plugin init and logic + this.main.addClass(this.options.myStyle); + } + + // TODO: YOU CAN ADD MORE FUNCTIONS FOR YOUR PLUGIN HERE + + } + + // Wrapper for the plugin + $.fn.{{functionName}} = function (options) { + var pluginName = "{{functionName}}"; + + if (options === undefined || typeof options === 'object') { + return this.each(function () { + if (!$.data(this, pluginName)) { + $.data(this, pluginName, new {{className}}(this, options)); + } + }); + } else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') { + let instance = $.data(this[0], pluginName); + + if (options === 'destroy') { + $.data(this, pluginName, null); + } + + if (instance instanceof {{className}} && typeof instance[options] === 'function') { + return instance[options].apply(instance, Array.prototype.slice.call(arguments, 1)); + } else { + return this; + } + } + }; +})); diff --git a/templates/javascript_css/test/test-template.html b/templates/javascript_css/test/test-template.html new file mode 100644 index 0000000..280f1c0 --- /dev/null +++ b/templates/javascript_css/test/test-template.html @@ -0,0 +1,11 @@ + + + + {{name}} Test + + + + +
+ + diff --git a/templates/javascript_css/test/test.js b/templates/javascript_css/test/test.js new file mode 100644 index 0000000..056ced9 --- /dev/null +++ b/templates/javascript_css/test/test.js @@ -0,0 +1,41 @@ +describe('Plugin Default Init', function() { + var el, plugin; + + beforeEach(function(){ + jasmine.getFixtures().fixturesPath = 'base/test'; + loadFixtures('test-template.html'); + + el = $('#test-element'); + plugin = el.{{functionName}}(); + }); + + afterEach(function(){ + el.remove(); + el = null; + }); + + it('should add default style to the element', function() { + expect(el).toHaveClass("my-style1"); + }); + +}); + +describe('Plugin with Option Init', function() { + var el, plugin; + + beforeEach(function(){ + el = $('
'); + $(document.body).append(el); + plugin = el.{{functionName}}({ myStyle: 'my-style2'}); + }); + + afterEach(function(){ + el.remove(); + el = null; + }); + + it('should add specified style to the element', function() { + expect(el.hasClass('my-style2')).toBe(true); + expect(el).not.toHaveClass("my-style1"); + }); +}); diff --git a/templates/javascript_sass/.gitignore b/templates/javascript_sass/.gitignore new file mode 100644 index 0000000..967d232 --- /dev/null +++ b/templates/javascript_sass/.gitignore @@ -0,0 +1,36 @@ +# See https://help.github.com/ignore-files/ for more about ignoring files. + +# dependencies +node_modules +node_modules +bower_components +vendor +public + +# builds +build +dist +.rpt2_cache + +# misc +.DS_Store +.env +.env.local +.env.development.local +.env.test.local +.env.production.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# editor files +/nbproject/ +/nbproject/private/ +.idea/* +.vscode/* +*.tmlanguage.cache +*.tmPreferences.cache +*.stTheme.cache +*.sublime-workspace +*.sublime-project diff --git a/templates/javascript_sass/.npmignore b/templates/javascript_sass/.npmignore new file mode 100644 index 0000000..b1cef55 --- /dev/null +++ b/templates/javascript_sass/.npmignore @@ -0,0 +1,64 @@ +.*.swp +._* +.DS_Store +.git +.github +.hg +.lock-wscript +.svn +.wafpickle-* +CVS +npm-debug.log + +*.seed +*.log +*.csv +*.dat +*.out +*.pid +*.gz +*.orig +*.jql.js + +work +build +src +test +spec +pids +logs +results +coverage +lib-cov +html-report +xunit.xml + +# IDE Files +#------------------------- +/nbproject/* +.idea/* +.vscode/* +.project +.idea +.settings +.iml + +## Sublime Text cache files +*.tmlanguage.cache +*.tmPreferences.cache +*.stTheme.cache +*.sublime-workspace +*.sublime-project + +ehthumbs.db +Icon? +Thumbs.db +.AppleDouble +.LSOverride +.Spotlight-V100 +.Trashes + +/ref.txt +/node_modules/ +/bower_components/ +/vendor/ diff --git a/templates/javascript_sass/CONTRIBUTING.md b/templates/javascript_sass/CONTRIBUTING.md new file mode 100644 index 0000000..f41e40f --- /dev/null +++ b/templates/javascript_sass/CONTRIBUTING.md @@ -0,0 +1,41 @@ +# Contributing + +## How can I contribute? +- Fix a bug you found or already reported. +- Add new features to the project. +- Create new themes +- Add new test cases. +- Add documentation. +- Add a demo page. + +## How to contribute code? +Here are the basic steps to get started contributing code: + +1. Fork the repository. +2. Install the dependencies, run `npm install`. +3. Start the project, run `npm start`. +4. Replicate the issue you're trying to fix or spec out the feature you're trying to add. +5. Modify the code to fix the bug or to add the feature. All changes should happen in the relevant `src/` files. +6. Verify that your fix or feature works. +7. Run the test cases by running `npm test`, you can also add more test cases based on your new change. +8. Build the code by running `npm run build`. +9. Commit your changes with an informative description. +10. Open a pull request with a descriptive message about what the PR does. + +Thank you for your contribution! + +##### Notes for pull request +- Follow the same code style as the library. +- Run the test suites in the `test` directory first by running `npm test`. +- Don't modify any files in the `dist` directory. +- Don't alter the licence headers. + +## Reporting bugs +#### Make sure it is a bug related to this project +Before reporting the bug, please make sure that the bug is in the project and not from your own code or any other library used. + +#### Try the latest version +Bugs in the older versions of the project may have already been fixed. +In order to avoid reporting known issues, make sure you are always testing against the latest release. +Also make sure the problem hasn't already been reported on the GitHub Issues Tracker. +If not, create a new issue there and include your test case. diff --git a/templates/javascript_sass/LICENSE b/templates/javascript_sass/LICENSE new file mode 100644 index 0000000..676b0eb --- /dev/null +++ b/templates/javascript_sass/LICENSE @@ -0,0 +1 @@ +{{license}} diff --git a/templates/javascript_sass/README.md b/templates/javascript_sass/README.md new file mode 100644 index 0000000..2e224d8 --- /dev/null +++ b/templates/javascript_sass/README.md @@ -0,0 +1,74 @@ +# {{name}} +#### {{description}} + +[![npm version](https://badge.fury.io/js/{{name}}.svg)](https://www.npmjs.com/package/{{name}}) + +Requirements +----- + + [jQuery](http://jquery.com/) + + +Installation +----- + +### [NPM](https://www.npmjs.com/package/{{name}}) +```bash +npm install {{name}} +``` + +### [Yarn](https://yarn.pm/{{name}}) +```bash +yarn add {{name}} +``` + +### [CDN - jsDelivr](https://www.jsdelivr.com/package/npm/{{name}}) +```html + + + + + +``` + +### [CDN - UNPKG](https://unpkg.com/browse/{{name}}/) +```html + + + + + +``` + +Usage +----- + +Include CSS +```html + +``` + +HTML +```html +
+``` + +Include jQuery +```html + +``` + +Include Plugin JS +```html + +``` +Initialize the Plugin +```js +$('#element').{{functionName}}(); +``` + +License +---- +{{license}} + + +Created with :green_heart: [create-jquery-plugin](https://www.npmjs.com/package/create-jquery-plugin) diff --git a/templates/javascript_sass/examples/index.html b/templates/javascript_sass/examples/index.html new file mode 100644 index 0000000..1a74711 --- /dev/null +++ b/templates/javascript_sass/examples/index.html @@ -0,0 +1,41 @@ + + + + {{name}} Example + + + + + + + +
+
+
+
+

Plugin Element 1

+

Plugin Element 2

+
+
+
+ + + + + + + + + + + diff --git a/templates/javascript_sass/gulpfile.js b/templates/javascript_sass/gulpfile.js new file mode 100644 index 0000000..cf44fdb --- /dev/null +++ b/templates/javascript_sass/gulpfile.js @@ -0,0 +1,125 @@ +// Include the required tools used on tasks +var gulp = require('gulp'), + jshint = require('gulp-jshint'), + rename = require('gulp-rename'), + uglify = require('gulp-uglify'), + saveLicense = require('uglify-save-license'), + babel = require("gulp-babel"), + postcss = require('gulp-postcss'), + cleanCSS = require('gulp-clean-css'), + cssbeautify = require('gulp-cssbeautify'), + autoprefixer = require('autoprefixer'), + sass = require('gulp-sass'), + del = require('del'); + +sass.compiler = require('node-sass'); +var Server = require('karma').Server; +var browserSync = require('browser-sync').create(); +var reload = browserSync.reload; + +// Specify the Source files +var SRC_JS = 'src/js/*.js'; +var SRC_SCSS = 'src/scss/*.scss'; + +// Specify the Destination folders +var DEST_JS = 'dist/js'; +var DEST_SCSS = 'dist/css'; + +// BUILD JS +function build_js(cb) { + gulp.src(SRC_JS) + .pipe(babel({ + presets: ['@babel/env'] + })) + .pipe(gulp.dest(DEST_JS)) + .pipe(uglify({ + output: { + comments: saveLicense + } + })) + .pipe(rename({ + suffix: '.min' + })) + .pipe(gulp.dest(DEST_JS)); + + cb(); +} + +// BUILD SCSS +function build_scss(cb) { + gulp.src(SRC_SCSS) + .pipe(sass({outputStyle:'expanded'}).on('error', sass.logError)) + .pipe(postcss( [autoprefixer()] )) + .pipe(cssbeautify({ autosemicolon: true })) + .pipe(gulp.dest(DEST_SCSS)) + .pipe(cleanCSS({compatibility: 'ie8'})) + .pipe(rename({suffix: '.min'})) + .pipe(gulp.dest(DEST_SCSS)); + + cb(); +} + +// LINT +function lint_js(cb) { + gulp.src(SRC_JS) + .pipe(jshint({ "esversion": 8 })) + .pipe(jshint.reporter('default')); + + cb(); +} + +// CLEAN +function clean_js(cb) { + del.sync([DEST_JS]); + + cb(); +} + +function clean_scss(cb) { + del.sync([DEST_SCSS]); + + cb(); +} + +// WATCH +function watch(cb) { + gulp.watch(SRC_JS, build_js); + gulp.watch(SRC_SCSS, build_scss); + + cb(); +} + +// SERVE +function serve(cb) { + // Serve files from the root of this project + browserSync.init({ + server: { + baseDir: ["examples", "dist"], + index: "index.html" + } + }); + + gulp.watch(SRC_JS, build_js).on("change", reload); + gulp.watch(SRC_SCSS, build_scss).on("change", reload); + + cb(); +} + +// TEST +function test(cb) { + new Server({ + configFile: __dirname + '/karma.conf.js', + singleRun: true + }, done).start(); + + cb(); +} + +// EXPORT methods +exports.clean = gulp.parallel(clean_js, clean_scss); +exports.build = gulp.parallel(gulp.series(clean_js, lint_js, build_js), gulp.series(clean_scss, build_scss)); +exports.lint = lint_js; +exports.watch = watch; +exports.test = test; +exports.serve = serve; +exports.default = serve; diff --git a/templates/javascript_sass/karma.conf.js b/templates/javascript_sass/karma.conf.js new file mode 100644 index 0000000..4faa22b --- /dev/null +++ b/templates/javascript_sass/karma.conf.js @@ -0,0 +1,76 @@ +// Karma configuration + +module.exports = function(config) { + config.set({ + + // base path that will be used to resolve all patterns (eg. files, exclude) + basePath: '', + + + // frameworks to use + // available frameworks: https://npmjs.org/browse/keyword/karma-adapter + frameworks: ['jasmine-jquery','jasmine'], + + + // list of files / patterns to load in the browser + files: [ + 'test/*.js', + 'https://code.jquery.com/jquery-3.4.1.min.js', + 'src/js/*.js', + { + pattern: 'test/*.html', + watched: true, + served: true, + included: false + } + ], + + + // list of files to exclude + exclude: [ + ], + + + // preprocess matching files before serving them to the browser + // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor + preprocessors: { + }, + + + // test results reporter to use + // possible values: 'dots', 'progress' + // available reporters: https://npmjs.org/browse/keyword/karma-reporter + reporters: ['spec'], + + + // web server port + port: 9876, + + + // enable / disable colors in the output (reporters and logs) + colors: true, + + + // level of logging + // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG + logLevel: config.LOG_INFO, + + + // enable / disable watching file and executing tests whenever any file changes + autoWatch: false, + + + // start these browsers + // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher + browsers: ['ChromeHeadless', 'FirefoxHeadless'], + + + // Continuous Integration mode + // if true, Karma captures browsers, runs the tests and exits + singleRun: true, + + // Concurrency level + // how many browser should be started simultaneous + concurrency: Infinity + }) +} diff --git a/templates/javascript_sass/package.json b/templates/javascript_sass/package.json new file mode 100644 index 0000000..7a78213 --- /dev/null +++ b/templates/javascript_sass/package.json @@ -0,0 +1,58 @@ +{ + "name": "{{name}}", + "version": "{{version}}", + "description": "{{{description}}}", + "homepage": "", + "license": "{{license}}", + "author": "{{{author}}}", + "repository": "{{repo}}", + "dependencies": { + "jquery": ">=1.9.0" + }, + "scripts": { + "start": "gulp build && gulp serve", + "watch": "gulp watch", + "test": "./node_modules/karma/bin/karma start --single-run", + "build": "gulp build", + "clean": "gulp clean", + "lint": "gulp lint" + }, + "keywords": [ + "util", + "create-jquery-plugin", + "cli", + "jquery", + "jquery-plugin", + "jquery-plugin-boilerplate", + "gulp", + "example" + ], + "devDependencies": { + "@babel/core": "^7.8.3", + "@babel/preset-env": "^7.8.3", + "autoprefixer": "^9.7.4", + "browser-sync": "^2.26.7", + "del": "^5.1.0", + "gulp": "^4.0.2", + "gulp-babel": "^8.0.0", + "gulp-clean-css": "^4.2.0", + "gulp-cssbeautify": "^2.0.1", + "gulp-jasmine": "^4.0.0", + "gulp-jshint": "^2.1.0", + "gulp-postcss": "^8.0.0", + "gulp-rename": "^2.0.0", + "gulp-sass": "^4.0.2", + "gulp-uglify": "^3.0.2", + "jasmine-core": "^3.5.0", + "jasmine-jquery": "^2.1.1", + "jshint": "^2.11.0", + "karma": "^4.4.1", + "karma-chrome-launcher": "^3.1.0", + "karma-firefox-launcher": "^1.3.0", + "karma-jasmine": "^3.1.0", + "karma-jasmine-jquery": "^0.1.1", + "karma-spec-reporter": "0.0.32", + "node-sass": "^4.13.1", + "uglify-save-license": "^0.4.1" + } +} diff --git a/templates/javascript_sass/src/js/jquery-plugin-boilerplate.js b/templates/javascript_sass/src/js/jquery-plugin-boilerplate.js new file mode 100644 index 0000000..1fbcd8e --- /dev/null +++ b/templates/javascript_sass/src/js/jquery-plugin-boilerplate.js @@ -0,0 +1,91 @@ +/*! + * {{name}} {{version}} + * {{{description}}} + * + * Created by {{{author}}} + * + * @license {{license}} + */ + +(function (factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['jquery'], factory); + } else if (typeof module === 'object' && module.exports) { + // Node/CommonJS + module.exports = function( root, jQuery ) { + if ( jQuery === undefined ) { + // require('jQuery') returns a factory that requires window to + // build a jQuery instance, we normalize how we use modules + // that require this pattern but the window provided is a noop + // if it's defined (how jquery works) + if ( typeof window !== 'undefined' ) { + jQuery = require('jquery'); + } + else { + jQuery = require('jquery')(root); + } + } + factory(jQuery); + return jQuery; + }; + } else { + // Browser globals + factory(jQuery); + } +}(function ($) { + "use strict"; + + // Default Options + var defaults = { + // TODO: ADD YOUR DEFAULT OPTIONS HERE + myStyle: 'my-style1' + }; + + class {{className}} { + + constructor(element, options) { + // Merge user settings with default + this.options = $.extend(true, {}, defaults, options); + // Main container element + this.main = $(element); + + // Initial load + this._init(); + } + + // Initial Method + _init() { + // Plugin init and logic + this.main.addClass(this.options.myStyle); + } + + // TODO: YOU CAN ADD MORE FUNCTIONS FOR YOUR PLUGIN HERE + + } + + // Wrapper for the plugin + $.fn.{{functionName}} = function (options) { + var pluginName = "{{functionName}}"; + + if (options === undefined || typeof options === 'object') { + return this.each(function () { + if (!$.data(this, pluginName)) { + $.data(this, pluginName, new {{className}}(this, options)); + } + }); + } else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') { + let instance = $.data(this[0], pluginName); + + if (options === 'destroy') { + $.data(this, pluginName, null); + } + + if (instance instanceof {{className}} && typeof instance[options] === 'function') { + return instance[options].apply(instance, Array.prototype.slice.call(arguments, 1)); + } else { + return this; + } + } + }; +})); diff --git a/templates/javascript_sass/src/scss/jquery-plugin-boilerplate.scss b/templates/javascript_sass/src/scss/jquery-plugin-boilerplate.scss new file mode 100644 index 0000000..f09c40d --- /dev/null +++ b/templates/javascript_sass/src/scss/jquery-plugin-boilerplate.scss @@ -0,0 +1,20 @@ + /*! + * {{name}} {{version}} + * {{{description}}} + * + * Created by {{{author}}} + * + * @license {{license}} + */ + +.my-style1 { + background-color: green; + color: #fff; + padding: 10px; +} + +.my-style2 { + background-color: red; + color: #000; + padding: 10px; +} diff --git a/templates/javascript_sass/test/test-template.html b/templates/javascript_sass/test/test-template.html new file mode 100644 index 0000000..280f1c0 --- /dev/null +++ b/templates/javascript_sass/test/test-template.html @@ -0,0 +1,11 @@ + + + + {{name}} Test + + + + +
+ + diff --git a/templates/javascript_sass/test/test.js b/templates/javascript_sass/test/test.js new file mode 100644 index 0000000..056ced9 --- /dev/null +++ b/templates/javascript_sass/test/test.js @@ -0,0 +1,41 @@ +describe('Plugin Default Init', function() { + var el, plugin; + + beforeEach(function(){ + jasmine.getFixtures().fixturesPath = 'base/test'; + loadFixtures('test-template.html'); + + el = $('#test-element'); + plugin = el.{{functionName}}(); + }); + + afterEach(function(){ + el.remove(); + el = null; + }); + + it('should add default style to the element', function() { + expect(el).toHaveClass("my-style1"); + }); + +}); + +describe('Plugin with Option Init', function() { + var el, plugin; + + beforeEach(function(){ + el = $('
'); + $(document.body).append(el); + plugin = el.{{functionName}}({ myStyle: 'my-style2'}); + }); + + afterEach(function(){ + el.remove(); + el = null; + }); + + it('should add specified style to the element', function() { + expect(el.hasClass('my-style2')).toBe(true); + expect(el).not.toHaveClass("my-style1"); + }); +}); diff --git a/templates/templates.json b/templates/templates.json new file mode 100644 index 0000000..342b523 --- /dev/null +++ b/templates/templates.json @@ -0,0 +1,12 @@ +{ + "templates": [ + { + "name": "JavaScript with CSS", + "folder": "javascript_css" + }, + { + "name": "JavaScript with Sass", + "folder": "javascript_sass" + } + ] +}