@icebreakers/monorepo-templates 0.1.0 → 0.1.2

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/README.md CHANGED
@@ -4,6 +4,5 @@ Template assets and metadata used by `create-icebreaker` and `@icebreakers/monor
4
4
 
5
5
  This package ships:
6
6
 
7
- - `skeleton/`: minimal root workspace config files
8
7
  - `templates/`: app and package templates
9
- - `assets/`: upgrade assets for `monorepo`
8
+ - `assets/`: root workspace config files and upgrade assets for `monorepo`
@@ -74,7 +74,7 @@
74
74
  "tslib": "^2.8.1",
75
75
  "tsup": "^8.5.1",
76
76
  "tsx": "^4.21.0",
77
- "turbo": "^2.7.4",
77
+ "turbo": "^2.7.5",
78
78
  "type-fest": "^5.4.1",
79
79
  "typescript": "^5.9.3",
80
80
  "unbuild": "^3.6.1",
package/dist/index.d.mts CHANGED
@@ -4,11 +4,23 @@ import input from "@inquirer/input";
4
4
  import select from "@inquirer/select";
5
5
  import { Command, program } from "commander";
6
6
 
7
+ //#region src/types.d.ts
8
+ interface TemplateChoice {
9
+ key: string;
10
+ label: string;
11
+ source: string;
12
+ target: string;
13
+ }
14
+ interface TemplateDefinition {
15
+ source: string;
16
+ target: string;
17
+ }
18
+ //#endregion
7
19
  //#region src/paths.d.ts
8
20
  declare const packageDir: string;
9
21
  declare const templatesDir: string;
10
- declare const skeletonDir: string;
11
22
  declare const assetsDir: string;
23
+ declare const skeletonDir: string;
12
24
  //#endregion
13
25
  //#region src/prepare.d.ts
14
26
  interface PrepareAssetsOptions {
@@ -17,6 +29,28 @@ interface PrepareAssetsOptions {
17
29
  }
18
30
  declare function prepareAssets(options?: PrepareAssetsOptions): Promise<void>;
19
31
  //#endregion
32
+ //#region src/scaffold.d.ts
33
+ type TargetMode = 'prepare' | 'ensure' | 'skip';
34
+ interface ScaffoldTemplateOptions {
35
+ sourceDir: string;
36
+ targetDir: string;
37
+ ensureTargetDir?: boolean;
38
+ filter?: (src: string) => boolean;
39
+ renameEntry?: (name: string) => string;
40
+ skipRootBasenames?: string[];
41
+ }
42
+ interface ScaffoldWorkspaceOptions {
43
+ targetDir: string;
44
+ templateKeys?: string[];
45
+ assetsDir?: string;
46
+ templatesDir?: string;
47
+ includeAssets?: boolean;
48
+ targetMode?: TargetMode;
49
+ force?: boolean;
50
+ }
51
+ declare function scaffoldTemplate(options: ScaffoldTemplateOptions): Promise<void>;
52
+ declare function scaffoldWorkspace(options: ScaffoldWorkspaceOptions): Promise<void>;
53
+ //#endregion
20
54
  //#region src/utils/command.d.ts
21
55
  interface RunCommandOptions {
22
56
  cwd?: string;
@@ -33,12 +67,6 @@ declare function shouldSkipTemplatePath(rootDir: string, targetPath: string): bo
33
67
  declare function createTemplateCopyFilter(rootDir: string): (src: string) => boolean;
34
68
  //#endregion
35
69
  //#region src/index.d.ts
36
- interface TemplateChoice {
37
- key: string;
38
- label: string;
39
- source: string;
40
- target: string;
41
- }
42
70
  declare const templateChoices: TemplateChoice[];
43
71
  declare const assetTargets: string[];
44
72
  declare const getAssetTargets: (core?: boolean) => string[];
@@ -46,4 +74,4 @@ declare const templateSourceMap: Record<string, string>;
46
74
  declare const templateTargetMap: Record<string, string>;
47
75
  declare const templateMap: Record<string, string>;
48
76
  //#endregion
49
- export { Command, TemplateChoice, assetTargets, assetsDir, checkbox, createTemplateCopyFilter, execaCommand, getAssetTargets, input, isGitignoreFile, packageDir, prepareAssets, program, runCommand, select, shouldSkipTemplatePath, skeletonDir, templateChoices, templateMap, templateSourceMap, templateTargetMap, templatesDir, toPublishGitignorePath, toWorkspaceGitignorePath };
77
+ export { Command, type TemplateChoice, type TemplateDefinition, assetTargets, assetsDir, checkbox, createTemplateCopyFilter, execaCommand, getAssetTargets, input, isGitignoreFile, packageDir, prepareAssets, program, runCommand, scaffoldTemplate, scaffoldWorkspace, select, shouldSkipTemplatePath, skeletonDir, templateChoices, templateMap, templateSourceMap, templateTargetMap, templatesDir, toPublishGitignorePath, toWorkspaceGitignorePath };
package/dist/index.mjs CHANGED
@@ -101,8 +101,8 @@ const templateChoices$1 = [
101
101
  //#region src/paths.ts
102
102
  const packageDir = path$1.resolve(fileURLToPath(new URL("../", import.meta.url)));
103
103
  const templatesDir = path$1.join(packageDir, "templates");
104
- const skeletonDir = path$1.join(packageDir, "skeleton");
105
104
  const assetsDir = path$1.join(packageDir, "assets");
105
+ const skeletonDir = assetsDir;
106
106
 
107
107
  //#endregion
108
108
  //#region src/utils/gitignore.ts
@@ -151,6 +151,7 @@ const skipDirs = new Set([
151
151
  ]);
152
152
  const skipFiles = new Set([
153
153
  ".DS_Store",
154
+ "CHANGELOG.md",
154
155
  "typed-router.d.ts",
155
156
  "worker-configuration.d.ts"
156
157
  ]);
@@ -171,22 +172,6 @@ function createTemplateCopyFilter(rootDir) {
171
172
 
172
173
  //#endregion
173
174
  //#region src/prepare.ts
174
- const skeletonFiles = [
175
- ".editorconfig",
176
- ".gitignore",
177
- ".npmrc",
178
- "package.json",
179
- "pnpm-workspace.yaml",
180
- "turbo.json",
181
- "tsconfig.json",
182
- "eslint.config.js",
183
- "stylelint.config.js",
184
- "vitest.config.ts",
185
- "commitlint.config.ts",
186
- "lint-staged.config.js",
187
- "renovate.json",
188
- "LICENSE"
189
- ];
190
175
  async function pathExists(targetPath) {
191
176
  try {
192
177
  await fs.access(targetPath);
@@ -240,13 +225,6 @@ async function copyEntry(from, to, overwriteExisting, filter) {
240
225
  throw error;
241
226
  }
242
227
  }
243
- async function copySkeleton(repoRoot, overwriteExisting) {
244
- for (const file of skeletonFiles) {
245
- const from = path$1.join(repoRoot, file);
246
- if (!await pathExists(from)) continue;
247
- await copyEntry(from, path$1.join(skeletonDir, toPublishGitignorePath(file)), overwriteExisting);
248
- }
249
- }
250
228
  async function copyAssets(repoRoot, overwriteExisting) {
251
229
  for (const target of assetTargets$1) {
252
230
  const from = path$1.join(repoRoot, target);
@@ -273,12 +251,88 @@ async function prepareAssets(options = {}) {
273
251
  if (!await pathExists(path$1.join(repoRoot, "templates"))) return;
274
252
  await resetDir(assetsDir, overwriteExisting);
275
253
  await resetDir(templatesDir, overwriteExisting);
276
- await resetDir(skeletonDir, overwriteExisting);
277
- await copySkeleton(repoRoot, overwriteExisting);
278
254
  await copyAssets(repoRoot, overwriteExisting);
279
255
  await copyTemplates(repoRoot, overwriteExisting);
280
256
  }
281
257
 
258
+ //#endregion
259
+ //#region src/scaffold.ts
260
+ async function isEmptyDir(dir) {
261
+ try {
262
+ return (await fs.readdir(dir)).length === 0;
263
+ } catch (error) {
264
+ if (error && error.code === "ENOENT") return true;
265
+ throw error;
266
+ }
267
+ }
268
+ async function prepareTargetDir(dir, options = {}) {
269
+ if (await isEmptyDir(dir)) {
270
+ await fs.mkdir(dir, { recursive: true });
271
+ return;
272
+ }
273
+ if (!options.force) throw new Error(`Target directory ${dir} is not empty. Pass --force to overwrite.`);
274
+ await fs.rm(dir, {
275
+ recursive: true,
276
+ force: true
277
+ });
278
+ await fs.mkdir(dir, { recursive: true });
279
+ }
280
+ async function copyDirContents(sourceDir, targetDir, options = {}) {
281
+ const rootDir = options.rootDir ?? sourceDir;
282
+ const filter = options.filter ?? ((src) => !shouldSkipTemplatePath(rootDir, src));
283
+ const renameEntry = options.renameEntry ?? toWorkspaceGitignorePath;
284
+ const skipRoot = new Set(options.skipRootBasenames ?? []);
285
+ await fs.mkdir(targetDir, { recursive: true });
286
+ const entries = await fs.readdir(sourceDir, { withFileTypes: true });
287
+ for (const entry of entries) {
288
+ if (sourceDir === rootDir && skipRoot.has(entry.name)) continue;
289
+ const from = path.join(sourceDir, entry.name);
290
+ if (!filter(from)) continue;
291
+ const targetName = renameEntry(entry.name);
292
+ const to = path.join(targetDir, targetName);
293
+ if (entry.isDirectory()) {
294
+ await copyDirContents(from, to, {
295
+ rootDir,
296
+ filter,
297
+ renameEntry,
298
+ skipRootBasenames: options.skipRootBasenames
299
+ });
300
+ continue;
301
+ }
302
+ if (entry.isSymbolicLink()) {
303
+ const link = await fs.readlink(from);
304
+ await fs.symlink(link, to);
305
+ continue;
306
+ }
307
+ await fs.cp(from, to);
308
+ }
309
+ }
310
+ async function scaffoldTemplate(options) {
311
+ const { sourceDir, targetDir, ensureTargetDir = true, filter, renameEntry, skipRootBasenames } = options;
312
+ if (ensureTargetDir) await fs.mkdir(targetDir, { recursive: true });
313
+ await copyDirContents(sourceDir, targetDir, {
314
+ rootDir: sourceDir,
315
+ filter,
316
+ renameEntry,
317
+ skipRootBasenames
318
+ });
319
+ }
320
+ async function scaffoldWorkspace(options) {
321
+ const { targetDir, templateKeys = [], assetsDir: assetsDir$1 = assetsDir, templatesDir: templatesDir$1 = templatesDir, includeAssets = true, targetMode = "prepare", force = false } = options;
322
+ if (targetMode === "prepare") await prepareTargetDir(targetDir, { force });
323
+ else if (targetMode === "ensure") await fs.mkdir(targetDir, { recursive: true });
324
+ if (includeAssets) await copyDirContents(assetsDir$1, targetDir, { rootDir: assetsDir$1 });
325
+ if (!templateKeys.length) return;
326
+ const selections = new Set(templateKeys);
327
+ for (const template of templateChoices$1) {
328
+ if (!selections.has(template.key)) continue;
329
+ await scaffoldTemplate({
330
+ sourceDir: path.join(templatesDir$1, template.source),
331
+ targetDir: path.join(targetDir, template.target)
332
+ });
333
+ }
334
+ }
335
+
282
336
  //#endregion
283
337
  //#region src/utils/command.ts
284
338
  async function runCommand(command, args, options = {}) {
@@ -298,4 +352,4 @@ const templateTargetMap = Object.fromEntries(templateChoices.map((item) => [item
298
352
  const templateMap = templateSourceMap;
299
353
 
300
354
  //#endregion
301
- export { Command, assetTargets, assetsDir, checkbox, createTemplateCopyFilter, execaCommand, getAssetTargets, input, isGitignoreFile, packageDir, prepareAssets, program, runCommand, select, shouldSkipTemplatePath, skeletonDir, templateChoices, templateMap, templateSourceMap, templateTargetMap, templatesDir, toPublishGitignorePath, toWorkspaceGitignorePath };
355
+ export { Command, assetTargets, assetsDir, checkbox, createTemplateCopyFilter, execaCommand, getAssetTargets, input, isGitignoreFile, packageDir, prepareAssets, program, runCommand, scaffoldTemplate, scaffoldWorkspace, select, shouldSkipTemplatePath, skeletonDir, templateChoices, templateMap, templateSourceMap, templateTargetMap, templatesDir, toPublishGitignorePath, toWorkspaceGitignorePath };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@icebreakers/monorepo-templates",
3
3
  "type": "module",
4
- "version": "0.1.0",
4
+ "version": "0.1.2",
5
5
  "description": "Template assets for icebreaker monorepo scaffolding",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -32,7 +32,6 @@
32
32
  "assets",
33
33
  "assets-data.mjs",
34
34
  "dist",
35
- "skeleton",
36
35
  "template-data.mjs",
37
36
  "templates"
38
37
  ],
@@ -53,7 +52,7 @@
53
52
  "dev": "tsdown --watch --sourcemap",
54
53
  "build": "tsdown",
55
54
  "typecheck": "tsc -p tsconfig.json",
56
- "sync:assets": "node scripts/sync-assets.mjs",
55
+ "sync:assets": "pnpm run build && node scripts/sync-assets.mjs",
57
56
  "lint": "eslint ."
58
57
  }
59
58
  }
@@ -4,9 +4,6 @@ export default icebreaker(
4
4
  {
5
5
  vue: true,
6
6
  typescript: true,
7
- tailwindcss: {
8
- entryPoint: 'src/style.css',
9
- },
10
7
  ignores: ['**/fixtures/**'],
11
8
  },
12
9
  )
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@icebreakers/vue-lib-template",
3
3
  "type": "module",
4
- "version": "0.0.0",
4
+ "version": "0.0.1",
5
5
  "description": "vue lib vite lib mode template",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "ISC",
@@ -16,15 +16,13 @@
16
16
  "keywords": [],
17
17
  "sideEffects": false,
18
18
  "exports": {
19
- ".": "./lib/index.ts"
19
+ ".": "./src/index.ts"
20
20
  },
21
21
  "files": [
22
22
  "dist"
23
23
  ],
24
24
  "scripts": {
25
- "dev": "vite",
26
25
  "build": "vue-tsc -b && vite build",
27
- "preview": "vite preview",
28
26
  "test": "vitest run",
29
27
  "test:dev": "vitest",
30
28
  "release": "pnpm publish",
@@ -45,17 +43,13 @@
45
43
  "types": "./dist/index.d.ts"
46
44
  },
47
45
  "devDependencies": {
48
- "@tailwindcss/vite": "^4.1.18",
49
46
  "@vitejs/plugin-vue": "^6.0.3",
50
47
  "@vue/test-utils": "^2.4.6",
51
48
  "@vue/tsconfig": "^0.8.1",
52
49
  "jsdom": "^27.4.0",
53
- "tailwindcss": "^4.1.18",
54
- "unplugin-vue-router": "^0.19.2",
55
50
  "vite": "^7.3.1",
56
51
  "vite-plugin-dts": "^4.5.4",
57
52
  "vue": "^3.5.26",
58
- "vue-router": "^4.6.4",
59
53
  "vue-tsc": "^3.2.2"
60
54
  }
61
55
  }
@@ -7,15 +7,16 @@ withDefaults(defineProps<{
7
7
  </script>
8
8
 
9
9
  <template>
10
- <div class="p-2">
11
- <div class="rounded-2xl p-2">
12
- {{ msg }}
13
- </div>
10
+ <div class="hello-world">
11
+ {{ msg }}
14
12
  </div>
15
13
  </template>
16
14
 
17
15
  <style scoped>
18
- .a {
19
- color: aliceblue;
16
+ .hello-world {
17
+ padding: 8px;
18
+ color: #222;
19
+ background: #f5f5f5;
20
+ border-radius: 12px;
20
21
  }
21
22
  </style>
@@ -1,3 +1,5 @@
1
1
  import HelloWorld from './HelloWorld.vue'
2
2
 
3
- export { HelloWorld }
3
+ export {
4
+ HelloWorld,
5
+ }
@@ -1,2 +1 @@
1
1
  /// <reference types="vite/client" />
2
- /// <reference types="unplugin-vue-router/client" />
@@ -1,5 +1,5 @@
1
1
  import { mount } from '@vue/test-utils'
2
- import HelloWorld from '../lib/HelloWorld.vue'
2
+ import HelloWorld from '../src/HelloWorld.vue'
3
3
 
4
4
  it('displays message', () => {
5
5
  const wrapper = mount(HelloWorld, {
@@ -5,9 +5,6 @@
5
5
  "paths": {
6
6
  "@/*": [
7
7
  "./src/*"
8
- ],
9
- "~/*": [
10
- "./lib/*"
11
8
  ]
12
9
  },
13
10
  /* Linting */
@@ -19,12 +16,8 @@
19
16
  "noUncheckedSideEffectImports": true
20
17
  },
21
18
  "include": [
22
- "lib/**/*.ts",
23
- "lib/**/*.tsx",
24
- "lib/**/*.vue",
25
19
  "src/**/*.ts",
26
20
  "src/**/*.tsx",
27
- "src/**/*.vue",
28
- "types"
21
+ "src/**/*.vue"
29
22
  ]
30
23
  }
@@ -14,9 +14,6 @@
14
14
  "paths": {
15
15
  "@/*": [
16
16
  "./src"
17
- ],
18
- "~/*": [
19
- "./lib"
20
17
  ]
21
18
  },
22
19
  "types": [
@@ -1,8 +1,6 @@
1
1
  import type { PluginOption, UserConfig } from 'vite'
2
- import Tailwindcss from '@tailwindcss/vite'
3
2
  import Vue from '@vitejs/plugin-vue'
4
3
  import path from 'pathe'
5
- import VueRouter from 'unplugin-vue-router/vite'
6
4
  import { mergeConfig } from 'vite'
7
5
  import DTS from 'vite-plugin-dts'
8
6
  import { sharedConfig } from './vite.shared.config'
@@ -12,28 +10,20 @@ const ensureVitePlugin = <T>(plugin: T) => plugin as unknown as PluginOption
12
10
 
13
11
  export default mergeConfig(sharedConfig, {
14
12
  plugins: [
15
- ensureVitePlugin(
16
- VueRouter(
17
- {
18
- dts: path.relative(import.meta.dirname, './types/typed-router.d.ts'),
19
- },
20
- ),
21
- ),
22
13
  ensureVitePlugin(Vue()),
23
14
  ensureVitePlugin(
24
15
  DTS(
25
16
  {
26
17
  tsconfigPath: './tsconfig.app.json',
27
- entryRoot: './lib',
18
+ entryRoot: './src',
28
19
  },
29
20
  ),
30
21
  ),
31
- ensureVitePlugin(Tailwindcss()),
32
22
  ],
33
23
  // https://vite.dev/guide/build.html#library-mode
34
24
  build: {
35
25
  lib: {
36
- entry: path.resolve(import.meta.dirname, 'lib/index'),
26
+ entry: path.resolve(import.meta.dirname, 'src/index'),
37
27
  name: 'icebreaker',
38
28
  // the proper extensions will be added
39
29
  fileName: 'index',
@@ -7,7 +7,6 @@ export const sharedConfig = defineConfig({
7
7
  resolve: {
8
8
  alias: {
9
9
  '@': path.resolve(import.meta.dirname, 'src'),
10
- '~': path.resolve(import.meta.dirname, 'lib'),
11
10
  },
12
11
  },
13
12
  })
@@ -1,12 +0,0 @@
1
- # EditorConfig is awesome: https://EditorConfig.org
2
-
3
- # top-most EditorConfig file
4
- root = true
5
-
6
- [*]
7
- indent_style = space
8
- indent_size = 2
9
- end_of_line = lf
10
- charset = utf-8
11
- trim_trailing_whitespace = false
12
- insert_final_newline = false
package/skeleton/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 ice breaker
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,3 +0,0 @@
1
- import { icebreaker } from '@icebreakers/commitlint-config'
2
-
3
- export default icebreaker()
@@ -1,7 +0,0 @@
1
- import { icebreaker } from '@icebreakers/eslint-config'
2
-
3
- export default icebreaker(
4
- {
5
- ignores: ['**/fixtures/**'],
6
- },
7
- )
@@ -1,38 +0,0 @@
1
- # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2
-
3
- # dependencies
4
- node_modules
5
- .pnp
6
- .pnp.js
7
-
8
- # testing
9
- coverage
10
-
11
- # next.js
12
- .next/
13
- out/
14
- build
15
-
16
- # misc
17
- .DS_Store
18
- *.pem
19
-
20
- # debug
21
- npm-debug.log*
22
- yarn-debug.log*
23
- yarn-error.log*
24
- .pnpm-debug.log*
25
-
26
- # local env files
27
- .env.local
28
- .env.development.local
29
- .env.test.local
30
- .env.production.local
31
-
32
- # turbo
33
- .turbo
34
-
35
- dist
36
- vite.config.ts.timestamp-*.mjs
37
- config.ts.timestamp-*.mjs
38
- .vite-inspect
@@ -1,11 +0,0 @@
1
- export default {
2
- '*.{js,jsx,mjs,ts,tsx,mts,vue}': [
3
- 'eslint --fix',
4
- ],
5
- '*.{json,md,mdx,css,html,yml,yaml,scss}': [
6
- // 'prettier --with-node-modules --ignore-path .prettierignore --write',
7
- 'eslint --fix',
8
- ],
9
- // for rust
10
- // '*.rs': ['cargo fmt --'],
11
- }
@@ -1,88 +0,0 @@
1
- {
2
- "name": "monorepo-template",
3
- "type": "module",
4
- "version": "0.0.0",
5
- "private": true,
6
- "packageManager": "pnpm@10.28.0",
7
- "author": "ice breaker <1324318532@qq.com>",
8
- "repository": {
9
- "type": "git",
10
- "url": "git+https://github.com/sonofmagic/monorepo-template.git"
11
- },
12
- "bugs": {
13
- "url": "https://github.com/sonofmagic/monorepo-template/issues"
14
- },
15
- "engines": {
16
- "node": ">=20.0.0"
17
- },
18
- "scripts": {
19
- "build": "turbo run build",
20
- "dev": "turbo run dev --parallel",
21
- "test": "vitest run",
22
- "test:dev": "vitest",
23
- "lint": "turbo run lint",
24
- "audit": "pnpm audit --audit-level=moderate",
25
- "audit:fix": "pnpm audit --fix",
26
- "typecheck": "turbo run typecheck",
27
- "format": "eslint . --fix",
28
- "validate": "pnpm run typecheck && pnpm run lint && pnpm run test",
29
- "release": "changeset",
30
- "publish-packages": "turbo run build lint test && changeset version && changeset publish",
31
- "------": "--------------",
32
- "preinstall": "npx only-allow pnpm",
33
- "prepare": "husky",
34
- "commit": "commit",
35
- "commitlint": "commitlint --edit",
36
- "-------": "---------------",
37
- "pr:alpha": "changeset pre enter alpha",
38
- "pr:beta": "changeset pre enter beta",
39
- "pr:rc": "changeset pre enter rc",
40
- "pr:exit": "changeset pre exit",
41
- "--------": "----------------",
42
- "script:init": "monorepo init",
43
- "script:sync": "monorepo sync",
44
- "script:clean": "monorepo clean",
45
- "script:mirror": "monorepo mirror"
46
- },
47
- "devDependencies": {
48
- "@changesets/cli": "^2.29.8",
49
- "@commitlint/cli": "^20.3.1",
50
- "@icebreakers/changelog-github": "^0.1.0",
51
- "@icebreakers/commitlint-config": "^1.2.5",
52
- "@icebreakers/eslint-config": "^1.6.13",
53
- "@icebreakers/monorepo": "workspace:*",
54
- "@icebreakers/stylelint-config": "^1.2.5",
55
- "@types/fs-extra": "^11.0.4",
56
- "@types/node": "^25.0.9",
57
- "@types/semver": "^7.7.1",
58
- "@vitest/coverage-v8": "~4.0.17",
59
- "ci-info": "^4.3.1",
60
- "cross-env": "^10.1.0",
61
- "defu": "^6.1.4",
62
- "es-toolkit": "^1.44.0",
63
- "eslint": "^9.39.2",
64
- "execa": "^9.6.1",
65
- "fs-extra": "^11.3.3",
66
- "husky": "^9.1.7",
67
- "lint-staged": "^16.2.7",
68
- "only-allow": "^1.2.2",
69
- "pathe": "^2.0.3",
70
- "pkg-types": "^2.3.0",
71
- "rimraf": "^6.1.2",
72
- "stylelint": "^17.0.0",
73
- "tsdown": "0.19.0",
74
- "tslib": "^2.8.1",
75
- "tsup": "^8.5.1",
76
- "tsx": "^4.21.0",
77
- "turbo": "^2.7.4",
78
- "type-fest": "^5.4.1",
79
- "typescript": "^5.9.3",
80
- "unbuild": "^3.6.1",
81
- "vitest": "~4.0.17",
82
- "yaml": "^2.8.2"
83
- },
84
- "publishConfig": {
85
- "access": "public",
86
- "registry": "https://registry.npmjs.org"
87
- }
88
- }
@@ -1,11 +0,0 @@
1
- packages:
2
- - apps/*
3
- - packages/*
4
- - templates/*
5
- - '!**/test/**'
6
-
7
- onlyBuiltDependencies:
8
- - '@tailwindcss/oxide'
9
- - esbuild
10
- - sharp
11
- - workerd
@@ -1,28 +0,0 @@
1
- {
2
- "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
- "extends": [
4
- "config:recommended",
5
- "group:allNonMajor",
6
- ":semanticCommitTypeAll(chore)"
7
- ],
8
- "commitBody": "[skip netlify]",
9
- "rangeStrategy": "bump",
10
- "npm": {
11
- "commitMessageTopic": "{{prettyDepType}} {{depName}}"
12
- },
13
- "ignoreDeps": [
14
- "node"
15
- ],
16
- "automerge": true,
17
- "automergeType": "pr",
18
- "packageRules": [
19
- {
20
- "matchUpdateTypes": [
21
- "minor",
22
- "patch",
23
- "pin",
24
- "digest"
25
- ]
26
- }
27
- ]
28
- }
@@ -1,3 +0,0 @@
1
- import { icebreaker } from '@icebreakers/stylelint-config'
2
-
3
- export default icebreaker()
@@ -1,51 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- // 指定 ECMAScript 目标版本,ESNext 表示支持最新的 ES 特性
4
- "target": "ESNext",
5
-
6
- // 指定模块系统,ESNext 使用原生 ES 模块 (import/export)
7
- "module": "ESNext",
8
-
9
- // 模块解析策略,Bundler 模式适用于打包工具(如 Vite、Webpack),支持更宽松的解析规则
10
- "moduleResolution": "Bundler",
11
-
12
- // 允许导入 .json 文件,并自动生成类型声明
13
- "resolveJsonModule": true,
14
-
15
- // 指定要包含的类型声明文件,node 提供 Node.js API 类型,vitest/globals 提供测试全局变量类型
16
- "types": [
17
- "node",
18
- "vitest/globals"
19
- ],
20
-
21
- // 允许编译 JavaScript 文件,使其可以被导入和进行类型检查
22
- "allowJs": true,
23
-
24
- // 启用所有严格类型检查选项,包括 noImplicitAny、strictNullChecks 等
25
- "strict": true,
26
-
27
- // 严格检查可选属性类型,区分 undefined 和缺失的属性
28
- "exactOptionalPropertyTypes": true,
29
-
30
- // 要求子类重写父类方法时必须使用 override 关键字
31
- "noImplicitOverride": true,
32
-
33
- // 禁止通过索引签名(如 obj['key'])访问未在索引签名中定义的属性
34
- "noPropertyAccessFromIndexSignature": true,
35
-
36
- // 访问索引签名时返回 undefined | T,而不是 T(防止未定义访问错误)
37
- "noUncheckedIndexedAccess": true,
38
-
39
- // 不生成输出文件(仅用于类型检查,实际由打包工具处理编译)
40
- "noEmit": true,
41
-
42
- // 允许从没有默认导出的模块中默认导入(如 import React from 'react')
43
- "allowSyntheticDefaultImports": true,
44
-
45
- // 启用 ES 模块互操作性,为 CommonJS 模块提供 synthetic default imports
46
- "esModuleInterop": true,
47
-
48
- // 跳过库文件的类型检查,提高编译速度(库文件通常已经有类型声明)
49
- "skipLibCheck": true
50
- }
51
- }
@@ -1,74 +0,0 @@
1
- {
2
- "$schema": "https://turborepo.com/schema.json",
3
- "tasks": {
4
- "build": {
5
- "dependsOn": [
6
- "^build"
7
- ],
8
- "inputs": [
9
- "src/**",
10
- "lib/**",
11
- "package.json",
12
- "tsconfig*.json",
13
- "*.config.{js,ts,mjs,mts}"
14
- ],
15
- "outputs": [
16
- "dist/**",
17
- "bin/**"
18
- ]
19
- },
20
- "lint": {
21
- "dependsOn": [
22
- "^lint"
23
- ],
24
- "inputs": [
25
- "src/**",
26
- "lib/**",
27
- "test/**",
28
- "*.config.{js,ts}",
29
- ".eslintrc*",
30
- ".stylelintrc*"
31
- ],
32
- "outputs": []
33
- },
34
- "dev": {
35
- "cache": false,
36
- "persistent": true
37
- },
38
- "test": {
39
- "dependsOn": [
40
- "^test"
41
- ],
42
- "inputs": [
43
- "src/**",
44
- "lib/**",
45
- "test/**",
46
- "package.json",
47
- "vitest.config.{js,ts}",
48
- "tsconfig*.json"
49
- ],
50
- "outputs": [
51
- "coverage/**"
52
- ]
53
- },
54
- "typecheck": {
55
- "dependsOn": [
56
- "^typecheck"
57
- ],
58
- "inputs": [
59
- "src/**",
60
- "lib/**",
61
- "test/**",
62
- "package.json",
63
- "tsconfig*.json"
64
- ],
65
- "outputs": []
66
- },
67
- "release": {
68
- "cache": false
69
- },
70
- "sync": {
71
- "cache": false
72
- }
73
- }
74
- }
@@ -1,123 +0,0 @@
1
- import fs from 'node:fs'
2
- import path from 'node:path'
3
- import { fileURLToPath } from 'node:url'
4
- import { defineConfig } from 'vitest/config'
5
- import YAML from 'yaml'
6
-
7
- const ROOT_DIR = path.dirname(fileURLToPath(new URL(import.meta.url)))
8
- const WORKSPACE_FILE = path.resolve(ROOT_DIR, 'pnpm-workspace.yaml')
9
- const CONFIG_FILENAMES = [
10
- 'vitest.config.ts',
11
- 'vitest.config.mts',
12
- 'vitest.config.cts',
13
- 'vitest.config.js',
14
- 'vitest.config.cjs',
15
- 'vitest.config.mjs',
16
- ] as const
17
-
18
- function extractBaseDirFromGlob(pattern: string): string | null {
19
- if (!pattern) {
20
- return null
21
- }
22
-
23
- const normalized = pattern
24
- .replace(/\\/g, '/')
25
- .replace(/^\.\//, '')
26
- const globIndex = normalized.search(/[*?[{]/)
27
- const base = globIndex === -1
28
- ? normalized
29
- : normalized.slice(0, globIndex)
30
-
31
- const cleaned = base.replace(/\/+$/, '')
32
- return cleaned || null
33
- }
34
-
35
- function loadProjectRootsFromWorkspace(): string[] {
36
- if (!fs.existsSync(WORKSPACE_FILE)) {
37
- return []
38
- }
39
-
40
- try {
41
- const workspaceContent = fs.readFileSync(WORKSPACE_FILE, 'utf8')
42
- const workspace = YAML.parse(workspaceContent) ?? {}
43
- const packages: unknown[] = Array.isArray(workspace.packages) ? workspace.packages : []
44
- const roots = packages
45
- .map(entry => typeof entry === 'string' ? entry.trim() : '')
46
- .filter(entry => entry && !entry.startsWith('!'))
47
- .map(extractBaseDirFromGlob)
48
- .filter((entry): entry is string => Boolean(entry))
49
-
50
- return roots.length ? Array.from(new Set(roots)) : []
51
- }
52
- catch (error) {
53
- console.warn('[vitest] Failed to parse pnpm-workspace.yaml, no project roots will be used.', error)
54
- return []
55
- }
56
- }
57
-
58
- const PROJECT_ROOTS = loadProjectRootsFromWorkspace()
59
-
60
- if (!PROJECT_ROOTS.length) {
61
- console.warn('[vitest] No project roots detected. Check pnpm-workspace.yaml to define workspace packages.')
62
- }
63
-
64
- function findConfig(basePath: string): string | null {
65
- for (const filename of CONFIG_FILENAMES) {
66
- const candidate = path.join(basePath, filename)
67
- if (fs.existsSync(candidate)) {
68
- return candidate
69
- }
70
- }
71
- return null
72
- }
73
-
74
- function resolveProjects(): string[] {
75
- const projects: string[] = []
76
-
77
- for (const folder of PROJECT_ROOTS) {
78
- const rootPath = path.resolve(ROOT_DIR, folder)
79
- if (!fs.existsSync(rootPath)) {
80
- continue
81
- }
82
-
83
- const rootConfig = findConfig(rootPath)
84
- if (rootConfig) {
85
- projects.push(rootConfig)
86
- }
87
-
88
- const entries = fs.readdirSync(rootPath, { withFileTypes: true })
89
- for (const entry of entries) {
90
- if (!entry.isDirectory()) {
91
- continue
92
- }
93
-
94
- const projectDir = path.join(rootPath, entry.name)
95
- const configPath = findConfig(projectDir)
96
- if (configPath) {
97
- projects.push(configPath)
98
- }
99
- }
100
- }
101
-
102
- return projects
103
- }
104
-
105
- const projects = resolveProjects()
106
-
107
- export default defineConfig(() => {
108
- return {
109
- test: {
110
- projects,
111
- coverage: {
112
- enabled: true,
113
- skipFull: true,
114
- exclude: [
115
- '**/dist/**',
116
- ],
117
- },
118
- forceRerunTriggers: [
119
- '**/{vitest,vite}.config.*/**',
120
- ],
121
- },
122
- }
123
- })
@@ -1,13 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>Vite + Vue + TS</title>
8
- </head>
9
- <body>
10
- <div id="app"></div>
11
- <script type="module" src="/src/main.ts"></script>
12
- </body>
13
- </html>
@@ -1,9 +0,0 @@
1
- <script setup lang="ts">
2
-
3
- </script>
4
-
5
- <template>
6
- <RouterView />
7
- </template>
8
-
9
- <style scoped></style>
@@ -1,8 +0,0 @@
1
- import { createApp } from 'vue'
2
- import App from './App.vue'
3
- import { router } from './router'
4
- import './style.css'
5
-
6
- const app = createApp(App)
7
- app.use(router)
8
- app.mount('#app')
@@ -1,7 +0,0 @@
1
- <script setup lang="ts">
2
- import { HelloWorld } from '~/index'
3
- </script>
4
-
5
- <template>
6
- <HelloWorld msg="Vite + Vue" />
7
- </template>
@@ -1,11 +0,0 @@
1
- import { createRouter, createWebHistory } from 'vue-router'
2
- import { handleHotUpdate, routes } from 'vue-router/auto-routes'
3
-
4
- export const router = createRouter({
5
- history: createWebHistory(),
6
- routes,
7
- })
8
-
9
- if (import.meta.hot) {
10
- handleHotUpdate(router)
11
- }
@@ -1 +0,0 @@
1
- @import 'tailwindcss';