create-adonisjs 3.2.1 → 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,24 +89,32 @@ 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.
|
|
87
93
|
* - For non-pnpm package managers: removes pnpm-workspace.yaml
|
|
94
|
+
* - For non-yarn package managers: removes .yarnrc.yml
|
|
88
95
|
* - For non-monorepo starter kits: no further changes are needed
|
|
89
96
|
* - For pnpm monorepos: removes the workspaces field from package.json
|
|
90
97
|
* since pnpm uses pnpm-workspace.yaml for workspace configuration
|
|
91
98
|
* - For monorepos: sets the packageManager field in package.json to the
|
|
92
|
-
*
|
|
99
|
+
* selected package manager, using detected version when available
|
|
93
100
|
*/
|
|
94
101
|
async #adaptForPackageManager() {
|
|
95
102
|
const pkgJsonPath = join(this.destination, "package.json");
|
|
96
103
|
const pkgJson = await readFile(pkgJsonPath, "utf-8").then(JSON.parse);
|
|
97
104
|
const pnpmWorkspacePath = join(this.destination, "pnpm-workspace.yaml");
|
|
105
|
+
const yarnFilePath = join(this.destination, ".yarnrc.yml");
|
|
98
106
|
if (this.packageManager !== "pnpm") {
|
|
99
107
|
try {
|
|
100
108
|
await unlink(pnpmWorkspacePath);
|
|
101
109
|
} catch {
|
|
102
110
|
}
|
|
103
111
|
}
|
|
112
|
+
if (this.packageManager !== "yarn") {
|
|
113
|
+
try {
|
|
114
|
+
await unlink(yarnFilePath);
|
|
115
|
+
} catch {
|
|
116
|
+
}
|
|
117
|
+
}
|
|
104
118
|
if (!this.isMonorepo) {
|
|
105
119
|
return;
|
|
106
120
|
}
|
|
@@ -110,10 +124,9 @@ var CreateNewApp = class extends BaseCommand {
|
|
|
110
124
|
dirty = true;
|
|
111
125
|
}
|
|
112
126
|
const detectedPackageManager = detectPackageManager();
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
127
|
+
const detectedVersion = detectedPackageManager?.name === this.packageManager ? detectedPackageManager.version : void 0;
|
|
128
|
+
pkgJson.packageManager = detectedVersion ? `${this.packageManager}@${detectedVersion}` : this.packageManager;
|
|
129
|
+
dirty = true;
|
|
117
130
|
if (dirty) {
|
|
118
131
|
await writeFile(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
|
|
119
132
|
}
|
package/build/index.js
CHANGED