@hubspot/cli 3.0.10-beta.17 → 3.0.10-beta.18

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.
@@ -1,8 +1,19 @@
1
1
  const { createProject } = require('@hubspot/cli-lib/projects');
2
+ const { GITHUB_RELEASE_TYPES } = require('@hubspot/cli-lib/lib/constants');
3
+ const { getIsInProject } = require('../../lib/projects');
4
+
5
+ const PROJECT_BOILERPLATE_REF = 'cms-boilerplate-developer-projects';
2
6
 
3
7
  module.exports = {
4
8
  dest: ({ name, assetType }) => name || assetType,
5
- execute: ({ dest, assetType, options }) => {
9
+ execute: async ({ dest, assetType, options }) => {
10
+ const isInProject = await getIsInProject(dest);
11
+
12
+ if (isInProject) {
13
+ options.ref = PROJECT_BOILERPLATE_REF;
14
+ // releaseType has to be 'REPOSITORY' to download a specific branch
15
+ options.releaseType = GITHUB_RELEASE_TYPES.REPOSITORY;
16
+ }
6
17
  createProject(dest, assetType, 'cms-theme-boilerplate', 'src', options);
7
18
  },
8
19
  };
package/lib/projects.js CHANGED
@@ -69,7 +69,12 @@ const writeProjectConfig = (configPath, config) => {
69
69
  }
70
70
  };
71
71
 
72
- const getProjectConfig = async _dir => {
72
+ const getIsInProject = async _dir => {
73
+ const configPath = await getProjectConfigPath(_dir);
74
+ return !!configPath;
75
+ };
76
+
77
+ const getProjectConfigPath = async _dir => {
73
78
  const projectDir = _dir ? path.resolve(getCwd(), _dir) : getCwd();
74
79
 
75
80
  const configPath = findup(PROJECT_CONFIG_FILE, {
@@ -77,6 +82,11 @@ const getProjectConfig = async _dir => {
77
82
  nocase: true,
78
83
  });
79
84
 
85
+ return configPath;
86
+ };
87
+
88
+ const getProjectConfig = async _dir => {
89
+ const configPath = await getProjectConfigPath(_dir);
80
90
  if (!configPath) {
81
91
  return { projectConfig: null, projectDir: null };
82
92
  }
@@ -381,6 +391,7 @@ const makeGetTaskStatus = taskType => {
381
391
  module.exports = {
382
392
  writeProjectConfig,
383
393
  getProjectConfig,
394
+ getIsInProject,
384
395
  createProjectConfig,
385
396
  validateProjectConfig,
386
397
  showWelcomeMessage,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/cli",
3
- "version": "3.0.10-beta.17",
3
+ "version": "3.0.10-beta.18",
4
4
  "description": "CLI for working with HubSpot",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -8,8 +8,8 @@
8
8
  "url": "https://github.com/HubSpot/hubspot-cms-tools"
9
9
  },
10
10
  "dependencies": {
11
- "@hubspot/cli-lib": "^3.0.10-beta.17",
12
- "@hubspot/serverless-dev-runtime": "^3.0.10-beta.17",
11
+ "@hubspot/cli-lib": "^3.0.10-beta.18",
12
+ "@hubspot/serverless-dev-runtime": "^3.0.10-beta.18",
13
13
  "archiver": "^5.3.0",
14
14
  "chalk": "^4.1.2",
15
15
  "express": "^4.17.1",
@@ -39,5 +39,5 @@
39
39
  "publishConfig": {
40
40
  "access": "public"
41
41
  },
42
- "gitHead": "f365463e60d6ee1765de2712965064188e765cb8"
42
+ "gitHead": "c0d4e2201f2e1b8e7f79b549b92eb7845ae7cd71"
43
43
  }