@aerogel/cli 0.0.0-next.0be1479064cfd43fb6eafa2552cb7f8775554d93

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.
Files changed (74) hide show
  1. package/.eslintrc.js +7 -0
  2. package/bin/ag +4 -0
  3. package/dist/aerogel-cli.cjs.js +2 -0
  4. package/dist/aerogel-cli.cjs.js.map +1 -0
  5. package/dist/aerogel-cli.d.ts +10 -0
  6. package/dist/aerogel-cli.esm.js +2 -0
  7. package/dist/aerogel-cli.esm.js.map +1 -0
  8. package/noeldemartin.config.js +14 -0
  9. package/package.json +47 -0
  10. package/src/cli.ts +27 -0
  11. package/src/commands/Command.ts +59 -0
  12. package/src/commands/create.test.ts +34 -0
  13. package/src/commands/create.ts +84 -0
  14. package/src/commands/generate-component.test.ts +44 -0
  15. package/src/commands/generate-component.ts +174 -0
  16. package/src/commands/generate-model.test.ts +45 -0
  17. package/src/commands/generate-model.ts +99 -0
  18. package/src/commands/generate-service.test.ts +21 -0
  19. package/src/commands/generate-service.ts +152 -0
  20. package/src/commands/install.test.ts +18 -0
  21. package/src/commands/install.ts +32 -0
  22. package/src/lib/App.ts +87 -0
  23. package/src/lib/Editor.ts +51 -0
  24. package/src/lib/File.mock.ts +66 -0
  25. package/src/lib/File.ts +76 -0
  26. package/src/lib/Log.mock.ts +37 -0
  27. package/src/lib/Log.test.ts +37 -0
  28. package/src/lib/Log.ts +95 -0
  29. package/src/lib/Shell.mock.ts +20 -0
  30. package/src/lib/Shell.ts +28 -0
  31. package/src/lib/Template.ts +56 -0
  32. package/src/lib/utils/app.ts +15 -0
  33. package/src/lib/utils/edit.ts +44 -0
  34. package/src/lib/utils/format.test.ts +33 -0
  35. package/src/lib/utils/format.ts +38 -0
  36. package/src/lib/utils/paths.ts +34 -0
  37. package/src/main.ts +3 -0
  38. package/src/plugins/Plugin.ts +125 -0
  39. package/src/plugins/Solid.ts +65 -0
  40. package/src/plugins/Soukai.ts +19 -0
  41. package/src/testing/setup.ts +74 -0
  42. package/src/types/ts-reset.d.ts +1 -0
  43. package/templates/app/.eslintrc.js +3 -0
  44. package/templates/app/.github/workflows/ci.yml +17 -0
  45. package/templates/app/.gitignore.template +2 -0
  46. package/templates/app/.nvmrc +1 -0
  47. package/templates/app/.vscode/launch.json +16 -0
  48. package/templates/app/.vscode/settings.json +10 -0
  49. package/templates/app/cypress/e2e/app.cy.ts +9 -0
  50. package/templates/app/cypress/support/e2e.ts +3 -0
  51. package/templates/app/cypress/tsconfig.json +12 -0
  52. package/templates/app/cypress.config.ts +12 -0
  53. package/templates/app/index.html +12 -0
  54. package/templates/app/package.json +54 -0
  55. package/templates/app/postcss.config.js +6 -0
  56. package/templates/app/prettier.config.js +5 -0
  57. package/templates/app/src/App.vue +12 -0
  58. package/templates/app/src/assets/styles.css +3 -0
  59. package/templates/app/src/lang/en.yaml +3 -0
  60. package/templates/app/src/main.test.ts +9 -0
  61. package/templates/app/src/main.ts +13 -0
  62. package/templates/app/src/types/globals.d.ts +2 -0
  63. package/templates/app/src/types/shims.d.ts +7 -0
  64. package/templates/app/src/types/ts-reset.d.ts +1 -0
  65. package/templates/app/tailwind.config.js +5 -0
  66. package/templates/app/tsconfig.json +18 -0
  67. package/templates/app/vite.config.ts +23 -0
  68. package/templates/component/[component.name].vue +3 -0
  69. package/templates/component-story/[component.name].story.vue +7 -0
  70. package/templates/model/[model.name].schema.ts +7 -0
  71. package/templates/model/[model.name].ts +3 -0
  72. package/templates/service/[service.name].ts +8 -0
  73. package/tsconfig.json +11 -0
  74. package/vite.config.ts +14 -0
@@ -0,0 +1,74 @@
1
+ import { beforeEach, vi } from 'vitest';
2
+ import { resolve } from 'path';
3
+ import { setTestingNamespace } from '@noeldemartin/utils';
4
+
5
+ import File from '@/lib/File';
6
+ import FileMock from '@/lib/File.mock';
7
+ import Log from '@/lib/Log';
8
+ import LogMock from '@/lib/Log.mock';
9
+ import Shell from '@/lib/Shell';
10
+ import ShellMock from '@/lib/Shell.mock';
11
+
12
+ setTestingNamespace(vi);
13
+
14
+ File.setMockInstance(FileMock);
15
+ Log.setMockInstance(LogMock);
16
+ Shell.setMockInstance(ShellMock);
17
+
18
+ beforeEach(() => {
19
+ FileMock.reset();
20
+ LogMock.reset();
21
+
22
+ File.mock();
23
+ Log.mock();
24
+ Shell.mock();
25
+ });
26
+
27
+ vi.mock('@/lib/utils/app', async () => {
28
+ const original = (await vi.importActual('@/lib/utils/app')) as object;
29
+
30
+ return {
31
+ ...original,
32
+ isLocalApp: () => false,
33
+ isLinkedLocalApp: () => false,
34
+ };
35
+ });
36
+
37
+ vi.mock('@/lib/utils/edit', async () => {
38
+ const original = (await vi.importActual('@/lib/utils/edit')) as object;
39
+
40
+ return {
41
+ ...original,
42
+ editFiles: () => false,
43
+ };
44
+ });
45
+
46
+ // TODO find out why these need to be mocked
47
+ vi.mock('@/lib/utils/paths', async () => {
48
+ const original = (await vi.importActual('@/lib/utils/paths')) as object;
49
+
50
+ function cliBasePath(path: string = '') {
51
+ return resolve(__dirname, '../../', path);
52
+ }
53
+
54
+ function basePath(path: string = '') {
55
+ return resolve(__dirname, '../../', path);
56
+ }
57
+
58
+ function packagePath(packageName: string) {
59
+ return basePath(`../${packageName}`);
60
+ }
61
+
62
+ return {
63
+ ...original,
64
+ basePath,
65
+ cliBasePath,
66
+ packagePath,
67
+ };
68
+ });
69
+
70
+ vi.mock('mustache', async () => {
71
+ const mustache = (await vi.importActual('mustache')) as { default: unknown };
72
+
73
+ return mustache.default;
74
+ });
@@ -0,0 +1 @@
1
+ /// <reference types="@total-typescript/ts-reset" />
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ extends: ['@noeldemartin/eslint-config-vue'],
3
+ };
@@ -0,0 +1,17 @@
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
@@ -0,0 +1,2 @@
1
+ /dist
2
+ /node_modules
@@ -0,0 +1 @@
1
+ lts/hydrogen
@@ -0,0 +1,16 @@
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
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "emeraldwalk.runonsave": {
3
+ "commands": [
4
+ {
5
+ "match": ".*",
6
+ "cmd": "npx prettier-eslint ${file} --write"
7
+ }
8
+ ]
9
+ }
10
+ }
@@ -0,0 +1,9 @@
1
+ describe('App', () => {
2
+
3
+ beforeEach(() => cy.visit('/'));
4
+
5
+ it('Shows get started link', () => {
6
+ cy.see('Get started');
7
+ });
8
+
9
+ });
@@ -0,0 +1,3 @@
1
+ import install from '@aerogel/cypress';
2
+
3
+ install();
@@ -0,0 +1,12 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es5",
4
+ "lib": ["es5", "dom"],
5
+ "types": ["cypress", "node"],
6
+ "baseUrl": ".",
7
+ "paths": {
8
+ "@cy/*": ["./*"]
9
+ }
10
+ },
11
+ "include": ["**/*.ts"]
12
+ }
@@ -0,0 +1,12 @@
1
+ import install from '@aerogel/cypress/dist/plugin';
2
+ import { defineConfig } from 'cypress';
3
+
4
+ export default defineConfig({
5
+ e2e: {
6
+ baseUrl: 'http://localhost:5001',
7
+ video: false,
8
+ setupNodeEvents(on) {
9
+ install(on);
10
+ },
11
+ },
12
+ });
@@ -0,0 +1,12 @@
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>
@@ -0,0 +1,54 @@
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
+ }
@@ -0,0 +1,6 @@
1
+ module.exports = {
2
+ plugins: {
3
+ tailwindcss: {},
4
+ autoprefixer: {},
5
+ },
6
+ };
@@ -0,0 +1,5 @@
1
+ /** @type {import('prettier').Config} */
2
+ module.exports = {
3
+ plugins: [require('prettier-plugin-tailwindcss')],
4
+ printWidth: 120,
5
+ };
@@ -0,0 +1,12 @@
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>
@@ -0,0 +1,3 @@
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
@@ -0,0 +1,3 @@
1
+ home:
2
+ title: Aerogel
3
+ getStarted: Get started
@@ -0,0 +1,9 @@
1
+ import { describe, expect, it } from 'vitest';
2
+
3
+ describe('App', () => {
4
+
5
+ it('works', () => {
6
+ expect(true).toBe(true);
7
+ });
8
+
9
+ });
@@ -0,0 +1,13 @@
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
+ });
@@ -0,0 +1,2 @@
1
+ /// <reference types="vite/client" />
2
+ /// <reference types="vue-i18n" />
@@ -0,0 +1,7 @@
1
+ declare module '*.vue' {
2
+ import type { ComponentOptions } from 'vue';
3
+
4
+ const component: ComponentOptions;
5
+
6
+ export default component;
7
+ }
@@ -0,0 +1 @@
1
+ /// <reference types="@total-typescript/ts-reset" />
@@ -0,0 +1,5 @@
1
+ /** @type {import('tailwindcss').Config} */
2
+ module.exports = {
3
+ content: ['./index.html', './src/**/*.{vue,ts}', '<% &contentPath %>'],
4
+ plugins: [require('@tailwindcss/forms'), require('@tailwindcss/typography')],
5
+ };
@@ -0,0 +1,18 @@
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
+ }
@@ -0,0 +1,23 @@
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
+ };
@@ -0,0 +1,3 @@
1
+ <template>
2
+ <div><% component.name %></div>
3
+ </template>
@@ -0,0 +1,7 @@
1
+ <template>
2
+ <Story>
3
+ <Variant title="Primary">
4
+ <<% component.name %> />
5
+ </Variant>
6
+ </Story>
7
+ </template>
@@ -0,0 +1,7 @@
1
+ import { <% soukaiImports %> } from 'soukai';
2
+
3
+ export default defineModelSchema({
4
+ fields: {
5
+ <% &model.fieldsDefinition %>
6
+ },
7
+ });
@@ -0,0 +1,3 @@
1
+ import Model from './<% model.name %>.schema';
2
+
3
+ export default class <% model.name %> extends Model {}
@@ -0,0 +1,8 @@
1
+ import { Service } from '@aerogel/core';
2
+ import { facade } from '@noeldemartin/utils';
3
+
4
+ export class <% service.name %>Service extends Service {
5
+
6
+ }
7
+
8
+ export default facade(new <% service.name %>Service());
package/tsconfig.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "types": ["node"],
5
+ "baseUrl": ".",
6
+ "paths": {
7
+ "@/*": ["./src/*"]
8
+ }
9
+ },
10
+ "include": ["src/**/*.ts"]
11
+ }
package/vite.config.ts ADDED
@@ -0,0 +1,14 @@
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
+ });