track-cli 4.2.0-rc1 → 4.2.0-rc2

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,6 +1,6 @@
1
1
  import * as dntShim from "../../_dnt.shims.js";
2
2
  import { CONFIG_FILE_PATH, load as loadConfig } from "../shared/config.js";
3
- import { CantReadFile, NewFilesNotAllowed, RejectNewFilesInTestFolder } from "../shared/errors.js";
3
+ import { CantReadFile, NewFilesNotAllowed, RejectNewFilesInTestFolder, RejectTooLongFilepath } from "../shared/errors.js";
4
4
  import { pathsToFilenameSet, toNativeStyle } from "../shared/file.js";
5
5
  import { getCommonChallengeContext, listFileNames, printWorkingFileSet, trackClientFromConfig, } from "../shared/mod.js";
6
6
  import { FileListType } from "../shared/types.js";
@@ -21,9 +21,15 @@ export async function add(filePaths) {
21
21
  existingPaths.add(CONFIG_FILE_PATH);
22
22
  const pathsToAdd = Array.from(requestedPaths).filter((p) => !existingPaths.has(p));
23
23
  // Files in test folder are not allowed
24
- const invalidFiles = pathsToAdd.filter(v => v.startsWith("test/"));
25
- if (invalidFiles.length > 0) {
26
- throw new RejectNewFilesInTestFolder(invalidFiles);
24
+ const filesInTestFolder = pathsToAdd.filter(v => v.startsWith("test/"));
25
+ if (filesInTestFolder.length > 0) {
26
+ throw new RejectNewFilesInTestFolder(filesInTestFolder);
27
+ }
28
+ // Reject long filepath
29
+ // https://givery.slack.com/archives/C05RABF6KU3/p1772069298650949
30
+ const longFilepaths = pathsToAdd.filter(v => v.length > 150);
31
+ if (longFilepaths.length > 0) {
32
+ throw new RejectTooLongFilepath(longFilepaths);
27
33
  }
28
34
  const addedFiles = listFileNames(codingContext, FileListType.UserAddedFiles)
29
35
  .concat(pathsToAdd);
package/esm/src/meta.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export declare const VERSION = "4.2.0-rc1";
1
+ export declare const VERSION = "4.2.0-rc2";
2
2
  export declare const DESCRIPTION = "A CLI for interacting with tracks.run and running code tests on track's servers";
3
3
  export declare function checkUpdates(): Promise<boolean>;
package/esm/src/meta.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as colors from "../deps/deno.land/std@0.195.0/fmt/colors.js";
2
2
  // @ts-ignore: has no exported member
3
3
  import { CookieJar, fetch } from "node-fetch-cookies";
4
- export const VERSION = "4.2.0-rc1";
4
+ export const VERSION = "4.2.0-rc2";
5
5
  export const DESCRIPTION = "A CLI for interacting with tracks.run and running code tests on track's servers";
6
6
  const VERSION_RE = /^(\d+)\.(\d+)\.(\d+)(?:-?(.*))$/;
7
7
  function parseSemver(s) {
@@ -83,6 +83,10 @@ export declare class RejectNewFilesInTestFolder extends TrackError {
83
83
  fileNames: string[];
84
84
  constructor(fileNames: string[]);
85
85
  }
86
+ export declare class RejectTooLongFilepath extends TrackError {
87
+ fileNames: string[];
88
+ constructor(fileNames: string[]);
89
+ }
86
90
  export declare class DeleteFilesNotAllowed extends TrackError {
87
91
  constructor();
88
92
  }
@@ -234,6 +234,18 @@ export class RejectNewFilesInTestFolder extends TrackError {
234
234
  this.name = "RejectNewFilesInTestFolder";
235
235
  }
236
236
  }
237
+ export class RejectTooLongFilepath extends TrackError {
238
+ constructor(fileNames) {
239
+ super(`More than 150 characters in filepath are not allowed: ${fileNames.join(", ")}`);
240
+ Object.defineProperty(this, "fileNames", {
241
+ enumerable: true,
242
+ configurable: true,
243
+ writable: true,
244
+ value: fileNames
245
+ });
246
+ this.name = "RejectTooLongFilepath";
247
+ }
248
+ }
237
249
  export class DeleteFilesNotAllowed extends TrackError {
238
250
  constructor() {
239
251
  super("This challenge does not allow the deletion of files");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "track-cli",
3
- "version": "4.2.0-rc1",
3
+ "version": "4.2.0-rc2",
4
4
  "description": "A CLI for interacting with tracks.run and running code tests on track's servers",
5
5
  "repository": {
6
6
  "type": "git",