@atlaspack/create-react-app 2.14.1-canary.54 → 2.14.1-canary.542
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 +3 -0
- package/lib/cli.js +33 -11
- package/lib/emoji.js +0 -1
- package/lib/types/cli.d.ts +1 -0
- package/lib/types/emoji.d.ts +6 -0
- package/package.json +11 -10
- package/src/bin.js +4 -1
- package/templates/package.json +2 -1
- package/templates/tsconfig.json +4 -0
package/lib/bin.js
CHANGED
package/lib/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _commander() {
|
|
4
|
-
const data =
|
|
4
|
+
const data = require("commander");
|
|
5
5
|
_commander = function () {
|
|
6
6
|
return data;
|
|
7
7
|
};
|
|
@@ -57,9 +57,9 @@ function _promiseSpawn() {
|
|
|
57
57
|
};
|
|
58
58
|
return data;
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function _rimraf2() {
|
|
61
61
|
const data = _interopRequireDefault(require("rimraf"));
|
|
62
|
-
|
|
62
|
+
_rimraf2 = function () {
|
|
63
63
|
return data;
|
|
64
64
|
};
|
|
65
65
|
return data;
|
|
@@ -79,17 +79,30 @@ function _chalk() {
|
|
|
79
79
|
return data;
|
|
80
80
|
}
|
|
81
81
|
var emoji = _interopRequireWildcard(require("./emoji"));
|
|
82
|
-
function
|
|
83
|
-
function
|
|
84
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
82
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
83
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
85
84
|
// flowlint-next-line untyped-import:off
|
|
85
|
+
|
|
86
86
|
// flowlint-next-line untyped-import:off
|
|
87
|
+
|
|
88
|
+
// @ts-expect-error TS7016
|
|
89
|
+
|
|
90
|
+
// @ts-expect-error TS7016
|
|
91
|
+
|
|
87
92
|
// flowlint-next-line untyped-import:off
|
|
93
|
+
// @ts-expect-error TS7016
|
|
94
|
+
|
|
95
|
+
// @ts-expect-error TS7016
|
|
96
|
+
|
|
97
|
+
// @ts-expect-error TS7016
|
|
98
|
+
|
|
88
99
|
const TEMPLATES_DIR = _path().default.resolve(__dirname, '../templates');
|
|
89
100
|
const ncp = (0, _util().promisify)(_ncp2().default);
|
|
101
|
+
const rimraf = (0, _util().promisify)(_rimraf2().default);
|
|
90
102
|
// eslint-disable-next-line no-console
|
|
91
103
|
const log = console.log;
|
|
92
|
-
_commander().
|
|
104
|
+
const program = new (_commander().Command)();
|
|
105
|
+
program.name('create-react-app').version(_package.version).arguments('<path-to-new-app>').action(command => {
|
|
93
106
|
run(command).catch(reason => {
|
|
94
107
|
// eslint-disable-next-line no-console
|
|
95
108
|
console.error((0, _chalk().default)`${emoji.error} {red ${reason.message}}`);
|
|
@@ -105,12 +118,14 @@ async function run(packagePath) {
|
|
|
105
118
|
try {
|
|
106
119
|
await createApp(_path().default.basename(packagePath), tempPath);
|
|
107
120
|
} catch (e) {
|
|
108
|
-
await (
|
|
121
|
+
await rimraf(tempPath);
|
|
109
122
|
throw e;
|
|
110
123
|
}
|
|
111
124
|
await _fs().default.promises.rename(tempPath, packagePath);
|
|
112
125
|
log((0, _chalk().default)`{green ${emoji.success} Successfully created a new Parcel app at {bold.underline ${packagePath}}.}`);
|
|
113
|
-
log((0, _chalk().default)`${emoji.info} {dim Run} {bold cd ${packagePath}} {dim and then} {bold ${
|
|
126
|
+
log((0, _chalk().default)`${emoji.info} {dim Run} {bold cd ${packagePath}} {dim and then} {bold ${
|
|
127
|
+
// @ts-expect-error TS7005
|
|
128
|
+
usesYarn ? 'yarn' : 'npm run'} start} {dim to start developing with Parcel.}`);
|
|
114
129
|
}
|
|
115
130
|
async function createApp(packageName, tempPath) {
|
|
116
131
|
log(emoji.progress, 'Creating package directory...');
|
|
@@ -120,13 +135,14 @@ async function createApp(packageName, tempPath) {
|
|
|
120
135
|
log(emoji.progress, 'Initializing git repository...');
|
|
121
136
|
await git.init();
|
|
122
137
|
log(emoji.progress, 'Adding templates...');
|
|
123
|
-
|
|
138
|
+
async function writePackageJson() {
|
|
124
139
|
const packageJson = JSON.parse(await _fs().default.promises.readFile(_path().default.join(TEMPLATES_DIR, 'package.json'), 'utf8'));
|
|
125
140
|
await _fs().default.promises.writeFile(_path().default.join(tempPath, 'package.json'), JSON.stringify({
|
|
126
141
|
name: packageName,
|
|
127
142
|
...packageJson
|
|
128
143
|
}, null, 2));
|
|
129
|
-
}
|
|
144
|
+
}
|
|
145
|
+
await Promise.all([writePackageJson(), ncp(_path().default.join(TEMPLATES_DIR, 'default'), tempPath)]);
|
|
130
146
|
log(emoji.progress, 'Installing packages...');
|
|
131
147
|
await installPackages(['@atlaspack/cli@canary', 'postcss', '@babel/core'], {
|
|
132
148
|
cwd: tempPath,
|
|
@@ -146,15 +162,21 @@ async function fsExists(filePath) {
|
|
|
146
162
|
return false;
|
|
147
163
|
}
|
|
148
164
|
}
|
|
165
|
+
|
|
166
|
+
// @ts-expect-error TS7034
|
|
149
167
|
let usesYarn;
|
|
150
168
|
async function installPackages(packageExpressions, opts) {
|
|
151
169
|
log(emoji.progress, (0, _chalk().default)`{dim Installing}`, _chalk().default.bold(...packageExpressions));
|
|
170
|
+
|
|
171
|
+
// @ts-expect-error TS7005
|
|
152
172
|
if (usesYarn == null) {
|
|
153
173
|
usesYarn = await (0, _commandExists().default)('yarn');
|
|
154
174
|
if (!usesYarn && !(await (0, _commandExists().default)('npm'))) {
|
|
155
175
|
throw new Error('Neither npm nor yarn found on system');
|
|
156
176
|
}
|
|
157
177
|
}
|
|
178
|
+
|
|
179
|
+
// @ts-expect-error TS7005
|
|
158
180
|
if (usesYarn) {
|
|
159
181
|
return spawn('yarn', ['add', opts.isDevDependency ? '--dev' : null, ...packageExpressions].filter(Boolean), opts.cwd);
|
|
160
182
|
}
|
package/lib/emoji.js
CHANGED
|
@@ -10,7 +10,6 @@ function isUnicodeSupported() {
|
|
|
10
10
|
if (process.platform !== 'win32') {
|
|
11
11
|
return process.env.TERM !== 'linux'; // Linux console (kernel)
|
|
12
12
|
}
|
|
13
|
-
|
|
14
13
|
return Boolean(process.env.CI) || Boolean(process.env.WT_SESSION) ||
|
|
15
14
|
// Windows Terminal
|
|
16
15
|
process.env.ConEmuTask === '{cmd::Cmder}' ||
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/create-react-app",
|
|
3
|
-
"version": "2.14.1-canary.
|
|
3
|
+
"version": "2.14.1-canary.542+e312a3c2a",
|
|
4
4
|
"bin": {
|
|
5
5
|
"atlaspack-create-react-app": "lib/bin.js"
|
|
6
6
|
},
|
|
@@ -10,15 +10,16 @@
|
|
|
10
10
|
"url": "https://github.com/atlassian-labs/atlaspack.git",
|
|
11
11
|
"directory": "packages/utils/create-react-app"
|
|
12
12
|
},
|
|
13
|
-
"source": "src/bin.
|
|
13
|
+
"source": "./src/bin.ts",
|
|
14
|
+
"types": "./lib/types/bin.d.ts",
|
|
14
15
|
"files": [
|
|
15
16
|
"templates",
|
|
16
17
|
"lib",
|
|
17
18
|
"bin"
|
|
18
19
|
],
|
|
19
20
|
"scripts": {
|
|
20
|
-
"
|
|
21
|
-
"
|
|
21
|
+
"dev:prepare": "rimraf ./lib/ && mkdir -p lib && cp ./bin/dev-bin.js ./lib/bin.js",
|
|
22
|
+
"build:lib": "gulp build --gulpfile ../../../gulpfile.js --cwd ."
|
|
22
23
|
},
|
|
23
24
|
"license": "(MIT OR Apache-2.0)",
|
|
24
25
|
"publishConfig": {
|
|
@@ -28,18 +29,18 @@
|
|
|
28
29
|
"@npmcli/promise-spawn": "^1.3.2",
|
|
29
30
|
"chalk": "^2.4.2",
|
|
30
31
|
"command-exists": "^1.2.6",
|
|
31
|
-
"commander": "^
|
|
32
|
+
"commander": "^8.3.0",
|
|
32
33
|
"ncp": "^2.0.0",
|
|
33
|
-
"rimraf": "^
|
|
34
|
+
"rimraf": "^3.0.2",
|
|
34
35
|
"simple-git": "^3.21.0",
|
|
35
36
|
"tempy": "^0.2.1",
|
|
36
37
|
"v8-compile-cache": "^2.0.0"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|
|
39
|
-
"@atlaspack/babel-register": "2.14.
|
|
40
|
+
"@atlaspack/babel-register": "2.14.5",
|
|
40
41
|
"@babel/core": "^7.22.11",
|
|
41
|
-
"rimraf": "^
|
|
42
|
+
"rimraf": "^3.0.2"
|
|
42
43
|
},
|
|
43
44
|
"type": "commonjs",
|
|
44
|
-
"gitHead": "
|
|
45
|
-
}
|
|
45
|
+
"gitHead": "e312a3c2a14f918859f3d6242529ba3a344857f8"
|
|
46
|
+
}
|
package/src/bin.js
CHANGED
package/templates/package.json
CHANGED