create-adonisjs 3.2.0 → 3.3.0
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/build/bin/run.js
CHANGED
|
@@ -28,26 +28,32 @@ var templates = [
|
|
|
28
28
|
{
|
|
29
29
|
name: "Hypermedia app",
|
|
30
30
|
alias: "hypermedia",
|
|
31
|
-
hint: "A
|
|
31
|
+
hint: "A full-stack app using server-side templates",
|
|
32
32
|
source: "github:adonisjs/starter-kits/hypermedia"
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
name: "React app (using Inertia)",
|
|
36
36
|
alias: "react",
|
|
37
|
-
hint: "A
|
|
37
|
+
hint: "A full-stack React app with end-to-end type safety",
|
|
38
38
|
source: "github:adonisjs/starter-kits/inertia-react"
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
41
|
name: "Vue app (using Inertia)",
|
|
42
42
|
alias: "vue",
|
|
43
|
-
hint: "A
|
|
43
|
+
hint: "A full-stack Vue app with end-to-end type safety",
|
|
44
44
|
source: "github:adonisjs/starter-kits/inertia-vue"
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
|
-
name: "API
|
|
47
|
+
name: "API",
|
|
48
48
|
alias: "api",
|
|
49
|
-
hint: "
|
|
49
|
+
hint: "A type-safe REST API with session and access token auth",
|
|
50
50
|
source: "github:adonisjs/starter-kits/api"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "API (monorepo)",
|
|
54
|
+
alias: "api-monorepo",
|
|
55
|
+
hint: "A monorepo setup with a type-safe REST API",
|
|
56
|
+
source: "github:adonisjs/starter-kits/api-monorepo"
|
|
51
57
|
}
|
|
52
58
|
];
|
|
53
59
|
|
|
@@ -83,29 +89,47 @@ var CreateNewApp = class extends BaseCommand {
|
|
|
83
89
|
}
|
|
84
90
|
}
|
|
85
91
|
/**
|
|
86
|
-
* Adapts the downloaded starter kit for the
|
|
92
|
+
* Adapts the downloaded starter kit for the selected package manager.
|
|
93
|
+
* - For non-pnpm package managers: removes pnpm-workspace.yaml
|
|
94
|
+
* - For non-yarn package managers: removes .yarnrc.yml
|
|
95
|
+
* - For non-monorepo starter kits: no further changes are needed
|
|
87
96
|
* - For pnpm monorepos: removes the workspaces field from package.json
|
|
88
|
-
*
|
|
89
|
-
* -
|
|
97
|
+
* since pnpm uses pnpm-workspace.yaml for workspace configuration
|
|
98
|
+
* - For monorepos: sets the packageManager field in package.json to the
|
|
99
|
+
* selected package manager, using detected version when available
|
|
90
100
|
*/
|
|
91
101
|
async #adaptForPackageManager() {
|
|
92
102
|
const pkgJsonPath = join(this.destination, "package.json");
|
|
93
103
|
const pkgJson = await readFile(pkgJsonPath, "utf-8").then(JSON.parse);
|
|
94
104
|
const pnpmWorkspacePath = join(this.destination, "pnpm-workspace.yaml");
|
|
95
|
-
|
|
96
|
-
if (this.packageManager
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
105
|
+
const yarnFilePath = join(this.destination, ".yarnrc.yml");
|
|
106
|
+
if (this.packageManager !== "pnpm") {
|
|
107
|
+
try {
|
|
108
|
+
await unlink(pnpmWorkspacePath);
|
|
109
|
+
} catch {
|
|
100
110
|
}
|
|
101
|
-
} else if (existsSync(pnpmWorkspacePath)) {
|
|
102
|
-
await unlink(pnpmWorkspacePath);
|
|
103
111
|
}
|
|
104
|
-
if (
|
|
105
|
-
|
|
112
|
+
if (this.packageManager !== "yarn") {
|
|
113
|
+
try {
|
|
114
|
+
await unlink(yarnFilePath);
|
|
115
|
+
} catch {
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (!this.isMonorepo) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
let dirty = false;
|
|
122
|
+
if (this.packageManager === "pnpm") {
|
|
123
|
+
delete pkgJson.workspaces;
|
|
106
124
|
dirty = true;
|
|
107
125
|
}
|
|
108
|
-
|
|
126
|
+
const detectedPackageManager = detectPackageManager();
|
|
127
|
+
const detectedVersion = detectedPackageManager?.name === this.packageManager ? detectedPackageManager.version : void 0;
|
|
128
|
+
pkgJson.packageManager = detectedVersion ? `${this.packageManager}@${detectedVersion}` : this.packageManager;
|
|
129
|
+
dirty = true;
|
|
130
|
+
if (dirty) {
|
|
131
|
+
await writeFile(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
|
|
132
|
+
}
|
|
109
133
|
}
|
|
110
134
|
/**
|
|
111
135
|
* Executes a bash command using execa with shared default options.
|
package/build/index.js
CHANGED