extension-create 3.1.0-next.7 → 3.1.0-next.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/dist/lib/messages.d.ts +1 -1
- package/dist/module.js +20 -4
- package/package.json +1 -1
package/dist/lib/messages.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export declare function destinationNotWriteable(workingDir: string): string;
|
|
|
2
2
|
export declare function directoryHasConflicts(projectPath: string, conflictingFiles: string[]): Promise<string>;
|
|
3
3
|
export declare function noProjectName(): string;
|
|
4
4
|
export declare function noUrlAllowed(): string;
|
|
5
|
-
export declare function successfullInstall(projectPath: string, projectName: string): Promise<string>;
|
|
5
|
+
export declare function successfullInstall(projectPath: string, projectName: string, depsInstalled: boolean): Promise<string>;
|
|
6
6
|
export declare function startingNewExtension(projectName: string): string;
|
|
7
7
|
export declare function checkingIfPathIsWriteable(): string;
|
|
8
8
|
export declare function scanningPossiblyConflictingFiles(): string;
|
package/dist/module.js
CHANGED
|
@@ -63,7 +63,7 @@ function noProjectName() {
|
|
|
63
63
|
function noUrlAllowed() {
|
|
64
64
|
return `${external_pintor_default().red('Error')} URLs are not allowed as a project path.\nNext step: provide a project name or a local directory path.`;
|
|
65
65
|
}
|
|
66
|
-
async function successfullInstall(projectPath, projectName) {
|
|
66
|
+
async function successfullInstall(projectPath, projectName, depsInstalled) {
|
|
67
67
|
const relativePath = external_path_namespaceObject.relative(process.cwd(), projectPath);
|
|
68
68
|
const pm = await (0, external_package_manager_detector_namespaceObject.detect)();
|
|
69
69
|
let command = 'npm run';
|
|
@@ -87,7 +87,8 @@ async function successfullInstall(projectPath, projectName) {
|
|
|
87
87
|
installCmd = 'pnpm install';
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
|
|
90
|
+
const steps = depsInstalled ? ` 1. ${external_pintor_default().blue('cd')} ${external_pintor_default().underline(relativePath)}\n 2. ${external_pintor_default().blue(command)} (runs a fresh browser profile with your extension loaded)\n` : ` 1. ${external_pintor_default().blue('cd')} ${external_pintor_default().underline(relativePath)}\n 2. ${external_pintor_default().blue(installCmd)}\n 3. ${external_pintor_default().blue(command)} (runs a fresh browser profile with your extension loaded)\n`;
|
|
91
|
+
return `${external_pintor_default().green('Created')} ${external_pintor_default().blue(projectName)}\n\nNext steps:\n\n` + steps;
|
|
91
92
|
}
|
|
92
93
|
function startingNewExtension(projectName) {
|
|
93
94
|
return `Creating ${external_pintor_default().blue(projectName)}...`;
|
|
@@ -305,7 +306,22 @@ async function importExternalTemplate(projectPath, projectName, template) {
|
|
|
305
306
|
});
|
|
306
307
|
if ('development' === process.env.EXTENSION_ENV) {
|
|
307
308
|
console.log(installingFromTemplate(projectName, template));
|
|
308
|
-
|
|
309
|
+
async function findTemplatesRoot(startDir) {
|
|
310
|
+
let current = startDir;
|
|
311
|
+
const maxDepth = 6;
|
|
312
|
+
for(let i = 0; i < maxDepth; i++){
|
|
313
|
+
const candidate = external_path_namespaceObject.join(current, 'templates');
|
|
314
|
+
try {
|
|
315
|
+
const stats = await promises_namespaceObject.stat(candidate);
|
|
316
|
+
if (stats.isDirectory()) return candidate;
|
|
317
|
+
} catch {}
|
|
318
|
+
const parent = external_path_namespaceObject.dirname(current);
|
|
319
|
+
if (parent === current) break;
|
|
320
|
+
current = parent;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
const localTemplatesRoot = await findTemplatesRoot(import_external_template_dirname);
|
|
324
|
+
if (!localTemplatesRoot) throw new Error('Local templates directory not found');
|
|
309
325
|
const localTemplateName = 'init' === templateName ? "javascript" : templateName;
|
|
310
326
|
const localTemplatePath = external_path_namespaceObject.join(localTemplatesRoot, localTemplateName);
|
|
311
327
|
await copyDirectoryWithSymlinks(localTemplatePath, projectPath);
|
|
@@ -744,7 +760,7 @@ async function extensionCreate(projectNameInput, { cliVersion, template = 'init'
|
|
|
744
760
|
await writeGitignore(projectPath);
|
|
745
761
|
await setupBuiltInTests(projectPath, projectName);
|
|
746
762
|
if (isTypeScriptTemplate(template)) await generateExtensionTypes(projectPath, projectName);
|
|
747
|
-
const successfulInstall = await successfullInstall(projectPath, projectName);
|
|
763
|
+
const successfulInstall = await successfullInstall(projectPath, projectName, Boolean(install));
|
|
748
764
|
console.log(successfulInstall);
|
|
749
765
|
} catch (error) {
|
|
750
766
|
console.error(error);
|