├── .gitattributes ├── .gitignore ├── .gitlab-ci.yml ├── .npmignore ├── .travis.yml ├── CHANGELOG ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── coverage └── bin-utils │ ├── clover.xml │ ├── coverage-final.json │ ├── lcov-report │ ├── base.css │ ├── index.html │ ├── lib │ │ ├── index.html │ │ ├── mkdirp.js.html │ │ ├── ncp.js.html │ │ ├── rimraf.js.html │ │ ├── stat.js.html │ │ └── utils │ │ │ ├── index.html │ │ │ ├── index.js.html │ │ │ ├── promisify.js.html │ │ │ └── syncify.js.html │ ├── prettify.css │ ├── prettify.js │ ├── sort-arrow-sprite.png │ └── sorter.js │ └── lcov.info ├── etc └── modular.sublime-project ├── lerna.json ├── package.json ├── packages ├── bin-utils │ ├── .babelrc │ ├── .eslintrc │ ├── .gitignore │ ├── .npmignore │ ├── CNAME │ ├── LICENSE │ ├── README.md │ ├── bin │ │ └── index.js │ ├── lib │ │ ├── index.js │ │ ├── mkdirp.js │ │ ├── ncp.js │ │ ├── rimraf.js │ │ ├── stat.js │ │ └── utils │ │ │ ├── index.js │ │ │ ├── promisify.js │ │ │ └── syncify.js │ ├── package.json │ ├── packages │ │ ├── __tests__ │ │ │ └── modules.test.js │ │ ├── create-cli-module.json │ │ ├── create-component-module.json │ │ ├── create-css-module.json │ │ ├── create-deploy-module.json │ │ ├── create-express-module.json │ │ ├── create-jest-module.json │ │ ├── create-koa-module.json │ │ ├── create-proxy-module.json │ │ ├── create-react-app.json │ │ ├── create-react-repo.json │ │ ├── create-sass-module.json │ │ └── create-umd-module.json │ ├── scripts │ │ ├── create-cli-module │ │ │ └── init.js │ │ ├── create-component-module │ │ │ └── init.js │ │ ├── create-css-module │ │ │ └── init.js │ │ ├── create-deploy-module │ │ │ └── init.js │ │ ├── create-express-module │ │ │ └── init.js │ │ ├── create-koa-module │ │ │ └── init.js │ │ ├── create-react-repo │ │ │ └── init.js │ │ ├── create-sass-module │ │ │ └── init.js │ │ ├── create-umd-module │ │ │ └── init.js │ │ └── createInit.js │ ├── src │ │ ├── bin │ │ │ └── index.js │ │ ├── lib │ │ │ ├── __tests__ │ │ │ │ ├── mkdirp.test.js │ │ │ │ ├── ncp.test.js │ │ │ │ ├── rimraf.test.js │ │ │ │ └── stat.test.js │ │ │ ├── index.js │ │ │ ├── mkdirp.js │ │ │ ├── ncp.js │ │ │ ├── rimraf.js │ │ │ ├── stat.js │ │ │ └── utils │ │ │ │ ├── __tests__ │ │ │ │ ├── promisify.test.js │ │ │ │ └── syncify.test.js │ │ │ │ ├── index.js │ │ │ │ ├── promisify.js │ │ │ │ └── syncify.js │ │ └── scripts │ │ │ ├── create-cli-module │ │ │ └── init.js │ │ │ ├── create-component-module │ │ │ └── init.js │ │ │ ├── create-css-module │ │ │ └── init.js │ │ │ ├── create-deploy-module │ │ │ └── init.js │ │ │ ├── create-express-module │ │ │ └── init.js │ │ │ ├── create-koa-module │ │ │ └── init.js │ │ │ ├── create-react-repo │ │ │ └── init.js │ │ │ ├── create-sass-module │ │ │ └── init.js │ │ │ ├── create-umd-module │ │ │ └── init.js │ │ │ └── createInit.js │ └── template │ │ ├── create-cli-module │ │ ├── .babelrc │ │ ├── .eslintrc │ │ ├── .travis.yml │ │ ├── README.md │ │ ├── bin.js │ │ ├── gitignore │ │ ├── npmignore │ │ └── src │ │ │ ├── __tests__ │ │ │ └── execute.test.js │ │ │ ├── cli.js │ │ │ └── index.js │ │ ├── create-component-module │ │ ├── .babelrc │ │ ├── .eslintrc │ │ ├── .travis.yml │ │ ├── gitignore │ │ ├── npmignore │ │ ├── src │ │ │ ├── __tests__ │ │ │ │ └── index.test.js │ │ │ └── index.js │ │ └── webpack.config.js │ │ ├── create-css-module │ │ ├── .babelrc │ │ ├── .eslintrc │ │ ├── .travis.yml │ │ ├── README.md │ │ ├── gitignore │ │ ├── npmignore │ │ └── src │ │ │ ├── config.js │ │ │ ├── lib │ │ │ ├── index.js │ │ │ └── styles.css │ │ │ ├── webpack.config.js │ │ │ └── webpack │ │ │ ├── devtool.js │ │ │ ├── entry.js │ │ │ ├── externals.js │ │ │ ├── make.js │ │ │ ├── module │ │ │ ├── index.js │ │ │ ├── loaders.js │ │ │ ├── noParse.js │ │ │ └── postLoaders.js │ │ │ ├── node.js │ │ │ ├── output.js │ │ │ ├── plugins.js │ │ │ ├── postcss.js │ │ │ ├── resolve │ │ │ ├── alias.js │ │ │ └── index.js │ │ │ ├── resolveLoader.js │ │ │ └── target.js │ │ ├── create-deploy-module │ │ ├── .babelrc │ │ ├── .eslintrc │ │ ├── .travis.yml │ │ ├── README.md │ │ ├── bin.js │ │ ├── gitignore │ │ ├── npmignore │ │ └── src │ │ │ ├── __tests__ │ │ │ └── execute.test.js │ │ │ ├── cli.js │ │ │ └── index.js │ │ ├── create-express-module │ │ ├── .babelrc │ │ ├── .eslintrc │ │ ├── .travis.yml │ │ ├── README.md │ │ ├── bin.js │ │ ├── gitignore │ │ ├── npmignore │ │ └── src │ │ │ ├── __tests__ │ │ │ └── execute.test.js │ │ │ ├── cli.js │ │ │ └── index.js │ │ ├── create-jest-module │ │ ├── .babelrc │ │ ├── .eslintrc │ │ ├── .travis.yml │ │ ├── README.md │ │ ├── __tests__ │ │ │ └── index.js │ │ ├── gitignore │ │ └── npmignore │ │ ├── create-koa-module │ │ ├── .babelrc │ │ ├── .eslintrc │ │ ├── .travis.yml │ │ ├── README.md │ │ ├── bin.js │ │ ├── gitignore │ │ ├── npmignore │ │ └── src │ │ │ ├── __tests__ │ │ │ └── execute.test.js │ │ │ ├── cli.js │ │ │ └── index.js │ │ ├── create-proxy-module │ │ ├── .babelrc │ │ ├── .eslintrc │ │ ├── .travis.yml │ │ ├── README.md │ │ ├── bin.js │ │ ├── gitignore │ │ ├── npmignore │ │ └── src │ │ │ ├── __tests__ │ │ │ └── execute.test.js │ │ │ ├── cli.js │ │ │ └── index.js │ │ ├── create-react-repo │ │ ├── .travis.yml │ │ ├── CHANGELOG │ │ ├── CONTRIBUTING.md │ │ ├── README.md │ │ ├── gitignore │ │ └── lerna.json │ │ ├── create-sass-module │ │ ├── .babelrc │ │ ├── .eslintrc │ │ ├── .travis.yml │ │ ├── README.md │ │ ├── gitignore │ │ ├── npmignore │ │ └── src │ │ │ ├── config.js │ │ │ ├── lib │ │ │ ├── index.js │ │ │ └── styles.css │ │ │ ├── webpack.config.js │ │ │ └── webpack │ │ │ ├── devtool.js │ │ │ ├── entry.js │ │ │ ├── externals.js │ │ │ ├── make.js │ │ │ ├── module │ │ │ ├── index.js │ │ │ ├── loaders.js │ │ │ ├── noParse.js │ │ │ └── postLoaders.js │ │ │ ├── node.js │ │ │ ├── output.js │ │ │ ├── plugins.js │ │ │ ├── postcss.js │ │ │ ├── resolve │ │ │ ├── alias.js │ │ │ └── index.js │ │ │ ├── resolveLoader.js │ │ │ └── target.js │ │ └── create-umd-module │ │ ├── .babelrc │ │ ├── .eslintrc │ │ ├── .travis.yml │ │ ├── gitignore │ │ ├── npmignore │ │ ├── rollup.config.js │ │ └── src │ │ ├── __tests__ │ │ └── index.test.js │ │ └── index.js ├── create-cli-module │ ├── README.md │ ├── bin.js │ ├── index.js │ └── package.json ├── create-component-module │ ├── README.md │ ├── bin.js │ ├── index.js │ └── package.json ├── create-css-module │ ├── README.md │ ├── bin.js │ ├── index.js │ └── package.json ├── create-deploy-module │ ├── README.md │ ├── bin.js │ ├── index.js │ └── package.json ├── create-express-module │ ├── README.md │ ├── bin.js │ ├── index.js │ └── package.json ├── create-jest-module │ ├── README.md │ ├── bin.js │ ├── index.js │ └── package.json ├── create-koa-module │ ├── README.md │ ├── bin.js │ ├── index.js │ └── package.json ├── create-package │ ├── .babelrc │ ├── .eslintrc │ ├── README.md │ ├── lib │ │ └── index.js │ ├── package.json │ └── src │ │ └── lib │ │ └── index.js ├── create-proxy-module │ ├── README.md │ ├── bin.js │ ├── index.js │ └── package.json ├── create-react-repo │ ├── README.md │ ├── index.js │ └── package.json ├── create-sass-module │ ├── README.md │ ├── bin.js │ ├── index.js │ └── package.json ├── create-umd-module │ ├── README.md │ ├── bin.js │ ├── index.js │ └── package.json ├── cross │ ├── .babelrc │ ├── .eslintrc │ ├── .gitignore │ ├── .npmignore │ ├── .travis.yml │ ├── README.md │ ├── __mocks__ │ │ └── cross-spawn.js │ ├── bin.js │ ├── package.json │ ├── src │ │ ├── cli.js │ │ └── index.js │ └── yarn.lock ├── dos2unix │ ├── .gitattributes │ ├── .gitignore │ ├── .jshintrc │ ├── .npmignore │ ├── .travis.yml │ ├── Gruntfile.js │ ├── LICENSE-MIT │ ├── README.md │ ├── index.js │ ├── lib │ │ ├── dos2unix.js │ │ └── util │ │ │ ├── encoding.js │ │ │ ├── glob.js │ │ │ └── validate.js │ ├── package.json │ ├── test │ │ ├── dos2unix_test.js │ │ ├── expected │ │ │ └── dos2unix │ │ │ │ ├── binary.swf │ │ │ │ ├── dos.sh │ │ │ │ └── unix.sh │ │ ├── fixtures │ │ │ ├── dos2unix │ │ │ │ ├── binary.swf │ │ │ │ ├── dos.sh │ │ │ │ └── unix.sh │ │ │ └── util │ │ │ │ └── encoding │ │ │ │ └── bom │ │ │ │ ├── ascii.txt │ │ │ │ ├── utf16be.txt │ │ │ │ ├── utf16le.txt │ │ │ │ ├── utf32be.txt │ │ │ │ ├── utf32le.txt │ │ │ │ ├── utf8-noBom.txt │ │ │ │ └── utf8.txt │ │ └── util │ │ │ └── encoding_test.js │ └── yarn.lock ├── install │ ├── .babelrc │ ├── .eslintrc │ ├── .gitignore │ ├── .npmignore │ ├── .travis.yml │ ├── README.md │ ├── bin.js │ ├── lib │ │ ├── cli.js │ │ ├── index.js │ │ └── utils │ │ │ └── shouldUseYarn.js │ ├── package.json │ └── src │ │ ├── cli.js │ │ ├── index.js │ │ └── utils │ │ ├── __tests__ │ │ ├── shouldUseYarn-dne.test.js │ │ └── shouldUseYarn.test.js │ │ └── shouldUseYarn.js ├── modular-test │ ├── .babelrc │ ├── .eslintrc │ ├── .gitignore │ ├── .npmignore │ ├── .travis.yml │ ├── README.md │ ├── __tests__ │ │ └── create-css-module.js │ └── package.json └── which │ ├── .babelrc │ ├── .eslintrc │ ├── .gitignore │ ├── .npmignore │ ├── .travis.yml │ ├── README.md │ ├── __mocks__ │ └── cross-spawn.js │ ├── bin.js │ ├── lib │ ├── cli.js │ ├── index.js │ └── streams │ │ └── FirstLineTransform.js │ ├── package.json │ └── src │ ├── __tests__ │ └── which.test.js │ ├── cli.js │ ├── index.js │ └── streams │ └── FirstLineTransform.js ├── public ├── png │ └── modular.png └── psd │ └── modular.psd └── yarn.lock /.gitattributes: -------------------------------------------------------------------------------- 1 | # Set the default behavior, in case people don't have core.autocrlf set. 2 | * text=auto 3 | *.psd filter=lfs diff=lfs merge=lfs -text 4 | *.ai filter=lfs diff=lfs merge=lfs -text 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # dependencies 2 | node_modules/ 3 | 4 | # testing 5 | coverage/ 6 | 7 | # production 8 | build/ 9 | staging/ 10 | 11 | # misc 12 | .DS_Store 13 | .env 14 | *.log 15 | *.log.* 16 | *.sublime-workspace 17 | *.suo 18 | *.user 19 | *.userosscache 20 | *.sln.docstates 21 | .*.swp 22 | .vscode/ 23 | -------------------------------------------------------------------------------- /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | # This file is a template, and might need editing before it works on your project. 2 | # Official framework image. Look for the different tagged releases at: 3 | # https://hub.docker.com/r/library/node/tags/ 4 | image: node:latest 5 | 6 | # Pick zero or more services to be used on all builds. 7 | # Only needed when using a docker container to run your tests in. 8 | # Check out: http://docs.gitlab.com/ce/ci/docker/using_docker_images.html#what-is-service 9 | services: 10 | - mysql:latest 11 | - redis:latest 12 | - postgres:latest 13 | 14 | # This folder is cached between builds 15 | # http://docs.gitlab.com/ce/ci/yaml/README.html#cache 16 | cache: 17 | paths: 18 | - node_modules/ 19 | 20 | test_async: 21 | script: 22 | - npm install 23 | - npm test -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | /packages/ 2 | /staging/ 3 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "7" 4 | - "6" 5 | - "5" 6 | cache: 7 | directories: 8 | - node_modules 9 | - $HOME/.yarn-cache 10 | before_install: 11 | # Repo for newer Node.js versions 12 | - curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - 13 | # Repo for Yarn 14 | - sudo apt-key adv --keyserver pgp.mit.edu --recv D101F7899D41F3C3 15 | - echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list 16 | - sudo apt-get update -qq 17 | - sudo apt-get install -y -qq yarn 18 | install: 19 | - yarn global add lerna@prerelease 20 | - yarn global add codecov@latest 21 | script: 22 | - lerna exec --concurrency=1 -- yarn 23 | - npm run coverage 24 | - codecov 25 | after_success: 26 | - bash <(curl -s https://codecov.io/bash) 27 | -------------------------------------------------------------------------------- /CHANGELOG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noderaider/modular/9abe14fbf1593ae09f6c1ee1f00b91ea15aaa942/CHANGELOG -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noderaider/modular/9abe14fbf1593ae09f6c1ee1f00b91ea15aaa942/CONTRIBUTING.md -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD License 2 | 3 | For create-react-app software 4 | 5 | Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 10 | * Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | 13 | * Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | 17 | * Neither the name Facebook nor the names of its contributors may be used to 18 | endorse or promote products derived from this software without specific 19 | prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 22 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 23 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 25 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 27 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 28 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | 33 | NOTE: noderaider/modular is not affiliated with create-react-app or Facebook 34 | but its architecture is heavily influenced and in some places pulled from 35 | create-react-app. 36 | -------------------------------------------------------------------------------- /coverage/bin-utils/lcov-report/prettify.css: -------------------------------------------------------------------------------- 1 | .pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} 2 | -------------------------------------------------------------------------------- /coverage/bin-utils/lcov-report/sort-arrow-sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noderaider/modular/9abe14fbf1593ae09f6c1ee1f00b91ea15aaa942/coverage/bin-utils/lcov-report/sort-arrow-sprite.png -------------------------------------------------------------------------------- /coverage/bin-utils/lcov.info: -------------------------------------------------------------------------------- 1 | TN: 2 | SF:C:\Users\cchamberlain\noderaider\modular\packages\bin-utils\src\lib\mkdirp.js 3 | FNF:0 4 | FNH:0 5 | LF:0 6 | LH:0 7 | BRF:0 8 | BRH:0 9 | end_of_record 10 | TN: 11 | SF:C:\Users\cchamberlain\noderaider\modular\packages\bin-utils\src\lib\ncp.js 12 | FNF:0 13 | FNH:0 14 | LF:0 15 | LH:0 16 | BRF:0 17 | BRH:0 18 | end_of_record 19 | TN: 20 | SF:C:\Users\cchamberlain\noderaider\modular\packages\bin-utils\src\lib\rimraf.js 21 | FNF:0 22 | FNH:0 23 | LF:0 24 | LH:0 25 | BRF:0 26 | BRH:0 27 | end_of_record 28 | TN: 29 | SF:C:\Users\cchamberlain\noderaider\modular\packages\bin-utils\src\lib\stat.js 30 | FNF:0 31 | FNH:0 32 | LF:0 33 | LH:0 34 | BRF:0 35 | BRH:0 36 | end_of_record 37 | TN: 38 | SF:C:\Users\cchamberlain\noderaider\modular\packages\bin-utils\src\lib\utils\index.js 39 | FNF:0 40 | FNH:0 41 | LF:0 42 | LH:0 43 | BRF:0 44 | BRH:0 45 | end_of_record 46 | TN: 47 | SF:C:\Users\cchamberlain\noderaider\modular\packages\bin-utils\src\lib\utils\promisify.js 48 | FN:1,promisify 49 | FN:2,(anonymous_1) 50 | FN:2,(anonymous_2) 51 | FN:4,(anonymous_3) 52 | FN:14,promiseWrap 53 | FNF:5 54 | FNH:4 55 | FNDA:6,promisify 56 | FNDA:1,(anonymous_1) 57 | FNDA:1,(anonymous_2) 58 | FNDA:0,(anonymous_3) 59 | FNDA:2,promiseWrap 60 | DA:2,6 61 | DA:3,1 62 | DA:4,1 63 | DA:5,0 64 | DA:6,0 65 | DA:8,0 66 | DA:11,0 67 | DA:14,6 68 | DA:15,2 69 | LF:9 70 | LH:5 71 | BRDA:5,0,0,0 72 | BRDA:5,0,1,0 73 | BRDA:16,1,0,1 74 | BRDA:16,1,1,1 75 | BRF:4 76 | BRH:2 77 | end_of_record 78 | TN: 79 | SF:C:\Users\cchamberlain\noderaider\modular\packages\bin-utils\src\lib\utils\syncify.js 80 | FN:1,syncify 81 | FNF:1 82 | FNH:1 83 | FNDA:6,syncify 84 | DA:2,6 85 | DA:3,1 86 | DA:4,5 87 | DA:5,1 88 | DA:6,4 89 | LF:5 90 | LH:5 91 | BRDA:2,0,0,1 92 | BRDA:2,0,1,5 93 | BRDA:4,1,0,1 94 | BRDA:4,1,1,4 95 | BRF:4 96 | BRH:4 97 | end_of_record 98 | -------------------------------------------------------------------------------- /etc/modular.sublime-project: -------------------------------------------------------------------------------- 1 | { 2 | "folders": 3 | [ 4 | { 5 | "name": "modular", 6 | "path": "../", 7 | "folder_exclude_patterns": ["node_modules"] 8 | } 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "lerna": "2.0.0-beta.30", 3 | "version": "0.15.0" 4 | } 5 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@raider/modular", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "lerna run --scope *-app start", 7 | "start-dev": "lerna exec --ignore *-app -- npm start", 8 | "test": "lerna run test", 9 | "coverage": "lerna run coverage" 10 | }, 11 | "devDependencies": { 12 | "babel-plugin-transform-runtime": "^6.15.0", 13 | "babel-preset-latest": "^6.16.0", 14 | "babel-preset-react": "^6.16.0", 15 | "babel-preset-stage-2": "^6.18.0", 16 | "lerna": "2.0.0-beta.30", 17 | "sinon": "^1.17.6" 18 | }, 19 | "repository": "noderaider/modular", 20 | "license": "BSD-3-Clause" 21 | } 22 | -------------------------------------------------------------------------------- /packages/bin-utils/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["latest", "stage-2"], 3 | "plugins": ["transform-runtime"] 4 | } 5 | -------------------------------------------------------------------------------- /packages/bin-utils/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "babel-eslint", 3 | "plugins": ["babel", "react", "flowtype"], 4 | "parserOptions": { 5 | "ecmaVersion": 2017, 6 | "sourceType": "module", 7 | "ecmaFeatures": { 8 | "jsx": true, 9 | "modules": true, 10 | "blockBindings": true, 11 | "defaultParams": true, 12 | "forOf": true, 13 | "generators": true, 14 | "objectLiteralComputedProperties": true, 15 | "objectLiteralDuplicateProperties": false, 16 | "objectLiteralShorthandMethods": true, 17 | "objectLiteralShorthandProperties": true, 18 | "templateStrings": true, 19 | "experimentalObjectRestSpread": true 20 | } 21 | }, 22 | "rules": { 23 | "quotes": [2, "single"], 24 | "strict": [2, "never"], 25 | "semi": [2, "never"], 26 | "brace-style": [2, "1tbs", { 27 | "allowSingleLine": true 28 | }], 29 | "comma-style": ["error", "first"], 30 | "comma-dangle": [2, "never"], 31 | "no-dupe-keys": 2, 32 | "no-ex-assign": 2, 33 | "no-extra-semi": 2, 34 | "valid-typeof": 2, 35 | "no-template-curly-in-string": "error", 36 | "symbol-description": "error", 37 | "class-methods-use-this": "error", 38 | "prefer-arrow-callback": ["error", {"allowNamedFunctions": true}], 39 | 40 | "babel/generator-star-spacing": 1, 41 | "babel/object-shorthand": 1, 42 | "babel/arrow-parens": 1, 43 | "babel/no-await-in-loop": 1, 44 | "babel/flow-object-type": [ "error", "comma" ], 45 | "babel/func-params-comma-dangle": 1, 46 | 47 | "react/jsx-uses-react": 2, 48 | "react/jsx-uses-vars": 2, 49 | "react/react-in-jsx-scope": 2, 50 | 51 | "flowtype/define-flow-type": 1, 52 | "flowtype/require-parameter-type": 1, 53 | "flowtype/require-return-type": [ 54 | 1, 55 | "always", 56 | { 57 | "annotateUndefined": "never" 58 | } 59 | ], 60 | "flowtype/space-after-type-colon": [ 61 | 1, 62 | "always" 63 | ], 64 | "flowtype/space-before-type-colon": [ 65 | 1, 66 | "never" 67 | ], 68 | "flowtype/type-id-match": [ 69 | 1, 70 | "^([A-Z]{1,3}[a-z0-9]+)+Type$" 71 | ], 72 | "flowtype/use-flow-type": 1, 73 | "flowtype/valid-syntax": 1 74 | }, 75 | "settings": { 76 | "flowtype": { 77 | "onlyFilesWithFlowAnnotation": true 78 | } 79 | }, 80 | "env": { 81 | "es6": true, 82 | "browser": true, 83 | "node": true 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /packages/bin-utils/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | *.lock 6 | 7 | # Runtime data 8 | pids 9 | *.pid 10 | *.seed 11 | 12 | # Directory for instrumented libs generated by jscoverage/JSCover 13 | lib-cov 14 | 15 | # Coverage directory used by tools like istanbul 16 | coverage 17 | 18 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 19 | .grunt 20 | 21 | # node-waf configuration 22 | .lock-wscript 23 | 24 | # Compiled binary addons (http://nodejs.org/api/addons.html) 25 | build/Release 26 | 27 | # Dependency directory 28 | node_modules 29 | 30 | # Optional npm cache directory 31 | .npm 32 | 33 | # Optional REPL history 34 | .node_repl_history 35 | -------------------------------------------------------------------------------- /packages/bin-utils/.npmignore: -------------------------------------------------------------------------------- 1 | # Source files 2 | /src/ 3 | 4 | .gitattributes 5 | 6 | .idea/ 7 | .vscode/ 8 | *.sublime-project 9 | *.sublime-workspace 10 | *.suo 11 | *.user 12 | 13 | *.7z 14 | *.zip 15 | *.rar 16 | *.psd 17 | -------------------------------------------------------------------------------- /packages/bin-utils/CNAME: -------------------------------------------------------------------------------- 1 | noderaider.js.org 2 | -------------------------------------------------------------------------------- /packages/bin-utils/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Cole Chamberlain 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/bin-utils/README.md: -------------------------------------------------------------------------------- 1 | # bin-utils 2 | 3 | **Collection of promisified bin utilities for creating cli components.** 4 | 5 | [![NPM](https://nodei.co/npm/bin-utils.png?stars=true&downloads=true)](https://nodei.co/npm/bin-utils/) 6 | 7 | ## Install 8 | 9 | `npm i -S bin-utils` 10 | 11 | ## In active development, review the unit tests until documentation is added. 12 | -------------------------------------------------------------------------------- /packages/bin-utils/bin/index.js: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env node 2 | 'use strict'; 3 | 4 | console.info('bin-utils: CLI COMMAND HERE'); -------------------------------------------------------------------------------- /packages/bin-utils/lib/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _mkdirp = require('./mkdirp'); 8 | 9 | Object.defineProperty(exports, 'mkdirp', { 10 | enumerable: true, 11 | get: function get() { 12 | return _interopRequireDefault(_mkdirp).default; 13 | } 14 | }); 15 | 16 | var _ncp = require('./ncp'); 17 | 18 | Object.defineProperty(exports, 'ncp', { 19 | enumerable: true, 20 | get: function get() { 21 | return _interopRequireDefault(_ncp).default; 22 | } 23 | }); 24 | 25 | var _rimraf = require('./rimraf'); 26 | 27 | Object.defineProperty(exports, 'rimraf', { 28 | enumerable: true, 29 | get: function get() { 30 | return _interopRequireDefault(_rimraf).default; 31 | } 32 | }); 33 | 34 | var _stat = require('./stat'); 35 | 36 | Object.defineProperty(exports, 'stat', { 37 | enumerable: true, 38 | get: function get() { 39 | return _interopRequireDefault(_stat).default; 40 | } 41 | }); 42 | 43 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -------------------------------------------------------------------------------- /packages/bin-utils/lib/mkdirp.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _mkdirp = require('mkdirp'); 8 | 9 | var _mkdirp2 = _interopRequireDefault(_mkdirp); 10 | 11 | var _utils = require('./utils'); 12 | 13 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 14 | 15 | exports.default = (0, _utils.syncify)((0, _utils.promisify)(_mkdirp2.default), _mkdirp2.default.sync); -------------------------------------------------------------------------------- /packages/bin-utils/lib/ncp.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _ncp = require('ncp'); 8 | 9 | var _ncp2 = _interopRequireDefault(_ncp); 10 | 11 | var _utils = require('./utils'); 12 | 13 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 14 | 15 | exports.default = (0, _utils.promisify)(_ncp2.default); -------------------------------------------------------------------------------- /packages/bin-utils/lib/rimraf.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _rimraf = require('rimraf'); 8 | 9 | var _rimraf2 = _interopRequireDefault(_rimraf); 10 | 11 | var _utils = require('./utils'); 12 | 13 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 14 | 15 | exports.default = (0, _utils.syncify)((0, _utils.promisify)(_rimraf2.default), _rimraf2.default.sync); -------------------------------------------------------------------------------- /packages/bin-utils/lib/stat.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _gracefulFs = require('graceful-fs'); 8 | 9 | var _gracefulFs2 = _interopRequireDefault(_gracefulFs); 10 | 11 | var _utils = require('./utils'); 12 | 13 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 14 | 15 | exports.default = (0, _utils.syncify)((0, _utils.promisify)(_gracefulFs2.default.stat), _gracefulFs2.default.statSync); -------------------------------------------------------------------------------- /packages/bin-utils/lib/utils/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _promisify = require('./promisify'); 8 | 9 | Object.defineProperty(exports, 'promisify', { 10 | enumerable: true, 11 | get: function get() { 12 | return _interopRequireDefault(_promisify).default; 13 | } 14 | }); 15 | 16 | var _syncify = require('./syncify'); 17 | 18 | Object.defineProperty(exports, 'syncify', { 19 | enumerable: true, 20 | get: function get() { 21 | return _interopRequireDefault(_syncify).default; 22 | } 23 | }); 24 | 25 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -------------------------------------------------------------------------------- /packages/bin-utils/lib/utils/promisify.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _promise = require('babel-runtime/core-js/promise'); 8 | 9 | var _promise2 = _interopRequireDefault(_promise); 10 | 11 | exports.default = promisify; 12 | 13 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 14 | 15 | function promisify(fn) { 16 | var promisified = function promisified() { 17 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { 18 | args[_key] = arguments[_key]; 19 | } 20 | 21 | return new _promise2.default(function (resolve, reject) { 22 | try { 23 | fn.apply(undefined, args.concat([function () { 24 | if ((arguments.length <= 0 ? undefined : arguments[0]) instanceof Error) reject(arguments.length <= 0 ? undefined : arguments[0]);else resolve.apply(undefined, arguments); 25 | }])); 26 | } catch (err) { 27 | reject(err); 28 | } 29 | }); 30 | }; 31 | return function promiseWrap() { 32 | var _ref; 33 | 34 | return typeof (_ref = arguments.length - 1, arguments.length <= _ref ? undefined : arguments[_ref]) === 'function' ? fn.apply(undefined, arguments) : promisified.apply(undefined, arguments); 35 | }; 36 | } -------------------------------------------------------------------------------- /packages/bin-utils/lib/utils/syncify.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.default = syncify; 7 | function syncify(fn, sync) { 8 | if (typeof fn !== 'function') throw new Error('syncify expects a function argument'); 9 | if (typeof sync !== 'function') throw new Error('sync function must be a function'); 10 | return Object.defineProperty(fn, 'sync', { value: sync, configurable: false, enumerable: true }); 11 | } -------------------------------------------------------------------------------- /packages/bin-utils/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bin-utils", 3 | "version": "0.15.0", 4 | "description": "Collection of promisified bin utilities for creating cli components.", 5 | "main": "lib/index.js", 6 | "files": [ 7 | ".babelrc", 8 | "bin", 9 | "lib", 10 | "scripts", 11 | "packages", 12 | "template", 13 | "README.md" 14 | ], 15 | "keywords": [ 16 | "modular", 17 | "modules", 18 | "packages", 19 | "rimraf", 20 | "mkdirp", 21 | "ncp" 22 | ], 23 | "jest": { 24 | "moduleFileExtensions": [ 25 | "js" 26 | ], 27 | "moduleDirectories": [ 28 | "node_modules" 29 | ], 30 | "testPathIgnorePatterns": [ 31 | "/node_modules/", 32 | "/template/" 33 | ], 34 | "coveragePathIgnorePatterns": [ 35 | "/node_modules/", 36 | "/template/" 37 | ], 38 | "coverageDirectory": "../../coverage/bin-utils" 39 | }, 40 | "scripts": { 41 | "start": "npm run build -- --watch", 42 | "prebuild": "rimraf lib", 43 | "build": "babel src -d . --ignore __tests__,__mocks__", 44 | "test": "jest", 45 | "coverage": "jest --coverage", 46 | "preversion": "run-s test build" 47 | }, 48 | "dependencies": { 49 | "@raider/install": "latest", 50 | "@raider/which": "latest", 51 | "babel-cli": "latest", 52 | "babel-preset-latest": "latest", 53 | "babel-preset-stage-2": "latest", 54 | "babel-plugin-transform-runtime": "latest", 55 | "babel-runtime": "latest", 56 | "bluebird": "latest", 57 | "bunyan": "latest", 58 | "fs-extra": "latest", 59 | "graceful-fs": "latest", 60 | "isomorphic-fetch": "latest", 61 | "jest": "latest", 62 | "jest-cli": "latest", 63 | "lerna": "prerelease", 64 | "mkdirp": "latest", 65 | "ncp": "latest", 66 | "npm-run-all": "latest", 67 | "rimraf": "latest", 68 | "signal-exit": "latest", 69 | "simple-git": "latest", 70 | "yargs": "latest" 71 | }, 72 | "author": "Cole Chamberlain (https://github.com/cchamberlain)", 73 | "bugs": { 74 | "url": "https://github.com/noderaider/modular/issues" 75 | }, 76 | "homepage": "https://noderaider.js.org/bin-utils", 77 | "license": "MIT", 78 | "repository": { 79 | "type": "git", 80 | "url": "git+https://github.com/noderaider/modular.git" 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /packages/bin-utils/packages/__tests__/modules.test.js: -------------------------------------------------------------------------------- 1 | import path from 'path' 2 | import fs from 'fs' 3 | 4 | const packageNames = fs.readdirSync(path.resolve(__dirname, '..')).filter((x) => x !== '__tests__').map((x) => path.join('..', path.basename(x))) 5 | 6 | describe('packages', () => { 7 | for(let packageName of packageNames) { 8 | describe(packageName, () => { 9 | it('can be imported', () => { 10 | expect(typeof require(packageName)).toBe('object') 11 | }) 12 | }) 13 | } 14 | }) 15 | -------------------------------------------------------------------------------- /packages/bin-utils/packages/create-cli-module.json: -------------------------------------------------------------------------------- 1 | { 2 | "bin": "bin.js", 3 | "main": "lib/index.js", 4 | "files": [ 5 | "bin.js", 6 | "lib" 7 | ], 8 | "scripts": { 9 | "start": "npm run build -- --watch", 10 | "prebuild": "rimraf lib", 11 | "build": "babel src -d lib --ignore __tests__,__mocks__", 12 | "test": "jest", 13 | "preversion": "run-s test build" 14 | }, 15 | "dependencies": { 16 | "@raider/which": "latest", 17 | "@raider/install": "latest", 18 | "babel-runtime": "latest", 19 | "bin-utils": "latest", 20 | "fs-extra": "latest", 21 | "ncp": "latest", 22 | "rimraf": "latest" 23 | }, 24 | "devDependencies": { 25 | "babel-cli": "latest", 26 | "babel-core": "latest", 27 | "babel-eslint": "latest", 28 | "babel-loader": "latest", 29 | "babel-plugin-transform-runtime": "latest", 30 | "babel-preset-latest": "latest", 31 | "babel-preset-stage-2": "latest", 32 | "eslint": "latest", 33 | "eslint-plugin-babel": "latest", 34 | "eslint-plugin-react": "latest", 35 | "npm-run-all": "latest", 36 | "rewire": "latest" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /packages/bin-utils/packages/create-component-module.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "lib/index.js", 3 | "files": [ 4 | "lib", 5 | "dist" 6 | ], 7 | "scripts": { 8 | "start": "npm run build -- --watch", 9 | "prebuild": "rimraf lib dist", 10 | "build:dist": "webpack", 11 | "build": "babel src -d lib --ignore __tests__,__mocks__", 12 | "preversion": "npm run build && npm run build:dist" 13 | }, 14 | "dependencies": { 15 | "classnames": "^2.2.5", 16 | "babel-runtime": "latest" 17 | }, 18 | "devDependencies": { 19 | "babel-cli": "latest", 20 | "babel-core": "^6.18.0", 21 | "babel-eslint": "latest", 22 | "babel-loader": "^6.2.7", 23 | "babel-plugin-transform-runtime": "latest", 24 | "babel-polyfill": "latest", 25 | "babel-preset-latest": "^6.16.0", 26 | "babel-preset-react": "^6.16.0", 27 | "babel-preset-stage-2": "^6.16.0", 28 | "bin-utils": "latest", 29 | "eslint": "latest", 30 | "eslint-plugin-babel": "latest", 31 | "eslint-plugin-react": "latest", 32 | "ncp": "latest", 33 | "npm-run-all": "latest", 34 | "rimraf": "latest", 35 | "webpack": "^2.1.0-beta.25" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /packages/bin-utils/packages/create-css-module.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "lib/index.js", 3 | "scripts": { 4 | "start": "npm run copy && npm run webpack -- --watch", 5 | "prewebpack": "rimraf webpack webpack.config.js config.js && babel src/webpack -d webpack && babel src/webpack.config.js -o webpack.config.js && babel src/config.js -o config.js", 6 | "webpack": "webpack --config webpack.config.js --progress --profile --colors", 7 | "copy": "rimraf lib && ncp src/lib lib && rimraf lib/index.js", 8 | "build": "npm run copy && npm run webpack", 9 | "preversion": "npm run build" 10 | }, 11 | "dependencies": { 12 | "chai": "latest", 13 | "json-loader": "^0.5.4", 14 | "ncp": "latest", 15 | "universal-style-loader": "^0.16.1", 16 | "universal-styles": "^0.16.1" 17 | }, 18 | "devDependencies": { 19 | "bin-utils": "latest", 20 | "babel-cli": "latest", 21 | "babel-core": "latest", 22 | "babel-eslint": "latest", 23 | "babel-loader": "latest", 24 | "babel-plugin-transform-runtime": "latest", 25 | "babel-polyfill": "latest", 26 | "babel-preset-latest": "latest", 27 | "babel-preset-stage-2": "latest", 28 | "css-loader": "latest", 29 | "eslint": "latest", 30 | "eslint-plugin-babel": "latest", 31 | "eslint-plugin-react": "latest", 32 | "file-loader": "latest", 33 | "postcss": "latest", 34 | "postcss-browser-reporter": "latest", 35 | "postcss-cssnext": "latest", 36 | "postcss-font-magician": "^1.4.0", 37 | "postcss-import": "latest", 38 | "postcss-js": "latest", 39 | "postcss-loader": "latest", 40 | "postcss-modules": "latest", 41 | "postcss-reporter": "latest", 42 | "postcss-url": "latest", 43 | "precss": "latest", 44 | "rimraf": "latest", 45 | "style-loader": "latest", 46 | "url-loader": "latest", 47 | "webpack": "latest" 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /packages/bin-utils/packages/create-deploy-module.json: -------------------------------------------------------------------------------- 1 | { 2 | "bin": "bin.js", 3 | "main": "lib/index.js", 4 | "files": [ 5 | "src", 6 | "lib" 7 | ], 8 | "scripts": { 9 | "start": "npm run build -- --watch", 10 | "prebuild": "rimraf lib", 11 | "build": "babel src -d lib --ignore __tests__,__mocks__", 12 | "test": "jest", 13 | "preversion": "run-s test build" 14 | }, 15 | "dependencies": { 16 | "express": "latest", 17 | "babel-runtime": "latest" 18 | }, 19 | "devDependencies": { 20 | "bin-utils": "latest", 21 | "babel-cli": "latest", 22 | "babel-core": "latest", 23 | "babel-eslint": "latest", 24 | "babel-loader": "latest", 25 | "babel-plugin-transform-runtime": "latest", 26 | "babel-preset-latest": "latest", 27 | "babel-preset-stage-2": "latest", 28 | "eslint": "latest", 29 | "eslint-plugin-babel": "latest", 30 | "eslint-plugin-react": "latest", 31 | "ncp": "latest", 32 | "npm-run-all": "latest", 33 | "rewire": "latest", 34 | "rimraf": "latest" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /packages/bin-utils/packages/create-express-module.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "lib/index.js", 3 | "files": [ 4 | "src", 5 | "lib" 6 | ], 7 | "scripts": { 8 | "start": "npm run build -- --watch", 9 | "prebuild": "rimraf lib", 10 | "build": "babel src -d lib --ignore __tests__,__mocks__", 11 | "test": "jest", 12 | "preversion": "run-s test build" 13 | }, 14 | "dependencies": { 15 | "express": "latest", 16 | "babel-runtime": "latest" 17 | }, 18 | "devDependencies": { 19 | "bin-utils": "latest", 20 | "babel-cli": "latest", 21 | "babel-core": "latest", 22 | "babel-eslint": "latest", 23 | "babel-loader": "latest", 24 | "babel-plugin-transform-runtime": "latest", 25 | "babel-preset-latest": "latest", 26 | "babel-preset-stage-2": "latest", 27 | "eslint": "latest", 28 | "eslint-plugin-babel": "latest", 29 | "eslint-plugin-react": "latest", 30 | "ncp": "latest", 31 | "npm-run-all": "latest", 32 | "rewire": "latest", 33 | "rimraf": "latest" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /packages/bin-utils/packages/create-jest-module.json: -------------------------------------------------------------------------------- 1 | { 2 | "files": [ 3 | "__tests__", 4 | "__mocks__" 5 | ], 6 | "scripts": { 7 | "start": "jest --watch", 8 | "test": "jest" 9 | }, 10 | "dependencies": { 11 | "jest": "latest", 12 | "rewire": "latest", 13 | "bin-utils": "latest", 14 | "fs-extra": "latest", 15 | "ncp": "latest", 16 | "react": "latest", 17 | "react-dom": "latest", 18 | "rimraf": "latest" 19 | }, 20 | "devDependencies": { 21 | "eslint": "latest", 22 | "eslint-plugin-babel": "latest", 23 | "eslint-plugin-react": "latest", 24 | "npm-run-all": "latest" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /packages/bin-utils/packages/create-koa-module.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "lib/index.js", 3 | "files": [ 4 | "src", 5 | "lib" 6 | ], 7 | "scripts": { 8 | "start": "npm run build -- --watch", 9 | "prebuild": "rimraf lib", 10 | "build": "babel src -d lib --ignore __tests__,__mocks__", 11 | "test": "jest", 12 | "preversion": "run-s test build" 13 | }, 14 | "dependencies": { 15 | "koa": "next", 16 | "babel-runtime": "latest" 17 | }, 18 | "devDependencies": { 19 | "bin-utils": "latest", 20 | "babel-cli": "latest", 21 | "babel-core": "latest", 22 | "babel-eslint": "latest", 23 | "babel-loader": "latest", 24 | "babel-plugin-transform-runtime": "latest", 25 | "babel-preset-latest": "latest", 26 | "babel-preset-stage-2": "latest", 27 | "eslint": "latest", 28 | "eslint-plugin-babel": "latest", 29 | "eslint-plugin-react": "latest", 30 | "ncp": "latest", 31 | "npm-run-all": "latest", 32 | "rewire": "latest", 33 | "rimraf": "latest" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /packages/bin-utils/packages/create-proxy-module.json: -------------------------------------------------------------------------------- 1 | { 2 | "bin": "bin.js", 3 | "main": "lib/index.js", 4 | "files": [ 5 | "src", 6 | "lib" 7 | ], 8 | "scripts": { 9 | "start": "npm run build -- --watch", 10 | "prebuild": "rimraf lib", 11 | "build": "babel src -d lib --ignore __tests__,__mocks__", 12 | "test": "jest", 13 | "preversion": "run-s test build" 14 | }, 15 | "dependencies": { 16 | "node-http-proxy": "latest", 17 | "babel-runtime": "latest" 18 | }, 19 | "devDependencies": { 20 | "bin-utils": "latest", 21 | "babel-cli": "latest", 22 | "babel-core": "latest", 23 | "babel-eslint": "latest", 24 | "babel-loader": "latest", 25 | "babel-plugin-transform-runtime": "latest", 26 | "babel-preset-latest": "latest", 27 | "babel-preset-stage-2": "latest", 28 | "eslint": "latest", 29 | "eslint-plugin-babel": "latest", 30 | "eslint-plugin-react": "latest", 31 | "ncp": "latest", 32 | "npm-run-all": "latest", 33 | "rewire": "latest", 34 | "rimraf": "latest" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /packages/bin-utils/packages/create-react-app.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "lib/index.js", 3 | "jsnext:main": "dist/bundle.es.js", 4 | "files": [ 5 | "lib", 6 | "dist" 7 | ], 8 | "scripts": { 9 | "start": "react-scripts start", 10 | "build": "react-scripts build", 11 | "test": "react-scripts test", 12 | "eject": "react-scripts eject" 13 | }, 14 | "dependencies": { 15 | "react": "latest", 16 | "react-dom": "latest" 17 | }, 18 | "devDependencies": { 19 | "react-scripts": "latest" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/bin-utils/packages/create-react-repo.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "lerna run --scope *-app start", 5 | "start-dev": "lerna exec --ignore *-app -- npm start", 6 | "test": "lerna run test", 7 | "coverage": "lerna run coverage" 8 | }, 9 | "devDependencies": { 10 | "@raider/modular": "latest", 11 | "babel-plugin-transform-runtime": "^6.15.0", 12 | "babel-preset-latest": "^6.16.0", 13 | "babel-preset-react": "^6.16.0", 14 | "babel-preset-stage-2": "^6.18.0", 15 | "lerna": "2.0.0-beta.30", 16 | "sinon": "^1.17.6" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/bin-utils/packages/create-sass-module.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "lib/index.js", 3 | "scripts": { 4 | "start": "npm run copy && npm run webpack -- --watch", 5 | "prewebpack": "rimraf webpack webpack.config.js config.js && babel src/webpack -d webpack && babel src/webpack.config.js -o webpack.config.js && babel src/config.js -o config.js", 6 | "webpack": "webpack --config webpack.config.js --progress --profile --colors", 7 | "copy": "rimraf lib && ncp src/lib lib && rimraf lib/index.js", 8 | "build": "npm run copy && npm run webpack", 9 | "preversion": "npm run build" 10 | }, 11 | "dependencies": { 12 | "chai": "latest", 13 | "json-loader": "^0.5.4", 14 | "ncp": "latest", 15 | "universal-style-loader": "^0.16.1", 16 | "universal-styles": "^0.16.1" 17 | }, 18 | "devDependencies": { 19 | "bin-utils": "latest", 20 | "babel-cli": "latest", 21 | "babel-core": "latest", 22 | "babel-eslint": "latest", 23 | "babel-loader": "latest", 24 | "babel-plugin-transform-runtime": "latest", 25 | "babel-polyfill": "latest", 26 | "babel-preset-latest": "latest", 27 | "babel-preset-stage-2": "latest", 28 | "css-loader": "latest", 29 | "eslint": "latest", 30 | "eslint-plugin-babel": "latest", 31 | "eslint-plugin-react": "latest", 32 | "file-loader": "latest", 33 | "postcss": "latest", 34 | "postcss-browser-reporter": "latest", 35 | "postcss-cssnext": "latest", 36 | "postcss-font-magician": "^1.4.0", 37 | "postcss-import": "latest", 38 | "postcss-js": "latest", 39 | "postcss-loader": "latest", 40 | "postcss-modules": "latest", 41 | "postcss-reporter": "latest", 42 | "postcss-scss": "latest", 43 | "postcss-url": "latest", 44 | "precss": "latest", 45 | "rimraf": "latest", 46 | "style-loader": "latest", 47 | "url-loader": "latest", 48 | "webpack": "latest" 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /packages/bin-utils/packages/create-umd-module.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "lib/index.js", 3 | "jsnext:main": "dist/bundle.es.js", 4 | "files": [ 5 | "lib", 6 | "dist" 7 | ], 8 | "scripts": { 9 | "start": "npm run build -- --watch", 10 | "prebuild": "rimraf lib dist", 11 | "build:dist": "rollup -c --sourcemap inline --environment NODE_ENV:production", 12 | "build": "babel src -d lib --ignore __tests__,__mocks__", 13 | "preversion": "npm run build && npm run build:dist", 14 | "test": "jest" 15 | }, 16 | "dependencies": { 17 | "invariant": "^2.2.1", 18 | "babel-runtime": "latest" 19 | }, 20 | "devDependencies": { 21 | "babel-cli": "latest", 22 | "babel-core": "latest", 23 | "babel-eslint": "latest", 24 | "babel-plugin-transform-runtime": "latest", 25 | "babel-preset-es2015": "latest", 26 | "babel-preset-latest": "latest", 27 | "babel-preset-react": "latest", 28 | "babel-preset-stage-0": "latest", 29 | "babel-register": "latest", 30 | "babelrc-rollup": "^3.0.0", 31 | "bin-utils": "latest", 32 | "eslint": "latest", 33 | "eslint-plugin-babel": "latest", 34 | "jest": "latest", 35 | "ncp": "latest", 36 | "npm-run-all": "latest", 37 | "rimraf": "latest", 38 | "rollup": "latest", 39 | "rollup-plugin-babel": "latest", 40 | "rollup-plugin-commonjs": "latest", 41 | "rollup-plugin-node-resolve": "latest", 42 | "rollup-watch": "latest" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /packages/bin-utils/scripts/create-cli-module/init.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _createInit = require('../createInit'); 8 | 9 | var _createInit2 = _interopRequireDefault(_createInit); 10 | 11 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 12 | 13 | exports.default = (0, _createInit2.default)('create-cli-module'); -------------------------------------------------------------------------------- /packages/bin-utils/scripts/create-component-module/init.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _createInit = require('../createInit'); 8 | 9 | var _createInit2 = _interopRequireDefault(_createInit); 10 | 11 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 12 | 13 | exports.default = (0, _createInit2.default)('create-component-module'); -------------------------------------------------------------------------------- /packages/bin-utils/scripts/create-css-module/init.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _createInit = require('../createInit'); 8 | 9 | var _createInit2 = _interopRequireDefault(_createInit); 10 | 11 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 12 | 13 | exports.default = (0, _createInit2.default)('create-css-module'); -------------------------------------------------------------------------------- /packages/bin-utils/scripts/create-deploy-module/init.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _createInit = require('../createInit'); 8 | 9 | var _createInit2 = _interopRequireDefault(_createInit); 10 | 11 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 12 | 13 | exports.default = (0, _createInit2.default)('create-deploy-module'); -------------------------------------------------------------------------------- /packages/bin-utils/scripts/create-express-module/init.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _createInit = require('../createInit'); 8 | 9 | var _createInit2 = _interopRequireDefault(_createInit); 10 | 11 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 12 | 13 | exports.default = (0, _createInit2.default)('create-express-module'); -------------------------------------------------------------------------------- /packages/bin-utils/scripts/create-koa-module/init.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _createInit = require('../createInit'); 8 | 9 | var _createInit2 = _interopRequireDefault(_createInit); 10 | 11 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 12 | 13 | exports.default = (0, _createInit2.default)('create-koa-module'); -------------------------------------------------------------------------------- /packages/bin-utils/scripts/create-react-repo/init.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _createInit = require('../createInit'); 8 | 9 | var _createInit2 = _interopRequireDefault(_createInit); 10 | 11 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 12 | 13 | exports.default = (0, _createInit2.default)('create-react-repo'); -------------------------------------------------------------------------------- /packages/bin-utils/scripts/create-sass-module/init.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _createInit = require('../createInit'); 8 | 9 | var _createInit2 = _interopRequireDefault(_createInit); 10 | 11 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 12 | 13 | exports.default = (0, _createInit2.default)('create-sass-module'); -------------------------------------------------------------------------------- /packages/bin-utils/scripts/create-umd-module/init.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _createInit = require('../createInit'); 8 | 9 | var _createInit2 = _interopRequireDefault(_createInit); 10 | 11 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 12 | 13 | exports.default = (0, _createInit2.default)('create-umd-module'); -------------------------------------------------------------------------------- /packages/bin-utils/src/bin/index.js: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env node 2 | 3 | console.info('bin-utils: CLI COMMAND HERE') 4 | -------------------------------------------------------------------------------- /packages/bin-utils/src/lib/__tests__/mkdirp.test.js: -------------------------------------------------------------------------------- 1 | import mkdirp from '../mkdirp' 2 | 3 | describe('mkdirp', () => { 4 | it('should be function', () => { 5 | expect(typeof mkdirp).toBe('function') 6 | }) 7 | it('should have sync function', () => { 8 | expect(typeof mkdirp.sync).toBe('function') 9 | }) 10 | }) 11 | -------------------------------------------------------------------------------- /packages/bin-utils/src/lib/__tests__/ncp.test.js: -------------------------------------------------------------------------------- 1 | import ncp from '../ncp' 2 | 3 | describe('ncp', () => { 4 | it('should be function', () => { 5 | expect(typeof ncp).toBe('function') 6 | }) 7 | }) 8 | -------------------------------------------------------------------------------- /packages/bin-utils/src/lib/__tests__/rimraf.test.js: -------------------------------------------------------------------------------- 1 | import rimraf from '../rimraf' 2 | 3 | describe('rimraf', () => { 4 | it('should be function', () => { 5 | expect(typeof rimraf).toBe('function') 6 | }) 7 | it('should have sync function', () => { 8 | expect(typeof rimraf.sync).toBe('function') 9 | }) 10 | }) 11 | -------------------------------------------------------------------------------- /packages/bin-utils/src/lib/__tests__/stat.test.js: -------------------------------------------------------------------------------- 1 | import stat from '../stat' 2 | 3 | describe('stat', () => { 4 | it('should be function', () => { 5 | expect(typeof stat).toBe('function') 6 | }) 7 | it('should have sync function', () => { 8 | expect(typeof stat.sync).toBe('function') 9 | }) 10 | }) 11 | -------------------------------------------------------------------------------- /packages/bin-utils/src/lib/index.js: -------------------------------------------------------------------------------- 1 | export { default as mkdirp } from './mkdirp' 2 | export { default as ncp } from './ncp' 3 | export { default as rimraf } from './rimraf' 4 | export { default as stat } from './stat' 5 | -------------------------------------------------------------------------------- /packages/bin-utils/src/lib/mkdirp.js: -------------------------------------------------------------------------------- 1 | import mkdirp from 'mkdirp' 2 | import { promisify, syncify } from './utils' 3 | 4 | export default syncify(promisify(mkdirp), mkdirp.sync) 5 | -------------------------------------------------------------------------------- /packages/bin-utils/src/lib/ncp.js: -------------------------------------------------------------------------------- 1 | import ncp from 'ncp' 2 | import { promisify } from './utils' 3 | 4 | export default promisify(ncp) 5 | -------------------------------------------------------------------------------- /packages/bin-utils/src/lib/rimraf.js: -------------------------------------------------------------------------------- 1 | import rimraf from 'rimraf' 2 | import { promisify, syncify } from './utils' 3 | 4 | export default syncify(promisify(rimraf), rimraf.sync) 5 | -------------------------------------------------------------------------------- /packages/bin-utils/src/lib/stat.js: -------------------------------------------------------------------------------- 1 | import fs from 'graceful-fs' 2 | import { promisify, syncify } from './utils' 3 | 4 | export default syncify(promisify(fs.stat), fs.statSync) 5 | -------------------------------------------------------------------------------- /packages/bin-utils/src/lib/utils/__tests__/promisify.test.js: -------------------------------------------------------------------------------- 1 | import promisify from '../promisify' 2 | 3 | describe('promisify', () => { 4 | it('returns original when callback passed', () => { 5 | const fn = (foo, bar, cb) => ({ foo, bar, cb }) 6 | const promisified = promisify(fn) 7 | const result = promisified('foo', 'bar', () => {}) 8 | expect(result instanceof Promise).toBe(false) 9 | }) 10 | 11 | it('returns promise when callback omitted', () => { 12 | const fn = (foo, bar, cb) => ({ foo, bar, cb }) 13 | const promisified = promisify(fn) 14 | const result = promisified('foo', 'bar') 15 | expect(result instanceof Promise).toBe(true) 16 | }) 17 | }) 18 | -------------------------------------------------------------------------------- /packages/bin-utils/src/lib/utils/__tests__/syncify.test.js: -------------------------------------------------------------------------------- 1 | import syncify from '../syncify' 2 | 3 | describe('syncify', () => { 4 | it('throws for non function', () => { 5 | expect(() => typeof syncify({})).toThrow() 6 | }) 7 | it('accepts an optional sync function', () => { 8 | const sync = () => { return 'SYNC_FINISHED' } 9 | expect(syncify(() => {}, sync).sync).toBe(sync) 10 | }) 11 | it('throws for non sync function', () => { 12 | expect(() => syncify(() => {}, {})).toThrow() 13 | }) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/bin-utils/src/lib/utils/index.js: -------------------------------------------------------------------------------- 1 | export { default as promisify } from './promisify' 2 | export { default as syncify } from './syncify' 3 | -------------------------------------------------------------------------------- /packages/bin-utils/src/lib/utils/promisify.js: -------------------------------------------------------------------------------- 1 | export default function promisify (fn) { 2 | const promisified = (...args) => new Promise((resolve, reject) => { 3 | try { 4 | fn(...args, (...results) => { 5 | if(results[0] instanceof Error) 6 | reject(results[0]) 7 | else 8 | resolve(...results) 9 | }) 10 | } catch(err) { 11 | reject(err) 12 | } 13 | }) 14 | return function promiseWrap (...args) { 15 | return ( 16 | typeof args[args.length - 1] === 'function' 17 | ? fn(...args) 18 | : promisified(...args) 19 | ) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/bin-utils/src/lib/utils/syncify.js: -------------------------------------------------------------------------------- 1 | export default function syncify(fn, sync) { 2 | if(typeof fn !== 'function') 3 | throw new Error('syncify expects a function argument') 4 | if(typeof sync !== 'function') 5 | throw new Error('sync function must be a function') 6 | return Object.defineProperty( fn, 'sync', { value: sync, configurable: false, enumerable: true }) 7 | } 8 | -------------------------------------------------------------------------------- /packages/bin-utils/src/scripts/create-cli-module/init.js: -------------------------------------------------------------------------------- 1 | import createInit from '../createInit' 2 | export default createInit('create-cli-module') 3 | -------------------------------------------------------------------------------- /packages/bin-utils/src/scripts/create-component-module/init.js: -------------------------------------------------------------------------------- 1 | import createInit from '../createInit' 2 | export default createInit('create-component-module') 3 | -------------------------------------------------------------------------------- /packages/bin-utils/src/scripts/create-css-module/init.js: -------------------------------------------------------------------------------- 1 | import createInit from '../createInit' 2 | export default createInit('create-css-module') 3 | -------------------------------------------------------------------------------- /packages/bin-utils/src/scripts/create-deploy-module/init.js: -------------------------------------------------------------------------------- 1 | import createInit from '../createInit' 2 | export default createInit('create-deploy-module') 3 | -------------------------------------------------------------------------------- /packages/bin-utils/src/scripts/create-express-module/init.js: -------------------------------------------------------------------------------- 1 | import createInit from '../createInit' 2 | export default createInit('create-express-module') 3 | -------------------------------------------------------------------------------- /packages/bin-utils/src/scripts/create-koa-module/init.js: -------------------------------------------------------------------------------- 1 | import createInit from '../createInit' 2 | export default createInit('create-koa-module') 3 | -------------------------------------------------------------------------------- /packages/bin-utils/src/scripts/create-react-repo/init.js: -------------------------------------------------------------------------------- 1 | import createInit from '../createInit' 2 | export default createInit('create-react-repo') 3 | -------------------------------------------------------------------------------- /packages/bin-utils/src/scripts/create-sass-module/init.js: -------------------------------------------------------------------------------- 1 | import createInit from '../createInit' 2 | export default createInit('create-sass-module') 3 | -------------------------------------------------------------------------------- /packages/bin-utils/src/scripts/create-umd-module/init.js: -------------------------------------------------------------------------------- 1 | import createInit from '../createInit' 2 | export default createInit('create-umd-module') 3 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-cli-module/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["latest", "stage-2"], 3 | "plugins": ["transform-runtime"] 4 | } 5 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-cli-module/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "babel-eslint", 3 | "plugins": ["babel", "react", "flowtype"], 4 | "parserOptions": { 5 | "ecmaVersion": 2017, 6 | "sourceType": "module", 7 | "ecmaFeatures": { 8 | "jsx": true, 9 | "modules": true, 10 | "blockBindings": true, 11 | "defaultParams": true, 12 | "forOf": true, 13 | "generators": true, 14 | "objectLiteralComputedProperties": true, 15 | "objectLiteralDuplicateProperties": false, 16 | "objectLiteralShorthandMethods": true, 17 | "objectLiteralShorthandProperties": true, 18 | "templateStrings": true, 19 | "experimentalObjectRestSpread": true 20 | } 21 | }, 22 | "rules": { 23 | "quotes": [2, "single"], 24 | "strict": [2, "never"], 25 | "semi": [2, "never"], 26 | "brace-style": [2, "1tbs", { 27 | "allowSingleLine": true 28 | }], 29 | "comma-style": ["error", "first"], 30 | "comma-dangle": [2, "never"], 31 | "no-dupe-keys": 2, 32 | "no-ex-assign": 2, 33 | "no-extra-semi": 2, 34 | "valid-typeof": 2, 35 | "no-template-curly-in-string": "error", 36 | "symbol-description": "error", 37 | "class-methods-use-this": "error", 38 | "prefer-arrow-callback": ["error", {"allowNamedFunctions": true}], 39 | 40 | "babel/generator-star-spacing": 1, 41 | "babel/object-shorthand": 1, 42 | "babel/arrow-parens": 1, 43 | "babel/no-await-in-loop": 1, 44 | "babel/flow-object-type": [ "error", "comma" ], 45 | "babel/func-params-comma-dangle": 1, 46 | 47 | "react/jsx-uses-react": 2, 48 | "react/jsx-uses-vars": 2, 49 | "react/react-in-jsx-scope": 2, 50 | 51 | "flowtype/define-flow-type": 1, 52 | "flowtype/require-parameter-type": 1, 53 | "flowtype/require-return-type": [ 54 | 1, 55 | "always", 56 | { 57 | "annotateUndefined": "never" 58 | } 59 | ], 60 | "flowtype/space-after-type-colon": [ 61 | 1, 62 | "always" 63 | ], 64 | "flowtype/space-before-type-colon": [ 65 | 1, 66 | "never" 67 | ], 68 | "flowtype/type-id-match": [ 69 | 1, 70 | "^([A-Z]{1,3}[a-z0-9]+)+Type$" 71 | ], 72 | "flowtype/use-flow-type": 1, 73 | "flowtype/valid-syntax": 1 74 | }, 75 | "settings": { 76 | "flowtype": { 77 | "onlyFilesWithFlowAnnotation": true 78 | } 79 | }, 80 | "env": { 81 | "es6": true, 82 | "browser": true, 83 | "node": true 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-cli-module/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "7" 4 | - "6" 5 | - "5" 6 | before_install: 7 | # Repo for newer Node.js versions 8 | - curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - 9 | # Repo for Yarn 10 | - sudo apt-key adv --keyserver pgp.mit.edu --recv D101F7899D41F3C3 11 | - echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list 12 | - sudo apt-get update -qq 13 | - sudo apt-get install -y -qq yarn 14 | cache: 15 | directories: 16 | - $HOME/.yarn-cache 17 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-cli-module/bin.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | 'use strict'; 4 | 5 | require('./lib/cli').default() 6 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-cli-module/gitignore: -------------------------------------------------------------------------------- 1 | # dependencies 2 | node_modules/ 3 | 4 | # testing 5 | coverage/ 6 | 7 | # production 8 | build/ 9 | staging/ 10 | 11 | # misc 12 | .DS_Store 13 | .env 14 | *.log 15 | *.log.* 16 | *.sublime-workspace 17 | *.suo 18 | *.user 19 | *.userosscache 20 | *.sln.docstates 21 | .*.swp 22 | .vscode/ 23 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-cli-module/npmignore: -------------------------------------------------------------------------------- 1 | /src/ 2 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-cli-module/src/__tests__/execute.test.js: -------------------------------------------------------------------------------- 1 | import execute from '../' 2 | 3 | describe('lib', () => { 4 | it('is a function', () => { 5 | expect(typeof execute).toBe('function') 6 | }) 7 | }) 8 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-cli-module/src/cli.js: -------------------------------------------------------------------------------- 1 | import chalk from 'chalk' 2 | import yargs from 'yargs' 3 | import util from 'util' 4 | import { api } from '../' 5 | 6 | export default function cli (cb = (result) => { 7 | if(result instanceof Error) { 8 | console.error(`error occurred during execution => ${util.inspect(err)}`) 9 | process.exit(1) 10 | } else if(result === false || result.length === 0) { 11 | process.exit(1) 12 | } 13 | console.log(result) 14 | }) { 15 | const packageJson = require('../package.json') 16 | const name = packageJson.name.includes('/') ? packageJson.name.split('/')[1] : packageJson.name 17 | const argv = yargs 18 | .usage(chalk.green.bold(`Usage: ${name} [options]`)) 19 | .version(packageJson.version) 20 | .describe('verbose', 'Print debugging information.') 21 | .help('h') 22 | .alias('h', 'help') 23 | .demand(1) 24 | .argv 25 | const { _, ...opts } = argv 26 | return api(_, opts, cb) 27 | } 28 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-cli-module/src/index.js: -------------------------------------------------------------------------------- 1 | import yargs from 'yargs' 2 | import chalk from 'chalk' 3 | 4 | const packageJson = require('package.json') 5 | 6 | export function api (args, opts, cb) { 7 | if(args.length !== 1) 8 | throw new Error(`${packageJson.name} requires exactly 1 command argument`) 9 | const [ arg ] = args 10 | return execute(arg, cb) 11 | } 12 | 13 | export default function execute(arg, cb) { 14 | if(cb) { 15 | _execute(arg, cb) 16 | } else { 17 | return new Promise((resolve, reject) => { 18 | _which(name, (result, ...rest) => { 19 | if(result instanceof Error) 20 | return reject(result) 21 | resolve(result, ...rest) 22 | }) 23 | }) 24 | } 25 | } 26 | 27 | function _execute (arg, cb) { 28 | try { 29 | console.log(`executing ${packageJson.name} with arg ${arg}`) 30 | cb() 31 | } catch(err) { 32 | cb(err) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-component-module/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ "latest", "react", "stage-2" ], 3 | "plugins": ["transform-runtime"] 4 | } 5 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-component-module/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "babel-eslint", 3 | "plugins": ["babel", "react", "flowtype"], 4 | "parserOptions": { 5 | "ecmaVersion": 2017, 6 | "sourceType": "module", 7 | "ecmaFeatures": { 8 | "jsx": true, 9 | "modules": true, 10 | "blockBindings": true, 11 | "defaultParams": true, 12 | "forOf": true, 13 | "generators": true, 14 | "objectLiteralComputedProperties": true, 15 | "objectLiteralDuplicateProperties": false, 16 | "objectLiteralShorthandMethods": true, 17 | "objectLiteralShorthandProperties": true, 18 | "templateStrings": true, 19 | "experimentalObjectRestSpread": true 20 | } 21 | }, 22 | "rules": { 23 | "quotes": [2, "single"], 24 | "strict": [2, "never"], 25 | "semi": [2, "never"], 26 | "brace-style": [2, "1tbs", { 27 | "allowSingleLine": true 28 | }], 29 | "comma-style": ["error", "first"], 30 | "comma-dangle": [2, "never"], 31 | "no-dupe-keys": 2, 32 | "no-ex-assign": 2, 33 | "no-extra-semi": 2, 34 | "valid-typeof": 2, 35 | "no-template-curly-in-string": "error", 36 | "symbol-description": "error", 37 | "prefer-arrow-callback": ["error", {"allowNamedFunctions": true}], 38 | 39 | "babel/generator-star-spacing": 1, 40 | "babel/object-shorthand": 1, 41 | "babel/arrow-parens": 1, 42 | "babel/no-await-in-loop": 1, 43 | "babel/flow-object-type": [ "error", "comma" ], 44 | "babel/func-params-comma-dangle": 1, 45 | 46 | "react/jsx-uses-react": 2, 47 | "react/jsx-uses-vars": 2, 48 | "react/react-in-jsx-scope": 2, 49 | 50 | "flowtype/define-flow-type": 1, 51 | "flowtype/require-parameter-type": 1, 52 | "flowtype/require-return-type": [ 53 | 1, 54 | "always", 55 | { 56 | "annotateUndefined": "never" 57 | } 58 | ], 59 | "flowtype/space-after-type-colon": [ 60 | 1, 61 | "always" 62 | ], 63 | "flowtype/space-before-type-colon": [ 64 | 1, 65 | "never" 66 | ], 67 | "flowtype/type-id-match": [ 68 | 1, 69 | "^([A-Z]{1,3}[a-z0-9]+)+Type$" 70 | ], 71 | "flowtype/use-flow-type": 1, 72 | "flowtype/valid-syntax": 1 73 | }, 74 | "settings": { 75 | "flowtype": { 76 | "onlyFilesWithFlowAnnotation": true 77 | } 78 | }, 79 | "env": { 80 | "es6": true, 81 | "browser": true, 82 | "node": true 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-component-module/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "7" 4 | - "6" 5 | - "5" 6 | before_install: 7 | # Repo for newer Node.js versions 8 | - curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - 9 | # Repo for Yarn 10 | - sudo apt-key adv --keyserver pgp.mit.edu --recv D101F7899D41F3C3 11 | - echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list 12 | - sudo apt-get update -qq 13 | - sudo apt-get install -y -qq yarn 14 | cache: 15 | directories: 16 | - $HOME/.yarn-cache 17 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-component-module/gitignore: -------------------------------------------------------------------------------- 1 | # dependencies 2 | node_modules/ 3 | 4 | # testing 5 | coverage/ 6 | 7 | # production 8 | build/ 9 | staging/ 10 | 11 | # misc 12 | .DS_Store 13 | .env 14 | *.log 15 | *.log.* 16 | *.sublime-workspace 17 | *.suo 18 | *.user 19 | *.userosscache 20 | *.sln.docstates 21 | .*.swp 22 | .vscode/ 23 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-component-module/npmignore: -------------------------------------------------------------------------------- 1 | /src/ 2 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-component-module/src/__tests__/index.test.js: -------------------------------------------------------------------------------- 1 | import lib from '../' 2 | 3 | describe('lib', () => { 4 | it('is a function', () => { 5 | expect(typeof lib).toBe('function') 6 | }) 7 | }) 8 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-component-module/src/index.js: -------------------------------------------------------------------------------- 1 | export default function () { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-component-module/webpack.config.js: -------------------------------------------------------------------------------- 1 | const webpack = require('webpack'); 2 | const path = require('path'); 3 | 4 | const nodeEnv = process.env.NODE_ENV || 'development'; 5 | const isProd = nodeEnv === 'production'; 6 | 7 | module.exports = { 8 | devtool: isProd ? 'hidden-source-map' : 'cheap-eval-source-map', 9 | context: path.join(__dirname, './src'), 10 | entry: { 11 | js: './index.js' /*, 12 | vendor: ['react'] 13 | */ 14 | }, 15 | output: { 16 | path: path.join(__dirname, './dist'), 17 | filename: 'bundle.js' 18 | }, 19 | module: { 20 | loaders: [ 21 | /* 22 | { 23 | test: /\.html$/, 24 | loader: 'file', 25 | query: { 26 | name: '[name].[ext]' 27 | } 28 | }, 29 | { 30 | test: /\.css$/, 31 | loaders: [ 32 | 'style', 33 | 'css' 34 | ] 35 | }, 36 | */ 37 | { 38 | test: /\.(js|jsx)$/, 39 | exclude: /node_modules/, 40 | loaders: [ 41 | // 'react-hot', 42 | 'babel-loader' 43 | ] 44 | }, 45 | ], 46 | }, 47 | resolve: { 48 | extensions: ['.js', '.jsx'], 49 | modules: [ 50 | path.resolve('./src'), 51 | 'node_modules' 52 | ] 53 | }, 54 | plugins: [ 55 | /* 56 | new webpack.optimize.CommonsChunkPlugin({ 57 | name: 'vendor', 58 | minChunks: Infinity, 59 | filename: 'vendor.bundle.js' 60 | }), 61 | */ 62 | new webpack.LoaderOptionsPlugin({ 63 | minimize: true, 64 | debug: false 65 | }), 66 | /* 67 | new webpack.optimize.UglifyJsPlugin({ 68 | compress: { 69 | warnings: false 70 | }, 71 | output: { 72 | comments: false 73 | }, 74 | sourceMap: false 75 | }), 76 | */ 77 | new webpack.DefinePlugin({ 78 | 'process.env': { NODE_ENV: JSON.stringify(nodeEnv) } 79 | }) 80 | ] 81 | /* 82 | , 83 | devServer: { 84 | contentBase: './src' 85 | // hot: true 86 | } 87 | */ 88 | }; 89 | 90 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-css-module/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["latest", "stage-2"] 3 | } 4 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-css-module/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "7" 4 | - "6" 5 | - "5" 6 | before_install: 7 | # Repo for newer Node.js versions 8 | - curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - 9 | # Repo for Yarn 10 | - sudo apt-key adv --keyserver pgp.mit.edu --recv D101F7899D41F3C3 11 | - echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list 12 | - sudo apt-get update -qq 13 | - sudo apt-get install -y -qq yarn 14 | cache: 15 | directories: 16 | - $HOME/.yarn-cache 17 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-css-module/gitignore: -------------------------------------------------------------------------------- 1 | # dependencies 2 | node_modules/ 3 | 4 | # testing 5 | coverage/ 6 | 7 | # production 8 | build/ 9 | staging/ 10 | 11 | # misc 12 | .DS_Store 13 | .env 14 | *.log 15 | *.log.* 16 | *.sublime-workspace 17 | *.suo 18 | *.user 19 | *.userosscache 20 | *.sln.docstates 21 | .*.swp 22 | .vscode/ 23 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-css-module/npmignore: -------------------------------------------------------------------------------- 1 | /src/ 2 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-css-module/src/config.js: -------------------------------------------------------------------------------- 1 | import path from 'path' 2 | 3 | export const noop = () => {} 4 | export const IS_HOT = process.env.NODE_ENV === 'hot' 5 | export const IS_DEV = process.env.NODE_ENV !== 'production' 6 | export const IS_BROWSER = typeof window === 'object' 7 | 8 | export const baseUrl = '/' 9 | 10 | export const log =/* !IS_DEV && IS_BROWSER ?*/ ({ name: 'css-module', trace: noop, debug: noop, info: noop, warn: noop, error: noop, fatal: noop }) /*: createLogger({ name, level: 'info' })*/ 11 | 12 | export const __rootname = IS_BROWSER ? '/' : __dirname 13 | export const resolveRoot = (...args) => IS_BROWSER ? `${__rootname}${args.join('/')}` : path.resolve(__rootname, ...args) 14 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-css-module/src/lib/index.js: -------------------------------------------------------------------------------- 1 | import styles from './styles.css' 2 | export default styles 3 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-css-module/src/lib/styles.css: -------------------------------------------------------------------------------- 1 | /** mobile */ @custom-media --mobile only screen and (width < 48em); 2 | /** desktop */ @custom-media --desktop only screen and (width >= 48em); 3 | 4 | /* ===== == = === 20em (320px) === = == ===== */ 5 | @custom-media --xs-screen only screen and (width >= 20em); 6 | 7 | /* ===== == = === 30em (480px) === = == ===== */ 8 | @custom-media --sm-screen only screen and (width >= 30em); 9 | 10 | /* ===== == = === 37.5em (600px) === = == ===== */ 11 | @custom-media --md-screen only screen and (width >= 37.5em); 12 | 13 | /* ===== == = === 48em (768px) === = == ===== */ 14 | @custom-media --lg-screen only screen and (width >= 48em); 15 | 16 | /* ===== == = === 56.25em (900px) === = == ===== */ 17 | @custom-media --xl-screen only screen and (width >= 56.25em); 18 | 19 | /* ===== == = === 68.75em (1100px) === = == ===== */ 20 | @custom-media --2x-screen only screen and (width >= 68.75em); 21 | 22 | /* ===== == = === 81.25em (1300px) === = == ===== */ 23 | @custom-media --3x-screen only screen and (width >= 81.25em); 24 | 25 | :root { 26 | --shadow: { 27 | /* offset-x | offset-y | blur-radius | spread-radius | color */ 28 | box-shadow: 2px 2px 3px 1px rgb(200, 200, 200); 29 | } 30 | } 31 | 32 | /** CSS MODULES READY TO GO */ 33 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-css-module/src/webpack.config.js: -------------------------------------------------------------------------------- 1 | import 'babel-polyfill' 2 | import make from './webpack/make' 3 | export default make('lib') 4 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-css-module/src/webpack/devtool.js: -------------------------------------------------------------------------------- 1 | import { server } from '../config.js' 2 | 3 | export default name => { 4 | return 'cheap-module-source-map' 5 | switch(name) { 6 | case 'lib': 7 | return '#eval' 8 | case 'server': 9 | return 'source-map' 10 | } 11 | if(process.env.NODE_ENV === 'hot') 12 | return '#eval' 13 | } 14 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-css-module/src/webpack/entry.js: -------------------------------------------------------------------------------- 1 | import { baseUrl } from '../config.js' 2 | import fs from 'fs' 3 | import path from 'path' 4 | 5 | const getHotUrl = name => { 6 | const path = `${baseUrl}/__webpack_hmr` 7 | const timeout = 2000 8 | const overlay = true 9 | const reload = true 10 | const noInfo = false 11 | const quiet = false 12 | return 'webpack-hot-middleware/client' //?path=${path}&timeout=${timeout}&overlay=${overlay}&reload=${reload}&noInfo=${noInfo}&quiet=${quiet}` 13 | } 14 | 15 | function maybeHotEntry(name, ...entries) { 16 | if(process.env.NODE_ENV === 'hot') { 17 | return [ getHotUrl(name), ...entries ] 18 | } 19 | return entries[0] 20 | } 21 | 22 | export default name => { 23 | switch(name) { 24 | case 'lib': 25 | return { 'lib/index': './src/lib' } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-css-module/src/webpack/externals.js: -------------------------------------------------------------------------------- 1 | import { dependencyNames } from '../config' 2 | 3 | export default name => { 4 | 5 | /* 6 | switch(name) { 7 | case 'server': 8 | return dependencyNames.reduce((externals, name) => ({ ...externals, [name]: true }), {}) 9 | case 'vendor': 10 | return { 'react/lib/ReactCSSTransitionGroup': 'ReactCSSTransitionGroup' 11 | , 'react': 'React' 12 | , 'react-dom': 'ReactDOM' 13 | } 14 | } 15 | */ 16 | } 17 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-css-module/src/webpack/make.js: -------------------------------------------------------------------------------- 1 | import { __rootname } from '../config' 2 | import getDevTool from './devtool' 3 | import getTarget from './target' 4 | import getEntry from './entry' 5 | import getOutput from './output' 6 | import getResolve from './resolve' 7 | import getResolveLoader from './resolveLoader' 8 | import getModule from './module' 9 | import getExternals from './externals' 10 | import getPlugins from './plugins' 11 | import getPostcss from './postcss' 12 | import getNode from './node' 13 | 14 | export default function make(name) { 15 | if(typeof name !== 'string') 16 | throw new Error('Name is required.') 17 | return { name 18 | , context: __rootname 19 | , cache: true 20 | , target: getTarget(name) 21 | , devtool: getDevTool(name) 22 | , entry: getEntry(name) 23 | , output: getOutput(name) 24 | , resolve: getResolve(name) 25 | , resolveLoader: getResolveLoader(name) 26 | , module: getModule(name) 27 | , externals: getExternals(name) 28 | , plugins: getPlugins(name) 29 | , node: getNode(name) 30 | , postcss: getPostcss(name) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-css-module/src/webpack/module/index.js: -------------------------------------------------------------------------------- 1 | import getLoaders from './loaders' 2 | import getPostLoaders from './postLoaders' 3 | import getNoParse from './noParse' 4 | 5 | export default name => ({ loaders: getLoaders(name) 6 | , postLoaders: getPostLoaders(name) 7 | , noParse: getNoParse(name) 8 | }) 9 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-css-module/src/webpack/module/noParse.js: -------------------------------------------------------------------------------- 1 | export default name => ([]) 2 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-css-module/src/webpack/module/postLoaders.js: -------------------------------------------------------------------------------- 1 | export default name => ([]) 2 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-css-module/src/webpack/node.js: -------------------------------------------------------------------------------- 1 | export default name => { 2 | switch(name) { 3 | case 'lib': 4 | case 'server': 5 | return { __filename: true, __dirname: true, console: true, net: true } 6 | default: 7 | return { fs: 'empty', 'graceful-fs': 'empty' } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-css-module/src/webpack/output.js: -------------------------------------------------------------------------------- 1 | import { libName, baseUrl, resolveRoot } from '../config.js' 2 | import { join } from 'path' 3 | 4 | const getPath = name => { 5 | switch(name) { 6 | case 'lib': 7 | return resolveRoot('.') 8 | case 'server': 9 | return resolveRoot('lib', 'app') 10 | case 'static': 11 | return resolveRoot('public', 'assets') 12 | default: 13 | return resolveRoot('public', 'assets') 14 | } 15 | } 16 | 17 | const getPublicPath = name => { 18 | switch(name) { 19 | case 'lib': 20 | return '/' 21 | case 'server': 22 | return '/lib/app' 23 | case 'static': 24 | return `${baseUrl}/assets/` 25 | default: 26 | return `${baseUrl}/assets/` 27 | } 28 | } 29 | 30 | 31 | const getLibrary = name => { 32 | return libName 33 | } 34 | 35 | const getLibraryTarget = name => { 36 | switch(name) { 37 | case 'lib': 38 | return 'umd' 39 | case 'server': 40 | return 'commonjs2' 41 | } 42 | } 43 | 44 | const getFilename = name => '[name].js' 45 | const getChunkFilename = name => '[name].js' 46 | const getSourceMapFilename = name => '[file].map' 47 | const getDevtoolModuleFilenameTemplate = name => 'file:///[absolute-resource-path]' 48 | const getHotUpdateChunkFilename = name => '[id].[hash].hot-update.js' 49 | const getHotUpdateMainFilename = name => '[hash].hot-update.json' 50 | const getCrossOriginLoading = name => 'anonymous' 51 | 52 | 53 | 54 | export default name => { 55 | let output = { path: getPath(name) 56 | , library: getLibrary(name) 57 | , libraryTarget: getLibraryTarget(name) 58 | , pathinfo: process.env.NODE_ENV === 'hot' 59 | , publicPath: getPublicPath(name) 60 | , filename: getFilename(name) 61 | , chunkFilename: getChunkFilename(name) 62 | , crossOriginLoading: getCrossOriginLoading(name) 63 | //, devtoolModuleFilenameTemplate: getDevtoolModuleFilenameTemplate(name) 64 | //, sourceMapFilename: getSourceMapFilename(name) 65 | //, hotUpdateChunkFilename: getHotUpdateChunkFilename(name) 66 | //, hotUpdateMainFilename: getHotUpdateMainFilename(name) 67 | } 68 | console.warn('OUTPUT', JSON.stringify(output, null, 2)) 69 | return output 70 | } 71 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-css-module/src/webpack/postcss.js: -------------------------------------------------------------------------------- 1 | import postcssModules from 'postcss-modules' 2 | import postcssImport from 'postcss-import' 3 | import postcssUrl from 'postcss-url' 4 | import postcssCssnext from 'postcss-cssnext' 5 | import postcssFontMagician from 'postcss-font-magician' 6 | import postcssBrowserReporter from 'postcss-browser-reporter' 7 | import postcssReporter from 'postcss-reporter' 8 | 9 | import { IS_DEV } from '../config' 10 | 11 | export default name => { 12 | return webpack => { 13 | 14 | const prodPostcss = [ postcssImport({ addDependencyTo: webpack }) 15 | , postcssUrl( { url: 'inline' 16 | //, basePath: '../src/app' 17 | //, assetsPath: '../images' 18 | }) 19 | , postcssCssnext() 20 | , postcssFontMagician() 21 | /* 22 | , postcssModules( { scopeBehaviour: 'global' 23 | } ) 24 | */ 25 | ] 26 | if(!IS_DEV) 27 | return prodPostcss 28 | 29 | const messagesStyle = { color: 'rgb(255, 255, 255)' 30 | , 'background-color': 'rgb(255, 100, 100)' 31 | , position: 'fixed' 32 | , 'font-family': 'Lato' 33 | , 'z-index': 1000000 34 | , top: '70px' 35 | , width: '500px' 36 | , 'margin-left': 'auto' 37 | , 'margin-right': 'auto' 38 | } 39 | return [ ...prodPostcss 40 | , postcssBrowserReporter({ styles: messagesStyle }) 41 | , postcssReporter() 42 | ] 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-css-module/src/webpack/resolve/alias.js: -------------------------------------------------------------------------------- 1 | import { resolveRoot } from '../../config.js' 2 | import { resolve } from 'path' 3 | 4 | export const configPath = resolveRoot('./config.js') 5 | export const libFolder = resolveRoot('./src/lib') 6 | 7 | export default name => { 8 | return { 'config': configPath 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-css-module/src/webpack/resolve/index.js: -------------------------------------------------------------------------------- 1 | import { __rootname, resolveRoot } from '../../config.js' 2 | import getAlias from './alias' 3 | 4 | export default name => { 5 | return { root: [ __rootname ] 6 | , alias: getAlias(name) 7 | , fallback: resolveRoot('node_modules') 8 | , extensions: [ '', '.jsx', '.js', '.json' ] 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-css-module/src/webpack/resolveLoader.js: -------------------------------------------------------------------------------- 1 | import { resolveRoot } from '../config.js' 2 | 3 | export default name => { 4 | return { root: resolveRoot('node_modules') 5 | , fallback: resolveRoot('node_modules') 6 | , extensions: [ '', '.jsx', '.js', '.json' ] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-css-module/src/webpack/target.js: -------------------------------------------------------------------------------- 1 | export default name => { 2 | switch(name) { 3 | case 'lib': 4 | case 'server': 5 | return 'node' 6 | default: 7 | return 'web' 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-deploy-module/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["latest", "stage-2"] 3 | } 4 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-deploy-module/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "7" 4 | - "6" 5 | - "5" 6 | before_install: 7 | # Repo for newer Node.js versions 8 | - curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - 9 | # Repo for Yarn 10 | - sudo apt-key adv --keyserver pgp.mit.edu --recv D101F7899D41F3C3 11 | - echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list 12 | - sudo apt-get update -qq 13 | - sudo apt-get install -y -qq yarn 14 | cache: 15 | directories: 16 | - $HOME/.yarn-cache 17 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-deploy-module/bin.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | 'use strict'; 4 | 5 | require('./lib/cli').default() 6 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-deploy-module/gitignore: -------------------------------------------------------------------------------- 1 | # dependencies 2 | node_modules/ 3 | 4 | # testing 5 | coverage/ 6 | 7 | # production 8 | build/ 9 | staging/ 10 | 11 | # misc 12 | .DS_Store 13 | .env 14 | *.log 15 | *.log.* 16 | *.sublime-workspace 17 | *.suo 18 | *.user 19 | *.userosscache 20 | *.sln.docstates 21 | .*.swp 22 | .vscode/ 23 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-deploy-module/npmignore: -------------------------------------------------------------------------------- 1 | /src/ 2 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-deploy-module/src/__tests__/execute.test.js: -------------------------------------------------------------------------------- 1 | import execute from '../' 2 | 3 | describe('lib', () => { 4 | it('is a function', () => { 5 | expect(typeof execute).toBe('function') 6 | }) 7 | }) 8 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-deploy-module/src/cli.js: -------------------------------------------------------------------------------- 1 | import chalk from 'chalk' 2 | import yargs from 'yargs' 3 | import util from 'util' 4 | import { api } from '../' 5 | 6 | export default function cli (cb = (result) => { 7 | if(result instanceof Error) { 8 | console.error(`error occurred during execution => ${util.inspect(err)}`) 9 | process.exit(1) 10 | } else if(result === false || result.length === 0) { 11 | process.exit(1) 12 | } 13 | console.log(result) 14 | }) { 15 | const packageJson = require('../package.json') 16 | const name = packageJson.name.includes('/') ? packageJson.name.split('/')[1] : packageJson.name 17 | const argv = yargs 18 | .usage(chalk.green.bold(`Usage: ${name} [options]`)) 19 | .version(packageJson.version) 20 | .describe('verbose', 'Print debugging information.') 21 | .help('h') 22 | .alias('h', 'help') 23 | .demand(1) 24 | .argv 25 | const { _, ...opts } = argv 26 | return api(_, opts, cb) 27 | } 28 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-deploy-module/src/index.js: -------------------------------------------------------------------------------- 1 | import yargs from 'yargs' 2 | import chalk from 'chalk' 3 | 4 | const packageJson = require('package.json') 5 | 6 | export function api (args, opts, cb) { 7 | if(args.length !== 1) 8 | throw new Error(`${packageJson.name} requires exactly 1 command argument`) 9 | const [ arg ] = args 10 | return execute(arg, cb) 11 | } 12 | 13 | export default function execute(arg, cb) { 14 | if(cb) { 15 | _execute(arg, cb) 16 | } else { 17 | return new Promise((resolve, reject) => { 18 | _which(name, (result, ...rest) => { 19 | if(result instanceof Error) 20 | return reject(result) 21 | resolve(result, ...rest) 22 | }) 23 | }) 24 | } 25 | } 26 | 27 | function _execute (arg, cb) { 28 | try { 29 | console.log(`executing ${packageJson.name} with arg ${arg}`) 30 | cb() 31 | } catch(err) { 32 | cb(err) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-express-module/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["latest", "stage-2"] 3 | } 4 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-express-module/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "7" 4 | - "6" 5 | - "5" 6 | before_install: 7 | # Repo for newer Node.js versions 8 | - curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - 9 | # Repo for Yarn 10 | - sudo apt-key adv --keyserver pgp.mit.edu --recv D101F7899D41F3C3 11 | - echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list 12 | - sudo apt-get update -qq 13 | - sudo apt-get install -y -qq yarn 14 | cache: 15 | directories: 16 | - $HOME/.yarn-cache 17 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-express-module/bin.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | 'use strict'; 4 | 5 | require('./lib/cli').default() 6 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-express-module/gitignore: -------------------------------------------------------------------------------- 1 | # dependencies 2 | node_modules/ 3 | 4 | # testing 5 | coverage/ 6 | 7 | # production 8 | build/ 9 | staging/ 10 | 11 | # misc 12 | .DS_Store 13 | .env 14 | *.log 15 | *.log.* 16 | *.sublime-workspace 17 | *.suo 18 | *.user 19 | *.userosscache 20 | *.sln.docstates 21 | .*.swp 22 | .vscode/ 23 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-express-module/npmignore: -------------------------------------------------------------------------------- 1 | /src/ 2 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-express-module/src/__tests__/execute.test.js: -------------------------------------------------------------------------------- 1 | import execute from '../' 2 | 3 | describe('lib', () => { 4 | it('is a function', () => { 5 | expect(typeof execute).toBe('function') 6 | }) 7 | }) 8 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-express-module/src/cli.js: -------------------------------------------------------------------------------- 1 | import chalk from 'chalk' 2 | import yargs from 'yargs' 3 | import util from 'util' 4 | import { api } from '../' 5 | 6 | export default function cli (cb = (result) => { 7 | if(result instanceof Error) { 8 | console.error(`error occurred during execution => ${util.inspect(err)}`) 9 | process.exit(1) 10 | } else if(result === false || result.length === 0) { 11 | process.exit(1) 12 | } 13 | console.log(result) 14 | }) { 15 | const packageJson = require('../package.json') 16 | const name = packageJson.name.includes('/') ? packageJson.name.split('/')[1] : packageJson.name 17 | const argv = yargs 18 | .usage(chalk.green.bold(`Usage: ${name} [options]`)) 19 | .version(packageJson.version) 20 | .describe('verbose', 'Print debugging information.') 21 | .help('h') 22 | .alias('h', 'help') 23 | .demand(1) 24 | .argv 25 | const { _, ...opts } = argv 26 | return api(_, opts, cb) 27 | } 28 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-express-module/src/index.js: -------------------------------------------------------------------------------- 1 | import yargs from 'yargs' 2 | import chalk from 'chalk' 3 | 4 | const packageJson = require('package.json') 5 | 6 | export function api (args, opts, cb) { 7 | if(args.length !== 1) 8 | throw new Error(`${packageJson.name} requires exactly 1 command argument`) 9 | const [ arg ] = args 10 | return execute(arg, cb) 11 | } 12 | 13 | export default function execute(arg, cb) { 14 | if(cb) { 15 | _execute(arg, cb) 16 | } else { 17 | return new Promise((resolve, reject) => { 18 | _which(name, (result, ...rest) => { 19 | if(result instanceof Error) 20 | return reject(result) 21 | resolve(result, ...rest) 22 | }) 23 | }) 24 | } 25 | } 26 | 27 | function _execute (arg, cb) { 28 | try { 29 | console.log(`executing ${packageJson.name} with arg ${arg}`) 30 | cb() 31 | } catch(err) { 32 | cb(err) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-jest-module/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["latest", "stage-2"] 3 | } 4 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-jest-module/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "7" 4 | - "6" 5 | - "5" 6 | before_install: 7 | # Repo for newer Node.js versions 8 | - curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - 9 | # Repo for Yarn 10 | - sudo apt-key adv --keyserver pgp.mit.edu --recv D101F7899D41F3C3 11 | - echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list 12 | - sudo apt-get update -qq 13 | - sudo apt-get install -y -qq yarn 14 | cache: 15 | directories: 16 | - $HOME/.yarn-cache 17 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-jest-module/__tests__/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import {{PACKAGE_EXPORT}} from '{{PACKAGE_NAME}}' 3 | 4 | describe('{{PACKAGE_EXPORT}}', () => { 5 | it('builds a component', () => { 6 | expect(typeof {{PACKAGE_EXPORT}}(React)).toBe('function') 7 | }) 8 | describe('Component', () => { 9 | const Component = {{PACKAGE_EXPORT}}(React) 10 | it('has unit tests') 11 | }) 12 | }) 13 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-jest-module/gitignore: -------------------------------------------------------------------------------- 1 | # dependencies 2 | node_modules/ 3 | 4 | # testing 5 | coverage/ 6 | 7 | # production 8 | build/ 9 | staging/ 10 | 11 | # misc 12 | .DS_Store 13 | .env 14 | *.log 15 | *.log.* 16 | *.sublime-workspace 17 | *.suo 18 | *.user 19 | *.userosscache 20 | *.sln.docstates 21 | .*.swp 22 | .vscode/ 23 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-jest-module/npmignore: -------------------------------------------------------------------------------- 1 | /src/ 2 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-koa-module/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["latest", "stage-2"], 3 | "plugins": [ "transform-runtime" ] 4 | } 5 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-koa-module/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "7" 4 | - "6" 5 | - "5" 6 | before_install: 7 | # Repo for newer Node.js versions 8 | - curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - 9 | # Repo for Yarn 10 | - sudo apt-key adv --keyserver pgp.mit.edu --recv D101F7899D41F3C3 11 | - echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list 12 | - sudo apt-get update -qq 13 | - sudo apt-get install -y -qq yarn 14 | cache: 15 | directories: 16 | - $HOME/.yarn-cache 17 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-koa-module/bin.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | 'use strict'; 4 | 5 | require('./lib/cli').default() 6 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-koa-module/gitignore: -------------------------------------------------------------------------------- 1 | # dependencies 2 | node_modules/ 3 | 4 | # testing 5 | coverage/ 6 | 7 | # production 8 | build/ 9 | staging/ 10 | 11 | # misc 12 | .DS_Store 13 | .env 14 | *.log 15 | *.log.* 16 | *.sublime-workspace 17 | *.suo 18 | *.user 19 | *.userosscache 20 | *.sln.docstates 21 | .*.swp 22 | .vscode/ 23 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-koa-module/npmignore: -------------------------------------------------------------------------------- 1 | /src/ 2 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-koa-module/src/__tests__/execute.test.js: -------------------------------------------------------------------------------- 1 | import execute from '../' 2 | 3 | describe('lib', () => { 4 | it('is a function', () => { 5 | expect(typeof execute).toBe('function') 6 | }) 7 | }) 8 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-koa-module/src/cli.js: -------------------------------------------------------------------------------- 1 | import chalk from 'chalk' 2 | import yargs from 'yargs' 3 | import util from 'util' 4 | import { api } from '../' 5 | 6 | export default function cli (cb = (result) => { 7 | if(result instanceof Error) { 8 | console.error(`error occurred during execution => ${util.inspect(err)}`) 9 | process.exit(1) 10 | } else if(result === false || result.length === 0) { 11 | process.exit(1) 12 | } 13 | console.log(result) 14 | }) { 15 | const packageJson = require('../package.json') 16 | const name = packageJson.name.includes('/') ? packageJson.name.split('/')[1] : packageJson.name 17 | const argv = yargs 18 | .usage(chalk.green.bold(`Usage: ${name} [options]`)) 19 | .version(packageJson.version) 20 | .describe('verbose', 'Print debugging information.') 21 | .help('h') 22 | .alias('h', 'help') 23 | .demand(1) 24 | .argv 25 | const { _, ...opts } = argv 26 | return api(_, opts, cb) 27 | } 28 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-koa-module/src/index.js: -------------------------------------------------------------------------------- 1 | import yargs from 'yargs' 2 | import chalk from 'chalk' 3 | 4 | const packageJson = require('package.json') 5 | 6 | export function api (args, opts, cb) { 7 | if(args.length !== 1) 8 | throw new Error(`${packageJson.name} requires exactly 1 command argument`) 9 | const [ arg ] = args 10 | return execute(arg, cb) 11 | } 12 | 13 | export default function execute(arg, cb) { 14 | if(cb) { 15 | _execute(arg, cb) 16 | } else { 17 | return new Promise((resolve, reject) => { 18 | _which(name, (result, ...rest) => { 19 | if(result instanceof Error) 20 | return reject(result) 21 | resolve(result, ...rest) 22 | }) 23 | }) 24 | } 25 | } 26 | 27 | function _execute (arg, cb) { 28 | try { 29 | console.log(`executing ${packageJson.name} with arg ${arg}`) 30 | cb() 31 | } catch(err) { 32 | cb(err) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-proxy-module/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["latest", "stage-2"], 3 | "plugins": [ "transform-runtime" ] 4 | } 5 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-proxy-module/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "7" 4 | - "6" 5 | - "5" 6 | before_install: 7 | # Repo for newer Node.js versions 8 | - curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - 9 | # Repo for Yarn 10 | - sudo apt-key adv --keyserver pgp.mit.edu --recv D101F7899D41F3C3 11 | - echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list 12 | - sudo apt-get update -qq 13 | - sudo apt-get install -y -qq yarn 14 | cache: 15 | directories: 16 | - $HOME/.yarn-cache 17 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-proxy-module/bin.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | 'use strict'; 4 | 5 | require('./lib/cli').default() 6 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-proxy-module/gitignore: -------------------------------------------------------------------------------- 1 | # dependencies 2 | node_modules/ 3 | 4 | # testing 5 | coverage/ 6 | 7 | # production 8 | build/ 9 | staging/ 10 | 11 | # misc 12 | .DS_Store 13 | .env 14 | *.log 15 | *.log.* 16 | *.sublime-workspace 17 | *.suo 18 | *.user 19 | *.userosscache 20 | *.sln.docstates 21 | .*.swp 22 | .vscode/ 23 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-proxy-module/npmignore: -------------------------------------------------------------------------------- 1 | /src/ 2 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-proxy-module/src/__tests__/execute.test.js: -------------------------------------------------------------------------------- 1 | import execute from '../' 2 | 3 | describe('lib', () => { 4 | it('is a function', () => { 5 | expect(typeof execute).toBe('function') 6 | }) 7 | }) 8 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-proxy-module/src/cli.js: -------------------------------------------------------------------------------- 1 | import chalk from 'chalk' 2 | import yargs from 'yargs' 3 | import util from 'util' 4 | import { api } from '../' 5 | 6 | export default function cli (cb = (result) => { 7 | if(result instanceof Error) { 8 | console.error(`error occurred during execution => ${util.inspect(err)}`) 9 | process.exit(1) 10 | } else if(result === false || result.length === 0) { 11 | process.exit(1) 12 | } 13 | console.log(result) 14 | }) { 15 | const packageJson = require('../package.json') 16 | const name = packageJson.name.includes('/') ? packageJson.name.split('/')[1] : packageJson.name 17 | const argv = yargs 18 | .usage(chalk.green.bold(`Usage: ${name} [options]`)) 19 | .version(packageJson.version) 20 | .describe('verbose', 'Print debugging information.') 21 | .help('h') 22 | .alias('h', 'help') 23 | .demand(1) 24 | .argv 25 | const { _, ...opts } = argv 26 | return api(_, opts, cb) 27 | } 28 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-proxy-module/src/index.js: -------------------------------------------------------------------------------- 1 | import yargs from 'yargs' 2 | import chalk from 'chalk' 3 | 4 | const packageJson = require('package.json') 5 | 6 | export function api (args, opts, cb) { 7 | if(args.length !== 1) 8 | throw new Error(`${packageJson.name} requires exactly 1 command argument`) 9 | const [ arg ] = args 10 | return execute(arg, cb) 11 | } 12 | 13 | export default function execute(arg, cb) { 14 | if(cb) { 15 | _execute(arg, cb) 16 | } else { 17 | return new Promise((resolve, reject) => { 18 | _which(name, (result, ...rest) => { 19 | if(result instanceof Error) 20 | return reject(result) 21 | resolve(result, ...rest) 22 | }) 23 | }) 24 | } 25 | } 26 | 27 | function _execute (arg, cb) { 28 | try { 29 | console.log(`executing ${packageJson.name} with arg ${arg}`) 30 | cb() 31 | } catch(err) { 32 | cb(err) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-react-repo/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "7" 4 | - "6" 5 | - "5" 6 | cache: 7 | directories: 8 | - node_modules 9 | - $HOME/.yarn-cache 10 | before_install: 11 | # Repo for newer Node.js versions 12 | - curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - 13 | # Repo for Yarn 14 | - sudo apt-key adv --keyserver pgp.mit.edu --recv D101F7899D41F3C3 15 | - echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list 16 | - sudo apt-get update -qq 17 | - sudo apt-get install -y -qq yarn 18 | install: 19 | - yarn global add lerna@prerelease 20 | - yarn global add codecov@latest 21 | script: 22 | - lerna exec --concurrency=1 -- yarn 23 | - npm run coverage 24 | - codecov 25 | after_success: 26 | - bash <(curl -s https://codecov.io/bash) 27 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-react-repo/CHANGELOG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noderaider/modular/9abe14fbf1593ae09f6c1ee1f00b91ea15aaa942/packages/bin-utils/template/create-react-repo/CHANGELOG -------------------------------------------------------------------------------- /packages/bin-utils/template/create-react-repo/CONTRIBUTING.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noderaider/modular/9abe14fbf1593ae09f6c1ee1f00b91ea15aaa942/packages/bin-utils/template/create-react-repo/CONTRIBUTING.md -------------------------------------------------------------------------------- /packages/bin-utils/template/create-react-repo/gitignore: -------------------------------------------------------------------------------- 1 | # dependencies 2 | node_modules/ 3 | 4 | # testing 5 | coverage/ 6 | 7 | # production 8 | build/ 9 | staging/ 10 | 11 | # misc 12 | .DS_Store 13 | .env 14 | *.log 15 | *.log.* 16 | *.sublime-workspace 17 | *.suo 18 | *.user 19 | *.userosscache 20 | *.sln.docstates 21 | .*.swp 22 | .vscode/ 23 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-react-repo/lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "lerna": "2.0.0-beta.30", 3 | "version": "0.13.3" 4 | } 5 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-sass-module/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["latest", "stage-2"] 3 | } 4 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-sass-module/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "7" 4 | - "6" 5 | - "5" 6 | before_install: 7 | # Repo for newer Node.js versions 8 | - curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - 9 | # Repo for Yarn 10 | - sudo apt-key adv --keyserver pgp.mit.edu --recv D101F7899D41F3C3 11 | - echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list 12 | - sudo apt-get update -qq 13 | - sudo apt-get install -y -qq yarn 14 | cache: 15 | directories: 16 | - $HOME/.yarn-cache 17 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-sass-module/gitignore: -------------------------------------------------------------------------------- 1 | # dependencies 2 | node_modules/ 3 | 4 | # testing 5 | coverage/ 6 | 7 | # production 8 | build/ 9 | staging/ 10 | 11 | # misc 12 | .DS_Store 13 | .env 14 | *.log 15 | *.log.* 16 | *.sublime-workspace 17 | *.suo 18 | *.user 19 | *.userosscache 20 | *.sln.docstates 21 | .*.swp 22 | .vscode/ 23 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-sass-module/npmignore: -------------------------------------------------------------------------------- 1 | /src/ 2 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-sass-module/src/config.js: -------------------------------------------------------------------------------- 1 | import path from 'path' 2 | 3 | export const noop = () => {} 4 | export const IS_HOT = process.env.NODE_ENV === 'hot' 5 | export const IS_DEV = process.env.NODE_ENV !== 'production' 6 | export const IS_BROWSER = typeof window === 'object' 7 | 8 | export const baseUrl = '/' 9 | 10 | export const log =/* !IS_DEV && IS_BROWSER ?*/ ({ name: 'css-module', trace: noop, debug: noop, info: noop, warn: noop, error: noop, fatal: noop }) /*: createLogger({ name, level: 'info' })*/ 11 | 12 | export const __rootname = IS_BROWSER ? '/' : __dirname 13 | export const resolveRoot = (...args) => IS_BROWSER ? `${__rootname}${args.join('/')}` : path.resolve(__rootname, ...args) 14 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-sass-module/src/lib/index.js: -------------------------------------------------------------------------------- 1 | import styles from './styles.css' 2 | export default styles 3 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-sass-module/src/lib/styles.css: -------------------------------------------------------------------------------- 1 | /** mobile */ @custom-media --mobile only screen and (width < 48em); 2 | /** desktop */ @custom-media --desktop only screen and (width >= 48em); 3 | 4 | /* ===== == = === 20em (320px) === = == ===== */ 5 | @custom-media --xs-screen only screen and (width >= 20em); 6 | 7 | /* ===== == = === 30em (480px) === = == ===== */ 8 | @custom-media --sm-screen only screen and (width >= 30em); 9 | 10 | /* ===== == = === 37.5em (600px) === = == ===== */ 11 | @custom-media --md-screen only screen and (width >= 37.5em); 12 | 13 | /* ===== == = === 48em (768px) === = == ===== */ 14 | @custom-media --lg-screen only screen and (width >= 48em); 15 | 16 | /* ===== == = === 56.25em (900px) === = == ===== */ 17 | @custom-media --xl-screen only screen and (width >= 56.25em); 18 | 19 | /* ===== == = === 68.75em (1100px) === = == ===== */ 20 | @custom-media --2x-screen only screen and (width >= 68.75em); 21 | 22 | /* ===== == = === 81.25em (1300px) === = == ===== */ 23 | @custom-media --3x-screen only screen and (width >= 81.25em); 24 | 25 | :root { 26 | --shadow: { 27 | /* offset-x | offset-y | blur-radius | spread-radius | color */ 28 | box-shadow: 2px 2px 3px 1px rgb(200, 200, 200); 29 | } 30 | } 31 | 32 | /** CSS MODULES READY TO GO */ 33 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-sass-module/src/webpack.config.js: -------------------------------------------------------------------------------- 1 | import 'babel-polyfill' 2 | import make from './webpack/make' 3 | export default make('lib') 4 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-sass-module/src/webpack/devtool.js: -------------------------------------------------------------------------------- 1 | import { server } from '../config.js' 2 | 3 | export default name => { 4 | return 'cheap-module-source-map' 5 | switch(name) { 6 | case 'lib': 7 | return '#eval' 8 | case 'server': 9 | return 'source-map' 10 | } 11 | if(process.env.NODE_ENV === 'hot') 12 | return '#eval' 13 | } 14 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-sass-module/src/webpack/entry.js: -------------------------------------------------------------------------------- 1 | import { baseUrl } from '../config.js' 2 | import fs from 'fs' 3 | import path from 'path' 4 | 5 | const getHotUrl = name => { 6 | const path = `${baseUrl}/__webpack_hmr` 7 | const timeout = 2000 8 | const overlay = true 9 | const reload = true 10 | const noInfo = false 11 | const quiet = false 12 | return 'webpack-hot-middleware/client' //?path=${path}&timeout=${timeout}&overlay=${overlay}&reload=${reload}&noInfo=${noInfo}&quiet=${quiet}` 13 | } 14 | 15 | function maybeHotEntry(name, ...entries) { 16 | if(process.env.NODE_ENV === 'hot') { 17 | return [ getHotUrl(name), ...entries ] 18 | } 19 | return entries[0] 20 | } 21 | 22 | export default name => { 23 | switch(name) { 24 | case 'lib': 25 | return { 'lib/index': './src/lib' } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-sass-module/src/webpack/externals.js: -------------------------------------------------------------------------------- 1 | import { dependencyNames } from '../config' 2 | 3 | export default name => { 4 | 5 | /* 6 | switch(name) { 7 | case 'server': 8 | return dependencyNames.reduce((externals, name) => ({ ...externals, [name]: true }), {}) 9 | case 'vendor': 10 | return { 'react/lib/ReactCSSTransitionGroup': 'ReactCSSTransitionGroup' 11 | , 'react': 'React' 12 | , 'react-dom': 'ReactDOM' 13 | } 14 | } 15 | */ 16 | } 17 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-sass-module/src/webpack/make.js: -------------------------------------------------------------------------------- 1 | import { __rootname } from '../config' 2 | import getDevTool from './devtool' 3 | import getTarget from './target' 4 | import getEntry from './entry' 5 | import getOutput from './output' 6 | import getResolve from './resolve' 7 | import getResolveLoader from './resolveLoader' 8 | import getModule from './module' 9 | import getExternals from './externals' 10 | import getPlugins from './plugins' 11 | import getPostcss from './postcss' 12 | import getNode from './node' 13 | 14 | export default function make(name) { 15 | if(typeof name !== 'string') 16 | throw new Error('Name is required.') 17 | return { name 18 | , context: __rootname 19 | , cache: true 20 | , target: getTarget(name) 21 | , devtool: getDevTool(name) 22 | , entry: getEntry(name) 23 | , output: getOutput(name) 24 | , resolve: getResolve(name) 25 | , resolveLoader: getResolveLoader(name) 26 | , module: getModule(name) 27 | , externals: getExternals(name) 28 | , plugins: getPlugins(name) 29 | , node: getNode(name) 30 | , postcss: getPostcss(name) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-sass-module/src/webpack/module/index.js: -------------------------------------------------------------------------------- 1 | import getLoaders from './loaders' 2 | import getPostLoaders from './postLoaders' 3 | import getNoParse from './noParse' 4 | 5 | export default name => ({ loaders: getLoaders(name) 6 | , postLoaders: getPostLoaders(name) 7 | , noParse: getNoParse(name) 8 | }) 9 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-sass-module/src/webpack/module/noParse.js: -------------------------------------------------------------------------------- 1 | export default name => ([]) 2 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-sass-module/src/webpack/module/postLoaders.js: -------------------------------------------------------------------------------- 1 | export default name => ([]) 2 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-sass-module/src/webpack/node.js: -------------------------------------------------------------------------------- 1 | export default name => { 2 | switch(name) { 3 | case 'lib': 4 | case 'server': 5 | return { __filename: true, __dirname: true, console: true, net: true } 6 | default: 7 | return { fs: 'empty', 'graceful-fs': 'empty' } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-sass-module/src/webpack/output.js: -------------------------------------------------------------------------------- 1 | import { libName, baseUrl, resolveRoot } from '../config.js' 2 | import { join } from 'path' 3 | 4 | const getPath = name => { 5 | switch(name) { 6 | case 'lib': 7 | return resolveRoot('.') 8 | case 'server': 9 | return resolveRoot('lib', 'app') 10 | case 'static': 11 | return resolveRoot('public', 'assets') 12 | default: 13 | return resolveRoot('public', 'assets') 14 | } 15 | } 16 | 17 | const getPublicPath = name => { 18 | switch(name) { 19 | case 'lib': 20 | return '/' 21 | case 'server': 22 | return '/lib/app' 23 | case 'static': 24 | return `${baseUrl}/assets/` 25 | default: 26 | return `${baseUrl}/assets/` 27 | } 28 | } 29 | 30 | 31 | const getLibrary = name => { 32 | return libName 33 | } 34 | 35 | const getLibraryTarget = name => { 36 | switch(name) { 37 | case 'lib': 38 | return 'umd' 39 | case 'server': 40 | return 'commonjs2' 41 | } 42 | } 43 | 44 | const getFilename = name => '[name].js' 45 | const getChunkFilename = name => '[name].js' 46 | const getSourceMapFilename = name => '[file].map' 47 | const getDevtoolModuleFilenameTemplate = name => 'file:///[absolute-resource-path]' 48 | const getHotUpdateChunkFilename = name => '[id].[hash].hot-update.js' 49 | const getHotUpdateMainFilename = name => '[hash].hot-update.json' 50 | const getCrossOriginLoading = name => 'anonymous' 51 | 52 | 53 | 54 | export default name => { 55 | let output = { path: getPath(name) 56 | , library: getLibrary(name) 57 | , libraryTarget: getLibraryTarget(name) 58 | , pathinfo: process.env.NODE_ENV === 'hot' 59 | , publicPath: getPublicPath(name) 60 | , filename: getFilename(name) 61 | , chunkFilename: getChunkFilename(name) 62 | , crossOriginLoading: getCrossOriginLoading(name) 63 | //, devtoolModuleFilenameTemplate: getDevtoolModuleFilenameTemplate(name) 64 | //, sourceMapFilename: getSourceMapFilename(name) 65 | //, hotUpdateChunkFilename: getHotUpdateChunkFilename(name) 66 | //, hotUpdateMainFilename: getHotUpdateMainFilename(name) 67 | } 68 | console.warn('OUTPUT', JSON.stringify(output, null, 2)) 69 | return output 70 | } 71 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-sass-module/src/webpack/postcss.js: -------------------------------------------------------------------------------- 1 | import postcssModules from 'postcss-modules' 2 | import postcssImport from 'postcss-import' 3 | import postcssUrl from 'postcss-url' 4 | import postcssCssnext from 'postcss-cssnext' 5 | import postcssFontMagician from 'postcss-font-magician' 6 | import postcssBrowserReporter from 'postcss-browser-reporter' 7 | import postcssReporter from 'postcss-reporter' 8 | 9 | import { IS_DEV } from '../config' 10 | 11 | export default name => { 12 | return webpack => { 13 | 14 | const prodPostcss = [ postcssImport({ addDependencyTo: webpack }) 15 | , postcssUrl( { url: 'inline' 16 | //, basePath: '../src/app' 17 | //, assetsPath: '../images' 18 | }) 19 | , postcssCssnext() 20 | , postcssFontMagician() 21 | /* 22 | , postcssModules( { scopeBehaviour: 'global' 23 | } ) 24 | */ 25 | ] 26 | if(!IS_DEV) 27 | return prodPostcss 28 | 29 | const messagesStyle = { color: 'rgb(255, 255, 255)' 30 | , 'background-color': 'rgb(255, 100, 100)' 31 | , position: 'fixed' 32 | , 'font-family': 'Lato' 33 | , 'z-index': 1000000 34 | , top: '70px' 35 | , width: '500px' 36 | , 'margin-left': 'auto' 37 | , 'margin-right': 'auto' 38 | } 39 | return [ ...prodPostcss 40 | , postcssBrowserReporter({ styles: messagesStyle }) 41 | , postcssReporter() 42 | ] 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-sass-module/src/webpack/resolve/alias.js: -------------------------------------------------------------------------------- 1 | import { resolveRoot } from '../../config.js' 2 | import { resolve } from 'path' 3 | 4 | export const configPath = resolveRoot('./config.js') 5 | export const libFolder = resolveRoot('./src/lib') 6 | 7 | export default name => { 8 | return { 'config': configPath 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-sass-module/src/webpack/resolve/index.js: -------------------------------------------------------------------------------- 1 | import { __rootname, resolveRoot } from '../../config.js' 2 | import getAlias from './alias' 3 | 4 | export default name => { 5 | return { root: [ __rootname ] 6 | , alias: getAlias(name) 7 | , fallback: resolveRoot('node_modules') 8 | , extensions: [ '', '.jsx', '.js', '.json' ] 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-sass-module/src/webpack/resolveLoader.js: -------------------------------------------------------------------------------- 1 | import { resolveRoot } from '../config.js' 2 | 3 | export default name => { 4 | return { root: resolveRoot('node_modules') 5 | , fallback: resolveRoot('node_modules') 6 | , extensions: [ '', '.jsx', '.js', '.json' ] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-sass-module/src/webpack/target.js: -------------------------------------------------------------------------------- 1 | export default name => { 2 | switch(name) { 3 | case 'lib': 4 | case 'server': 5 | return 'node' 6 | default: 7 | return 'web' 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-umd-module/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ "latest", "stage-0" ], 3 | "plugins": [ "transform-runtime" ] 4 | } 5 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-umd-module/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "babel-eslint", 3 | "plugins": ["babel", "react", "flowtype"], 4 | "parserOptions": { 5 | "ecmaVersion": 2017, 6 | "sourceType": "module", 7 | "ecmaFeatures": { 8 | "jsx": true, 9 | "modules": true, 10 | "blockBindings": true, 11 | "defaultParams": true, 12 | "forOf": true, 13 | "generators": true, 14 | "objectLiteralComputedProperties": true, 15 | "objectLiteralDuplicateProperties": false, 16 | "objectLiteralShorthandMethods": true, 17 | "objectLiteralShorthandProperties": true, 18 | "templateStrings": true, 19 | "experimentalObjectRestSpread": true 20 | } 21 | }, 22 | "rules": { 23 | "quotes": [2, "single"], 24 | "strict": [2, "never"], 25 | "semi": [2, "never"], 26 | "brace-style": [2, "1tbs", { 27 | "allowSingleLine": true 28 | }], 29 | "comma-style": ["error", "first"], 30 | "comma-dangle": [2, "never"], 31 | "no-dupe-keys": 2, 32 | "no-ex-assign": 2, 33 | "no-extra-semi": 2, 34 | "valid-typeof": 2, 35 | "no-template-curly-in-string": "error", 36 | "symbol-description": "error", 37 | "prefer-arrow-callback": ["error", {"allowNamedFunctions": true}], 38 | 39 | "babel/generator-star-spacing": 1, 40 | "babel/object-shorthand": 1, 41 | "babel/arrow-parens": 1, 42 | "babel/no-await-in-loop": 1, 43 | "babel/flow-object-type": [ "error", "comma" ], 44 | "babel/func-params-comma-dangle": 1, 45 | 46 | "react/jsx-uses-react": 2, 47 | "react/jsx-uses-vars": 2, 48 | "react/react-in-jsx-scope": 2, 49 | 50 | "flowtype/define-flow-type": 1, 51 | "flowtype/require-parameter-type": 1, 52 | "flowtype/require-return-type": [ 53 | 1, 54 | "always", 55 | { 56 | "annotateUndefined": "never" 57 | } 58 | ], 59 | "flowtype/space-after-type-colon": [ 60 | 1, 61 | "always" 62 | ], 63 | "flowtype/space-before-type-colon": [ 64 | 1, 65 | "never" 66 | ], 67 | "flowtype/type-id-match": [ 68 | 1, 69 | "^([A-Z]{1,3}[a-z0-9]+)+Type$" 70 | ], 71 | "flowtype/use-flow-type": 1, 72 | "flowtype/valid-syntax": 1 73 | }, 74 | "settings": { 75 | "flowtype": { 76 | "onlyFilesWithFlowAnnotation": true 77 | } 78 | }, 79 | "env": { 80 | "es6": true, 81 | "browser": true, 82 | "node": true 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-umd-module/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "7" 4 | - "6" 5 | - "5" 6 | before_install: 7 | # Repo for newer Node.js versions 8 | - curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - 9 | # Repo for Yarn 10 | - sudo apt-key adv --keyserver pgp.mit.edu --recv D101F7899D41F3C3 11 | - echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list 12 | - sudo apt-get update -qq 13 | - sudo apt-get install -y -qq yarn 14 | cache: 15 | directories: 16 | - $HOME/.yarn-cache 17 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-umd-module/gitignore: -------------------------------------------------------------------------------- 1 | # dependencies 2 | node_modules/ 3 | 4 | # testing 5 | coverage/ 6 | 7 | # production 8 | build/ 9 | staging/ 10 | 11 | # misc 12 | .DS_Store 13 | .env 14 | *.log 15 | *.log.* 16 | *.sublime-workspace 17 | *.suo 18 | *.user 19 | *.userosscache 20 | *.sln.docstates 21 | .*.swp 22 | .vscode/ 23 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-umd-module/npmignore: -------------------------------------------------------------------------------- 1 | /src/ 2 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-umd-module/rollup.config.js: -------------------------------------------------------------------------------- 1 | import babel from 'rollup-plugin-babel' 2 | import commonjs from 'rollup-plugin-commonjs' 3 | import nodeResolve from 'rollup-plugin-node-resolve' 4 | 5 | export default ( 6 | { entry: 'src/index.js' 7 | , targets: [ { dest: 'dist/bundle.umd.js', format: 'umd' } 8 | , { dest: 'dist/bundle.es.js', format: 'es' } 9 | ] 10 | , moduleName: require('./package.json').name.split('-').map((x, i) => i === 0 ? x : `${x[0]}${x.slice(1)}`).join('') 11 | , plugins: [ babel({ babelrc: false 12 | , exclude: 'node_modules/**' 13 | , presets: [ [ 'es2015', { modules: false } ], 'stage-2' ] 14 | , plugins: [ 'transform-runtime' ] 15 | , runtimeHelpers: true 16 | }) 17 | , nodeResolve({ jsnext: true, main: true }) 18 | , commonjs({ include: 'node_modules/**' }) 19 | ] 20 | } 21 | ) 22 | l 23 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-umd-module/src/__tests__/index.test.js: -------------------------------------------------------------------------------- 1 | import lib from '../' 2 | 3 | describe('lib', () => { 4 | it('is a function', () => { 5 | expect(typeof lib).toBe('function') 6 | }) 7 | }) 8 | -------------------------------------------------------------------------------- /packages/bin-utils/template/create-umd-module/src/index.js: -------------------------------------------------------------------------------- 1 | export default function () { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /packages/create-cli-module/README.md: -------------------------------------------------------------------------------- 1 | # create-cli-module 2 | 3 | **Unofficial counterpart to create-react-app to allow quick scaffolding of a CLI module package.** 4 | 5 | [![NPM](https://nodei.co/npm/create-cli-module.png?stars=true&downloads=true)](https://nodei.co/npm/create-cli-module/) 6 | 7 | ## Install 8 | 9 | `npm i -S create-cli-module` 10 | 11 | ## In active development, review the unit tests until documentation is added. 12 | -------------------------------------------------------------------------------- /packages/create-cli-module/bin.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * Copyright (c) 2015-present, Facebook, Inc. 5 | * All rights reserved. 6 | * 7 | * This source code is licensed under the BSD-style license found in the 8 | * LICENSE file in the root directory of this source tree. An additional grant 9 | * of patent rights can be found in the PATENTS file in the same directory. 10 | * 11 | * NOTE: This package was inspired by and partially copied from Facebook's create-react-app but is not associated with Facebook in any way. 12 | */ 13 | 14 | 'use strict'; 15 | 16 | require('./')(); 17 | -------------------------------------------------------------------------------- /packages/create-cli-module/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | * NOTE: This package was inspired by and partially copied from Facebook's create-react-app but is not associated with Facebook in any way. 10 | */ 11 | 12 | 'use strict'; 13 | 14 | module.exports = require('create-package').default(require('./package.json')); 15 | -------------------------------------------------------------------------------- /packages/create-cli-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "create-cli-module", 3 | "version": "0.15.0", 4 | "description": "Unofficial companion to create-react-app.", 5 | "files": [ 6 | "bin.js", 7 | "index.js" 8 | ], 9 | "bin": "bin.js", 10 | "main": "index.js", 11 | "keywords": [ 12 | "create-react-app", 13 | "modular", 14 | "css", 15 | "modules", 16 | "packages" 17 | ], 18 | "dependencies": { 19 | "create-package": "^0.15.0" 20 | }, 21 | "author": "Cole Chamberlain (https://github.com/cchamberlain)", 22 | "bugs": { 23 | "url": "https://github.com/noderaider/modular/issues" 24 | }, 25 | "homepage": "https://noderaider.js.org/create-css-module", 26 | "license": "BSD-3-Clause", 27 | "repository": { 28 | "type": "git", 29 | "url": "git+https://github.com/noderaider/modular.git" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /packages/create-component-module/README.md: -------------------------------------------------------------------------------- 1 | # create-component-module 2 | 3 | **Unofficial counterpart to create-react-app to allow quick scaffolding of React component module packages.** 4 | 5 | [![NPM](https://nodei.co/npm/create-component-module.png?stars=true&downloads=true)](https://nodei.co/npm/create-component-module/) 6 | 7 | ## Install 8 | 9 | `npm i -S create-component-module` 10 | 11 | ## In active development, review the unit tests until documentation is added. 12 | -------------------------------------------------------------------------------- /packages/create-component-module/bin.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * Copyright (c) 2015-present, Facebook, Inc. 5 | * All rights reserved. 6 | * 7 | * This source code is licensed under the BSD-style license found in the 8 | * LICENSE file in the root directory of this source tree. An additional grant 9 | * of patent rights can be found in the PATENTS file in the same directory. 10 | * 11 | * NOTE: This package was inspired by and partially copied from Facebook's create-react-app but is not associated with Facebook in any way. 12 | */ 13 | 14 | 'use strict'; 15 | 16 | require('./')(); 17 | -------------------------------------------------------------------------------- /packages/create-component-module/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | * NOTE: This package was inspired by and partially copied from Facebook's create-react-app but is not associated with Facebook in any way. 10 | */ 11 | 12 | 'use strict'; 13 | 14 | module.exports = require('create-package').default(require('./package.json')); 15 | -------------------------------------------------------------------------------- /packages/create-component-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "create-component-module", 3 | "version": "0.15.0", 4 | "description": "Unofficial companion to create-react-app.", 5 | "files": [ 6 | "bin.js", 7 | "index.js" 8 | ], 9 | "bin": "bin.js", 10 | "main": "index.js", 11 | "keywords": [ 12 | "create-react-app", 13 | "modular", 14 | "css", 15 | "modules", 16 | "packages" 17 | ], 18 | "dependencies": { 19 | "create-package": "^0.15.0" 20 | }, 21 | "author": "Cole Chamberlain (https://github.com/cchamberlain)", 22 | "bugs": { 23 | "url": "https://github.com/noderaider/modular/issues" 24 | }, 25 | "homepage": "https://noderaider.js.org/create-component-module", 26 | "license": "BSD-3-Clause", 27 | "repository": { 28 | "type": "git", 29 | "url": "git+https://github.com/noderaider/modular.git" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /packages/create-css-module/README.md: -------------------------------------------------------------------------------- 1 | # create-css-module 2 | 3 | **Unofficial counterpart to create-react-app to allow quick scaffolding of CSS module packages.** 4 | 5 | [![NPM](https://nodei.co/npm/create-css-module.png?stars=true&downloads=true)](https://nodei.co/npm/create-css-module/) 6 | 7 | ## Install 8 | 9 | `npm i -S create-css-module` 10 | 11 | ## In active development, review the unit tests until documentation is added. 12 | -------------------------------------------------------------------------------- /packages/create-css-module/bin.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * Copyright (c) 2015-present, Facebook, Inc. 5 | * All rights reserved. 6 | * 7 | * This source code is licensed under the BSD-style license found in the 8 | * LICENSE file in the root directory of this source tree. An additional grant 9 | * of patent rights can be found in the PATENTS file in the same directory. 10 | * 11 | * NOTE: This package was inspired by and partially copied from Facebook's create-react-app but is not associated with Facebook in any way. 12 | */ 13 | 14 | 'use strict'; 15 | 16 | require('./')(); 17 | -------------------------------------------------------------------------------- /packages/create-css-module/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | * NOTE: This package was inspired by and partially copied from Facebook's create-react-app but is not associated with Facebook in any way. 10 | */ 11 | 12 | 'use strict'; 13 | 14 | module.exports = require('create-package').default(require('./package.json')); 15 | -------------------------------------------------------------------------------- /packages/create-css-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "create-css-module", 3 | "version": "0.15.0", 4 | "description": "Unofficial companion to create-react-app.", 5 | "files": [ 6 | "bin.js", 7 | "index.js" 8 | ], 9 | "bin": "bin.js", 10 | "main": "index.js", 11 | "keywords": [ 12 | "create-react-app", 13 | "modular", 14 | "css", 15 | "modules", 16 | "packages" 17 | ], 18 | "dependencies": { 19 | "create-package": "^0.15.0" 20 | }, 21 | "author": "Cole Chamberlain (https://github.com/cchamberlain)", 22 | "bugs": { 23 | "url": "https://github.com/noderaider/modular/issues" 24 | }, 25 | "homepage": "https://noderaider.js.org/create-css-module", 26 | "license": "BSD-3-Clause", 27 | "repository": { 28 | "type": "git", 29 | "url": "git+https://github.com/noderaider/modular.git" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /packages/create-deploy-module/README.md: -------------------------------------------------------------------------------- 1 | # create-deploy-module 2 | 3 | **Unofficial counterpart to create-react-app to allow quick scaffolding of a module to handle webhook listening and deployment on a build / web server.** 4 | 5 | [![NPM](https://nodei.co/npm/create-deploy-module.png?stars=true&downloads=true)](https://nodei.co/npm/create-deploy-module/) 6 | 7 | ## Install 8 | 9 | `npm i -S create-deploy-module` 10 | 11 | ## In active development, review the unit tests until documentation is added. 12 | -------------------------------------------------------------------------------- /packages/create-deploy-module/bin.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * Copyright (c) 2015-present, Facebook, Inc. 5 | * All rights reserved. 6 | * 7 | * This source code is licensed under the BSD-style license found in the 8 | * LICENSE file in the root directory of this source tree. An additional grant 9 | * of patent rights can be found in the PATENTS file in the same directory. 10 | * 11 | * NOTE: This package was inspired by and partially copied from Facebook's create-react-app but is not associated with Facebook in any way. 12 | */ 13 | 14 | 'use strict'; 15 | 16 | require('./')(); 17 | -------------------------------------------------------------------------------- /packages/create-deploy-module/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | * NOTE: This package was inspired by and partially copied from Facebook's create-react-app but is not associated with Facebook in any way. 10 | */ 11 | 12 | 'use strict'; 13 | 14 | module.exports = require('create-package').default(require('./package.json')); 15 | -------------------------------------------------------------------------------- /packages/create-deploy-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "create-deploy-module", 3 | "version": "0.15.0", 4 | "description": "Unofficial companion to create-react-app.", 5 | "files": [ 6 | "bin.js", 7 | "index.js" 8 | ], 9 | "bin": "bin.js", 10 | "main": "index.js", 11 | "keywords": [ 12 | "create-react-app", 13 | "modular", 14 | "css", 15 | "modules", 16 | "packages" 17 | ], 18 | "dependencies": { 19 | "create-package": "^0.15.0" 20 | }, 21 | "author": "Cole Chamberlain (https://github.com/cchamberlain)", 22 | "bugs": { 23 | "url": "https://github.com/noderaider/modular/issues" 24 | }, 25 | "homepage": "https://noderaider.js.org/create-deploy-module", 26 | "license": "BSD-3-Clause", 27 | "repository": { 28 | "type": "git", 29 | "url": "git+https://github.com/noderaider/modular.git" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /packages/create-express-module/README.md: -------------------------------------------------------------------------------- 1 | # create-express-module 2 | 3 | **Unofficial counterpart to create-react-app to allow quick scaffolding of an express module.** 4 | 5 | [![NPM](https://nodei.co/npm/create-express-module.png?stars=true&downloads=true)](https://nodei.co/npm/create-express-module/) 6 | 7 | ## Install 8 | 9 | `npm i -S create-express-module` 10 | 11 | ## In active development, review the unit tests until documentation is added. 12 | -------------------------------------------------------------------------------- /packages/create-express-module/bin.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * Copyright (c) 2015-present, Facebook, Inc. 5 | * All rights reserved. 6 | * 7 | * This source code is licensed under the BSD-style license found in the 8 | * LICENSE file in the root directory of this source tree. An additional grant 9 | * of patent rights can be found in the PATENTS file in the same directory. 10 | * 11 | * NOTE: This package was inspired by and partially copied from Facebook's create-react-app but is not associated with Facebook in any way. 12 | */ 13 | 14 | 'use strict'; 15 | 16 | require('./')(); 17 | -------------------------------------------------------------------------------- /packages/create-express-module/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | * NOTE: This package was inspired by and partially copied from Facebook's create-react-app but is not associated with Facebook in any way. 10 | */ 11 | 12 | 'use strict'; 13 | 14 | module.exports = require('create-package').default(require('./package.json')); 15 | -------------------------------------------------------------------------------- /packages/create-express-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "create-express-module", 3 | "version": "0.15.0", 4 | "description": "Unofficial companion to create-react-app.", 5 | "files": [ 6 | "bin.js", 7 | "index.js" 8 | ], 9 | "bin": "bin.js", 10 | "main": "index.js", 11 | "keywords": [ 12 | "create-react-app", 13 | "modular", 14 | "css", 15 | "modules", 16 | "packages" 17 | ], 18 | "dependencies": { 19 | "create-package": "^0.15.0" 20 | }, 21 | "author": "Cole Chamberlain (https://github.com/cchamberlain)", 22 | "bugs": { 23 | "url": "https://github.com/noderaider/modular/issues" 24 | }, 25 | "homepage": "https://noderaider.js.org/create-express-module", 26 | "license": "BSD-3-Clause", 27 | "repository": { 28 | "type": "git", 29 | "url": "git+https://github.com/noderaider/modular.git" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /packages/create-jest-module/README.md: -------------------------------------------------------------------------------- 1 | # create-jest-module 2 | 3 | **Unofficial counterpart to create-react-app to allow quick scaffolding of a jest test module.** 4 | 5 | [![NPM](https://nodei.co/npm/create-jest-module.png?stars=true&downloads=true)](https://nodei.co/npm/create-jest-module/) 6 | 7 | ## Install 8 | 9 | `npm i -S create-jest-module` 10 | 11 | ## In active development, review the unit tests until documentation is added. 12 | -------------------------------------------------------------------------------- /packages/create-jest-module/bin.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * Copyright (c) 2015-present, Facebook, Inc. 5 | * All rights reserved. 6 | * 7 | * This source code is licensed under the BSD-style license found in the 8 | * LICENSE file in the root directory of this source tree. An additional grant 9 | * of patent rights can be found in the PATENTS file in the same directory. 10 | * 11 | * NOTE: This package was inspired by and partially copied from Facebook's create-react-app but is not associated with Facebook in any way. 12 | */ 13 | 14 | 'use strict'; 15 | 16 | require('./')(); 17 | -------------------------------------------------------------------------------- /packages/create-jest-module/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | * NOTE: This package was inspired by and partially copied from Facebook's create-react-app but is not associated with Facebook in any way. 10 | */ 11 | 12 | 'use strict'; 13 | 14 | module.exports = require('create-package').default(require('./package.json')); 15 | -------------------------------------------------------------------------------- /packages/create-jest-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "create-jest-module", 3 | "version": "0.15.0", 4 | "description": "Unofficial companion to create-react-app.", 5 | "files": [ 6 | "bin.js", 7 | "index.js" 8 | ], 9 | "bin": "bin.js", 10 | "main": "index.js", 11 | "keywords": [ 12 | "create-react-app", 13 | "modular", 14 | "css", 15 | "modules", 16 | "packages" 17 | ], 18 | "dependencies": { 19 | "create-package": "^0.10.2" 20 | }, 21 | "author": "Cole Chamberlain (https://github.com/cchamberlain)", 22 | "bugs": { 23 | "url": "https://github.com/noderaider/modular/issues" 24 | }, 25 | "homepage": "https://noderaider.js.org/create-component-module", 26 | "license": "BSD-3-Clause", 27 | "repository": { 28 | "type": "git", 29 | "url": "git+https://github.com/noderaider/modular.git" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /packages/create-koa-module/README.md: -------------------------------------------------------------------------------- 1 | # create-koa-module 2 | 3 | **Unofficial counterpart to create-react-app to allow quick modularing of CSS module packages.** 4 | 5 | [![NPM](https://nodei.co/npm/create-koa-module.png?stars=true&downloads=true)](https://nodei.co/npm/create-koa-module/) 6 | 7 | ## Install 8 | 9 | `npm i -S create-koa-module` 10 | 11 | ## In active development, review the unit tests until documentation is added. 12 | -------------------------------------------------------------------------------- /packages/create-koa-module/bin.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * Copyright (c) 2015-present, Facebook, Inc. 5 | * All rights reserved. 6 | * 7 | * This source code is licensed under the BSD-style license found in the 8 | * LICENSE file in the root directory of this source tree. An additional grant 9 | * of patent rights can be found in the PATENTS file in the same directory. 10 | * 11 | * NOTE: This package was inspired by and partially copied from Facebook's create-react-app but is not associated with Facebook in any way. 12 | */ 13 | 14 | 'use strict'; 15 | 16 | require('./')(); 17 | -------------------------------------------------------------------------------- /packages/create-koa-module/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | * NOTE: This package was inspired by and partially copied from Facebook's create-react-app but is not associated with Facebook in any way. 10 | */ 11 | 12 | 'use strict'; 13 | 14 | module.exports = require('create-package').default(require('./package.json')); 15 | -------------------------------------------------------------------------------- /packages/create-koa-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "create-koa-module", 3 | "version": "0.15.0", 4 | "description": "Unofficial companion to create-react-app.", 5 | "files": [ 6 | "bin.js", 7 | "index.js" 8 | ], 9 | "bin": "bin.js", 10 | "main": "index.js", 11 | "keywords": [ 12 | "create-react-app", 13 | "modular", 14 | "css", 15 | "modules", 16 | "packages" 17 | ], 18 | "dependencies": { 19 | "create-package": "^0.15.0" 20 | }, 21 | "author": "Cole Chamberlain (https://github.com/cchamberlain)", 22 | "bugs": { 23 | "url": "https://github.com/noderaider/modular/issues" 24 | }, 25 | "homepage": "https://noderaider.js.org/create-koa-module", 26 | "license": "BSD-3-Clause", 27 | "repository": { 28 | "type": "git", 29 | "url": "git+https://github.com/noderaider/modular.git" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /packages/create-package/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["latest", "stage-2"], 3 | "plugins": ["transform-runtime"] 4 | } 5 | -------------------------------------------------------------------------------- /packages/create-package/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "babel-eslint", 3 | "plugins": ["babel", "react", "flowtype"], 4 | "parserOptions": { 5 | "ecmaVersion": 2017, 6 | "sourceType": "module", 7 | "ecmaFeatures": { 8 | "jsx": true, 9 | "modules": true, 10 | "blockBindings": true, 11 | "defaultParams": true, 12 | "forOf": true, 13 | "generators": true, 14 | "objectLiteralComputedProperties": true, 15 | "objectLiteralDuplicateProperties": false, 16 | "objectLiteralShorthandMethods": true, 17 | "objectLiteralShorthandProperties": true, 18 | "templateStrings": true, 19 | "experimentalObjectRestSpread": true 20 | } 21 | }, 22 | "rules": { 23 | "quotes": [2, "single"], 24 | "strict": [2, "never"], 25 | "semi": [2, "never"], 26 | "brace-style": [2, "1tbs", { 27 | "allowSingleLine": true 28 | }], 29 | "comma-style": ["error", "first"], 30 | "comma-dangle": [2, "never"], 31 | "no-dupe-keys": 2, 32 | "no-ex-assign": 2, 33 | "no-extra-semi": 2, 34 | "valid-typeof": 2, 35 | "no-template-curly-in-string": "error", 36 | "symbol-description": "error", 37 | "class-methods-use-this": "error", 38 | "prefer-arrow-callback": ["error", {"allowNamedFunctions": true}], 39 | 40 | "babel/generator-star-spacing": 1, 41 | "babel/object-shorthand": 1, 42 | "babel/arrow-parens": 1, 43 | "babel/no-await-in-loop": 1, 44 | "babel/flow-object-type": [ "error", "comma" ], 45 | "babel/func-params-comma-dangle": 1, 46 | 47 | "react/jsx-uses-react": 2, 48 | "react/jsx-uses-vars": 2, 49 | "react/react-in-jsx-scope": 2, 50 | 51 | "flowtype/define-flow-type": 1, 52 | "flowtype/require-parameter-type": 1, 53 | "flowtype/require-return-type": [ 54 | 1, 55 | "always", 56 | { 57 | "annotateUndefined": "never" 58 | } 59 | ], 60 | "flowtype/space-after-type-colon": [ 61 | 1, 62 | "always" 63 | ], 64 | "flowtype/space-before-type-colon": [ 65 | 1, 66 | "never" 67 | ], 68 | "flowtype/type-id-match": [ 69 | 1, 70 | "^([A-Z]{1,3}[a-z0-9]+)+Type$" 71 | ], 72 | "flowtype/use-flow-type": 1, 73 | "flowtype/valid-syntax": 1 74 | }, 75 | "settings": { 76 | "flowtype": { 77 | "onlyFilesWithFlowAnnotation": true 78 | } 79 | }, 80 | "env": { 81 | "es6": true, 82 | "browser": true, 83 | "node": true 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /packages/create-package/README.md: -------------------------------------------------------------------------------- 1 | # create-package 2 | 3 | **Unofficial counterpart to create-react-app to allow quick modularing of lerna monorepos ready for `create-react-app` usage.** 4 | 5 | [![NPM](https://nodei.co/npm/create-package.png?stars=true&downloads=true)](https://nodei.co/npm/create-package/) 6 | 7 | ## Install 8 | 9 | `npm i -S create-package` 10 | 11 | ## In active development, review the unit tests until documentation is added. 12 | -------------------------------------------------------------------------------- /packages/create-package/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "create-package", 3 | "version": "0.15.0", 4 | "description": "Unofficial companion to create-react-app.", 5 | "main": "lib/index.js", 6 | "files": [ 7 | "lib", 8 | "README.md" 9 | ], 10 | "engines": { 11 | "node": ">=4" 12 | }, 13 | "keywords": [ 14 | "create-react-app", 15 | "modular", 16 | "packages" 17 | ], 18 | "scripts": { 19 | "start": "npm run build -- --watch", 20 | "prebuild": "rimraf lib", 21 | "build": "babel src -d . --ignore __tests__,__mocks__", 22 | "test": "jest", 23 | "preversion": "npm run build && npm run test" 24 | }, 25 | "dependencies": { 26 | "@raider/install": "^0.15.0", 27 | "babel-cli": "latest", 28 | "babel-plugin-transform-runtime": "latest", 29 | "babel-preset-latest": "latest", 30 | "babel-preset-stage-2": "latest", 31 | "chalk": "^1.1.1", 32 | "cross-spawn": "^4.0.0", 33 | "node-fetch": "^1.6.3", 34 | "path-exists": "^2.1.0", 35 | "semver": "^5.0.3", 36 | "yargs": "^6.3.0", 37 | "jest": "latest", 38 | "rimraf": "latest" 39 | }, 40 | "author": "Cole Chamberlain (https://github.com/cchamberlain)", 41 | "bugs": { 42 | "url": "https://github.com/noderaider/modular/issues" 43 | }, 44 | "homepage": "https://noderaider.js.org/create-package", 45 | "license": "BSD-3-Clause", 46 | "repository": { 47 | "type": "git", 48 | "url": "git+https://github.com/noderaider/modular.git" 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /packages/create-proxy-module/README.md: -------------------------------------------------------------------------------- 1 | # create-proxy-module 2 | 3 | **Unofficial counterpart to create-react-app to allow quick scaffolding of a reverse proxy module.** 4 | 5 | [![NPM](https://nodei.co/npm/create-proxy-module.png?stars=true&downloads=true)](https://nodei.co/npm/create-proxy-module/) 6 | 7 | ## Install 8 | 9 | `npm i -S create-proxy-module` 10 | 11 | ## In active development, review the unit tests until documentation is added. 12 | -------------------------------------------------------------------------------- /packages/create-proxy-module/bin.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * Copyright (c) 2015-present, Facebook, Inc. 5 | * All rights reserved. 6 | * 7 | * This source code is licensed under the BSD-style license found in the 8 | * LICENSE file in the root directory of this source tree. An additional grant 9 | * of patent rights can be found in the PATENTS file in the same directory. 10 | * 11 | * NOTE: This package was inspired by and partially copied from Facebook's create-react-app but is not associated with Facebook in any way. 12 | */ 13 | 14 | 'use strict'; 15 | 16 | require('./')(); 17 | -------------------------------------------------------------------------------- /packages/create-proxy-module/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | * NOTE: This package was inspired by and partially copied from Facebook's create-react-app but is not associated with Facebook in any way. 10 | */ 11 | 12 | 'use strict'; 13 | 14 | module.exports = require('create-package').default(require('./package.json')); 15 | -------------------------------------------------------------------------------- /packages/create-proxy-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "create-proxy-module", 3 | "version": "0.15.0", 4 | "description": "Unofficial companion to create-react-app.", 5 | "files": [ 6 | "bin.js", 7 | "index.js" 8 | ], 9 | "bin": "bin.js", 10 | "main": "index.js", 11 | "keywords": [ 12 | "create-react-app", 13 | "modular", 14 | "css", 15 | "modules", 16 | "packages" 17 | ], 18 | "dependencies": { 19 | "create-package": "^0.10.2" 20 | }, 21 | "author": "Cole Chamberlain (https://github.com/cchamberlain)", 22 | "bugs": { 23 | "url": "https://github.com/noderaider/modular/issues" 24 | }, 25 | "homepage": "https://noderaider.js.org/create-component-module", 26 | "license": "BSD-3-Clause", 27 | "repository": { 28 | "type": "git", 29 | "url": "git+https://github.com/noderaider/modular.git" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /packages/create-react-repo/README.md: -------------------------------------------------------------------------------- 1 | # create-react-repo 2 | 3 | **Unofficial counterpart to create-react-app to allow quick modularing of lerna monorepos ready for `create-react-app` usage.** 4 | 5 | [![NPM](https://nodei.co/npm/create-react-repo.png?stars=true&downloads=true)](https://nodei.co/npm/create-react-repo/) 6 | 7 | ## Install 8 | 9 | `npm i -S create-react-repo` 10 | 11 | ## In active development, review the unit tests until documentation is added. 12 | -------------------------------------------------------------------------------- /packages/create-react-repo/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * Copyright (c) 2015-present, Facebook, Inc. 5 | * All rights reserved. 6 | * 7 | * This source code is licensed under the BSD-style license found in the 8 | * LICENSE file in the root directory of this source tree. An additional grant 9 | * of patent rights can be found in the PATENTS file in the same directory. 10 | */ 11 | 12 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 13 | // /!\ DO NOT MODIFY THIS FILE /!\ 14 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 15 | // 16 | // create-react-package is installed globally on people's computers. This means 17 | // that it is extremely difficult to have them upgrade the version and 18 | // because there's only one global version installed, it is very prone to 19 | // breaking changes. 20 | // 21 | // The only job of create-react-package is to init the repository and then 22 | // forward all the commands to the local version of create-react-package. 23 | // 24 | // If you need to add a new command, please add it to the scripts/ folder. 25 | // 26 | // The only reason to modify this file is to add more warnings and 27 | // troubleshooting information for the `create-react-package` command. 28 | // 29 | // Do not make breaking changes! We absolutely don't want to have to 30 | // tell people to update their global version of create-react-package. 31 | // 32 | // Also be careful with new language features. 33 | // This file must work on Node 0.10+. 34 | // 35 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 36 | // /!\ DO NOT MODIFY THIS FILE /!\ 37 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 38 | 39 | 'use strict'; 40 | 41 | require('create-package').default('create-react-repo', require('./package.json').version); 42 | -------------------------------------------------------------------------------- /packages/create-react-repo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "create-react-repo", 3 | "version": "0.15.0", 4 | "description": "Unofficial companion to create-react-app.", 5 | "files": [ 6 | "index.js" 7 | ], 8 | "bin": { 9 | "create-react-repo": "./index.js" 10 | }, 11 | "dependencies": { 12 | "create-package": "^0.15.0" 13 | }, 14 | "devDependencies": { 15 | "babel-cli": "latest", 16 | "babel-preset-latest": "latest", 17 | "babel-preset-stage-2": "latest", 18 | "jest": "latest", 19 | "rimraf": "latest" 20 | }, 21 | "author": "Cole Chamberlain (https://github.com/cchamberlain)", 22 | "bugs": { 23 | "url": "https://github.com/noderaider/modular/issues" 24 | }, 25 | "homepage": "https://noderaider.js.org/create-react-repo", 26 | "license": "BSD-3-Clause", 27 | "repository": { 28 | "type": "git", 29 | "url": "git+https://github.com/noderaider/modular.git" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /packages/create-sass-module/README.md: -------------------------------------------------------------------------------- 1 | # create-sass-module 2 | 3 | **Unofficial counterpart to create-react-app to allow quick scaffolding of a sass package.** 4 | 5 | [![NPM](https://nodei.co/npm/create-sass-module.png?stars=true&downloads=true)](https://nodei.co/npm/create-sass-module/) 6 | 7 | ## Install 8 | 9 | `npm i -S create-sass-module` 10 | 11 | ## In active development, review the unit tests until documentation is added. 12 | -------------------------------------------------------------------------------- /packages/create-sass-module/bin.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * Copyright (c) 2015-present, Facebook, Inc. 5 | * All rights reserved. 6 | * 7 | * This source code is licensed under the BSD-style license found in the 8 | * LICENSE file in the root directory of this source tree. An additional grant 9 | * of patent rights can be found in the PATENTS file in the same directory. 10 | * 11 | * NOTE: This package was inspired by and partially copied from Facebook's create-react-app but is not associated with Facebook in any way. 12 | */ 13 | 14 | 'use strict'; 15 | 16 | require('./')(); 17 | -------------------------------------------------------------------------------- /packages/create-sass-module/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | * NOTE: This package was inspired by and partially copied from Facebook's create-react-app but is not associated with Facebook in any way. 10 | */ 11 | 12 | 'use strict'; 13 | 14 | module.exports = require('create-package').default(require('./package.json')); 15 | -------------------------------------------------------------------------------- /packages/create-sass-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "create-sass-module", 3 | "version": "0.15.0", 4 | "description": "Unofficial companion to create-react-app.", 5 | "files": [ 6 | "bin.js", 7 | "index.js" 8 | ], 9 | "bin": "bin.js", 10 | "main": "index.js", 11 | "keywords": [ 12 | "create-react-app", 13 | "modular", 14 | "css", 15 | "modules", 16 | "packages" 17 | ], 18 | "dependencies": { 19 | "create-package": "^0.15.0" 20 | }, 21 | "author": "Cole Chamberlain (https://github.com/cchamberlain)", 22 | "bugs": { 23 | "url": "https://github.com/noderaider/modular/issues" 24 | }, 25 | "homepage": "https://noderaider.js.org/create-sass-module", 26 | "license": "BSD-3-Clause", 27 | "repository": { 28 | "type": "git", 29 | "url": "git+https://github.com/noderaider/modular.git" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /packages/create-umd-module/README.md: -------------------------------------------------------------------------------- 1 | # create-umd-module 2 | 3 | **Unofficial counterpart to create-react-app to allow quick scaffolding of universal module definition (`UMD`) package with Rollup tree-shaking.** 4 | 5 | [![NPM](https://nodei.co/npm/create-umd-module.png?stars=true&downloads=true)](https://nodei.co/npm/create-umd-module/) 6 | 7 | ## Install 8 | 9 | `npm i -S create-umd-module` 10 | 11 | ## In active development, review the unit tests until documentation is added. 12 | -------------------------------------------------------------------------------- /packages/create-umd-module/bin.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * Copyright (c) 2015-present, Facebook, Inc. 5 | * All rights reserved. 6 | * 7 | * This source code is licensed under the BSD-style license found in the 8 | * LICENSE file in the root directory of this source tree. An additional grant 9 | * of patent rights can be found in the PATENTS file in the same directory. 10 | * 11 | * NOTE: This package was inspired by and partially copied from Facebook's create-react-app but is not associated with Facebook in any way. 12 | */ 13 | 14 | 'use strict'; 15 | 16 | require('./')(); 17 | -------------------------------------------------------------------------------- /packages/create-umd-module/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | * NOTE: This package was inspired by and partially copied from Facebook's create-react-app but is not associated with Facebook in any way. 10 | */ 11 | 12 | 'use strict'; 13 | 14 | module.exports = require('create-package').default(require('./package.json')); 15 | -------------------------------------------------------------------------------- /packages/create-umd-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "create-umd-module", 3 | "version": "0.15.0", 4 | "description": "Unofficial companion to create-react-app.", 5 | "files": [ 6 | "bin.js", 7 | "index.js" 8 | ], 9 | "bin": "bin.js", 10 | "main": "index.js", 11 | "keywords": [ 12 | "modular", 13 | "create-react-app", 14 | "modular", 15 | "modules", 16 | "packages" 17 | ], 18 | "dependencies": { 19 | "create-package": "^0.15.0" 20 | }, 21 | "author": "Cole Chamberlain (https://github.com/cchamberlain)", 22 | "bugs": { 23 | "url": "https://github.com/noderaider/modular/issues" 24 | }, 25 | "homepage": "https://noderaider.js.org/create-umd-module", 26 | "license": "BSD-3-Clause", 27 | "repository": { 28 | "type": "git", 29 | "url": "git+https://github.com/noderaider/modular.git" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /packages/cross/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["latest", "stage-2"] 3 | } 4 | -------------------------------------------------------------------------------- /packages/cross/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "babel-eslint", 3 | "plugins": ["babel", "react", "flowtype"], 4 | "parserOptions": { 5 | "ecmaVersion": 2017, 6 | "sourceType": "module", 7 | "ecmaFeatures": { 8 | "jsx": true, 9 | "modules": true, 10 | "blockBindings": true, 11 | "defaultParams": true, 12 | "forOf": true, 13 | "generators": true, 14 | "objectLiteralComputedProperties": true, 15 | "objectLiteralDuplicateProperties": false, 16 | "objectLiteralShorthandMethods": true, 17 | "objectLiteralShorthandProperties": true, 18 | "templateStrings": true, 19 | "experimentalObjectRestSpread": true 20 | } 21 | }, 22 | "rules": { 23 | "quotes": [2, "single"], 24 | "strict": [2, "never"], 25 | "semi": [2, "never"], 26 | "brace-style": [2, "1tbs", { 27 | "allowSingleLine": true 28 | }], 29 | "comma-style": ["error", "first"], 30 | "comma-dangle": [2, "never"], 31 | "no-dupe-keys": 2, 32 | "no-ex-assign": 2, 33 | "no-extra-semi": 2, 34 | "valid-typeof": 2, 35 | "no-template-curly-in-string": "error", 36 | "symbol-description": "error", 37 | "class-methods-use-this": "error", 38 | "prefer-arrow-callback": ["error", {"allowNamedFunctions": true}], 39 | 40 | "babel/generator-star-spacing": 1, 41 | "babel/object-shorthand": 1, 42 | "babel/arrow-parens": 1, 43 | "babel/no-await-in-loop": 1, 44 | "babel/flow-object-type": [ "error", "comma" ], 45 | "babel/func-params-comma-dangle": 1, 46 | 47 | "react/jsx-uses-react": 2, 48 | "react/jsx-uses-vars": 2, 49 | "react/react-in-jsx-scope": 2, 50 | 51 | "flowtype/define-flow-type": 1, 52 | "flowtype/require-parameter-type": 1, 53 | "flowtype/require-return-type": [ 54 | 1, 55 | "always", 56 | { 57 | "annotateUndefined": "never" 58 | } 59 | ], 60 | "flowtype/space-after-type-colon": [ 61 | 1, 62 | "always" 63 | ], 64 | "flowtype/space-before-type-colon": [ 65 | 1, 66 | "never" 67 | ], 68 | "flowtype/type-id-match": [ 69 | 1, 70 | "^([A-Z]{1,3}[a-z0-9]+)+Type$" 71 | ], 72 | "flowtype/use-flow-type": 1, 73 | "flowtype/valid-syntax": 1 74 | }, 75 | "settings": { 76 | "flowtype": { 77 | "onlyFilesWithFlowAnnotation": true 78 | } 79 | }, 80 | "env": { 81 | "es6": true, 82 | "browser": true, 83 | "node": true 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /packages/cross/.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | node_modules 5 | 6 | # testing 7 | coverage 8 | 9 | # production 10 | build 11 | 12 | # misc 13 | .DS_Store 14 | .env 15 | npm-debug.log 16 | -------------------------------------------------------------------------------- /packages/cross/.npmignore: -------------------------------------------------------------------------------- 1 | /src/ 2 | -------------------------------------------------------------------------------- /packages/cross/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "7" 4 | - "6" 5 | - "5" 6 | before_install: 7 | # Repo for newer Node.js versions 8 | - curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - 9 | # Repo for Yarn 10 | - sudo apt-key adv --keyserver pgp.mit.edu --recv D101F7899D41F3C3 11 | - echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list 12 | - sudo apt-get update -qq 13 | - sudo apt-get install -y -qq yarn 14 | cache: 15 | directories: 16 | - $HOME/.yarn-cache 17 | -------------------------------------------------------------------------------- /packages/cross/README.md: -------------------------------------------------------------------------------- 1 | # [@raider/cross](https://npmjs.com/package/@raider/cross) 2 | 3 | **Upgrade a repo / package to use unix style line endings (works on all platforms).** 4 | 5 | [![NPM](https://nodei.co/npm/cross.png?stars=true&downloads=true)](https://nodei.co/npm/cross/) 6 | 7 | ## CLI 8 | 9 | ```bash 10 | npm i -g @raider/cross@latest 11 | 12 | cross [repo/path] 13 | ``` 14 | 15 | @raider/cross will prompt user for confirmation before doing anything. 16 | 17 | ## package.json 18 | 19 | ```json 20 | { "scripts": { 21 | "prepublish": "cross" 22 | }, 23 | "devDependencies": { 24 | "@raider/cross": "latest" 25 | } 26 | } 27 | ``` 28 | 29 | ## API 30 | 31 | ```js 32 | import cross from '@raider/cross' 33 | 34 | cross(process.cwd(), (err) => { 35 | if(err) 36 | console.error(err) 37 | }) 38 | ``` 39 | 40 | **omit the callback to return a promise** 41 | 42 | ```js 43 | cross(__dirname) 44 | .then(() => console.log('DONE')) 45 | .catch((err) => console.error(err)) 46 | ``` 47 | 48 | **async / await** 49 | 50 | ```js 51 | (async function () { 52 | try { 53 | await cross(undefined) // defaults to process.cwd() 54 | console.log('DONE') 55 | } catch (err) { 56 | console.error(err) 57 | } 58 | }) 59 | ``` 60 | 61 | 62 | `@raider/cross` is tested and made to work cross-platform. 63 | -------------------------------------------------------------------------------- /packages/cross/__mocks__/cross-spawn.js: -------------------------------------------------------------------------------- 1 | export default function spawn (command, args, opts) { 2 | const cbMap = new Map() 3 | const on = (event, cb) => { 4 | cbMap.set(event, cb) 5 | } 6 | const stream = ( 7 | { on 8 | } 9 | ) 10 | const stdout = ( 11 | { pipe: () => { 12 | const executable = args[0] 13 | const result = ['npm', 'node'].includes(executable) ? `/usr/bin/${executable}` : '' 14 | if(result) { 15 | result.split('/').forEach((chunk, i) => { 16 | setTimeout(() => { 17 | cbMap.get('data')(`${i > 0 ? '/' : ''}${chunk}`) 18 | }, (i + 1) * 20) 19 | }) 20 | } 21 | setTimeout(() => { 22 | cbMap.get('end')() 23 | }, 200) 24 | return stream 25 | } 26 | } 27 | ) 28 | 29 | return { stdout } 30 | } 31 | -------------------------------------------------------------------------------- /packages/cross/bin.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | 'use strict'; 4 | 5 | require('./lib/cli').default() 6 | -------------------------------------------------------------------------------- /packages/cross/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@raider/cross", 3 | "description": "Fixes common cross-platform issues with repos / packages.", 4 | "version": "0.15.0", 5 | "bin": "bin.js", 6 | "main": "lib/index.js", 7 | "files": [ 8 | "bin.js", 9 | "lib" 10 | ], 11 | "scripts": { 12 | "start": "npm run build -- --watch", 13 | "prebuild": "rimraf lib", 14 | "build": "babel src -d lib --ignore __tests__,__mocks__", 15 | "test": "jest", 16 | "preversion": "run-s test build" 17 | }, 18 | "dependencies": { 19 | "bin-utils": "^0.15.0", 20 | "cli-prompt": "latest", 21 | "@raider/dos2unix": "latest", 22 | "fs-extra": "latest", 23 | "ncp": "latest", 24 | "rimraf": "latest", 25 | "yargs": "latest" 26 | }, 27 | "devDependencies": { 28 | "babel-cli": "latest", 29 | "babel-core": "latest", 30 | "babel-eslint": "latest", 31 | "babel-loader": "latest", 32 | "babel-plugin-transform-runtime": "latest", 33 | "babel-preset-latest": "latest", 34 | "babel-preset-stage-2": "latest", 35 | "eslint": "latest", 36 | "eslint-plugin-babel": "latest", 37 | "eslint-plugin-react": "latest", 38 | "invariant": "^2.2.1", 39 | "npm-run-all": "latest", 40 | "rewire": "latest" 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /packages/cross/src/cli.js: -------------------------------------------------------------------------------- 1 | import chalk from 'chalk' 2 | import yargs from 'yargs' 3 | import util from 'util' 4 | import { api } from '../' 5 | import prompt from 'cli-prompt' 6 | 7 | export default function cli (cb = (result) => { 8 | if(result instanceof Error) { 9 | console.error(`error occurred during execution => ${util.inspect(result)}`) 10 | process.exit(1) 11 | } else if(result === false) { 12 | process.exit(1) 13 | } 14 | if(result) 15 | console.log(result) 16 | }) { 17 | const packageJson = require('../package.json') 18 | const name = packageJson.name.includes('/') ? packageJson.name.split('/')[1] : packageJson.name 19 | const argv = yargs 20 | .usage(chalk.green.bold(`Usage: ${name} [repo/path] [options]`)) 21 | .version(packageJson.version) 22 | .describe('verbose', 'Print debugging information.') 23 | .help('h') 24 | .alias('h', 'help') 25 | .argv 26 | const { _, ...opts } = argv 27 | const [ _path = process.cwd() ] = _ 28 | prompt( `${packageJson.name} will upgrade ${chalk.cyan(_path)} recursively => proceed? [${chalk.green('y')}${chalk.red('N')}]` 29 | , (val) => { 30 | if(val === 'y') { 31 | api([ _path ], opts, cb) 32 | } else { 33 | console.log('\u270C') 34 | process.exit(0) 35 | } 36 | } 37 | , (err) => { 38 | console.error(err) 39 | process.exit(1) 40 | } 41 | ) 42 | } 43 | -------------------------------------------------------------------------------- /packages/cross/src/index.js: -------------------------------------------------------------------------------- 1 | import yargs from 'yargs' 2 | import chalk from 'chalk' 3 | import { dos2unix } from '@raider/dos2unix' 4 | import invariant from 'invariant' 5 | 6 | export function api (args, opts, cb) { 7 | const [ path ] = args 8 | return cross(path, cb) 9 | } 10 | 11 | export default function cross(path = process.cwd(), cb) { 12 | if(cb) { 13 | _cross(path, cb) 14 | } else { 15 | return new Promise((resolve, reject) => { 16 | _cross(path, (result) => { 17 | if(result instanceof Error) 18 | return reject(result) 19 | resolve(result) 20 | }) 21 | }) 22 | } 23 | } 24 | 25 | function _cross (path, cb) { 26 | try { 27 | // Create a new `dos2unix` instance and add important event listeners 28 | const d2u = new dos2unix({ glob: { cwd: path }, maxConcurrency: 50 }) 29 | .on('error', (err) => { 30 | cb(err) 31 | }) 32 | .on('end', (stats) => { 33 | console.log(stats) 34 | cb() 35 | }) 36 | d2u.process([ '**/*' ]) 37 | } catch(err) { 38 | cb(err) 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /packages/dos2unix/.gitattributes: -------------------------------------------------------------------------------- 1 | unix.sh -text 2 | dos.sh -text 3 | -------------------------------------------------------------------------------- /packages/dos2unix/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | test/fixtures/tmp/ 3 | -------------------------------------------------------------------------------- /packages/dos2unix/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "curly": true, 3 | "eqeqeq": true, 4 | "immed": true, 5 | "latedef": true, 6 | "newcap": true, 7 | "noarg": true, 8 | "sub": true, 9 | "undef": true, 10 | "unused": true, 11 | "boss": true, 12 | "eqnull": true, 13 | "node": true, 14 | "es5": true 15 | } 16 | -------------------------------------------------------------------------------- /packages/dos2unix/.npmignore: -------------------------------------------------------------------------------- 1 | npm-debug.log 2 | .gitattributes 3 | .gitignore 4 | .jshintrc 5 | .npmignore 6 | .travis.yml 7 | Gruntfile.js 8 | 9 | node_modules 10 | test 11 | tests -------------------------------------------------------------------------------- /packages/dos2unix/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 0.8 4 | - "0.10" 5 | before_script: 6 | - npm install -g grunt-cli 7 | -------------------------------------------------------------------------------- /packages/dos2unix/Gruntfile.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function(grunt) { 4 | 5 | // Project configuration. 6 | grunt.initConfig({ 7 | jshint: { 8 | options: { 9 | jshintrc: '.jshintrc' 10 | }, 11 | all: { 12 | src: ['Gruntfile.js', 'lib/**/*.js', 'test/**/*.js'] 13 | } 14 | }, 15 | nodeunit: { 16 | all: ['test/**/*_test.js'] 17 | } 18 | }); 19 | 20 | // These plugins provide necessary tasks. 21 | grunt.loadNpmTasks('grunt-contrib-nodeunit'); 22 | grunt.loadNpmTasks('grunt-contrib-jshint'); 23 | 24 | // Default task. 25 | grunt.registerTask('default', ['jshint', 'nodeunit']); 26 | // TravisCI task. 27 | grunt.registerTask('travis', ['jshint', 'nodeunit']); 28 | 29 | }; 30 | -------------------------------------------------------------------------------- /packages/dos2unix/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 James M. Greene 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /packages/dos2unix/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * dos2unix 3 | * https://github.com/JamesMGreene/node-dos2unix 4 | * 5 | * Copyright (c) 2013 James M. Greene 6 | * Licensed under the MIT license. 7 | */ 8 | 9 | 'use strict'; 10 | 11 | // Exports 12 | module.exports = { 13 | dos2unix: require('./lib/dos2unix') 14 | }; 15 | -------------------------------------------------------------------------------- /packages/dos2unix/lib/util/glob.js: -------------------------------------------------------------------------------- 1 | /* 2 | * dos2unix 3 | * https://github.com/JamesMGreene/node-dos2unix 4 | * 5 | * Copyright (c) 2013 James M. Greene 6 | * Licensed under the MIT license. 7 | */ 8 | 9 | 'use strict'; 10 | 11 | // Built-in modules 12 | var path = require('path'); 13 | 14 | // External modules 15 | var glob = require('glob'); 16 | var async = require('async'); 17 | var extend = require('node.extend'); 18 | 19 | 20 | // Utility functions 21 | function isArray(o) { 22 | return Object.prototype.toString.call(o) === '[object Array]'; 23 | } 24 | 25 | function omitDirs(arr) { 26 | return (arr || []).filter(function(e) { 27 | var lastChar = e.slice(-1); 28 | return lastChar !== '/' && lastChar !== '\\'; 29 | }); 30 | } 31 | 32 | function unique(arr) { 33 | return (arr || []).filter(function(e, i, c) { 34 | return c.indexOf(e) === i; 35 | }); 36 | } 37 | 38 | function prependAll(arr, prefixPath) { 39 | return (arr || []).map(function(e) { 40 | return path.join(prefixPath, e); 41 | }); 42 | } 43 | 44 | 45 | // Configuration 46 | var defaultOptions = { 47 | nonull: false, 48 | nocase: true, 49 | mark: true 50 | }; 51 | 52 | // Public methods 53 | function resolveGlobAsync(patterns, options, done) { 54 | var opts = extend(true, {}, defaultOptions, options); 55 | 56 | // Relative patterns are matched against the current working directory. 57 | var globIterator = function(pattern, callback) { 58 | glob(pattern, opts, function(err, globbedFiles) { 59 | if (isArray(globbedFiles) && globbedFiles.length && !err) { 60 | callback(null, globbedFiles); 61 | } 62 | else { 63 | console.error('The glob pattern ' + JSON.stringify(pattern) + ' did not match any files!'); 64 | callback(null, []); 65 | } 66 | }); 67 | }; 68 | async.concat(patterns, globIterator, function(err, files) { 69 | if (err) { 70 | done(err); 71 | return; 72 | } 73 | // Get rid of any duplicates and sort it 74 | var _cwd = opts.cwd || process.cwd(); 75 | var polishedList = prependAll(unique(omitDirs(files)), _cwd).sort(); 76 | done(null, polishedList); 77 | }); 78 | } 79 | 80 | 81 | 82 | // Exports 83 | module.exports = { 84 | defaults: defaultOptions, 85 | glob: resolveGlobAsync 86 | }; 87 | -------------------------------------------------------------------------------- /packages/dos2unix/lib/util/validate.js: -------------------------------------------------------------------------------- 1 | /* 2 | * dos2unix 3 | * https://github.com/JamesMGreene/node-dos2unix 4 | * 5 | * Copyright (c) 2013 James M. Greene 6 | * Licensed under the MIT license. 7 | */ 8 | 9 | 'use strict'; 10 | 11 | // External modules 12 | var extend = require('node.extend'); 13 | 14 | // Internal modules 15 | var globber = require('./glob'); 16 | 17 | 18 | // Utility functions 19 | function isArray(o) { 20 | return Object.prototype.toString.call(o) === '[object Array]'; 21 | } 22 | 23 | function validateOptions(opts) { 24 | var cleanOpts = { 25 | glob: globber.defaults, 26 | maxConcurrency: 0 /* unlimited */ 27 | }; 28 | if (opts) { 29 | // glob 30 | var typeOfGlob = typeof opts.glob; 31 | if (typeOfGlob === 'object' && opts.glob !== null) { 32 | cleanOpts.glob = extend(true, {}, cleanOpts.glob, opts.glob); 33 | } 34 | else if (opts.glob != null) { 35 | throw new TypeError('`glob` expects an Object type but was: ' + typeOfGlob); 36 | } 37 | 38 | // maxConcurrency 39 | var typeOfMaxConcurrency = typeof opts.maxConcurrency; 40 | if (typeOfMaxConcurrency === 'number') { 41 | if (opts.maxConcurrency > 0) { 42 | cleanOpts.maxConcurrency = opts.maxConcurrency; 43 | } 44 | else { 45 | cleanOpts.maxConcurrency = 0; 46 | } 47 | } 48 | else if (opts.maxConcurrency != null) { 49 | throw new TypeError('`maxConcurrency` expects a Number type but was: ' + typeOfMaxConcurrency); 50 | } 51 | } 52 | return cleanOpts; 53 | } 54 | 55 | function validateGlobPatterns(patterns, done) { 56 | if (typeof patterns === 'string') { 57 | if (!patterns) { 58 | done(new TypeError('`patterns` cannot be an empty string')); 59 | return; 60 | } 61 | patterns = [patterns]; 62 | } 63 | if (!isArray(patterns)) { 64 | done(new TypeError('`patterns` must either be a string or an array')); 65 | return; 66 | } 67 | if (patterns.length < 1) { 68 | done(new TypeError('`patterns` cannot be an empty array')); 69 | return; 70 | } 71 | done(null, patterns); 72 | } 73 | 74 | 75 | 76 | // Exports 77 | module.exports = { 78 | validateOptions: validateOptions, 79 | validateGlobPatterns: validateGlobPatterns 80 | }; 81 | -------------------------------------------------------------------------------- /packages/dos2unix/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@raider/dos2unix", 3 | "description": "A Node.js module to convert text files with DOS line breaks to Unix line breaks, i.e. like using `dos2unix`.", 4 | "version": "0.15.0", 5 | "homepage": "https://github.com/JamesMGreene/node-dos2unix", 6 | "author": { 7 | "name": "James M. Greene", 8 | "email": "james.m.greene@gmail.com", 9 | "url": "http://jamesgreene.net/" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "git://github.com/JamesMGreene/node-dos2unix.git" 14 | }, 15 | "bugs": { 16 | "url": "https://github.com/JamesMGreene/node-dos2unix/issues" 17 | }, 18 | "licenses": [ 19 | { 20 | "type": "MIT", 21 | "url": "https://github.com/JamesMGreene/node-dos2unix/blob/master/LICENSE-MIT" 22 | } 23 | ], 24 | "main": "index", 25 | "engines": { 26 | "node": ">= 0.8.0" 27 | }, 28 | "scripts": { 29 | "test": "grunt travis --verbose" 30 | }, 31 | "dependencies": { 32 | "async": "~0.2.9", 33 | "glob": "~3.2.1", 34 | "node.extend": "~1.0.5", 35 | "readable-stream": "~1.0.2" 36 | }, 37 | "devDependencies": { 38 | "fs-extra": "~0.6.0", 39 | "grunt": "~0.4.1", 40 | "grunt-cli": "^1.2.0", 41 | "grunt-contrib-jshint": "~0.4.3", 42 | "grunt-contrib-nodeunit": "^1.0.0", 43 | "nodeunit": "latest" 44 | }, 45 | "keywords": [ 46 | "dos2unix", 47 | "unix2dos", 48 | "crlf", 49 | "lf", 50 | "carriage return", 51 | "line feed", 52 | "newline", 53 | "new line", 54 | "line endings" 55 | ] 56 | } 57 | -------------------------------------------------------------------------------- /packages/dos2unix/test/expected/dos2unix/binary.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noderaider/modular/9abe14fbf1593ae09f6c1ee1f00b91ea15aaa942/packages/dos2unix/test/expected/dos2unix/binary.swf -------------------------------------------------------------------------------- /packages/dos2unix/test/expected/dos2unix/dos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo "DOS style!" -------------------------------------------------------------------------------- /packages/dos2unix/test/expected/dos2unix/unix.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo "UNIX style!" 3 | -------------------------------------------------------------------------------- /packages/dos2unix/test/fixtures/dos2unix/binary.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noderaider/modular/9abe14fbf1593ae09f6c1ee1f00b91ea15aaa942/packages/dos2unix/test/fixtures/dos2unix/binary.swf -------------------------------------------------------------------------------- /packages/dos2unix/test/fixtures/dos2unix/dos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo "DOS style!" -------------------------------------------------------------------------------- /packages/dos2unix/test/fixtures/dos2unix/unix.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo "UNIX style!" 3 | -------------------------------------------------------------------------------- /packages/dos2unix/test/fixtures/util/encoding/bom/ascii.txt: -------------------------------------------------------------------------------- 1 | ASCII -------------------------------------------------------------------------------- /packages/dos2unix/test/fixtures/util/encoding/bom/utf16be.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noderaider/modular/9abe14fbf1593ae09f6c1ee1f00b91ea15aaa942/packages/dos2unix/test/fixtures/util/encoding/bom/utf16be.txt -------------------------------------------------------------------------------- /packages/dos2unix/test/fixtures/util/encoding/bom/utf16le.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noderaider/modular/9abe14fbf1593ae09f6c1ee1f00b91ea15aaa942/packages/dos2unix/test/fixtures/util/encoding/bom/utf16le.txt -------------------------------------------------------------------------------- /packages/dos2unix/test/fixtures/util/encoding/bom/utf32be.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noderaider/modular/9abe14fbf1593ae09f6c1ee1f00b91ea15aaa942/packages/dos2unix/test/fixtures/util/encoding/bom/utf32be.txt -------------------------------------------------------------------------------- /packages/dos2unix/test/fixtures/util/encoding/bom/utf32le.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noderaider/modular/9abe14fbf1593ae09f6c1ee1f00b91ea15aaa942/packages/dos2unix/test/fixtures/util/encoding/bom/utf32le.txt -------------------------------------------------------------------------------- /packages/dos2unix/test/fixtures/util/encoding/bom/utf8-noBom.txt: -------------------------------------------------------------------------------- 1 | UTF-8 ☃ (no BOM) -------------------------------------------------------------------------------- /packages/dos2unix/test/fixtures/util/encoding/bom/utf8.txt: -------------------------------------------------------------------------------- 1 | UTF-8 ☃ -------------------------------------------------------------------------------- /packages/install/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["latest", "stage-2"] 3 | } 4 | -------------------------------------------------------------------------------- /packages/install/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "babel-eslint", 3 | "plugins": ["babel", "react", "flowtype"], 4 | "parserOptions": { 5 | "ecmaVersion": 2017, 6 | "sourceType": "module", 7 | "ecmaFeatures": { 8 | "jsx": true, 9 | "modules": true, 10 | "blockBindings": true, 11 | "defaultParams": true, 12 | "forOf": true, 13 | "generators": true, 14 | "objectLiteralComputedProperties": true, 15 | "objectLiteralDuplicateProperties": false, 16 | "objectLiteralShorthandMethods": true, 17 | "objectLiteralShorthandProperties": true, 18 | "templateStrings": true, 19 | "experimentalObjectRestSpread": true 20 | } 21 | }, 22 | "rules": { 23 | "quotes": [2, "single"], 24 | "strict": [2, "never"], 25 | "semi": [2, "never"], 26 | "brace-style": [2, "1tbs", { 27 | "allowSingleLine": true 28 | }], 29 | "comma-style": ["error", "first"], 30 | "comma-dangle": [2, "never"], 31 | "no-dupe-keys": 2, 32 | "no-ex-assign": 2, 33 | "no-extra-semi": 2, 34 | "valid-typeof": 2, 35 | "no-template-curly-in-string": "error", 36 | "symbol-description": "error", 37 | "class-methods-use-this": "error", 38 | "prefer-arrow-callback": ["error", {"allowNamedFunctions": true}], 39 | 40 | "babel/generator-star-spacing": 1, 41 | "babel/object-shorthand": 1, 42 | "babel/arrow-parens": 1, 43 | "babel/no-await-in-loop": 1, 44 | "babel/flow-object-type": [ "error", "comma" ], 45 | "babel/func-params-comma-dangle": 1, 46 | 47 | "react/jsx-uses-react": 2, 48 | "react/jsx-uses-vars": 2, 49 | "react/react-in-jsx-scope": 2, 50 | 51 | "flowtype/define-flow-type": 1, 52 | "flowtype/require-parameter-type": 1, 53 | "flowtype/require-return-type": [ 54 | 1, 55 | "always", 56 | { 57 | "annotateUndefined": "never" 58 | } 59 | ], 60 | "flowtype/space-after-type-colon": [ 61 | 1, 62 | "always" 63 | ], 64 | "flowtype/space-before-type-colon": [ 65 | 1, 66 | "never" 67 | ], 68 | "flowtype/type-id-match": [ 69 | 1, 70 | "^([A-Z]{1,3}[a-z0-9]+)+Type$" 71 | ], 72 | "flowtype/use-flow-type": 1, 73 | "flowtype/valid-syntax": 1 74 | }, 75 | "settings": { 76 | "flowtype": { 77 | "onlyFilesWithFlowAnnotation": true 78 | } 79 | }, 80 | "env": { 81 | "es6": true, 82 | "browser": true, 83 | "node": true 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /packages/install/.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | node_modules 5 | 6 | # testing 7 | coverage 8 | 9 | # production 10 | build 11 | 12 | # misc 13 | .DS_Store 14 | .env 15 | npm-debug.log 16 | -------------------------------------------------------------------------------- /packages/install/.npmignore: -------------------------------------------------------------------------------- 1 | /src/ 2 | -------------------------------------------------------------------------------- /packages/install/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "7" 4 | - "6" 5 | - "5" 6 | before_install: 7 | # Repo for newer Node.js versions 8 | - curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - 9 | # Repo for Yarn 10 | - sudo apt-key adv --keyserver pgp.mit.edu --recv D101F7899D41F3C3 11 | - echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list 12 | - sudo apt-get update -qq 13 | - sudo apt-get install -y -qq yarn 14 | cache: 15 | directories: 16 | - $HOME/.yarn-cache 17 | -------------------------------------------------------------------------------- /packages/install/README.md: -------------------------------------------------------------------------------- 1 | # [@raider/install](https://npmjs.com/package/@raider/install) 2 | 3 | **fast cross-platform 'install' utility with API and CLI support. Autodetects npm client installer (npm or yarn for now) and installs with best option.** 4 | 5 | [![NPM](https://nodei.co/npm/install.png?stars=true&downloads=true)](https://nodei.co/npm/install/) 6 | 7 | ## CLI 8 | 9 | ```bash 10 | npm i -g @raider/install@latest 11 | 12 | install 13 | 14 | # for usage instructions: 15 | install -h 16 | ``` 17 | 18 | ## API 19 | 20 | ```js 21 | import install from '@raider/install' 22 | 23 | // Options can be passed to force installation using npm or yarn, if omitted, they will be autodetected on the system (yarn takes precedence). 24 | install({ npm: false, yarn: false, verbose: false }, () => { 25 | console.log('done installing') 26 | }) 27 | ``` 28 | 29 | **omit the callback to return a promise** 30 | 31 | ```js 32 | install({}).then(() => { 33 | // continue 34 | }) 35 | ``` 36 | 37 | **async / await** 38 | 39 | ```js 40 | (async function () { 41 | await install() 42 | // continue 43 | }) 44 | ``` 45 | 46 | `@raider/install` is tested and made to work cross-platform. 47 | -------------------------------------------------------------------------------- /packages/install/bin.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | 'use strict'; 4 | 5 | require('./lib/cli').default() 6 | -------------------------------------------------------------------------------- /packages/install/lib/cli.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.default = cli; 7 | 8 | var _yargs = require('yargs'); 9 | 10 | var _yargs2 = _interopRequireDefault(_yargs); 11 | 12 | var _util = require('util'); 13 | 14 | var _util2 = _interopRequireDefault(_util); 15 | 16 | var _2 = require('../'); 17 | 18 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 19 | 20 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } 21 | 22 | function cli() { 23 | var cb = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function (err) { 24 | if (err instanceof Error) { 25 | console.error('error occurred during execution => ' + _util2.default.inspect(err)); 26 | process.exit(1); 27 | } 28 | }; 29 | 30 | var packageJson = require('../package.json'); 31 | var argv = _yargs2.default.usage('Usage: ' + packageJson.name + ' [options]\nversion: ' + packageJson.version).describe('verbose', 'Print debugging information.').help('h').alias('h', 'help').argv; 32 | 33 | var _ = argv._, 34 | _opts = _objectWithoutProperties(argv, ['_']); 35 | 36 | return (0, _2.api)(_, _opts, cb); 37 | } -------------------------------------------------------------------------------- /packages/install/lib/utils/shouldUseYarn.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.default = shouldUseYarn; 7 | 8 | var _which = require('@raider/which'); 9 | 10 | var _which2 = _interopRequireDefault(_which); 11 | 12 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 13 | 14 | function shouldUseYarn() { 15 | var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, 16 | yarn = _ref.yarn, 17 | npm = _ref.npm; 18 | 19 | var cb = arguments[1]; 20 | var desc = arguments[2]; 21 | 22 | if (yarn && npm) throw new Error('you must choose between yarn or npm or let the best choice be autodetected.'); 23 | if (npm) cb(false);else if (yarn) cb(true);else { 24 | (0, _which2.default)('yarn', function (result) { 25 | return cb(result ? true : false); 26 | }); 27 | } 28 | } -------------------------------------------------------------------------------- /packages/install/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@raider/install", 3 | "description": "cross-platform yarn / npm install with autodetection and CLI / API support.", 4 | "version": "0.15.0", 5 | "bin": "bin.js", 6 | "main": "lib/index.js", 7 | "files": [ 8 | "bin.js", 9 | "lib" 10 | ], 11 | "scripts": { 12 | "start": "npm run build -- --watch", 13 | "prebuild": "rimraf lib", 14 | "build": "babel src -d lib --ignore __tests__,__mocks__", 15 | "test": "jest", 16 | "preversion": "run-s test build" 17 | }, 18 | "dependencies": { 19 | "@raider/which": "^0.15.0", 20 | "bin-utils": "^0.15.0", 21 | "fs-extra": "latest", 22 | "ncp": "latest", 23 | "rimraf": "latest", 24 | "yargs": "latest" 25 | }, 26 | "devDependencies": { 27 | "babel-cli": "latest", 28 | "babel-core": "latest", 29 | "babel-eslint": "latest", 30 | "babel-loader": "latest", 31 | "babel-plugin-transform-runtime": "latest", 32 | "babel-preset-latest": "latest", 33 | "babel-preset-stage-2": "latest", 34 | "eslint": "latest", 35 | "eslint-plugin-babel": "latest", 36 | "eslint-plugin-react": "latest", 37 | "npm-run-all": "latest", 38 | "rewire": "latest" 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /packages/install/src/cli.js: -------------------------------------------------------------------------------- 1 | import yargs from 'yargs' 2 | import util from 'util' 3 | import { api } from '../' 4 | 5 | export default function cli (cb = (err) => { 6 | if(err instanceof Error) { 7 | console.error(`error occurred during execution => ${util.inspect(err)}`) 8 | process.exit(1) 9 | } 10 | }) { 11 | const packageJson = require('../package.json') 12 | const argv = yargs 13 | .usage(`Usage: ${packageJson.name} [options]\nversion: ${packageJson.version}`) 14 | .describe('verbose', 'Print debugging information.') 15 | .help('h') 16 | .alias('h', 'help') 17 | .argv 18 | const { _, ..._opts } = argv 19 | return api(_, _opts, cb) 20 | } 21 | -------------------------------------------------------------------------------- /packages/install/src/utils/__tests__/shouldUseYarn-dne.test.js: -------------------------------------------------------------------------------- 1 | import shouldUseYarn from '../shouldUseYarn' 2 | import sinon from 'sinon' 3 | 4 | jest.mock('@raider/which') 5 | const which = require('@raider/which').default 6 | which.mockImplementation((name, cb) => cb([ 'node', 'npm' ].includes(name) ? `/usr/bin/${name}` : false)) 7 | 8 | describe('shouldUseYarn', () => { 9 | it('should be a function', () => { 10 | expect(typeof shouldUseYarn).toBe('function') 11 | }) 12 | 13 | const testSet = (desc, opts, expected) => { 14 | describe(desc, () => { 15 | it('should call the callback once', () => { 16 | const cb = sinon.spy() 17 | shouldUseYarn(opts, cb, `cb test: ${desc}`) 18 | expect(cb.calledOnce).toBe(true) 19 | }) 20 | it(`should return ${expected}`, () => { 21 | shouldUseYarn(opts, (result) => { 22 | expect(result).toBe(expected) 23 | }, `returns expected: ${desc} => ${expected}`) 24 | }) 25 | }) 26 | } 27 | 28 | describe('yarn not in path', () => { 29 | testSet('npm: true', { npm: true }, false) 30 | testSet('yarn: true', { yarn: true }, true) 31 | testSet('autodetect (empty)', {}, false) 32 | }) 33 | }) 34 | -------------------------------------------------------------------------------- /packages/install/src/utils/__tests__/shouldUseYarn.test.js: -------------------------------------------------------------------------------- 1 | import shouldUseYarn from '../shouldUseYarn' 2 | import sinon from 'sinon' 3 | 4 | jest.mock('@raider/which') 5 | const which = require('@raider/which').default 6 | which.mockImplementation((name, cb) => cb([ 'node', 'npm', 'yarn' ].includes(name) ? `/usr/bin/${name}` : false)) 7 | 8 | describe('shouldUseYarn', () => { 9 | it('should be a function', () => { 10 | expect(typeof shouldUseYarn).toBe('function') 11 | }) 12 | 13 | const testSet = (desc, opts, expected) => { 14 | describe(desc, () => { 15 | it('should call the callback once', () => { 16 | const cb = sinon.spy() 17 | shouldUseYarn(opts, cb, `cb test: ${desc}`) 18 | expect(cb.calledOnce).toBe(true) 19 | }) 20 | it(`should return ${expected}`, () => { 21 | shouldUseYarn(opts, (result) => { 22 | expect(result).toBe(expected) 23 | }, `returns expected: ${desc} => ${expected}`) 24 | }) 25 | }) 26 | } 27 | 28 | describe('yarn in path', () => { 29 | testSet('npm: true', { npm: true }, false) 30 | testSet('yarn: true', { yarn: true }, true) 31 | testSet('autodetect (empty)', {}, true) 32 | }) 33 | }) 34 | -------------------------------------------------------------------------------- /packages/install/src/utils/shouldUseYarn.js: -------------------------------------------------------------------------------- 1 | import which from '@raider/which' 2 | 3 | export default function shouldUseYarn ({ yarn, npm } = {}, cb, desc) { 4 | if(yarn && npm) 5 | throw new Error('you must choose between yarn or npm or let the best choice be autodetected.') 6 | if(npm) 7 | cb(false) 8 | else if(yarn) 9 | cb(true) 10 | else { 11 | which('yarn', (result) => cb(result ? true : false)) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/modular-test/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["latest", "stage-2"] 3 | } 4 | -------------------------------------------------------------------------------- /packages/modular-test/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "babel-eslint", 3 | "plugins": ["babel", "react", "flowtype"], 4 | "parserOptions": { 5 | "ecmaVersion": 2017, 6 | "sourceType": "module", 7 | "ecmaFeatures": { 8 | "jsx": true, 9 | "modules": true, 10 | "blockBindings": true, 11 | "defaultParams": true, 12 | "forOf": true, 13 | "generators": true, 14 | "objectLiteralComputedProperties": true, 15 | "objectLiteralDuplicateProperties": false, 16 | "objectLiteralShorthandMethods": true, 17 | "objectLiteralShorthandProperties": true, 18 | "templateStrings": true, 19 | "experimentalObjectRestSpread": true 20 | } 21 | }, 22 | "rules": { 23 | "quotes": [2, "single"], 24 | "strict": [2, "never"], 25 | "semi": [2, "never"], 26 | "brace-style": [2, "1tbs", { 27 | "allowSingleLine": true 28 | }], 29 | "comma-style": ["error", "first"], 30 | "comma-dangle": [2, "never"], 31 | "no-dupe-keys": 2, 32 | "no-ex-assign": 2, 33 | "no-extra-semi": 2, 34 | "valid-typeof": 2, 35 | "no-template-curly-in-string": "error", 36 | "symbol-description": "error", 37 | "class-methods-use-this": "error", 38 | "prefer-arrow-callback": ["error", {"allowNamedFunctions": true}], 39 | 40 | "babel/generator-star-spacing": 1, 41 | "babel/object-shorthand": 1, 42 | "babel/arrow-parens": 1, 43 | "babel/no-await-in-loop": 1, 44 | "babel/flow-object-type": [ "error", "comma" ], 45 | "babel/func-params-comma-dangle": 1, 46 | 47 | "react/jsx-uses-react": 2, 48 | "react/jsx-uses-vars": 2, 49 | "react/react-in-jsx-scope": 2, 50 | 51 | "flowtype/define-flow-type": 1, 52 | "flowtype/require-parameter-type": 1, 53 | "flowtype/require-return-type": [ 54 | 1, 55 | "always", 56 | { 57 | "annotateUndefined": "never" 58 | } 59 | ], 60 | "flowtype/space-after-type-colon": [ 61 | 1, 62 | "always" 63 | ], 64 | "flowtype/space-before-type-colon": [ 65 | 1, 66 | "never" 67 | ], 68 | "flowtype/type-id-match": [ 69 | 1, 70 | "^([A-Z]{1,3}[a-z0-9]+)+Type$" 71 | ], 72 | "flowtype/use-flow-type": 1, 73 | "flowtype/valid-syntax": 1 74 | }, 75 | "settings": { 76 | "flowtype": { 77 | "onlyFilesWithFlowAnnotation": true 78 | } 79 | }, 80 | "env": { 81 | "es6": true, 82 | "browser": true, 83 | "node": true 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /packages/modular-test/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | *.lock 6 | 7 | # Runtime data 8 | pids 9 | *.pid 10 | *.seed 11 | 12 | # Directory for instrumented libs generated by jscoverage/JSCover 13 | lib-cov 14 | 15 | # Coverage directory used by tools like istanbul 16 | coverage 17 | 18 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 19 | .grunt 20 | 21 | # node-waf configuration 22 | .lock-wscript 23 | 24 | # Compiled binary addons (http://nodejs.org/api/addons.html) 25 | build/Release 26 | 27 | # Dependency directory 28 | node_modules 29 | 30 | # Optional npm cache directory 31 | .npm 32 | 33 | # Optional REPL history 34 | .node_repl_history 35 | -------------------------------------------------------------------------------- /packages/modular-test/.npmignore: -------------------------------------------------------------------------------- 1 | # Source files 2 | /vagrant/ 3 | 4 | .babelrc 5 | .eslintrc 6 | .gitattributes 7 | .gitignore 8 | 9 | .idea/ 10 | .vscode/ 11 | *.sublime-project 12 | *.sublime-workspace 13 | *.suo 14 | *.user 15 | 16 | *.7z 17 | *.zip 18 | *.rar 19 | *.psd 20 | -------------------------------------------------------------------------------- /packages/modular-test/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "7" 4 | - "6" 5 | - "5" 6 | before_install: 7 | # Repo for newer Node.js versions 8 | - curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - 9 | # Repo for Yarn 10 | - sudo apt-key adv --keyserver pgp.mit.edu --recv D101F7899D41F3C3 11 | - echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list 12 | - sudo apt-get update -qq 13 | - sudo apt-get install -y -qq yarn 14 | cache: 15 | directories: 16 | - $HOME/.yarn-cache 17 | -------------------------------------------------------------------------------- /packages/modular-test/README.md: -------------------------------------------------------------------------------- 1 | # @raider/modular-test 2 | 3 | ## In active development, review the unit tests until documentation is added. 4 | -------------------------------------------------------------------------------- /packages/modular-test/__tests__/create-css-module.js: -------------------------------------------------------------------------------- 1 | import createCssModule from 'create-css-module' 2 | 3 | describe('create-css-module', () => { 4 | it('is a function', () => { 5 | expect(typeof createCssModule).toBe('function') 6 | }) 7 | }) 8 | -------------------------------------------------------------------------------- /packages/modular-test/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@raider/modular-test", 3 | "version": "0.15.0", 4 | "description": "Test project for all the @raider/modular packages", 5 | "dependencies": { 6 | "bin-utils": "^0.15.0", 7 | "create-react-repo": "^0.15.0", 8 | "create-component-module": "^0.15.0", 9 | "create-css-module": "^0.15.0", 10 | "create-sass-module": "^0.15.0", 11 | "create-deploy-module": "^0.15.0", 12 | "create-express-module": "^0.15.0", 13 | "create-koa-module": "^0.15.0", 14 | "create-cli-module": "^0.15.0", 15 | "create-package": "^0.15.0", 16 | "babel-cli": "latest", 17 | "babel-preset-latest": "latest", 18 | "babel-preset-stage-2": "latest", 19 | "bluebird": "latest", 20 | "bunyan": "latest", 21 | "graceful-fs": "latest", 22 | "isomorphic-fetch": "latest", 23 | "jest": "latest", 24 | "lerna": "prerelease", 25 | "mkdirp": "latest", 26 | "ncp": "latest", 27 | "npm-run-all": "latest", 28 | "rimraf": "latest", 29 | "signal-exit": "latest", 30 | "simple-git": "latest", 31 | "yargs": "latest" 32 | }, 33 | "jest": { 34 | "moduleDirectories": [ 35 | "node_modules" 36 | ], 37 | "moduleFileExtensions": [ 38 | "js", 39 | "json", 40 | "node" 41 | ] 42 | }, 43 | "scripts": { 44 | "test": "jest" 45 | }, 46 | "repository": { 47 | "type": "git", 48 | "url": "https://github.com/noderaider/modular.git" 49 | }, 50 | "author": "Cole Chamberlain ", 51 | "license": "MIT" 52 | } 53 | -------------------------------------------------------------------------------- /packages/which/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["latest", "stage-2"] 3 | } 4 | -------------------------------------------------------------------------------- /packages/which/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "babel-eslint", 3 | "plugins": ["babel", "react", "flowtype"], 4 | "parserOptions": { 5 | "ecmaVersion": 2017, 6 | "sourceType": "module", 7 | "ecmaFeatures": { 8 | "jsx": true, 9 | "modules": true, 10 | "blockBindings": true, 11 | "defaultParams": true, 12 | "forOf": true, 13 | "generators": true, 14 | "objectLiteralComputedProperties": true, 15 | "objectLiteralDuplicateProperties": false, 16 | "objectLiteralShorthandMethods": true, 17 | "objectLiteralShorthandProperties": true, 18 | "templateStrings": true, 19 | "experimentalObjectRestSpread": true 20 | } 21 | }, 22 | "rules": { 23 | "quotes": [2, "single"], 24 | "strict": [2, "never"], 25 | "semi": [2, "never"], 26 | "brace-style": [2, "1tbs", { 27 | "allowSingleLine": true 28 | }], 29 | "comma-style": ["error", "first"], 30 | "comma-dangle": [2, "never"], 31 | "no-dupe-keys": 2, 32 | "no-ex-assign": 2, 33 | "no-extra-semi": 2, 34 | "valid-typeof": 2, 35 | "no-template-curly-in-string": "error", 36 | "symbol-description": "error", 37 | "class-methods-use-this": "error", 38 | "prefer-arrow-callback": ["error", {"allowNamedFunctions": true}], 39 | 40 | "babel/generator-star-spacing": 1, 41 | "babel/object-shorthand": 1, 42 | "babel/arrow-parens": 1, 43 | "babel/no-await-in-loop": 1, 44 | "babel/flow-object-type": [ "error", "comma" ], 45 | "babel/func-params-comma-dangle": 1, 46 | 47 | "react/jsx-uses-react": 2, 48 | "react/jsx-uses-vars": 2, 49 | "react/react-in-jsx-scope": 2, 50 | 51 | "flowtype/define-flow-type": 1, 52 | "flowtype/require-parameter-type": 1, 53 | "flowtype/require-return-type": [ 54 | 1, 55 | "always", 56 | { 57 | "annotateUndefined": "never" 58 | } 59 | ], 60 | "flowtype/space-after-type-colon": [ 61 | 1, 62 | "always" 63 | ], 64 | "flowtype/space-before-type-colon": [ 65 | 1, 66 | "never" 67 | ], 68 | "flowtype/type-id-match": [ 69 | 1, 70 | "^([A-Z]{1,3}[a-z0-9]+)+Type$" 71 | ], 72 | "flowtype/use-flow-type": 1, 73 | "flowtype/valid-syntax": 1 74 | }, 75 | "settings": { 76 | "flowtype": { 77 | "onlyFilesWithFlowAnnotation": true 78 | } 79 | }, 80 | "env": { 81 | "es6": true, 82 | "browser": true, 83 | "node": true 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /packages/which/.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | node_modules 5 | 6 | # testing 7 | coverage 8 | 9 | # production 10 | build 11 | 12 | # misc 13 | .DS_Store 14 | .env 15 | npm-debug.log 16 | -------------------------------------------------------------------------------- /packages/which/.npmignore: -------------------------------------------------------------------------------- 1 | /src/ 2 | -------------------------------------------------------------------------------- /packages/which/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "7" 4 | - "6" 5 | - "5" 6 | before_install: 7 | # Repo for newer Node.js versions 8 | - curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - 9 | # Repo for Yarn 10 | - sudo apt-key adv --keyserver pgp.mit.edu --recv D101F7899D41F3C3 11 | - echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list 12 | - sudo apt-get update -qq 13 | - sudo apt-get install -y -qq yarn 14 | cache: 15 | directories: 16 | - $HOME/.yarn-cache 17 | -------------------------------------------------------------------------------- /packages/which/README.md: -------------------------------------------------------------------------------- 1 | # [@raider/which](https://npmjs.com/package/@raider/which) 2 | 3 | **fast cross-platform 'which' utility with API and CLI support.** 4 | 5 | [![NPM](https://nodei.co/npm/which.png?stars=true&downloads=true)](https://nodei.co/npm/which/) 6 | 7 | ## CLI 8 | 9 | ```bash 10 | npm i -g @raider/which@latest 11 | 12 | which node 13 | # C:\Program Files\nodejs\node.exe 14 | 15 | which npm 16 | # C:\Users\raider\local\npm\npm 17 | 18 | which yarn 19 | # C:\Users\raider\local\npm\yarn 20 | ``` 21 | 22 | ## API 23 | 24 | ```js 25 | import which from '@raider/which' 26 | 27 | which('node', (path) => { 28 | if(result) 29 | console.log(path) 30 | }) 31 | ``` 32 | 33 | **omit the callback to return a promise** 34 | 35 | ```js 36 | which('npm').then((path) => { 37 | if(path) { 38 | // process 39 | } 40 | }) 41 | ``` 42 | 43 | **async / await** 44 | 45 | ```js 46 | (async function () { 47 | const path = await which('yarn') 48 | if(path) { 49 | // process 50 | } 51 | }) 52 | ``` 53 | 54 | 55 | `@raider/which` is tested and made to work cross-platform. 56 | -------------------------------------------------------------------------------- /packages/which/__mocks__/cross-spawn.js: -------------------------------------------------------------------------------- 1 | export default function spawn (command, args, opts) { 2 | const cbMap = new Map() 3 | const on = (event, cb) => { 4 | cbMap.set(event, cb) 5 | } 6 | const stream = ( 7 | { on 8 | } 9 | ) 10 | const stdout = ( 11 | { pipe: () => { 12 | const executable = args[0] 13 | const result = ['npm', 'node'].includes(executable) ? `/usr/bin/${executable}` : '' 14 | if(result) { 15 | result.split('/').forEach((chunk, i) => { 16 | setTimeout(() => { 17 | cbMap.get('data')(`${i > 0 ? '/' : ''}${chunk}`) 18 | }, (i + 1) * 20) 19 | }) 20 | } 21 | setTimeout(() => { 22 | cbMap.get('end')() 23 | }, 200) 24 | return stream 25 | } 26 | } 27 | ) 28 | 29 | return { stdout } 30 | } 31 | -------------------------------------------------------------------------------- /packages/which/bin.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | 'use strict'; 4 | 5 | require('./lib/cli').default() 6 | -------------------------------------------------------------------------------- /packages/which/lib/cli.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.default = cli; 7 | 8 | var _chalk = require('chalk'); 9 | 10 | var _chalk2 = _interopRequireDefault(_chalk); 11 | 12 | var _yargs = require('yargs'); 13 | 14 | var _yargs2 = _interopRequireDefault(_yargs); 15 | 16 | var _util = require('util'); 17 | 18 | var _util2 = _interopRequireDefault(_util); 19 | 20 | var _2 = require('../'); 21 | 22 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 23 | 24 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } 25 | 26 | function cli() { 27 | var cb = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function (result) { 28 | if (result instanceof Error) { 29 | console.error('error occurred during execution => ' + _util2.default.inspect(result)); 30 | process.exit(1); 31 | } else if (result === false || result.length === 0) { 32 | process.exit(1); 33 | } 34 | console.log(result); 35 | }; 36 | 37 | var packageJson = require('../package.json'); 38 | var name = packageJson.name.includes('/') ? packageJson.name.split('/')[1] : packageJson.name; 39 | var argv = _yargs2.default.usage(_chalk2.default.green.bold('Usage: ' + name + ' [options]')).version(packageJson.version).describe('verbose', 'Print debugging information.').help('h').alias('h', 'help').demand(1).argv; 40 | 41 | var _ = argv._, 42 | opts = _objectWithoutProperties(argv, ['_']); 43 | 44 | return (0, _2.api)(_, opts, cb); 45 | } -------------------------------------------------------------------------------- /packages/which/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@raider/which", 3 | "description": "fast cross-platform 'which' utility with API and CLI support.", 4 | "version": "0.15.0", 5 | "bin": "bin.js", 6 | "main": "lib/index.js", 7 | "files": [ 8 | "bin.js", 9 | "lib" 10 | ], 11 | "scripts": { 12 | "start": "npm run build -- --watch", 13 | "prebuild": "rimraf lib", 14 | "build": "babel src -d lib --ignore __tests__,__mocks__", 15 | "test": "jest", 16 | "preversion": "run-s test build" 17 | }, 18 | "dependencies": { 19 | "bin-utils": "^0.15.0", 20 | "fs-extra": "latest", 21 | "ncp": "latest", 22 | "rimraf": "latest", 23 | "yargs": "latest" 24 | }, 25 | "devDependencies": { 26 | "babel-cli": "latest", 27 | "babel-core": "latest", 28 | "babel-eslint": "latest", 29 | "babel-loader": "latest", 30 | "babel-plugin-transform-runtime": "latest", 31 | "babel-preset-latest": "latest", 32 | "babel-preset-stage-2": "latest", 33 | "eslint": "latest", 34 | "eslint-plugin-babel": "latest", 35 | "eslint-plugin-react": "latest", 36 | "npm-run-all": "latest", 37 | "rewire": "latest" 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /packages/which/src/__tests__/which.test.js: -------------------------------------------------------------------------------- 1 | import which from '../' 2 | import sinon from 'sinon' 3 | 4 | jest.useFakeTimers() 5 | 6 | describe('which', () => { 7 | it('is a function', () => { 8 | expect(typeof which).toBe('function') 9 | }) 10 | it('calls callback', () => { 11 | const cb = sinon.spy() 12 | which('node', cb) 13 | jest.runOnlyPendingTimers() 14 | expect(cb.calledOnce).toBe(true) 15 | }) 16 | it('returns string for existing executable', () => { 17 | const cb = sinon.spy() 18 | which('node', cb) 19 | jest.runOnlyPendingTimers() 20 | expect(cb.calledWith('/usr/bin/node')).toBe(true) 21 | }) 22 | it('returns false for non-existant executable', () => { 23 | const cb = sinon.spy() 24 | which('blahblahblah', cb) 25 | jest.runOnlyPendingTimers() 26 | expect(cb.calledWith(false)).toBe(true) 27 | }) 28 | 29 | it('returns promise for single arg', () => { 30 | const promise = which('node') 31 | jest.runOnlyPendingTimers() 32 | expect(promise instanceof Promise).toBe(true) 33 | }) 34 | it('promise resolves string for existing executable', () => { 35 | const promise = which('node').then((result) => { 36 | expect(result).toBe('/usr/bin/node') 37 | }) 38 | jest.runOnlyPendingTimers() 39 | return promise 40 | }) 41 | it('promise resolves false for non-existant executable', () => { 42 | const promise = which('blahblahblah').then((result) => { 43 | expect(result).toBe(false) 44 | }) 45 | jest.runOnlyPendingTimers() 46 | return promise 47 | }) 48 | }) 49 | -------------------------------------------------------------------------------- /packages/which/src/cli.js: -------------------------------------------------------------------------------- 1 | import chalk from 'chalk' 2 | import yargs from 'yargs' 3 | import util from 'util' 4 | import { api } from '../' 5 | 6 | export default function cli (cb = (result) => { 7 | if(result instanceof Error) { 8 | console.error(`error occurred during execution => ${util.inspect(result)}`) 9 | process.exit(1) 10 | } else if(result === false || result.length === 0) { 11 | process.exit(1) 12 | } 13 | console.log(result) 14 | }) { 15 | const packageJson = require('../package.json') 16 | const name = packageJson.name.includes('/') ? packageJson.name.split('/')[1] : packageJson.name 17 | const argv = yargs 18 | .usage(chalk.green.bold(`Usage: ${name} [options]`)) 19 | .version(packageJson.version) 20 | .describe('verbose', 'Print debugging information.') 21 | .help('h') 22 | .alias('h', 'help') 23 | .demand(1) 24 | .argv 25 | const { _, ...opts } = argv 26 | return api(_, opts, cb) 27 | } 28 | -------------------------------------------------------------------------------- /packages/which/src/index.js: -------------------------------------------------------------------------------- 1 | import yargs from 'yargs' 2 | import chalk from 'chalk' 3 | import spawn from 'cross-spawn' 4 | import os from 'os' 5 | import FirstLineTransform from './streams/FirstLineTransform' 6 | 7 | export function api (args, opts, cb) { 8 | if(args.length !== 1) 9 | throw new Error('which requires exactly 1 argument name (and a callback for api)') 10 | const [ name ] = args 11 | return which(name, cb) 12 | } 13 | 14 | export default function which(name, cb) { 15 | if(cb) { 16 | _which(name, cb) 17 | } else { 18 | return new Promise((resolve, reject) => { 19 | _which(name, (result) => { 20 | if(result instanceof Error) 21 | return reject(result) 22 | resolve(result) 23 | }) 24 | }) 25 | } 26 | } 27 | 28 | function _which (name, cb) { 29 | try { 30 | if(!name) 31 | throw new Error('which requires a name argument') 32 | const isWin = os.platform() === 'win32' 33 | const child = spawn ( 34 | isWin ? 'where' : 'which' 35 | , [ name ] 36 | , { encoding: 'utf8' } 37 | ) 38 | let output = '' 39 | let pipe = child.stdout.pipe(new FirstLineTransform()) 40 | let chunks = [] 41 | const timeoutMS = 5000 42 | const timeoutID = setTimeout(() => cb(new Error(`which timed out after ${timeoutMS}`)), timeoutMS) 43 | pipe.on('data', (chunk) => { 44 | if(chunk) output += chunk 45 | }) 46 | pipe.on('end', () => { 47 | clearTimeout(timeoutID) 48 | cb(output.length > 0 ? output : false) 49 | }) 50 | } catch(err) { 51 | cb(err) 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /packages/which/src/streams/FirstLineTransform.js: -------------------------------------------------------------------------------- 1 | import { Transform } from 'stream' 2 | 3 | export default class FirstLineTransform extends Transform { 4 | constructor() { 5 | super({}) 6 | this.isFinished = false 7 | } 8 | _transform(chunk, encoding, next) { 9 | if(this.isFinished) 10 | return next() 11 | const str = chunk.toString('utf8') 12 | if(str.includes('\n')) { 13 | const [ final ] = str.split('\n') 14 | this.push(final) 15 | this.isFinished = true 16 | } else { 17 | this.push(str) 18 | } 19 | next() 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /public/png/modular.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noderaider/modular/9abe14fbf1593ae09f6c1ee1f00b91ea15aaa942/public/png/modular.png -------------------------------------------------------------------------------- /public/psd/modular.psd: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:3c6d23d018d2cb9581d4e461cc57d73708d7fa3f47420664f56eca8f170835ce 3 | size 7121698 4 | --------------------------------------------------------------------------------