create-absolutejs 0.3.7 → 0.3.9
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/README.md +2 -0
- package/dist/commands/formatProject.d.ts +1 -1
- package/dist/commands/formatProject.js +3 -3
- package/dist/commands/initializeGit.d.ts +1 -0
- package/dist/commands/initializeGit.js +17 -0
- package/dist/commands/installDependencies.d.ts +2 -6
- package/dist/commands/installDependencies.js +4 -4
- package/dist/index.js +1 -1
- package/dist/questions/directoryConfiguration.js +2 -2
- package/dist/scaffold.d.ts +1 -1
- package/dist/scaffold.js +7 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -168,6 +168,8 @@ bun install
|
|
|
168
168
|
bun run dev
|
|
169
169
|
```
|
|
170
170
|
|
|
171
|
+
If you downloaded this repository to test or make changes you can use `bun run test` to start the created dev server without having to change directories back and forth.
|
|
172
|
+
|
|
171
173
|
## Contributing
|
|
172
174
|
|
|
173
175
|
Contributions are welcome! Feel free to open issues or submit pull requests to improve the CLI.
|
|
@@ -4,5 +4,5 @@ type FormatProjectProps = {
|
|
|
4
4
|
packageManager: PackageManager;
|
|
5
5
|
installDependenciesNow: boolean;
|
|
6
6
|
};
|
|
7
|
-
export declare const formatProject: ({ projectName, packageManager, installDependenciesNow }: FormatProjectProps) => void
|
|
7
|
+
export declare const formatProject: ({ projectName, packageManager, installDependenciesNow }: FormatProjectProps) => Promise<void>;
|
|
8
8
|
export {};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { execSync } from 'child_process';
|
|
2
1
|
import { exit } from 'process';
|
|
3
2
|
import { spinner } from '@clack/prompts';
|
|
3
|
+
import { $ } from 'bun';
|
|
4
4
|
import { green, red } from 'picocolors';
|
|
5
5
|
import { formatCommands, formatNoInstallCommands } from '../utils/commandMaps';
|
|
6
|
-
export const formatProject = ({ projectName, packageManager, installDependenciesNow }) => {
|
|
6
|
+
export const formatProject = async ({ projectName, packageManager, installDependenciesNow }) => {
|
|
7
7
|
const spin = spinner();
|
|
8
8
|
try {
|
|
9
9
|
const fmt = installDependenciesNow
|
|
10
10
|
? formatCommands[packageManager]
|
|
11
11
|
: formatNoInstallCommands[packageManager];
|
|
12
12
|
spin.start('Formatting files…');
|
|
13
|
-
|
|
13
|
+
await $ `sh -c ${fmt}`.cwd(projectName).quiet();
|
|
14
14
|
spin.stop(green('Files formatted'));
|
|
15
15
|
}
|
|
16
16
|
catch (err) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const initializeGit: (projectName: string) => Promise<void>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { spinner } from '@clack/prompts';
|
|
2
|
+
import { $ } from 'bun';
|
|
3
|
+
import { green, red } from 'picocolors';
|
|
4
|
+
export const initializeGit = async (projectName) => {
|
|
5
|
+
const spin = spinner();
|
|
6
|
+
try {
|
|
7
|
+
spin.start('Initializing git repository…');
|
|
8
|
+
await $ `git init -b main`.cwd(projectName).quiet();
|
|
9
|
+
await $ `git add -A`.cwd(projectName).quiet();
|
|
10
|
+
await $ `git commit -m "Initial commit"`.cwd(projectName).quiet();
|
|
11
|
+
spin.stop(green('Git repo initialized'));
|
|
12
|
+
}
|
|
13
|
+
catch (err) {
|
|
14
|
+
spin.stop(red('Failed to initialize git'), 1);
|
|
15
|
+
throw err;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
packageManager: string;
|
|
4
|
-
};
|
|
5
|
-
export declare const installDependencies: ({ projectName, packageManager }: InstallDependenciesProps) => Promise<void>;
|
|
6
|
-
export {};
|
|
1
|
+
import { PackageManager } from '../types';
|
|
2
|
+
export declare const installDependencies: (packageManager: PackageManager, projectName: string) => Promise<void>;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { execSync } from 'child_process';
|
|
2
1
|
import { exit } from 'process';
|
|
3
2
|
import { spinner } from '@clack/prompts';
|
|
3
|
+
import { $ } from 'bun';
|
|
4
4
|
import { green, red } from 'picocolors';
|
|
5
5
|
import { installCommands } from '../utils/commandMaps';
|
|
6
|
-
export const installDependencies = async (
|
|
6
|
+
export const installDependencies = async (packageManager, projectName) => {
|
|
7
7
|
const spin = spinner();
|
|
8
|
-
const cmd = installCommands[packageManager]
|
|
8
|
+
const cmd = installCommands[packageManager];
|
|
9
9
|
try {
|
|
10
10
|
spin.start('Installing dependencies…');
|
|
11
|
-
|
|
11
|
+
await $ `sh -c ${cmd}`.cwd(projectName).quiet();
|
|
12
12
|
spin.stop(green('Dependencies installed'));
|
|
13
13
|
}
|
|
14
14
|
catch (err) {
|
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ if (help === true) {
|
|
|
13
13
|
exit(0);
|
|
14
14
|
}
|
|
15
15
|
const response = await prompt(argumentConfiguration);
|
|
16
|
-
scaffold({ latest, packageManager, response });
|
|
16
|
+
await scaffold({ latest, packageManager, response });
|
|
17
17
|
const debugMessage = debug !== false
|
|
18
18
|
? getDebugMessage({
|
|
19
19
|
packageManager,
|
|
@@ -5,7 +5,7 @@ export const getDirectoryConfiguration = async ({ directoryConfig, useTailwind,
|
|
|
5
5
|
return {
|
|
6
6
|
assetsDirectory: argumentConfiguration.assetsDirectory ?? 'src/backend/assets',
|
|
7
7
|
buildDirectory: argumentConfiguration.buildDirectory ?? 'build',
|
|
8
|
-
databaseDirectory: databaseEngine
|
|
8
|
+
databaseDirectory: databaseEngine !== undefined && databaseEngine !== 'none'
|
|
9
9
|
? (argumentConfiguration.databaseDirectory ?? 'db')
|
|
10
10
|
: undefined,
|
|
11
11
|
tailwind: useTailwind
|
|
@@ -58,7 +58,7 @@ export const getDirectoryConfiguration = async ({ directoryConfig, useTailwind,
|
|
|
58
58
|
}
|
|
59
59
|
// Database
|
|
60
60
|
let databaseDirectory;
|
|
61
|
-
if (databaseEngine !== undefined) {
|
|
61
|
+
if (databaseEngine !== undefined && databaseEngine !== 'none') {
|
|
62
62
|
databaseDirectory =
|
|
63
63
|
argumentConfiguration.databaseDirectory ??
|
|
64
64
|
(await text({
|
package/dist/scaffold.d.ts
CHANGED
|
@@ -4,5 +4,5 @@ type ScaffoldProps = {
|
|
|
4
4
|
packageManager: PackageManager;
|
|
5
5
|
latest: boolean;
|
|
6
6
|
};
|
|
7
|
-
export declare const scaffold: ({ response: { projectName, codeQualityTool, initializeGitNow, databaseEngine, useHTMLScripts, useTailwind, databaseDirectory, orm, frontends, plugins, authProvider, buildDirectory, assetsDirectory, tailwind, installDependenciesNow, frontendDirectories }, latest, packageManager }: ScaffoldProps) => void
|
|
7
|
+
export declare const scaffold: ({ response: { projectName, codeQualityTool, initializeGitNow, databaseEngine, useHTMLScripts, useTailwind, databaseDirectory, orm, frontends, plugins, authProvider, buildDirectory, assetsDirectory, tailwind, installDependenciesNow, frontendDirectories }, latest, packageManager }: ScaffoldProps) => Promise<void>;
|
|
8
8
|
export {};
|
package/dist/scaffold.js
CHANGED
|
@@ -2,6 +2,7 @@ import { copyFileSync } from 'node:fs';
|
|
|
2
2
|
import { join, dirname } from 'node:path';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
4
|
import { formatProject } from './commands/formatProject';
|
|
5
|
+
import { initializeGit } from './commands/initializeGit';
|
|
5
6
|
import { installDependencies } from './commands/installDependencies';
|
|
6
7
|
import { availablePlugins } from './data';
|
|
7
8
|
import { addConfigurationFiles } from './generators/configurations/addConfigurationFiles';
|
|
@@ -10,7 +11,7 @@ import { initalizeRoot } from './generators/configurations/initializeRoot';
|
|
|
10
11
|
import { scaffoldDatabase } from './generators/db/scaffoldDatabase';
|
|
11
12
|
import { generateServerFile } from './generators/project/generateServer';
|
|
12
13
|
import { scaffoldFrontends } from './generators/project/scaffoldFrontends';
|
|
13
|
-
export const scaffold = ({ response: { projectName, codeQualityTool, initializeGitNow, databaseEngine,
|
|
14
|
+
export const scaffold = async ({ response: { projectName, codeQualityTool, initializeGitNow, databaseEngine,
|
|
14
15
|
// databaseHost,
|
|
15
16
|
useHTMLScripts, useTailwind, databaseDirectory, orm, frontends, plugins, authProvider, buildDirectory, assetsDirectory, tailwind, installDependenciesNow, frontendDirectories }, latest, packageManager }) => {
|
|
16
17
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
@@ -60,11 +61,14 @@ useHTMLScripts, useTailwind, databaseDirectory, orm, frontends, plugins, authPro
|
|
|
60
61
|
useHTMLScripts
|
|
61
62
|
});
|
|
62
63
|
if (installDependenciesNow) {
|
|
63
|
-
installDependencies(
|
|
64
|
+
await installDependencies(packageManager, projectName);
|
|
64
65
|
}
|
|
65
|
-
formatProject({
|
|
66
|
+
await formatProject({
|
|
66
67
|
installDependenciesNow,
|
|
67
68
|
packageManager,
|
|
68
69
|
projectName
|
|
69
70
|
});
|
|
71
|
+
if (initializeGitNow) {
|
|
72
|
+
await initializeGit(projectName);
|
|
73
|
+
}
|
|
70
74
|
};
|
package/package.json
CHANGED