@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.
- package/.eslintrc.js +7 -0
- package/bin/ag +4 -0
- package/dist/aerogel-cli.cjs.js +2 -0
- package/dist/aerogel-cli.cjs.js.map +1 -0
- package/dist/aerogel-cli.d.ts +10 -0
- package/dist/aerogel-cli.esm.js +2 -0
- package/dist/aerogel-cli.esm.js.map +1 -0
- package/noeldemartin.config.js +14 -0
- package/package.json +47 -0
- package/src/cli.ts +27 -0
- package/src/commands/Command.ts +59 -0
- package/src/commands/create.test.ts +34 -0
- package/src/commands/create.ts +84 -0
- package/src/commands/generate-component.test.ts +44 -0
- package/src/commands/generate-component.ts +174 -0
- package/src/commands/generate-model.test.ts +45 -0
- package/src/commands/generate-model.ts +99 -0
- package/src/commands/generate-service.test.ts +21 -0
- package/src/commands/generate-service.ts +152 -0
- package/src/commands/install.test.ts +18 -0
- package/src/commands/install.ts +32 -0
- package/src/lib/App.ts +87 -0
- package/src/lib/Editor.ts +51 -0
- package/src/lib/File.mock.ts +66 -0
- package/src/lib/File.ts +76 -0
- package/src/lib/Log.mock.ts +37 -0
- package/src/lib/Log.test.ts +37 -0
- package/src/lib/Log.ts +95 -0
- package/src/lib/Shell.mock.ts +20 -0
- package/src/lib/Shell.ts +28 -0
- package/src/lib/Template.ts +56 -0
- package/src/lib/utils/app.ts +15 -0
- package/src/lib/utils/edit.ts +44 -0
- package/src/lib/utils/format.test.ts +33 -0
- package/src/lib/utils/format.ts +38 -0
- package/src/lib/utils/paths.ts +34 -0
- package/src/main.ts +3 -0
- package/src/plugins/Plugin.ts +125 -0
- package/src/plugins/Solid.ts +65 -0
- package/src/plugins/Soukai.ts +19 -0
- package/src/testing/setup.ts +74 -0
- package/src/types/ts-reset.d.ts +1 -0
- package/templates/app/.eslintrc.js +3 -0
- package/templates/app/.github/workflows/ci.yml +17 -0
- package/templates/app/.gitignore.template +2 -0
- package/templates/app/.nvmrc +1 -0
- package/templates/app/.vscode/launch.json +16 -0
- package/templates/app/.vscode/settings.json +10 -0
- package/templates/app/cypress/e2e/app.cy.ts +9 -0
- package/templates/app/cypress/support/e2e.ts +3 -0
- package/templates/app/cypress/tsconfig.json +12 -0
- package/templates/app/cypress.config.ts +12 -0
- package/templates/app/index.html +12 -0
- package/templates/app/package.json +54 -0
- package/templates/app/postcss.config.js +6 -0
- package/templates/app/prettier.config.js +5 -0
- package/templates/app/src/App.vue +12 -0
- package/templates/app/src/assets/styles.css +3 -0
- package/templates/app/src/lang/en.yaml +3 -0
- package/templates/app/src/main.test.ts +9 -0
- package/templates/app/src/main.ts +13 -0
- package/templates/app/src/types/globals.d.ts +2 -0
- package/templates/app/src/types/shims.d.ts +7 -0
- package/templates/app/src/types/ts-reset.d.ts +1 -0
- package/templates/app/tailwind.config.js +5 -0
- package/templates/app/tsconfig.json +18 -0
- package/templates/app/vite.config.ts +23 -0
- package/templates/component/[component.name].vue +3 -0
- package/templates/component-story/[component.name].story.vue +7 -0
- package/templates/model/[model.name].schema.ts +7 -0
- package/templates/model/[model.name].ts +3 -0
- package/templates/service/[service.name].ts +8 -0
- package/tsconfig.json +11 -0
- 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,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 @@
|
|
|
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,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,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,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 @@
|
|
|
1
|
+
/// <reference types="@total-typescript/ts-reset" />
|
|
@@ -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
|
+
};
|
package/tsconfig.json
ADDED
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
|
+
});
|