create-astro 0.0.0-9591-20240103143428
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/LICENSE +59 -0
- package/README.md +63 -0
- package/create-astro.mjs +15 -0
- package/dist/actions/context.d.ts +25 -0
- package/dist/actions/dependencies.d.ts +2 -0
- package/dist/actions/git.d.ts +2 -0
- package/dist/actions/help.d.ts +1 -0
- package/dist/actions/intro.d.ts +2 -0
- package/dist/actions/next-steps.d.ts +2 -0
- package/dist/actions/project-name.d.ts +2 -0
- package/dist/actions/shared.d.ts +3 -0
- package/dist/actions/template.d.ts +4 -0
- package/dist/actions/typescript.d.ts +5 -0
- package/dist/actions/verify.d.ts +2 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +1209 -0
- package/dist/messages.d.ts +31 -0
- package/dist/shell.d.ts +13 -0
- package/package.json +51 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Fred K. Schott
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
"""
|
|
24
|
+
This license applies to parts of the `packages/create-astro` and `packages/astro` subdirectories originating from the https://github.com/sveltejs/kit repository:
|
|
25
|
+
|
|
26
|
+
Copyright (c) 2020 [these people](https://github.com/sveltejs/kit/graphs/contributors)
|
|
27
|
+
|
|
28
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
29
|
+
|
|
30
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
31
|
+
|
|
32
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
"""
|
|
36
|
+
This license applies to parts of the `packages/create-astro` and `packages/astro` subdirectories originating from the https://github.com/vitejs/vite repository:
|
|
37
|
+
|
|
38
|
+
MIT License
|
|
39
|
+
|
|
40
|
+
Copyright (c) 2019-present, Yuxi (Evan) You and Vite contributors
|
|
41
|
+
|
|
42
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
43
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
44
|
+
in the Software without restriction, including without limitation the rights
|
|
45
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
46
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
47
|
+
furnished to do so, subject to the following conditions:
|
|
48
|
+
|
|
49
|
+
The above copyright notice and this permission notice shall be included in all
|
|
50
|
+
copies or substantial portions of the Software.
|
|
51
|
+
|
|
52
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
53
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
54
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
55
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
56
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
57
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
58
|
+
SOFTWARE.
|
|
59
|
+
"""
|
package/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# create-astro
|
|
2
|
+
|
|
3
|
+
## Scaffolding for Astro projects
|
|
4
|
+
|
|
5
|
+
**With NPM:**
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm create astro@latest
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
**With Yarn:**
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
yarn create astro
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**With PNPM:**
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pnpm create astro
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`create-astro` automatically runs in _interactive_ mode, but you can also specify your project name and template with command line arguments.
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# npm
|
|
27
|
+
npm create astro@latest my-astro-project -- --template minimal
|
|
28
|
+
|
|
29
|
+
# yarn
|
|
30
|
+
yarn create astro my-astro-project --template minimal
|
|
31
|
+
|
|
32
|
+
# pnpm
|
|
33
|
+
pnpm create astro my-astro-project --template minimal
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
[Check out the full list][examples] of example templates, available on GitHub.
|
|
37
|
+
|
|
38
|
+
You can also use any GitHub repo as a template:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npm create astro@latest my-astro-project -- --template cassidoo/shopify-react-astro
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### CLI Flags
|
|
45
|
+
|
|
46
|
+
May be provided in place of prompts
|
|
47
|
+
|
|
48
|
+
| Name | Description |
|
|
49
|
+
| :--------------------------- | :----------------------------------------------------- |
|
|
50
|
+
| `--help` (`-h`) | Display available flags. |
|
|
51
|
+
| `--template <name>` | Specify your template. |
|
|
52
|
+
| `--install` / `--no-install` | Install dependencies (or not). |
|
|
53
|
+
| `--git` / `--no-git` | Initialize git repo (or not). |
|
|
54
|
+
| `--yes` (`-y`) | Skip all prompts by accepting defaults. |
|
|
55
|
+
| `--no` (`-n`) | Skip all prompts by declining defaults. |
|
|
56
|
+
| `--dry-run` | Walk through steps without executing. |
|
|
57
|
+
| `--skip-houston` | Skip Houston animation. |
|
|
58
|
+
| `--ref` | Specify an Astro branch (default: latest). |
|
|
59
|
+
| `--fancy` | Enable full Unicode support for Windows. |
|
|
60
|
+
| `--typescript <option>` | TypeScript option: `strict` / `strictest` / `relaxed`. |
|
|
61
|
+
|
|
62
|
+
[examples]: https://github.com/withastro/astro/tree/main/examples
|
|
63
|
+
[typescript]: https://github.com/withastro/astro/tree/main/packages/astro/tsconfigs
|
package/create-astro.mjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/* eslint-disable no-console */
|
|
3
|
+
'use strict';
|
|
4
|
+
|
|
5
|
+
const currentVersion = process.versions.node;
|
|
6
|
+
const requiredMajorVersion = parseInt(currentVersion.split('.')[0], 10);
|
|
7
|
+
const minimumMajorVersion = 18;
|
|
8
|
+
|
|
9
|
+
if (requiredMajorVersion < minimumMajorVersion) {
|
|
10
|
+
console.error(`Node.js v${currentVersion} is out of date and unsupported!`);
|
|
11
|
+
console.error(`Please use Node.js v${minimumMajorVersion} or higher.`);
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
import('./dist/index.js').then(({ main }) => main());
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { prompt, type Task } from '@astrojs/cli-kit';
|
|
2
|
+
export interface Context {
|
|
3
|
+
help: boolean;
|
|
4
|
+
prompt: typeof prompt;
|
|
5
|
+
cwd: string;
|
|
6
|
+
packageManager: string;
|
|
7
|
+
username: Promise<string>;
|
|
8
|
+
version: Promise<string>;
|
|
9
|
+
skipHouston: boolean;
|
|
10
|
+
fancy?: boolean;
|
|
11
|
+
dryRun?: boolean;
|
|
12
|
+
yes?: boolean;
|
|
13
|
+
projectName?: string;
|
|
14
|
+
template?: string;
|
|
15
|
+
ref: string;
|
|
16
|
+
install?: boolean;
|
|
17
|
+
git?: boolean;
|
|
18
|
+
typescript?: string;
|
|
19
|
+
stdin?: typeof process.stdin;
|
|
20
|
+
stdout?: typeof process.stdout;
|
|
21
|
+
exit(code: number): never;
|
|
22
|
+
hat?: string;
|
|
23
|
+
tasks: Task[];
|
|
24
|
+
}
|
|
25
|
+
export declare function getContext(argv: string[]): Promise<Context>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function help(): void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Context } from './context.js';
|
|
2
|
+
export declare function template(ctx: Pick<Context, 'template' | 'prompt' | 'yes' | 'dryRun' | 'exit' | 'tasks'>): Promise<void>;
|
|
3
|
+
export declare function getTemplateTarget(tmpl: string, ref?: string): string;
|
|
4
|
+
export default function copyTemplate(tmpl: string, ctx: Context): Promise<void>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Context } from './context.js';
|
|
2
|
+
type PickedTypeScriptContext = Pick<Context, 'typescript' | 'yes' | 'prompt' | 'dryRun' | 'cwd' | 'exit' | 'packageManager' | 'install' | 'tasks'>;
|
|
3
|
+
export declare function typescript(ctx: PickedTypeScriptContext): Promise<void>;
|
|
4
|
+
export declare function setupTypeScript(value: string, ctx: PickedTypeScriptContext): Promise<void>;
|
|
5
|
+
export {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { getContext } from './actions/context.js';
|
|
2
|
+
import { dependencies } from './actions/dependencies.js';
|
|
3
|
+
import { git } from './actions/git.js';
|
|
4
|
+
import { intro } from './actions/intro.js';
|
|
5
|
+
import { next } from './actions/next-steps.js';
|
|
6
|
+
import { projectName } from './actions/project-name.js';
|
|
7
|
+
import { template } from './actions/template.js';
|
|
8
|
+
import { setupTypeScript, typescript } from './actions/typescript.js';
|
|
9
|
+
import { verify } from './actions/verify.js';
|
|
10
|
+
import { setStdout } from './messages.js';
|
|
11
|
+
export declare function main(): Promise<void>;
|
|
12
|
+
export { dependencies, getContext, git, intro, next, projectName, setStdout, setupTypeScript, template, typescript, verify, };
|