New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@parischap/configs

Package Overview
Dependencies
Maintainers
0
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@parischap/configs

Utility to generate configuration files in a repository

  • 0.0.9
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
132
increased by355.17%
Maintainers
0
Weekly downloads
 
Created
Source

Goal of this package is to allow simple and fast setup and modification of all other packages. To make a package work, we need:

  • to install at its root and in its dist a package.json. The package.json at the root is the one that is called when the package is used inside a pnpm workspace. There the package can be consumed directly as typescript package without prior compilation with tools like vite. The package.json in the dist folder is the one that is used when the package is distributed, e.g on npm.
  • to install at its root some files for versioning et deployment: .gitignore
  • to install some files at its root for formatting and linting: tsconfig.json, eslint.config.js, prettier.config.js, .prettierignore
  • to install at its root some files to produce the dist folder: vite-builder.ts, tsconfig.json
  • and sometimes some other stuff

The package.json file can be created by merging several imported json files. The tsconfig.json file can be created by copying several files that imports one of three configs: library, node or browser. Same for eslint.config.js. The prettier.config.js can be created by copying a file that imports a config. The .gitignore and .prettierignore files can be created by copying a file. The vite.config.js file can be created by copying a file and merging some modifications into the exported object.

What config-manager must do:

  • it must offer a static folder containing .json and .js files to import. To prevent bad things from happening, meaningful filenames in this folder (like package.json, tsconfig.json,...) are suffixed with .template.
  • it must be able to create the configs files at the root of each package (create-config-files). To achieve this, each package will need to have a project.config.js file at its root that will import the necessary files from static, merge them, bring any necessary modifications, and export them in the form of a default object whose keys will be the name of the target file and the value a js object. create-config-files must import the default object exported by project.config.js. For each key of that object that ends in .js, it must create at the root of the package a file with that key as a name that imports the given key from project.config.js and re-exports it as default. For any other key, it must create at the root of the package a file with that key as name and fill it with the stringified value associated with this key.
  • it must offer a tool that copies package.json from the root directory of the package to its dist directory after bringing some modifications (in particular in the exports and imports fields).

config-manager needs some config files to work... The first time, run node init/main.mjs because there must be a package.json and pnpm-lock.yaml to setup the github environment. Run pnpm build to install all configuration files locally. Then, push the repo to github. In github:

  • make sure to have read and write prermissions under workflow in Settings/Actions/General.
  • run manually the first-release action to create a first release
  • run manually publish when ready to send to npm

Now run node init/main.mjs to reinstall the dependencies. And now you can use pnpm update-config-files.

About tsconfig:

  • if the include directive does not match any ts file, it is considered that there is no include directive. It then falls back to the default which is all files in all subdirectories. In particular, if it finds only .js files and even if allowJs and checkJs are activated, it will revert to the default.

  • typescript looks for the nearest tsconfig. If the file is not covered by that tsconfig, it does not look any further. It considers this files is not covered by a tsconfig. It will not try to see if there is another tsconfig up the directory tree that covers this file. I need 3 tsconfigs:

  • one to build

  • one to lint in vsCode

  • one to provide to eslint. This one does not need to include any library because eslint as its own library management. So it can be put at monorepo level

About packages: In each package, we have in the root and the dist folders two package.json files with the same name. It can work if the project is noy a worksâce or if these two files don't coexist simultaneously. The dist repo is only created on github just before being published.

About npm: NPM is free for public packages. But we can publish a minified transpiled package to npm without the source code or maps. This will not be very useful to anyone.

FAQs

Package last updated on 11 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc