@quilted/create 0.1.15 → 0.1.18
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 +22 -0
- package/README.md +30 -0
- package/build/cjs/_commonjsHelpers.cjs +10 -0
- package/build/cjs/app.cjs +0 -2
- package/build/cjs/package-manager.cjs +7 -2
- package/build/cjs/package.cjs +27 -12
- package/build/cjs/parser-babel.cjs +59 -0
- package/build/cjs/parser-yaml.cjs +182 -0
- package/build/cjs/standalone.cjs +18 -22
- package/build/esm/_commonjsHelpers.mjs +7 -0
- package/build/esm/app.mjs +0 -2
- package/build/esm/package-manager.mjs +7 -2
- package/build/esm/package.mjs +28 -13
- package/build/esm/parser-babel.mjs +57 -0
- package/build/esm/parser-yaml.mjs +180 -0
- package/build/esm/standalone.mjs +16 -20
- 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.map +1 -1
- package/package.json +1 -1
- package/source/app.ts +0 -10
- package/source/package.ts +51 -22
- package/source/shared.ts +6 -1
- package/templates/app-basic/features/Start/Start.test.tsx +12 -0
- package/templates/app-basic/foundation/Head/Head.test.tsx +25 -0
- package/templates/app-basic/foundation/{Head.tsx → Head/Head.tsx} +0 -0
- package/templates/app-basic/foundation/Head/index.ts +1 -0
- package/templates/app-basic/foundation/Http/Http.test.tsx +24 -0
- package/templates/app-basic/foundation/{Http.tsx → Http/Http.tsx} +0 -0
- package/templates/app-basic/foundation/Http/index.ts +1 -0
- package/templates/app-basic/tests/mount.tsx +47 -0
- package/templates/app-basic/tsconfig.json +3 -2
- package/templates/app-single-file/tsconfig.json +1 -1
- package/templates/package/package.json +1 -0
- package/templates/package/source/index.ts +3 -1
- package/templates/package/source/tests/index.test.ts +8 -0
- package/templates/package/tsconfig.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @quilted/create
|
|
2
2
|
|
|
3
|
+
## 0.1.18
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`a98c7c2b`](https://github.com/lemonmade/quilt/commit/a98c7c2bc40fa29b95e1ca3005d5c0fe995c9a5f) Thanks [@lemonmade](https://github.com/lemonmade)! - Add versioning instructions to package create
|
|
8
|
+
|
|
9
|
+
* [`ae2475f7`](https://github.com/lemonmade/quilt/commit/ae2475f735a5e83969cbb596efe7b31cfd9f893b) Thanks [@lemonmade](https://github.com/lemonmade)! - Add tests to created packages
|
|
10
|
+
|
|
11
|
+
## 0.1.17
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`78d28015`](https://github.com/lemonmade/quilt/commit/78d280157c239175a431e12dbb9fda08f2c84a09) Thanks [@lemonmade](https://github.com/lemonmade)! - Fix create package flow in monorepos
|
|
16
|
+
|
|
17
|
+
* [`ae3bbaa8`](https://github.com/lemonmade/quilt/commit/ae3bbaa8e2cc50bb8f57e332fa0aa12100153fc6) Thanks [@lemonmade](https://github.com/lemonmade)! - Add `directory` to package.json in monorepo packages
|
|
18
|
+
|
|
19
|
+
## 0.1.16
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- [`910c7dbe`](https://github.com/lemonmade/quilt/commit/910c7dbe0ba5ad9b348c77e045faf13ba4b94219) Thanks [@lemonmade](https://github.com/lemonmade)! - Fix prettier standalone usage
|
|
24
|
+
|
|
3
25
|
## 0.1.15
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
package/README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# `@quilted/create`
|
|
2
|
+
|
|
3
|
+
This package provides a command line tool for generating new Quilt projects.
|
|
4
|
+
|
|
5
|
+
When run inside an existing [Quilt workspace](../../documentation/projects.md), this command will add additional [apps](../../documentation/projects.md#apps) or [packages](../../documentation/projects.md#packages) to the same workspace.
|
|
6
|
+
|
|
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
|
+
|
|
9
|
+
The best way to use this command is to run the `create` command in your favorite package manager. Quilt supports [npm](https://docs.npmjs.com/about-npm), [yarn](https://yarnpkg.com), and [pnpm](https://pnpm.io).
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pnpm create @quilted # for pnpm
|
|
13
|
+
npm create @quilted # for npm
|
|
14
|
+
yarn create @quilted # for yarn
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
> **Note:** If you don’t already have a favorite package manager, we recommend [pnpm](https://pnpm.io). pnpm is fast, takes up less space on disk, and produces a strict package installation that enforces dependency management best practices.
|
|
18
|
+
|
|
19
|
+
This command will ask you what type of project you want to create. If you want to jump right to creating a particular kind of project, you can pass it as an additional argument to this command:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pnpm create @quilted app # create an app with pnpm
|
|
23
|
+
npm create @quilted package # create a package with npm
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
This command also accepts many command-line flags to pre-answer the questions you will be asked when creating your project. To learn more about these flags, run the command with the `--help` flag:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pnpm create @quilted --help
|
|
30
|
+
```
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
4
|
+
|
|
5
|
+
function getDefaultExportFromCjs (x) {
|
|
6
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
exports.commonjsGlobal = commonjsGlobal;
|
|
10
|
+
exports.getDefaultExportFromCjs = getDefaultExportFromCjs;
|
package/build/cjs/app.cjs
CHANGED
|
@@ -120,8 +120,6 @@ async function createApp() {
|
|
|
120
120
|
workspacePackageJson.name = packageManager.toValidPackageName(name);
|
|
121
121
|
workspacePackageJson.eslintConfig = projectPackageJson.eslintConfig;
|
|
122
122
|
workspacePackageJson.browserslist = projectPackageJson.browserslist;
|
|
123
|
-
const addBackToTSConfigInclude = new Set(['quilt.project.ts', '*.test.ts', '*.test.tsx']);
|
|
124
|
-
projectTSConfig.exclude = projectTSConfig.exclude.filter(excluded => !addBackToTSConfigInclude.has(excluded));
|
|
125
123
|
let quiltProject = await appTemplate.read('quilt.project.ts');
|
|
126
124
|
quiltProject = quiltProject.replace('quiltApp', 'quiltWorkspace, quiltApp').replace('quiltApp(', 'quiltWorkspace(), quiltApp(');
|
|
127
125
|
await outputRoot.write('quilt.project.ts', await packageManager.format(quiltProject, {
|
|
@@ -146,13 +146,18 @@ async function format(content, {
|
|
|
146
146
|
}) {
|
|
147
147
|
const [{
|
|
148
148
|
format
|
|
149
|
-
}
|
|
149
|
+
}, {
|
|
150
|
+
default: babel
|
|
151
|
+
}, {
|
|
152
|
+
default: yaml
|
|
153
|
+
}] = 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; })]);
|
|
150
154
|
return format(content, {
|
|
151
155
|
arrowParens: 'always',
|
|
152
156
|
bracketSpacing: false,
|
|
153
157
|
singleQuote: true,
|
|
154
158
|
trailingComma: 'all',
|
|
155
|
-
parser
|
|
159
|
+
parser,
|
|
160
|
+
plugins: [babel, yaml]
|
|
156
161
|
});
|
|
157
162
|
}
|
|
158
163
|
|
package/build/cjs/package.cjs
CHANGED
|
@@ -153,8 +153,6 @@ async function createPackage() {
|
|
|
153
153
|
isPublic,
|
|
154
154
|
registry: argv['--registry']
|
|
155
155
|
});
|
|
156
|
-
const addBackToTSConfigInclude = new Set(['quilt.project.ts', '*.test.ts', '*.test.tsx']);
|
|
157
|
-
projectTSConfig.exclude = projectTSConfig.exclude.filter(excluded => !addBackToTSConfigInclude.has(excluded));
|
|
158
156
|
quiltProject = quiltProject.replace('quiltPackage', 'quiltWorkspace, quiltPackage').replace('quiltPackage(', 'quiltWorkspace(), quiltPackage(');
|
|
159
157
|
await outputRoot.write('quilt.project.ts', await packageManager.format(quiltProject, {
|
|
160
158
|
as: 'typescript'
|
|
@@ -189,6 +187,7 @@ async function createPackage() {
|
|
|
189
187
|
if (partOfMonorepo) {
|
|
190
188
|
// Write the package’s package.json (the root one was already created)
|
|
191
189
|
const projectPackageJson = JSON.parse(await packageTemplate.read('package.json'));
|
|
190
|
+
projectPackageJson.repository.directory = path__namespace.relative(directory, packageDirectory);
|
|
192
191
|
adjustPackageJson(projectPackageJson, {
|
|
193
192
|
name: packageManager.toValidPackageName(name),
|
|
194
193
|
react: useReact,
|
|
@@ -198,6 +197,7 @@ async function createPackage() {
|
|
|
198
197
|
await outputRoot.write(path__namespace.join(packageDirectory, 'package.json'), await packageManager.format(JSON.stringify(projectPackageJson), {
|
|
199
198
|
as: 'json-stringify'
|
|
200
199
|
}));
|
|
200
|
+
await outputRoot.write(path__namespace.join(packageDirectory, 'quilt.project.ts'), quiltProject);
|
|
201
201
|
await Promise.all([packageManager.addToTsConfig(packageDirectory, outputRoot), packageManager.addToPackageManagerWorkspaces(packageDirectory, outputRoot, packageManager$1)]);
|
|
202
202
|
}
|
|
203
203
|
|
|
@@ -212,6 +212,18 @@ async function createPackage() {
|
|
|
212
212
|
console.log('Installed dependencies.');
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
+
const packageJsonInstructions = index.stripIndent`
|
|
216
|
+
Your new package is ready to go! However, before you go too much further,
|
|
217
|
+
you should update the following fields in ${index.cyan_1(packageManager.relativeDirectoryForDisplay(path__namespace.relative(process.cwd(), path__namespace.join(packageDirectory, 'package.json'))))}:
|
|
218
|
+
|
|
219
|
+
- ${index.bold_1(`"description"`)}, where you provide a description of what your package does
|
|
220
|
+
- ${index.bold_1(`"repository"`)}, where you should include the ${index.bold_1(`"url"`)} of your project’s repo
|
|
221
|
+
|
|
222
|
+
Before you publish your package, you will also want to update the ${index.bold_1(`"version"`)}
|
|
223
|
+
field in the package.json file.
|
|
224
|
+
`;
|
|
225
|
+
console.log();
|
|
226
|
+
console.log(packageJsonInstructions);
|
|
215
227
|
const commands = [];
|
|
216
228
|
|
|
217
229
|
if (!inWorkspace && directory !== process.cwd()) {
|
|
@@ -227,17 +239,20 @@ async function createPackage() {
|
|
|
227
239
|
commands.push(`git init && git add -A && git commit -m "Initial commit" ${index.dim_1('# Start your git history (optional)')}`);
|
|
228
240
|
}
|
|
229
241
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
242
|
+
if (commands.length > 0) {
|
|
243
|
+
const whatsNext = index.stripIndent`
|
|
244
|
+
After you update your package.json, there’s ${commands.length > 1 ? 'a few more steps' : 'one more step'} you’ll need to take
|
|
245
|
+
in order to start building:
|
|
246
|
+
`;
|
|
247
|
+
console.log();
|
|
248
|
+
console.log(whatsNext);
|
|
249
|
+
console.log();
|
|
250
|
+
console.log(commands.map(command => ` ${command}`).join('\n'));
|
|
251
|
+
}
|
|
252
|
+
|
|
238
253
|
const followUp = index.stripIndent`
|
|
239
|
-
Quilt can
|
|
240
|
-
|
|
254
|
+
Quilt can help you build, test, lint, and type-check your new package. You
|
|
255
|
+
can learn more about building packages with Quilt by reading the documentation:
|
|
241
256
|
${index.underline_1(index.magenta_1('https://github.com/lemonmade/quilt/tree/main/documentation'))}
|
|
242
257
|
|
|
243
258
|
Have fun! 🎉
|