hardhat-deploy 2.0.0-next.69 → 2.0.0-next.70
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/dist/postinstall.js +29 -10
- package/dist/postinstall.js.map +1 -1
- package/dist/v1-entry.cjs +1 -1
- package/package.json +1 -1
- package/src/postinstall.ts +34 -10
- package/src/v1-entry.cjs +1 -1
package/dist/postinstall.js
CHANGED
|
@@ -3,25 +3,44 @@
|
|
|
3
3
|
// This script should be lightweight and fail gracefully
|
|
4
4
|
import { existsSync, readFileSync, writeFileSync } from 'fs';
|
|
5
5
|
import { join, dirname } from 'path';
|
|
6
|
-
import { fileURLToPath } from 'url';
|
|
7
6
|
import { execSync } from 'child_process';
|
|
8
|
-
const
|
|
9
|
-
const __dirname = dirname(__filename);
|
|
10
|
-
const MIGRATION_URL = 'https://rocketh.dev/hardhat-deploy/documentation/how-to/migration-from-v1';
|
|
7
|
+
const MIGRATION_URL = 'https://rocketh.dev/hardhat-deploy/documentation/how-to/migration-from-v1.html';
|
|
11
8
|
const V1_INSTALL_CMD = 'npm install hardhat-deploy@1';
|
|
12
9
|
const MARKER_FILE = '.hardhat-deploy-v2-notice';
|
|
10
|
+
// Find the project root by navigating up from node_modules
|
|
11
|
+
function findProjectRoot(currentPath) {
|
|
12
|
+
let path = currentPath;
|
|
13
|
+
while (path !== '/' && path !== '') {
|
|
14
|
+
// Check if we're inside node_modules
|
|
15
|
+
if (path.includes('node_modules')) {
|
|
16
|
+
path = dirname(path);
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
// Check if this directory has a package.json (likely project root)
|
|
20
|
+
if (existsSync(join(path, 'package.json'))) {
|
|
21
|
+
return path;
|
|
22
|
+
}
|
|
23
|
+
path = dirname(path);
|
|
24
|
+
}
|
|
25
|
+
// Fallback to current directory
|
|
26
|
+
return currentPath;
|
|
27
|
+
}
|
|
13
28
|
async function checkEnvironment() {
|
|
14
|
-
|
|
29
|
+
// Postinstall runs in the package directory, need to find the actual project root
|
|
30
|
+
const projectRoot = findProjectRoot(process.cwd());
|
|
15
31
|
let v1Detected = false;
|
|
16
32
|
let reasons = [];
|
|
17
33
|
// Check for hardhat version via command line
|
|
18
34
|
try {
|
|
19
|
-
const output = execSync('hardhat --version', { encoding: 'utf-8', stdio: 'pipe' });
|
|
35
|
+
const output = execSync('hardhat --version', { encoding: 'utf-8', stdio: 'pipe', cwd: projectRoot });
|
|
20
36
|
// Output format is like "hardhat, version 2.x.x" or "hardhat, version 3.x.x"
|
|
21
|
-
const
|
|
22
|
-
if (
|
|
23
|
-
|
|
24
|
-
|
|
37
|
+
const match = output.match(/hardhat, version (\d+\.\d+\.\d+)/);
|
|
38
|
+
if (match) {
|
|
39
|
+
const hardhatVersion = match[1];
|
|
40
|
+
if (hardhatVersion.startsWith('2.')) {
|
|
41
|
+
v1Detected = true;
|
|
42
|
+
reasons.push(`hardhat ${hardhatVersion} detected (v2 requires hardhat 3.x)`);
|
|
43
|
+
}
|
|
25
44
|
}
|
|
26
45
|
}
|
|
27
46
|
catch (e) {
|
package/dist/postinstall.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postinstall.js","sourceRoot":"","sources":["../src/postinstall.ts"],"names":[],"mappings":";AAEA,mDAAmD;AACnD,wDAAwD;AAExD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"postinstall.js","sourceRoot":"","sources":["../src/postinstall.ts"],"names":[],"mappings":";AAEA,mDAAmD;AACnD,wDAAwD;AAExD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,QA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QACf,cAAc,CAAC,OAAO,CAAC,CAAC;QACxB,gBAAgB,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IACzC,CAAC;SAAM,CAAC;QACN,YAAY,EAAE,CAAC;IACjB,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,WAAmB,EAAE,OAAiB;IAC9D,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IAClD,MAAM,OAAO,GAAG;;;;;;EAMhB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;;;;;;KAMtC,cAAc;;;KAGd,aAAa;;;CAGjB,CAAC;IAEA,IAAI,CAAC;QACH,aAAa,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,gDAAgD;IAClD,CAAC;AACH,CAAC;AAED,SAAS,cAAc,CAAC,OAAiB;IACvC,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE9D,OAAO,CAAC,GAAG,CAAC;;;;;;;;;EASZ,WAAW;;;;;;;;;IAST,cAAc;;;;SAIT,aAAa;;;;iBAIL,WAAW;CAC3B,CAAC,CAAC;AACH,CAAC;AAED,SAAS,YAAY;IACnB,OAAO,CAAC,GAAG,CAAC;;;CAGb,CAAC,CAAC;AACH,CAAC;AAED,gBAAgB,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC"}
|
package/dist/v1-entry.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// This file serves as a CommonJS entry point for hardhat v2
|
|
2
2
|
// It detects v1 users and shows them a migration message
|
|
3
3
|
|
|
4
|
-
const MIGRATION_URL = 'https://rocketh.dev/hardhat-deploy/migration-from-v1';
|
|
4
|
+
const MIGRATION_URL = 'https://rocketh.dev/hardhat-deploy/documentation/how-to/migration-from-v1.html';
|
|
5
5
|
const V1_INSTALL_CMD = 'npm install hardhat-deploy@1';
|
|
6
6
|
|
|
7
7
|
function getHardhatVersion() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hardhat-deploy",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.70",
|
|
4
4
|
"description": "Hardhat plugin for replicable smart contract deployments and easy testing across multiple EVM chains, with support for proxies, diamonds, named accounts, and deployment fixtures",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hardhat",
|
package/src/postinstall.ts
CHANGED
|
@@ -5,29 +5,53 @@
|
|
|
5
5
|
|
|
6
6
|
import { existsSync, readFileSync, writeFileSync } from 'fs';
|
|
7
7
|
import { join, dirname } from 'path';
|
|
8
|
-
import { fileURLToPath } from 'url';
|
|
9
8
|
import { execSync } from 'child_process';
|
|
10
9
|
|
|
11
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
12
|
-
const __dirname = dirname(__filename);
|
|
13
10
|
|
|
14
|
-
const MIGRATION_URL = 'https://rocketh.dev/hardhat-deploy/documentation/how-to/migration-from-v1';
|
|
11
|
+
const MIGRATION_URL = 'https://rocketh.dev/hardhat-deploy/documentation/how-to/migration-from-v1.html';
|
|
15
12
|
const V1_INSTALL_CMD = 'npm install hardhat-deploy@1';
|
|
16
13
|
const MARKER_FILE = '.hardhat-deploy-v2-notice';
|
|
17
14
|
|
|
15
|
+
// Find the project root by navigating up from node_modules
|
|
16
|
+
function findProjectRoot(currentPath: string): string {
|
|
17
|
+
let path = currentPath;
|
|
18
|
+
|
|
19
|
+
while (path !== '/' && path !== '') {
|
|
20
|
+
// Check if we're inside node_modules
|
|
21
|
+
if (path.includes('node_modules')) {
|
|
22
|
+
path = dirname(path);
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Check if this directory has a package.json (likely project root)
|
|
27
|
+
if (existsSync(join(path, 'package.json'))) {
|
|
28
|
+
return path;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
path = dirname(path);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Fallback to current directory
|
|
35
|
+
return currentPath;
|
|
36
|
+
}
|
|
37
|
+
|
|
18
38
|
async function checkEnvironment() {
|
|
19
|
-
|
|
39
|
+
// Postinstall runs in the package directory, need to find the actual project root
|
|
40
|
+
const projectRoot = findProjectRoot(process.cwd());
|
|
20
41
|
let v1Detected = false;
|
|
21
42
|
let reasons: string[] = [];
|
|
22
43
|
|
|
23
44
|
// Check for hardhat version via command line
|
|
24
45
|
try {
|
|
25
|
-
const output = execSync('hardhat --version', { encoding: 'utf-8', stdio: 'pipe' });
|
|
46
|
+
const output = execSync('hardhat --version', { encoding: 'utf-8', stdio: 'pipe', cwd: projectRoot });
|
|
26
47
|
// Output format is like "hardhat, version 2.x.x" or "hardhat, version 3.x.x"
|
|
27
|
-
const
|
|
28
|
-
if (
|
|
29
|
-
|
|
30
|
-
|
|
48
|
+
const match = output.match(/hardhat, version (\d+\.\d+\.\d+)/);
|
|
49
|
+
if (match) {
|
|
50
|
+
const hardhatVersion = match[1];
|
|
51
|
+
if (hardhatVersion.startsWith('2.')) {
|
|
52
|
+
v1Detected = true;
|
|
53
|
+
reasons.push(`hardhat ${hardhatVersion} detected (v2 requires hardhat 3.x)`);
|
|
54
|
+
}
|
|
31
55
|
}
|
|
32
56
|
} catch (e) {
|
|
33
57
|
// Hardhat not installed yet - that's fine
|
package/src/v1-entry.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// This file serves as a CommonJS entry point for hardhat v2
|
|
2
2
|
// It detects v1 users and shows them a migration message
|
|
3
3
|
|
|
4
|
-
const MIGRATION_URL = 'https://rocketh.dev/hardhat-deploy/migration-from-v1';
|
|
4
|
+
const MIGRATION_URL = 'https://rocketh.dev/hardhat-deploy/documentation/how-to/migration-from-v1.html';
|
|
5
5
|
const V1_INSTALL_CMD = 'npm install hardhat-deploy@1';
|
|
6
6
|
|
|
7
7
|
function getHardhatVersion() {
|