@aerogel/cli 0.0.0-next.926bde19326fe7b6b24b277666936862b64d8295 → 0.0.0-next.a5b6ecb68fdca29d00c8b8906d00aa5bf64a9d7c
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/aerogel-cli.cjs.js +1 -1
- package/dist/aerogel-cli.cjs.js.map +1 -1
- package/dist/aerogel-cli.esm.js +1 -1
- package/dist/aerogel-cli.esm.js.map +1 -1
- package/package.json +12 -5
- package/src/cli.ts +4 -0
- package/src/commands/Command.ts +15 -7
- package/src/commands/create.test.ts +32 -7
- package/src/commands/create.ts +25 -8
- package/src/commands/generate-component.test.ts +70 -6
- package/src/commands/generate-component.ts +165 -23
- package/src/commands/generate-model.test.ts +17 -6
- package/src/commands/generate-model.ts +34 -25
- package/src/commands/generate-service.test.ts +29 -0
- package/src/commands/generate-service.ts +151 -0
- package/src/commands/install.test.ts +49 -0
- package/src/commands/install.ts +33 -0
- package/src/lib/App.ts +65 -3
- package/src/lib/Editor.ts +58 -0
- package/src/lib/File.ts +6 -0
- package/src/lib/Log.mock.ts +2 -1
- package/src/lib/Log.ts +6 -4
- package/src/lib/Shell.mock.ts +1 -1
- package/src/lib/Template.ts +5 -1
- package/src/lib/utils/app.ts +15 -0
- package/src/lib/utils/edit.ts +44 -0
- package/src/lib/utils/paths.ts +34 -0
- package/src/plugins/Histoire.ts +105 -0
- package/src/plugins/Plugin.ts +178 -0
- package/src/plugins/Solid.ts +78 -0
- package/src/plugins/Soukai.ts +19 -0
- package/src/testing/setup.ts +36 -6
- package/src/testing/stubs/ProgramStub.ts +35 -0
- package/src/testing/utils.ts +14 -0
- package/templates/app/.github/workflows/ci.yml +14 -2
- package/templates/app/.vscode/launch.json +16 -0
- package/templates/app/.vscode/settings.json +10 -0
- package/templates/app/README.md +3 -0
- package/templates/app/cypress/cypress.config.ts +16 -0
- package/templates/app/index.html +4 -3
- package/templates/app/package.json +33 -9
- package/templates/app/src/App.vue +5 -3
- package/templates/app/src/assets/public/robots.txt +2 -0
- package/templates/app/src/main.ts +6 -2
- package/templates/app/src/types/globals.d.ts +0 -1
- package/templates/app/tailwind.config.js +1 -1
- package/templates/app/tsconfig.json +1 -0
- package/templates/app/vite.config.ts +14 -6
- package/templates/component-button/[component.name].vue +32 -0
- package/templates/component-button-story/[component.name].story.vue +71 -0
- package/templates/component-input/[component.name].vue +16 -0
- package/templates/component-input-story/[component.name].story.vue +63 -0
- package/templates/histoire/histoire.config.ts +7 -0
- package/templates/histoire/patches/histoire+0.17.6.patch +13 -0
- package/templates/histoire/src/main.histoire.ts +8 -0
- package/templates/postcss-pseudo-classes/postcss.config.js +15 -0
- package/templates/service/[service.name].ts +8 -0
- package/.eslintrc.js +0 -7
- package/noeldemartin.config.js +0 -4
- package/src/lib/utils.test.ts +0 -33
- package/src/lib/utils.ts +0 -44
- package/templates/app/cypress.config.ts +0 -8
- /package/bin/{ag → gel} +0 -0
- /package/templates/app/src/assets/{styles.css → css/styles.css} +0 -0
package/src/lib/utils.test.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
|
|
3
|
-
import { formatCodeBlock } from './utils';
|
|
4
|
-
|
|
5
|
-
describe('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.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { resolve } from 'path';
|
|
2
|
-
|
|
3
|
-
export interface FormatCodeBlockOptions {
|
|
4
|
-
indent?: number;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export function basePath(path: string): string {
|
|
8
|
-
return resolve(__dirname, '../', path);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function formatCodeBlock(code: string, options: FormatCodeBlockOptions = {}): string {
|
|
12
|
-
const lines = code.split('\n');
|
|
13
|
-
const indent = options.indent ?? 0;
|
|
14
|
-
let originalIndent = 0;
|
|
15
|
-
let formatted = '';
|
|
16
|
-
|
|
17
|
-
for (const line of lines) {
|
|
18
|
-
const trimmedLine = line.trim();
|
|
19
|
-
const isEmptyLine = trimmedLine.length === 0;
|
|
20
|
-
|
|
21
|
-
if (formatted.length === 0) {
|
|
22
|
-
if (isEmptyLine) {
|
|
23
|
-
continue;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
originalIndent = line.indexOf(trimmedLine[0] ?? '');
|
|
27
|
-
formatted += `${' '.repeat(indent)}${trimmedLine}\n`;
|
|
28
|
-
|
|
29
|
-
continue;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (isEmptyLine) {
|
|
33
|
-
formatted += '\n';
|
|
34
|
-
|
|
35
|
-
continue;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const lineIndent = line.indexOf(trimmedLine[0] ?? '');
|
|
39
|
-
|
|
40
|
-
formatted += `${' '.repeat(indent + lineIndent - originalIndent)}${trimmedLine}\n`;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return formatted.trimEnd();
|
|
44
|
-
}
|
/package/bin/{ag → gel}
RENAMED
|
File without changes
|
|
File without changes
|