@iteam/supreme
Advanced tools
Comparing version 2.10.36 to 2.11.0
@@ -0,1 +1,8 @@ | ||
# [2.11.0](https://github.com/Iteam1337/supreme/compare/v2.10.36...v2.11.0) (2020-06-16) | ||
### Features | ||
* add github actions without npm release ([#223](https://github.com/Iteam1337/supreme/issues/223)) ([d76273c](https://github.com/Iteam1337/supreme/commit/d76273cd92f2cc67ffd8a021557f77c960bb6bcc)) | ||
## [2.10.36](https://github.com/Iteam1337/supreme/compare/v2.10.35...v2.10.36) (2020-06-16) | ||
@@ -2,0 +9,0 @@ |
@@ -1,1 +0,6 @@ | ||
export declare const ghactions: () => Promise<void>; | ||
import { CLIFlags } from '../'; | ||
interface GhActionsProps { | ||
flags: CLIFlags; | ||
} | ||
export declare const ghactions: ({ flags }: GhActionsProps) => Promise<void>; | ||
export {}; |
@@ -8,2 +8,3 @@ export interface CLIFlags { | ||
react?: boolean; | ||
npm: boolean; | ||
} | ||
@@ -10,0 +11,0 @@ export interface CLIProps { |
@@ -1020,10 +1020,9 @@ 'use strict'; | ||
var ghactions = function ghactions() { | ||
var ghactions = function ghactions(_ref) { | ||
var flags = _ref.flags; | ||
try { | ||
var _temp5 = function _temp5() { | ||
function _temp2() { | ||
return Promise.resolve(create({ | ||
templateName: 'ghactions/releaserc', | ||
output: '.releaserc' | ||
})).then(function () { | ||
var _temp7 = function _temp7() { | ||
function _temp4() { | ||
function _temp2() { | ||
return Promise.resolve(create({ | ||
@@ -1035,3 +1034,6 @@ templateName: 'ghactions/pr_check.yml', | ||
templateName: 'ghactions/release.yml', | ||
output: '.github/workflows/release.yml' | ||
output: '.github/workflows/release.yml', | ||
templateData: { | ||
npm: flags.npm | ||
} | ||
})).then(function () { | ||
@@ -1041,6 +1043,22 @@ console.log("Added GitHub actions in " + chalk.green(".github/workflows")); | ||
}); | ||
}); | ||
} | ||
var _temp = function () { | ||
if (flags.npm) { | ||
return Promise.resolve(create({ | ||
templateName: 'ghactions/releaserc', | ||
output: '.releaserc' | ||
})).then(function () {}); | ||
} else { | ||
return Promise.resolve(create({ | ||
templateName: 'ghactions/releaserc.nonpm', | ||
output: '.releaserc' | ||
})).then(function () {}); | ||
} | ||
}(); | ||
return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp); | ||
} | ||
var _temp = function () { | ||
var _temp3 = function () { | ||
if (!workflowsFolder) { | ||
@@ -1051,3 +1069,3 @@ return Promise.resolve(createFolder('.github/workflows')).then(function () {}); | ||
return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp); | ||
return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3); | ||
}; | ||
@@ -1060,3 +1078,3 @@ | ||
var _temp6 = function () { | ||
var _temp8 = function () { | ||
if (!githubFolder) { | ||
@@ -1067,3 +1085,3 @@ return Promise.resolve(createFolder('.github')).then(function () {}); | ||
return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(_temp5) : _temp5(_temp6)); | ||
return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(_temp7) : _temp7(_temp8)); | ||
} catch (e) { | ||
@@ -1206,3 +1224,5 @@ return Promise.reject(e); | ||
case 'ghactions': | ||
ghactions(); | ||
ghactions({ | ||
flags: flags | ||
}); | ||
break; | ||
@@ -1223,3 +1243,3 @@ | ||
/*#__PURE__*/ | ||
meow("\n Usage\n $ supreme [command]\n\n Commands\n $ init Create some configs and ignore files\n $ add <name> Add a specific config\n $ react <name> [flags] Creates a React app (CRA)\n $ reason <name> Creates a ReasonReact app\n $ snippets [flags] Copy snippets to clipboard\n $ graphql <name> Create a GraphQL API\n $ ghactions Create base GitHub actions\n $ typescript Create basic Typescript app\n\n Flags\n --javascript JavaScript app (react)\n --ide IDE for snippets (snippets) \n --language Language for snippets (snippets) \n --examples GraphQL examples (examples)\n --node ESLint node (add/init)\n --react ESLint react (add/init)\n ", { | ||
meow("\n Usage\n $ supreme [command]\n\n Commands\n $ init Create some configs and ignore files\n $ add <name> Add a specific config\n $ react <name> [flags] Creates a React app (CRA)\n $ reason <name> Creates a ReasonReact app\n $ snippets [flags] Copy snippets to clipboard\n $ graphql <name> Create a GraphQL API\n $ ghactions Create base GitHub actions\n $ typescript Create basic Typescript app\n\n Flags\n --javascript JavaScript app (react)\n --ide IDE for snippets (snippets) \n --language Language for snippets (snippets) \n --examples GraphQL examples (examples)\n --node ESLint node (add/init)\n --react ESLint react (add/init)\n --no-npm Remove npm release (ghactions) \n ", { | ||
flags: { | ||
@@ -1244,2 +1264,6 @@ javascript: { | ||
type: 'boolean' | ||
}, | ||
npm: { | ||
type: 'boolean', | ||
"default": true | ||
} | ||
@@ -1246,0 +1270,0 @@ } |
@@ -1,2 +0,2 @@ | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("chalk")),n=e(require("meow")),r=e(require("execa")),o=e(require("fs")),i=e(require("path")),s=e(require("util")),a=e(require("ejs")),c=e(require("read-pkg-up")),u=e(require("inquirer")),l=e(require("ora")),m=e(require("clipboardy"));const p=function(){function e(){}return e.prototype.then=function(t,n){const r=new e,o=this.s;if(o){const e=1&o?t:n;if(e){try{f(r,1,e(this.v))}catch(e){f(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?f(r,1,t?t(o):o):n?f(r,1,n(o)):f(r,2,o)}catch(e){f(r,2,e)}},r},e}();function f(e,t,n){if(!e.s){if(n instanceof p){if(!n.s)return void(n.o=f.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(f.bind(null,e,t),f.bind(null,e,2));e.s=t,e.v=n;const r=e.o;r&&r(e)}}function h(e,t){var n,r=-1;e:{for(var o=0;o<t.length;o++){var i=t[o][0];if(i){var s=i();if(s&&s.then)break e;if(s===e){r=o;break}}else r=o}if(-1!==r){do{for(var a=t[r][1];!a;)r++,a=t[r][1];var c=a();if(c&&c.then){n=!0;break e}var u=t[r][2];r++}while(u&&!u());return c}}const l=new p,m=f.bind(null,l,2);return(n?c.then(h):s.then((function n(s){for(;;){if(s===e){r=o;break}if(++o===t.length){if(-1!==r)break;return void f(l,1,c)}if(i=t[o][0]){if((s=i())&&s.then)return void s.then(n).then(void 0,m)}else r=o}do{for(var a=t[r][1];!a;)r++,a=t[r][1];var c=a();if(c&&c.then)return void c.then(h).then(void 0,m);var u=t[r][2];r++}while(u&&!u());f(l,1,c)}))).then(void 0,m),l;function h(e){for(;;){var n=t[r][2];if(!n||n())break;r++;for(var o=t[r][1];!o;)r++,o=t[r][1];if((e=o())&&e.then)return void e.then(h).then(void 0,m)}f(l,1,e)}}function v(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var g=function(e,n){var r=n.flag;try{var c=e.templateName,l=e.output,m=e.templateData,p=void 0===m?{}:m,f=s.promisify(o.writeFile),g=v((function(){return Promise.resolve(a.renderFile(i.join(__dirname,"../src/templates/"+c+".ejs"),p)).then((function(e){return Promise.resolve(f(i.join(process.cwd(),l),e,{flag:r})).then((function(){}))}))}),(function(n){var r=h(n.code,[[function(){return"EEXIST"},function(){return Promise.resolve(function(e){try{return console.error("File already exists "+t.yellow(e.output)),Promise.resolve(u.prompt({type:"confirm",name:"isOverwrite",message:"Do you want to overwrite the existing file?",default:!1})).then((function(t){t.isOverwrite&&P(e)}))}catch(e){return Promise.reject(e)}}(e)).then((function(){}))}],[void 0,function(){console.error("Something went wrong",n)},function(){}]]);return r&&r.then?r.then((function(){})):void 0}));return Promise.resolve(g&&g.then?g.then((function(){})):void 0)}catch(e){return Promise.reject(e)}},d=function(e){return g(e,{flag:"wx"})},P=function(e){return g(e,{flag:"w"})},b=function(e){try{var t=s.promisify(o.mkdir),n=v((function(){return Promise.resolve(t(i.resolve(process.cwd(),e))).then((function(){}))}),(function(e){console.log(e),process.exit(1)}));return Promise.resolve(n&&n.then?n.then((function(){})):void 0)}catch(e){return Promise.reject(e)}},y=function(e){return o.existsSync(i.resolve(process.cwd(),e))},j=function(e,n){void 0===n&&(n={});try{return Promise.resolve(function(e,t){try{return Promise.resolve(c(t)).then((function(t){if(!t)return!1;var n=t.packageJson.dependencies,r=t.packageJson.devDependencies;return!!n&&n.hasOwnProperty(e)||!!r&&r.hasOwnProperty(e)}))}catch(e){return Promise.reject(e)}}(e,n)).then((function(o){var i=function(){if(!o){var i="Installing "+t.blue(e);return n.spinner?n.spinner.text=i:console.log(i),Promise.resolve(r.command("npm install --save-dev --save-exact "+e,n)).then((function(){}))}}();if(i&&i.then)return i.then((function(){}))}))}catch(e){return Promise.reject(e)}},w=function(e){void 0===e&&(e={});try{return Promise.resolve(d({templateName:"gitignore",output:e.cwd?e.cwd+"/.gitignore":".gitignore"})).then((function(){}))}catch(e){return Promise.reject(e)}},k=function(e){void 0===e&&(e={});try{return Promise.resolve(j("prettier",e)).then((function(){return Promise.resolve(d({templateName:"prettierrc",output:e.cwd?e.cwd+"/.prettierrc":".prettierrc"})).then((function(){}))}))}catch(e){return Promise.reject(e)}},N=function(e){void 0===e&&(e={});try{return Promise.resolve(j("jest",e)).then((function(){return Promise.resolve(j("jest-watch-typeahead",e)).then((function(){return Promise.resolve(d({templateName:"jest.config",output:e.cwd?e.cwd+"/jest.config.js":"jest.config.js"})).then((function(){}))}))}))}catch(e){return Promise.reject(e)}},x=function(e){void 0===e&&(e={});try{return Promise.resolve(r("node",["-v"])).then((function(t){return Promise.resolve(d({templateName:"nvmrc",output:e.cwd?e.cwd+"/.nvmrc":".nvmrc",templateData:{nodeVersion:t.stdout}})).then((function(){}))}))}catch(e){return Promise.reject(e)}},_=function(e){var t=e.javascript;try{return Promise.resolve(j("@iteam/config")).then((function(){return Promise.resolve(d({templateName:"config/config.json",output:"config.json"})).then((function(){var e=!1;function n(n){var r=!1;if(e)return n;function o(e){if(r)return e;function n(){var e=function(){if(!t)return Promise.resolve(d({templateName:"config/config.ts",output:"src/config.ts"})).then((function(){}))}();if(e&&e.then)return e.then((function(){}))}b("src");var o=function(){if(t)return Promise.resolve(d({templateName:"config/config.js",output:"src/config.js"})).then((function(){}))}();return o&&o.then?o.then(n):n()}var i=v((function(){function e(e){return r?e:function(){if(n&&!t)return Promise.resolve(d({templateName:"config/config.ts",output:"src/config.ts"})).then((function(){r=!0}))}()}var n=y("src"),o=function(){if(n&&t)return Promise.resolve(d({templateName:"config/config.js",output:"src/config.js"})).then((function(){r=!0}))}();return o&&o.then?o.then(e):e(o)}),(function(){}));return i&&i.then?i.then(o):o(i)}var r=v((function(){function n(n){return e?n:function(){if(r&&!t)return Promise.resolve(d({templateName:"config/config.ts",output:"lib/config.ts"})).then((function(){e=!0}))}()}var r=y("lib"),o=function(){if(r&&t)return Promise.resolve(d({templateName:"config/config.js",output:"lib/config.js"})).then((function(){e=!0}))}();return o&&o.then?o.then(n):n(o)}),(function(){}));return r&&r.then?r.then(n):n(r)}))}))}catch(e){return Promise.reject(e)}},q=function(e){void 0===e&&(e={});try{return Promise.resolve(j("husky",e)).then((function(){return Promise.resolve(j("pretty-quick",e)).then((function(){return Promise.resolve(d({templateName:"huskyrc",output:e.cwd?e.cwd+"/.huskyrc":".huskyrc"})).then((function(){}))}))}))}catch(e){return Promise.reject(e)}},S=function(e){void 0===e&&(e={});try{return Promise.resolve(j("eslint",e)).then((function(){function t(){var t=function(){if(e.react)return Promise.resolve(j("@iteam/eslint-config-react",e)).then((function(){return Promise.resolve(j("@typescript-eslint/eslint-plugin",e)).then((function(){return Promise.resolve(j("@typescript-eslint/parser",e)).then((function(){return Promise.resolve(d({templateName:"eslint/eslintrc.react",output:e.cwd?e.cwd+"/.eslintrc":".eslintrc"})).then((function(){}))}))}))}))}();if(t&&t.then)return t.then((function(){}))}var n=function(){if(e.node)return Promise.resolve(j("@iteam/eslint-config-node",e)).then((function(){return Promise.resolve(d({templateName:"eslint/eslintrc.node",output:e.cwd?e.cwd+"/.eslintrc":".eslintrc"})).then((function(){}))}))}();return n&&n.then?n.then(t):t()}))}catch(e){return Promise.reject(e)}},C=function(e){var t,n=e.message;(t=e.template,a.renderFile(i.resolve(__dirname,"../src/templates/snippets/"+t+".ejs"))).then((function(e){m.writeSync(e),console.log(n)}))},I=function(e){var n=e.input,o=e.flags,s=e.help,a=n[0],c=n[1];switch(console.log(t.italic.bgRed(" SUPREME \n")),a){case"init":!function(e){var t=e.flags;try{Promise.resolve(_({javascript:t.javascript||!1})).then((function(){return Promise.resolve(w()).then((function(){return Promise.resolve(k()).then((function(){return Promise.resolve(N()).then((function(){return Promise.resolve(x()).then((function(){return Promise.resolve(q()).then((function(){return Promise.resolve(S({node:t.node,react:t.react})).then((function(){}))}))}))}))}))}))}))}catch(e){return Promise.reject(e)}}({flags:o});break;case"react":!function(e){var n=e.name,o=e.flags;try{console.log("Creating app "+t.blue(n||"")),Promise.resolve(r("npx",["create-react-app",n||".",o.javascript?"":"--typescript"])).then((function(){console.log(t.green("Created app "+(n||"")))}))}catch(e){return Promise.reject(e)}}({name:c,flags:o});break;case"reason":!function(e){var n=e.name;try{var o=n||"supreme-reason",s={cwd:i.join(process.cwd(),o)};console.log("Creating app "+t.blue(o));var a=l({text:"Creating folder",color:"blue"}).start();Promise.resolve(r.command("mkdir "+o)).then((function(){return Promise.resolve(r.command("mkdir public",s)).then((function(){return Promise.resolve(r.command("mkdir src",s)).then((function(){return a.text="Updating configs",Promise.resolve(P({templateName:"reason/package.json",output:o+"/package.json",templateData:{name:o}})).then((function(){return Promise.resolve(P({templateName:"reason/bsconfig.json",output:o+"/bsconfig.json",templateData:{name:o}})).then((function(){return Promise.resolve(P({templateName:"reason/webpack.config.js",output:o+"/webpack.config.js"})).then((function(){return Promise.resolve(P({templateName:"reason/README.md",output:o+"/README.md",templateData:{name:o}})).then((function(){return Promise.resolve(r.command("git init",s)).then((function(){return Promise.resolve(P({templateName:"reason/gitignore",output:o+"/.gitignore"})).then((function(){return a.text="Installing dependencies",Promise.resolve(r.command("npm install --silent",s)).then((function(){return a.text="Setting up styling",Promise.resolve(r("npx",["tailwind","init"],s)).then((function(){return Promise.resolve(d({templateName:"reason/postcss.config.js",output:o+"/postcss.config.js"})).then((function(){return Promise.resolve(d({templateName:"reason/index.css",output:o+"/src/index.css"})).then((function(){return Promise.resolve(d({templateName:"reason/index.js",output:o+"/src/index.js"})).then((function(){return Promise.resolve(d({templateName:"reason/releaserc",output:o+"/.releaserc"})).then((function(){return a.text="Updating base files",Promise.resolve(P({templateName:"reason/index.html",output:o+"/public/index.html",templateData:{name:o}})).then((function(){return Promise.resolve(P({templateName:"reason/Index.re",output:o+"/src/Index.re"})).then((function(){return Promise.resolve(d({templateName:"reason/App.re",output:o+"/src/App.re"})).then((function(){return Promise.resolve(b(o+"/__tests__")).then((function(){return Promise.resolve(d({templateName:"reason/App_test.re",output:o+"/__tests__/App_test.re"})).then((function(){a.stop(),console.log(t.green("Created app "+o)),console.log("\n\tGet your app running by opening two terminal tabs and\n\trunning the following commands:\n\n * "+t.green("npm start")+" (starts compiler)\n * "+t.green("npm run server")+" (start Webpack on port 3000)\n")}))}))}))}))}))}))}))}))}))}))}))}))}))}))}))}))}))}))}))}))}catch(e){return Promise.reject(e)}}({name:c,flags:o});break;case"add":!function(e){var t=e.command,n=e.flags;switch(t){case"nvm":case"nvmrc":x();break;case"git":case"gitignore":w();break;case"jest":N();break;case"prettier":k();break;case"config":_({javascript:n.javascript});break;case"husky":q();break;case"eslint":S({node:n.node,react:n.react});break;default:console.log(t+" is not a valid command")}}({command:c,flags:o});break;case"snippets":!function(e){var t=e.language,n=e.ide;try{if(!n)return console.log("--ide flag is missing"),Promise.resolve();if(!t)return console.log("--language flag is missing"),Promise.resolve();var r=h(n,[[function(){return"vim"},function(){return Promise.resolve(function(e){try{switch(e){case"js":case"javascript":C({template:"javascript.vim",message:"JavaScript snippets for VIM (UltiSnips) have been copied to the clipboard"});break;case"ts":case"typescript":C({template:"typescript.vim",message:"Typescript snippets for VIM (UltiSnips) have been copied to the clipboard"});break;case"reason":case"reasonml":C({template:"reason.vim",message:"ReasonML snippets for VIM (UltiSnips) have been copied to the clipboard"});break;default:console.log("I don't have any snippets for that language ("+e+")")}return Promise.resolve()}catch(e){return Promise.reject(e)}}(t)).then((function(){}))}],[function(){return"vscode"},function(){return Promise.resolve(function(e){try{switch(e){case"reason":case"reasonml":C({template:"reason.vscode",message:"ReasonML snippets for VSCode have been copied to the clipboard"});break;default:console.log("I don't have any snippets for that language ("+e+")")}return Promise.resolve()}catch(e){return Promise.reject(e)}}(t)).then((function(){}))}],[void 0,function(){console.log("I don't have any snippets for that IDE ("+n+")")},function(){}]]);Promise.resolve(r&&r.then?r.then((function(){})):void 0)}catch(e){return Promise.reject(e)}}({language:o.language,ide:o.ide});break;case"graphql":!function(e){var n=e.name,o=e.flags;try{if(!n)return console.log("No name provided"),Promise.resolve();var s={cwd:i.join(process.cwd(),n)},a=l({text:"Creating folder",color:"blue"}).start();Promise.resolve(b(n)).then((function(){return a.text="Creating empty git repository",Promise.resolve(r.command("git init",s)).then((function(){return Promise.resolve(P({templateName:"graphql/gitignore",output:n+"/.gitignore"})).then((function(){return a.text="Installing dependencies",Promise.resolve(d({templateName:"graphql/package.json",output:n+"/package.json",templateData:{name:n}})).then((function(){return Promise.resolve(r.command("npm install --silent",s)).then((function(){return Promise.resolve(k({cwd:n,spinner:a})).then((function(){return Promise.resolve(N({cwd:n,spinner:a})).then((function(){return Promise.resolve(x({cwd:n,spinner:a})).then((function(){return Promise.resolve(q({cwd:n,spinner:a})).then((function(){return Promise.resolve(S({cwd:n,node:!0,spinner:a})).then((function(){return a.text="Creating base files",Promise.resolve(d({templateName:"typescript/tsconfig.json",output:n+"/tsconfig.json"})).then((function(){return Promise.resolve(b(n+"/lib")).then((function(){return Promise.resolve(b(n+"/lib/__generated__")).then((function(){function e(){return Promise.resolve(d({templateName:"graphql/codegen.yml",output:n+"/codegen.yml"})).then((function(){a.stop(),console.log(t.green("Created app "+n)),console.log("\n Start the API by running:\n\n * "+t.green("cd "+n)+"\n * "+t.green("npm run dev")+" (starts API on port 4000)\n ")}))}var r=o.examples?Promise.resolve(d({templateName:"graphql/serverExample.ts",output:n+"/lib/server.ts"})).then((function(){return Promise.resolve(b(n+"/lib/resolvers")).then((function(){return Promise.resolve(d({templateName:"graphql/resolversExample.ts",output:n+"/lib/resolvers/queue.ts"})).then((function(){return Promise.resolve(d({templateName:"graphql/graphqlExample.d.ts",output:n+"/lib/__generated__/graphql.d.ts"})).then((function(){}))}))}))})):Promise.resolve(d({templateName:"graphql/server.ts",output:n+"/lib/server.ts"})).then((function(){return Promise.resolve(d({templateName:"graphql/graphql.d.ts",output:n+"/lib/__generated__/graphql.d.ts"})).then((function(){}))}));return r&&r.then?r.then(e):e()}))}))}))}))}))}))}))}))}))}))}))}))}))}catch(e){return Promise.reject(e)}}({name:c,flags:o});break;case"ghactions":!function(){try{var e=function(){function e(){return Promise.resolve(d({templateName:"ghactions/releaserc",output:".releaserc"})).then((function(){return Promise.resolve(d({templateName:"ghactions/pr_check.yml",output:".github/workflows/pr_check.yml"})).then((function(){return Promise.resolve(d({templateName:"ghactions/release.yml",output:".github/workflows/release.yml"})).then((function(){console.log("Added GitHub actions in "+t.green(".github/workflows"))}))}))}))}var n=function(){if(!r)return Promise.resolve(b(".github/workflows")).then((function(){}))}();return n&&n.then?n.then(e):e()},n=y(".github"),r=y(".github/workflows");j("@semantic-release/changelog"),j("@semantic-release/git");var o=function(){if(!n)return Promise.resolve(b(".github")).then((function(){}))}();Promise.resolve(o&&o.then?o.then(e):e())}catch(e){return Promise.reject(e)}}();break;case"typescript":!function(e){var n=e.name;try{if(!n)return console.log("No name provided"),Promise.resolve();var o={cwd:i.join(process.cwd(),n)},s=l({text:"Creating folder",color:"blue"}).start();Promise.resolve(b(n)).then((function(){return Promise.resolve(d({templateName:"typescript/package.json",output:n+"/package.json",templateData:{name:n}})).then((function(){return s.text="Installing dependencies",Promise.resolve(r.command("npm install --silent",o)).then((function(){return Promise.resolve(k({cwd:n,spinner:s})).then((function(){return Promise.resolve(N({cwd:n,spinner:s})).then((function(){return Promise.resolve(x({cwd:n,spinner:s})).then((function(){return Promise.resolve(q({cwd:n,spinner:s})).then((function(){return Promise.resolve(w({cwd:n,spinner:s})).then((function(){return Promise.resolve(S({cwd:n,node:!0,spinner:s})).then((function(){return s.text="Creating files",Promise.resolve(b(n+"/lib")).then((function(){return Promise.resolve(d({templateName:"typescript/tsconfig.json",output:n+"/tsconfig.json"})).then((function(){return Promise.resolve(d({templateName:"typescript/index.ts",output:n+"/lib/index.ts"})).then((function(){s.stop(),console.log(t.green("Created app "+n)),console.log("\n Build the app by running:\n\n * "+t.green("cd "+n)+"\n * "+t.green("npm run build")+" (builds app)\n ")}))}))}))}))}))}))}))}))}))}))}))}))}catch(e){return Promise.reject(e)}}({name:c,flags:o});break;default:console.log(s)}};I(n("\n Usage\n $ supreme [command]\n\n Commands\n $ init Create some configs and ignore files\n $ add <name> Add a specific config\n $ react <name> [flags] Creates a React app (CRA)\n $ reason <name> Creates a ReasonReact app\n $ snippets [flags] Copy snippets to clipboard\n $ graphql <name> Create a GraphQL API\n $ ghactions Create base GitHub actions\n $ typescript Create basic Typescript app\n\n Flags\n --javascript JavaScript app (react)\n --ide IDE for snippets (snippets) \n --language Language for snippets (snippets) \n --examples GraphQL examples (examples)\n --node ESLint node (add/init)\n --react ESLint react (add/init)\n ",{flags:{javascript:{default:!1,type:"boolean"},ide:{type:"string"},language:{type:"string"},examples:{type:"boolean"},react:{type:"boolean"},node:{type:"boolean"}}})),exports.run=I; | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("chalk")),n=e(require("meow")),r=e(require("execa")),o=e(require("fs")),i=e(require("path")),s=e(require("util")),a=e(require("ejs")),c=e(require("read-pkg-up")),u=e(require("inquirer")),l=e(require("ora")),m=e(require("clipboardy"));const p=function(){function e(){}return e.prototype.then=function(t,n){const r=new e,o=this.s;if(o){const e=1&o?t:n;if(e){try{f(r,1,e(this.v))}catch(e){f(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?f(r,1,t?t(o):o):n?f(r,1,n(o)):f(r,2,o)}catch(e){f(r,2,e)}},r},e}();function f(e,t,n){if(!e.s){if(n instanceof p){if(!n.s)return void(n.o=f.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(f.bind(null,e,t),f.bind(null,e,2));e.s=t,e.v=n;const r=e.o;r&&r(e)}}function h(e,t){var n,r=-1;e:{for(var o=0;o<t.length;o++){var i=t[o][0];if(i){var s=i();if(s&&s.then)break e;if(s===e){r=o;break}}else r=o}if(-1!==r){do{for(var a=t[r][1];!a;)r++,a=t[r][1];var c=a();if(c&&c.then){n=!0;break e}var u=t[r][2];r++}while(u&&!u());return c}}const l=new p,m=f.bind(null,l,2);return(n?c.then(h):s.then((function n(s){for(;;){if(s===e){r=o;break}if(++o===t.length){if(-1!==r)break;return void f(l,1,c)}if(i=t[o][0]){if((s=i())&&s.then)return void s.then(n).then(void 0,m)}else r=o}do{for(var a=t[r][1];!a;)r++,a=t[r][1];var c=a();if(c&&c.then)return void c.then(h).then(void 0,m);var u=t[r][2];r++}while(u&&!u());f(l,1,c)}))).then(void 0,m),l;function h(e){for(;;){var n=t[r][2];if(!n||n())break;r++;for(var o=t[r][1];!o;)r++,o=t[r][1];if((e=o())&&e.then)return void e.then(h).then(void 0,m)}f(l,1,e)}}function v(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var g=function(e,n){var r=n.flag;try{var c=e.templateName,l=e.output,m=e.templateData,p=void 0===m?{}:m,f=s.promisify(o.writeFile),g=v((function(){return Promise.resolve(a.renderFile(i.join(__dirname,"../src/templates/"+c+".ejs"),p)).then((function(e){return Promise.resolve(f(i.join(process.cwd(),l),e,{flag:r})).then((function(){}))}))}),(function(n){var r=h(n.code,[[function(){return"EEXIST"},function(){return Promise.resolve(function(e){try{return console.error("File already exists "+t.yellow(e.output)),Promise.resolve(u.prompt({type:"confirm",name:"isOverwrite",message:"Do you want to overwrite the existing file?",default:!1})).then((function(t){t.isOverwrite&&P(e)}))}catch(e){return Promise.reject(e)}}(e)).then((function(){}))}],[void 0,function(){console.error("Something went wrong",n)},function(){}]]);return r&&r.then?r.then((function(){})):void 0}));return Promise.resolve(g&&g.then?g.then((function(){})):void 0)}catch(e){return Promise.reject(e)}},d=function(e){return g(e,{flag:"wx"})},P=function(e){return g(e,{flag:"w"})},b=function(e){try{var t=s.promisify(o.mkdir),n=v((function(){return Promise.resolve(t(i.resolve(process.cwd(),e))).then((function(){}))}),(function(e){console.log(e),process.exit(1)}));return Promise.resolve(n&&n.then?n.then((function(){})):void 0)}catch(e){return Promise.reject(e)}},y=function(e){return o.existsSync(i.resolve(process.cwd(),e))},j=function(e,n){void 0===n&&(n={});try{return Promise.resolve(function(e,t){try{return Promise.resolve(c(t)).then((function(t){if(!t)return!1;var n=t.packageJson.dependencies,r=t.packageJson.devDependencies;return!!n&&n.hasOwnProperty(e)||!!r&&r.hasOwnProperty(e)}))}catch(e){return Promise.reject(e)}}(e,n)).then((function(o){var i=function(){if(!o){var i="Installing "+t.blue(e);return n.spinner?n.spinner.text=i:console.log(i),Promise.resolve(r.command("npm install --save-dev --save-exact "+e,n)).then((function(){}))}}();if(i&&i.then)return i.then((function(){}))}))}catch(e){return Promise.reject(e)}},w=function(e){void 0===e&&(e={});try{return Promise.resolve(d({templateName:"gitignore",output:e.cwd?e.cwd+"/.gitignore":".gitignore"})).then((function(){}))}catch(e){return Promise.reject(e)}},k=function(e){void 0===e&&(e={});try{return Promise.resolve(j("prettier",e)).then((function(){return Promise.resolve(d({templateName:"prettierrc",output:e.cwd?e.cwd+"/.prettierrc":".prettierrc"})).then((function(){}))}))}catch(e){return Promise.reject(e)}},N=function(e){void 0===e&&(e={});try{return Promise.resolve(j("jest",e)).then((function(){return Promise.resolve(j("jest-watch-typeahead",e)).then((function(){return Promise.resolve(d({templateName:"jest.config",output:e.cwd?e.cwd+"/jest.config.js":"jest.config.js"})).then((function(){}))}))}))}catch(e){return Promise.reject(e)}},x=function(e){void 0===e&&(e={});try{return Promise.resolve(r("node",["-v"])).then((function(t){return Promise.resolve(d({templateName:"nvmrc",output:e.cwd?e.cwd+"/.nvmrc":".nvmrc",templateData:{nodeVersion:t.stdout}})).then((function(){}))}))}catch(e){return Promise.reject(e)}},_=function(e){var t=e.javascript;try{return Promise.resolve(j("@iteam/config")).then((function(){return Promise.resolve(d({templateName:"config/config.json",output:"config.json"})).then((function(){var e=!1;function n(n){var r=!1;if(e)return n;function o(e){if(r)return e;function n(){var e=function(){if(!t)return Promise.resolve(d({templateName:"config/config.ts",output:"src/config.ts"})).then((function(){}))}();if(e&&e.then)return e.then((function(){}))}b("src");var o=function(){if(t)return Promise.resolve(d({templateName:"config/config.js",output:"src/config.js"})).then((function(){}))}();return o&&o.then?o.then(n):n()}var i=v((function(){function e(e){return r?e:function(){if(n&&!t)return Promise.resolve(d({templateName:"config/config.ts",output:"src/config.ts"})).then((function(){r=!0}))}()}var n=y("src"),o=function(){if(n&&t)return Promise.resolve(d({templateName:"config/config.js",output:"src/config.js"})).then((function(){r=!0}))}();return o&&o.then?o.then(e):e(o)}),(function(){}));return i&&i.then?i.then(o):o(i)}var r=v((function(){function n(n){return e?n:function(){if(r&&!t)return Promise.resolve(d({templateName:"config/config.ts",output:"lib/config.ts"})).then((function(){e=!0}))}()}var r=y("lib"),o=function(){if(r&&t)return Promise.resolve(d({templateName:"config/config.js",output:"lib/config.js"})).then((function(){e=!0}))}();return o&&o.then?o.then(n):n(o)}),(function(){}));return r&&r.then?r.then(n):n(r)}))}))}catch(e){return Promise.reject(e)}},q=function(e){void 0===e&&(e={});try{return Promise.resolve(j("husky",e)).then((function(){return Promise.resolve(j("pretty-quick",e)).then((function(){return Promise.resolve(d({templateName:"huskyrc",output:e.cwd?e.cwd+"/.huskyrc":".huskyrc"})).then((function(){}))}))}))}catch(e){return Promise.reject(e)}},S=function(e){void 0===e&&(e={});try{return Promise.resolve(j("eslint",e)).then((function(){function t(){var t=function(){if(e.react)return Promise.resolve(j("@iteam/eslint-config-react",e)).then((function(){return Promise.resolve(j("@typescript-eslint/eslint-plugin",e)).then((function(){return Promise.resolve(j("@typescript-eslint/parser",e)).then((function(){return Promise.resolve(d({templateName:"eslint/eslintrc.react",output:e.cwd?e.cwd+"/.eslintrc":".eslintrc"})).then((function(){}))}))}))}))}();if(t&&t.then)return t.then((function(){}))}var n=function(){if(e.node)return Promise.resolve(j("@iteam/eslint-config-node",e)).then((function(){return Promise.resolve(d({templateName:"eslint/eslintrc.node",output:e.cwd?e.cwd+"/.eslintrc":".eslintrc"})).then((function(){}))}))}();return n&&n.then?n.then(t):t()}))}catch(e){return Promise.reject(e)}},C=function(e){var t,n=e.message;(t=e.template,a.renderFile(i.resolve(__dirname,"../src/templates/snippets/"+t+".ejs"))).then((function(e){m.writeSync(e),console.log(n)}))},I=function(e){var n=e.input,o=e.flags,s=e.help,a=n[0],c=n[1];switch(console.log(t.italic.bgRed(" SUPREME \n")),a){case"init":!function(e){var t=e.flags;try{Promise.resolve(_({javascript:t.javascript||!1})).then((function(){return Promise.resolve(w()).then((function(){return Promise.resolve(k()).then((function(){return Promise.resolve(N()).then((function(){return Promise.resolve(x()).then((function(){return Promise.resolve(q()).then((function(){return Promise.resolve(S({node:t.node,react:t.react})).then((function(){}))}))}))}))}))}))}))}catch(e){return Promise.reject(e)}}({flags:o});break;case"react":!function(e){var n=e.name,o=e.flags;try{console.log("Creating app "+t.blue(n||"")),Promise.resolve(r("npx",["create-react-app",n||".",o.javascript?"":"--typescript"])).then((function(){console.log(t.green("Created app "+(n||"")))}))}catch(e){return Promise.reject(e)}}({name:c,flags:o});break;case"reason":!function(e){var n=e.name;try{var o=n||"supreme-reason",s={cwd:i.join(process.cwd(),o)};console.log("Creating app "+t.blue(o));var a=l({text:"Creating folder",color:"blue"}).start();Promise.resolve(r.command("mkdir "+o)).then((function(){return Promise.resolve(r.command("mkdir public",s)).then((function(){return Promise.resolve(r.command("mkdir src",s)).then((function(){return a.text="Updating configs",Promise.resolve(P({templateName:"reason/package.json",output:o+"/package.json",templateData:{name:o}})).then((function(){return Promise.resolve(P({templateName:"reason/bsconfig.json",output:o+"/bsconfig.json",templateData:{name:o}})).then((function(){return Promise.resolve(P({templateName:"reason/webpack.config.js",output:o+"/webpack.config.js"})).then((function(){return Promise.resolve(P({templateName:"reason/README.md",output:o+"/README.md",templateData:{name:o}})).then((function(){return Promise.resolve(r.command("git init",s)).then((function(){return Promise.resolve(P({templateName:"reason/gitignore",output:o+"/.gitignore"})).then((function(){return a.text="Installing dependencies",Promise.resolve(r.command("npm install --silent",s)).then((function(){return a.text="Setting up styling",Promise.resolve(r("npx",["tailwind","init"],s)).then((function(){return Promise.resolve(d({templateName:"reason/postcss.config.js",output:o+"/postcss.config.js"})).then((function(){return Promise.resolve(d({templateName:"reason/index.css",output:o+"/src/index.css"})).then((function(){return Promise.resolve(d({templateName:"reason/index.js",output:o+"/src/index.js"})).then((function(){return Promise.resolve(d({templateName:"reason/releaserc",output:o+"/.releaserc"})).then((function(){return a.text="Updating base files",Promise.resolve(P({templateName:"reason/index.html",output:o+"/public/index.html",templateData:{name:o}})).then((function(){return Promise.resolve(P({templateName:"reason/Index.re",output:o+"/src/Index.re"})).then((function(){return Promise.resolve(d({templateName:"reason/App.re",output:o+"/src/App.re"})).then((function(){return Promise.resolve(b(o+"/__tests__")).then((function(){return Promise.resolve(d({templateName:"reason/App_test.re",output:o+"/__tests__/App_test.re"})).then((function(){a.stop(),console.log(t.green("Created app "+o)),console.log("\n\tGet your app running by opening two terminal tabs and\n\trunning the following commands:\n\n * "+t.green("npm start")+" (starts compiler)\n * "+t.green("npm run server")+" (start Webpack on port 3000)\n")}))}))}))}))}))}))}))}))}))}))}))}))}))}))}))}))}))}))}))}))}catch(e){return Promise.reject(e)}}({name:c,flags:o});break;case"add":!function(e){var t=e.command,n=e.flags;switch(t){case"nvm":case"nvmrc":x();break;case"git":case"gitignore":w();break;case"jest":N();break;case"prettier":k();break;case"config":_({javascript:n.javascript});break;case"husky":q();break;case"eslint":S({node:n.node,react:n.react});break;default:console.log(t+" is not a valid command")}}({command:c,flags:o});break;case"snippets":!function(e){var t=e.language,n=e.ide;try{if(!n)return console.log("--ide flag is missing"),Promise.resolve();if(!t)return console.log("--language flag is missing"),Promise.resolve();var r=h(n,[[function(){return"vim"},function(){return Promise.resolve(function(e){try{switch(e){case"js":case"javascript":C({template:"javascript.vim",message:"JavaScript snippets for VIM (UltiSnips) have been copied to the clipboard"});break;case"ts":case"typescript":C({template:"typescript.vim",message:"Typescript snippets for VIM (UltiSnips) have been copied to the clipboard"});break;case"reason":case"reasonml":C({template:"reason.vim",message:"ReasonML snippets for VIM (UltiSnips) have been copied to the clipboard"});break;default:console.log("I don't have any snippets for that language ("+e+")")}return Promise.resolve()}catch(e){return Promise.reject(e)}}(t)).then((function(){}))}],[function(){return"vscode"},function(){return Promise.resolve(function(e){try{switch(e){case"reason":case"reasonml":C({template:"reason.vscode",message:"ReasonML snippets for VSCode have been copied to the clipboard"});break;default:console.log("I don't have any snippets for that language ("+e+")")}return Promise.resolve()}catch(e){return Promise.reject(e)}}(t)).then((function(){}))}],[void 0,function(){console.log("I don't have any snippets for that IDE ("+n+")")},function(){}]]);Promise.resolve(r&&r.then?r.then((function(){})):void 0)}catch(e){return Promise.reject(e)}}({language:o.language,ide:o.ide});break;case"graphql":!function(e){var n=e.name,o=e.flags;try{if(!n)return console.log("No name provided"),Promise.resolve();var s={cwd:i.join(process.cwd(),n)},a=l({text:"Creating folder",color:"blue"}).start();Promise.resolve(b(n)).then((function(){return a.text="Creating empty git repository",Promise.resolve(r.command("git init",s)).then((function(){return Promise.resolve(P({templateName:"graphql/gitignore",output:n+"/.gitignore"})).then((function(){return a.text="Installing dependencies",Promise.resolve(d({templateName:"graphql/package.json",output:n+"/package.json",templateData:{name:n}})).then((function(){return Promise.resolve(r.command("npm install --silent",s)).then((function(){return Promise.resolve(k({cwd:n,spinner:a})).then((function(){return Promise.resolve(N({cwd:n,spinner:a})).then((function(){return Promise.resolve(x({cwd:n,spinner:a})).then((function(){return Promise.resolve(q({cwd:n,spinner:a})).then((function(){return Promise.resolve(S({cwd:n,node:!0,spinner:a})).then((function(){return a.text="Creating base files",Promise.resolve(d({templateName:"typescript/tsconfig.json",output:n+"/tsconfig.json"})).then((function(){return Promise.resolve(b(n+"/lib")).then((function(){return Promise.resolve(b(n+"/lib/__generated__")).then((function(){function e(){return Promise.resolve(d({templateName:"graphql/codegen.yml",output:n+"/codegen.yml"})).then((function(){a.stop(),console.log(t.green("Created app "+n)),console.log("\n Start the API by running:\n\n * "+t.green("cd "+n)+"\n * "+t.green("npm run dev")+" (starts API on port 4000)\n ")}))}var r=o.examples?Promise.resolve(d({templateName:"graphql/serverExample.ts",output:n+"/lib/server.ts"})).then((function(){return Promise.resolve(b(n+"/lib/resolvers")).then((function(){return Promise.resolve(d({templateName:"graphql/resolversExample.ts",output:n+"/lib/resolvers/queue.ts"})).then((function(){return Promise.resolve(d({templateName:"graphql/graphqlExample.d.ts",output:n+"/lib/__generated__/graphql.d.ts"})).then((function(){}))}))}))})):Promise.resolve(d({templateName:"graphql/server.ts",output:n+"/lib/server.ts"})).then((function(){return Promise.resolve(d({templateName:"graphql/graphql.d.ts",output:n+"/lib/__generated__/graphql.d.ts"})).then((function(){}))}));return r&&r.then?r.then(e):e()}))}))}))}))}))}))}))}))}))}))}))}))}))}catch(e){return Promise.reject(e)}}({name:c,flags:o});break;case"ghactions":!function(e){var n=e.flags;try{var r=function(){function e(){function e(){return Promise.resolve(d({templateName:"ghactions/pr_check.yml",output:".github/workflows/pr_check.yml"})).then((function(){return Promise.resolve(d({templateName:"ghactions/release.yml",output:".github/workflows/release.yml",templateData:{npm:n.npm}})).then((function(){console.log("Added GitHub actions in "+t.green(".github/workflows"))}))}))}var r=n.npm?Promise.resolve(d({templateName:"ghactions/releaserc",output:".releaserc"})).then((function(){})):Promise.resolve(d({templateName:"ghactions/releaserc.nonpm",output:".releaserc"})).then((function(){}));return r&&r.then?r.then(e):e()}var r=function(){if(!i)return Promise.resolve(b(".github/workflows")).then((function(){}))}();return r&&r.then?r.then(e):e()},o=y(".github"),i=y(".github/workflows");j("@semantic-release/changelog"),j("@semantic-release/git");var s=function(){if(!o)return Promise.resolve(b(".github")).then((function(){}))}();Promise.resolve(s&&s.then?s.then(r):r())}catch(e){return Promise.reject(e)}}({flags:o});break;case"typescript":!function(e){var n=e.name;try{if(!n)return console.log("No name provided"),Promise.resolve();var o={cwd:i.join(process.cwd(),n)},s=l({text:"Creating folder",color:"blue"}).start();Promise.resolve(b(n)).then((function(){return Promise.resolve(d({templateName:"typescript/package.json",output:n+"/package.json",templateData:{name:n}})).then((function(){return s.text="Installing dependencies",Promise.resolve(r.command("npm install --silent",o)).then((function(){return Promise.resolve(k({cwd:n,spinner:s})).then((function(){return Promise.resolve(N({cwd:n,spinner:s})).then((function(){return Promise.resolve(x({cwd:n,spinner:s})).then((function(){return Promise.resolve(q({cwd:n,spinner:s})).then((function(){return Promise.resolve(w({cwd:n,spinner:s})).then((function(){return Promise.resolve(S({cwd:n,node:!0,spinner:s})).then((function(){return s.text="Creating files",Promise.resolve(b(n+"/lib")).then((function(){return Promise.resolve(d({templateName:"typescript/tsconfig.json",output:n+"/tsconfig.json"})).then((function(){return Promise.resolve(d({templateName:"typescript/index.ts",output:n+"/lib/index.ts"})).then((function(){s.stop(),console.log(t.green("Created app "+n)),console.log("\n Build the app by running:\n\n * "+t.green("cd "+n)+"\n * "+t.green("npm run build")+" (builds app)\n ")}))}))}))}))}))}))}))}))}))}))}))}))}catch(e){return Promise.reject(e)}}({name:c,flags:o});break;default:console.log(s)}};I(n("\n Usage\n $ supreme [command]\n\n Commands\n $ init Create some configs and ignore files\n $ add <name> Add a specific config\n $ react <name> [flags] Creates a React app (CRA)\n $ reason <name> Creates a ReasonReact app\n $ snippets [flags] Copy snippets to clipboard\n $ graphql <name> Create a GraphQL API\n $ ghactions Create base GitHub actions\n $ typescript Create basic Typescript app\n\n Flags\n --javascript JavaScript app (react)\n --ide IDE for snippets (snippets) \n --language Language for snippets (snippets) \n --examples GraphQL examples (examples)\n --node ESLint node (add/init)\n --react ESLint react (add/init)\n --no-npm Remove npm release (ghactions) \n ",{flags:{javascript:{default:!1,type:"boolean"},ide:{type:"string"},language:{type:"string"},examples:{type:"boolean"},react:{type:"boolean"},node:{type:"boolean"},npm:{type:"boolean",default:!0}}})),exports.run=I; | ||
//# sourceMappingURL=supreme.cjs.production.min.js.map |
@@ -1014,10 +1014,9 @@ import chalk from 'chalk'; | ||
var ghactions = function ghactions() { | ||
var ghactions = function ghactions(_ref) { | ||
var flags = _ref.flags; | ||
try { | ||
var _temp5 = function _temp5() { | ||
function _temp2() { | ||
return Promise.resolve(create({ | ||
templateName: 'ghactions/releaserc', | ||
output: '.releaserc' | ||
})).then(function () { | ||
var _temp7 = function _temp7() { | ||
function _temp4() { | ||
function _temp2() { | ||
return Promise.resolve(create({ | ||
@@ -1029,3 +1028,6 @@ templateName: 'ghactions/pr_check.yml', | ||
templateName: 'ghactions/release.yml', | ||
output: '.github/workflows/release.yml' | ||
output: '.github/workflows/release.yml', | ||
templateData: { | ||
npm: flags.npm | ||
} | ||
})).then(function () { | ||
@@ -1035,6 +1037,22 @@ console.log("Added GitHub actions in " + chalk.green(".github/workflows")); | ||
}); | ||
}); | ||
} | ||
var _temp = function () { | ||
if (flags.npm) { | ||
return Promise.resolve(create({ | ||
templateName: 'ghactions/releaserc', | ||
output: '.releaserc' | ||
})).then(function () {}); | ||
} else { | ||
return Promise.resolve(create({ | ||
templateName: 'ghactions/releaserc.nonpm', | ||
output: '.releaserc' | ||
})).then(function () {}); | ||
} | ||
}(); | ||
return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp); | ||
} | ||
var _temp = function () { | ||
var _temp3 = function () { | ||
if (!workflowsFolder) { | ||
@@ -1045,3 +1063,3 @@ return Promise.resolve(createFolder('.github/workflows')).then(function () {}); | ||
return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp); | ||
return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3); | ||
}; | ||
@@ -1054,3 +1072,3 @@ | ||
var _temp6 = function () { | ||
var _temp8 = function () { | ||
if (!githubFolder) { | ||
@@ -1061,3 +1079,3 @@ return Promise.resolve(createFolder('.github')).then(function () {}); | ||
return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(_temp5) : _temp5(_temp6)); | ||
return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(_temp7) : _temp7(_temp8)); | ||
} catch (e) { | ||
@@ -1200,3 +1218,5 @@ return Promise.reject(e); | ||
case 'ghactions': | ||
ghactions(); | ||
ghactions({ | ||
flags: flags | ||
}); | ||
break; | ||
@@ -1217,3 +1237,3 @@ | ||
/*#__PURE__*/ | ||
meow("\n Usage\n $ supreme [command]\n\n Commands\n $ init Create some configs and ignore files\n $ add <name> Add a specific config\n $ react <name> [flags] Creates a React app (CRA)\n $ reason <name> Creates a ReasonReact app\n $ snippets [flags] Copy snippets to clipboard\n $ graphql <name> Create a GraphQL API\n $ ghactions Create base GitHub actions\n $ typescript Create basic Typescript app\n\n Flags\n --javascript JavaScript app (react)\n --ide IDE for snippets (snippets) \n --language Language for snippets (snippets) \n --examples GraphQL examples (examples)\n --node ESLint node (add/init)\n --react ESLint react (add/init)\n ", { | ||
meow("\n Usage\n $ supreme [command]\n\n Commands\n $ init Create some configs and ignore files\n $ add <name> Add a specific config\n $ react <name> [flags] Creates a React app (CRA)\n $ reason <name> Creates a ReasonReact app\n $ snippets [flags] Copy snippets to clipboard\n $ graphql <name> Create a GraphQL API\n $ ghactions Create base GitHub actions\n $ typescript Create basic Typescript app\n\n Flags\n --javascript JavaScript app (react)\n --ide IDE for snippets (snippets) \n --language Language for snippets (snippets) \n --examples GraphQL examples (examples)\n --node ESLint node (add/init)\n --react ESLint react (add/init)\n --no-npm Remove npm release (ghactions) \n ", { | ||
flags: { | ||
@@ -1238,2 +1258,6 @@ javascript: { | ||
type: 'boolean' | ||
}, | ||
npm: { | ||
type: 'boolean', | ||
"default": true | ||
} | ||
@@ -1240,0 +1264,0 @@ } |
@@ -6,3 +6,3 @@ import { Ora } from 'ora'; | ||
templateData?: { | ||
[key: string]: string; | ||
[key: string]: string | boolean; | ||
}; | ||
@@ -9,0 +9,0 @@ } |
{ | ||
"name": "@iteam/supreme", | ||
"version": "2.10.36", | ||
"version": "2.11.0", | ||
"description": "A CLI tool that helps you get up an running fast", | ||
@@ -5,0 +5,0 @@ "author": { |
import { create, createFolder, folderExists, installPkg } from '../utils/file' | ||
import chalk from 'chalk' | ||
import { CLIFlags } from '../' | ||
export const ghactions = async () => { | ||
interface GhActionsProps { | ||
flags: CLIFlags | ||
} | ||
export const ghactions = async ({ flags }: GhActionsProps) => { | ||
const githubFolder = folderExists('.github') | ||
@@ -19,6 +24,13 @@ const workflowsFolder = folderExists('.github/workflows') | ||
await create({ | ||
templateName: 'ghactions/releaserc', | ||
output: '.releaserc', | ||
}) | ||
if (flags.npm) { | ||
await create({ | ||
templateName: 'ghactions/releaserc', | ||
output: '.releaserc', | ||
}) | ||
} else { | ||
await create({ | ||
templateName: 'ghactions/releaserc.nonpm', | ||
output: '.releaserc', | ||
}) | ||
} | ||
@@ -33,2 +45,5 @@ await create({ | ||
output: '.github/workflows/release.yml', | ||
templateData: { | ||
npm: flags.npm, | ||
}, | ||
}) | ||
@@ -35,0 +50,0 @@ |
@@ -19,2 +19,3 @@ import chalk from 'chalk' | ||
react?: boolean | ||
npm: boolean | ||
} | ||
@@ -56,3 +57,3 @@ | ||
case 'ghactions': | ||
ghactions() | ||
ghactions({ flags: flags as CLIFlags }) | ||
break | ||
@@ -89,2 +90,3 @@ case 'typescript': | ||
--react ESLint react (add/init) | ||
--no-npm Remove npm release (ghactions) | ||
`, | ||
@@ -112,2 +114,6 @@ { | ||
}, | ||
npm: { | ||
type: 'boolean', | ||
default: true, | ||
}, | ||
}, | ||
@@ -114,0 +120,0 @@ } |
@@ -14,3 +14,3 @@ import chalk from 'chalk' | ||
output: string | ||
templateData?: { [key: string]: string } | ||
templateData?: { [key: string]: string | boolean } | ||
} | ||
@@ -17,0 +17,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
388927
76
3300