extension-create 2.0.0-rc.36 → 2.0.0-rc.38
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/module.js +33 -33
- package/package.json +2 -2
package/dist/module.js
CHANGED
|
@@ -40,28 +40,28 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
40
40
|
});
|
|
41
41
|
const external_path_namespaceObject = require("path");
|
|
42
42
|
const external_fs_namespaceObject = require("fs");
|
|
43
|
-
const
|
|
44
|
-
var
|
|
43
|
+
const external_pintor_namespaceObject = require("pintor");
|
|
44
|
+
var external_pintor_default = /*#__PURE__*/ __webpack_require__.n(external_pintor_namespaceObject);
|
|
45
45
|
const external_package_manager_detector_namespaceObject = require("package-manager-detector");
|
|
46
46
|
function destinationNotWriteable(workingDir) {
|
|
47
47
|
const workingDirFolder = external_path_namespaceObject.basename(workingDir);
|
|
48
|
-
return `${
|
|
48
|
+
return `${external_pintor_default().red("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Failed to write in the destination directory\n\nPath is not writable. Ensure you have write permissions for this folder.\n${external_pintor_default().red('NOT WRITEABLE')}: ${external_pintor_default().underline(workingDirFolder)}`;
|
|
49
49
|
}
|
|
50
50
|
async function directoryHasConflicts(projectPath, conflictingFiles) {
|
|
51
51
|
const projectName = external_path_namespaceObject.basename(projectPath);
|
|
52
|
-
let message = `\nConflict! Path to ${
|
|
52
|
+
let message = `\nConflict! Path to ${external_pintor_default().cyan(projectName)} includes conflicting files:\n\n`;
|
|
53
53
|
for (const file of conflictingFiles){
|
|
54
54
|
const stats = await external_fs_namespaceObject.promises.lstat(external_path_namespaceObject.join(projectPath, file));
|
|
55
|
-
message += stats.isDirectory() ? `${
|
|
55
|
+
message += stats.isDirectory() ? `${external_pintor_default().gray('-')} ${external_pintor_default().yellow(file)}\n` : `${external_pintor_default().gray('-')} ${external_pintor_default().yellow(file)}\n`;
|
|
56
56
|
}
|
|
57
|
-
message += `\nYou need to either rename/remove the files listed above, or choose a new directory name for your extension.\n\nPath to conflicting directory: ${
|
|
57
|
+
message += `\nYou need to either rename/remove the files listed above, or choose a new directory name for your extension.\n\nPath to conflicting directory: ${external_pintor_default().underline(projectPath)}`;
|
|
58
58
|
return message;
|
|
59
59
|
}
|
|
60
60
|
function noProjectName() {
|
|
61
|
-
return `${
|
|
61
|
+
return `${external_pintor_default().red("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} You need to provide an extension name to create one. See ${external_pintor_default().yellow('--help')} for command info.`;
|
|
62
62
|
}
|
|
63
63
|
function noUrlAllowed() {
|
|
64
|
-
return `${
|
|
64
|
+
return `${external_pintor_default().red("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} URLs are not allowed as a project path. Either write a name or a path to a local folder.`;
|
|
65
65
|
}
|
|
66
66
|
async function successfullInstall(projectPath, projectName) {
|
|
67
67
|
const relativePath = external_path_namespaceObject.relative(process.cwd(), projectPath);
|
|
@@ -80,10 +80,10 @@ async function successfullInstall(projectPath, projectName) {
|
|
|
80
80
|
if (process.env.npm_config_user_agent) {
|
|
81
81
|
if (process.env.npm_config_user_agent.includes('pnpm')) command = 'pnpm dev';
|
|
82
82
|
}
|
|
83
|
-
return `\u{1F9E9} - ${
|
|
83
|
+
return `\u{1F9E9} - ${external_pintor_default().green('Success!')} Extension ${external_pintor_default().cyan(projectName)} created.\n\nNow ${external_pintor_default().magenta(`cd ${external_pintor_default().underline(relativePath)}`)} and ${external_pintor_default().magenta(`${command}`)} to open a new browser instance\nwith your extension installed, loaded, and enabled for development.\n\n${external_pintor_default().green('You are ready')}. Time to hack on your extension!`;
|
|
84
84
|
}
|
|
85
85
|
function startingNewExtension(projectName) {
|
|
86
|
-
return `\u{1F423} - Starting a new browser extension named ${
|
|
86
|
+
return `\u{1F423} - Starting a new browser extension named ${external_pintor_default().cyan(projectName)}...`;
|
|
87
87
|
}
|
|
88
88
|
function checkingIfPathIsWriteable() {
|
|
89
89
|
return `\u{1F91E} - Checking if destination path is writeable...`;
|
|
@@ -92,74 +92,74 @@ function scanningPossiblyConflictingFiles() {
|
|
|
92
92
|
return "\uD83D\uDD0E - Scanning for potential conflicting files...";
|
|
93
93
|
}
|
|
94
94
|
function createDirectoryError(projectName, error) {
|
|
95
|
-
return `${
|
|
95
|
+
return `${external_pintor_default().red("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Can't create directory ${external_pintor_default().cyan(projectName)}:\n${external_pintor_default().red(error)}`;
|
|
96
96
|
}
|
|
97
97
|
function writingTypeDefinitions(projectName) {
|
|
98
|
-
return `\u{1F537} - Writing type definitions for ${
|
|
98
|
+
return `\u{1F537} - Writing type definitions for ${external_pintor_default().cyan(projectName)}...`;
|
|
99
99
|
}
|
|
100
100
|
function writingTypeDefinitionsError(error) {
|
|
101
|
-
return `${
|
|
101
|
+
return `${external_pintor_default().red("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Failed to write the extension type definition.\n${external_pintor_default().red(error)}`;
|
|
102
102
|
}
|
|
103
103
|
function installingFromTemplate(projectName, templateName) {
|
|
104
|
-
if ('init' === templateName) return `\u{1F9F0} - Installing ${
|
|
105
|
-
return `\u{1F9F0} - Installing ${
|
|
104
|
+
if ('init' === templateName) return `\u{1F9F0} - Installing ${external_pintor_default().cyan(projectName)}...`;
|
|
105
|
+
return `\u{1F9F0} - Installing ${external_pintor_default().cyan(projectName)} from template ${external_pintor_default().magenta(templateName)}...`;
|
|
106
106
|
}
|
|
107
107
|
function installingFromTemplateError(projectName, template, error) {
|
|
108
|
-
return `${
|
|
108
|
+
return `${external_pintor_default().red("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Can't find template ${external_pintor_default().magenta(template)} for ${external_pintor_default().cyan(projectName)}:\n${external_pintor_default().red(error)}`;
|
|
109
109
|
}
|
|
110
110
|
function initializingGitForRepository(projectName) {
|
|
111
|
-
return `\u{1F332} - Initializing git repository for ${
|
|
111
|
+
return `\u{1F332} - Initializing git repository for ${external_pintor_default().cyan(projectName)}...`;
|
|
112
112
|
}
|
|
113
113
|
function initializingGitForRepositoryFailed(gitCommand, gitArgs, code) {
|
|
114
|
-
return `${
|
|
114
|
+
return `${external_pintor_default().red("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Command ${external_pintor_default().yellow(gitCommand)} ${external_pintor_default().yellow(gitArgs.join(' '))} failed with exit code ${code}`;
|
|
115
115
|
}
|
|
116
116
|
function initializingGitForRepositoryProcessError(projectName, error) {
|
|
117
|
-
return `${
|
|
117
|
+
return `${external_pintor_default().red("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Child process error: Can't initialize ${external_pintor_default().yellow('git')} for ${external_pintor_default().cyan(projectName)}:\n${external_pintor_default().red(error.message)}`;
|
|
118
118
|
}
|
|
119
119
|
function initializingGitForRepositoryError(projectName, error) {
|
|
120
|
-
return `${
|
|
120
|
+
return `${external_pintor_default().red("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Can't initialize ${external_pintor_default().yellow('git')} for ${external_pintor_default().cyan(projectName)}:\n${external_pintor_default().red(error.message || error.toString())}`;
|
|
121
121
|
}
|
|
122
122
|
function installingDependencies() {
|
|
123
123
|
return "\uD83D\uDEE0 - Installing dependencies... (takes a moment)";
|
|
124
124
|
}
|
|
125
125
|
function installingDependenciesFailed(gitCommand, gitArgs, code) {
|
|
126
|
-
return `${
|
|
126
|
+
return `${external_pintor_default().red("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Command ${gitCommand} ${gitArgs.join(' ')} failed with exit code ${code}`;
|
|
127
127
|
}
|
|
128
128
|
function installingDependenciesProcessError(projectName, error) {
|
|
129
|
-
return `${
|
|
129
|
+
return `${external_pintor_default().red("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Child process error: Can't install dependencies for ${external_pintor_default().cyan(projectName)}:\n${external_pintor_default().red(error)}`;
|
|
130
130
|
}
|
|
131
131
|
function cantInstallDependencies(projectName, error) {
|
|
132
|
-
return `${
|
|
132
|
+
return `${external_pintor_default().red("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Can't install dependencies for ${external_pintor_default().cyan(projectName)}:\n${external_pintor_default().red(error.message || error.toString())}`;
|
|
133
133
|
}
|
|
134
134
|
function writingPackageJsonMetadata() {
|
|
135
|
-
return `\u{1F4DD} - Writing ${
|
|
135
|
+
return `\u{1F4DD} - Writing ${external_pintor_default().yellow('package.json')} metadata...`;
|
|
136
136
|
}
|
|
137
137
|
function writingPackageJsonMetadataError(projectName, error) {
|
|
138
|
-
return `${
|
|
138
|
+
return `${external_pintor_default().red("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Can't write ${external_pintor_default().yellow('package.json')} for ${external_pintor_default().cyan(projectName)}:\n${external_pintor_default().red(error)}`;
|
|
139
139
|
}
|
|
140
140
|
function writingManifestJsonMetadata() {
|
|
141
|
-
return `\u{1F4DC} - Writing ${
|
|
141
|
+
return `\u{1F4DC} - Writing ${external_pintor_default().yellow('manifest.json')} metadata...`;
|
|
142
142
|
}
|
|
143
143
|
function writingManifestJsonMetadataError(projectName, error) {
|
|
144
|
-
return `${
|
|
144
|
+
return `${external_pintor_default().red("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Can't write ${external_pintor_default().yellow('manifest.json')} for ${external_pintor_default().cyan(projectName)}:\n${external_pintor_default().red(error)}`;
|
|
145
145
|
}
|
|
146
146
|
function writingReadmeMetaData() {
|
|
147
|
-
return `\u{1F4C4} - Writing ${
|
|
147
|
+
return `\u{1F4C4} - Writing ${external_pintor_default().yellow('README.md')} metadata...`;
|
|
148
148
|
}
|
|
149
149
|
function writingGitIgnore() {
|
|
150
|
-
return `\u{1F648} - Writing ${
|
|
150
|
+
return `\u{1F648} - Writing ${external_pintor_default().yellow('.gitignore')} lines...`;
|
|
151
151
|
}
|
|
152
152
|
function writingReadmeMetaDataEError(projectName, error) {
|
|
153
|
-
return `${
|
|
153
|
+
return `${external_pintor_default().red("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Can't write the ${external_pintor_default().yellow('README.md')} file for ${external_pintor_default().cyan(projectName)}:\n${external_pintor_default().red(error)}`;
|
|
154
154
|
}
|
|
155
155
|
function folderExists(projectName) {
|
|
156
|
-
return `\u{1F91D} - Ensuring ${
|
|
156
|
+
return `\u{1F91D} - Ensuring ${external_pintor_default().cyan(projectName)} folder exists...`;
|
|
157
157
|
}
|
|
158
158
|
function writingDirectoryError(error) {
|
|
159
|
-
return `${
|
|
159
|
+
return `${external_pintor_default().red("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Error while checking directory writability:\n` + external_pintor_default().red(error);
|
|
160
160
|
}
|
|
161
161
|
function cantSetupBuiltInTests(projectName, error) {
|
|
162
|
-
return `${
|
|
162
|
+
return `${external_pintor_default().red("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Can't setup built-in tests for ${external_pintor_default().cyan(projectName)}:\n${external_pintor_default().red(error)}`;
|
|
163
163
|
}
|
|
164
164
|
const promises_namespaceObject = require("fs/promises");
|
|
165
165
|
const external_url_namespaceObject = require("url");
|
package/package.json
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"dist"
|
|
22
22
|
],
|
|
23
23
|
"name": "extension-create",
|
|
24
|
-
"version": "2.0.0-rc.
|
|
24
|
+
"version": "2.0.0-rc.38",
|
|
25
25
|
"description": "The create step of Extension.js",
|
|
26
26
|
"author": {
|
|
27
27
|
"name": "Cezar Augusto",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"url": "https://cezaraugusto.com"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"chalk": "^5.3.0",
|
|
33
32
|
"cross-spawn": "^7.0.6",
|
|
34
33
|
"go-git-it": "4.0.0",
|
|
35
34
|
"package-manager-detector": "^0.2.7",
|
|
35
|
+
"pintor": "0.3.0",
|
|
36
36
|
"tiny-glob": "^0.2.9"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|