@shopify/create-app 0.5.2 → 0.6.0
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/CHANGELOG.md +7 -0
- package/bin/{dev → create-app-dev} +2 -2
- package/bin/create-app-dev.cmd +3 -0
- package/bin/{run → create-app-run} +0 -0
- package/bin/create-app-run.cmd +3 -0
- package/dist/commands/init.js +558 -41
- package/package.json +12 -15
- package/bin/dev.cmd +0 -3
- package/bin/run.cmd +0 -3
- package/dist/commands/init.d.ts +0 -5
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
if (!process.argv.includes("init")) {
|
|
4
|
-
process.argv.
|
|
4
|
+
process.argv.splice(2, 0, 'init');
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
const oclif = require('@oclif/core')
|
|
8
8
|
|
|
9
9
|
const path = require('path')
|
|
10
|
-
const project = path.join(__dirname, '..', 'tsconfig.json')
|
|
10
|
+
const project = path.join(__dirname, '..', 'tsconfig.dist.json')
|
|
11
11
|
|
|
12
12
|
// In dev mode -> use ts-node and dev plugins
|
|
13
13
|
process.env.NODE_ENV = 'development'
|
|
File without changes
|
package/dist/commands/init.js
CHANGED
|
@@ -1,43 +1,560 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@oclif/core');
|
|
4
|
+
var path$1 = require('path');
|
|
5
|
+
var require$$1 = require('fs');
|
|
6
|
+
var require$$2 = require('util');
|
|
7
|
+
|
|
8
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
|
+
|
|
10
|
+
var path__default = /*#__PURE__*/_interopDefaultLegacy(path$1);
|
|
11
|
+
var require$$1__default = /*#__PURE__*/_interopDefaultLegacy(require$$1);
|
|
12
|
+
var require$$2__default = /*#__PURE__*/_interopDefaultLegacy(require$$2);
|
|
13
|
+
|
|
14
|
+
function normalizeWindowsPath(input = "") {
|
|
15
|
+
if (!input.includes("\\")) {
|
|
16
|
+
return input;
|
|
17
|
+
}
|
|
18
|
+
return input.replace(/\\/g, "/");
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const _UNC_REGEX = /^[/][/]/;
|
|
22
|
+
const _UNC_DRIVE_REGEX = /^[/][/]([.]{1,2}[/])?([a-zA-Z]):[/]/;
|
|
23
|
+
const _IS_ABSOLUTE_RE = /^\/|^\\|^[a-zA-Z]:[/\\]/;
|
|
24
|
+
const sep = "/";
|
|
25
|
+
const delimiter = ":";
|
|
26
|
+
const normalize = function(path2) {
|
|
27
|
+
if (path2.length === 0) {
|
|
28
|
+
return ".";
|
|
29
|
+
}
|
|
30
|
+
path2 = normalizeWindowsPath(path2);
|
|
31
|
+
const isUNCPath = path2.match(_UNC_REGEX);
|
|
32
|
+
const hasUNCDrive = isUNCPath && path2.match(_UNC_DRIVE_REGEX);
|
|
33
|
+
const isPathAbsolute = isAbsolute(path2);
|
|
34
|
+
const trailingSeparator = path2[path2.length - 1] === "/";
|
|
35
|
+
path2 = normalizeString(path2, !isPathAbsolute);
|
|
36
|
+
if (path2.length === 0) {
|
|
37
|
+
if (isPathAbsolute) {
|
|
38
|
+
return "/";
|
|
39
|
+
}
|
|
40
|
+
return trailingSeparator ? "./" : ".";
|
|
41
|
+
}
|
|
42
|
+
if (trailingSeparator) {
|
|
43
|
+
path2 += "/";
|
|
44
|
+
}
|
|
45
|
+
if (isUNCPath) {
|
|
46
|
+
if (hasUNCDrive) {
|
|
47
|
+
return `//./${path2}`;
|
|
48
|
+
}
|
|
49
|
+
return `//${path2}`;
|
|
50
|
+
}
|
|
51
|
+
return isPathAbsolute && !isAbsolute(path2) ? `/${path2}` : path2;
|
|
52
|
+
};
|
|
53
|
+
const join = function(...args) {
|
|
54
|
+
if (args.length === 0) {
|
|
55
|
+
return ".";
|
|
56
|
+
}
|
|
57
|
+
let joined;
|
|
58
|
+
for (let i = 0; i < args.length; ++i) {
|
|
59
|
+
const arg = args[i];
|
|
60
|
+
if (arg.length > 0) {
|
|
61
|
+
if (joined === void 0) {
|
|
62
|
+
joined = arg;
|
|
63
|
+
} else {
|
|
64
|
+
joined += `/${arg}`;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (joined === void 0) {
|
|
69
|
+
return ".";
|
|
70
|
+
}
|
|
71
|
+
return normalize(joined);
|
|
72
|
+
};
|
|
73
|
+
const resolve = function(...args) {
|
|
74
|
+
args = args.map((arg) => normalizeWindowsPath(arg));
|
|
75
|
+
let resolvedPath = "";
|
|
76
|
+
let resolvedAbsolute = false;
|
|
77
|
+
for (let i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
|
78
|
+
const path2 = i >= 0 ? args[i] : process.cwd();
|
|
79
|
+
if (path2.length === 0) {
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
resolvedPath = `${path2}/${resolvedPath}`;
|
|
83
|
+
resolvedAbsolute = isAbsolute(path2);
|
|
84
|
+
}
|
|
85
|
+
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
|
|
86
|
+
if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
|
|
87
|
+
return `/${resolvedPath}`;
|
|
88
|
+
}
|
|
89
|
+
return resolvedPath.length > 0 ? resolvedPath : ".";
|
|
90
|
+
};
|
|
91
|
+
function normalizeString(path2, allowAboveRoot) {
|
|
92
|
+
let res = "";
|
|
93
|
+
let lastSegmentLength = 0;
|
|
94
|
+
let lastSlash = -1;
|
|
95
|
+
let dots = 0;
|
|
96
|
+
let char = null;
|
|
97
|
+
for (let i = 0; i <= path2.length; ++i) {
|
|
98
|
+
if (i < path2.length) {
|
|
99
|
+
char = path2[i];
|
|
100
|
+
} else if (char === "/") {
|
|
101
|
+
break;
|
|
102
|
+
} else {
|
|
103
|
+
char = "/";
|
|
39
104
|
}
|
|
105
|
+
if (char === "/") {
|
|
106
|
+
if (lastSlash === i - 1 || dots === 1) ; else if (dots === 2) {
|
|
107
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
108
|
+
if (res.length > 2) {
|
|
109
|
+
const lastSlashIndex = res.lastIndexOf("/");
|
|
110
|
+
if (lastSlashIndex === -1) {
|
|
111
|
+
res = "";
|
|
112
|
+
lastSegmentLength = 0;
|
|
113
|
+
} else {
|
|
114
|
+
res = res.slice(0, lastSlashIndex);
|
|
115
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
116
|
+
}
|
|
117
|
+
lastSlash = i;
|
|
118
|
+
dots = 0;
|
|
119
|
+
continue;
|
|
120
|
+
} else if (res.length !== 0) {
|
|
121
|
+
res = "";
|
|
122
|
+
lastSegmentLength = 0;
|
|
123
|
+
lastSlash = i;
|
|
124
|
+
dots = 0;
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if (allowAboveRoot) {
|
|
129
|
+
res += res.length > 0 ? "/.." : "..";
|
|
130
|
+
lastSegmentLength = 2;
|
|
131
|
+
}
|
|
132
|
+
} else {
|
|
133
|
+
if (res.length > 0) {
|
|
134
|
+
res += `/${path2.slice(lastSlash + 1, i)}`;
|
|
135
|
+
} else {
|
|
136
|
+
res = path2.slice(lastSlash + 1, i);
|
|
137
|
+
}
|
|
138
|
+
lastSegmentLength = i - lastSlash - 1;
|
|
139
|
+
}
|
|
140
|
+
lastSlash = i;
|
|
141
|
+
dots = 0;
|
|
142
|
+
} else if (char === "." && dots !== -1) {
|
|
143
|
+
++dots;
|
|
144
|
+
} else {
|
|
145
|
+
dots = -1;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return res;
|
|
40
149
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
150
|
+
const isAbsolute = function(p) {
|
|
151
|
+
return _IS_ABSOLUTE_RE.test(p);
|
|
152
|
+
};
|
|
153
|
+
const toNamespacedPath = function(p) {
|
|
154
|
+
return normalizeWindowsPath(p);
|
|
155
|
+
};
|
|
156
|
+
const extname = function(p) {
|
|
157
|
+
return path__default["default"].posix.extname(normalizeWindowsPath(p));
|
|
158
|
+
};
|
|
159
|
+
const relative = function(from, to) {
|
|
160
|
+
return path__default["default"].posix.relative(normalizeWindowsPath(from), normalizeWindowsPath(to));
|
|
161
|
+
};
|
|
162
|
+
const dirname = function(p) {
|
|
163
|
+
return path__default["default"].posix.dirname(normalizeWindowsPath(p));
|
|
164
|
+
};
|
|
165
|
+
const format = function(p) {
|
|
166
|
+
return normalizeWindowsPath(path__default["default"].posix.format(p));
|
|
167
|
+
};
|
|
168
|
+
const basename = function(p, ext) {
|
|
169
|
+
return path__default["default"].posix.basename(normalizeWindowsPath(p), ext);
|
|
170
|
+
};
|
|
171
|
+
const parse = function(p) {
|
|
172
|
+
return path__default["default"].posix.parse(normalizeWindowsPath(p));
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
const _path = /*#__PURE__*/Object.freeze({
|
|
176
|
+
__proto__: null,
|
|
177
|
+
sep: sep,
|
|
178
|
+
delimiter: delimiter,
|
|
179
|
+
normalize: normalize,
|
|
180
|
+
join: join,
|
|
181
|
+
resolve: resolve,
|
|
182
|
+
normalizeString: normalizeString,
|
|
183
|
+
isAbsolute: isAbsolute,
|
|
184
|
+
toNamespacedPath: toNamespacedPath,
|
|
185
|
+
extname: extname,
|
|
186
|
+
relative: relative,
|
|
187
|
+
dirname: dirname,
|
|
188
|
+
format: format,
|
|
189
|
+
basename: basename,
|
|
190
|
+
parse: parse
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
const index = {
|
|
194
|
+
..._path
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
var findUp$1 = {exports: {}};
|
|
198
|
+
|
|
199
|
+
var locatePath = {exports: {}};
|
|
200
|
+
|
|
201
|
+
var pLocate$2 = {exports: {}};
|
|
202
|
+
|
|
203
|
+
var pLimit$2 = {exports: {}};
|
|
204
|
+
|
|
205
|
+
var pTry$2 = {exports: {}};
|
|
206
|
+
|
|
207
|
+
const pTry$1 = (fn, ...arguments_) => new Promise(resolve => {
|
|
208
|
+
resolve(fn(...arguments_));
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
pTry$2.exports = pTry$1;
|
|
212
|
+
// TODO: remove this in the next major version
|
|
213
|
+
pTry$2.exports.default = pTry$1;
|
|
214
|
+
|
|
215
|
+
const pTry = pTry$2.exports;
|
|
216
|
+
|
|
217
|
+
const pLimit$1 = concurrency => {
|
|
218
|
+
if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
|
|
219
|
+
return Promise.reject(new TypeError('Expected `concurrency` to be a number from 1 and up'));
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const queue = [];
|
|
223
|
+
let activeCount = 0;
|
|
224
|
+
|
|
225
|
+
const next = () => {
|
|
226
|
+
activeCount--;
|
|
227
|
+
|
|
228
|
+
if (queue.length > 0) {
|
|
229
|
+
queue.shift()();
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
const run = (fn, resolve, ...args) => {
|
|
234
|
+
activeCount++;
|
|
235
|
+
|
|
236
|
+
const result = pTry(fn, ...args);
|
|
237
|
+
|
|
238
|
+
resolve(result);
|
|
239
|
+
|
|
240
|
+
result.then(next, next);
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
const enqueue = (fn, resolve, ...args) => {
|
|
244
|
+
if (activeCount < concurrency) {
|
|
245
|
+
run(fn, resolve, ...args);
|
|
246
|
+
} else {
|
|
247
|
+
queue.push(run.bind(null, fn, resolve, ...args));
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
const generator = (fn, ...args) => new Promise(resolve => enqueue(fn, resolve, ...args));
|
|
252
|
+
Object.defineProperties(generator, {
|
|
253
|
+
activeCount: {
|
|
254
|
+
get: () => activeCount
|
|
255
|
+
},
|
|
256
|
+
pendingCount: {
|
|
257
|
+
get: () => queue.length
|
|
258
|
+
},
|
|
259
|
+
clearQueue: {
|
|
260
|
+
value: () => {
|
|
261
|
+
queue.length = 0;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
return generator;
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
pLimit$2.exports = pLimit$1;
|
|
270
|
+
pLimit$2.exports.default = pLimit$1;
|
|
271
|
+
|
|
272
|
+
const pLimit = pLimit$2.exports;
|
|
273
|
+
|
|
274
|
+
class EndError extends Error {
|
|
275
|
+
constructor(value) {
|
|
276
|
+
super();
|
|
277
|
+
this.value = value;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// The input can also be a promise, so we await it
|
|
282
|
+
const testElement = async (element, tester) => tester(await element);
|
|
283
|
+
|
|
284
|
+
// The input can also be a promise, so we `Promise.all()` them both
|
|
285
|
+
const finder = async element => {
|
|
286
|
+
const values = await Promise.all(element);
|
|
287
|
+
if (values[1] === true) {
|
|
288
|
+
throw new EndError(values[0]);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
return false;
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
const pLocate$1 = async (iterable, tester, options) => {
|
|
295
|
+
options = {
|
|
296
|
+
concurrency: Infinity,
|
|
297
|
+
preserveOrder: true,
|
|
298
|
+
...options
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
const limit = pLimit(options.concurrency);
|
|
302
|
+
|
|
303
|
+
// Start all the promises concurrently with optional limit
|
|
304
|
+
const items = [...iterable].map(element => [element, limit(testElement, element, tester)]);
|
|
305
|
+
|
|
306
|
+
// Check the promises either serially or concurrently
|
|
307
|
+
const checkLimit = pLimit(options.preserveOrder ? 1 : Infinity);
|
|
308
|
+
|
|
309
|
+
try {
|
|
310
|
+
await Promise.all(items.map(element => checkLimit(finder, element)));
|
|
311
|
+
} catch (error) {
|
|
312
|
+
if (error instanceof EndError) {
|
|
313
|
+
return error.value;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
throw error;
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
pLocate$2.exports = pLocate$1;
|
|
321
|
+
// TODO: Remove this for the next major release
|
|
322
|
+
pLocate$2.exports.default = pLocate$1;
|
|
323
|
+
|
|
324
|
+
const path = path__default["default"];
|
|
325
|
+
const fs$1 = require$$1__default["default"];
|
|
326
|
+
const {promisify: promisify$1} = require$$2__default["default"];
|
|
327
|
+
const pLocate = pLocate$2.exports;
|
|
328
|
+
|
|
329
|
+
const fsStat = promisify$1(fs$1.stat);
|
|
330
|
+
const fsLStat = promisify$1(fs$1.lstat);
|
|
331
|
+
|
|
332
|
+
const typeMappings = {
|
|
333
|
+
directory: 'isDirectory',
|
|
334
|
+
file: 'isFile'
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
function checkType({type}) {
|
|
338
|
+
if (type in typeMappings) {
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
throw new Error(`Invalid type specified: ${type}`);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
const matchType = (type, stat) => type === undefined || stat[typeMappings[type]]();
|
|
346
|
+
|
|
347
|
+
locatePath.exports = async (paths, options) => {
|
|
348
|
+
options = {
|
|
349
|
+
cwd: process.cwd(),
|
|
350
|
+
type: 'file',
|
|
351
|
+
allowSymlinks: true,
|
|
352
|
+
...options
|
|
353
|
+
};
|
|
354
|
+
checkType(options);
|
|
355
|
+
const statFn = options.allowSymlinks ? fsStat : fsLStat;
|
|
356
|
+
|
|
357
|
+
return pLocate(paths, async path_ => {
|
|
358
|
+
try {
|
|
359
|
+
const stat = await statFn(path.resolve(options.cwd, path_));
|
|
360
|
+
return matchType(options.type, stat);
|
|
361
|
+
} catch (_) {
|
|
362
|
+
return false;
|
|
363
|
+
}
|
|
364
|
+
}, options);
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
locatePath.exports.sync = (paths, options) => {
|
|
368
|
+
options = {
|
|
369
|
+
cwd: process.cwd(),
|
|
370
|
+
allowSymlinks: true,
|
|
371
|
+
type: 'file',
|
|
372
|
+
...options
|
|
373
|
+
};
|
|
374
|
+
checkType(options);
|
|
375
|
+
const statFn = options.allowSymlinks ? fs$1.statSync : fs$1.lstatSync;
|
|
376
|
+
|
|
377
|
+
for (const path_ of paths) {
|
|
378
|
+
try {
|
|
379
|
+
const stat = statFn(path.resolve(options.cwd, path_));
|
|
380
|
+
|
|
381
|
+
if (matchType(options.type, stat)) {
|
|
382
|
+
return path_;
|
|
383
|
+
}
|
|
384
|
+
} catch (_) {
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
var pathExists = {exports: {}};
|
|
390
|
+
|
|
391
|
+
const fs = require$$1__default["default"];
|
|
392
|
+
const {promisify} = require$$2__default["default"];
|
|
393
|
+
|
|
394
|
+
const pAccess = promisify(fs.access);
|
|
395
|
+
|
|
396
|
+
pathExists.exports = async path => {
|
|
397
|
+
try {
|
|
398
|
+
await pAccess(path);
|
|
399
|
+
return true;
|
|
400
|
+
} catch (_) {
|
|
401
|
+
return false;
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
pathExists.exports.sync = path => {
|
|
406
|
+
try {
|
|
407
|
+
fs.accessSync(path);
|
|
408
|
+
return true;
|
|
409
|
+
} catch (_) {
|
|
410
|
+
return false;
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
(function (module) {
|
|
415
|
+
const path = path__default["default"];
|
|
416
|
+
const locatePath$1 = locatePath.exports;
|
|
417
|
+
const pathExists$1 = pathExists.exports;
|
|
418
|
+
|
|
419
|
+
const stop = Symbol('findUp.stop');
|
|
420
|
+
|
|
421
|
+
module.exports = async (name, options = {}) => {
|
|
422
|
+
let directory = path.resolve(options.cwd || '');
|
|
423
|
+
const {root} = path.parse(directory);
|
|
424
|
+
const paths = [].concat(name);
|
|
425
|
+
|
|
426
|
+
const runMatcher = async locateOptions => {
|
|
427
|
+
if (typeof name !== 'function') {
|
|
428
|
+
return locatePath$1(paths, locateOptions);
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
const foundPath = await name(locateOptions.cwd);
|
|
432
|
+
if (typeof foundPath === 'string') {
|
|
433
|
+
return locatePath$1([foundPath], locateOptions);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
return foundPath;
|
|
437
|
+
};
|
|
438
|
+
|
|
439
|
+
// eslint-disable-next-line no-constant-condition
|
|
440
|
+
while (true) {
|
|
441
|
+
// eslint-disable-next-line no-await-in-loop
|
|
442
|
+
const foundPath = await runMatcher({...options, cwd: directory});
|
|
443
|
+
|
|
444
|
+
if (foundPath === stop) {
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
if (foundPath) {
|
|
449
|
+
return path.resolve(directory, foundPath);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
if (directory === root) {
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
directory = path.dirname(directory);
|
|
457
|
+
}
|
|
458
|
+
};
|
|
459
|
+
|
|
460
|
+
module.exports.sync = (name, options = {}) => {
|
|
461
|
+
let directory = path.resolve(options.cwd || '');
|
|
462
|
+
const {root} = path.parse(directory);
|
|
463
|
+
const paths = [].concat(name);
|
|
464
|
+
|
|
465
|
+
const runMatcher = locateOptions => {
|
|
466
|
+
if (typeof name !== 'function') {
|
|
467
|
+
return locatePath$1.sync(paths, locateOptions);
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
const foundPath = name(locateOptions.cwd);
|
|
471
|
+
if (typeof foundPath === 'string') {
|
|
472
|
+
return locatePath$1.sync([foundPath], locateOptions);
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
return foundPath;
|
|
476
|
+
};
|
|
477
|
+
|
|
478
|
+
// eslint-disable-next-line no-constant-condition
|
|
479
|
+
while (true) {
|
|
480
|
+
const foundPath = runMatcher({...options, cwd: directory});
|
|
481
|
+
|
|
482
|
+
if (foundPath === stop) {
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
if (foundPath) {
|
|
487
|
+
return path.resolve(directory, foundPath);
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
if (directory === root) {
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
directory = path.dirname(directory);
|
|
495
|
+
}
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
module.exports.exists = pathExists$1;
|
|
499
|
+
|
|
500
|
+
module.exports.sync.exists = pathExists$1.sync;
|
|
501
|
+
|
|
502
|
+
module.exports.stop = stop;
|
|
503
|
+
}(findUp$1));
|
|
504
|
+
|
|
505
|
+
var findUp = findUp$1.exports;
|
|
506
|
+
|
|
507
|
+
function findPathUp(path, from, type) {
|
|
508
|
+
return findUp(path, { cwd: from, type });
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
class FatalError extends Error {
|
|
512
|
+
constructor(message, tryMessage = null) {
|
|
513
|
+
super(message);
|
|
514
|
+
this.tryMessage = tryMessage;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
class BugError extends FatalError {
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
async function template(name) {
|
|
521
|
+
const templatePath = await findPathUp(`templates/${name}`, __dirname, "directory");
|
|
522
|
+
if (templatePath) {
|
|
523
|
+
return templatePath;
|
|
524
|
+
} else {
|
|
525
|
+
throw new BugError(`Couldn't find the template ${name} in @shopify/create-app.`);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
async function init(_) {
|
|
530
|
+
console.log("it works");
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
const _Init = class extends core.Command {
|
|
534
|
+
async run() {
|
|
535
|
+
const templatePath = await template("app");
|
|
536
|
+
const { flags } = await this.parse(_Init);
|
|
537
|
+
const directory = flags.path ? index.resolve(flags.path) : process.cwd();
|
|
538
|
+
await init({
|
|
539
|
+
name: flags.name,
|
|
540
|
+
templatePath,
|
|
541
|
+
directory
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
};
|
|
545
|
+
let Init = _Init;
|
|
546
|
+
Init.description = "Create a new Shopify app";
|
|
547
|
+
Init.flags = {
|
|
548
|
+
name: core.Flags.string({
|
|
549
|
+
char: "n",
|
|
550
|
+
description: "The name of the app to be initialized.",
|
|
551
|
+
hidden: false
|
|
552
|
+
}),
|
|
553
|
+
path: core.Flags.string({
|
|
554
|
+
char: "p",
|
|
555
|
+
description: "The path to the directory where the app will be created.",
|
|
556
|
+
hidden: false
|
|
557
|
+
})
|
|
558
|
+
};
|
|
559
|
+
|
|
560
|
+
module.exports = Init;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopify/create-app",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A CLI tool to create a new Shopify app.",
|
|
6
6
|
"keywords": [
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"types": "dist/index.d.ts",
|
|
14
14
|
"bin": {
|
|
15
|
-
"create-app": "./bin/run"
|
|
15
|
+
"create-app": "./bin/create-app-run"
|
|
16
16
|
},
|
|
17
17
|
"files": [
|
|
18
18
|
"/bin",
|
|
@@ -25,8 +25,9 @@
|
|
|
25
25
|
"@shopify:registry": "https://registry.npmjs.org"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
|
-
"
|
|
29
|
-
"build
|
|
28
|
+
"clean": "shx rm -rf dist",
|
|
29
|
+
"build": "shx rm -rf dist && rollup -c",
|
|
30
|
+
"build:watch": "tsc -b tsconfig.dist.json --watch",
|
|
30
31
|
"prepublishOnly": "yarn run build",
|
|
31
32
|
"lint": "prettier -c src/** && eslint src/**",
|
|
32
33
|
"lint:fix": "prettier src/** && eslint src/** --fix",
|
|
@@ -40,17 +41,15 @@
|
|
|
40
41
|
]
|
|
41
42
|
},
|
|
42
43
|
"dependencies": {
|
|
43
|
-
"@bugsnag/js": "^7.14.1",
|
|
44
|
-
"@oclif/command": "^1",
|
|
45
|
-
"@oclif/core": "^1",
|
|
46
44
|
"@oclif/plugin-help": "^5",
|
|
47
|
-
"@oclif/
|
|
48
|
-
"@
|
|
49
|
-
"
|
|
50
|
-
"@shopify/support": "0.5.2"
|
|
45
|
+
"@oclif/core": "^1",
|
|
46
|
+
"@bugsnag/js": "^7.14.1",
|
|
47
|
+
"plop": "^2.7.6"
|
|
51
48
|
},
|
|
52
49
|
"devDependencies": {
|
|
53
|
-
"@
|
|
50
|
+
"@shopify/core": "0.5.2",
|
|
51
|
+
"@types/listr": "^0.14.4",
|
|
52
|
+
"listr": "^0.14.3"
|
|
54
53
|
},
|
|
55
54
|
"engine-strict": true,
|
|
56
55
|
"engines": {
|
|
@@ -63,8 +62,6 @@
|
|
|
63
62
|
],
|
|
64
63
|
"oclif": {
|
|
65
64
|
"bin": "create-app",
|
|
66
|
-
"commands": "./dist/commands"
|
|
67
|
-
"plugins": [],
|
|
68
|
-
"topicSeparator": " "
|
|
65
|
+
"commands": "./dist/commands"
|
|
69
66
|
}
|
|
70
67
|
}
|
package/bin/dev.cmd
DELETED
package/bin/run.cmd
DELETED
package/dist/commands/init.d.ts
DELETED
package/dist/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { run } from '@oclif/core';
|
package/dist/index.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.run = void 0;
|
|
4
|
-
var core_1 = require("@oclif/core");
|
|
5
|
-
Object.defineProperty(exports, "run", { enumerable: true, get: function () { return core_1.run; } });
|
|
6
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsb0NBQWdDO0FBQXhCLDJGQUFBLEdBQUcsT0FBQSJ9
|