@quilted/create 0.1.29 → 0.1.31
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/CHANGELOG.md +12 -0
- package/build/cjs/app.cjs +233 -39
- package/build/cjs/index.cjs +315 -413
- package/build/cjs/package.cjs +36 -36
- package/build/cjs/shared/package-manager.cjs +677 -0
- package/build/esm/app.mjs +207 -13
- package/build/esm/index.mjs +314 -389
- package/build/esm/package.mjs +37 -37
- package/build/esm/parser-babel.mjs +1 -1
- package/build/esm/parser-typescript.mjs +1 -1
- package/build/esm/parser-yaml.mjs +1 -1
- package/build/esm/shared/package-manager.mjs +635 -0
- package/build/esm/standalone.mjs +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/typescript/app.d.ts.map +1 -1
- package/build/typescript/help.d.ts.map +1 -1
- package/build/typescript/package.d.ts.map +1 -1
- package/build/typescript/shared/prompts.d.ts +3 -4
- package/build/typescript/shared/prompts.d.ts.map +1 -1
- package/build/typescript/shared.d.ts +1 -1
- package/build/typescript/shared.d.ts.map +1 -1
- package/package.json +2 -2
- package/source/app.ts +12 -11
- package/source/create.ts +2 -5
- package/source/help.ts +1 -2
- package/source/package.ts +36 -38
- package/source/shared/prompts.ts +13 -44
- package/source/shared.ts +1 -2
- package/tsconfig.json +6 -1
- package/build/cjs/package-manager.cjs +0 -330
- package/build/esm/package-manager.mjs +0 -299
package/build/cjs/package.cjs
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
var fs = require('node:fs');
|
|
4
4
|
var path = require('node:path');
|
|
5
|
-
var node_child_process = require('node:child_process');
|
|
6
5
|
var index = require('./index.cjs');
|
|
7
|
-
var packageManager = require('./package-manager.cjs');
|
|
6
|
+
var packageManager = require('./shared/package-manager.cjs');
|
|
8
7
|
require('node:tty');
|
|
9
8
|
require('node:url');
|
|
10
9
|
require('node:readline');
|
|
11
10
|
require('node:events');
|
|
11
|
+
require('node:child_process');
|
|
12
12
|
|
|
13
13
|
function _interopNamespace(e) {
|
|
14
14
|
if (e && e.__esModule) return e;
|
|
@@ -37,10 +37,10 @@ let _ = t => t,
|
|
|
37
37
|
_t3,
|
|
38
38
|
_t4;
|
|
39
39
|
async function createProject() {
|
|
40
|
-
const
|
|
40
|
+
const args = getArguments();
|
|
41
41
|
|
|
42
|
-
if (
|
|
43
|
-
var
|
|
42
|
+
if (args['--help']) {
|
|
43
|
+
var _args$PackageManag;
|
|
44
44
|
|
|
45
45
|
const additionalOptions = index.stripIndent(_t || (_t = _`
|
|
46
46
|
${0}, ${0}
|
|
@@ -58,23 +58,25 @@ async function createProject() {
|
|
|
58
58
|
index.printHelp({
|
|
59
59
|
kind: 'package',
|
|
60
60
|
options: additionalOptions,
|
|
61
|
-
packageManager: (
|
|
61
|
+
packageManager: (_args$PackageManag = args['--package-manager']) === null || _args$PackageManag === void 0 ? void 0 : _args$PackageManag.toLowerCase()
|
|
62
62
|
});
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
const inWorkspace = fs__namespace.existsSync('quilt.workspace.ts');
|
|
67
|
-
const name = await getName(
|
|
68
|
-
const directory = await getDirectory(
|
|
67
|
+
const name = await getName(args);
|
|
68
|
+
const directory = await getDirectory(args, {
|
|
69
69
|
name,
|
|
70
70
|
inWorkspace
|
|
71
71
|
});
|
|
72
|
-
const isPublic = await getPublic(
|
|
73
|
-
const useReact = await getReact(
|
|
74
|
-
const createAsMonorepo = !inWorkspace && (await
|
|
75
|
-
const shouldInstall = await
|
|
76
|
-
const packageManager$1 = await
|
|
77
|
-
|
|
72
|
+
const isPublic = await getPublic(args);
|
|
73
|
+
const useReact = await getReact(args);
|
|
74
|
+
const createAsMonorepo = !inWorkspace && (await packageManager.getCreateAsMonorepo(args));
|
|
75
|
+
const shouldInstall = await packageManager.getShouldInstall(args);
|
|
76
|
+
const packageManager$1 = await packageManager.getPackageManager(args, {
|
|
77
|
+
root: directory
|
|
78
|
+
});
|
|
79
|
+
const setupExtras = await packageManager.getExtrasToSetup(args, {
|
|
78
80
|
inWorkspace
|
|
79
81
|
});
|
|
80
82
|
const partOfMonorepo = inWorkspace || createAsMonorepo;
|
|
@@ -114,7 +116,7 @@ async function createProject() {
|
|
|
114
116
|
const workspacePackageJson = JSON.parse(await workspaceTemplate.read('package.json'));
|
|
115
117
|
workspacePackageJson.name = packageManager.toValidPackageName(name);
|
|
116
118
|
|
|
117
|
-
if (packageManager$1 === 'pnpm') {
|
|
119
|
+
if (packageManager$1.type === 'pnpm') {
|
|
118
120
|
await outputRoot.write('pnpm-workspace.yaml', await packageManager.format(`
|
|
119
121
|
packages:
|
|
120
122
|
- './packages/*'
|
|
@@ -151,7 +153,7 @@ async function createProject() {
|
|
|
151
153
|
name: packageManager.toValidPackageName(name),
|
|
152
154
|
react: useReact,
|
|
153
155
|
isPublic,
|
|
154
|
-
registry:
|
|
156
|
+
registry: args['--registry']
|
|
155
157
|
});
|
|
156
158
|
quiltProject = quiltProject.replace('quiltPackage', 'quiltWorkspace, quiltPackage').replace('quiltPackage(', 'quiltWorkspace(), quiltPackage(');
|
|
157
159
|
await outputRoot.write('quilt.project.ts', await packageManager.format(quiltProject, {
|
|
@@ -192,21 +194,19 @@ async function createProject() {
|
|
|
192
194
|
name: packageManager.toValidPackageName(name),
|
|
193
195
|
react: useReact,
|
|
194
196
|
isPublic,
|
|
195
|
-
registry:
|
|
197
|
+
registry: args['--registry']
|
|
196
198
|
});
|
|
197
199
|
await outputRoot.write(path__namespace.join(packageDirectory, 'package.json'), await packageManager.format(JSON.stringify(projectPackageJson), {
|
|
198
200
|
as: 'json-stringify'
|
|
199
201
|
}));
|
|
200
202
|
await outputRoot.write(path__namespace.join(packageDirectory, 'quilt.project.ts'), quiltProject);
|
|
201
|
-
await Promise.all([packageManager.addToTsConfig(packageDirectory, outputRoot), packageManager.addToPackageManagerWorkspaces(packageDirectory, outputRoot, packageManager$1)]);
|
|
203
|
+
await Promise.all([packageManager.addToTsConfig(packageDirectory, outputRoot), packageManager.addToPackageManagerWorkspaces(packageDirectory, outputRoot, packageManager$1.type)]);
|
|
202
204
|
}
|
|
203
205
|
|
|
204
206
|
if (shouldInstall) {
|
|
205
207
|
process.stdout.write('\nInstalling dependencies...\n'); // TODO: better loading, handle errors
|
|
206
208
|
|
|
207
|
-
|
|
208
|
-
cwd: rootDirectory
|
|
209
|
-
});
|
|
209
|
+
await packageManager$1.install();
|
|
210
210
|
process.stdout.moveCursor(0, -1);
|
|
211
211
|
process.stdout.clearLine(1);
|
|
212
212
|
console.log('Installed dependencies.');
|
|
@@ -231,7 +231,7 @@ async function createProject() {
|
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
if (!shouldInstall) {
|
|
234
|
-
commands.push(
|
|
234
|
+
commands.push(`${packageManager$1.commands.install()} ${index.dim_1('# Install all your dependencies')}`);
|
|
235
235
|
}
|
|
236
236
|
|
|
237
237
|
if (!inWorkspace) {
|
|
@@ -261,8 +261,8 @@ async function createProject() {
|
|
|
261
261
|
console.log(followUp);
|
|
262
262
|
} // Argument handling
|
|
263
263
|
|
|
264
|
-
function
|
|
265
|
-
const
|
|
264
|
+
function getArguments() {
|
|
265
|
+
const args = index.parseArguments({
|
|
266
266
|
'--yes': Boolean,
|
|
267
267
|
'-y': '--yes',
|
|
268
268
|
'--name': String,
|
|
@@ -284,13 +284,13 @@ function getArgv() {
|
|
|
284
284
|
}, {
|
|
285
285
|
permissive: true
|
|
286
286
|
});
|
|
287
|
-
return
|
|
287
|
+
return args;
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
-
async function getName(
|
|
290
|
+
async function getName(args) {
|
|
291
291
|
let {
|
|
292
292
|
'--name': name
|
|
293
|
-
} =
|
|
293
|
+
} = args;
|
|
294
294
|
|
|
295
295
|
if (name == null) {
|
|
296
296
|
name = await index.prompt({
|
|
@@ -303,11 +303,11 @@ async function getName(argv) {
|
|
|
303
303
|
return name;
|
|
304
304
|
}
|
|
305
305
|
|
|
306
|
-
async function getDirectory(
|
|
306
|
+
async function getDirectory(args, {
|
|
307
307
|
name,
|
|
308
308
|
inWorkspace
|
|
309
309
|
}) {
|
|
310
|
-
let directory =
|
|
310
|
+
let directory = args['--directory'] ? path__namespace.resolve(args['--directory']) : undefined;
|
|
311
311
|
|
|
312
312
|
if (directory == null) {
|
|
313
313
|
const basePackageName = packageManager.toValidPackageName(name.split('/').pop());
|
|
@@ -319,7 +319,7 @@ async function getDirectory(argv, {
|
|
|
319
319
|
}));
|
|
320
320
|
}
|
|
321
321
|
|
|
322
|
-
while (!
|
|
322
|
+
while (!args['--yes']) {
|
|
323
323
|
if (fs__namespace.existsSync(directory) && !(await packageManager.isEmpty(directory))) {
|
|
324
324
|
const relativeDirectory = path__namespace.relative(process.cwd(), directory);
|
|
325
325
|
const empty = await index.prompt({
|
|
@@ -341,12 +341,12 @@ async function getDirectory(argv, {
|
|
|
341
341
|
return directory;
|
|
342
342
|
}
|
|
343
343
|
|
|
344
|
-
async function getPublic(
|
|
344
|
+
async function getPublic(args) {
|
|
345
345
|
let isPublic;
|
|
346
346
|
|
|
347
|
-
if (
|
|
347
|
+
if (args['--public'] || args['--yes']) {
|
|
348
348
|
isPublic = true;
|
|
349
|
-
} else if (
|
|
349
|
+
} else if (args['--private']) {
|
|
350
350
|
isPublic = false;
|
|
351
351
|
} else {
|
|
352
352
|
isPublic = await index.prompt({
|
|
@@ -359,12 +359,12 @@ async function getPublic(argv) {
|
|
|
359
359
|
return isPublic;
|
|
360
360
|
}
|
|
361
361
|
|
|
362
|
-
async function getReact(
|
|
362
|
+
async function getReact(args) {
|
|
363
363
|
let useReact;
|
|
364
364
|
|
|
365
|
-
if (
|
|
365
|
+
if (args['--react'] || args['--yes']) {
|
|
366
366
|
useReact = true;
|
|
367
|
-
} else if (
|
|
367
|
+
} else if (args['--no-react']) {
|
|
368
368
|
useReact = false;
|
|
369
369
|
} else {
|
|
370
370
|
useReact = await index.prompt({
|