Giter Site home page Giter Site logo

Comments (8)

0x80 avatar 0x80 commented on August 15, 2024 1

Ah glad you found it! I will add a check on the stdout result to see if it is a filepath, and if not log it and throw an error

from isolate-package.

0x80 avatar 0x80 commented on August 15, 2024

@capybarahero That looks to me like it might be a JSON parsing error. Could you share your config file? As the error suggests, property names in JSON have to use double quotes.

from isolate-package.

capybarahero avatar capybarahero commented on August 15, 2024

Hi @0x80, here is how my folder structure look like:

monorepo
|_pnpm-workspace.yaml
|_firebase-project
       |___functions/ 
              |___package.json (includes "isolate-package": "^1.0.1" and "shared-library": "workspace:*")
              |___other files and folders/
       |___firebase.json
       |___other files and folders/
|_packages
       |___shared-library/
|_other apps/files

As I have the firebase.json file with the "functions" source code, I haven't created any isolate.config.json myself. I will experiment creating it and see if it works.

ps.: Thanks for taking a look at this.

from isolate-package.

capybarahero avatar capybarahero commented on August 15, 2024

Hi @0x80, quick update here:

I'm afraid the issue I was experiencing comes from here:

const configDefaults: IsolateConfigResolved = {
  buildDirName: undefined,
  includeDevDependencies: false,
  isolateDirName: "isolate",
  logLevel: "info",
  targetPackagePath: undefined,
  tsconfigPath: "./tsconfig.json",
  workspacePackages: undefined,
  workspaceRoot: "../..",
};

The issue seems to be solved when I created a isolate.config.ts as below:

{
  "buildDirName": "lib",
  "includeDevDependencies": false,
  "isolateDirName": "isolate",
  "logLevel": "debug",
  "tsconfigPath": "./tsconfig.json",
  "workspaceRoot": "../.."
}

and ran npx isolate from the 'functions' folder.

Quick note: Afterwards, I came across two different issues:

  1. Error: Command failed: pnpm pack --pack-destination <path>. This was solved by adding "version": “1.0.0” to my firebase/functions package.json.

  2. Error: ENOENT: no such file or directory after line 38 from "/pack.ts" (while running /pack-dependencies.ts) as below. I will investigate this at some point today.

debug Using pnpm to pack dependencies
debug Packed shared-library-1.0.0.tgz
debug Unpacked shared-library-1.0.0.tgz
debug Moved package files to isolate ./packages/shared-library
debug Packed functions-1.0.0.tgz
Error: ENOENT: no such file or directory

from isolate-package.

0x80 avatar 0x80 commented on August 15, 2024

@capybarahero Thanks for reporting. I haven't been able to reproduce the issue. I suspect the JSON parse error might come from your tsconfig file. If isolate.config.json is not found, the process will look for tsconfig.json to figure out what your build output directory is.

Could you share the contents of your tsconfig file?

The other options you are setting are the same as the defaults, so you could leave them out. This should be enough for your setup:

{
  "buildDirName": "lib",
  "logLevel": "debug"
}

I added to the readme that a version string is required in order for pnpm pack to work. It makes sense since it uses the version string as part of the filename. I woudn't be surprised if npm pack had a similar requirement.

The Error: ENOENT: no such file or directory is likely because the system can not find the packed file somehow. I have changed the debug logging to print absolute paths for the pack/unpack parts, so we can see where it is trying to read from.

The changes are published as 1.0.2 so please give that a try.

If an error occurs, the __tmp directory is not cleaned up, so you could inspect it.

from isolate-package.

0x80 avatar 0x80 commented on August 15, 2024

In 1.0.3 I have added clear errors for any failure of reading json or yaml files.

from isolate-package.

capybarahero avatar capybarahero commented on August 15, 2024

Hi @0x80, I managed it identify the source of the issue above and it comes from here:

exec(`pnpm pack --pack-destination ${destDir}`, (err, stdout2) => { ... }

As I am using a different version of Node from my package.json, I receive the "warning" below before the path is printed, something like this:

"WARN  Unsupported engine: wanted: {"node":"18"} (current: {"node":"v19.2.0"}) /Users/<path>"

Hence, I had to add a regex to remove it before this: const packedFilePath = stdout.trim();

Thanks again!

from isolate-package.

capybarahero avatar capybarahero commented on August 15, 2024

Amazing! Just a quick note: The package is working well now. Thanks for creating it! ❤️

from isolate-package.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.