@hubspot/npm-scripts 0.0.3 → 0.0.4-beta.0
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/package.json +2 -2
- package/src/linking.js +13 -4
- package/src/utils/logging.d.ts +1 -0
- package/src/utils/logging.js +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/npm-scripts",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4-beta.0",
|
|
4
4
|
"description": "Scripts for working with npm packages in the HubSpot ecosystem",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"fs-extra": "^11.3.2",
|
|
24
24
|
"open": "^10.2.0",
|
|
25
25
|
"semver": "^7.7.2",
|
|
26
|
-
"yargs": "
|
|
26
|
+
"yargs": "17.7.2"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@eslint/js": "^9.36.0",
|
package/src/linking.js
CHANGED
|
@@ -19,10 +19,19 @@ function getSymLinksInDirectory(directory) {
|
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
21
|
function getPackageName(node_modules_dir, packages) {
|
|
22
|
-
return packages
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
return packages
|
|
23
|
+
.map((item) => {
|
|
24
|
+
const pathToOpen = path.join(node_modules_dir, item, packageJson);
|
|
25
|
+
try {
|
|
26
|
+
const { name } = fs.readJsonSync(pathToOpen);
|
|
27
|
+
return name;
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
logger.warn(`Unable to open "${pathToOpen}", if @hubspot/${item} is a dependency of this project it is not installed. If you would like to link it, add it as a project dependency and install it.\n`);
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
.filter((item) => item !== undefined);
|
|
26
35
|
}
|
|
27
36
|
const yarnLinkPath = path.join(os.homedir(), '.config', 'yarn', 'link', hubspotPackageNamespace);
|
|
28
37
|
(async () => {
|
package/src/utils/logging.d.ts
CHANGED
package/src/utils/logging.js
CHANGED
|
@@ -9,6 +9,9 @@ export const logger = {
|
|
|
9
9
|
success(...args) {
|
|
10
10
|
console.log(`${chalk.cyan('[SUCCESS]')}`, ...args);
|
|
11
11
|
},
|
|
12
|
+
warn(...args) {
|
|
13
|
+
console.log(`${chalk.yellow('[WARN]')}`, ...args);
|
|
14
|
+
},
|
|
12
15
|
error(...args) {
|
|
13
16
|
console.log(`${chalk.red('[ERROR]')}`, ...args);
|
|
14
17
|
},
|