create-presenter 0.4.8 → 0.5.0
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 c=function(n,e,t,r){return new(t||(t=Promise))((function(o,i){function c(n){try{a(r.next(n))}catch(n){i(n)}}function s(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(c,s)}a((r=r.apply(n,e||[])).next())}))},s=function(n,e){var t,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return c.next=s(0),c.throw=s(1),c.return=s(2),"function"==typeof Symbol&&(c[Symbol.iterator]=function(){return this}),c;function s(s){return function(a){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;c&&(c=0,s[0]&&(i=0)),i;)try{if(t=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,r=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(6===s[0]&&i.label<o[1]){i.label=o[1],o=s;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(s);break}o[2]&&i.ops.pop(),i.trys.pop();continue}s=e.call(n,i)}catch(n){s=[6,n],r=0}finally{t=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,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 c(this,void 0,void 0,(function(){return s(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 c(this,void 0,void 0,(function(){return s(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 c(this,void 0,void 0,(function(){return s(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:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return c.next=s(0),c.throw=s(1),c.return=s(2),"function"==typeof Symbol&&(c[Symbol.iterator]=function(){return this}),c;function s(s){return function(a){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;c&&(c=0,s[0]&&(i=0)),i;)try{if(t=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,r=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(6===s[0]&&i.label<o[1]){i.label=o[1],o=s;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(s);break}o[2]&&i.ops.pop(),i.trys.pop();continue}s=e.call(n,i)}catch(n){s=[6,n],r=0}finally{t=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}}(this,(function(i){switch(i.label){case 0:return i.trys.push([0,12,,13]),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.
|
|
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 c=function(n,e,t,r){return new(t||(t=Promise))((function(o,i){function c(n){try{a(r.next(n))}catch(n){i(n)}}function s(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(c,s)}a((r=r.apply(n,e||[])).next())}))},s=function(n,e){var t,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return c.next=s(0),c.throw=s(1),c.return=s(2),"function"==typeof Symbol&&(c[Symbol.iterator]=function(){return this}),c;function s(s){return function(a){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;c&&(c=0,s[0]&&(i=0)),i;)try{if(t=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,r=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(6===s[0]&&i.label<o[1]){i.label=o[1],o=s;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(s);break}o[2]&&i.ops.pop(),i.trys.pop();continue}s=e.call(n,i)}catch(n){s=[6,n],r=0}finally{t=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,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 c(this,void 0,void 0,(function(){return s(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 c(this,void 0,void 0,(function(){return s(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 c(this,void 0,void 0,(function(){return s(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:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return c.next=s(0),c.throw=s(1),c.return=s(2),"function"==typeof Symbol&&(c[Symbol.iterator]=function(){return this}),c;function s(s){return function(a){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;c&&(c=0,s[0]&&(i=0)),i;)try{if(t=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,r=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(6===s[0]&&i.label<o[1]){i.label=o[1],o=s;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(s);break}o[2]&&i.ops.pop(),i.trys.pop();continue}s=e.call(n,i)}catch(n){s=[6,n],r=0}finally{t=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}}(this,(function(i){switch(i.label){case 0:return i.trys.push([0,12,,13]),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.5.0"\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 { Presentation, Slide, Text } from "presenter";\n\nconst slide = new Slide([\n new Text("Welcome to Presenter.js!", {\n position: { x: 0.5, y: 0.5 },\n anchor: "center",\n fontSize: 150,\n }),\n]);\n\ndocument.addEventListener("DOMContentLoaded", () => {\n const presentation = new Presentation(\n "Presentation",\n [slide],\n document.body,\n );\n\n presentation.present();\n});\n',{})];case 9:return i.sent(),[4,p(r.join(n,e,"src","custom.d.ts"),'declare module "*.svg" {\n const content: any;\n export default content;\n}\n',{})];case 10:return i.sent(),a("Installing dependencies..."),[4,t(317).execSync("cd ".concat(e," && npm install"),{stdio:"inherit"})];case 11: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,13];case 12:return o=i.sent(),console.error(),console.error(o),[3,13];case 13:return[2]}}))},new((o=void 0)||(o=Promise))((function(t,r){function c(n){try{a(i.next(n))}catch(n){r(n)}}function s(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(c,s)}a((i=i.apply(n,e||[])).next())}))}()})();
|