@vyriy/create 0.5.2 → 0.5.3

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.
@@ -2,12 +2,16 @@
2
2
  import { create } from '../index.js';
3
3
  const args = process.argv.slice(2);
4
4
  const directory = args.find((arg) => !arg.startsWith('-')) ?? '';
5
+ const dryRun = args.includes('--dry-run');
6
+ const overwrite = args.includes('--overwrite');
7
+ const skipExisting = args.includes('--skip-existing');
5
8
  const install = !args.includes('--no-install');
9
+ const verify = install && !args.includes('--no-verify');
6
10
  process.exitCode = await create({
7
11
  directory,
8
- dryRun: args.includes('--dry-run'),
9
- overwrite: args.includes('--overwrite'),
10
- skipExisting: args.includes('--skip-existing'),
12
+ dryRun,
13
+ overwrite,
14
+ skipExisting,
11
15
  install,
12
- verify: install && !args.includes('--no-verify'),
16
+ verify,
13
17
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vyriy/create",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "Vyriy project creation CLI.",
5
5
  "type": "module",
6
6
  "engines": {
@@ -9,7 +9,7 @@
9
9
  "packageManager": "yarn@4.15.0",
10
10
  "bin": "./bin/vyriy-create.js",
11
11
  "dependencies": {
12
- "@vyriy/check": "0.5.2"
12
+ "@vyriy/check": "0.5.3"
13
13
  },
14
14
  "peerDependencies": {
15
15
  "@testing-library/dom": "^10.4.1",
@@ -252,16 +252,6 @@
252
252
  "import": "./preset/rest.js",
253
253
  "default": "./preset/rest.js"
254
254
  },
255
- "./preset/shared": {
256
- "types": "./preset/shared.d.ts",
257
- "import": "./preset/shared.js",
258
- "default": "./preset/shared.js"
259
- },
260
- "./preset/shared.js": {
261
- "types": "./preset/shared.d.ts",
262
- "import": "./preset/shared.js",
263
- "default": "./preset/shared.js"
264
- },
265
255
  "./preset/spa": {
266
256
  "types": "./preset/spa.d.ts",
267
257
  "import": "./preset/spa.js",
package/preset/api.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { Preset } from './types.js';
1
+ import type { Preset } from './types.js';
2
2
  export declare const api: Preset;
package/preset/api.js CHANGED
@@ -1,15 +1,222 @@
1
- import { base } from './base.js';
2
- import { apiWorkspaceBaseFiles, baseToolingDeps, buildPackageJson, serverDeps, webpackDeps, workspaceScripts, } from './shared.js';
1
+ import { existsSync, readFileSync } from 'node:fs';
2
+ import { dirname, resolve } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ import packageJson from '../package.json' with { type: 'json' };
5
+ const presetDir = dirname(fileURLToPath(import.meta.url));
6
+ const agentsPath = [
7
+ resolve(presetDir, '../../../AGENTS.md'),
8
+ resolve(presetDir, '../../../../AGENTS.md'),
9
+ ].find(existsSync) ?? '';
10
+ const agentsContent = agentsPath ? readFileSync(agentsPath, 'utf8') : '';
3
11
  export const api = (options) => ({
4
- ...base(options),
5
- ...apiWorkspaceBaseFiles(options.name, options.description),
6
- 'package.json': buildPackageJson(options, [
7
- 'workspaces/*',
8
- ], workspaceScripts('api'), {
9
- ...baseToolingDeps(),
10
- ...webpackDeps(),
11
- ...serverDeps(),
12
- }),
12
+ 'package.json': JSON.stringify({
13
+ name: options.name,
14
+ version: '0.0.0',
15
+ description: options.description,
16
+ private: true,
17
+ type: 'module',
18
+ agents: './AGENTS.md',
19
+ packageManager: packageJson.packageManager,
20
+ engines: {
21
+ node: packageJson.engines.node,
22
+ },
23
+ workspaces: [
24
+ 'workspaces/*',
25
+ ],
26
+ scripts: {
27
+ storybook: 'cross-env STORYBOOK_DISABLE_TELEMETRY=1 storybook dev -p 6006 --disable-telemetry',
28
+ check: 'run-s lint build test',
29
+ fix: "run-s 'fix:*'",
30
+ start: "run-p 'start:*'",
31
+ lint: "run-s 'lint:*'",
32
+ build: "run-s 'build:*'",
33
+ test: "run-s 'test:*'",
34
+ 'fix:prettier': 'prettier . --write',
35
+ 'fix:eslint': 'eslint . --fix',
36
+ 'lint:ts': 'tsc',
37
+ 'lint:prettier': 'prettier . --check',
38
+ 'lint:eslint': 'eslint .',
39
+ 'build:storybook': 'cross-env STORYBOOK_DISABLE_TELEMETRY=1 storybook build --quiet --disable-telemetry',
40
+ 'test:jest': 'jest',
41
+ postinstall: 'husky',
42
+ 'start:api': 'sh workspaces/api/bin/start.sh',
43
+ 'build:api': 'rimraf dist && sh workspaces/api/bin/build.sh',
44
+ },
45
+ dependencies: {
46
+ '@vyriy/typescript-config': `^${packageJson.version}`,
47
+ typescript: packageJson.peerDependencies.typescript,
48
+ '@vyriy/prettier-config': `^${packageJson.version}`,
49
+ prettier: packageJson.peerDependencies.prettier,
50
+ '@vyriy/eslint-config': `^${packageJson.version}`,
51
+ eslint: packageJson.peerDependencies.eslint,
52
+ '@vyriy/jest-config': `^${packageJson.version}`,
53
+ jest: packageJson.peerDependencies.jest,
54
+ '@vyriy/storybook-config': `^${packageJson.version}`,
55
+ storybook: packageJson.peerDependencies.storybook,
56
+ '@vyriy/path': `^${packageJson.version}`,
57
+ husky: packageJson.peerDependencies.husky,
58
+ 'npm-run-all2': packageJson.peerDependencies['npm-run-all2'],
59
+ 'cross-env': packageJson.peerDependencies['cross-env'],
60
+ rimraf: packageJson.peerDependencies.rimraf,
61
+ '@vyriy/webpack-config': `^${packageJson.version}`,
62
+ tsx: packageJson.peerDependencies.tsx,
63
+ 'webpack-cli': packageJson.peerDependencies['webpack-cli'],
64
+ '@vyriy/handler': `^${packageJson.version}`,
65
+ '@vyriy/server': `^${packageJson.version}`,
66
+ },
67
+ }, null, 2) + '\n',
68
+ 'README.md': `# ${options.name}\n\n${options.description}\n`,
69
+ 'doc.mdx': `import { Meta, Markdown } from '@storybook/addon-docs/blocks';
70
+ import ReadMe from './README.md?raw';
71
+
72
+ <Meta title="${options.name}" />
73
+
74
+ <Markdown>{ReadMe}</Markdown>
75
+ `,
76
+ 'AGENTS.md': agentsContent,
77
+ '.editorconfig': `# https://editorconfig.org
78
+ root = true
79
+
80
+ [*]
81
+ charset = utf-8
82
+ end_of_line = lf
83
+ insert_final_newline = true
84
+ trim_trailing_whitespace = true
85
+
86
+ indent_style = space
87
+ indent_size = 2
88
+
89
+ max_line_length = 100
90
+
91
+ # Markdown
92
+ [*.md]
93
+ trim_trailing_whitespace = false
94
+ max_line_length = off
95
+
96
+ # YAML / YML
97
+ [*.{yml,yaml}]
98
+ indent_size = 2
99
+
100
+ # JSON
101
+ [*.json]
102
+ indent_size = 2
103
+
104
+ # TypeScript / JavaScript
105
+ [*.{ts,tsx,js,jsx}]
106
+ indent_size = 2
107
+
108
+ # Shell / Bash
109
+ [*.sh]
110
+ indent_size = 2
111
+ `,
112
+ '.gitignore': `.yarn/*
113
+ !.yarn/cache
114
+ !.yarn/patches
115
+ !.yarn/plugins
116
+ !.yarn/releases
117
+ !.yarn/sdks
118
+ !.yarn/versions
119
+
120
+ .DS_Store
121
+ .idea
122
+ node_modules
123
+ coverage
124
+ dist
125
+ storybook-static
126
+ *storybook.log
127
+ consumer
128
+
129
+ cdk.out
130
+ cdk.context.json
131
+
132
+ !/**/.gitkeep
133
+ `,
134
+ '.npmrc': 'engine-strict=true\n',
135
+ '.nvmrc': 'lts/krypton\n',
136
+ '.yarnrc.yml': 'nodeLinker: node-modules\nnpmMinimalAgeGate: 0\n',
137
+ '.husky/commit-msg': '#!/bin/sh\n',
138
+ '.husky/post-checkout': '#!/bin/sh\n\nyarn\n',
139
+ '.husky/post-merge': '#!/bin/sh\n\nyarn\n',
140
+ '.husky/pre-commit': '#!/bin/sh\n\nyarn check\n',
141
+ '.husky/pre-push': '#!/bin/sh\n\nyarn check\n',
142
+ '.storybook/main.ts': `import config from '@vyriy/storybook-config';
143
+ import { path } from '@vyriy/path';
144
+
145
+ export default {
146
+ ...config,
147
+ stories: [
148
+ path('**/*.mdx'),
149
+ path('**/*.stories.@(js|jsx|mjs|ts|tsx)'),
150
+ ],
151
+ };
152
+ `,
153
+ '.storybook/preview.tsx': "export { default } from '@vyriy/storybook-config/preview';\n",
154
+ 'yarn.lock': '',
155
+ 'tsconfig.json': JSON.stringify({
156
+ extends: '@vyriy/typescript-config/index.json',
157
+ include: [
158
+ '.storybook/**/*.ts',
159
+ '.storybook/**/*.tsx',
160
+ 'packages/**/*.ts',
161
+ 'packages/**/*.tsx',
162
+ 'workspaces/**/*.ts',
163
+ 'workspaces/**/*.tsx',
164
+ '*.ts',
165
+ ],
166
+ }, null, 2) + '\n',
167
+ 'prettier.config.ts': "export { default } from '@vyriy/prettier-config';\n",
168
+ '.prettierignore': 'node_modules\ndist\ncoverage\nstorybook-static\nconsumer\n',
169
+ 'eslint.config.ts': "export { default } from '@vyriy/eslint-config';\n",
170
+ 'jest.config.ts': "export { default } from '@vyriy/jest-config';\n",
171
+ 'workspaces/api/bin/build.sh': `#!/usr/bin/env sh
172
+
173
+ set -e
174
+
175
+ scriptdir="$PWD/workspaces/api";
176
+
177
+ NODE_ENV=production npx webpack --config $scriptdir/webpack.config.ts
178
+
179
+ cp $scriptdir/package.json dist/api/package.json
180
+ npm pkg delete "type" --prefix dist/api
181
+ npm pkg delete "private" --prefix dist/api
182
+ `,
183
+ 'workspaces/api/bin/start.sh': `#!/usr/bin/env sh
184
+
185
+ set -e
186
+
187
+ scriptdir="$PWD/workspaces/api";
188
+
189
+ NODE_ENV=production LOG_LEVEL=info tsx $scriptdir/index.ts
190
+ `,
191
+ 'workspaces/api/doc.mdx': `import { Meta, Markdown } from '@storybook/addon-docs/blocks';
192
+ import ReadMe from './README.md?raw';
193
+
194
+ <Meta title="Workspaces/API" />
195
+
196
+ <Markdown>{ReadMe}</Markdown>
197
+ `,
198
+ 'workspaces/api/README.md': `# ${options.name} API\n\n${options.description}\n`,
199
+ 'workspaces/api/webpack.config.ts': `import { path } from '@vyriy/path';
200
+ import { ssr, external } from '@vyriy/webpack-config';
201
+
202
+ export default ssr(
203
+ '@w/api',
204
+ {
205
+ path: path('dist', 'api'),
206
+ filename: 'index.js',
207
+ library: { type: 'commonjs2' },
208
+ },
209
+ (config) => ({
210
+ ...config,
211
+ externals: [external({ allowlist: [/^@p/, /^@w/, /^@vyriy/] })],
212
+ }),
213
+ );
214
+ `,
215
+ 'workspaces/api/package.json': JSON.stringify({
216
+ name: '@w/api',
217
+ type: 'module',
218
+ private: true,
219
+ }, null, 2) + '\n',
13
220
  'workspaces/api/index.ts': `import { server } from '@vyriy/server';
14
221
  import { api } from '@vyriy/handler';
15
222
 
package/preset/base.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { Preset } from './types.js';
1
+ import type { Preset } from './types.js';
2
2
  export declare const base: Preset;