google / clasp

🔗 Command Line Apps Script Projects
https://developers.google.com/apps-script/guides/clasp
Apache License 2.0
4.53k stars 423 forks source link

'undefined' inside complied comment #957

Open fullth opened 1 year ago

fullth commented 1 year ago

(Note: Non-breaking issues are likely not to be prioritized. Please consider a PR in addition to your issue)

Expected Behavior

Replace something instead 'undefined'.

Actual Behavior

Commented at the top '// Compiled using undefined undefined (TypeScript 4.9.5)'

Steps to Reproduce the Problem

  1. I replaced file type 'Code.js' with 'Code.ts'
  2. clasp push

Specifications

InExSu commented 8 months ago

yes, in *.gs files see

// Compiled using undefined undefined (TypeScript 4.9.5)

tsconfig.json { "compilerOptions": { "lib": [ "esnext" ], "experimentalDecorators": true } }

node -v v21.2.0 clasp -v 2.4.2 OS: Mac Ventura

pmaczko commented 5 months ago

Any progress? I started using clasp few days ago and after tutorial I see the same comment with undefined... Thanks in advance for any help!

UPDATE: Small progress :) The second undefined is related to version in package.json! My current comment: // Compiled using undefined 0.0.1 (TypeScript 4.9.5), so I suppose the first undefined will be related to other value from project settings.

PopGoesTheWza commented 4 months ago

The comment originates from this line in ts2gas

https://github.com/grant/ts2gas/blob/535c850b0fd92203f885a8623f65caaa70887c51/src/index.ts#L374

I am unsure if either ts2gas or clasp need to be updated. I have stopped using Google Sheets and clasp a few years ago and no longer contribute these projects.

ivancho1707 commented 2 months ago

So the undefined parts come from the package.json fields name and version, declaring them properly will return a "good" output

{
  "name": "my-project",
  "version": "1.0.0",
  "devDependencies": {
    "@types/google-apps-script": "^1.0.83"
  }
}

compiled file example output:

// Compiled using my-project 1.0.0 (TypeScript 4.9.5)
...

This might well be fixed documenting this behavior or prompting user for these values when creating or importing a project