create-presenter 0.6.2 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
(()=>{"use strict";var n={317:n=>{n.exports=require("child_process")}},e={};function t(r){var o=e[r];if(void 0!==o)return o.exports;var i=e[r]={exports:{}};return n[r](i,i.exports,t),i.exports}const r=require("path"),o=require("fs"),i=require("readline");var s=function(n,e,t,r){return new(t||(t=Promise))((function(o,i){function s(n){try{a(r.next(n))}catch(n){i(n)}}function c(n){try{a(r.throw(n))}catch(n){i(n)}}function a(n){var e;n.done?o(n.value):(e=n.value,e instanceof t?e:new t((function(n){n(e)}))).then(s,c)}a((r=r.apply(n,e||[])).next())}))},c=function(n,e){var t,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=c(0),s.throw=c(1),s.return=c(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function c(c){return function(a){return function(c){if(t)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(i=0)),i;)try{if(t=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=e.call(n,i)}catch(n){c=[6,n],r=0}finally{t=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}};function a(n){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];console.log.apply(console,function(n,e,t){if(t||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return n.concat(r||Array.prototype.slice.call(e))}([n],e,!1))}function u(n){return s(this,void 0,void 0,(function(){return c(this,(function(e){return[2,new Promise((function(e){var t=i.createInterface({input:process.stdin,output:process.stdout});t.question(n,(function(n){t.close(),e(n)}))}))]}))}))}function l(n){return s(this,void 0,void 0,(function(){return c(this,(function(e){return[2,new Promise((function(e,t){o.mkdir(n,(function(r){r?("EEXIST"===r.code&&t(new Error("Directory '".concat(n,"' already exists."))),t(r)):e()}))}))]}))}))}function p(n,e,t){return s(this,void 0,void 0,(function(){return c(this,(function(r){return Object.keys(t).forEach((function(n){e=e.replace(new RegExp("{{\\s*".concat(n,"\\s*}}"),"g"),t[n])})),[2,new Promise((function(t,r){o.writeFile(n,e,(function(n){n?r(n):t()}))}))]}))}))}!function(){var n,e,o,i;n=this,e=void 0,i=function(){var n,e,o;return function(n,e){var t,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=c(0),s.throw=c(1),s.return=c(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function c(c){return function(a){return function(c){if(t)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(i=0)),i;)try{if(t=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=e.call(n,i)}catch(n){c=[6,n],r=0}finally{t=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}}(this,(function(i){switch(i.label){case 0:return i.trys.push([0,11,,12]),n=process.cwd(),a("This utility will help you create a new Presenter.js presentation.\n"),[4,u("presentation name: (presentation) ")];case 1:return""===(e=i.sent().replace(/\s+/g,"-").toLowerCase())&&(e="presentation"),a("Creating a new Presenter.js presentation in ".concat(e,"...")),[4,l(e)];case 2:return i.sent(),[4,l(r.join(e,"public"))];case 3:return i.sent(),[4,l(r.join(e,"src"))];case 4:return i.sent(),[4,p(r.join(n,e,"package.json"),'{\n "name": "{{ projectName }}",\n "version": "1.0.0",\n "description": "A Presenter.js presentation",\n "main": "dist/main.js",\n "scripts": {\n "build": "NODE_ENV=production webpack",\n "watch": "NODE_ENV=development webpack --watch",\n "serve": "NODE_ENV=development webpack serve --open"\n },\n "devDependencies": {\n "copy-webpack-plugin": "^12.0.2",\n "ts-loader": "^9.5.1",\n "typescript": "^5.7.2",\n "webpack": "^5.96.1",\n "webpack-cli": "^5.1.4",\n "webpack-dev-server": "^5.1.0"\n },\n "dependencies": {\n "presenter": "^0.6.
|
|
2
|
+
(()=>{"use strict";var n={317:n=>{n.exports=require("child_process")}},e={};function t(r){var o=e[r];if(void 0!==o)return o.exports;var i=e[r]={exports:{}};return n[r](i,i.exports,t),i.exports}const r=require("path"),o=require("fs"),i=require("readline");var s=function(n,e,t,r){return new(t||(t=Promise))((function(o,i){function s(n){try{a(r.next(n))}catch(n){i(n)}}function c(n){try{a(r.throw(n))}catch(n){i(n)}}function a(n){var e;n.done?o(n.value):(e=n.value,e instanceof t?e:new t((function(n){n(e)}))).then(s,c)}a((r=r.apply(n,e||[])).next())}))},c=function(n,e){var t,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=c(0),s.throw=c(1),s.return=c(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function c(c){return function(a){return function(c){if(t)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(i=0)),i;)try{if(t=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=e.call(n,i)}catch(n){c=[6,n],r=0}finally{t=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}};function a(n){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];console.log.apply(console,function(n,e,t){if(t||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return n.concat(r||Array.prototype.slice.call(e))}([n],e,!1))}function u(n){return s(this,void 0,void 0,(function(){return c(this,(function(e){return[2,new Promise((function(e){var t=i.createInterface({input:process.stdin,output:process.stdout});t.question(n,(function(n){t.close(),e(n)}))}))]}))}))}function l(n){return s(this,void 0,void 0,(function(){return c(this,(function(e){return[2,new Promise((function(e,t){o.mkdir(n,(function(r){r?("EEXIST"===r.code&&t(new Error("Directory '".concat(n,"' already exists."))),t(r)):e()}))}))]}))}))}function p(n,e,t){return s(this,void 0,void 0,(function(){return c(this,(function(r){return Object.keys(t).forEach((function(n){e=e.replace(new RegExp("{{\\s*".concat(n,"\\s*}}"),"g"),t[n])})),[2,new Promise((function(t,r){o.writeFile(n,e,(function(n){n?r(n):t()}))}))]}))}))}!function(){var n,e,o,i;n=this,e=void 0,i=function(){var n,e,o;return function(n,e){var t,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=c(0),s.throw=c(1),s.return=c(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function c(c){return function(a){return function(c){if(t)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(i=0)),i;)try{if(t=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=e.call(n,i)}catch(n){c=[6,n],r=0}finally{t=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}}(this,(function(i){switch(i.label){case 0:return i.trys.push([0,11,,12]),n=process.cwd(),a("This utility will help you create a new Presenter.js presentation.\n"),[4,u("presentation name: (presentation) ")];case 1:return""===(e=i.sent().replace(/\s+/g,"-").toLowerCase())&&(e="presentation"),a("Creating a new Presenter.js presentation in ".concat(e,"...")),[4,l(e)];case 2:return i.sent(),[4,l(r.join(e,"public"))];case 3:return i.sent(),[4,l(r.join(e,"src"))];case 4:return i.sent(),[4,p(r.join(n,e,"package.json"),'{\n "name": "{{ projectName }}",\n "version": "1.0.0",\n "description": "A Presenter.js presentation",\n "main": "dist/main.js",\n "scripts": {\n "build": "NODE_ENV=production webpack",\n "watch": "NODE_ENV=development webpack --watch",\n "serve": "NODE_ENV=development webpack serve --open"\n },\n "devDependencies": {\n "copy-webpack-plugin": "^12.0.2",\n "ts-loader": "^9.5.1",\n "typescript": "^5.7.2",\n "webpack": "^5.96.1",\n "webpack-cli": "^5.1.4",\n "webpack-dev-server": "^5.1.0"\n },\n "dependencies": {\n "presenter": "^0.6.3"\n }\n}\n',{projectName:e})];case 5:return i.sent(),[4,p(r.join(n,e,"tsconfig.json"),'{\n "compilerOptions": {\n "moduleResolution": "node16",\n "module": "node16",\n "outDir": "./dist/",\n "noImplicitAny": true,\n "target": "es5",\n "allowJs": true\n }\n}\n',{})];case 6:return i.sent(),[4,p(r.join(n,e,"webpack.config.js"),'const path = require("path");\nconst CopyPlugin = require("copy-webpack-plugin");\n\nmodule.exports = {\n mode: process.env.NODE_ENV || "development",\n entry: "./src/index.ts",\n output: {\n filename: "main.js",\n path: path.resolve(__dirname, "dist"),\n },\n devServer: {\n static: "./dist",\n },\n resolve: {\n extensions: [".ts", ".js"],\n },\n module: {\n rules: [\n {\n test: /\\.ts$/,\n use: "ts-loader",\n exclude: /node_modules/,\n },\n {\n test: /\\.(svg)$/i,\n type: "asset/source",\n },\n ],\n },\n plugins: [\n new CopyPlugin({\n patterns: [{ from: "public", to: "." }],\n }),\n ],\n};\n',{})];case 7:return i.sent(),[4,p(r.join(n,e,"public","index.html"),'<!doctype html>\n<html lang="en">\n <head>\n <title>Presenter.js</title>\n <script src="main.js"><\/script>\n </head>\n <body></body>\n</html>\n',{})];case 8:return i.sent(),[4,p(r.join(n,e,"src","index.ts"),'import { Anchor, BrowserCanvasRenderer, Presentation, Slide, Text } from "presenter";\n\nconst presentationSize = { width: 3840, height: 2160 };\n\nconst text = Text("Welcome to Presenter.js!", {\n x: presentationSize.width / 2,\n y: presentationSize.height / 2,\n anchor: Anchor.CENTER,\n fontSize: 150,\n});\n\nconst slide = Slide({\n objects: [text],\n});\n\ndocument.addEventListener("DOMContentLoaded", () => {\n const presentation = Presentation({\n size: presentationSize,\n slides: [slide],\n });\n\n const renderer = new BrowserCanvasRenderer({ presentation });\n renderer.present();\n});\n',{})];case 9:return i.sent(),a("Installing dependencies..."),[4,t(317).execSync("cd ".concat(e," && npm install"),{stdio:"inherit"})];case 10:return i.sent(),a('\n[32mSuccess! Created project "'.concat(e,'" at ').concat(r.join(n,e),"[0m")),a("\nTo run your presentation, run:"),a("\n $ cd ".concat(e)),a("\n $ npm run serve"),a("\n"),[3,12];case 11:return o=i.sent(),console.error(),console.error(o),[3,12];case 12:return[2]}}))},new((o=void 0)||(o=Promise))((function(t,r){function s(n){try{a(i.next(n))}catch(n){r(n)}}function c(n){try{a(i.throw(n))}catch(n){r(n)}}function a(n){var e;n.done?t(n.value):(e=n.value,e instanceof o?e:new o((function(n){n(e)}))).then(s,c)}a((i=i.apply(n,e||[])).next())}))}()})();
|