@atlaspack/create-react-app 2.14.1-canary.54 → 2.14.1-canary.540

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 CHANGED
@@ -1,5 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
 
4
+ if (process.env.ATLASPACK_SOURCES === 'true' || process.env.ATLASPACK_BUILD_ENV === 'test') {
5
+ require('@atlaspack/babel-register');
6
+ }
4
7
  require('v8-compile-cache');
5
8
  require('./cli');
package/lib/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  function _commander() {
4
- const data = _interopRequireDefault(require("commander"));
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 _rimraf() {
60
+ function _rimraf2() {
61
61
  const data = _interopRequireDefault(require("rimraf"));
62
- _rimraf = function () {
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 _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
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
- 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().default.name('create-react-app').version(_package.version).arguments('<path-to-new-app>').action(command => {
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 (0, _rimraf().default)(tempPath);
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 ${usesYarn ? 'yarn' : 'npm run'} start} {dim to start developing with Parcel.}`);
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
- await Promise.all([async function writePackageJson() {
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
- }(), ncp(_path().default.join(TEMPLATES_DIR, 'default'), tempPath)]);
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 {};
@@ -0,0 +1,6 @@
1
+ export declare const progress: string;
2
+ export declare const success: string;
3
+ export declare const error: string;
4
+ export declare const warning: string;
5
+ export declare const info: string;
6
+ export declare const hint: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/create-react-app",
3
- "version": "2.14.1-canary.54+23a8687f8",
3
+ "version": "2.14.1-canary.540+13a467550",
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.js",
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
- "prepack": "./ensure-no-dev-lib.sh",
21
- "dev:prepare": "rimraf ./lib/ && mkdir -p lib && cp ./bin/dev-bin.js ./lib/bin.js"
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": "^7.0.0",
32
+ "commander": "^8.3.0",
32
33
  "ncp": "^2.0.0",
33
- "rimraf": "^5.0.5",
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.1",
40
+ "@atlaspack/babel-register": "2.14.5",
40
41
  "@babel/core": "^7.22.11",
41
- "rimraf": "^5.0.5"
42
+ "rimraf": "^3.0.2"
42
43
  },
43
44
  "type": "commonjs",
44
- "gitHead": "23a8687f886a45ebec028882291732a07e70b02f"
45
- }
45
+ "gitHead": "13a4675501f6252aadeba677808d9e3e117f6af4"
46
+ }
package/src/bin.js CHANGED
@@ -2,7 +2,10 @@
2
2
 
3
3
  'use strict';
4
4
 
5
- if (process.env.ATLASPACK_BUILD_ENV !== 'production') {
5
+ if (
6
+ process.env.ATLASPACK_SOURCES === 'true' ||
7
+ process.env.ATLASPACK_BUILD_ENV === 'test'
8
+ ) {
6
9
  require('@atlaspack/babel-register');
7
10
  }
8
11
 
@@ -3,6 +3,7 @@
3
3
  "private": true,
4
4
  "scripts": {
5
5
  "start": "atlaspack src/index.html",
6
- "build": "atlaspack build src/index.html"
6
+ "build": "atlaspack build src/index.html",
7
+ "build:lib": "gulp build --gulpfile ../../../../gulpfile.js --cwd ."
7
8
  }
8
9
  }
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "../../../tsconfig.base.json",
3
+ "include": ["src"]
4
+ }