create-umi 4.0.0-beta.16 → 4.0.0-canary.202200505.1
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/index.js +11 -18
- package/package.json +5 -4
- package/templates/app/.gitignore.tpl +4 -2
- package/templates/app/package.json.tpl +2 -2
- package/templates/app/src/assets/yay.jpg +0 -0
- package/templates/app/src/layouts/index.less +10 -0
- package/templates/app/{layouts/index.tsx → src/layouts/index.tsx.tpl} +4 -5
- package/templates/app/{pages/users.tsx → src/pages/docs.tsx} +1 -1
- package/templates/app/src/pages/index.tsx +16 -0
- package/templates/app/tsconfig.json +18 -0
- package/templates/app/typings.d.ts +6 -0
- package/templates/app/pages/index.tsx +0 -5
- package/templates/app/pages/users/foo.tsx +0 -3
package/dist/index.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
const utils_1 = require("@umijs/utils");
|
|
13
4
|
const path_1 = require("path");
|
|
@@ -21,13 +12,13 @@ const testData = {
|
|
|
21
12
|
npmClient: 'pnpm',
|
|
22
13
|
registry: 'https://registry.npmjs.org/',
|
|
23
14
|
};
|
|
24
|
-
exports.default = ({ cwd, args, }) =>
|
|
25
|
-
const [
|
|
15
|
+
exports.default = async ({ cwd, args, }) => {
|
|
16
|
+
const [name] = args._;
|
|
26
17
|
let npmClient = 'pnpm';
|
|
27
18
|
let registry = 'https://registry.npmjs.org/';
|
|
28
19
|
// test ignore prompts
|
|
29
20
|
if (!args.default) {
|
|
30
|
-
const response =
|
|
21
|
+
const response = await (0, utils_1.prompts)([
|
|
31
22
|
{
|
|
32
23
|
type: 'select',
|
|
33
24
|
name: 'npmClient',
|
|
@@ -37,13 +28,14 @@ exports.default = ({ cwd, args, }) => __awaiter(void 0, void 0, void 0, function
|
|
|
37
28
|
{ title: 'cnpm', value: 'cnpm' },
|
|
38
29
|
{ title: 'tnpm', value: 'tnpm' },
|
|
39
30
|
{ title: 'yarn', value: 'yarn' },
|
|
40
|
-
{ title: 'pnpm', value: 'pnpm'
|
|
31
|
+
{ title: 'pnpm', value: 'pnpm' },
|
|
41
32
|
],
|
|
33
|
+
initial: 4,
|
|
42
34
|
},
|
|
43
35
|
{
|
|
44
36
|
type: 'select',
|
|
45
37
|
name: 'registry',
|
|
46
|
-
message: 'Pick
|
|
38
|
+
message: 'Pick Npm Registry',
|
|
47
39
|
choices: [
|
|
48
40
|
{
|
|
49
41
|
title: 'npm',
|
|
@@ -85,9 +77,10 @@ exports.default = ({ cwd, args, }) => __awaiter(void 0, void 0, void 0, function
|
|
|
85
77
|
message: `Which organization is your plugin stored under github?`,
|
|
86
78
|
},
|
|
87
79
|
];
|
|
80
|
+
const target = name ? (0, path_1.join)(cwd, name) : cwd;
|
|
88
81
|
const generator = new utils_1.BaseGenerator({
|
|
89
82
|
path: (0, path_1.join)(__dirname, '..', 'templates', args.plugin ? 'plugin' : 'app'),
|
|
90
|
-
target
|
|
83
|
+
target,
|
|
91
84
|
data: args.default
|
|
92
85
|
? testData
|
|
93
86
|
: {
|
|
@@ -97,9 +90,9 @@ exports.default = ({ cwd, args, }) => __awaiter(void 0, void 0, void 0, function
|
|
|
97
90
|
},
|
|
98
91
|
questions: args.default ? [] : args.plugin ? pluginPrompts : [],
|
|
99
92
|
});
|
|
100
|
-
|
|
93
|
+
await generator.run();
|
|
101
94
|
if (!args.default) {
|
|
102
95
|
// install
|
|
103
|
-
(0, utils_1.installWithNpmClient)({ npmClient });
|
|
96
|
+
(0, utils_1.installWithNpmClient)({ npmClient, cwd: target });
|
|
104
97
|
}
|
|
105
|
-
}
|
|
98
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-umi",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-canary.202200505.1",
|
|
4
4
|
"description": "create-umi",
|
|
5
5
|
"homepage": "https://github.com/umijs/umi-next/tree/master/packages/create-umi#readme",
|
|
6
6
|
"bugs": "https://github.com/umijs/umi-next/issues",
|
|
@@ -20,11 +20,12 @@
|
|
|
20
20
|
],
|
|
21
21
|
"scripts": {
|
|
22
22
|
"build": "pnpm tsc",
|
|
23
|
-
"build:deps": "
|
|
24
|
-
"dev": "pnpm build -- --watch"
|
|
23
|
+
"build:deps": "umi-scripts bundleDeps",
|
|
24
|
+
"dev": "pnpm build -- --watch",
|
|
25
|
+
"test": "umi-scripts jest-turbo"
|
|
25
26
|
},
|
|
26
27
|
"dependencies": {
|
|
27
|
-
"@umijs/utils": "4.0.0-
|
|
28
|
+
"@umijs/utils": "4.0.0-canary.202200505.1"
|
|
28
29
|
},
|
|
29
30
|
"publishConfig": {
|
|
30
31
|
"access": "public"
|
|
Binary file
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
// @ts-ignore
|
|
3
2
|
import { Link, Outlet } from 'umi';
|
|
3
|
+
import styles from './index.less';
|
|
4
4
|
|
|
5
5
|
export default function Layout() {
|
|
6
6
|
return (
|
|
7
|
-
<div>
|
|
8
|
-
<h2>global layout</h2>
|
|
7
|
+
<div className={styles.navs}>
|
|
9
8
|
<ul>
|
|
10
9
|
<li>
|
|
11
10
|
<Link to="/">Home</Link>
|
|
12
11
|
</li>
|
|
13
12
|
<li>
|
|
14
|
-
<Link to="/
|
|
13
|
+
<Link to="/docs">Docs</Link>
|
|
15
14
|
</li>
|
|
16
15
|
<li>
|
|
17
|
-
<
|
|
16
|
+
<a href="https://github.com/umijs/umi">Github</a>
|
|
18
17
|
</li>
|
|
19
18
|
</ul>
|
|
20
19
|
<Outlet />
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import yayJpg from '../assets/yay.jpg';
|
|
3
|
+
|
|
4
|
+
export default function HomePage() {
|
|
5
|
+
return (
|
|
6
|
+
<div>
|
|
7
|
+
<h2>Yay! Welcome to umi!</h2>
|
|
8
|
+
<p>
|
|
9
|
+
<img src={yayJpg} width="388" />
|
|
10
|
+
</p>
|
|
11
|
+
<p>
|
|
12
|
+
To get started, edit <code>pages/index.tsx</code> and save to reload.
|
|
13
|
+
</p>
|
|
14
|
+
</div>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "esnext",
|
|
4
|
+
"module": "esnext",
|
|
5
|
+
"moduleResolution": "node",
|
|
6
|
+
"importHelpers": true,
|
|
7
|
+
"jsx": "react",
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"sourceMap": true,
|
|
10
|
+
"baseUrl": ".",
|
|
11
|
+
"strict": true,
|
|
12
|
+
"paths": {
|
|
13
|
+
"@/*": ["src/*"],
|
|
14
|
+
"@@/*": ["src/.umi/*"]
|
|
15
|
+
},
|
|
16
|
+
"allowSyntheticDefaultImports": true
|
|
17
|
+
}
|
|
18
|
+
}
|