@crosscopy/crosscopy-cli
Advanced tools
| # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created | ||
| # For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages | ||
| name: Node.js Package | ||
| on: | ||
| release: | ||
| types: [created] | ||
| jobs: | ||
| publish-npm: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: 16 | ||
| registry-url: https://registry.npmjs.org/ | ||
| - run: npm ci | ||
| - run: npm run build | ||
| - run: ls & ls dist | ||
| - run: npm publish | ||
| env: | ||
| NODE_AUTH_TOKEN: ${{secrets.npm_token}} |
| # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created | ||
| # For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages | ||
| name: Test Building | ||
| on: [push] | ||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: 16 | ||
| - run: npm ci | ||
| - run: npm run build | ||
| - run: ls && ls dist |
| #!/usr/bin/env node | ||
| var $g5Y9E$chalk = require("chalk"); | ||
| var $g5Y9E$inquirer = require("inquirer"); | ||
| var $g5Y9E$figlet = require("figlet"); | ||
| var $g5Y9E$chalkanimation = require("chalk-animation"); | ||
| function $parcel$interopDefault(a) { | ||
| return a && a.__esModule ? a.default : a; | ||
| } | ||
| const $80bd448eb6ea085b$var$sleep = (ms = 2000)=>new Promise((r)=>setTimeout(r, ms)); | ||
| console.log((0, ($parcel$interopDefault($g5Y9E$chalk))).blue((0, ($parcel$interopDefault($g5Y9E$figlet))).textSync("Huakun Zui Shuai!!!"))); | ||
| console.log((0, ($parcel$interopDefault($g5Y9E$chalk))).blue((0, ($parcel$interopDefault($g5Y9E$figlet))).textSync("Huakun Zui Shuai!!!"))); | ||
| async function $80bd448eb6ea085b$var$entrypoint() { | ||
| const rainbow = (0, ($parcel$interopDefault($g5Y9E$chalkanimation))).rainbow("Huakun Zui Shuai!!!"); | ||
| rainbow.start(); | ||
| await $80bd448eb6ea085b$var$sleep(); | ||
| rainbow.stop(); | ||
| } | ||
| (async function() { | ||
| await $80bd448eb6ea085b$var$entrypoint(); | ||
| (0, $g5Y9E$inquirer.prompt)([ | ||
| { | ||
| type: "list", | ||
| name: "handsomeCoder", | ||
| message: "Who is the most handsome coder in the world?", | ||
| choices: [ | ||
| "Huakun", | ||
| "Huakun Shen" | ||
| ] | ||
| }, | ||
| ]).then((answers)=>{ | ||
| const rainbow = (0, ($parcel$interopDefault($g5Y9E$chalkanimation))).rainbow(`Congrats! You are right, ${answers.handsomeCoder} Is The Most Handsome Coder.`); | ||
| rainbow.start(); | ||
| rainbow.stop(); | ||
| }); | ||
| })(); | ||
| //# sourceMappingURL=index.tmp.cjs.map |
| {"mappings":";;;;;;;;AAAA;;;;AAMA,MAAM,2BAAK,GAAG,CAAC,EAAE,GAAG,IAAI,GAAK,IAAI,OAAO,CAAC,CAAC,CAAC,GAAK,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,AAAC;AAEnE,OAAO,CAAC,GAAG,CAAC,CAAA,GAAA,sCAAK,CAAA,CAAC,IAAI,CAAC,CAAA,GAAA,uCAAM,CAAA,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;AAChE,OAAO,CAAC,GAAG,CAAC,CAAA,GAAA,sCAAK,CAAA,CAAC,IAAI,CAAC,CAAA,GAAA,uCAAM,CAAA,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;AAEhE,eAAe,gCAAU,GAAG;IAC1B,MAAM,OAAO,GAAG,CAAA,GAAA,+CAAc,CAAA,CAAC,OAAO,CAAC,qBAAqB,CAAC,AAAC;IAC9D,OAAO,CAAC,KAAK,EAAE,CAAC;IAChB,MAAM,2BAAK,EAAE,CAAC;IACd,OAAO,CAAC,IAAI,EAAE,CAAC;CAChB;AAEA,CAAA,iBAAkB;IACjB,MAAM,gCAAU,EAAE,CAAC;IAEnB,CAAA,GAAA,sBAAM,CAAA,CAAC;QACL;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,eAAe;YACrB,OAAO,EAAE,8CAA8C;YACvD,OAAO,EAAE;gBAAC,QAAQ;gBAAE,aAAa;aAAC;SACnC;KACF,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,GAAK;QACnB,MAAM,OAAO,GAAG,CAAA,GAAA,+CAAc,CAAA,CAAC,OAAO,CACpC,CAAC,yBAAyB,EAAE,OAAO,CAAC,aAAa,CAAC,4BAA4B,CAAC,CAChF,AAAC;QACF,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,IAAI,EAAE,CAAC;KAChB,CAAC,CAAC;CACJ,CAAA,EAAG,CAAC","sources":["index.ts"],"sourcesContent":["#! /usr/bin/env node\nimport chalk from \"chalk\";\nimport { prompt } from \"inquirer\";\nimport figlet from \"figlet\";\nimport chalkAnimation from \"chalk-animation\";\n\nconst sleep = (ms = 2000) => new Promise((r) => setTimeout(r, ms));\n\nconsole.log(chalk.blue(figlet.textSync(\"Huakun Zui Shuai!!!\")));\nconsole.log(chalk.blue(figlet.textSync(\"Huakun Zui Shuai!!!\")));\n\nasync function entrypoint() {\n const rainbow = chalkAnimation.rainbow(\"Huakun Zui Shuai!!!\");\n rainbow.start();\n await sleep();\n rainbow.stop();\n}\n\n(async function () {\n await entrypoint();\n\n prompt([\n {\n type: \"list\",\n name: \"handsomeCoder\",\n message: \"Who is the most handsome coder in the world?\",\n choices: [\"Huakun\", \"Huakun Shen\"],\n },\n ]).then((answers) => {\n const rainbow = chalkAnimation.rainbow(\n `Congrats! You are right, ${answers.handsomeCoder} Is The Most Handsome Coder.`\n );\n rainbow.start();\n rainbow.stop();\n });\n})();\n"],"names":[],"version":3,"file":"index.tmp.cjs.map"} |
| #! /usr/bin/env node |
+29
-32
@@ -1,39 +0,36 @@ | ||
| import chalk from 'chalk'; | ||
| import inquirer from 'inquirer'; | ||
| import figlet from 'figlet'; | ||
| import chalkAnimation from 'chalk-animation'; | ||
| #! /usr/bin/env node | ||
| import chalk from "chalk"; | ||
| import { prompt } from "inquirer"; | ||
| import figlet from "figlet"; | ||
| import chalkAnimation from "chalk-animation"; | ||
| const sleep = (ms = 2000) => new Promise((r) => setTimeout(r, ms)) | ||
| const sleep = (ms = 2000) => new Promise((r) => setTimeout(r, ms)); | ||
| console.log(chalk.blue(figlet.textSync("Huakun Zui Shuai!!!"))) | ||
| console.log(chalk.blue(figlet.textSync("Huakun Zui Shuai!!!"))); | ||
| console.log(chalk.blue(figlet.textSync("Huakun Zui Shuai!!!"))); | ||
| async function entrypoint() { | ||
| const rainbow = chalkAnimation.rainbow('Huakun Zui Shuai!!!'); | ||
| rainbow.start() | ||
| await sleep() | ||
| rainbow.stop() | ||
| const rainbow = chalkAnimation.rainbow("Huakun Zui Shuai!!!"); | ||
| rainbow.start(); | ||
| await sleep(); | ||
| rainbow.stop(); | ||
| } | ||
| (async function() { | ||
| await entrypoint() | ||
| (async function () { | ||
| await entrypoint(); | ||
| inquirer | ||
| .prompt([ | ||
| { | ||
| type: 'list', | ||
| name: 'handsomeCoder', | ||
| message: 'Who is the most handsome coder in the world?', | ||
| choices: [ | ||
| 'Huakun', | ||
| 'Huakun Shen', | ||
| ], | ||
| }, | ||
| ]) | ||
| .then((answers) => { | ||
| const rainbow = chalkAnimation.rainbow(`Congrats! You are right, ${answers.handsomeCoder} Is The Most Handsome Coder.`); | ||
| rainbow.start() | ||
| rainbow.stop() | ||
| }); | ||
| })() | ||
| prompt([ | ||
| { | ||
| type: "list", | ||
| name: "handsomeCoder", | ||
| message: "Who is the most handsome coder in the world?", | ||
| choices: ["Huakun", "Huakun Shen"], | ||
| }, | ||
| ]).then((answers) => { | ||
| const rainbow = chalkAnimation.rainbow( | ||
| `Congrats! You are right, ${answers.handsomeCoder} Is The Most Handsome Coder.` | ||
| ); | ||
| rainbow.start(); | ||
| rainbow.stop(); | ||
| }); | ||
| })(); |
+15
-12
| { | ||
| "name": "@crosscopy/crosscopy-cli", | ||
| "version": "0.0.2", | ||
| "description": "Cross-Platform Console App for CrossCopy", | ||
| "main": "dist/main.js", | ||
| "version": "0.0.3", | ||
| "description": "CrossCopy CLI", | ||
| "main": "dist/index.tmp.cjs", | ||
| "source": "index.ts", | ||
| "module": "dist/module.js", | ||
| "types": "dist/types.d.ts", | ||
| "bin": { | ||
| "crosscopy-cli": "dist/module.js" | ||
| }, | ||
| "bin": "dist/index.cjs", | ||
| "scripts": { | ||
| "watch": "parcel watch", | ||
| "add-shebang": "echo '#!/usr/bin/env node' > dist/index.cjs && cat dist/index.tmp.cjs >> dist/index.cjs", | ||
| "prebuild": "rimraf dist", | ||
| "build": "parcel build", | ||
| "start": "ts-node index.ts", | ||
| "dev": "nodemon" | ||
| "postbuild": "npm run add-shebang && rimraf dist/index.tmp.cjs", | ||
| "start:ts": "ts-node index.ts", | ||
| "start": "node dist/index.ts", | ||
| "dev": "npx nodemon index.ts" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/CrossCopy/crosscopy-cli.git" | ||
| "url": "git+https://github.com/HuakunShen/typescript-npx-parcel-template.git" | ||
| }, | ||
@@ -27,5 +29,5 @@ "keywords": [ | ||
| "bugs": { | ||
| "url": "https://github.com/CrossCopy/crosscopy-cli/issues" | ||
| "url": "https://github.com/HuakunShen/typescript-npx-parcel-template/issues" | ||
| }, | ||
| "homepage": "https://github.com/CrossCopy/crosscopy-cli#readme", | ||
| "homepage": "https://github.com/HuakunShen/typescript-npx-parcel-template#readme", | ||
| "devDependencies": { | ||
@@ -40,2 +42,3 @@ "@parcel/packager-ts": "^2.6.0", | ||
| "parcel": "^2.6.0", | ||
| "rimraf": "^3.0.2", | ||
| "ts-node": "^10.8.1", | ||
@@ -42,0 +45,0 @@ "typescript": "^4.7.3" |
+58
-2
@@ -1,2 +0,58 @@ | ||
| # crosscopy-cli | ||
| Cross-Platform Console App for CrossCopy | ||
| # TypeScript npx Template with Parcel | ||
| [](https://github.com/HuakunShen/typescript-npx-parcel-template/actions/workflows/npm-publish.yml) | ||
| [](https://github.com/HuakunShen/typescript-npx-parcel-template/actions/workflows/test-build.yml) | ||
| [](https://badge.fury.io/js/ts-npx-parcel-template) | ||
| [](https://www.npmjs.com/package/ts-npx-parcel-template) | ||
| ## How To Run? | ||
| ```bash | ||
| npx ts-npx-parcel-template | ||
| npx ts-npx-parcel-template@latest # if you don't get the latest version | ||
| ``` | ||
| ## Setup | ||
| ```bash | ||
| npm i | ||
| ``` | ||
| ## Development | ||
| Method 2 and 3 support auto-reload. | ||
| ### Method 1 | ||
| `npm start:ts`: run `index.ts` directly using `ts-node` | ||
| ### Method 2 | ||
| `npm run dev`: run `index.ts` with `ts-node` and `nodemon` | ||
| ### Method 3 | ||
| `npm run watch`: build automatically | ||
| `npm run start`: run produced JS file | ||
| ## Production Build | ||
| `npm run build` | ||
| `"bin": "dist/index.cjs"` in `package.json` specifies where the npx executable is. | ||
| ## Publish | ||
| Update `"version"` in `package.json`. | ||
| ```bash | ||
| npm login | ||
| npm publish | ||
| ``` | ||
+1
-1
@@ -14,3 +14,3 @@ { | ||
| /* Language and Environment */ | ||
| "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ | ||
| "target": "es2022", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ | ||
| // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ | ||
@@ -17,0 +17,0 @@ // "jsx": "preserve", /* Specify what JSX code is generated. */ |
20012
49.17%9
125%163
28.35%59
1866.67%11
10%