@aerogel/cli 0.0.0-next.7e89f52eb37d9154f4879a5ccd058d27d476dada → 0.0.0-next.7f369b50c025aaa1a8024b6e53c659a6d7d617b5
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/bin/gel +4 -0
- package/dist/aerogel-cli.d.ts +2 -2
- package/dist/aerogel-cli.js +754 -0
- package/dist/aerogel-cli.js.map +1 -0
- package/package.json +26 -32
- package/src/cli.ts +26 -8
- package/src/commands/Command.ts +14 -9
- package/src/commands/create.test.ts +3 -17
- package/src/commands/create.ts +19 -20
- package/src/commands/generate-component.test.ts +1 -14
- package/src/commands/generate-component.ts +20 -50
- package/src/commands/generate-model.test.ts +2 -2
- package/src/commands/generate-model.ts +13 -14
- package/src/commands/generate-service.test.ts +2 -2
- package/src/commands/generate-service.ts +16 -17
- package/src/commands/info.ts +15 -0
- package/src/commands/install.test.ts +21 -4
- package/src/commands/install.ts +12 -11
- package/src/lib/App.ts +45 -49
- package/src/lib/Editor.ts +19 -13
- package/src/lib/File.mock.ts +7 -11
- package/src/lib/File.ts +14 -3
- package/src/lib/Log.mock.ts +4 -8
- package/src/lib/Log.test.ts +4 -4
- package/src/lib/Log.ts +7 -7
- package/src/lib/Shell.mock.ts +3 -3
- package/src/lib/Shell.ts +2 -2
- package/src/lib/Template.ts +24 -17
- package/src/lib/utils/app.ts +3 -3
- package/src/lib/utils/edit.ts +2 -2
- package/src/lib/utils/paths.ts +16 -8
- package/src/plugins/LocalFirst.ts +9 -0
- package/src/plugins/Plugin.ts +49 -14
- package/src/plugins/Solid.ts +48 -42
- package/src/plugins/Soukai.ts +6 -6
- package/src/testing/setup.ts +36 -31
- package/templates/app/README.md +3 -0
- package/templates/service/[service.name].ts +1 -1
- package/.eslintrc.js +0 -7
- package/bin/ag +0 -4
- package/dist/aerogel-cli.cjs.js +0 -2
- package/dist/aerogel-cli.cjs.js.map +0 -1
- package/dist/aerogel-cli.esm.js +0 -2
- package/dist/aerogel-cli.esm.js.map +0 -1
- package/noeldemartin.config.js +0 -14
- package/src/lib/utils/format.test.ts +0 -33
- package/src/lib/utils/format.ts +0 -38
- package/templates/app/.eslintrc.js +0 -3
- package/templates/app/.github/workflows/ci.yml +0 -17
- package/templates/app/.gitignore.template +0 -2
- package/templates/app/.nvmrc +0 -1
- package/templates/app/.vscode/launch.json +0 -16
- package/templates/app/.vscode/settings.json +0 -10
- package/templates/app/cypress/e2e/app.cy.ts +0 -9
- package/templates/app/cypress/support/e2e.ts +0 -3
- package/templates/app/cypress/tsconfig.json +0 -12
- package/templates/app/cypress.config.ts +0 -12
- package/templates/app/index.html +0 -12
- package/templates/app/package.json +0 -54
- package/templates/app/postcss.config.js +0 -6
- package/templates/app/prettier.config.js +0 -5
- package/templates/app/src/App.vue +0 -12
- package/templates/app/src/assets/styles.css +0 -3
- package/templates/app/src/lang/en.yaml +0 -3
- package/templates/app/src/main.test.ts +0 -9
- package/templates/app/src/main.ts +0 -13
- package/templates/app/src/types/globals.d.ts +0 -2
- package/templates/app/src/types/shims.d.ts +0 -7
- package/templates/app/src/types/ts-reset.d.ts +0 -1
- package/templates/app/tailwind.config.js +0 -5
- package/templates/app/tsconfig.json +0 -18
- package/templates/app/vite.config.ts +0 -23
- package/templates/component-story/[component.name].story.vue +0 -7
- package/tsconfig.json +0 -11
- package/vite.config.ts +0 -14
- /package/src/{main.ts → index.ts} +0 -0
package/dist/aerogel-cli.esm.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{Command as e}from"commander";import t from"@babel/runtime/helpers/esm/defineProperty";import"core-js/modules/esnext.async-iterator.reduce.js";import"core-js/modules/esnext.iterator.constructor.js";import"core-js/modules/esnext.iterator.reduce.js";import{facade as i,stringMatchAll as s,toString as n,stringMatch as r,arrayFrom as a,stringToSlug as o,stringToStudlyCase as c,stringToCamelCase as l}from"@noeldemartin/utils";import{existsSync as d,lstatSync as p,readFileSync as m,readdirSync as u,mkdirSync as g,writeFileSync as h}from"fs";import{resolve as f,dirname as y}from"path";import"core-js/modules/esnext.async-iterator.for-each.js";import"core-js/modules/esnext.iterator.for-each.js";import"core-js/modules/esnext.async-iterator.find.js";import"core-js/modules/esnext.iterator.find.js";import"core-js/modules/esnext.async-iterator.map.js";import"core-js/modules/esnext.iterator.map.js";import{hex as w,bold as v}from"chalk";import{cursorTo as j,clearLine as x}from"readline";import{render as $}from"mustache";import"core-js/modules/esnext.set.add-all.js";import"core-js/modules/esnext.set.delete-all.js";import"core-js/modules/esnext.set.difference.js";import"core-js/modules/esnext.set.every.js";import"core-js/modules/esnext.set.filter.js";import"core-js/modules/esnext.set.find.js";import"core-js/modules/esnext.set.intersection.js";import"core-js/modules/esnext.set.is-disjoint-from.js";import"core-js/modules/esnext.set.is-subset-of.js";import"core-js/modules/esnext.set.is-superset-of.js";import"core-js/modules/esnext.set.join.js";import"core-js/modules/esnext.set.map.js";import"core-js/modules/esnext.set.reduce.js";import"core-js/modules/esnext.set.some.js";import"core-js/modules/esnext.set.symmetric-difference.js";import"core-js/modules/esnext.set.union.js";import{Project as k,SyntaxKind as S,Node as C}from"ts-morph";import{exec as A}from"child_process";import"core-js/modules/esnext.async-iterator.some.js";import"core-js/modules/esnext.iterator.some.js";var D=i(new class{contains(e,t){return!!this.read(e)?.includes(t)}exists(e){return d(e)}isSymlink(e){return p(e).isSymbolicLink()}read(e){return this.isFile(e)?m(e).toString():null}getFiles(e){const t=u(e,{withFileTypes:!0}),i=[];for(const s of t){const t=f(e,s.name);s.isDirectory()?i.push(...this.getFiles(t)):i.push(t)}return i}isDirectory(e){return this.exists(e)&&p(e).isDirectory()}isFile(e){return this.exists(e)&&p(e).isFile()}isEmptyDirectory(e){return!!this.isDirectory(e)&&0===this.getFiles(e).length}makeDirectory(e){g(e,{recursive:!0})}write(e,t){d(y(e))||g(y(e),{recursive:!0}),h(e,t)}});var F=i(new class{constructor(){t(this,"renderInfo",w("#00ffff")),t(this,"renderSuccess",w("#00ff00")),t(this,"renderError",w("#ff0000"))}async animate(e,t){var i=this;const s=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const r=i.renderInfo(i.renderMarkdown(e)+(s?"...":".".repeat(n%4)))+t;i.stdout(r)};let n=0;s();const r=setInterval((()=>(n++,s())),1e3),a=await t();return clearInterval(r),s("\n",!0),a}info(e){this.log(this.renderMarkdown(e),this.renderInfo)}error(e){this.log(this.renderMarkdown(e),this.renderError)}fail(e){this.error(e),process.exit(1)}success(e){this.log(this.renderMarkdown(e),this.renderSuccess)}renderMarkdown(e){const t=s(e,/\*\*(.*)\*\*/g);for(const i of t)e=e.replace(i[0],v(i[1]));return e}log(e,t){this.formatMessage(e).forEach((e=>{this.logLine(t?t(e):e)}))}formatMessage(e){if("\n"===e[0]){const t=(e=e.slice(1).trimEnd()).split("\n"),i=e.trim()[0]??"",s=t.find((e=>e.trim().length>0))?.indexOf(i)??0;return t.map((e=>e.slice(s)))}return[e]}logLine(e){console.log(e)}stdout(e){j(process.stdout,0),x(process.stdout,0),process.stdout.write(e)}});class I{static instantiate(e,t,i){return new I(e).instantiate(t,i)}constructor(e){t(this,"path",void 0),this.path=e}instantiate(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=this.getFilenameReplacements(t),s=[];e=`${e}/`.replace(/\/\//,"/");for(const n of D.getFiles(this.path)){const r=Object.entries(i).reduce(((e,t)=>{let[i,s]=t;return e.replaceAll(i,s)}),n.substring(this.path.length+1)),a=m(n).toString(),o=e+(r.endsWith(".template")?r.slice(0,-9):r);D.write(o,$(a,t,void 0,["<%","%>"])),s.push(o)}return s}getFilenameReplacements(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return Object.entries(e).reduce(((e,i)=>{let[s,r]=i;return"object"==typeof r?Object.assign(e,this.getFilenameReplacements(r,`${s}.`)):e[`[${t}${s}]`]=n(r),e}),{})}}function P(e){return F.fail(`Could not find ${e} pack file, did you run 'npm pack'?`)}function b(e){return D.getFiles(E(e)).find((e=>e.endsWith(".tgz")))??null}function E(e){return function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";if(D.contains(f(__dirname,"../../../package.json"),'"name": "aerogel"'))return f(__dirname,"../",e);const t=D.read(f(__dirname,"../../../../package.json")),i=r(t??"",/"@aerogel\/cli": "file:(.*)\/aerogel-cli-[\d.]*\.tgz"/),s=i?.[1]??F.fail("Could not determine base path");return f(s,e)}(`../${e}`)}function O(e){return f(__dirname,`../templates/${e}`)}var N=i(new class{constructor(){t(this,"cwd",null)}setWorkingDirectory(e){this.cwd=e}async run(e){await new Promise(((t,i)=>{A(e,{cwd:this.cwd??void 0},(e=>{e?i(e):t()}))}))}});class L{constructor(){t(this,"project",void 0),t(this,"modifiedFiles",void 0),this.project=new k({tsConfigFilePath:"tsconfig.json"}),this.modifiedFiles=new Set,this.project.addSourceFilesAtPaths("src/**/*.ts"),this.project.addSourceFilesAtPaths("tailwind.config.js"),this.project.addSourceFilesAtPaths("vite.config.ts")}addSourceFile(e){this.project.addSourceFilesAtPaths(e)}requireSourceFile(e){return this.project.getSourceFileOrThrow(e)}async format(){await F.animate("Formatting modified files",(async()=>{const e=D.exists("prettier.config.js"),t=D.exists(".eslintrc.js");await Promise.all(a(this.modifiedFiles).map((async i=>{e&&await N.run(`npx prettier ${i} --write`),t&&await N.run(`npx eslint ${i} --fix`)})))}))}async save(e){await e.save(),this.modifiedFiles.add(e.getFilePath())}}class T{constructor(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t(this,"name",void 0),t(this,"options",void 0),this.name=e,this.options=i}create(e){!D.exists(e)||D.isDirectory(e)&&D.isEmptyDirectory(e)||F.fail(`Folder at '${e}' already exists!`),I.instantiate(O("app"),e,{app:{name:this.name,slug:o(this.name)},dependencies:this.getDependencies(),contentPath:this.options.linkedLocal?`${E("core")}/dist/**/*.js`:"./node_modules/@aerogel/core/dist/**/*.js"})}edit(){return new L}getDependencies(){const e=e=>Object.entries(e).reduce(((e,t)=>{let[i,s]=t;return Object.assign(e,{[i]:`file:${s}`})}),{});return this.options.linkedLocal?e({aerogelCli:E("cli"),aerogelCore:E("core"),aerogelCypress:E("cypress"),aerogelPluginI18n:E("plugin-i18n"),aerogelPluginSoukai:E("plugin-soukai"),aerogelVite:E("vite")}):this.options.local?e({aerogelCli:b("cli")??P("cli"),aerogelCore:b("core")??P("core"),aerogelCypress:b("cypress")??P("cypress"),aerogelPluginI18n:b("plugin-i18n")??P("plugin-i18n"),aerogelPluginSoukai:b("plugin-soukai")??P("plugin-soukai"),aerogelVite:b("vite")??P("vite")}):{aerogelCli:"next",aerogelCore:"next",aerogelCypress:"next",aerogelPluginI18n:"next",aerogelPluginSoukai:"next",aerogelVite:"next"}}}class z{static define(e){var t=this;e=e.command(this.command).description(this.description);for(const[t,i]of this.parameters)e=e.argument(`<${t}>`,i);for(const[t,i]of Object.entries(this.options)){const s="string"==typeof i?i:i.description,n="string"==typeof i?"string":i.type??"string";e=e.option("boolean"===n?`--${t}`:`--${t} <${n}>`,s)}e=e.action((function(){for(var e=arguments.length,i=new Array(e),s=0;s<e;s++)i[s]=arguments[s];return t.run.call(t,...i)}))}static async run(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];const s=new this(...t);await s.run()}async run(){}assertAerogelOrDirectory(e){const t=D.read("package.json");if(t?.includes("@aerogel/core"))return;if(e&&D.isDirectory(e))return;const i=e?`${e} folder does not exist.`:"package.json does not contain @aerogel/core.";F.fail(`${i} Are you sure this is an Aerogel app?`)}}t(z,"command",""),t(z,"description",""),t(z,"parameters",[]),t(z,"options",{});class B extends z{constructor(e,i){super(),t(this,"path",void 0),t(this,"options",void 0),this.path=e,this.options=i}async run(){const e=this.path,t=this.options.name??"Aerogel App";N.setWorkingDirectory(e),await this.createApp(t,e),await this.installDependencies(),await this.initializeGit(),F.success(`\n\n That's it! You can start working on **${t}** doing the following:\n\n cd ${e}\n npm run dev\n\n Have fun!\n `)}async createApp(e,t){F.info(`Creating **${e}**...`),new T(e,{local:this.options.local,linkedLocal:this.options.local&&!this.options.copy}).create(t)}async installDependencies(){await F.animate("Installing dependencies",(async()=>{await N.run("npm install")}))}async initializeGit(){await F.animate("Initializing git",(async()=>{await N.run("git init"),await N.run("git add ."),await N.run('git commit -m "Start"')}))}}function _(){return new T("")}function M(){return D.isSymlink("node_modules/@aerogel/core")}function q(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e)return;const i=t.guard??(()=>!0),s=t.validate??(()=>!0),n=a(t.skip??[]);return e.forEachDescendant(((e,t)=>{if(i(e)&&s(e))return e;const r=e.getKind();n.includes(r)&&t.skip()}))}function J(e,t){if(e&&t(e))return e}t(B,"command","create"),t(B,"description","Create AerogelJS app"),t(B,"parameters",[["path","Application path"]]),t(B,"options",{name:"Application name",local:{type:"boolean",description:"Whether to create an app using local Aerogel packages (used for core development)"},copy:{type:"boolean",description:"Whether to create an app linked to local Aerogel packages (used in CI)"}});class W extends z{constructor(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t(this,"path",void 0),t(this,"options",void 0),this.path=e,this.options=i}async run(){this.assertAerogelOrDirectory("src/components"),this.assertHistoireInstalled();const e=new Set,[t,i]=this.parsePathComponents();await this.createComponent(t,i,e),await this.createStory(i,e),await this.declareComponents();const s=a(e).map((e=>`- ${e}`)).join("\n");F.info(`${i} component created successfully! The following files were created:\n\n${s}`)}assertHistoireInstalled(){this.options.story&&(D.exists("src/main.histoire.ts")||F.fail("Histoire is not installed yet!"))}async createComponent(e,t,i){await F.animate("Creating component",(async()=>{D.exists(`src/components/${this.path}.vue`)&&F.fail(`${this.path} component already exists!`);I.instantiate(O("component"),`src/components/${e}`,{component:{name:t}}).forEach((e=>i.add(e)))}))}async createStory(e,t){this.options.story&&await F.animate("Creating story",(async()=>{I.instantiate(O("component-story"),"src/components",{component:{name:e}}).forEach((e=>t.add(e)))}))}async declareComponents(){const e=_().edit(),t=e.requireSourceFile("vite.config.ts"),i=this.getComponentDirsArray(t);if(!i)return F.fail("Could not find component dirs declaration in vite config!");i.getDescendantsOfKind(S.StringLiteral).some((e=>"'src/components'"===e.getText()))||(await F.animate("Updating vite config",(async()=>{i.addElement("'src/components'"),await e.save(t)})),await e.format())}getComponentDirsArray(e){const t=q(e,{guard:C.isCallExpression,validate:e=>e.getText().startsWith("Components("),skip:S.ImportDeclaration});if(!t)return null;const i=q(t,{guard:C.isPropertyAssignment,validate:e=>"dirs"===e.getName()}),s=i?.getInitializer();return C.isArrayLiteralExpression(s)?s:this.declareComponentDirsArray(t)}declareComponentDirsArray(e){const t=q(e,{guard:C.isObjectLiteralExpression}),i=t?.addPropertyAssignment({name:"dirs",initializer:"[]"});return i?.getInitializer()??null}parsePathComponents(){const e=this.path.lastIndexOf("/");return-1===e?["",this.path]:[this.path.substring(0,e),this.path.substring(e+1)]}}function G(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=e.split("\n"),s=t.indent??0;let n=0,r="";for(const e of i){const t=e.trim(),i=0===t.length;if(0===r.length){if(i)continue;n=e.indexOf(t[0]??""),r+=`${" ".repeat(s)}${t}\n`;continue}if(i){r+="\n";continue}const a=e.indexOf(t[0]??"");r+=`${" ".repeat(s+a-n)}${t}\n`}return r.trimEnd()}t(W,"command","generate:component"),t(W,"description","Generate an AerogelJS Component"),t(W,"parameters",[["path","Component path (relative to components folder; extension not necessary)"]]),t(W,"options",{story:{description:"Create component story using Histoire",type:"boolean"}});class H extends z{constructor(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t(this,"name",void 0),t(this,"options",void 0),this.name=e,this.options=i}async run(){this.assertAerogelOrDirectory("src/models"),D.exists(`src/models/${this.name}.ts`)&&F.fail(`${this.name} model already exists!`),this.assertSoukaiInstalled();const e=await F.animate("Creating model",(async()=>I.instantiate(O("model"),"src/models",{model:{name:this.name,fieldsDefinition:this.getFieldsDefinition()},soukaiImports:this.options.fields?"FieldType, defineModelSchema":"defineModelSchema"}).map((e=>`- ${e}`)).join("\n")));F.info(`${this.name} model created successfully! The following files were created:\n\n${e}`)}getFieldsDefinition(){if(!this.options.fields)return" //";const e=this.options.fields.split(",").map((e=>{const[t,i,s]=e.split(":");return{name:t,type:c(i??"string"),required:"required"===s}})).reduce(((e,t)=>e+`\n${t.required?G(`\n ${t.name}: {\n type: FieldType.${t.type},\n required: true,\n }\n `):`${t.name}: FieldType.${t.type}`},`),"");return G(e,{indent:8})}assertSoukaiInstalled(){D.contains("package.json",'"soukai"')||D.contains("package.json",'"@aerogel/plugin-soukai"')||F.fail("\n Soukai is not installed yet! You can install it running:\n npx ag install soukai\n ")}}t(H,"command","generate:model"),t(H,"description","Generate an AerogelJS Model"),t(H,"parameters",[["name","Model name"]]),t(H,"options",{fields:"Create model with the given fields"});class R extends z{constructor(e){super(),t(this,"name",void 0),this.name=e}async run(){this.assertAerogelOrDirectory("src/services");const e=new Set,t=_().edit();await this.createService(e),await this.registerService(t),await t.format();const i=a(e).map((e=>`- ${e}`)).join("\n");F.info(`${this.name} service created successfully! The following files were created:\n\n${i}`)}async createService(e){await F.animate("Creating service",(async()=>{D.exists(`src/services/${this.name}.ts`)&&F.fail(`${this.name} service already exists!`);I.instantiate(O("service"),"src/services",{service:{name:this.name}}).forEach((t=>e.add(t)))}))}async registerService(e){await F.animate("Registering service",(async()=>{D.exists("src/services/index.ts")||await this.createServicesIndex(e);const t=e.requireSourceFile("src/services/index.ts"),i=this.getServicesObject(t);if(!i)return F.fail("Could not find services object in services config, please add it manually.");t.addImportDeclaration({defaultImport:this.name,moduleSpecifier:`./${this.name}`}),i.addPropertyAssignment({name:`$${l(this.name)}`,initializer:this.name}),await e.save(t)}))}async createServicesIndex(e){D.write("src/services/index.ts",G("\n export const services = {};\n\n export type AppServices = typeof services;\n\n declare module '@vue/runtime-core' {\n interface ComponentCustomProperties extends AppServices {}\n }\n ")),e.addSourceFile("src/services/index.ts");const t=e.requireSourceFile("src/main.ts"),i=this.getBootstrapOptions(t);if(!i)return F.fail("Could not find options object in bootstrap config, please add the services manually.");i.insertShorthandPropertyAssignment(0,{name:"services"}),t.addImportDeclaration({namedImports:["services"],moduleSpecifier:"./services"}),await e.save(t)}getBootstrapOptions(e){const t=q(e,{guard:C.isCallExpression,validate:e=>"bootstrapApplication"===e.getExpression().getText(),skip:S.ImportDeclaration}),i=t?.getArguments()[1];return C.isObjectLiteralExpression(i)?i:null}getServicesObject(e){const t=q(e,{guard:C.isVariableDeclaration,validate:e=>"services"===e.getName()}),i=t?.getInitializer();return C.isObjectLiteralExpression(i)?i:null}}t(R,"command","generate:service"),t(R,"description","Generate an AerogelJS Service"),t(R,"parameters",[["name","Service name"]]);class V{constructor(e){t(this,"name",void 0),this.name=e}async install(){this.assertNotInstalled(),await this.installDependencies();{const e=_().edit();await this.updateFiles(e),await e.format()}F.info(`Plugin ${this.name} installed!`)}assertNotInstalled(){D.contains("package.json",`"${this.getNpmPackageName()}"`)&&F.fail(`${this.name} is already installed!`)}async installDependencies(){await F.animate("Installing plugin dependencies",(async()=>{await this.installNpmDependencies()}))}async updateFiles(e){await this.updateBootstrapConfig(e)}async installNpmDependencies(){if(M())await N.run(`npm install file:${E(this.getLocalPackageName())}`);else if(D.contains("package.json","file")){const e=b(this.getLocalPackageName())??P(this.getLocalPackageName());await N.run(`npm install file:${e}`)}else await N.run(`npm install ${this.getNpmPackageName()}@next`)}async updateBootstrapConfig(e){await F.animate("Injecting plugin in bootstrap configuration",(async()=>{const t=e.requireSourceFile("src/main.ts"),i=this.getBootstrapPluginsDeclaration(t);if(!i)return F.fail(`\n Could not find plugins array in bootstrap config, please add the following manually:\n\n ${this.getBootstrapConfig()}\n `);t.addImportDeclaration(this.getBootstrapImport()),i.addElement(this.getBootstrapConfig()),await e.save(t)}))}getBootstrapPluginsDeclaration(e){const t=q(e,{guard:C.isCallExpression,validate:e=>"bootstrapApplication"===e.getExpression().getText(),skip:S.ImportDeclaration}),i=t?.getArguments()[1],s=J(i,C.isObjectLiteralExpression)?.getProperty("plugins"),n=J(s,C.isPropertyAssignment)?.getInitializer();return C.isArrayLiteralExpression(n)?n:null}getBootstrapImport(){return{defaultImport:this.name,moduleSpecifier:`@aerogel/plugin-${this.name}`}}getNpmPackageName(){return`@aerogel/${this.getLocalPackageName()}`}getLocalPackageName(){return`plugin-${this.name}`}getBootstrapConfig(){return`${this.name}()`}}const K=[new class extends V{constructor(){super("soukai")}async installNpmDependencies(){await N.run("npm install soukai@next"),await super.installNpmDependencies()}getBootstrapConfig(){return"soukai({ models: import.meta.glob('@/models/*', { eager: true }) })"}},new class extends V{constructor(){super("solid")}async updateFiles(e){await this.updateTailwindConfig(e),await super.updateFiles(e)}async installNpmDependencies(){await N.run("npm install soukai-solid@next"),await super.installNpmDependencies()}async updateTailwindConfig(e){await F.animate("Updating tailwind configuration",(async()=>{const t=e.requireSourceFile("tailwind.config.js"),i=this.getTailwindContentArray(t),s=M()?`'${E("plugin-solid")}/dist/**/*.js'`:"'./node_modules/@aerogel/plugin-solid/dist/**/*.js'";if(!i)return F.fail(`\n Could not find content array in tailwind config, please add the following manually:\n\n ${s}\n `);i.addElement(s),await e.save(t)}))}getTailwindContentArray(e){const t=q(e,{guard:C.isPropertyAssignment,validate:e=>"content"===e.getName(),skip:S.JSDoc}),i=t?.getInitializer();return C.isArrayLiteralExpression(i)?i:null}}].reduce(((e,t)=>Object.assign(e,{[t.name]:t})),{});class U extends z{constructor(e){super(),t(this,"plugin",void 0),this.plugin=K[e]??F.fail(`Plugin '${e}' doesn't exist. Available plugins: ${Object.keys(K).join(", ")}`)}async run(){await this.plugin.install()}}t(U,"command","install"),t(U,"description","Install an AerogelJS plugin"),t(U,"parameters",[["plugin","Plugin to install"]]);var Y=i(new class{run(t){const i=new e;i.name("ag").description("AerogelJS CLI").version("0.0.0"),B.define(i),W.define(i),H.define(i),R.define(i),U.define(i),i.parse(t)}});export{Y as CLI};
|
|
2
|
-
//# sourceMappingURL=aerogel-cli.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"aerogel-cli.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/noeldemartin.config.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
|
|
3
|
-
import { formatCodeBlock } from './format';
|
|
4
|
-
|
|
5
|
-
describe('Format utils', () => {
|
|
6
|
-
|
|
7
|
-
it('Formats code blocks', () => {
|
|
8
|
-
// Arrange
|
|
9
|
-
const raw = `
|
|
10
|
-
|
|
11
|
-
const foo = 'bar';
|
|
12
|
-
|
|
13
|
-
if (foo) {
|
|
14
|
-
doSomething();
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
`;
|
|
18
|
-
const formatted = [
|
|
19
|
-
'const foo = \'bar\';', //
|
|
20
|
-
'', //
|
|
21
|
-
'if (foo) {', //
|
|
22
|
-
' doSomething();', //
|
|
23
|
-
'}', //
|
|
24
|
-
].join('\n');
|
|
25
|
-
|
|
26
|
-
// Act
|
|
27
|
-
const actual = formatCodeBlock(raw);
|
|
28
|
-
|
|
29
|
-
// Assert
|
|
30
|
-
expect(actual).toEqual(formatted);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
});
|
package/src/lib/utils/format.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
export interface FormatCodeBlockOptions {
|
|
2
|
-
indent?: number;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
export function formatCodeBlock(code: string, options: FormatCodeBlockOptions = {}): string {
|
|
6
|
-
const lines = code.split('\n');
|
|
7
|
-
const indent = options.indent ?? 0;
|
|
8
|
-
let originalIndent = 0;
|
|
9
|
-
let formatted = '';
|
|
10
|
-
|
|
11
|
-
for (const line of lines) {
|
|
12
|
-
const trimmedLine = line.trim();
|
|
13
|
-
const isEmptyLine = trimmedLine.length === 0;
|
|
14
|
-
|
|
15
|
-
if (formatted.length === 0) {
|
|
16
|
-
if (isEmptyLine) {
|
|
17
|
-
continue;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
originalIndent = line.indexOf(trimmedLine[0] ?? '');
|
|
21
|
-
formatted += `${' '.repeat(indent)}${trimmedLine}\n`;
|
|
22
|
-
|
|
23
|
-
continue;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (isEmptyLine) {
|
|
27
|
-
formatted += '\n';
|
|
28
|
-
|
|
29
|
-
continue;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const lineIndent = line.indexOf(trimmedLine[0] ?? '');
|
|
33
|
-
|
|
34
|
-
formatted += `${' '.repeat(indent + lineIndent - originalIndent)}${trimmedLine}\n`;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return formatted.trimEnd();
|
|
38
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
name: CI
|
|
2
|
-
|
|
3
|
-
on: [push, pull_request]
|
|
4
|
-
|
|
5
|
-
jobs:
|
|
6
|
-
ci:
|
|
7
|
-
runs-on: ubuntu-latest
|
|
8
|
-
steps:
|
|
9
|
-
- uses: actions/checkout@v3
|
|
10
|
-
- uses: actions/setup-node@v3
|
|
11
|
-
with:
|
|
12
|
-
node-version-file: '.nvmrc'
|
|
13
|
-
- run: npm ci
|
|
14
|
-
- run: npm run lint
|
|
15
|
-
- run: npm run test:ci
|
|
16
|
-
- run: npm run cy:test
|
|
17
|
-
- run: npm run build
|
package/templates/app/.nvmrc
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
lts/hydrogen
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": "0.2.0",
|
|
3
|
-
"configurations": [
|
|
4
|
-
{
|
|
5
|
-
"type": "node",
|
|
6
|
-
"request": "launch",
|
|
7
|
-
"name": "Debug Current Test File",
|
|
8
|
-
"autoAttachChildProcesses": true,
|
|
9
|
-
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
|
|
10
|
-
"program": "${workspaceRoot}/node_modules/vitest/vitest.mjs",
|
|
11
|
-
"args": ["run", "${fileBasenameNoExtension}"],
|
|
12
|
-
"smartStep": true,
|
|
13
|
-
"console": "integratedTerminal"
|
|
14
|
-
}
|
|
15
|
-
]
|
|
16
|
-
}
|
package/templates/app/index.html
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en" class="h-full w-full">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
-
<title><% app.name %></title>
|
|
7
|
-
</head>
|
|
8
|
-
<body class="h-full w-full text-base font-normal leading-tight text-gray-900 antialiased">
|
|
9
|
-
<div id="app" class="h-full"></div>
|
|
10
|
-
<script type="module" src="./src/main.ts"></script>
|
|
11
|
-
</body>
|
|
12
|
-
</html>
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "<% app.slug %>",
|
|
3
|
-
"version": "0.0.0",
|
|
4
|
-
"private": true,
|
|
5
|
-
"scripts": {
|
|
6
|
-
"build": "vite build",
|
|
7
|
-
"cy:dev": "concurrently --kill-others \"npm run test:serve-app\" \"npm run cy:open\"",
|
|
8
|
-
"cy:open": "cypress open --e2e --browser chromium",
|
|
9
|
-
"cy:run": "cypress run",
|
|
10
|
-
"cy:test": "start-server-and-test test:serve-app http-get://localhost:5001 cy:run",
|
|
11
|
-
"cy:test-snapshots": "docker run -it -u `id -u ${whoami}` -e CYPRESS_SNAPSHOTS=true -v ./:/app -w /app cypress/base:18.16.0 sh -c \"npx cypress install && npm run cy:test\"",
|
|
12
|
-
"cy:test-snapshots:ci": "docker run -e CYPRESS_SNAPSHOTS=true -v ./:/app -w /app cypress/base:18.16.0 sh -c \"npx cypress install && npm run cy:test\"",
|
|
13
|
-
"dev": "vite",
|
|
14
|
-
"lint": "noeldemartin-lint src",
|
|
15
|
-
"test": "vitest --run",
|
|
16
|
-
"test:ci": "vitest --run --reporter verbose",
|
|
17
|
-
"test:serve-app": "vite --port 5001"
|
|
18
|
-
},
|
|
19
|
-
"dependencies": {
|
|
20
|
-
"@aerogel/core": "<% &dependencies.aerogelCore %>",
|
|
21
|
-
"@aerogel/plugin-i18n": "<% &dependencies.aerogelPluginI18n %>",
|
|
22
|
-
"@aerogel/plugin-soukai": "<% &dependencies.aerogelPluginSoukai %>",
|
|
23
|
-
"@intlify/unplugin-vue-i18n": "^0.12.2",
|
|
24
|
-
"@noeldemartin/utils": "next",
|
|
25
|
-
"@tailwindcss/forms": "^0.5.3",
|
|
26
|
-
"@tailwindcss/typography": "^0.5.9",
|
|
27
|
-
"soukai": "next",
|
|
28
|
-
"tailwindcss": "^3.3.2",
|
|
29
|
-
"vue": "^3.3.0",
|
|
30
|
-
"vue-i18n": "9.3.0-beta.19"
|
|
31
|
-
},
|
|
32
|
-
"devDependencies": {
|
|
33
|
-
"@aerogel/cli": "<% &dependencies.aerogelCli %>",
|
|
34
|
-
"@aerogel/cypress": "<% &dependencies.aerogelCypress %>",
|
|
35
|
-
"@aerogel/vite": "<% &dependencies.aerogelVite %>",
|
|
36
|
-
"@noeldemartin/eslint-config-vue": "next",
|
|
37
|
-
"@noeldemartin/scripts": "next",
|
|
38
|
-
"@total-typescript/ts-reset": "^0.4.2",
|
|
39
|
-
"@types/node": "^20.3.1",
|
|
40
|
-
"autoprefixer": "^10.4.14",
|
|
41
|
-
"concurrently": "^8.2.0",
|
|
42
|
-
"cypress": "^12.17.0",
|
|
43
|
-
"eslint": "^8.40.0",
|
|
44
|
-
"prettier": "^2.8.8",
|
|
45
|
-
"prettier-eslint-cli": "^7.1.0",
|
|
46
|
-
"prettier-plugin-tailwindcss": "^0.2.8",
|
|
47
|
-
"start-server-and-test": "^2.0.0",
|
|
48
|
-
"unplugin-icons": "^0.16.3",
|
|
49
|
-
"unplugin-vue-components": "^0.24.1",
|
|
50
|
-
"vite": "^4.3.0",
|
|
51
|
-
"vitest": "^0.33.0",
|
|
52
|
-
"vue-tsc": "^1.8.15"
|
|
53
|
-
}
|
|
54
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<AGAppLayout>
|
|
3
|
-
<main class="flex flex-grow flex-col items-center justify-center bg-blue-50">
|
|
4
|
-
<h1 class="text-4xl font-semibold">
|
|
5
|
-
{{ $t('home.title') }}
|
|
6
|
-
</h1>
|
|
7
|
-
<a href="https://aerogel.js.org" target="_blank" class="mt-2 underline opacity-75 hover:opacity-100">
|
|
8
|
-
{{ $t('home.getStarted') }}
|
|
9
|
-
</a>
|
|
10
|
-
</main>
|
|
11
|
-
</AGAppLayout>
|
|
12
|
-
</template>
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import i18n from '@aerogel/plugin-i18n';
|
|
2
|
-
import soukai from '@aerogel/plugin-soukai';
|
|
3
|
-
import { bootstrapApplication } from '@aerogel/core';
|
|
4
|
-
|
|
5
|
-
import './assets/styles.css';
|
|
6
|
-
import App from './App.vue';
|
|
7
|
-
|
|
8
|
-
bootstrapApplication(App, {
|
|
9
|
-
plugins: [
|
|
10
|
-
i18n({ messages: import.meta.glob('@/lang/*.yaml') }),
|
|
11
|
-
soukai({ models: import.meta.glob('@/models/*', { eager: true }) }),
|
|
12
|
-
],
|
|
13
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/// <reference types="@total-typescript/ts-reset" />
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "esnext",
|
|
4
|
-
"module": "esnext",
|
|
5
|
-
"moduleResolution": "node",
|
|
6
|
-
"strict": true,
|
|
7
|
-
"jsx": "preserve",
|
|
8
|
-
"noUncheckedIndexedAccess": true,
|
|
9
|
-
"resolveJsonModule": true,
|
|
10
|
-
"esModuleInterop": true,
|
|
11
|
-
"lib": ["esnext", "dom"],
|
|
12
|
-
"baseUrl": ".",
|
|
13
|
-
"paths": {
|
|
14
|
-
"@/*": ["./src/*"]
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
"include": ["src/**/*.ts", "src/**/*.vue"]
|
|
18
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import Aerogel, { AerogelResolver } from '@aerogel/vite';
|
|
2
|
-
import Components from 'unplugin-vue-components/vite';
|
|
3
|
-
import I18n from '@intlify/unplugin-vue-i18n/vite';
|
|
4
|
-
import Icons from 'unplugin-icons/vite';
|
|
5
|
-
import IconsResolver from 'unplugin-icons/resolver';
|
|
6
|
-
import { resolve } from 'path';
|
|
7
|
-
|
|
8
|
-
export default {
|
|
9
|
-
plugins: [
|
|
10
|
-
Aerogel(),
|
|
11
|
-
Components({
|
|
12
|
-
dts: false,
|
|
13
|
-
resolvers: [AerogelResolver(), IconsResolver()],
|
|
14
|
-
}),
|
|
15
|
-
I18n({ include: resolve(__dirname, './src/lang/**/*.yaml') }),
|
|
16
|
-
Icons(),
|
|
17
|
-
],
|
|
18
|
-
resolve: {
|
|
19
|
-
alias: {
|
|
20
|
-
'@': resolve(__dirname, './src'),
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
};
|
package/tsconfig.json
DELETED
package/vite.config.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'vitest/config';
|
|
2
|
-
import { resolve } from 'path';
|
|
3
|
-
|
|
4
|
-
export default defineConfig({
|
|
5
|
-
test: {
|
|
6
|
-
clearMocks: true,
|
|
7
|
-
setupFiles: ['./src/testing/setup.ts'],
|
|
8
|
-
},
|
|
9
|
-
resolve: {
|
|
10
|
-
alias: {
|
|
11
|
-
'@': resolve(__dirname, './src'),
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
});
|
|
File without changes
|