This is only for testing npm init for installing other things.
https://learnjsthehardway.com/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
447 B
16 lines
447 B
2 years ago
|
import fs from "fs/promises";
|
||
|
import path from "path";
|
||
|
import url from "url";
|
||
|
|
||
|
export const description = "Prints out the version of the tool.";
|
||
|
|
||
|
export const options = [];
|
||
|
|
||
|
export const main = async (opts) => {
|
||
|
const pkgurl = url.parse(import.meta.url);
|
||
|
const pkgpath = path.parse(pkgurl.path);
|
||
|
const pkgfile = path.join(pkgpath.dir, "../package.json");
|
||
|
const info = JSON.parse(await fs.readFile(pkgfile));
|
||
|
console.log(info.version);
|
||
|
}
|