If you are looking for a package manager with CLI and complete integration with all your github repositories, their respective releases and a complete deployment of new ones without doing boilerplating like npm publish
, this is your land.
This is like npm, but deno right.
- Open your terminal and type
deno install -Af https://module.land/cli/land.js
- Check if the command works with
land -v
- On a new project folder type
land add moduleland/[email protected]
You see that? A new json emerged, you are creating land!
- Open
land.json
file, we are gonna inspect what's inside
{
"imports": {
"moduleland/[email protected]/": "https://v1.module.land/public/moduleland/[email protected]/"
}
}
The imports
object, defines the aliases you can use to import inside your project, without using all the long url.
- Create a new file
main.ts
and type the following code
import { foo, fighters } from 'moduleland/[email protected]/main.ts';
console.log(foo(), fighters(2))
- Now, run the this code with
land run main.ts
, add all the flags you need, deno has a lot of cool ones!
Hello land! 4
Really nice, now we have a deno project running with land.
Now, you are ready for start sharing your first module, log in and share your project from github, use the knowledge from the example to integrate your module.
Remember, if you make a new release on github, you don't need to tell land
what to do, the new version is gonna be available at the same time.
We are gonna update [email protected]
reference, it's a very old module
- Open your terminal inside the project and type
land update moduleland/[email protected]
- Now, type
land run main.ts
and the following is gonna blow your mind
Hello land 2.0.0! 6
You didn't change your code, and the results are different. Let's check out the land.json
and main.ts
files.
{
"imports": {
"moduleland/[email protected]/": "https://v1.module.land/public/moduleland/[email protected]/"
}
}
import { foo, fighters } from 'moduleland/[email protected]/main.ts';
console.log(foo(), fighters(2))
land update
check all the references inside your project and makes an update for you, so you don't need to worry if you lose the trace from a file.
- We will update the project once more, but without specifying the version
land update moduleland/deno-lib
- Type
land run main.ts
Hello *latest* land! 8
Now, the module is on the latest version of the default branch of the project.
Check this example on github and moduleland/deno-lib