@quilted/create 0.1.23 → 0.1.26
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 +18 -0
- package/README.md +1 -1
- package/build/cjs/app.cjs +13 -10
- package/build/cjs/index.cjs +6 -6
- package/build/cjs/package-manager.cjs +21 -6
- package/build/cjs/package.cjs +11 -29
- package/build/cjs/parser-typescript.cjs +312 -0
- package/build/esm/app.mjs +13 -10
- package/build/esm/index.mjs +6 -6
- package/build/esm/index2.mjs +16 -16
- package/build/esm/package-manager.mjs +21 -7
- package/build/esm/package.mjs +11 -29
- package/build/esm/parser-typescript.mjs +310 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/typescript/app.d.ts.map +1 -1
- package/build/typescript/package.d.ts.map +1 -1
- package/build/typescript/shared.d.ts +1 -0
- package/build/typescript/shared.d.ts.map +1 -1
- package/package.json +1 -1
- package/quilt.project.ts +3 -1
- package/source/app.ts +15 -2
- package/source/package.ts +6 -22
- package/source/shared.ts +24 -6
- package/templates/vscode/_vscode/settings.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @quilted/create
|
|
2
2
|
|
|
3
|
+
## 0.1.26
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`9ad07bf7`](https://github.com/lemonmade/quilt/commit/9ad07bf727208151b81030858eb65643040b994d) Thanks [@lemonmade](https://github.com/lemonmade)! - Fix package.json git.directory for packages
|
|
8
|
+
|
|
9
|
+
## 0.1.25
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#390](https://github.com/lemonmade/quilt/pull/390) [`15cf0022`](https://github.com/lemonmade/quilt/commit/15cf00222e8109d9076b4e90c438429628c86095) Thanks [@lemonmade](https://github.com/lemonmade)! - Switch from binary => executable
|
|
14
|
+
|
|
15
|
+
## 0.1.24
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [`dae904fe`](https://github.com/lemonmade/quilt/commit/dae904fe489f7b869bcc2fa2398b3826651e75b9) Thanks [@lemonmade](https://github.com/lemonmade)! - Fix non-monorepo app creation issues
|
|
20
|
+
|
|
3
21
|
## 0.1.23
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
This package provides a command line tool for generating new Quilt projects.
|
|
4
4
|
|
|
5
|
-
When run inside an existing [Quilt workspace](../../documentation/projects.md), this command will add additional [apps](../../documentation/projects
|
|
5
|
+
When run inside an existing [Quilt workspace](../../documentation/projects.md), this command will add additional [apps](../../documentation/projects/apps) or [packages](../../documentation/projects.md#packages) to the same workspace.
|
|
6
6
|
|
|
7
7
|
You can also run it outside an existing repository, and it will create a new repository with a Quilt app or package. This new repo can be configured either as a “monorepo”, with room for additional projects, or as a repo just focused on a single project.
|
|
8
8
|
|
package/build/cjs/app.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var fs = require('fs');
|
|
4
|
-
var path = require('path');
|
|
5
|
-
var
|
|
3
|
+
var fs = require('node:fs');
|
|
4
|
+
var path = require('node:path');
|
|
5
|
+
var node_child_process = require('node:child_process');
|
|
6
6
|
var index = require('./index.cjs');
|
|
7
7
|
var packageManager = require('./package-manager.cjs');
|
|
8
|
-
require('tty');
|
|
9
|
-
require('url');
|
|
10
|
-
require('readline');
|
|
11
|
-
require('events');
|
|
8
|
+
require('node:tty');
|
|
9
|
+
require('node:url');
|
|
10
|
+
require('node:readline');
|
|
11
|
+
require('node:events');
|
|
12
12
|
|
|
13
13
|
function _interopNamespace(e) {
|
|
14
14
|
if (e && e.__esModule) return e;
|
|
@@ -126,6 +126,7 @@ async function createApp() {
|
|
|
126
126
|
workspacePackageJson.name = packageManager.toValidPackageName(name);
|
|
127
127
|
workspacePackageJson.eslintConfig = projectPackageJson.eslintConfig;
|
|
128
128
|
workspacePackageJson.browserslist = projectPackageJson.browserslist;
|
|
129
|
+
workspacePackageJson.devDependencies = packageManager.mergeDependencies(workspacePackageJson.devDependencies, projectPackageJson.devDependencies);
|
|
129
130
|
let quiltProject = await appTemplate.read('quilt.project.ts');
|
|
130
131
|
quiltProject = quiltProject.replace('quiltApp', 'quiltWorkspace, quiltApp').replace('quiltApp(', 'quiltWorkspace(), quiltApp(');
|
|
131
132
|
await outputRoot.write('quilt.project.ts', await packageManager.format(quiltProject, {
|
|
@@ -171,7 +172,7 @@ async function createApp() {
|
|
|
171
172
|
if (shouldInstall) {
|
|
172
173
|
process.stdout.write('\nInstalling dependencies...\n'); // TODO: better loading, handle errors
|
|
173
174
|
|
|
174
|
-
|
|
175
|
+
node_child_process.execSync(`${packageManager$1} install`, {
|
|
175
176
|
cwd: rootDirectory
|
|
176
177
|
});
|
|
177
178
|
process.stdout.moveCursor(0, -1);
|
|
@@ -181,12 +182,14 @@ async function createApp() {
|
|
|
181
182
|
|
|
182
183
|
const commands = [];
|
|
183
184
|
|
|
185
|
+
const packageManagerRun = command => packageManager$1 === 'npm' ? `npm run ${command}` : `pnpm ${command}`;
|
|
186
|
+
|
|
184
187
|
if (!inWorkspace && directory !== process.cwd()) {
|
|
185
188
|
commands.push(`cd ${index.cyan_1(packageManager.relativeDirectoryForDisplay(path__namespace.relative(process.cwd(), directory)))} ${index.dim_1('# Move into your new app’s directory')}`);
|
|
186
189
|
}
|
|
187
190
|
|
|
188
191
|
if (!shouldInstall) {
|
|
189
|
-
commands.push(
|
|
192
|
+
commands.push(`${packageManager$1} install ${index.dim_1('# Install all your dependencies')}`);
|
|
190
193
|
}
|
|
191
194
|
|
|
192
195
|
if (!inWorkspace) {
|
|
@@ -194,7 +197,7 @@ async function createApp() {
|
|
|
194
197
|
commands.push(`git init && git add -A && git commit -m "Initial commit" ${index.dim_1('# Start your git history (optional)')}`);
|
|
195
198
|
}
|
|
196
199
|
|
|
197
|
-
commands.push(
|
|
200
|
+
commands.push(`${packageManagerRun('develop')} ${index.dim_1('# Start the development server')}`);
|
|
198
201
|
const whatsNext = index.stripIndent(_t2 || (_t2 = _`
|
|
199
202
|
Your new app is ready to go! There’s just ${0} you’ll need to take
|
|
200
203
|
in order to start developing:
|
package/build/cjs/index.cjs
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var require$$0 = require('tty');
|
|
6
|
-
var fs = require('fs');
|
|
7
|
-
require('path');
|
|
8
|
-
require('url');
|
|
9
|
-
var require$$0$1 = require('readline');
|
|
10
|
-
var require$$2 = require('events');
|
|
5
|
+
var require$$0 = require('node:tty');
|
|
6
|
+
var fs = require('node:fs');
|
|
7
|
+
require('node:path');
|
|
8
|
+
require('node:url');
|
|
9
|
+
var require$$0$1 = require('node:readline');
|
|
10
|
+
var require$$2 = require('node:events');
|
|
11
11
|
|
|
12
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
13
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var path = require('path');
|
|
4
|
-
var fs = require('fs');
|
|
5
|
-
var
|
|
3
|
+
var path = require('node:path');
|
|
4
|
+
var fs = require('node:fs');
|
|
5
|
+
var node_url = require('node:url');
|
|
6
6
|
require('./index.cjs');
|
|
7
7
|
|
|
8
8
|
function _interopNamespace(e) {
|
|
@@ -90,7 +90,7 @@ async function getPackageRoot() {
|
|
|
90
90
|
packageDirectory
|
|
91
91
|
} = await Promise.resolve().then(function () { return require('./index2.cjs'); });
|
|
92
92
|
return packageDirectory({
|
|
93
|
-
cwd: path__namespace.dirname(
|
|
93
|
+
cwd: path__namespace.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('package-manager.cjs', document.baseURI).href))))
|
|
94
94
|
});
|
|
95
95
|
})();
|
|
96
96
|
}
|
|
@@ -152,18 +152,32 @@ async function format(content, {
|
|
|
152
152
|
format
|
|
153
153
|
}, {
|
|
154
154
|
default: babel
|
|
155
|
+
}, {
|
|
156
|
+
default: typescript
|
|
155
157
|
}, {
|
|
156
158
|
default: yaml
|
|
157
|
-
}] = await Promise.all([Promise.resolve().then(function () { return require('./standalone.cjs'); }).then(function (n) { return n.standalone; }), Promise.resolve().then(function () { return require('./parser-babel.cjs'); }).then(function (n) { return n.parserBabel; }), Promise.resolve().then(function () { return require('./parser-yaml.cjs'); }).then(function (n) { return n.parserYaml; })]);
|
|
159
|
+
}] = await Promise.all([Promise.resolve().then(function () { return require('./standalone.cjs'); }).then(function (n) { return n.standalone; }), Promise.resolve().then(function () { return require('./parser-babel.cjs'); }).then(function (n) { return n.parserBabel; }), Promise.resolve().then(function () { return require('./parser-typescript.cjs'); }).then(function (n) { return n.parserTypescript; }), Promise.resolve().then(function () { return require('./parser-yaml.cjs'); }).then(function (n) { return n.parserYaml; })]);
|
|
158
160
|
return format(content, {
|
|
159
161
|
arrowParens: 'always',
|
|
160
162
|
bracketSpacing: false,
|
|
161
163
|
singleQuote: true,
|
|
162
164
|
trailingComma: 'all',
|
|
163
165
|
parser,
|
|
164
|
-
plugins: [babel, yaml]
|
|
166
|
+
plugins: [babel, typescript, yaml]
|
|
165
167
|
});
|
|
166
168
|
}
|
|
169
|
+
function mergeDependencies(first = {}, second = {}) {
|
|
170
|
+
const all = { ...first,
|
|
171
|
+
...second
|
|
172
|
+
};
|
|
173
|
+
const merged = {};
|
|
174
|
+
|
|
175
|
+
for (const [key, value] of Object.entries(all).sort(([keyOne], [keyTwo]) => keyOne.localeCompare(keyTwo))) {
|
|
176
|
+
merged[key] = value;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return merged;
|
|
180
|
+
}
|
|
167
181
|
|
|
168
182
|
const ENDS_WITH_TSCONFIG = /[/]?tsconfig[.a-z0-9]*[.]json/i;
|
|
169
183
|
async function addToTsConfig(directory, output) {
|
|
@@ -311,5 +325,6 @@ exports.emptyDirectory = emptyDirectory;
|
|
|
311
325
|
exports.format = format;
|
|
312
326
|
exports.isEmpty = isEmpty;
|
|
313
327
|
exports.loadTemplate = loadTemplate;
|
|
328
|
+
exports.mergeDependencies = mergeDependencies;
|
|
314
329
|
exports.relativeDirectoryForDisplay = relativeDirectoryForDisplay;
|
|
315
330
|
exports.toValidPackageName = toValidPackageName;
|
package/build/cjs/package.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var fs = require('fs');
|
|
4
|
-
var path = require('path');
|
|
5
|
-
var
|
|
3
|
+
var fs = require('node:fs');
|
|
4
|
+
var path = require('node:path');
|
|
5
|
+
var node_child_process = require('node:child_process');
|
|
6
6
|
var index = require('./index.cjs');
|
|
7
7
|
var packageManager = require('./package-manager.cjs');
|
|
8
|
-
require('tty');
|
|
9
|
-
require('url');
|
|
10
|
-
require('readline');
|
|
11
|
-
require('events');
|
|
8
|
+
require('node:tty');
|
|
9
|
+
require('node:url');
|
|
10
|
+
require('node:readline');
|
|
11
|
+
require('node:events');
|
|
12
12
|
|
|
13
13
|
function _interopNamespace(e) {
|
|
14
14
|
if (e && e.__esModule) return e;
|
|
@@ -98,14 +98,9 @@ async function createProject() {
|
|
|
98
98
|
const outputRoot = packageManager.createOutputTarget(rootDirectory);
|
|
99
99
|
const packageTemplate = packageManager.loadTemplate('package');
|
|
100
100
|
const workspaceTemplate = packageManager.loadTemplate('workspace');
|
|
101
|
-
let quiltProject = await packageTemplate.read('quilt.project.ts');
|
|
102
|
-
|
|
103
|
-
if (useReact) {
|
|
104
|
-
quiltProject = quiltProject.replace('react: false', 'react: true');
|
|
105
|
-
} // If we aren’t already in a workspace, copy the workspace files over, which
|
|
101
|
+
let quiltProject = await packageTemplate.read('quilt.project.ts'); // If we aren’t already in a workspace, copy the workspace files over, which
|
|
106
102
|
// are needed if we are making a monorepo or not.
|
|
107
103
|
|
|
108
|
-
|
|
109
104
|
if (!inWorkspace) {
|
|
110
105
|
await workspaceTemplate.copy(directory, file => {
|
|
111
106
|
// When this is a single project, we use the project’s Quilt configuration as the base.
|
|
@@ -149,9 +144,7 @@ async function createProject() {
|
|
|
149
144
|
newPackageJson.dependencies = projectPackageJson.dependencies;
|
|
150
145
|
newPackageJson.peerDependencies = projectPackageJson.peerDependencies;
|
|
151
146
|
newPackageJson.peerDependenciesMeta = projectPackageJson.peerDependenciesMeta;
|
|
152
|
-
newPackageJson.devDependencies =
|
|
153
|
-
...projectPackageJson.devDependencies
|
|
154
|
-
});
|
|
147
|
+
newPackageJson.devDependencies = packageManager.mergeDependencies(workspacePackageJson.devDependencies, projectPackageJson.devDependencies);
|
|
155
148
|
}
|
|
156
149
|
|
|
157
150
|
adjustPackageJson(newPackageJson, {
|
|
@@ -194,7 +187,7 @@ async function createProject() {
|
|
|
194
187
|
if (partOfMonorepo) {
|
|
195
188
|
// Write the package’s package.json (the root one was already created)
|
|
196
189
|
const projectPackageJson = JSON.parse(await packageTemplate.read('package.json'));
|
|
197
|
-
projectPackageJson.repository.directory = path__namespace.relative(
|
|
190
|
+
projectPackageJson.repository.directory = path__namespace.relative(rootDirectory, packageDirectory);
|
|
198
191
|
adjustPackageJson(projectPackageJson, {
|
|
199
192
|
name: packageManager.toValidPackageName(name),
|
|
200
193
|
react: useReact,
|
|
@@ -211,7 +204,7 @@ async function createProject() {
|
|
|
211
204
|
if (shouldInstall) {
|
|
212
205
|
process.stdout.write('\nInstalling dependencies...\n'); // TODO: better loading, handle errors
|
|
213
206
|
|
|
214
|
-
|
|
207
|
+
node_child_process.execSync(`${packageManager$1} install`, {
|
|
215
208
|
cwd: rootDirectory
|
|
216
209
|
});
|
|
217
210
|
process.stdout.moveCursor(0, -1);
|
|
@@ -418,15 +411,4 @@ function adjustPackageJson(packageJson, {
|
|
|
418
411
|
return packageJson;
|
|
419
412
|
}
|
|
420
413
|
|
|
421
|
-
function sortKeys(object) {
|
|
422
|
-
const newObject = {};
|
|
423
|
-
const sortedEntries = Object.entries(object).sort(([keyOne], [keyTwo]) => keyOne.localeCompare(keyTwo));
|
|
424
|
-
|
|
425
|
-
for (const [key, value] of sortedEntries) {
|
|
426
|
-
newObject[key] = value;
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
return newObject;
|
|
430
|
-
}
|
|
431
|
-
|
|
432
414
|
exports.createProject = createProject;
|