@phila/cli 0.0.6 → 0.0.7
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 +20 -1
- package/dist/commands/config.d.ts +2 -0
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +17 -6
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +89 -6
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/ship.d.ts.map +1 -1
- package/dist/commands/ship.js +14 -4
- package/dist/commands/ship.js.map +1 -1
- package/dist/templates/_shared/webapp-cdk-package.json.tmpl +2 -2
- package/dist/templates/lambda-api-nodejs/cdk/package.json +2 -2
- package/dist/templates/lambda-api-nodejs/package.json.tmpl +2 -2
- package/dist/templates/lambda-api-nodejs/pnpm-workspace.yaml.tmpl +3 -0
- package/dist/templates/lambda-dynamo-api/cdk/package.json +2 -2
- package/dist/templates/lambda-dynamo-api/package.json.tmpl +2 -2
- package/dist/templates/lambda-dynamo-api/pnpm-workspace.yaml.tmpl +3 -0
- package/dist/templates/lambda-postgres-api/cdk/package.json +2 -2
- package/dist/templates/lambda-postgres-api/package.json.tmpl +2 -2
- package/dist/templates/lambda-postgres-api/pnpm-workspace.yaml.tmpl +3 -0
- package/dist/templates/static-site/cdk/package.json +2 -2
- package/dist/templates/static-site/package.json.tmpl +2 -6
- package/dist/templates/static-site/pnpm-workspace.yaml.tmpl +3 -0
- package/dist/templates/webapp-ecs-dotnet/package.json.tmpl +1 -1
- package/dist/templates/webapp-ecs-dotnet/pnpm-workspace.yaml.tmpl +3 -0
- package/dist/templates/webapp-ecs-node/package.json.tmpl +2 -2
- package/dist/templates/webapp-ecs-node/pnpm-workspace.yaml.tmpl +4 -0
- package/dist/templates/webapp-ecs-postgres-dotnet/package.json.tmpl +1 -1
- package/dist/templates/webapp-ecs-postgres-dotnet/pnpm-workspace.yaml.tmpl +3 -0
- package/dist/templates/webapp-ecs-postgres-node/package.json.tmpl +2 -2
- package/dist/templates/webapp-ecs-postgres-node/pnpm-workspace.yaml.tmpl +4 -0
- package/dist/templates/webapp-lambda-dotnet/package.json.tmpl +1 -1
- package/dist/templates/webapp-lambda-dotnet/pnpm-workspace.yaml.tmpl +3 -0
- package/dist/templates/webapp-lambda-dynamo-dotnet/package.json.tmpl +1 -1
- package/dist/templates/webapp-lambda-dynamo-dotnet/pnpm-workspace.yaml.tmpl +3 -0
- package/dist/templates/webapp-lambda-dynamo-node/package.json.tmpl +2 -2
- package/dist/templates/webapp-lambda-dynamo-node/pnpm-workspace.yaml.tmpl +4 -0
- package/dist/templates/webapp-lambda-node/package.json.tmpl +2 -2
- package/dist/templates/webapp-lambda-node/pnpm-workspace.yaml.tmpl +4 -0
- package/dist/templates/webapp-lambda-postgres-dotnet/package.json.tmpl +1 -1
- package/dist/templates/webapp-lambda-postgres-dotnet/pnpm-workspace.yaml.tmpl +3 -0
- package/dist/templates/webapp-lambda-postgres-node/package.json.tmpl +2 -2
- package/dist/templates/webapp-lambda-postgres-node/pnpm-workspace.yaml.tmpl +4 -0
- package/dist/utils/cli-installation.d.ts +17 -0
- package/dist/utils/cli-installation.d.ts.map +1 -0
- package/dist/utils/cli-installation.js +131 -0
- package/dist/utils/cli-installation.js.map +1 -0
- package/dist/utils/dependencies.d.ts.map +1 -1
- package/dist/utils/dependencies.js +75 -0
- package/dist/utils/dependencies.js.map +1 -1
- package/dist/utils/package-manager.d.ts +30 -0
- package/dist/utils/package-manager.d.ts.map +1 -0
- package/dist/utils/package-manager.js +145 -0
- package/dist/utils/package-manager.js.map +1 -0
- package/dist/utils/template.d.ts +3 -0
- package/dist/utils/template.d.ts.map +1 -1
- package/dist/utils/template.js +23 -5
- package/dist/utils/template.js.map +1 -1
- package/package.json +2 -2
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@phila/constructs": "^{{constructsVersion}}",
|
|
12
|
-
"aws-cdk-lib": "^2.
|
|
12
|
+
"aws-cdk-lib": "^2.236.0",
|
|
13
13
|
"cdk-nag": "^2.28.0",
|
|
14
14
|
"constructs": "^10.4.4",
|
|
15
15
|
"source-map-support": "^0.5.21"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/node": "^20.10.0",
|
|
19
|
-
"aws-cdk": "^2.
|
|
19
|
+
"aws-cdk": "^2.1103.0",
|
|
20
20
|
"ts-node": "^10.9.0",
|
|
21
21
|
"typescript": "^5.3.0"
|
|
22
22
|
},
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"description": "Lambda API application using Philadelphia constructs",
|
|
5
5
|
"private": true,
|
|
6
6
|
"scripts": {
|
|
7
|
-
"build": "
|
|
8
|
-
"test": "
|
|
7
|
+
"build": "{{buildCommand}}",
|
|
8
|
+
"test": "{{testCommand}}",
|
|
9
9
|
"synth": "cd cdk && cdk synth",
|
|
10
10
|
"deploy": "cd cdk && cdk deploy",
|
|
11
11
|
"diff": "cd cdk && cdk diff"
|
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@phila/constructs": "^{{constructsVersion}}",
|
|
12
|
-
"aws-cdk-lib": "^2.
|
|
12
|
+
"aws-cdk-lib": "^2.236.0",
|
|
13
13
|
"cdk-nag": "^2.28.0",
|
|
14
14
|
"constructs": "^10.4.4",
|
|
15
15
|
"source-map-support": "^0.5.21"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/node": "^20.10.0",
|
|
19
|
-
"aws-cdk": "^2.
|
|
19
|
+
"aws-cdk": "^2.1103.0",
|
|
20
20
|
"ts-node": "^10.9.0",
|
|
21
21
|
"typescript": "^5.3.0"
|
|
22
22
|
},
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"description": "Lambda DynamoDB API application using Philadelphia constructs",
|
|
5
5
|
"private": true,
|
|
6
6
|
"scripts": {
|
|
7
|
-
"build": "
|
|
8
|
-
"test": "
|
|
7
|
+
"build": "{{buildCommand}}",
|
|
8
|
+
"test": "{{testCommand}}",
|
|
9
9
|
"synth": "cd cdk && cdk synth",
|
|
10
10
|
"deploy": "cd cdk && cdk deploy",
|
|
11
11
|
"diff": "cd cdk && cdk diff"
|
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@phila/constructs": "^{{constructsVersion}}",
|
|
12
|
-
"aws-cdk-lib": "^2.
|
|
12
|
+
"aws-cdk-lib": "^2.236.0",
|
|
13
13
|
"cdk-nag": "^2.28.0",
|
|
14
14
|
"constructs": "^10.4.4",
|
|
15
15
|
"source-map-support": "^0.5.21"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/node": "^20.10.0",
|
|
19
|
-
"aws-cdk": "^2.
|
|
19
|
+
"aws-cdk": "^2.1103.0",
|
|
20
20
|
"ts-node": "^10.9.0",
|
|
21
21
|
"typescript": "^5.3.0"
|
|
22
22
|
},
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"description": "Lambda API with PostgreSQL database using Philadelphia constructs",
|
|
5
5
|
"private": true,
|
|
6
6
|
"scripts": {
|
|
7
|
-
"build": "
|
|
8
|
-
"test": "
|
|
7
|
+
"build": "{{buildCommand}}",
|
|
8
|
+
"test": "{{testCommand}}",
|
|
9
9
|
"synth": "cd cdk && cdk synth",
|
|
10
10
|
"deploy": "cd cdk && cdk deploy",
|
|
11
11
|
"diff": "cd cdk && cdk diff"
|
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@phila/constructs": "^{{constructsVersion}}",
|
|
12
|
-
"aws-cdk-lib": "^2.
|
|
12
|
+
"aws-cdk-lib": "^2.236.0",
|
|
13
13
|
"cdk-nag": "^2.28.0",
|
|
14
14
|
"constructs": "^10.4.4",
|
|
15
15
|
"source-map-support": "^0.5.21"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/node": "^20.10.0",
|
|
19
|
-
"aws-cdk": "^2.
|
|
19
|
+
"aws-cdk": "^2.1103.0",
|
|
20
20
|
"ts-node": "^10.9.0",
|
|
21
21
|
"typescript": "^5.3.0"
|
|
22
22
|
},
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"description": "Static site application using Philadelphia constructs",
|
|
5
5
|
"private": true,
|
|
6
6
|
"scripts": {
|
|
7
|
-
"build": "
|
|
7
|
+
"build": "{{buildCommand}}",
|
|
8
8
|
"synth": "cd cdk && cdk synth",
|
|
9
9
|
"deploy": "cd cdk && cdk deploy",
|
|
10
10
|
"diff": "cd cdk && cdk diff"
|
|
@@ -12,9 +12,5 @@
|
|
|
12
12
|
"workspaces": [
|
|
13
13
|
"cdk",
|
|
14
14
|
"frontend"
|
|
15
|
-
]
|
|
16
|
-
"devDependencies": {
|
|
17
|
-
"@types/node": "^20.10.0",
|
|
18
|
-
"typescript": "^5.3.0"
|
|
19
|
-
}
|
|
15
|
+
]
|
|
20
16
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"build:frontend": "cd frontend && npm run build",
|
|
9
9
|
"build:api": "cd apps/api && docker build -t {{appName}}-api .",
|
|
10
10
|
"dev": "cd frontend && npm run dev",
|
|
11
|
-
"test": "
|
|
11
|
+
"test": "{{testCommand}}",
|
|
12
12
|
"synth": "cd cdk && cdk synth",
|
|
13
13
|
"deploy": "cd cdk && cdk deploy",
|
|
14
14
|
"diff": "cd cdk && cdk diff"
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
"description": "Web application with Nuxt frontend and ECS containerized API backend",
|
|
5
5
|
"private": true,
|
|
6
6
|
"scripts": {
|
|
7
|
-
"build": "
|
|
7
|
+
"build": "{{buildCommand}}",
|
|
8
8
|
"build:frontend": "cd frontend && npm run build",
|
|
9
9
|
"build:api": "cd apps/api && npm run build",
|
|
10
10
|
"dev": "cd frontend && npm run dev",
|
|
11
11
|
"dev:api": "cd apps/api && npm run dev",
|
|
12
|
-
"test": "
|
|
12
|
+
"test": "{{testCommand}}",
|
|
13
13
|
"synth": "cd cdk && cdk synth",
|
|
14
14
|
"deploy": "cd cdk && cdk deploy",
|
|
15
15
|
"diff": "cd cdk && cdk diff"
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"build:frontend": "cd frontend && npm run build",
|
|
9
9
|
"build:api": "cd apps/api && docker build -t {{appName}}-api .",
|
|
10
10
|
"dev": "cd frontend && npm run dev",
|
|
11
|
-
"test": "
|
|
11
|
+
"test": "{{testCommand}}",
|
|
12
12
|
"synth": "cd cdk && cdk synth",
|
|
13
13
|
"deploy": "cd cdk && cdk deploy",
|
|
14
14
|
"diff": "cd cdk && cdk diff"
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
"description": "Web application with Nuxt frontend, ECS containerized API backend, and PostgreSQL",
|
|
5
5
|
"private": true,
|
|
6
6
|
"scripts": {
|
|
7
|
-
"build": "
|
|
7
|
+
"build": "{{buildCommand}}",
|
|
8
8
|
"build:frontend": "cd frontend && npm run build",
|
|
9
9
|
"build:api": "cd apps/api && npm run build",
|
|
10
10
|
"dev": "cd frontend && npm run dev",
|
|
11
11
|
"dev:api": "cd apps/api && npm run dev",
|
|
12
|
-
"test": "
|
|
12
|
+
"test": "{{testCommand}}",
|
|
13
13
|
"synth": "cd cdk && cdk synth",
|
|
14
14
|
"deploy": "cd cdk && cdk deploy",
|
|
15
15
|
"diff": "cd cdk && cdk diff"
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"build:frontend": "cd frontend && npm run build",
|
|
9
9
|
"build:api": "cd apps/api && dotnet publish -c Release -o publish",
|
|
10
10
|
"dev": "cd frontend && npm run dev",
|
|
11
|
-
"test": "
|
|
11
|
+
"test": "{{testCommand}}",
|
|
12
12
|
"synth": "cd cdk && cdk synth",
|
|
13
13
|
"deploy": "cd cdk && cdk deploy",
|
|
14
14
|
"diff": "cd cdk && cdk diff"
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"build:frontend": "cd frontend && npm run build",
|
|
9
9
|
"build:api": "cd apps/api && dotnet publish -c Release -o publish",
|
|
10
10
|
"dev": "cd frontend && npm run dev",
|
|
11
|
-
"test": "
|
|
11
|
+
"test": "{{testCommand}}",
|
|
12
12
|
"synth": "cd cdk && cdk synth",
|
|
13
13
|
"deploy": "cd cdk && cdk deploy",
|
|
14
14
|
"diff": "cd cdk && cdk diff"
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
"description": "Web application with Nuxt frontend and Lambda API backend",
|
|
5
5
|
"private": true,
|
|
6
6
|
"scripts": {
|
|
7
|
-
"build": "
|
|
7
|
+
"build": "{{buildCommand}}",
|
|
8
8
|
"build:frontend": "cd frontend && npm run build",
|
|
9
9
|
"build:api": "cd apps/api && npm run build",
|
|
10
10
|
"dev": "cd frontend && npm run dev",
|
|
11
|
-
"test": "
|
|
11
|
+
"test": "{{testCommand}}",
|
|
12
12
|
"synth": "cd cdk && cdk synth",
|
|
13
13
|
"deploy": "cd cdk && cdk deploy",
|
|
14
14
|
"diff": "cd cdk && cdk diff"
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
"description": "Web application with Nuxt frontend and Lambda API backend",
|
|
5
5
|
"private": true,
|
|
6
6
|
"scripts": {
|
|
7
|
-
"build": "
|
|
7
|
+
"build": "{{buildCommand}}",
|
|
8
8
|
"build:frontend": "cd frontend && npm run build",
|
|
9
9
|
"build:api": "cd apps/api && npm run build",
|
|
10
10
|
"dev": "cd frontend && npm run dev",
|
|
11
|
-
"test": "
|
|
11
|
+
"test": "{{testCommand}}",
|
|
12
12
|
"synth": "cd cdk && cdk synth",
|
|
13
13
|
"deploy": "cd cdk && cdk deploy",
|
|
14
14
|
"diff": "cd cdk && cdk diff"
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"build:frontend": "cd frontend && npm run build",
|
|
9
9
|
"build:api": "cd apps/api && dotnet publish -c Release -o publish",
|
|
10
10
|
"dev": "cd frontend && npm run dev",
|
|
11
|
-
"test": "
|
|
11
|
+
"test": "{{testCommand}}",
|
|
12
12
|
"synth": "cd cdk && cdk synth",
|
|
13
13
|
"deploy": "cd cdk && cdk deploy",
|
|
14
14
|
"diff": "cd cdk && cdk diff"
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
"description": "Web application with Nuxt frontend and Lambda API backend",
|
|
5
5
|
"private": true,
|
|
6
6
|
"scripts": {
|
|
7
|
-
"build": "
|
|
7
|
+
"build": "{{buildCommand}}",
|
|
8
8
|
"build:frontend": "cd frontend && npm run build",
|
|
9
9
|
"build:api": "cd apps/api && npm run build",
|
|
10
10
|
"dev": "cd frontend && npm run dev",
|
|
11
|
-
"test": "
|
|
11
|
+
"test": "{{testCommand}}",
|
|
12
12
|
"synth": "cd cdk && cdk synth",
|
|
13
13
|
"deploy": "cd cdk && cdk deploy",
|
|
14
14
|
"diff": "cd cdk && cdk diff"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detects if the CLI package is running from a local link or workspace (via npm link, pnpm link, or direct workspace execution)
|
|
3
|
+
* vs installed from npm registry.
|
|
4
|
+
*
|
|
5
|
+
* @returns true if running from a local link or workspace, false if from npm registry
|
|
6
|
+
*/
|
|
7
|
+
export declare function isLocalLink(): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Finds the workspace root by looking for pnpm-workspace.yaml, package.json with workspaces,
|
|
10
|
+
* or other workspace indicators
|
|
11
|
+
*/
|
|
12
|
+
export declare function findWorkspaceRoot(startDir: string): string | null;
|
|
13
|
+
/**
|
|
14
|
+
* Gets the installation type as a string for display purposes
|
|
15
|
+
*/
|
|
16
|
+
export declare function getInstallationType(): 'local' | 'npm';
|
|
17
|
+
//# sourceMappingURL=cli-installation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-installation.d.ts","sourceRoot":"","sources":["../../src/utils/cli-installation.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,wBAAgB,WAAW,IAAI,OAAO,CAmDrC;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA0BjE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,GAAG,KAAK,CAErD"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ABOUTME: Detects whether the CLI is running from a local link or npm registry
|
|
3
|
+
// ABOUTME: Checks symlinks, workspace paths, and node_modules location
|
|
4
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5
|
+
if (k2 === undefined) k2 = k;
|
|
6
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
7
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
8
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
9
|
+
}
|
|
10
|
+
Object.defineProperty(o, k2, desc);
|
|
11
|
+
}) : (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
o[k2] = m[k];
|
|
14
|
+
}));
|
|
15
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
16
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
17
|
+
}) : function(o, v) {
|
|
18
|
+
o["default"] = v;
|
|
19
|
+
});
|
|
20
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
21
|
+
var ownKeys = function(o) {
|
|
22
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
23
|
+
var ar = [];
|
|
24
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
25
|
+
return ar;
|
|
26
|
+
};
|
|
27
|
+
return ownKeys(o);
|
|
28
|
+
};
|
|
29
|
+
return function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
})();
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
exports.isLocalLink = isLocalLink;
|
|
39
|
+
exports.findWorkspaceRoot = findWorkspaceRoot;
|
|
40
|
+
exports.getInstallationType = getInstallationType;
|
|
41
|
+
const path = __importStar(require("path"));
|
|
42
|
+
const fs = __importStar(require("fs-extra"));
|
|
43
|
+
/**
|
|
44
|
+
* Detects if the CLI package is running from a local link or workspace (via npm link, pnpm link, or direct workspace execution)
|
|
45
|
+
* vs installed from npm registry.
|
|
46
|
+
*
|
|
47
|
+
* @returns true if running from a local link or workspace, false if from npm registry
|
|
48
|
+
*/
|
|
49
|
+
function isLocalLink() {
|
|
50
|
+
try {
|
|
51
|
+
// Get the resolved path to this package's package.json
|
|
52
|
+
// When linked, this will point to the source directory
|
|
53
|
+
// When installed, it will be in node_modules
|
|
54
|
+
const packageJsonPath = require.resolve('@phila/cli/package.json');
|
|
55
|
+
const packageDir = path.dirname(packageJsonPath);
|
|
56
|
+
// Check if the package.json itself or its parent directory is a symlink
|
|
57
|
+
const stats = fs.lstatSync(packageJsonPath);
|
|
58
|
+
if (stats.isSymbolicLink()) {
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
// Check parent directory
|
|
62
|
+
const parentStats = fs.lstatSync(packageDir);
|
|
63
|
+
if (parentStats.isSymbolicLink()) {
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
// Check if it's outside node_modules (typical for linked packages or workspace execution)
|
|
67
|
+
if (!packageDir.includes('node_modules')) {
|
|
68
|
+
// Check if it's in the workspace (pnpm workspaces keep packages at root level)
|
|
69
|
+
const workspaceRoot = findWorkspaceRoot(packageDir);
|
|
70
|
+
if (workspaceRoot) {
|
|
71
|
+
// Check if this is the actual workspace package
|
|
72
|
+
const expectedPath = path.join(workspaceRoot, 'packages', 'cli', 'package.json');
|
|
73
|
+
if (fs.existsSync(expectedPath)) {
|
|
74
|
+
// Always use file paths when in workspace (whether it's the actual package or a link)
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
// If not in node_modules and not in expected workspace location, likely a link
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
// If it's in node_modules, check if it's a symlink
|
|
82
|
+
// npm link creates symlinks in node_modules
|
|
83
|
+
const nodeModulesPath = path.join(packageDir, '..', '..');
|
|
84
|
+
if (fs.existsSync(nodeModulesPath)) {
|
|
85
|
+
const nodeModulesStats = fs.lstatSync(nodeModulesPath);
|
|
86
|
+
if (nodeModulesStats.isSymbolicLink()) {
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
// If we can't resolve, assume it's not a local link
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Finds the workspace root by looking for pnpm-workspace.yaml, package.json with workspaces,
|
|
99
|
+
* or other workspace indicators
|
|
100
|
+
*/
|
|
101
|
+
function findWorkspaceRoot(startDir) {
|
|
102
|
+
let current = path.resolve(startDir);
|
|
103
|
+
while (current !== path.dirname(current)) {
|
|
104
|
+
// Check for pnpm workspace
|
|
105
|
+
if (fs.existsSync(path.join(current, 'pnpm-workspace.yaml'))) {
|
|
106
|
+
return current;
|
|
107
|
+
}
|
|
108
|
+
// Check for npm/yarn workspace in package.json
|
|
109
|
+
const packageJsonPath = path.join(current, 'package.json');
|
|
110
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
111
|
+
try {
|
|
112
|
+
const pkg = fs.readJsonSync(packageJsonPath);
|
|
113
|
+
if (pkg.workspaces || pkg.workspace) {
|
|
114
|
+
return current;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
// Ignore JSON parse errors
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
current = path.dirname(current);
|
|
122
|
+
}
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Gets the installation type as a string for display purposes
|
|
127
|
+
*/
|
|
128
|
+
function getInstallationType() {
|
|
129
|
+
return isLocalLink() ? 'local' : 'npm';
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=cli-installation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-installation.js","sourceRoot":"","sources":["../../src/utils/cli-installation.ts"],"names":[],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../src/utils/dependencies.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../src/utils/dependencies.ts"],"names":[],"mappings":"AAYA,oBAAY,QAAQ;IAClB,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,KAAK,UAAU;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACvC,OAAO,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC5D,YAAY,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;CAClD;AAED,wBAAgB,WAAW,IAAI,QAAQ,CAKtC;AAED,eAAO,MAAM,YAAY,EAAE,UAAU,EAmMpC,CAAC;AAEF;;GAEG;AACH,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAOxE;AAkBD;;GAEG;AACH,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CA6DxD"}
|
|
@@ -1,6 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// ABOUTME: Dependency validation and auto-installation for CLI tools
|
|
3
3
|
// ABOUTME: Checks node, npm, pnpm, aws, cdk, zip on every command
|
|
4
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5
|
+
if (k2 === undefined) k2 = k;
|
|
6
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
7
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
8
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
9
|
+
}
|
|
10
|
+
Object.defineProperty(o, k2, desc);
|
|
11
|
+
}) : (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
o[k2] = m[k];
|
|
14
|
+
}));
|
|
15
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
16
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
17
|
+
}) : function(o, v) {
|
|
18
|
+
o["default"] = v;
|
|
19
|
+
});
|
|
20
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
21
|
+
var ownKeys = function(o) {
|
|
22
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
23
|
+
var ar = [];
|
|
24
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
25
|
+
return ar;
|
|
26
|
+
};
|
|
27
|
+
return ownKeys(o);
|
|
28
|
+
};
|
|
29
|
+
return function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
})();
|
|
4
37
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
38
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6
39
|
};
|
|
@@ -11,8 +44,12 @@ exports.checkAllDependencies = checkAllDependencies;
|
|
|
11
44
|
exports.ensureDependencies = ensureDependencies;
|
|
12
45
|
const child_process_1 = require("child_process");
|
|
13
46
|
const os_1 = require("os");
|
|
47
|
+
const path = __importStar(require("path"));
|
|
48
|
+
const fs = __importStar(require("fs-extra"));
|
|
14
49
|
const chalk_1 = __importDefault(require("chalk"));
|
|
15
50
|
const inquirer_1 = __importDefault(require("inquirer"));
|
|
51
|
+
const config_1 = require("../commands/config");
|
|
52
|
+
const package_manager_1 = require("./package-manager");
|
|
16
53
|
var Platform;
|
|
17
54
|
(function (Platform) {
|
|
18
55
|
Platform["Darwin"] = "darwin";
|
|
@@ -130,6 +167,44 @@ exports.DEPENDENCIES = [
|
|
|
130
167
|
{
|
|
131
168
|
name: 'cdk',
|
|
132
169
|
check: async () => {
|
|
170
|
+
// First, try to find local cdk if we're in a project directory
|
|
171
|
+
const config = await (0, config_1.loadConfig)(process.cwd());
|
|
172
|
+
if (config) {
|
|
173
|
+
const cdkDir = path.resolve(process.cwd(), config.cdkPath);
|
|
174
|
+
const packageJsonPath = path.join(cdkDir, 'package.json');
|
|
175
|
+
// Check if cdk directory exists and has package.json
|
|
176
|
+
if (await fs.pathExists(packageJsonPath)) {
|
|
177
|
+
try {
|
|
178
|
+
// Check if aws-cdk is listed as a dependency
|
|
179
|
+
const packageJson = await fs.readJson(packageJsonPath);
|
|
180
|
+
const hasCdk = (packageJson.dependencies && packageJson.dependencies['aws-cdk']) ||
|
|
181
|
+
(packageJson.devDependencies && packageJson.devDependencies['aws-cdk']);
|
|
182
|
+
if (hasCdk) {
|
|
183
|
+
// Try to run the local cdk command from the cdk directory
|
|
184
|
+
try {
|
|
185
|
+
// Detect package manager from project root (where lock files are for workspaces)
|
|
186
|
+
const pm = (0, package_manager_1.detectPackageManager)(process.cwd());
|
|
187
|
+
const cdkCmd = (0, package_manager_1.getCdkCommand)(pm);
|
|
188
|
+
const cmd = `${cdkCmd} --version`;
|
|
189
|
+
const version = (0, child_process_1.execSync)(cmd, { cwd: cdkDir, stdio: 'pipe' })
|
|
190
|
+
.toString()
|
|
191
|
+
.trim()
|
|
192
|
+
.split(' ')[0];
|
|
193
|
+
return { name: 'cdk', installed: true, version };
|
|
194
|
+
}
|
|
195
|
+
catch {
|
|
196
|
+
// Command failed (dependencies not installed yet), but cdk is in package.json
|
|
197
|
+
// Consider it available since deploy command will install dependencies
|
|
198
|
+
return { name: 'cdk', installed: true };
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
catch {
|
|
203
|
+
// Failed to read package.json, fall through to global check
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
// Fall back to global cdk check
|
|
133
208
|
try {
|
|
134
209
|
const version = (0, child_process_1.execSync)('cdk --version').toString().trim().split(' ')[0];
|
|
135
210
|
return { name: 'cdk', installed: true, version };
|