@atlaspack/create-react-app 2.14.1-canary.21 → 2.14.1-canary.210
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 +21 -3
- package/package.json +6 -6
- package/src/bin.js +4 -1
- package/templates/tsconfig.json +4 -0
package/lib/bin.js
CHANGED
package/lib/cli.js
CHANGED
|
@@ -83,8 +83,16 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
83
83
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
84
84
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
85
85
|
// flowlint-next-line untyped-import:off
|
|
86
|
+
|
|
86
87
|
// flowlint-next-line untyped-import:off
|
|
88
|
+
|
|
89
|
+
// @ts-expect-error TS7016
|
|
90
|
+
|
|
91
|
+
// @ts-expect-error TS7016
|
|
92
|
+
|
|
87
93
|
// flowlint-next-line untyped-import:off
|
|
94
|
+
// @ts-expect-error TS7016
|
|
95
|
+
// @ts-expect-error TS7016
|
|
88
96
|
const TEMPLATES_DIR = _path().default.resolve(__dirname, '../templates');
|
|
89
97
|
const ncp = (0, _util().promisify)(_ncp2().default);
|
|
90
98
|
// eslint-disable-next-line no-console
|
|
@@ -105,12 +113,15 @@ async function run(packagePath) {
|
|
|
105
113
|
try {
|
|
106
114
|
await createApp(_path().default.basename(packagePath), tempPath);
|
|
107
115
|
} catch (e) {
|
|
116
|
+
// @ts-expect-error TS2349
|
|
108
117
|
await (0, _rimraf().default)(tempPath);
|
|
109
118
|
throw e;
|
|
110
119
|
}
|
|
111
120
|
await _fs().default.promises.rename(tempPath, packagePath);
|
|
112
121
|
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 ${
|
|
122
|
+
log((0, _chalk().default)`${emoji.info} {dim Run} {bold cd ${packagePath}} {dim and then} {bold ${
|
|
123
|
+
// @ts-expect-error TS7005
|
|
124
|
+
usesYarn ? 'yarn' : 'npm run'} start} {dim to start developing with Parcel.}`);
|
|
114
125
|
}
|
|
115
126
|
async function createApp(packageName, tempPath) {
|
|
116
127
|
log(emoji.progress, 'Creating package directory...');
|
|
@@ -120,13 +131,14 @@ async function createApp(packageName, tempPath) {
|
|
|
120
131
|
log(emoji.progress, 'Initializing git repository...');
|
|
121
132
|
await git.init();
|
|
122
133
|
log(emoji.progress, 'Adding templates...');
|
|
123
|
-
|
|
134
|
+
async function writePackageJson() {
|
|
124
135
|
const packageJson = JSON.parse(await _fs().default.promises.readFile(_path().default.join(TEMPLATES_DIR, 'package.json'), 'utf8'));
|
|
125
136
|
await _fs().default.promises.writeFile(_path().default.join(tempPath, 'package.json'), JSON.stringify({
|
|
126
137
|
name: packageName,
|
|
127
138
|
...packageJson
|
|
128
139
|
}, null, 2));
|
|
129
|
-
}
|
|
140
|
+
}
|
|
141
|
+
await Promise.all([writePackageJson(), ncp(_path().default.join(TEMPLATES_DIR, 'default'), tempPath)]);
|
|
130
142
|
log(emoji.progress, 'Installing packages...');
|
|
131
143
|
await installPackages(['@atlaspack/cli@canary', 'postcss', '@babel/core'], {
|
|
132
144
|
cwd: tempPath,
|
|
@@ -146,15 +158,21 @@ async function fsExists(filePath) {
|
|
|
146
158
|
return false;
|
|
147
159
|
}
|
|
148
160
|
}
|
|
161
|
+
|
|
162
|
+
// @ts-expect-error TS7034
|
|
149
163
|
let usesYarn;
|
|
150
164
|
async function installPackages(packageExpressions, opts) {
|
|
151
165
|
log(emoji.progress, (0, _chalk().default)`{dim Installing}`, _chalk().default.bold(...packageExpressions));
|
|
166
|
+
|
|
167
|
+
// @ts-expect-error TS7005
|
|
152
168
|
if (usesYarn == null) {
|
|
153
169
|
usesYarn = await (0, _commandExists().default)('yarn');
|
|
154
170
|
if (!usesYarn && !(await (0, _commandExists().default)('npm'))) {
|
|
155
171
|
throw new Error('Neither npm nor yarn found on system');
|
|
156
172
|
}
|
|
157
173
|
}
|
|
174
|
+
|
|
175
|
+
// @ts-expect-error TS7005
|
|
158
176
|
if (usesYarn) {
|
|
159
177
|
return spawn('yarn', ['add', opts.isDevDependency ? '--dev' : null, ...packageExpressions].filter(Boolean), opts.cwd);
|
|
160
178
|
}
|
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.210+1671f630d",
|
|
4
4
|
"bin": {
|
|
5
5
|
"atlaspack-create-react-app": "lib/bin.js"
|
|
6
6
|
},
|
|
@@ -10,14 +10,14 @@
|
|
|
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/bin.d.ts",
|
|
14
15
|
"files": [
|
|
15
16
|
"templates",
|
|
16
17
|
"lib",
|
|
17
18
|
"bin"
|
|
18
19
|
],
|
|
19
20
|
"scripts": {
|
|
20
|
-
"prepack": "./ensure-no-dev-lib.sh",
|
|
21
21
|
"dev:prepare": "rimraf ./lib/ && mkdir -p lib && cp ./bin/dev-bin.js ./lib/bin.js"
|
|
22
22
|
},
|
|
23
23
|
"license": "(MIT OR Apache-2.0)",
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
"v8-compile-cache": "^2.0.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@atlaspack/babel-register": "2.14.
|
|
39
|
+
"@atlaspack/babel-register": "2.14.1",
|
|
40
40
|
"@babel/core": "^7.22.11",
|
|
41
41
|
"rimraf": "^5.0.5"
|
|
42
42
|
},
|
|
43
43
|
"type": "commonjs",
|
|
44
|
-
"gitHead": "
|
|
45
|
-
}
|
|
44
|
+
"gitHead": "1671f630d50d47ee18d525fb6a3615bda4102f87"
|
|
45
|
+
}
|
package/src/bin.js
CHANGED