@parcel/create-react-app 2.8.4-nightly.2926 → 2.8.4-nightly.2937
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/lib/bin.js +0 -1
- package/lib/cli.js +2 -58
- package/lib/emoji.js +6 -5
- package/package.json +2 -2
package/lib/bin.js
CHANGED
package/lib/cli.js
CHANGED
@@ -2,134 +2,94 @@
|
|
2
2
|
|
3
3
|
function _commander() {
|
4
4
|
const data = _interopRequireDefault(require("commander"));
|
5
|
-
|
6
5
|
_commander = function () {
|
7
6
|
return data;
|
8
7
|
};
|
9
|
-
|
10
8
|
return data;
|
11
9
|
}
|
12
|
-
|
13
10
|
var _package = require("../package.json");
|
14
|
-
|
15
11
|
function _simpleGit() {
|
16
12
|
const data = _interopRequireDefault(require("simple-git"));
|
17
|
-
|
18
13
|
_simpleGit = function () {
|
19
14
|
return data;
|
20
15
|
};
|
21
|
-
|
22
16
|
return data;
|
23
17
|
}
|
24
|
-
|
25
18
|
function _fs() {
|
26
19
|
const data = _interopRequireDefault(require("fs"));
|
27
|
-
|
28
20
|
_fs = function () {
|
29
21
|
return data;
|
30
22
|
};
|
31
|
-
|
32
23
|
return data;
|
33
24
|
}
|
34
|
-
|
35
25
|
function _path() {
|
36
26
|
const data = _interopRequireDefault(require("path"));
|
37
|
-
|
38
27
|
_path = function () {
|
39
28
|
return data;
|
40
29
|
};
|
41
|
-
|
42
30
|
return data;
|
43
31
|
}
|
44
|
-
|
45
32
|
function _ncp2() {
|
46
33
|
const data = _interopRequireDefault(require("ncp"));
|
47
|
-
|
48
34
|
_ncp2 = function () {
|
49
35
|
return data;
|
50
36
|
};
|
51
|
-
|
52
37
|
return data;
|
53
38
|
}
|
54
|
-
|
55
39
|
function _util() {
|
56
40
|
const data = require("util");
|
57
|
-
|
58
41
|
_util = function () {
|
59
42
|
return data;
|
60
43
|
};
|
61
|
-
|
62
44
|
return data;
|
63
45
|
}
|
64
|
-
|
65
46
|
function _commandExists() {
|
66
47
|
const data = _interopRequireDefault(require("command-exists"));
|
67
|
-
|
68
48
|
_commandExists = function () {
|
69
49
|
return data;
|
70
50
|
};
|
71
|
-
|
72
51
|
return data;
|
73
52
|
}
|
74
|
-
|
75
53
|
function _promiseSpawn() {
|
76
54
|
const data = _interopRequireDefault(require("@npmcli/promise-spawn"));
|
77
|
-
|
78
55
|
_promiseSpawn = function () {
|
79
56
|
return data;
|
80
57
|
};
|
81
|
-
|
82
58
|
return data;
|
83
59
|
}
|
84
|
-
|
85
60
|
function _rimraf2() {
|
86
61
|
const data = _interopRequireDefault(require("rimraf"));
|
87
|
-
|
88
62
|
_rimraf2 = function () {
|
89
63
|
return data;
|
90
64
|
};
|
91
|
-
|
92
65
|
return data;
|
93
66
|
}
|
94
|
-
|
95
67
|
function _tempy() {
|
96
68
|
const data = _interopRequireDefault(require("tempy"));
|
97
|
-
|
98
69
|
_tempy = function () {
|
99
70
|
return data;
|
100
71
|
};
|
101
|
-
|
102
72
|
return data;
|
103
73
|
}
|
104
|
-
|
105
74
|
function _chalk() {
|
106
75
|
const data = _interopRequireDefault(require("chalk"));
|
107
|
-
|
108
76
|
_chalk = function () {
|
109
77
|
return data;
|
110
78
|
};
|
111
|
-
|
112
79
|
return data;
|
113
80
|
}
|
114
|
-
|
115
81
|
var emoji = _interopRequireWildcard(require("./emoji"));
|
116
|
-
|
117
82
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
118
|
-
|
119
83
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
120
|
-
|
121
84
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
122
|
-
|
123
85
|
// flowlint-next-line untyped-import:off
|
124
86
|
// flowlint-next-line untyped-import:off
|
125
87
|
// flowlint-next-line untyped-import:off
|
126
88
|
const TEMPLATES_DIR = _path().default.resolve(__dirname, '../templates');
|
127
|
-
|
128
89
|
const ncp = (0, _util().promisify)(_ncp2().default);
|
129
|
-
const rimraf = (0, _util().promisify)(_rimraf2().default);
|
130
|
-
|
90
|
+
const rimraf = (0, _util().promisify)(_rimraf2().default);
|
91
|
+
// eslint-disable-next-line no-console
|
131
92
|
const log = console.log;
|
132
|
-
|
133
93
|
_commander().default.name('create-react-app').version(_package.version).arguments('<path-to-new-app>').action(command => {
|
134
94
|
run(command).catch(reason => {
|
135
95
|
// eslint-disable-next-line no-console
|
@@ -137,28 +97,22 @@ _commander().default.name('create-react-app').version(_package.version).argument
|
|
137
97
|
process.exit(1);
|
138
98
|
});
|
139
99
|
}).parse();
|
140
|
-
|
141
100
|
async function run(packagePath) {
|
142
101
|
log((0, _chalk().default)`${emoji.progress} {green Creating Parcel app at}`, _chalk().default.bold.underline(packagePath));
|
143
|
-
|
144
102
|
if (await fsExists(packagePath)) {
|
145
103
|
throw new Error(`File or directory at ${packagePath} already exists`);
|
146
104
|
}
|
147
|
-
|
148
105
|
let tempPath = _tempy().default.directory();
|
149
|
-
|
150
106
|
try {
|
151
107
|
await createApp(_path().default.basename(packagePath), tempPath);
|
152
108
|
} catch (e) {
|
153
109
|
await rimraf(tempPath);
|
154
110
|
throw e;
|
155
111
|
}
|
156
|
-
|
157
112
|
await _fs().default.promises.rename(tempPath, packagePath);
|
158
113
|
log((0, _chalk().default)`{green ${emoji.success} Successfully created a new Parcel app at {bold.underline ${packagePath}}.}`);
|
159
114
|
log((0, _chalk().default)`${emoji.info} {dim Run} {bold cd ${packagePath}} {dim and then} {bold ${usesYarn ? 'yarn' : 'npm run'} start} {dim to start developing with Parcel.}`);
|
160
115
|
}
|
161
|
-
|
162
116
|
async function createApp(packageName, tempPath) {
|
163
117
|
log(emoji.progress, 'Creating package directory...');
|
164
118
|
const git = (0, _simpleGit().default)({
|
@@ -167,7 +121,6 @@ async function createApp(packageName, tempPath) {
|
|
167
121
|
log(emoji.progress, 'Initializing git repository...');
|
168
122
|
await git.init();
|
169
123
|
log(emoji.progress, 'Adding templates...');
|
170
|
-
|
171
124
|
async function writePackageJson() {
|
172
125
|
const packageJson = JSON.parse(await _fs().default.promises.readFile(_path().default.join(TEMPLATES_DIR, 'package.json'), 'utf8'));
|
173
126
|
await _fs().default.promises.writeFile(_path().default.join(tempPath, 'package.json'), JSON.stringify({
|
@@ -175,7 +128,6 @@ async function createApp(packageName, tempPath) {
|
|
175
128
|
...packageJson
|
176
129
|
}, null, 2));
|
177
130
|
}
|
178
|
-
|
179
131
|
await Promise.all([writePackageJson(), ncp(_path().default.join(TEMPLATES_DIR, 'default'), tempPath)]);
|
180
132
|
log(emoji.progress, 'Installing packages...');
|
181
133
|
await installPackages(['parcel@nightly', 'postcss', '@babel/core'], {
|
@@ -189,7 +141,6 @@ async function createApp(packageName, tempPath) {
|
|
189
141
|
await git.add('.');
|
190
142
|
await git.commit('Initial commit created with @parcel/create-react-app');
|
191
143
|
}
|
192
|
-
|
193
144
|
async function fsExists(filePath) {
|
194
145
|
try {
|
195
146
|
return (await _fs().default.promises.stat(filePath)) && true;
|
@@ -197,27 +148,20 @@ async function fsExists(filePath) {
|
|
197
148
|
return false;
|
198
149
|
}
|
199
150
|
}
|
200
|
-
|
201
151
|
let usesYarn;
|
202
|
-
|
203
152
|
async function installPackages(packageExpressions, opts) {
|
204
153
|
log(emoji.progress, (0, _chalk().default)`{dim Installing}`, _chalk().default.bold(...packageExpressions));
|
205
|
-
|
206
154
|
if (usesYarn == null) {
|
207
155
|
usesYarn = await (0, _commandExists().default)('yarn');
|
208
|
-
|
209
156
|
if (!usesYarn && !(await (0, _commandExists().default)('npm'))) {
|
210
157
|
throw new Error('Neither npm nor yarn found on system');
|
211
158
|
}
|
212
159
|
}
|
213
|
-
|
214
160
|
if (usesYarn) {
|
215
161
|
return spawn('yarn', ['add', opts.isDevDependency ? '--dev' : null, ...packageExpressions].filter(Boolean), opts.cwd);
|
216
162
|
}
|
217
|
-
|
218
163
|
return spawn('npm', ['install', opts.isDevDependency ? '--save-dev' : null, ...packageExpressions].filter(Boolean), opts.cwd);
|
219
164
|
}
|
220
|
-
|
221
165
|
function spawn(command, args, cwd) {
|
222
166
|
return (0, _promiseSpawn().default)(command, args, {
|
223
167
|
cwd,
|
package/lib/emoji.js
CHANGED
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.warning = exports.success = exports.progress = exports.info = exports.hint = exports.error = void 0;
|
7
|
-
|
8
7
|
// From https://github.com/sindresorhus/is-unicode-supported/blob/8f123916d5c25a87c4f966dcc248b7ca5df2b4ca/index.js
|
9
8
|
// This package is ESM-only so it has to be vendored
|
10
9
|
function isUnicodeSupported() {
|
@@ -12,13 +11,15 @@ function isUnicodeSupported() {
|
|
12
11
|
return process.env.TERM !== 'linux'; // Linux console (kernel)
|
13
12
|
}
|
14
13
|
|
15
|
-
return Boolean(process.env.CI) || Boolean(process.env.WT_SESSION) ||
|
16
|
-
|
14
|
+
return Boolean(process.env.CI) || Boolean(process.env.WT_SESSION) ||
|
15
|
+
// Windows Terminal
|
16
|
+
process.env.ConEmuTask === '{cmd::Cmder}' ||
|
17
|
+
// ConEmu and cmder
|
17
18
|
process.env.TERM_PROGRAM === 'vscode' || process.env.TERM === 'xterm-256color' || process.env.TERM === 'alacritty';
|
18
19
|
}
|
20
|
+
const supportsEmoji = isUnicodeSupported();
|
19
21
|
|
20
|
-
|
21
|
-
|
22
|
+
// Fallback symbols for Windows from https://en.wikipedia.org/wiki/Code_page_437
|
22
23
|
const progress = supportsEmoji ? '⏳' : '∞';
|
23
24
|
exports.progress = progress;
|
24
25
|
const success = supportsEmoji ? '✨' : '√';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@parcel/create-react-app",
|
3
|
-
"version": "2.8.4-nightly.
|
3
|
+
"version": "2.8.4-nightly.2937+3ad435157",
|
4
4
|
"bin": {
|
5
5
|
"parcel-create-react-app": "lib/bin.js"
|
6
6
|
},
|
@@ -34,5 +34,5 @@
|
|
34
34
|
"@babel/core": "^7.0.0",
|
35
35
|
"@parcel/babel-register": "2.8.3"
|
36
36
|
},
|
37
|
-
"gitHead": "
|
37
|
+
"gitHead": "3ad435157d443da806c215d68ccf292b4e95ae0c"
|
38
38
|
}
|