create-zephyr-apps 0.0.7 → 0.0.8
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/.github/workflows/pull_request.yml +56 -0
- package/.vscode/settings.json +75 -0
- package/biome.json +37 -0
- package/dist/index.cjs +132 -107
- package/dist/index.mjs +130 -105
- package/dist/package/utils/constants.d.ts +1 -1
- package/dist/package/utils/end.d.ts +1 -1
- package/package/index.ts +176 -112
- package/package/utils/constants.ts +64 -58
- package/package/utils/end.ts +14 -27
- package/package/utils/types.ts +1 -1
- package/package.json +33 -20
- package/rslib.config.ts +36 -37
- package/tsconfig.json +1 -2
|
@@ -6,63 +6,69 @@ const BASE_REPO = `${REPO_OWNER}/${REPO_NAME}`;
|
|
|
6
6
|
|
|
7
7
|
const REPACK_REPO_PATH = `${REPO_OWNER}/${REPACK_REPO}`;
|
|
8
8
|
|
|
9
|
-
|
|
10
9
|
const TEMPLATES = {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
10
|
+
'rspack-project': {
|
|
11
|
+
label: 'React + Rspack',
|
|
12
|
+
hint: 'A simple application build by Rspack.',
|
|
13
|
+
framework: 'react',
|
|
14
|
+
},
|
|
15
|
+
'react-vite-ts': {
|
|
16
|
+
label: 'A simple React application build by Vite',
|
|
17
|
+
hint: 'You will be building React app powered by Vite.',
|
|
18
|
+
framework: 'react',
|
|
19
|
+
},
|
|
20
|
+
'react-vite-mf': {
|
|
21
|
+
label: 'React + Vite + Webpack + Rspack',
|
|
22
|
+
hint: 'You will be building federated React apps powered by Vite, Webpack and Rspack.',
|
|
23
|
+
framework: 'react',
|
|
24
|
+
},
|
|
25
|
+
'angular-vite': {
|
|
26
|
+
label: 'Angular app with Vite',
|
|
27
|
+
hint: 'You will be building an Angular app powered by Vite.',
|
|
28
|
+
framework: 'angular',
|
|
29
|
+
},
|
|
30
|
+
'react-webpack-mf': {
|
|
31
|
+
label: 'React + Webpack',
|
|
32
|
+
hint: 'A React application with Module Federation, using Webpack as the bundler.',
|
|
33
|
+
framework: 'react',
|
|
34
|
+
},
|
|
35
|
+
'nx-rspack-mf': {
|
|
36
|
+
label: 'React + Nx + Rspack',
|
|
37
|
+
hint: 'A React application with Module Federation, using Nx as Monorepo manager and Rspack as the bundler.',
|
|
38
|
+
framework: 'react',
|
|
39
|
+
},
|
|
40
|
+
'nx-webpack-mf': {
|
|
41
|
+
label: 'React + Nx + Webpack',
|
|
42
|
+
hint: 'React applications with Module Federation, using Nx as Monorepo manager and Webpack as the bundler.',
|
|
43
|
+
framework: 'react',
|
|
44
|
+
},
|
|
45
|
+
'ng-nx': {
|
|
46
|
+
label: 'Angular app with Nx',
|
|
47
|
+
hint: 'An Angular application with Nx as Monorepo manager.',
|
|
48
|
+
framework: 'angular',
|
|
49
|
+
},
|
|
50
|
+
'qwik-1.5': {
|
|
51
|
+
label: 'Qwik + Vite',
|
|
52
|
+
hint: 'A Qwik v1.5 app using Vite as the bundler.',
|
|
53
|
+
framework: 'qwik',
|
|
54
|
+
},
|
|
55
|
+
'react-rspack-tractor-2.0': {
|
|
56
|
+
label: 'React + Rspack + Tractor 2.0',
|
|
57
|
+
hint: 'A React application using Rspack as the bundler and Tractor 2.0 as the module federation manager.',
|
|
58
|
+
framework: 'react',
|
|
59
|
+
},
|
|
60
|
+
'turbo-rspack-mf': {
|
|
61
|
+
label: 'Turbo + Rspack + Module Federation',
|
|
62
|
+
hint: 'A monorepo using Turborepo, React, and Rspack as the bundler.',
|
|
63
|
+
framework: 'react',
|
|
64
|
+
},
|
|
65
|
+
};
|
|
67
66
|
|
|
68
|
-
export {
|
|
67
|
+
export {
|
|
68
|
+
REPO_OWNER,
|
|
69
|
+
REPO_NAME,
|
|
70
|
+
REPACK_REPO,
|
|
71
|
+
BASE_REPO,
|
|
72
|
+
REPACK_REPO_PATH,
|
|
73
|
+
TEMPLATES,
|
|
74
|
+
};
|
package/package/utils/end.ts
CHANGED
|
@@ -1,41 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import c from 'chalk';
|
|
3
|
-
import { exec } from 'child_process';
|
|
1
|
+
import { exec } from 'node:child_process';
|
|
4
2
|
import { note } from '@clack/prompts';
|
|
3
|
+
import c from 'chalk';
|
|
4
|
+
import type { CLIOptions } from './types';
|
|
5
5
|
|
|
6
6
|
export default function end_note({ project }: { project: CLIOptions }) {
|
|
7
7
|
try {
|
|
8
|
-
exec(
|
|
8
|
+
exec('git config user.name', (err, stdout, stderr) => {
|
|
9
9
|
const user_name = stdout.toString().trim();
|
|
10
|
-
|
|
11
10
|
const repo_name = project.path.split('/').pop();
|
|
12
11
|
|
|
13
|
-
let next_steps;
|
|
12
|
+
let next_steps: string[];
|
|
14
13
|
|
|
15
14
|
if (project.type === 'web') {
|
|
16
|
-
next_steps = [
|
|
17
|
-
`cd ${repo_name}`,
|
|
18
|
-
`pnpm install`,
|
|
19
|
-
`rm -rf .git`,
|
|
20
|
-
`git init`,
|
|
21
|
-
`git remote add origin https://github.com/${user_name.length >= 1 ? user_name : 'YourUsername'}/${repo_name}.git`,
|
|
22
|
-
`git add .`,
|
|
23
|
-
`git commit -m "Initial commit"`,
|
|
24
|
-
`pnpm run build`,
|
|
25
|
-
];
|
|
15
|
+
next_steps = [`cd ${repo_name}`, 'pnpm install', 'pnpm run build'];
|
|
26
16
|
} else {
|
|
27
17
|
next_steps = [
|
|
28
18
|
`cd ${repo_name}`,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
`Make your first commit and link it to the remote repository!`,
|
|
38
|
-
`Read more about how Module Federation works with Zephyr and why steps above are required: ${c.underline(c.cyan('https://docs.zephyr-cloud.io/how-to/mf-guide'))}`,
|
|
19
|
+
'pnpm install',
|
|
20
|
+
c.magenta(
|
|
21
|
+
`git remote add origin https://github.com/${user_name.length >= 1 ? user_name : 'YourUsername'}/${repo_name}.git`,
|
|
22
|
+
),
|
|
23
|
+
'ZC=1 pnpm run start',
|
|
24
|
+
'\n--------------------------------\n',
|
|
25
|
+
'Make sure to commit and add a remote to the remote repository!',
|
|
26
|
+
`Read more about how Module Federation works with Zephyr: ${c.underline(c.cyan('https://docs.zephyr-cloud.io/how-to/mf-guide'))}`,
|
|
39
27
|
];
|
|
40
28
|
}
|
|
41
29
|
|
|
@@ -53,4 +41,3 @@ export default function end_note({ project }: { project: CLIOptions }) {
|
|
|
53
41
|
note(Object.values(end_notes).join('\n'), 'Problems?');
|
|
54
42
|
}
|
|
55
43
|
}
|
|
56
|
-
|
package/package/utils/types.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-zephyr-apps",
|
|
3
3
|
"module": "./src/index.ts",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.8",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"build": "rslib build",
|
|
8
|
-
"dev": "tsx package/index.ts"
|
|
9
|
-
},
|
|
10
6
|
"author": {
|
|
11
7
|
"name": "ZephyrCloudIO",
|
|
12
8
|
"url": "https://github.com/ZephyrCloudIO"
|
|
@@ -14,6 +10,33 @@
|
|
|
14
10
|
"bin": {
|
|
15
11
|
"create-zephyr-apps": "dist/index.mjs"
|
|
16
12
|
},
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=18"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"zephyr",
|
|
18
|
+
"create-zephyr-apps",
|
|
19
|
+
"zephyr-apps",
|
|
20
|
+
"zephyr-cli",
|
|
21
|
+
"zephyr-example",
|
|
22
|
+
"zephyr-template",
|
|
23
|
+
"example",
|
|
24
|
+
"template"
|
|
25
|
+
],
|
|
26
|
+
"lint-staged": {
|
|
27
|
+
"*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}": [
|
|
28
|
+
"biome check --files-ignore-unknown=true"
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
"simple-git-hooks": {
|
|
32
|
+
"pre-commit": "npx lint-staged"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "rslib build",
|
|
36
|
+
"dev": "tsx package/index.ts",
|
|
37
|
+
"lint": "biome check",
|
|
38
|
+
"fix": "biome format && biome check --fix --unsafe"
|
|
39
|
+
},
|
|
17
40
|
"dependencies": {
|
|
18
41
|
"@clack/core": "^0.4.1",
|
|
19
42
|
"@clack/prompts": "^0.9.1",
|
|
@@ -22,6 +45,9 @@
|
|
|
22
45
|
"tempy": "^3.1.0"
|
|
23
46
|
},
|
|
24
47
|
"devDependencies": {
|
|
48
|
+
"lint-staged": "^15.4.3",
|
|
49
|
+
"simple-git-hooks": "^2.11.1",
|
|
50
|
+
"@biomejs/biome": "1.9.4",
|
|
25
51
|
"@rslib/core": "^0.3.2",
|
|
26
52
|
"@types/degit": "^2.8.6",
|
|
27
53
|
"@types/node": "^22.10.7",
|
|
@@ -32,18 +58,5 @@
|
|
|
32
58
|
"peerDependencies": {
|
|
33
59
|
"typescript": "^5.0.0"
|
|
34
60
|
},
|
|
35
|
-
"packageManager": "pnpm@9.15.0"
|
|
36
|
-
|
|
37
|
-
"node": ">=18"
|
|
38
|
-
},
|
|
39
|
-
"keywords": [
|
|
40
|
-
"zephyr",
|
|
41
|
-
"create-zephyr-apps",
|
|
42
|
-
"zephyr-apps",
|
|
43
|
-
"zephyr-cli",
|
|
44
|
-
"zephyr-example",
|
|
45
|
-
"zephyr-template",
|
|
46
|
-
"example",
|
|
47
|
-
"template"
|
|
48
|
-
]
|
|
49
|
-
}
|
|
61
|
+
"packageManager": "pnpm@9.15.0"
|
|
62
|
+
}
|
package/rslib.config.ts
CHANGED
|
@@ -1,42 +1,41 @@
|
|
|
1
1
|
import { defineConfig } from '@rslib/core';
|
|
2
2
|
|
|
3
3
|
export default defineConfig({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
4
|
+
source: {
|
|
5
|
+
entry: {
|
|
6
|
+
index: './package/index.ts',
|
|
8
7
|
},
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
cleanDistPath: true,
|
|
23
|
-
},
|
|
8
|
+
},
|
|
9
|
+
lib: [
|
|
10
|
+
{
|
|
11
|
+
format: 'cjs',
|
|
12
|
+
autoExtension: false,
|
|
13
|
+
syntax: 'es2020',
|
|
14
|
+
dts: {
|
|
15
|
+
build: true,
|
|
16
|
+
},
|
|
17
|
+
output: {
|
|
18
|
+
target: 'node',
|
|
19
|
+
filename: {
|
|
20
|
+
js: '[name].cjs',
|
|
24
21
|
},
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
22
|
+
cleanDistPath: true,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
format: 'esm',
|
|
27
|
+
autoExtension: false,
|
|
28
|
+
syntax: 'es2020',
|
|
29
|
+
dts: {
|
|
30
|
+
build: true,
|
|
31
|
+
},
|
|
32
|
+
output: {
|
|
33
|
+
target: 'node',
|
|
34
|
+
filename: {
|
|
35
|
+
js: '[name].mjs',
|
|
36
|
+
},
|
|
37
|
+
cleanDistPath: true,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
});
|
package/tsconfig.json
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
"module": "ES2020",
|
|
7
7
|
"moduleDetection": "force",
|
|
8
8
|
|
|
9
|
-
//"jsx": "react-jsx",
|
|
10
9
|
"allowJs": true,
|
|
11
10
|
|
|
12
11
|
// Bundler mode
|
|
@@ -24,7 +23,7 @@
|
|
|
24
23
|
// Some stricter flags (disabled by default)
|
|
25
24
|
"noUnusedLocals": false,
|
|
26
25
|
"noUnusedParameters": false,
|
|
27
|
-
"noPropertyAccessFromIndexSignature": false,
|
|
26
|
+
"noPropertyAccessFromIndexSignature": false,
|
|
28
27
|
"outDir": "./dist",
|
|
29
28
|
"types": ["node"]
|
|
30
29
|
}
|