@intuned/runtime-dev 1.0.6-cli.8.1.1 → 1.0.6-cli.8.1.2

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.
@@ -12,15 +12,6 @@ _dotenv.default.config({
12
12
  });
13
13
  _commander.program.description("Deploy an Intuned project to be public").argument("[project-name]", "Name of the project to deploy").option("-w, --workspace-id <id>", "Your Intuned workspace ID").option("-k, --api-key <key>", "Your Intuned API key").action(async (projectName, options) => {
14
14
  try {
15
- const _projectName = projectName || (await (0, _utils2.getSettingIntunedJSON)("projectName"));
16
- console.log("Project name: ", _projectName);
17
- if (!_projectName) {
18
- throw new Error("Project name is required");
19
- }
20
- const projectNameValidation = (0, _utils.validateProjectName)(_projectName);
21
- if (!projectNameValidation.isValid) {
22
- throw new Error(projectNameValidation.errorMessage);
23
- }
24
15
  const {
25
16
  isValid,
26
17
  errorMessage
@@ -29,6 +20,14 @@ _commander.program.description("Deploy an Intuned project to be public").argumen
29
20
  const userErrorMesage = `Project to be deployed is not a valid Intuned project: ${errorMessage}, modify and check again`;
30
21
  throw new Error(userErrorMesage);
31
22
  }
23
+ const _projectName = projectName || (await (0, _utils2.getSettingIntunedJSON)("projectName"));
24
+ if (!_projectName) {
25
+ throw new Error("Project name is required");
26
+ }
27
+ const projectNameValidation = (0, _utils.validateProjectName)(_projectName);
28
+ if (!projectNameValidation.isValid) {
29
+ throw new Error(projectNameValidation.errorMessage);
30
+ }
32
31
  const auth = await (0, _utils2.getAuthCredentials)(options);
33
32
  const deployStarted = await (0, _utils.deployProject)(_projectName, auth);
34
33
  if (!deployStarted) {
@@ -166,6 +166,9 @@ async function deployProject(projectName, auth) {
166
166
  body: JSON.stringify(deployProjectPayload)
167
167
  });
168
168
  if (!response.ok) {
169
+ if (response.status === 401) {
170
+ throw new Error(`Invalid API key. Please check your API key and try again.`);
171
+ }
169
172
  throw new Error(`Error deploying project`);
170
173
  }
171
174
  const startTime = Date.now();
@@ -211,9 +214,9 @@ const validateIntunedProject = async () => {
211
214
  const validationSteps = [{
212
215
  name: "package.json",
213
216
  check: async () => {
214
- const packageJsonPath = path.join(currentDirectoryToDeploy, "package.json");
215
217
  try {
216
218
  var _packageJson$dependen;
219
+ const packageJsonPath = path.join(currentDirectoryToDeploy, "package.json");
217
220
  await fs.exists(packageJsonPath);
218
221
  const packageJson = JSON.parse(await fs.readFile(packageJsonPath, {
219
222
  encoding: "utf-8"
@@ -238,8 +241,8 @@ const validateIntunedProject = async () => {
238
241
  }, {
239
242
  name: "intuned.json",
240
243
  check: async () => {
241
- const intunedJsonPath = path.join(currentDirectoryToDeploy, "intuned.json");
242
244
  try {
245
+ const intunedJsonPath = path.join(currentDirectoryToDeploy, "intuned.json");
243
246
  await fs.exists(intunedJsonPath);
244
247
  return {
245
248
  isValid: true
@@ -254,8 +257,8 @@ const validateIntunedProject = async () => {
254
257
  }, {
255
258
  name: "api folder",
256
259
  check: async () => {
257
- const apiFolderPath = path.join(currentDirectoryToDeploy, "api");
258
260
  try {
261
+ const apiFolderPath = path.join(currentDirectoryToDeploy, "api");
259
262
  await fs.access(apiFolderPath);
260
263
  return {
261
264
  isValid: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intuned/runtime-dev",
3
- "version": "1.0.6-cli.8.1.1",
3
+ "version": "1.0.6-cli.8.1.2",
4
4
  "description": "Intuned runtime",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",