GithubHelp home page GithubHelp logo

Comments (5)

awirkerman avatar awirkerman commented on June 9, 2024 1

I have experienced the same issue. In my case, it was related to executing on a windows machine, rather than a posix system.

I found that custom parsers were not firing either, and style-dictionary was unable to locate the source token files. Style-dictionary itself seems to be expecting a posix glob pattern (see https://github.com/amzn/style-dictionary/blob/main/lib/utils/combineJSON.js - combineJSON) function. However, on a windows machine, the @nxkit/style-dictionary executor is calling path.resolve(...), which produces a Windows style path, causing style dictionaries glob to not return results.

from nxkit.

awirkerman avatar awirkerman commented on June 9, 2024 1

I used the following within the executor's normalizeConfig section to convert "source" from a windows path to a posix path, and it seemed to work for my case, however I'm not sure if this is the correct solution.
.split(path.sep).join(path.posix.sep)

from nxkit.

Ionaru avatar Ionaru commented on June 9, 2024

I made a little script to patch the lib while the proper fix is being worked on.

const { readFileSync, writeFileSync } = require('node:fs');

const badCode = 'require("path")';
const badFile =
  'node_modules/@nxkit/style-dictionary/src/executors/build/lib/normalize-config.js';
const badContents = readFileSync(badFile, 'utf8');

const goodCode = 'require("path/posix")';

if (badContents.includes(badCode)) {
  const goodContents = badContents.replace(badCode, goodCode);
  writeFileSync(badFile, goodContents, 'utf8');
  console.log('Patched');
} else {
  console.log('No changes needed');
}

Using a prepare target, it runs whenever style dictionary needs to build.

    "prepare": {
      "executor": "nx:run-commands",
      "options": {
        "commands": [
          {
            "command": "node tools/patch-nxkit-style-dictionary.js"
          }
        ]
      }
    },
    "build": {
      "dependsOn": ["prepare"],
      "executor": "@nxkit/style-dictionary:build",
      ...
    },

from nxkit.

sebastiandg7 avatar sebastiandg7 commented on June 9, 2024

@allcontributors add @astrodomas for bug

from nxkit.

allcontributors avatar allcontributors commented on June 9, 2024

@sebastiandg7

I've put up a pull request to add @astrodomas! 🎉

from nxkit.

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.