create-zephyr-apps 0.0.8 → 0.0.41

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/.eslintignore ADDED
@@ -0,0 +1,3 @@
1
+ # test folders to clone repositories
2
+ test
3
+ test*
package/README.md CHANGED
@@ -1,18 +1,11 @@
1
- # create-zephyr-apps
1
+ # Create Zephyr Apps
2
2
 
3
- Recommend using node version 22.0.0 or above.
3
+ <div align="center">
4
4
 
5
- ```
6
- npx create-zephyr-apps@latest
7
- ```
5
+ [Zephyr Cloud](https://zephyr-cloud.io) | [Zephyr Docs](https://docs.zephyr-cloud.io) | [Discord](https://zephyr-cloud.io/discord) | [Twitter](https://x.com/ZephyrCloudIO) | [LinkedIn](https://www.linkedin.com/company/zephyr-cloud/)
8
6
 
9
- ## Todos
7
+ <hr/>
10
8
 
11
- - [ ] Move templates generation to local or using normal vite/rspack/react-native generation command
12
- - [ ] Add bundling options
13
- - [ ] Creating template file to make sure dependencies are up to date
14
- - [ ] Add Nx as an option for monorepo
15
- - [ ] Add package manager selector
16
- - [ ] Add tests
17
- - [ ] Add more documentation
18
- - [ ] Write a good readme
9
+ <a href="https://zephyr-cloud.io">
10
+ <img src="https://cdn.prod.website-files.com/669061ee3adb95b628c3acda/66981c766e352fe1f57191e2_Opengraph-zephyr.png" alt="Zephyr Logo" />
11
+ </a>
package/dist/index.js ADDED
@@ -0,0 +1,218 @@
1
+ #!/usr/bin/env node
2
+ var _a;
3
+ import { exec } from 'node:child_process';
4
+ import * as fs from 'node:fs';
5
+ import { homedir } from 'node:os';
6
+ import path from 'node:path';
7
+ import { setImmediate } from 'node:timers/promises';
8
+ import { promisify } from 'node:util';
9
+ import { cancel, confirm, intro, isCancel, log, note, select, spinner, text, } from '@clack/prompts';
10
+ import { getCatalogsFromWorkspaceManifest } from '@pnpm/catalogs.config';
11
+ import { resolveFromCatalog } from '@pnpm/catalogs.resolver';
12
+ import { readWorkspaceManifest } from '@pnpm/workspace.read-manifest';
13
+ import c from 'chalk-template';
14
+ import terminalLink from 'terminal-link';
15
+ import { ProjectTypes, Templates } from './templates.js';
16
+ const execAsync = promisify(exec);
17
+ // Immediate is required to avoid terminal image flickering
18
+ console.clear();
19
+ await setImmediate();
20
+ if (!process.stdout.isTTY) {
21
+ cancel('Please run this command in a TTY terminal.');
22
+ process.exit(1);
23
+ }
24
+ intro(c `Bootstrap your project using {cyan Zephyr}!`);
25
+ note(c `The only sane way to do micro-frontends\n{cyan https://docs.zephyr-cloud.io/}`, 'Zephyr Cloud');
26
+ let output = await text({
27
+ message: 'Where should we create your project?',
28
+ placeholder: './my-app',
29
+ validate(value) {
30
+ if (!value.trim().length) {
31
+ return 'Please enter a project name.';
32
+ }
33
+ return undefined;
34
+ },
35
+ });
36
+ if (isCancel(output)) {
37
+ cancel('Operation cancelled.');
38
+ process.exit(0);
39
+ }
40
+ output = path.resolve(output);
41
+ const relativeOutput = path.relative(process.cwd(), output) || './';
42
+ // ensures output is not a directory with contents
43
+ if (fs.existsSync(output)) {
44
+ const stats = fs.statSync(output);
45
+ if (!stats.isDirectory()) {
46
+ cancel(c `{cyan ${relativeOutput}} is not a directory.`);
47
+ process.exit(1);
48
+ }
49
+ const files = fs.readdirSync(output);
50
+ if (files.length > 0) {
51
+ cancel(c `Output directory {cyan ${relativeOutput}} must be empty.`);
52
+ process.exit(1);
53
+ }
54
+ }
55
+ const projectKind = await select({
56
+ message: 'What type of project you are creating?',
57
+ initialValue: (_a = ProjectTypes[0]) === null || _a === void 0 ? void 0 : _a.value,
58
+ options: ProjectTypes,
59
+ maxItems: 1,
60
+ });
61
+ if (isCancel(projectKind)) {
62
+ cancel('Operation cancelled.');
63
+ process.exit(0);
64
+ }
65
+ let examplesRepoName;
66
+ let subfolder;
67
+ if (projectKind === 'web') {
68
+ const template = await select({
69
+ message: 'Pick a template: ',
70
+ initialValue: 'react-rspack-mf',
71
+ options: Templates.map((temp) => ({
72
+ value: temp.name,
73
+ label: temp.label,
74
+ hint: temp.hint,
75
+ })),
76
+ });
77
+ if (isCancel(template)) {
78
+ cancel('Operation cancelled.');
79
+ process.exit(0);
80
+ }
81
+ examplesRepoName = 'zephyr-examples';
82
+ subfolder = `examples/${template}`;
83
+ }
84
+ else {
85
+ examplesRepoName = 'zephyr-repack-example';
86
+ subfolder = '';
87
+ }
88
+ const loading = spinner();
89
+ const tmpDir = path.resolve(homedir(), '.zephyr', examplesRepoName);
90
+ loading.start('Preparing temporary directory...');
91
+ if (!fs.existsSync(tmpDir)) {
92
+ // ensures the temporary directory exists
93
+ await fs.promises.mkdir(tmpDir, { recursive: true });
94
+ }
95
+ else {
96
+ // cleans the temporary directory
97
+ await fs.promises.rm(tmpDir, { recursive: true, force: true });
98
+ }
99
+ loading.message('Cloning example to temporary directory...');
100
+ try {
101
+ const { stderr } = await execAsync(`git clone --quiet --depth 1 https://github.com/ZephyrCloudIO/${examplesRepoName}.git -b main ${tmpDir}`, { encoding: 'utf8', timeout: 1000 * 60 * 5 });
102
+ if (stderr) {
103
+ loading.stop('Error cloning repository to temporary directory... ');
104
+ cancel(stderr);
105
+ process.exit(1);
106
+ }
107
+ loading.message(`Extracting template to ${relativeOutput}...`);
108
+ const pathToCopy = path.join(tmpDir, subfolder);
109
+ const dotGitPath = path.join(pathToCopy, '.git');
110
+ await fs.promises.cp(pathToCopy, output, {
111
+ recursive: true,
112
+ force: true,
113
+ dereference: true,
114
+ // skip .git folder
115
+ filter(source) {
116
+ return !source.startsWith(dotGitPath);
117
+ },
118
+ });
119
+ loading.message('Reading package.json...');
120
+ const pkgJson = await fs.promises
121
+ .readFile(path.join(output, 'package.json'), 'utf-8')
122
+ .then(JSON.parse);
123
+ // Monorepos uses pnpm catalogs
124
+ const manifest = await readWorkspaceManifest(tmpDir);
125
+ if (manifest && (manifest.catalog || manifest.catalogs)) {
126
+ loading.message('Replacing catalogs...');
127
+ const catalogs = getCatalogsFromWorkspaceManifest(manifest);
128
+ for (const field of [
129
+ 'dependencies',
130
+ 'devDependencies',
131
+ 'peerDependencies',
132
+ 'optionalDependencies',
133
+ 'bundledDependencies',
134
+ ]) {
135
+ if (!pkgJson[field]) {
136
+ continue;
137
+ }
138
+ for (const [alias, pref] of Object.entries(pkgJson[field])) {
139
+ const result = resolveFromCatalog(catalogs, { alias, pref });
140
+ switch (result.type) {
141
+ case 'found':
142
+ pkgJson[field][alias] = result.resolution.specifier;
143
+ break;
144
+ case 'misconfiguration':
145
+ throw result.error;
146
+ }
147
+ }
148
+ }
149
+ // Write the modified package.json back to the file
150
+ await fs.promises.writeFile(path.join(output, 'package.json'), JSON.stringify(pkgJson, null, 2));
151
+ }
152
+ loading.message('Cleaning up temporary directory...');
153
+ await fs.promises.rm(tmpDir, { recursive: true, force: true });
154
+ loading.stop(c `Project successfully created at {cyan ${relativeOutput}}!`);
155
+ }
156
+ catch (error) {
157
+ cancel(c `Error cloning repository to {cyan ${relativeOutput}}: ${error}`);
158
+ loading.stop('Error!', 1);
159
+ process.exit(1);
160
+ }
161
+ const shouldInitGit = await confirm({
162
+ message: 'Would you like to initialize a new Git repository?',
163
+ initialValue: true,
164
+ });
165
+ if (isCancel(shouldInitGit)) {
166
+ cancel('Operation cancelled');
167
+ process.exit(0);
168
+ }
169
+ if (shouldInitGit) {
170
+ // Initialize the repository.
171
+ await execAsync('git init', { cwd: output });
172
+ // Set temporary Git user configuration.
173
+ await execAsync('git config user.email "zephyrbot@zephyr-cloud.io"', {
174
+ cwd: output,
175
+ });
176
+ await execAsync('git config user.name "Zephyr Bot"', { cwd: output });
177
+ // Stage all files and commit them.
178
+ await execAsync('git add .', { cwd: output });
179
+ await execAsync('git commit --no-gpg-sign -m "Initial commit from Zephyr"', {
180
+ cwd: output,
181
+ });
182
+ // Remove the temporary local Git configuration so that the user's global
183
+ // settings will be used for future commits.
184
+ await execAsync('git config --unset user.email', { cwd: output });
185
+ await execAsync('git config --unset user.name', { cwd: output });
186
+ }
187
+ else {
188
+ log.warn('Zephyr requires a Git repository to work properly, please create it manually afterwards.');
189
+ }
190
+ const repoName = path.basename(output);
191
+ if (projectKind === 'web') {
192
+ note(`
193
+ cd ./${repoName}
194
+ pnpm install
195
+ pnpm run build
196
+ `.trim(), 'Run the application!');
197
+ }
198
+ else {
199
+ note(c `
200
+ cd ./${repoName}
201
+ pnpm install
202
+ git remote add origin https://github.com/{cyan <name>}/{cyan ${repoName}}.git
203
+ {cyan ZC=1} pnpm start
204
+ `.trim(), 'Run the application!');
205
+ note(c `
206
+ Make sure to commit and add a remote to the remote repository!
207
+ Read more about how Module Federation works with Zephyr:
208
+ - {cyan https://docs.zephyr-cloud.io/how-to/mf-guide}
209
+ `.trim(), 'Read more about Module Federation');
210
+ }
211
+ note(c `
212
+ - {cyan ${terminalLink('Discord', 'https://zephyr-cloud.io/discord')}}
213
+ - {cyan ${terminalLink('Documentation', projectKind === 'web'
214
+ ? 'https://docs.zephyr-cloud.io/recipes'
215
+ : 'https://docs.zephyr-cloud.io/recipes/repack-mf')}}
216
+ - {cyan ${terminalLink('Open an issue', 'https://github.com/ZephyrCloudIO/zephyr-packages/issues')}}
217
+ `.trim(), 'Next steps.');
218
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EACL,MAAM,EACN,OAAO,EACP,KAAK,EACL,QAAQ,EACR,GAAG,EACH,IAAI,EACJ,MAAM,EACN,OAAO,EACP,IAAI,GACL,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE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,CAAC;AAEvC,IAAI,WAAW,KAAK,KAAK,EAAE,CAAC;IAC1B,IAAI,CACF;OACG,QAAQ;;;CAGd,CAAC,IAAI,EAAE,EACJ,sBAAsB,CACvB,CAAC;AACJ,CAAC;KAAM,CAAC;IACN,IAAI,CACF,CAAC,CAAA;OACE,QAAQ;;+DAEgD,QAAQ;;CAEtE,CAAC,IAAI,EAAE,EACJ,sBAAsB,CACvB,CAAC;IAEF,IAAI,CACF,CAAC,CAAA;;;;KAIA,CAAC,IAAI,EAAE,EACR,mCAAmC,CACpC,CAAC;AACJ,CAAC;AAED,IAAI,CACF,CAAC,CAAA;UACO,YAAY,CAAC,SAAS,EAAE,iCAAiC,CAAC;UAC1D,YAAY,CAClB,eAAe,EACf,WAAW,KAAK,KAAK;IACnB,CAAC,CAAC,sCAAsC;IACxC,CAAC,CAAC,gDAAgD,CACrD;UACO,YAAY,CAClB,eAAe,EACf,yDAAyD,CAC1D;CACF,CAAC,IAAI,EAAE,EACN,aAAa,CACd,CAAC"}
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "create-zephyr-apps",
3
+ "version": "0.0.41",
4
+ "description": "A CLI tool to create web applications using Zephyr.",
5
+ "keywords": [
6
+ "zephyr",
7
+ "create-zephyr-apps",
8
+ "zephyr-apps",
9
+ "zephyr-cli",
10
+ "zephyr-example",
11
+ "zephyr-template",
12
+ "example",
13
+ "template"
14
+ ],
15
+ "license": "Apache-2.0",
16
+ "author": {
17
+ "name": "ZephyrCloudIO",
18
+ "url": "https://github.com/ZephyrCloudIO"
19
+ },
20
+ "type": "module",
21
+ "main": "dist/index.js",
22
+ "types": "dist/index.d.ts",
23
+ "bin": "dist/index.js",
24
+ "scripts": {
25
+ "build": "nx run create-zephyr-apps:build",
26
+ "dev": "tsx src/index.ts",
27
+ "patch-version": "pnpm version"
28
+ },
29
+ "dependencies": {
30
+ "@clack/prompts": "0.10.1",
31
+ "@pnpm/catalogs.config": "1000.0.2",
32
+ "@pnpm/catalogs.resolver": "1000.0.2",
33
+ "@pnpm/workspace.read-manifest": "1000.1.3",
34
+ "chalk-template": "1.1.0",
35
+ "terminal-link": "^4.0.0"
36
+ },
37
+ "devDependencies": {
38
+ "@types/jest": "catalog:typescript",
39
+ "@types/node": "catalog:typescript",
40
+ "@typescript-eslint/eslint-plugin": "catalog:eslint",
41
+ "ts-jest": "catalog:typescript",
42
+ "tsx": "^4.19.3",
43
+ "typescript": "catalog:typescript"
44
+ },
45
+ "module": "./index.js"
46
+ }
@@ -0,0 +1,10 @@
1
+ export declare const ProjectTypes: {
2
+ value: string;
3
+ label: string;
4
+ hint: string;
5
+ }[];
6
+ export declare const Templates: {
7
+ name: string;
8
+ label: string;
9
+ hint: string;
10
+ }[];
@@ -0,0 +1,71 @@
1
+ export const ProjectTypes = [
2
+ {
3
+ value: 'web',
4
+ label: 'Web',
5
+ hint: 'You will be choosing from a selection of templates provided by us.',
6
+ },
7
+ {
8
+ value: 'react-native',
9
+ label: 'React Native',
10
+ hint: 'This is a comprehensive example project provided by us. You will be building React Native powered by Re.Pack.',
11
+ },
12
+ ];
13
+ // TODO: Programmatically load templates from the examples repo after cloning it
14
+ export const Templates = [
15
+ {
16
+ name: 'angular-vite',
17
+ label: 'Angular app with Vite',
18
+ hint: 'You will be building an Angular app powered by Vite.',
19
+ },
20
+ {
21
+ name: 'modernjs-app',
22
+ label: 'ModernJS',
23
+ hint: 'A simple ModernJS app.',
24
+ },
25
+ {
26
+ name: 'qwik-1.5',
27
+ label: 'Qwik + Vite',
28
+ hint: 'A Qwik v1.5 app using Vite as the bundler.',
29
+ },
30
+ {
31
+ name: 'react-rspack-tractor-2.0',
32
+ label: 'React + Rspack + Tractor 2.0',
33
+ hint: 'A React application using Rspack as the bundler and Tractor 2.0 as the module federation manager.',
34
+ },
35
+ {
36
+ name: 'react-vite-mf',
37
+ label: 'React + Vite + Webpack + Rspack',
38
+ hint: 'You will be building federated React apps powered by Vite, Webpack and Rspack.',
39
+ },
40
+ {
41
+ name: 'react-vite-ts',
42
+ label: 'A simple React application build by Vite',
43
+ hint: 'You will be building React app powered by Vite.',
44
+ },
45
+ {
46
+ name: 'rolldown-react',
47
+ label: 'React + Rolldown',
48
+ hint: 'A React example using Rolldown.',
49
+ },
50
+ {
51
+ name: 'rspack-project',
52
+ label: 'React + Rspack',
53
+ hint: 'A simple application build by Rspack.',
54
+ },
55
+ {
56
+ name: 'solid',
57
+ label: 'Solid + Vite',
58
+ hint: 'A Solid app using Vite as the bundler.',
59
+ },
60
+ {
61
+ name: 'svelte',
62
+ label: 'Svelte + Vite',
63
+ hint: 'A Svelte app using Vite as the bundler.',
64
+ },
65
+ {
66
+ name: 'turbo-rspack-mf',
67
+ label: 'Turbo + Rspack + Module Federation',
68
+ hint: 'A monorepo using Turborepo, React, and Rspack as the bundler.',
69
+ },
70
+ ].sort((a, b) => a.name.localeCompare(b.name));
71
+ //# sourceMappingURL=templates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.js","sourceRoot":"","sources":["../src/templates.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B;QACE,KAAK,EAAE,KAAK;QACZ,KAAK,EAAE,KAAK;QACZ,IAAI,EAAE,oEAAoE;KAC3E;IACD;QACE,KAAK,EAAE,cAAc;QACrB,KAAK,EAAE,cAAc;QACrB,IAAI,EAAE,+GAA+G;KACtH;CACF,CAAC;AAEF,gFAAgF;AAChF,MAAM,CAAC,MAAM,SAAS,GAAoD;IACxE;QACE,IAAI,EAAE,cAAc;QACpB,KAAK,EAAE,uBAAuB;QAC9B,IAAI,EAAE,sDAAsD;KAC7D;IACD;QACE,IAAI,EAAE,cAAc;QACpB,KAAK,EAAE,UAAU;QACjB,IAAI,EAAE,wBAAwB;KAC/B;IACD;QACE,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,aAAa;QACpB,IAAI,EAAE,4CAA4C;KACnD;IACD;QACE,IAAI,EAAE,0BAA0B;QAChC,KAAK,EAAE,8BAA8B;QACrC,IAAI,EAAE,mGAAmG;KAC1G;IACD;QACE,IAAI,EAAE,eAAe;QACrB,KAAK,EAAE,iCAAiC;QACxC,IAAI,EAAE,gFAAgF;KACvF;IACD;QACE,IAAI,EAAE,eAAe;QACrB,KAAK,EAAE,0CAA0C;QACjD,IAAI,EAAE,iDAAiD;KACxD;IACD;QACE,IAAI,EAAE,gBAAgB;QACtB,KAAK,EAAE,kBAAkB;QACzB,IAAI,EAAE,iCAAiC;KACxC;IACD;QACE,IAAI,EAAE,gBAAgB;QACtB,KAAK,EAAE,gBAAgB;QACvB,IAAI,EAAE,uCAAuC;KAC9C;IACD;QACE,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,cAAc;QACrB,IAAI,EAAE,wCAAwC;KAC/C;IACD;QACE,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,eAAe;QACtB,IAAI,EAAE,yCAAyC;KAChD;IACD;QACE,IAAI,EAAE,iBAAiB;QACvB,KAAK,EAAE,oCAAoC;QAC3C,IAAI,EAAE,+DAA+D;KACtE;CACF,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,18 +1,7 @@
1
1
  {
2
2
  "name": "create-zephyr-apps",
3
- "module": "./src/index.ts",
4
- "version": "0.0.8",
5
- "type": "module",
6
- "author": {
7
- "name": "ZephyrCloudIO",
8
- "url": "https://github.com/ZephyrCloudIO"
9
- },
10
- "bin": {
11
- "create-zephyr-apps": "dist/index.mjs"
12
- },
13
- "engines": {
14
- "node": ">=18"
15
- },
3
+ "version": "0.0.41",
4
+ "description": "A CLI tool to create web applications using Zephyr.",
16
5
  "keywords": [
17
6
  "zephyr",
18
7
  "create-zephyr-apps",
@@ -23,40 +12,34 @@
23
12
  "example",
24
13
  "template"
25
14
  ],
26
- "lint-staged": {
27
- "*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}": [
28
- "biome check --files-ignore-unknown=true"
29
- ]
30
- },
31
- "simple-git-hooks": {
32
- "pre-commit": "npx lint-staged"
33
- },
34
- "scripts": {
35
- "build": "rslib build",
36
- "dev": "tsx package/index.ts",
37
- "lint": "biome check",
38
- "fix": "biome format && biome check --fix --unsafe"
15
+ "license": "Apache-2.0",
16
+ "author": {
17
+ "name": "ZephyrCloudIO",
18
+ "url": "https://github.com/ZephyrCloudIO"
39
19
  },
20
+ "type": "module",
21
+ "main": "dist/index.js",
22
+ "types": "dist/index.d.ts",
23
+ "bin": "dist/index.js",
40
24
  "dependencies": {
41
- "@clack/core": "^0.4.1",
42
- "@clack/prompts": "^0.9.1",
43
- "chalk": "^5.4.1",
44
- "picocolors": "^1.1.1",
45
- "tempy": "^3.1.0"
25
+ "@clack/prompts": "0.10.1",
26
+ "@pnpm/catalogs.config": "1000.0.2",
27
+ "@pnpm/catalogs.resolver": "1000.0.2",
28
+ "@pnpm/workspace.read-manifest": "1000.1.3",
29
+ "chalk-template": "1.1.0",
30
+ "terminal-link": "^4.0.0"
46
31
  },
47
32
  "devDependencies": {
48
- "lint-staged": "^15.4.3",
49
- "simple-git-hooks": "^2.11.1",
50
- "@biomejs/biome": "1.9.4",
51
- "@rslib/core": "^0.3.2",
52
- "@types/degit": "^2.8.6",
53
- "@types/node": "^22.10.7",
54
- "ts-node": "^10.9.2",
55
- "tsx": "^4.19.2",
56
- "typescript": "^5.7.3"
33
+ "@types/jest": "29.5.14",
34
+ "@types/node": "^22.13.11",
35
+ "@typescript-eslint/eslint-plugin": "^8.27.0",
36
+ "ts-jest": "^29.2.6",
37
+ "tsx": "^4.19.3",
38
+ "typescript": "~5.8.2"
57
39
  },
58
- "peerDependencies": {
59
- "typescript": "^5.0.0"
60
- },
61
- "packageManager": "pnpm@9.15.0"
62
- }
40
+ "scripts": {
41
+ "build": "nx run create-zephyr-apps:build",
42
+ "dev": "tsx src/index.ts",
43
+ "patch-version": "pnpm version"
44
+ }
45
+ }
@@ -1,56 +0,0 @@
1
- name: pull_request
2
-
3
- on:
4
- pull_request:
5
- workflow_dispatch:
6
- inputs:
7
- branch:
8
- description: "Branch to run workflow on"
9
- required: true
10
- default: "main"
11
-
12
- env:
13
- NX_BRANCH: ${{ github.event.number || github.ref_name }}
14
- NODE_VERSION: 18
15
-
16
- concurrency:
17
- group: ${{ github.workflow }}-${{ github.ref }}
18
- cancel-in-progress: true
19
-
20
- jobs:
21
- cache:
22
- runs-on: ubuntu-latest
23
- steps:
24
- - uses: actions/checkout@v4
25
- with:
26
- fetch-depth: 0
27
- - uses: pnpm/action-setup@v4
28
-
29
- - name: Setup Node.js
30
- uses: actions/setup-node@v3
31
- with:
32
- node-version-file: ".nvmrc"
33
- cache: "pnpm"
34
- - run: pnpm i --frozen-lockfile
35
-
36
- lint:
37
- needs: cache
38
- runs-on: ubuntu-latest
39
- steps:
40
- - uses: actions/checkout@v4
41
- with:
42
- fetch-depth: 0
43
- - uses: nrwl/nx-set-shas@v4
44
- - uses: pnpm/action-setup@v4
45
-
46
- - name: Setup Node.js
47
- uses: actions/setup-node@v3
48
- with:
49
- node-version-file: ".nvmrc"
50
- cache: "pnpm"
51
-
52
- - name: Install dependencies
53
- run: pnpm i --frozen-lockfile
54
-
55
- - name: Lint
56
- run: pnpm lint
package/.nvmrc DELETED
@@ -1 +0,0 @@
1
- 22.0.0
@@ -1,75 +0,0 @@
1
- {
2
- "files.associations": {
3
- ".code-workspace": "jsonc",
4
- ".stylelintrc": "jsonc",
5
- "stylelintrc": "jsonc",
6
- "README": "markdown"
7
- },
8
- "search.useIgnoreFiles": true,
9
- "search.exclude": {
10
- "**/dist": true,
11
- "**/*.log": true,
12
- "**/*.pid": true,
13
- "**/.git": true,
14
- "**/node_modules": true
15
- },
16
- "files.eol": "\n",
17
- "files.trimTrailingWhitespace": true,
18
- "files.insertFinalNewline": true,
19
- //
20
- "javascript.validate.enable": false,
21
- "typescript.validate.enable": true,
22
- "css.validate": false,
23
- "[css]": {
24
- "editor.formatOnType": true,
25
- "editor.formatOnPaste": true,
26
- "editor.formatOnSave": true
27
- },
28
- "editor.codeActionsOnSave": {
29
- "quickfix.biome": "explicit"
30
- },
31
- "editor.defaultFormatter": "biomejs.biome",
32
- "editor.formatOnSave": true,
33
- "[typescript]": {
34
- "editor.defaultFormatter": "biomejs.biome",
35
- "editor.codeActionsOnSave": {
36
- "quickfix.biome": "explicit",
37
- "source.organizeImports": "never",
38
- "source.organizeImports.biome": "explicit"
39
- }
40
- },
41
- "[typescriptreact]": {
42
- "editor.defaultFormatter": "biomejs.biome",
43
- "editor.codeActionsOnSave": {
44
- "quickfix.biome": "explicit",
45
- "source.organizeImports": "never",
46
- "source.organizeImports.biome": "explicit"
47
- }
48
- },
49
- "[json]": {
50
- "editor.defaultFormatter": "biomejs.biome"
51
- },
52
- "[jsonc]": {
53
- "editor.defaultFormatter": "biomejs.biome"
54
- },
55
- "[javascriptreact]": {
56
- "editor.defaultFormatter": "biomejs.biome",
57
- "editor.codeActionsOnSave": {
58
- "quickfix.biome": "explicit",
59
- "source.organizeImports": "never",
60
- "source.organizeImports.biome": "explicit"
61
- }
62
- },
63
- "[javascript]": {
64
- "editor.defaultFormatter": "biomejs.biome",
65
- "editor.codeActionsOnSave": {
66
- "quickfix.biome": "explicit",
67
- "source.organizeImports": "never",
68
- "source.organizeImports.biome": "explicit"
69
- }
70
- },
71
- "typescript.tsdk": "node_modules/typescript/lib",
72
- "[github-actions-workflow]": {
73
- "editor.defaultFormatter": "esbenp.prettier-vscode"
74
- }
75
- }
package/biome.json DELETED
@@ -1,37 +0,0 @@
1
- {
2
- "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
3
- "vcs": {
4
- "enabled": true,
5
- "defaultBranch": "main",
6
- "clientKind": "git",
7
- "useIgnoreFile": true
8
- },
9
- "formatter": {
10
- "enabled": true,
11
- "indentStyle": "space"
12
- },
13
- "javascript": {
14
- "formatter": {
15
- "quoteStyle": "single",
16
- "arrowParentheses": "asNeeded",
17
- "jsxQuoteStyle": "double",
18
- "lineWidth": 80
19
- }
20
- },
21
- "linter": {
22
- "enabled": true,
23
- "rules": {
24
- "recommended": true,
25
- "suspicious": {
26
- "noDuplicateFontNames": "off"
27
- }
28
- }
29
- },
30
- "organizeImports": {
31
- "enabled": true
32
- },
33
- "files": {
34
- "ignoreUnknown": true,
35
- "ignore": [".vscode/**/*", "node_modules/**/*", "dist/**/*"]
36
- }
37
- }