1.0.46 • Published 2 years ago

globimp v1.0.46

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Globimp

Access node_modules functions and variables from anywhere, without imports. With typescript support !

How does it look ? Example

Github sources

https://github.com/Chill-Studio/globimp/tree/main

Getting started

Video tutorial

Watch the video

Installation

npm install -g globimp

In package.json you can add globimp command to postinstall the hooks. This way the globimp typings and variables will be updated when your package.json updates its dependencies

scripts : {
  ...
  "postinstall" : "globimp"
  ...
}

Generate a globimp files

At the root of your npm project :

globimp

This will generate a globimp.config.json based on your package.json at the root. It will also generate an globimp.ts in <root-of-project>/src

Enable Globimp

At the root of your project import the global variable for them to be defined.

import React from "react";
import ReactDOM from "react-dom";
import { App } from "./app";

// Add this line
import "./globimp";

ReactDOM.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
  document.getElementById("root")
);

Access default imports globaly

In globimp.config.json, to have access a the default import, set the dependency value to true under the key defaultImport

{
    "defaultImports": {
        ...
        "axios": true,
        ...
    },
    ...
}

WARNING: Any change in globimp.config.json require a globimp in order for the update to be taken into account

Access named imports globaly

In globimp.config.json, to access a named import globally, add the name of the named import in the array of the relevant dependency

Note If this import is already defined and set to true in the default section, the namedImports section will be ignored.

  "namedImports": {
    "react": ["useEffect","useState"],
  }

WARNING: Any change in globimp.config.json require a globimp in order for the update to be taken into account

1.0.44

2 years ago

1.0.43

2 years ago

1.0.46

2 years ago

1.0.45

2 years ago

1.0.42

2 years ago

1.0.41

2 years ago

1.0.40

2 years ago

1.0.39

2 years ago

1.0.37

2 years ago

1.0.36

2 years ago

1.0.35

2 years ago

1.0.34

2 years ago

1.0.33

2 years ago

1.0.32

2 years ago

1.0.31

2 years ago

1.0.3-O

2 years ago

1.0.29

2 years ago

1.0.28

2 years ago

1.0.27

2 years ago

1.0.26

2 years ago

1.0.25

2 years ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.22

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago