@bagelink/workspace 1.10.4 → 1.10.6
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/bin/bgl.ts +2 -2
- package/dist/bin/bgl.cjs +3 -3
- package/dist/bin/bgl.mjs +3 -3
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +2 -2
- package/dist/shared/{workspace.BMua7RCN.cjs → workspace.DQ-r7Tja.cjs} +5 -5
- package/dist/shared/{workspace.wLxjK4CD.mjs → workspace.Dq4_YhqE.mjs} +9 -9
- package/package.json +1 -1
- package/src/workspace.ts +6 -7
package/bin/bgl.ts
CHANGED
|
@@ -10,8 +10,8 @@ const [,, command, subcommand, ...args] = process.argv
|
|
|
10
10
|
|
|
11
11
|
async function main() {
|
|
12
12
|
if (command === 'init') {
|
|
13
|
-
const
|
|
14
|
-
if (
|
|
13
|
+
const createWorkspace = args.includes('--workspace') || args.includes('-w')
|
|
14
|
+
if (createWorkspace) {
|
|
15
15
|
await initWorkspace()
|
|
16
16
|
}
|
|
17
17
|
else {
|
package/dist/bin/bgl.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
const process = require('node:process');
|
|
5
|
-
const detect = require('../shared/workspace.
|
|
5
|
+
const detect = require('../shared/workspace.DQ-r7Tja.cjs');
|
|
6
6
|
require('node:fs');
|
|
7
7
|
require('node:path');
|
|
8
8
|
require('prompts');
|
|
@@ -14,8 +14,8 @@ const process__default = /*#__PURE__*/_interopDefaultCompat(process);
|
|
|
14
14
|
const [, , command, subcommand, ...args] = process__default.argv;
|
|
15
15
|
async function main() {
|
|
16
16
|
if (command === "init") {
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
17
|
+
const createWorkspace = args.includes("--workspace") || args.includes("-w");
|
|
18
|
+
if (createWorkspace) {
|
|
19
19
|
await detect.initWorkspace();
|
|
20
20
|
} else {
|
|
21
21
|
await detect.generateWorkspaceConfig();
|
package/dist/bin/bgl.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import process from 'node:process';
|
|
3
|
-
import { i as initWorkspace, g as generateWorkspaceConfig, h as addProject, l as listProjects, k as isWorkspace, d as setupLint, f as generateSDKForWorkspace, e as generateSDK } from '../shared/workspace.
|
|
3
|
+
import { i as initWorkspace, g as generateWorkspaceConfig, h as addProject, l as listProjects, k as isWorkspace, d as setupLint, f as generateSDKForWorkspace, e as generateSDK } from '../shared/workspace.Dq4_YhqE.mjs';
|
|
4
4
|
import 'node:fs';
|
|
5
5
|
import 'node:path';
|
|
6
6
|
import 'prompts';
|
|
@@ -8,8 +8,8 @@ import 'prompts';
|
|
|
8
8
|
const [, , command, subcommand, ...args] = process.argv;
|
|
9
9
|
async function main() {
|
|
10
10
|
if (command === "init") {
|
|
11
|
-
const
|
|
12
|
-
if (
|
|
11
|
+
const createWorkspace = args.includes("--workspace") || args.includes("-w");
|
|
12
|
+
if (createWorkspace) {
|
|
13
13
|
await initWorkspace();
|
|
14
14
|
} else {
|
|
15
15
|
await generateWorkspaceConfig();
|
package/dist/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const node_fs = require('node:fs');
|
|
4
4
|
const node_path = require('node:path');
|
|
5
5
|
const process = require('node:process');
|
|
6
|
-
const detect = require('./shared/workspace.
|
|
6
|
+
const detect = require('./shared/workspace.DQ-r7Tja.cjs');
|
|
7
7
|
require('prompts');
|
|
8
8
|
|
|
9
9
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
2
|
import { resolve, join } from 'node:path';
|
|
3
3
|
import process from 'node:process';
|
|
4
|
-
import { g as generateWorkspaceConfig, s as setBuildEnvVars, w as writeNetlifyConfig } from './shared/workspace.
|
|
5
|
-
export { h as addProject, a as generateNetlifyConfig, b as generateNetlifyRedirect, e as generateSDK, f as generateSDKForWorkspace, c as generateWorkspaceConfigSync, j as getWorkspaceInfo, i as initWorkspace, k as isWorkspace, l as listProjects, d as setupLint } from './shared/workspace.
|
|
4
|
+
import { g as generateWorkspaceConfig, s as setBuildEnvVars, w as writeNetlifyConfig } from './shared/workspace.Dq4_YhqE.mjs';
|
|
5
|
+
export { h as addProject, a as generateNetlifyConfig, b as generateNetlifyRedirect, e as generateSDK, f as generateSDKForWorkspace, c as generateWorkspaceConfigSync, j as getWorkspaceInfo, i as initWorkspace, k as isWorkspace, l as listProjects, d as setupLint } from './shared/workspace.Dq4_YhqE.mjs';
|
|
6
6
|
import 'prompts';
|
|
7
7
|
|
|
8
8
|
async function resolveConfig(mode = "development", options = {}) {
|
|
@@ -600,8 +600,8 @@ function createWorkspaceRoot(root, name, projectId) {
|
|
|
600
600
|
},
|
|
601
601
|
devDependencies: {
|
|
602
602
|
"@bagelink/workspace": "latest",
|
|
603
|
-
typescript: "^5.0.0",
|
|
604
|
-
vite: "latest"
|
|
603
|
+
"typescript": "^5.0.0",
|
|
604
|
+
"vite": "latest"
|
|
605
605
|
}
|
|
606
606
|
};
|
|
607
607
|
node_fs.writeFileSync(
|
|
@@ -724,8 +724,8 @@ async function addProject(name, root = process__default.cwd()) {
|
|
|
724
724
|
dependencies: {},
|
|
725
725
|
devDependencies: {
|
|
726
726
|
"@vitejs/plugin-vue": "latest",
|
|
727
|
-
vite: "latest",
|
|
728
|
-
vue: "latest"
|
|
727
|
+
"vite": "latest",
|
|
728
|
+
"vue": "latest"
|
|
729
729
|
}
|
|
730
730
|
};
|
|
731
731
|
if (isWorkspace) {
|
|
@@ -831,7 +831,7 @@ function updateWorkspaceScripts(root, projectName) {
|
|
|
831
831
|
if (!node_fs.existsSync(packageJsonPath)) return;
|
|
832
832
|
try {
|
|
833
833
|
const packageJson = JSON.parse(
|
|
834
|
-
readFileSync(packageJsonPath, "utf-8")
|
|
834
|
+
node_fs.readFileSync(packageJsonPath, "utf-8")
|
|
835
835
|
);
|
|
836
836
|
if (!packageJson.scripts) {
|
|
837
837
|
packageJson.scripts = {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { writeFileSync, existsSync, readFileSync
|
|
1
|
+
import { writeFileSync, existsSync, readFileSync, mkdirSync, readdirSync } from 'node:fs';
|
|
2
2
|
import { resolve } from 'node:path';
|
|
3
3
|
import process from 'node:process';
|
|
4
4
|
import prompts from 'prompts';
|
|
@@ -164,7 +164,7 @@ function updatePackageJsonScripts(root) {
|
|
|
164
164
|
return;
|
|
165
165
|
}
|
|
166
166
|
try {
|
|
167
|
-
const packageJson = JSON.parse(readFileSync
|
|
167
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
168
168
|
if (!packageJson.scripts) {
|
|
169
169
|
packageJson.scripts = {};
|
|
170
170
|
}
|
|
@@ -203,7 +203,7 @@ function updateViteConfig(root) {
|
|
|
203
203
|
const viteConfigPath = resolve(root, "vite.config.ts");
|
|
204
204
|
const viteConfigExists = existsSync(viteConfigPath);
|
|
205
205
|
if (viteConfigExists) {
|
|
206
|
-
const existingConfig = readFileSync
|
|
206
|
+
const existingConfig = readFileSync(viteConfigPath, "utf-8");
|
|
207
207
|
if (existingConfig.includes("@bagelink/workspace")) {
|
|
208
208
|
console.log("\u2139\uFE0F vite.config.ts already configured");
|
|
209
209
|
return;
|
|
@@ -369,7 +369,7 @@ function updatePackageJsonLint(root, configs) {
|
|
|
369
369
|
}
|
|
370
370
|
try {
|
|
371
371
|
const packageJson = JSON.parse(
|
|
372
|
-
readFileSync
|
|
372
|
+
readFileSync(packageJsonPath, "utf-8")
|
|
373
373
|
);
|
|
374
374
|
if (!packageJson.scripts) {
|
|
375
375
|
packageJson.scripts = {};
|
|
@@ -593,8 +593,8 @@ function createWorkspaceRoot(root, name, projectId) {
|
|
|
593
593
|
},
|
|
594
594
|
devDependencies: {
|
|
595
595
|
"@bagelink/workspace": "latest",
|
|
596
|
-
typescript: "^5.0.0",
|
|
597
|
-
vite: "latest"
|
|
596
|
+
"typescript": "^5.0.0",
|
|
597
|
+
"vite": "latest"
|
|
598
598
|
}
|
|
599
599
|
};
|
|
600
600
|
writeFileSync(
|
|
@@ -717,8 +717,8 @@ async function addProject(name, root = process.cwd()) {
|
|
|
717
717
|
dependencies: {},
|
|
718
718
|
devDependencies: {
|
|
719
719
|
"@vitejs/plugin-vue": "latest",
|
|
720
|
-
vite: "latest",
|
|
721
|
-
vue: "latest"
|
|
720
|
+
"vite": "latest",
|
|
721
|
+
"vue": "latest"
|
|
722
722
|
}
|
|
723
723
|
};
|
|
724
724
|
if (isWorkspace) {
|
|
@@ -856,7 +856,7 @@ function isWorkspace(root = process.cwd()) {
|
|
|
856
856
|
const packageJsonPath = resolve(root, "package.json");
|
|
857
857
|
if (existsSync(packageJsonPath)) {
|
|
858
858
|
try {
|
|
859
|
-
const packageJson = JSON.parse(readFileSync
|
|
859
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
860
860
|
if (packageJson.workspaces !== void 0) {
|
|
861
861
|
return true;
|
|
862
862
|
}
|
package/package.json
CHANGED
package/src/workspace.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, readdirSync, writeFileSync } from 'node:fs'
|
|
1
|
+
import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from 'node:fs'
|
|
2
2
|
import { resolve } from 'node:path'
|
|
3
3
|
import process from 'node:process'
|
|
4
4
|
import prompts from 'prompts'
|
|
@@ -91,8 +91,8 @@ function createWorkspaceRoot(root: string, name: string, projectId: string): voi
|
|
|
91
91
|
},
|
|
92
92
|
devDependencies: {
|
|
93
93
|
'@bagelink/workspace': 'latest',
|
|
94
|
-
typescript: '^5.0.0',
|
|
95
|
-
vite: 'latest',
|
|
94
|
+
'typescript': '^5.0.0',
|
|
95
|
+
'vite': 'latest',
|
|
96
96
|
},
|
|
97
97
|
}
|
|
98
98
|
|
|
@@ -249,8 +249,8 @@ export async function addProject(
|
|
|
249
249
|
dependencies: {} as Record<string, string>,
|
|
250
250
|
devDependencies: {
|
|
251
251
|
'@vitejs/plugin-vue': 'latest',
|
|
252
|
-
vite: 'latest',
|
|
253
|
-
vue: 'latest',
|
|
252
|
+
'vite': 'latest',
|
|
253
|
+
'vue': 'latest',
|
|
254
254
|
},
|
|
255
255
|
}
|
|
256
256
|
|
|
@@ -417,8 +417,7 @@ export function listProjects(root: string = process.cwd()): string[] {
|
|
|
417
417
|
const items = readdirSync(root, { withFileTypes: true })
|
|
418
418
|
return items
|
|
419
419
|
.filter(
|
|
420
|
-
item =>
|
|
421
|
-
item.isDirectory()
|
|
420
|
+
item => item.isDirectory()
|
|
422
421
|
&& item.name !== 'node_modules'
|
|
423
422
|
&& item.name !== 'shared'
|
|
424
423
|
&& item.name !== '.git'
|