extension-create 4.0.16 → 4.0.17
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
CHANGED
|
@@ -4,8 +4,6 @@ export declare function noProjectName(): string;
|
|
|
4
4
|
export declare function noUrlAllowed(): string;
|
|
5
5
|
export declare function successfullInstall(projectPath: string, projectName: string, depsInstalled: boolean): Promise<string>;
|
|
6
6
|
export declare function startingNewExtension(projectName: string): string;
|
|
7
|
-
export declare function checkingIfPathIsWriteable(): string;
|
|
8
|
-
export declare function scanningPossiblyConflictingFiles(): string;
|
|
9
7
|
export declare function createDirectoryError(projectName: string, error: unknown): string;
|
|
10
8
|
export declare function writingTypeDefinitions(projectName: string): string;
|
|
11
9
|
export declare function writingTypeDefinitionsError(error: unknown): string;
|
|
@@ -33,6 +31,5 @@ export declare function writingManifestJsonMetadataError(projectName: string, er
|
|
|
33
31
|
export declare function writingReadmeMetaData(): string;
|
|
34
32
|
export declare function writingGitIgnore(): string;
|
|
35
33
|
export declare function writingReadmeMetaDataEError(projectName: string, error: unknown): string;
|
|
36
|
-
export declare function folderExists(projectName: string): string;
|
|
37
34
|
export declare function writingDirectoryError(error: unknown): string;
|
|
38
35
|
export declare function cantSetupBuiltInTests(projectName: string, error: unknown): string;
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
export type Channel = 'info' | 'success' | 'warn' | 'error' | 'debug';
|
|
2
|
+
export declare function isDebug(): boolean;
|
|
3
|
+
export declare function prefix(type: Channel): string;
|
|
4
|
+
export declare const fmt: {
|
|
5
|
+
heading: (title: string) => string;
|
|
6
|
+
label: (key: string) => string;
|
|
7
|
+
val: (value: string) => string;
|
|
8
|
+
code: (value: string) => string;
|
|
9
|
+
bullet: (value: string) => string;
|
|
10
|
+
block(title: string, rows: Array<[string, string]>): string;
|
|
11
|
+
truncate(input: unknown, max?: number): string;
|
|
12
|
+
};
|
|
13
|
+
export interface CardRow {
|
|
14
|
+
label: string;
|
|
15
|
+
value?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface CardInput {
|
|
18
|
+
version?: string;
|
|
19
|
+
suffix?: string;
|
|
20
|
+
rows?: CardRow[];
|
|
21
|
+
}
|
|
22
|
+
export declare function card(input?: CardInput): string;
|
|
23
|
+
export declare function isCardKeyClaimed(key: string): boolean;
|
|
24
|
+
export declare function claimCardKey(key: string): boolean;
|
|
25
|
+
export declare function artifactNoun(browser: string): 'Add-on' | 'Extension';
|
|
26
|
+
export declare const ENVELOPE_SCHEMA = 1;
|
|
27
|
+
export declare const CODES: {
|
|
28
|
+
readonly E_ARGS: 'E_ARGS';
|
|
29
|
+
readonly E_PROJECT_NOT_FOUND: 'E_PROJECT_NOT_FOUND';
|
|
30
|
+
readonly E_MANIFEST_NOT_FOUND: 'E_MANIFEST_NOT_FOUND';
|
|
31
|
+
readonly E_MANIFEST_INVALID: 'E_MANIFEST_INVALID';
|
|
32
|
+
readonly E_FIRST_COMPILE: 'E_FIRST_COMPILE';
|
|
33
|
+
readonly E_COMPILE: 'E_COMPILE';
|
|
34
|
+
readonly E_BROWSER_NOT_FOUND: 'E_BROWSER_NOT_FOUND';
|
|
35
|
+
readonly E_BROWSER_LAUNCH: 'E_BROWSER_LAUNCH';
|
|
36
|
+
readonly E_PROFILE_LOCKED: 'E_PROFILE_LOCKED';
|
|
37
|
+
readonly E_READY_TIMEOUT: 'E_READY_TIMEOUT';
|
|
38
|
+
readonly E_SESSION_EXISTS: 'E_SESSION_EXISTS';
|
|
39
|
+
readonly E_CONTROL_DENIED: 'E_CONTROL_DENIED';
|
|
40
|
+
readonly E_CONTROL_UNAVAILABLE: 'E_CONTROL_UNAVAILABLE';
|
|
41
|
+
readonly E_TOKEN_MISSING: 'E_TOKEN_MISSING';
|
|
42
|
+
readonly E_NETWORK: 'E_NETWORK';
|
|
43
|
+
readonly E_INTERRUPTED: 'E_INTERRUPTED';
|
|
44
|
+
readonly E_NOT_IMPLEMENTED: 'E_NOT_IMPLEMENTED';
|
|
45
|
+
readonly E_INTERNAL: 'E_INTERNAL';
|
|
46
|
+
readonly E_UNSUPPORTED_BROWSER: 'E_UNSUPPORTED_BROWSER';
|
|
47
|
+
readonly E_INVALID_OPTION: 'E_INVALID_OPTION';
|
|
48
|
+
readonly E_PORT_UNAVAILABLE: 'E_PORT_UNAVAILABLE';
|
|
49
|
+
readonly E_DEPENDENCY_INSTALL: 'E_DEPENDENCY_INSTALL';
|
|
50
|
+
readonly E_TEMPLATE_NOT_FOUND: 'E_TEMPLATE_NOT_FOUND';
|
|
51
|
+
readonly E_DESTINATION_NOT_EMPTY: 'E_DESTINATION_NOT_EMPTY';
|
|
52
|
+
readonly E_DESTINATION_NOT_WRITABLE: 'E_DESTINATION_NOT_WRITABLE';
|
|
53
|
+
readonly E_BROWSER_DOWNLOAD: 'E_BROWSER_DOWNLOAD';
|
|
54
|
+
readonly E_SESSION_NOT_FOUND: 'E_SESSION_NOT_FOUND';
|
|
55
|
+
readonly E_EVAL_REFUSED: 'E_EVAL_REFUSED';
|
|
56
|
+
readonly E_TARGET_NOT_FOUND: 'E_TARGET_NOT_FOUND';
|
|
57
|
+
readonly E_TIMEOUT: 'E_TIMEOUT';
|
|
58
|
+
readonly E_PUBLISH_REJECTED: 'E_PUBLISH_REJECTED';
|
|
59
|
+
readonly E_AUTH_REQUIRED: 'E_AUTH_REQUIRED';
|
|
60
|
+
readonly E_SAFARI_TOOLCHAIN: 'E_SAFARI_TOOLCHAIN';
|
|
61
|
+
readonly E_EVAL: 'E_EVAL';
|
|
62
|
+
readonly E_INSPECT: 'E_INSPECT';
|
|
63
|
+
readonly E_STORAGE: 'E_STORAGE';
|
|
64
|
+
readonly E_LOGS_NOT_FOUND: 'E_LOGS_NOT_FOUND';
|
|
65
|
+
readonly E_READY_ERROR_STATUS: 'E_READY_ERROR_STATUS';
|
|
66
|
+
readonly E_COMMAND_UNSUPPORTED_FOR_TARGET: 'E_COMMAND_UNSUPPORTED_FOR_TARGET';
|
|
67
|
+
readonly E_FLAG_VALUE_INVALID: 'E_FLAG_VALUE_INVALID';
|
|
68
|
+
readonly E_FLAG_NOT_SUPPORTED_HERE: 'E_FLAG_NOT_SUPPORTED_HERE';
|
|
69
|
+
readonly E_DEV_SERVER_START: 'E_DEV_SERVER_START';
|
|
70
|
+
readonly E_DOCTOR_CHECKS_FAILED: 'E_DOCTOR_CHECKS_FAILED';
|
|
71
|
+
readonly E_TELEMETRY_WRITE: 'E_TELEMETRY_WRITE';
|
|
72
|
+
readonly E_PREVIEW_NO_DIST: 'E_PREVIEW_NO_DIST';
|
|
73
|
+
readonly E_BROWSER_UNINSTALL: 'E_BROWSER_UNINSTALL';
|
|
74
|
+
readonly E_NODE_VERSION: 'E_NODE_VERSION';
|
|
75
|
+
readonly E_UNKNOWN_COMMAND: 'E_UNKNOWN_COMMAND';
|
|
76
|
+
readonly E_REMOVED_FLAG: 'E_REMOVED_FLAG';
|
|
77
|
+
readonly E_BROWSER_NOT_INSTALLABLE: 'E_BROWSER_NOT_INSTALLABLE';
|
|
78
|
+
readonly E_PARENT_GONE: 'E_PARENT_GONE';
|
|
79
|
+
readonly E_REMOTE_URL_UNSUPPORTED: 'E_REMOTE_URL_UNSUPPORTED';
|
|
80
|
+
readonly E_CONFIG_LOAD: 'E_CONFIG_LOAD';
|
|
81
|
+
readonly E_MANAGED_DEP_CONFLICT: 'E_MANAGED_DEP_CONFLICT';
|
|
82
|
+
readonly E_TYPES_EMIT: 'E_TYPES_EMIT';
|
|
83
|
+
readonly E_TSCONFIG_MISSING: 'E_TSCONFIG_MISSING';
|
|
84
|
+
readonly E_OPTIONAL_DEP_UNRESOLVED: 'E_OPTIONAL_DEP_UNRESOLVED';
|
|
85
|
+
readonly E_OPTIONAL_DEP_LOAD: 'E_OPTIONAL_DEP_LOAD';
|
|
86
|
+
readonly E_OPTIONAL_DEP_UNKNOWN: 'E_OPTIONAL_DEP_UNKNOWN';
|
|
87
|
+
readonly E_COMPANION_EXTENSION_PATH: 'E_COMPANION_EXTENSION_PATH';
|
|
88
|
+
readonly E_MANIFEST_IN_PUBLIC: 'E_MANIFEST_IN_PUBLIC';
|
|
89
|
+
readonly E_RUNTIME_NOT_FOUND: 'E_RUNTIME_NOT_FOUND';
|
|
90
|
+
readonly E_MANIFEST_SHAPE: 'E_MANIFEST_SHAPE';
|
|
91
|
+
readonly E_MANIFEST_PAGE_MISSING: 'E_MANIFEST_PAGE_MISSING';
|
|
92
|
+
readonly E_MANIFEST_VERSION_UNSUPPORTED: 'E_MANIFEST_VERSION_UNSUPPORTED';
|
|
93
|
+
readonly E_MANIFEST_LOAD_BLOCKERS: 'E_MANIFEST_LOAD_BLOCKERS';
|
|
94
|
+
readonly E_MANIFEST_PERMISSION_MISSING: 'E_MANIFEST_PERMISSION_MISSING';
|
|
95
|
+
readonly E_MANIFEST_MSG_KEY_MISSING: 'E_MANIFEST_MSG_KEY_MISSING';
|
|
96
|
+
readonly E_MANIFEST_EMIT: 'E_MANIFEST_EMIT';
|
|
97
|
+
readonly E_RESTART_REQUIRED: 'E_RESTART_REQUIRED';
|
|
98
|
+
readonly E_COMPILE_FATAL: 'E_COMPILE_FATAL';
|
|
99
|
+
readonly E_MODULE_NOT_FOUND: 'E_MODULE_NOT_FOUND';
|
|
100
|
+
readonly E_ENTRY_NOT_FOUND: 'E_ENTRY_NOT_FOUND';
|
|
101
|
+
readonly E_ASSET_MISSING: 'E_ASSET_MISSING';
|
|
102
|
+
readonly E_SCRIPT_DEP_MISSING: 'E_SCRIPT_DEP_MISSING';
|
|
103
|
+
readonly E_RESERVED_FOLDER: 'E_RESERVED_FOLDER';
|
|
104
|
+
readonly E_CSS_PARSE: 'E_CSS_PARSE';
|
|
105
|
+
readonly E_CSS_PREPROCESSOR_MISSING: 'E_CSS_PREPROCESSOR_MISSING';
|
|
106
|
+
readonly E_CSS_DEAD_REF: 'E_CSS_DEAD_REF';
|
|
107
|
+
readonly E_INTEGRATION_INSTALL: 'E_INTEGRATION_INSTALL';
|
|
108
|
+
readonly E_POLYFILL_NOT_FOUND: 'E_POLYFILL_NOT_FOUND';
|
|
109
|
+
readonly E_LOCALES_LAYOUT: 'E_LOCALES_LAYOUT';
|
|
110
|
+
readonly E_WAR_INVALID: 'E_WAR_INVALID';
|
|
111
|
+
readonly E_MATCH_PATTERN_INVALID: 'E_MATCH_PATTERN_INVALID';
|
|
112
|
+
readonly E_BACKGROUND_REQUIRED: 'E_BACKGROUND_REQUIRED';
|
|
113
|
+
readonly E_CONTENT_SCRIPT_SYNTAX: 'E_CONTENT_SCRIPT_SYNTAX';
|
|
114
|
+
readonly E_NO_ENTRYPOINTS: 'E_NO_ENTRYPOINTS';
|
|
115
|
+
readonly E_REMOTE_RESOURCE_BLOCKED: 'E_REMOTE_RESOURCE_BLOCKED';
|
|
116
|
+
readonly E_PERF_BUDGET: 'E_PERF_BUDGET';
|
|
117
|
+
readonly E_ZIP_SKIPPED: 'E_ZIP_SKIPPED';
|
|
118
|
+
readonly E_ENV_NO_MATCH: 'E_ENV_NO_MATCH';
|
|
119
|
+
readonly E_REMOTE_FETCH_TIMEOUT: 'E_REMOTE_FETCH_TIMEOUT';
|
|
120
|
+
readonly E_REMOTE_DOWNLOAD: 'E_REMOTE_DOWNLOAD';
|
|
121
|
+
readonly E_REMOTE_ZIP_INVALID: 'E_REMOTE_ZIP_INVALID';
|
|
122
|
+
readonly E_LOCAL_ZIP_NOT_FOUND: 'E_LOCAL_ZIP_NOT_FOUND';
|
|
123
|
+
readonly E_PROJECT_DOWNLOAD_EMPTY: 'E_PROJECT_DOWNLOAD_EMPTY';
|
|
124
|
+
readonly E_BROWSER_BINARY_REQUIRED: 'E_BROWSER_BINARY_REQUIRED';
|
|
125
|
+
readonly E_BROWSER_BINARY_INVALID: 'E_BROWSER_BINARY_INVALID';
|
|
126
|
+
readonly E_BROWSER_EXITED: 'E_BROWSER_EXITED';
|
|
127
|
+
readonly E_BROWSER_START_TIMEOUT: 'E_BROWSER_START_TIMEOUT';
|
|
128
|
+
readonly E_LAUNCH_SKIPPED_COMPILE_ERRORS: 'E_LAUNCH_SKIPPED_COMPILE_ERRORS';
|
|
129
|
+
readonly E_INSTANCE_AMBIGUOUS: 'E_INSTANCE_AMBIGUOUS';
|
|
130
|
+
readonly E_WSL_INTEROP: 'E_WSL_INTEROP';
|
|
131
|
+
readonly E_EXTENSION_LOAD_REFUSED: 'E_EXTENSION_LOAD_REFUSED';
|
|
132
|
+
readonly E_ADDON_INSTALL: 'E_ADDON_INSTALL';
|
|
133
|
+
readonly E_BROWSER_CONNECT: 'E_BROWSER_CONNECT';
|
|
134
|
+
readonly E_BROWSER_CONNECTION_CLOSED: 'E_BROWSER_CONNECTION_CLOSED';
|
|
135
|
+
readonly E_CDP_NOT_CONNECTED: 'E_CDP_NOT_CONNECTED';
|
|
136
|
+
readonly E_CDP_TIMEOUT: 'E_CDP_TIMEOUT';
|
|
137
|
+
readonly E_CDP_OP_FAILED: 'E_CDP_OP_FAILED';
|
|
138
|
+
readonly E_EXTENSION_ID_UNKNOWN: 'E_EXTENSION_ID_UNKNOWN';
|
|
139
|
+
readonly E_RDP_PROTOCOL: 'E_RDP_PROTOCOL';
|
|
140
|
+
readonly E_DEV_SERVER_TIMEOUT: 'E_DEV_SERVER_TIMEOUT';
|
|
141
|
+
readonly E_PORT_IN_USE: 'E_PORT_IN_USE';
|
|
142
|
+
readonly E_SESSION_STOPPED: 'E_SESSION_STOPPED';
|
|
143
|
+
readonly E_LOGS_STREAM_GAP: 'E_LOGS_STREAM_GAP';
|
|
144
|
+
readonly E_CREATE_DIR: 'E_CREATE_DIR';
|
|
145
|
+
readonly E_CREATE_WRITE: 'E_CREATE_WRITE';
|
|
146
|
+
readonly E_CREATE_TESTS_SETUP: 'E_CREATE_TESTS_SETUP';
|
|
147
|
+
readonly E_GIT_SKIPPED: 'E_GIT_SKIPPED';
|
|
148
|
+
readonly E_BROWSER_INSTALL_PRIVILEGE: 'E_BROWSER_INSTALL_PRIVILEGE';
|
|
149
|
+
readonly E_UNINSTALL_NOOP: 'E_UNINSTALL_NOOP';
|
|
150
|
+
};
|
|
151
|
+
export type ErrorCode = (typeof CODES)[keyof typeof CODES];
|
|
152
|
+
export interface EnvelopeError {
|
|
153
|
+
code: ErrorCode;
|
|
154
|
+
message: string;
|
|
155
|
+
name?: string;
|
|
156
|
+
engine?: string;
|
|
157
|
+
hint?: string;
|
|
158
|
+
}
|
|
159
|
+
export interface Envelope<T = unknown> {
|
|
160
|
+
schema: typeof ENVELOPE_SCHEMA;
|
|
161
|
+
ok: boolean;
|
|
162
|
+
command: string;
|
|
163
|
+
status: string;
|
|
164
|
+
value: T | null;
|
|
165
|
+
error: EnvelopeError | null;
|
|
166
|
+
truncated?: boolean;
|
|
167
|
+
hint?: string;
|
|
168
|
+
warnings: string[];
|
|
169
|
+
}
|
|
170
|
+
export interface EnvelopeExtras {
|
|
171
|
+
hint?: string;
|
|
172
|
+
warnings?: string[];
|
|
173
|
+
truncated?: boolean;
|
|
174
|
+
value?: unknown;
|
|
175
|
+
}
|
|
176
|
+
export declare const ENVELOPE: {
|
|
177
|
+
schema: number;
|
|
178
|
+
ok<T>(command: string, status: string, value: T, extras?: EnvelopeExtras): Envelope<T>;
|
|
179
|
+
fail(command: string, status: string, error: EnvelopeError, extras?: EnvelopeExtras): Envelope;
|
|
180
|
+
};
|
package/dist/lib/utils.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare function copyDirectoryWithSymlinks(source: string, destination: string): Promise<void>;
|
|
2
2
|
export declare function moveDirectoryContents(source: string, destination: string): Promise<void>;
|
|
3
3
|
export declare function getInstallCommand(): Promise<import("prefers-yarn").PackageManagerName>;
|
|
4
|
-
export declare function isDirectoryWriteable(directory: string,
|
|
4
|
+
export declare function isDirectoryWriteable(directory: string, logger: {
|
|
5
5
|
log(...args: unknown[]): void;
|
|
6
6
|
error(...args: unknown[]): void;
|
|
7
7
|
}): Promise<boolean>;
|
package/dist/module.cjs
CHANGED
|
@@ -45,6 +45,71 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
45
45
|
const external_node_path_namespaceObject = require("node:path");
|
|
46
46
|
const external_pintor_namespaceObject = require("pintor");
|
|
47
47
|
var external_pintor_default = /*#__PURE__*/ __webpack_require__.n(external_pintor_namespaceObject);
|
|
48
|
+
const GLYPH = '⏵⏵⏵';
|
|
49
|
+
const DEBUG_GLYPH = '···';
|
|
50
|
+
const DEBUG_VALUES = new Set([
|
|
51
|
+
'1',
|
|
52
|
+
'true',
|
|
53
|
+
'yes',
|
|
54
|
+
'on',
|
|
55
|
+
'debug',
|
|
56
|
+
'dev',
|
|
57
|
+
'development'
|
|
58
|
+
]);
|
|
59
|
+
function isDebug() {
|
|
60
|
+
const raw = process.env.EXTENSION_DEBUG ?? process.env.EXTENSION_AUTHOR_MODE;
|
|
61
|
+
return DEBUG_VALUES.has(String(raw ?? '').trim().toLowerCase());
|
|
62
|
+
}
|
|
63
|
+
function prefix(type) {
|
|
64
|
+
if ('error' === type) return external_pintor_default().red(GLYPH);
|
|
65
|
+
if ('warn' === type) return external_pintor_default().brightYellow(GLYPH);
|
|
66
|
+
if ('success' === type) return external_pintor_default().green(GLYPH);
|
|
67
|
+
if ('debug' === type) return external_pintor_default().dim(external_pintor_default().gray(DEBUG_GLYPH));
|
|
68
|
+
return external_pintor_default().gray(GLYPH);
|
|
69
|
+
}
|
|
70
|
+
const fmt = {
|
|
71
|
+
heading: (title)=>external_pintor_default().underline(external_pintor_default().blue(title)),
|
|
72
|
+
label: (key)=>external_pintor_default().gray(key.toUpperCase()),
|
|
73
|
+
val: (value)=>external_pintor_default().underline(value),
|
|
74
|
+
code: (value)=>external_pintor_default().blue(value),
|
|
75
|
+
bullet: (value)=>`- ${value}`,
|
|
76
|
+
block (title, rows) {
|
|
77
|
+
const head = fmt.heading(title);
|
|
78
|
+
const body = rows.map(([key, value])=>`${fmt.label(key)} ${value}`).join('\n');
|
|
79
|
+
return `${head}\n${body}`;
|
|
80
|
+
},
|
|
81
|
+
truncate (input, max = 800) {
|
|
82
|
+
const s = (()=>{
|
|
83
|
+
try {
|
|
84
|
+
return 'string' == typeof input ? input : JSON.stringify(input);
|
|
85
|
+
} catch {
|
|
86
|
+
return String(input);
|
|
87
|
+
}
|
|
88
|
+
})();
|
|
89
|
+
return s.length > max ? `${s.slice(0, max)}…` : s;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
const CARD_LABEL_WIDTH = 15;
|
|
93
|
+
function card(input = {}) {
|
|
94
|
+
const version = String(input.version || '').trim();
|
|
95
|
+
const suffix = String(input.suffix || '').trim();
|
|
96
|
+
const head = ` 🧩 ${external_pintor_default().brightBlue('Extension.js')}` + (version ? ` ${external_pintor_default().gray(version)}` : '') + (suffix ? ` ${suffix}` : '');
|
|
97
|
+
const body = (input.rows || []).filter((row)=>String(row.value || '').trim().length > 0).map((row)=>{
|
|
98
|
+
const label = row.label.padEnd(CARD_LABEL_WIDTH);
|
|
99
|
+
return ` ${label}${external_pintor_default().gray(String(row.value).trim())}`;
|
|
100
|
+
});
|
|
101
|
+
return [
|
|
102
|
+
head,
|
|
103
|
+
...body
|
|
104
|
+
].join('\n');
|
|
105
|
+
}
|
|
106
|
+
new Set([
|
|
107
|
+
'firefox',
|
|
108
|
+
'firefox-based',
|
|
109
|
+
'gecko-based',
|
|
110
|
+
'librewolf',
|
|
111
|
+
'waterfox'
|
|
112
|
+
]);
|
|
48
113
|
const external_prefers_yarn_namespaceObject = require("prefers-yarn");
|
|
49
114
|
function isDenoRuntime() {
|
|
50
115
|
return void 0 !== globalThis.Deno || Boolean(process.versions?.deno);
|
|
@@ -53,23 +118,22 @@ function resolveScaffoldPackageManager() {
|
|
|
53
118
|
if (isDenoRuntime()) return 'deno';
|
|
54
119
|
return (0, external_prefers_yarn_namespaceObject.detectPackageManagerFromEnv)();
|
|
55
120
|
}
|
|
56
|
-
const statusPrefix = external_pintor_default().brightBlue('⏵⏵⏵');
|
|
57
121
|
function destinationNotWriteable(workingDir) {
|
|
58
122
|
const workingDirFolder = external_node_path_namespaceObject.basename(workingDir);
|
|
59
|
-
return `${
|
|
123
|
+
return `${prefix('error')} Couldn't write to the destination directory.\n${external_pintor_default().red('Choose a writable path, or update the folder permissions.')}\n${fmt.label('PATH')} ${fmt.val(workingDirFolder)}`;
|
|
60
124
|
}
|
|
61
125
|
async function directoryHasConflicts(projectPath, conflictingFiles) {
|
|
62
126
|
const projectName = external_node_path_namespaceObject.basename(projectPath);
|
|
63
|
-
let message =
|
|
127
|
+
let message = `${prefix('error')} ${external_pintor_default().blue(projectName)} already contains files that would be overwritten.\n${external_pintor_default().red('Remove or rename them, or choose a different directory name.')}\n\n`;
|
|
64
128
|
for (const file of conflictingFiles)message += ` ${external_pintor_default().yellow('-')} ${external_pintor_default().yellow(file)}\n`;
|
|
65
|
-
message += `\n${
|
|
129
|
+
message += `\n${fmt.label('PATH')} ${fmt.val(projectPath)}`;
|
|
66
130
|
return message;
|
|
67
131
|
}
|
|
68
132
|
function noProjectName() {
|
|
69
|
-
return `${
|
|
133
|
+
return `${prefix('error')} A project name is required.\n${external_pintor_default().red('Pass a name, for example')} ${external_pintor_default().blue('extension create my-extension')}.\n${external_pintor_default().red('Run')} ${external_pintor_default().blue('extension create --help')} ${external_pintor_default().red('for the full usage.')}`;
|
|
70
134
|
}
|
|
71
135
|
function noUrlAllowed() {
|
|
72
|
-
return `${
|
|
136
|
+
return `${prefix('error')} A URL is not a valid project path.\n${external_pintor_default().red('Pass a project name or a local directory path.')}`;
|
|
73
137
|
}
|
|
74
138
|
async function successfullInstall(projectPath, projectName, depsInstalled) {
|
|
75
139
|
const relativePath = external_node_path_namespaceObject.relative(process.cwd(), projectPath);
|
|
@@ -97,116 +161,107 @@ async function successfullInstall(projectPath, projectName, depsInstalled) {
|
|
|
97
161
|
command = 'npm run dev';
|
|
98
162
|
installCmd = 'npm install';
|
|
99
163
|
}
|
|
100
|
-
const
|
|
101
|
-
const
|
|
102
|
-
return `${
|
|
164
|
+
const runNote = ` ${external_pintor_default().gray('Run the extension in a fresh browser profile.')}\n`;
|
|
165
|
+
const steps = depsInstalled ? ` 1. ${external_pintor_default().blue('cd')} ${fmt.val(relativePath)}\n 2. ${external_pintor_default().blue(command)}\n` + runNote : ` 1. ${external_pintor_default().blue('cd')} ${fmt.val(relativePath)}\n 2. ${external_pintor_default().blue(installCmd)}\n 3. ${external_pintor_default().blue(command)}\n` + runNote;
|
|
166
|
+
return `${prefix('success')} ${external_pintor_default().blue(projectName)} is ready.\n\nNext steps:\n` + steps;
|
|
103
167
|
}
|
|
104
168
|
function startingNewExtension(projectName) {
|
|
105
|
-
return `${
|
|
106
|
-
}
|
|
107
|
-
function checkingIfPathIsWriteable() {
|
|
108
|
-
return `${statusPrefix} Checking if the destination path is writable...`;
|
|
109
|
-
}
|
|
110
|
-
function scanningPossiblyConflictingFiles() {
|
|
111
|
-
return `${statusPrefix} Scanning for conflicting files...`;
|
|
169
|
+
return `${prefix('info')} Create the extension ${external_pintor_default().blue(projectName)}.`;
|
|
112
170
|
}
|
|
113
171
|
function createDirectoryError(projectName, error) {
|
|
114
|
-
return `${
|
|
172
|
+
return `${prefix('error')} Couldn't create the directory ${external_pintor_default().blue(projectName)}.\n${external_pintor_default().red('Check the path and its permissions, then try again.')}\n${external_pintor_default().red(String(error))}`;
|
|
115
173
|
}
|
|
116
174
|
function writingTypeDefinitions(projectName) {
|
|
117
|
-
return `${
|
|
175
|
+
return `${prefix('debug')} create types name=${projectName}`;
|
|
118
176
|
}
|
|
119
177
|
function writingTypeDefinitionsError(error) {
|
|
120
|
-
return `${
|
|
178
|
+
return `${prefix('error')} Couldn't write the extension type definitions.\n${external_pintor_default().red('Check the file permissions, then try again.')}\n${external_pintor_default().red(String(error))}`;
|
|
121
179
|
}
|
|
122
180
|
function installingFromTemplate(projectName, templateName) {
|
|
123
|
-
if ('init' === templateName || "javascript" === templateName) return `${
|
|
124
|
-
return `${
|
|
181
|
+
if ('init' === templateName || "javascript" === templateName) return `${prefix('info')} Install ${external_pintor_default().blue(projectName)}.`;
|
|
182
|
+
return `${prefix('info')} Install ${external_pintor_default().blue(projectName)} from the template ${external_pintor_default().yellow(templateName)}.`;
|
|
125
183
|
}
|
|
126
184
|
function installingFromTemplateError(projectName, template, error) {
|
|
127
|
-
return `${
|
|
185
|
+
return `${prefix('error')} Couldn't find the template ${external_pintor_default().yellow(template)}.\n${external_pintor_default().red('Choose a template name from')} ${external_pintor_default().blue('extension create --help')}${external_pintor_default().red(', or pass a GitHub URL.')}\n${external_pintor_default().red(String(error))}`;
|
|
128
186
|
}
|
|
129
187
|
function templateFetchTimedOut(templateName, ms) {
|
|
130
|
-
return `${
|
|
188
|
+
return `${prefix('error')} Timed out after ${external_pintor_default().yellow(`${Math.round(ms / 1000)}s`)} fetching the template ${external_pintor_default().yellow(templateName)}.\n${external_pintor_default().red('Check your network connection.')}\n${external_pintor_default().red('Set EXTENSION_CREATE_TIMEOUT_MS to allow more time.')}`;
|
|
131
189
|
}
|
|
132
190
|
function templateNotFoundInCatalog(templateName, error) {
|
|
133
|
-
return `${
|
|
191
|
+
return `${prefix('error')} The template ${external_pintor_default().yellow(templateName)} is not in the extension-js/examples catalog.\n${external_pintor_default().red('Run')} ${external_pintor_default().blue('extension create --help')} ${external_pintor_default().red('to list the valid template names.')}\n${external_pintor_default().red('Or pass a GitHub URL to use a template from anywhere.')}` + (error ? `\n${external_pintor_default().red(String(error))}` : '');
|
|
134
192
|
}
|
|
135
193
|
function templateDownloadFailed(templateName, error) {
|
|
136
|
-
return `${
|
|
194
|
+
return `${prefix('error')} Couldn't download the template ${external_pintor_default().yellow(templateName)} from ${external_pintor_default().yellow('github.com/extension-js/examples')}.\n${external_pintor_default().red('Check your network connection and any GitHub rate limit, then try again.')}\n${external_pintor_default().red('Set EXTENSION_CREATE_TIMEOUT_MS to allow more time.')}\n${external_pintor_default().red(String(error?.message || error))}`;
|
|
137
195
|
}
|
|
138
196
|
function initializingGitForRepository(projectName) {
|
|
139
|
-
return `${
|
|
197
|
+
return `${prefix('debug')} create git init name=${projectName}`;
|
|
140
198
|
}
|
|
141
199
|
function initializingGitSkipped(projectName, reason) {
|
|
142
|
-
return `${
|
|
200
|
+
return `${prefix('warn')} Skip the git init for ${external_pintor_default().blue(projectName)}.\n${fmt.label('REASON')} ${external_pintor_default().yellow(reason)}\nRun ${external_pintor_default().yellow('git init')} yourself if you want version control.`;
|
|
143
201
|
}
|
|
144
202
|
function installingDependencies() {
|
|
145
|
-
return `${
|
|
203
|
+
return `${prefix('info')} Install the project dependencies.\n${external_pintor_default().gray('This can take a moment.')}`;
|
|
146
204
|
}
|
|
147
205
|
function foundSpecializedDependencies(count) {
|
|
148
|
-
return `${
|
|
206
|
+
return `${prefix('debug')} create integrations count=${count}`;
|
|
149
207
|
}
|
|
150
208
|
function installingProjectIntegrations(integrations) {
|
|
151
|
-
if (0 === integrations.length) return `${
|
|
209
|
+
if (0 === integrations.length) return `${prefix('info')} Install the dependencies for the ${external_pintor_default().gray('project tooling')}.\n${external_pintor_default().gray('This can take a moment.')}`;
|
|
152
210
|
const formatList = (items)=>{
|
|
153
211
|
if (1 === items.length) return items[0];
|
|
154
212
|
if (2 === items.length) return `${items[0]} and ${items[1]}`;
|
|
155
213
|
return `${items.slice(0, -1).join(', ')}, and ${items[items.length - 1]}`;
|
|
156
214
|
};
|
|
157
215
|
const tools = formatList(integrations.map((name)=>external_pintor_default().yellow(name)));
|
|
158
|
-
return `${
|
|
216
|
+
return `${prefix('info')} Install the dependencies for ${tools}.\n${external_pintor_default().gray('This can take a moment.')}`;
|
|
159
217
|
}
|
|
160
218
|
function installingDependenciesFailed(gitCommand, gitArgs, code) {
|
|
161
|
-
return `${
|
|
219
|
+
return `${prefix('error')} The command ${external_pintor_default().yellow(gitCommand)} ${external_pintor_default().yellow(gitArgs.join(' '))} failed with exit code ${external_pintor_default().yellow(String(code))}.\n${external_pintor_default().red('Run it yourself to see the full error.')}`;
|
|
162
220
|
}
|
|
163
221
|
function installingDependenciesProcessError(projectName, error) {
|
|
164
|
-
return `${
|
|
222
|
+
return `${prefix('error')} The install process for ${external_pintor_default().blue(projectName)} exited unexpectedly.\n${external_pintor_default().red('Run the install command yourself to see the full error.')}\n${external_pintor_default().red(String(error))}`;
|
|
165
223
|
}
|
|
166
224
|
function cantInstallDependencies(projectName, error) {
|
|
167
|
-
return `${
|
|
225
|
+
return `${prefix('error')} Couldn't install the dependencies for ${external_pintor_default().blue(projectName)}.\n${external_pintor_default().red('Check your package manager settings, then try again.')}\n${external_pintor_default().red(String(error?.message || error))}`;
|
|
168
226
|
}
|
|
169
227
|
function writingPackageJsonMetadata() {
|
|
170
|
-
return `${
|
|
228
|
+
return `${prefix('debug')} create write file=package.json`;
|
|
171
229
|
}
|
|
172
230
|
function writingPackageJsonMetadataError(projectName, error) {
|
|
173
|
-
return `${
|
|
231
|
+
return `${prefix('error')} Couldn't write ${external_pintor_default().yellow('package.json')}.\n${external_pintor_default().red('Check the file permissions, then try again.')}\n${external_pintor_default().red(String(error))}`;
|
|
174
232
|
}
|
|
175
233
|
function writingDenoJsonc() {
|
|
176
|
-
return `${
|
|
234
|
+
return `${prefix('debug')} create write file=deno.jsonc`;
|
|
177
235
|
}
|
|
178
236
|
function writingDenoJsoncError(projectName, error) {
|
|
179
|
-
return `${
|
|
237
|
+
return `${prefix('error')} Couldn't write ${external_pintor_default().yellow('deno.jsonc')}.\n${external_pintor_default().red('Check the file permissions, then try again.')}\n${external_pintor_default().red(String(error))}`;
|
|
180
238
|
}
|
|
181
239
|
function writingTemplateProvenance() {
|
|
182
|
-
return `${
|
|
240
|
+
return `${prefix('debug')} create write file=.extension-create.json`;
|
|
183
241
|
}
|
|
184
242
|
function writingTemplateProvenanceError(error) {
|
|
185
|
-
return `${
|
|
243
|
+
return `${prefix('warn')} Couldn't write ${external_pintor_default().yellow('.extension-create.json')}.\nThe project is fine; only the template provenance record is missing.\n${external_pintor_default().yellow(String(error))}`;
|
|
186
244
|
}
|
|
187
245
|
function writingManifestJsonMetadata() {
|
|
188
|
-
return `${
|
|
246
|
+
return `${prefix('debug')} create write file=manifest.json`;
|
|
189
247
|
}
|
|
190
248
|
function writingManifestJsonMetadataError(projectName, error) {
|
|
191
|
-
return `${
|
|
249
|
+
return `${prefix('error')} Couldn't write ${external_pintor_default().yellow('manifest.json')}.\n${external_pintor_default().red('Check the file permissions, then try again.')}\n${external_pintor_default().red(String(error))}`;
|
|
192
250
|
}
|
|
193
251
|
function writingReadmeMetaData() {
|
|
194
|
-
return `${
|
|
252
|
+
return `${prefix('debug')} create write file=README.md`;
|
|
195
253
|
}
|
|
196
254
|
function writingGitIgnore() {
|
|
197
|
-
return `${
|
|
255
|
+
return `${prefix('debug')} create write file=.gitignore`;
|
|
198
256
|
}
|
|
199
257
|
function writingReadmeMetaDataEError(projectName, error) {
|
|
200
|
-
return `${
|
|
201
|
-
}
|
|
202
|
-
function folderExists(projectName) {
|
|
203
|
-
return `${statusPrefix} Ensuring ${external_pintor_default().blue(projectName)} exists...`;
|
|
258
|
+
return `${prefix('error')} Couldn't write ${external_pintor_default().yellow('README.md')}.\n${external_pintor_default().red('Check the file permissions, then try again.')}\n${external_pintor_default().red(String(error))}`;
|
|
204
259
|
}
|
|
205
260
|
function writingDirectoryError(error) {
|
|
206
|
-
return `${
|
|
261
|
+
return `${prefix('error')} Couldn't check whether the directory is writable.\n${external_pintor_default().red('Check the path and its permissions, then try again.')}\n${external_pintor_default().red(String(error))}`;
|
|
207
262
|
}
|
|
208
263
|
function cantSetupBuiltInTests(projectName, error) {
|
|
209
|
-
return `${
|
|
264
|
+
return `${prefix('error')} Couldn't set up the built-in tests.\n${external_pintor_default().red('The extension itself is fine. Re-run create, or skip the tests.')}\n${external_pintor_default().red(String(error))}`;
|
|
210
265
|
}
|
|
211
266
|
const promises_namespaceObject = require("node:fs/promises");
|
|
212
267
|
async function copyDirectoryWithSymlinks(source, destination) {
|
|
@@ -278,15 +333,14 @@ async function moveDirectoryContents(source, destination) {
|
|
|
278
333
|
async function getInstallCommand() {
|
|
279
334
|
return (0, external_prefers_yarn_namespaceObject.detectPackageManagerFromEnv)();
|
|
280
335
|
}
|
|
281
|
-
async function isDirectoryWriteable(directory,
|
|
336
|
+
async function isDirectoryWriteable(directory, logger) {
|
|
282
337
|
try {
|
|
283
|
-
logger.log(folderExists(projectName));
|
|
284
338
|
await promises_namespaceObject.mkdir(directory, {
|
|
285
339
|
recursive: true
|
|
286
340
|
});
|
|
287
341
|
return true;
|
|
288
342
|
} catch (err) {
|
|
289
|
-
logger.
|
|
343
|
+
logger.error(writingDirectoryError(err));
|
|
290
344
|
return false;
|
|
291
345
|
}
|
|
292
346
|
}
|
|
@@ -300,14 +354,12 @@ const allowlist = [
|
|
|
300
354
|
async function createDirectory(projectPath, projectName, logger) {
|
|
301
355
|
logger.log(startingNewExtension(projectName));
|
|
302
356
|
try {
|
|
303
|
-
const isCurrentDirWriteable = await isDirectoryWriteable(projectPath,
|
|
304
|
-
logger.log(checkingIfPathIsWriteable());
|
|
357
|
+
const isCurrentDirWriteable = await isDirectoryWriteable(projectPath, logger);
|
|
305
358
|
if (!isCurrentDirWriteable) {
|
|
306
359
|
logger.error(destinationNotWriteable(projectPath));
|
|
307
360
|
throw new Error(destinationNotWriteable(projectPath));
|
|
308
361
|
}
|
|
309
362
|
const currentDir = await promises_namespaceObject.readdir(projectPath);
|
|
310
|
-
logger.log(scanningPossiblyConflictingFiles());
|
|
311
363
|
const conflictingFiles = await Promise.all(currentDir.filter((file)=>!file.startsWith('.')).filter((file)=>!file.endsWith('.log')).filter((file)=>!allowlist.includes(file)).map(async (file)=>{
|
|
312
364
|
const stats = await promises_namespaceObject.lstat(external_node_path_namespaceObject.join(projectPath, file));
|
|
313
365
|
return stats.isDirectory() ? `${file}/` : `${file}`;
|
|
@@ -338,7 +390,7 @@ async function generateExtensionTypes(projectPath, projectName, logger) {
|
|
|
338
390
|
await promises_namespaceObject.mkdir(projectPath, {
|
|
339
391
|
recursive: true
|
|
340
392
|
});
|
|
341
|
-
logger.log(writingTypeDefinitions(projectName));
|
|
393
|
+
if (isDebug()) logger.log(writingTypeDefinitions(projectName));
|
|
342
394
|
await promises_namespaceObject.writeFile(extensionEnvFile, fileContent);
|
|
343
395
|
} catch (error) {
|
|
344
396
|
logger.error(writingTypeDefinitionsError(error));
|
|
@@ -465,7 +517,7 @@ async function importFromExamplesCatalog(templateName, projectPath) {
|
|
|
465
517
|
};
|
|
466
518
|
}
|
|
467
519
|
function isAuthorOrDevMode() {
|
|
468
|
-
return 'development' === process.env.EXTENSION_ENV ||
|
|
520
|
+
return 'development' === process.env.EXTENSION_ENV || isDebug();
|
|
469
521
|
}
|
|
470
522
|
async function withTimeout(task, ms, onTimeout) {
|
|
471
523
|
let timer;
|
|
@@ -637,7 +689,7 @@ async function initializeGitRepository(projectPath, projectName, logger) {
|
|
|
637
689
|
'init',
|
|
638
690
|
'--quiet'
|
|
639
691
|
];
|
|
640
|
-
logger.log(initializingGitForRepository(projectName));
|
|
692
|
+
if (isDebug()) logger.log(initializingGitForRepository(projectName));
|
|
641
693
|
const stdio = 'development' === process.env.EXTENSION_ENV ? 'inherit' : 'ignore';
|
|
642
694
|
const child = (0, external_cross_spawn_namespaceObject.spawn)(gitCommand, gitArgs, {
|
|
643
695
|
stdio,
|
|
@@ -1088,13 +1140,14 @@ async function installOptionalDependencies(developRoot, projectPath, plan, logge
|
|
|
1088
1140
|
if (0 === plan.dependencies.length) return;
|
|
1089
1141
|
const pm = (0, external_prefers_yarn_namespaceObject.detectPackageManagerFromEnv)();
|
|
1090
1142
|
const stdio = 'development' === process.env.EXTENSION_ENV ? 'inherit' : 'ignore';
|
|
1091
|
-
logger.log(foundSpecializedDependencies(plan.integrations.length));
|
|
1143
|
+
if (isDebug()) logger.log(foundSpecializedDependencies(plan.integrations.length));
|
|
1144
|
+
const infoPrefix = prefix('info');
|
|
1092
1145
|
for (const [index, integration] of plan.integrations.entries()){
|
|
1093
1146
|
const missingDeps = plan.dependenciesByIntegration[integration] || [];
|
|
1094
1147
|
const baseMessage = installingProjectIntegrations([
|
|
1095
1148
|
integration
|
|
1096
1149
|
]);
|
|
1097
|
-
const installMessage = baseMessage.replace(
|
|
1150
|
+
const installMessage = baseMessage.replace(infoPrefix, `${infoPrefix} [${index + 1}/${plan.integrations.length}]`);
|
|
1098
1151
|
logger.log(installMessage);
|
|
1099
1152
|
if (0 === missingDeps.length) continue;
|
|
1100
1153
|
const args = buildOptionalInstallArgs(pm, missingDeps, developRoot);
|
|
@@ -1263,7 +1316,7 @@ async function overridePackageJson(projectPath, projectName, { template = "javas
|
|
|
1263
1316
|
}
|
|
1264
1317
|
};
|
|
1265
1318
|
try {
|
|
1266
|
-
logger.log(writingPackageJsonMetadata());
|
|
1319
|
+
if (isDebug()) logger.log(writingPackageJsonMetadata());
|
|
1267
1320
|
await promises_namespaceObject.writeFile(external_node_path_namespaceObject.join(projectPath, 'package.json'), `${JSON.stringify(packageMetadata, null, 2)}\n`);
|
|
1268
1321
|
} catch (error) {
|
|
1269
1322
|
logger.error(writingPackageJsonMetadataError(projectName, error));
|
|
@@ -1320,7 +1373,7 @@ async function writeDenoJsonc(projectPath, projectName, { template = "javascript
|
|
|
1320
1373
|
const tasks = getTemplateAwareScripts(template, extensionBinary);
|
|
1321
1374
|
const imports = primary ? await collectTemplateImports(projectPath, cliVersion) : void 0;
|
|
1322
1375
|
try {
|
|
1323
|
-
logger.log(writingDenoJsonc());
|
|
1376
|
+
if (isDebug()) logger.log(writingDenoJsonc());
|
|
1324
1377
|
await promises_namespaceObject.writeFile(external_node_path_namespaceObject.join(projectPath, 'deno.jsonc'), renderDenoJsonc(tasks, imports));
|
|
1325
1378
|
if (primary) await promises_namespaceObject.rm(external_node_path_namespaceObject.join(projectPath, 'package.json'), {
|
|
1326
1379
|
force: true
|
|
@@ -1396,7 +1449,7 @@ async function writeGitignore(projectPath, logger) {
|
|
|
1396
1449
|
const linesToAdd = globalLines.filter((line)=>!paths.has(line));
|
|
1397
1450
|
while('' === linesToAdd[linesToAdd.length - 1])linesToAdd.pop();
|
|
1398
1451
|
if (0 === linesToAdd.length) return;
|
|
1399
|
-
logger.log(writingGitIgnore());
|
|
1452
|
+
if (isDebug()) logger.log(writingGitIgnore());
|
|
1400
1453
|
const shouldPrefixWithNewline = currentContents.length > 0 && !currentContents.endsWith('\n');
|
|
1401
1454
|
const contentToAppend = `${shouldPrefixWithNewline ? '\n' : ''}${linesToAdd.join('\n')}`;
|
|
1402
1455
|
await promises_namespaceObject.appendFile(gitIgnorePath, contentToAppend).catch((err)=>{
|
|
@@ -1457,7 +1510,7 @@ async function writeManifestJson(projectPath, projectName, logger) {
|
|
|
1457
1510
|
author: 'Your Name'
|
|
1458
1511
|
};
|
|
1459
1512
|
try {
|
|
1460
|
-
logger.log(writingManifestJsonMetadata());
|
|
1513
|
+
if (isDebug()) logger.log(writingManifestJsonMetadata());
|
|
1461
1514
|
await promises_namespaceObject.writeFile(manifestJsonPath, JSON.stringify(manifestMetadata, null, 2));
|
|
1462
1515
|
} catch (error) {
|
|
1463
1516
|
logger.error(writingManifestJsonMetadataError(projectName, error));
|
|
@@ -1486,7 +1539,7 @@ async function writeReadmeFile(projectPath, projectName, logger) {
|
|
|
1486
1539
|
const blockquote = description ? `> ${description}\n\n` : '';
|
|
1487
1540
|
const readme = `<a href="https://extension.js.org" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/badge/Powered%20by%20%7C%20Extension.js-0971fe" alt="Powered by Extension.js" align="right" /></a>\n\n# ${projectName}\n\n` + blockquote + `${screenshotEmbed}` + `## Commands\n` + `\n` + `### dev\n` + `\n` + "Run the extension in development mode. Target a browser with `--browser`:\n" + `\n` + "```bash\n" + `${runPrefix} dev\n` + `${runPrefix} dev${argSeparator} --browser=firefox\n` + `${runPrefix} dev${argSeparator} --browser=edge\n` + "```\n" + `\n` + `### build\n` + `\n` + `Build for production. Convenience scripts target each browser:\n` + `\n` + "```bash\n" + `${runPrefix} build # Chrome (default)\n` + `${runPrefix} build:firefox\n` + `${runPrefix} build:edge\n` + "```\n" + `\n` + `### preview\n` + `\n` + `Preview the production build in the browser:\n` + `\n` + "```bash\n" + `${runPrefix} preview\n` + "```\n" + `\n` + `## Learn more\n` + `\n` + `[Extension.js docs](https://extension.js.org).\n`;
|
|
1488
1541
|
try {
|
|
1489
|
-
logger.log(writingReadmeMetaData());
|
|
1542
|
+
if (isDebug()) logger.log(writingReadmeMetaData());
|
|
1490
1543
|
await promises_namespaceObject.mkdir(projectPath, {
|
|
1491
1544
|
recursive: true
|
|
1492
1545
|
});
|
|
@@ -1521,7 +1574,7 @@ async function writeTemplateProvenance(projectPath, provenance, logger) {
|
|
|
1521
1574
|
if (!provenance?.template) return;
|
|
1522
1575
|
const record = buildProvenanceRecord(provenance);
|
|
1523
1576
|
try {
|
|
1524
|
-
logger.log(writingTemplateProvenance());
|
|
1577
|
+
if (isDebug()) logger.log(writingTemplateProvenance());
|
|
1525
1578
|
await promises_namespaceObject.writeFile(external_node_path_namespaceObject.join(projectPath, TEMPLATE_PROVENANCE_FILE), `${JSON.stringify(record, null, 2)}\n`);
|
|
1526
1579
|
} catch (error) {
|
|
1527
1580
|
logger.error(writingTemplateProvenanceError(error));
|
|
@@ -1532,6 +1585,25 @@ async function extensionCreate(projectNameInput, { cliVersion, template = "javas
|
|
|
1532
1585
|
if (projectNameInput.startsWith('http')) throw new Error(noUrlAllowed());
|
|
1533
1586
|
const projectPath = external_node_path_namespaceObject.isAbsolute(projectNameInput) ? projectNameInput : external_node_path_namespaceObject.join(process.cwd(), projectNameInput);
|
|
1534
1587
|
const projectName = external_node_path_namespaceObject.basename(projectPath);
|
|
1588
|
+
const updateSuffix = process.env.EXTENSION_CLI_UPDATE_SUFFIX || '';
|
|
1589
|
+
if (updateSuffix) delete process.env.EXTENSION_CLI_UPDATE_SUFFIX;
|
|
1590
|
+
logger.log(' ');
|
|
1591
|
+
logger.log(card({
|
|
1592
|
+
version: cliVersion || process.env.EXTENSION_CLI_VERSION,
|
|
1593
|
+
suffix: updateSuffix,
|
|
1594
|
+
rows: [
|
|
1595
|
+
{
|
|
1596
|
+
label: 'Extension',
|
|
1597
|
+
value: projectName
|
|
1598
|
+
},
|
|
1599
|
+
{
|
|
1600
|
+
label: 'Output',
|
|
1601
|
+
value: projectPath
|
|
1602
|
+
}
|
|
1603
|
+
]
|
|
1604
|
+
}));
|
|
1605
|
+
logger.log(' ');
|
|
1606
|
+
process.env.EXTENSION_CLI_BANNER_PRINTED = 'true';
|
|
1535
1607
|
await createDirectory(projectPath, projectName, logger);
|
|
1536
1608
|
const templateProvenance = await importExternalTemplate(projectPath, projectName, template, logger);
|
|
1537
1609
|
const isMonorepoTemplate = String(template).toLowerCase().includes('monorepo');
|