-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
13 additions
and
204 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,10 @@ | ||
#!/usr/bin/env node | ||
import execa from "execa"; | ||
import init from "init-package-json"; | ||
import path from "path"; | ||
|
||
const HOME = process.env.HOME || "."; | ||
// a path to a promzard module. In the event that this file is | ||
// not found, one will be provided for you. | ||
const initFile = path.resolve(HOME, ".npm-init"); | ||
|
||
// the dir where we're doin stuff. | ||
const dir = process.cwd(); | ||
|
||
// extra stuff that gets put into the PromZard module's context. | ||
// In npm, this is the resolved config object. Exposed as 'config' | ||
// Optional. | ||
const configData = { some: "extra stuff" }; | ||
|
||
// Any existing stuff from the package.json file is also exposed in the | ||
// PromZard module as the `package` object. There will also be free | ||
// vars for: | ||
// * `filename` path to the package.json file | ||
// * `basename` the tip of the package dir | ||
// * `dirname` the parent of the package dir | ||
|
||
init(dir, initFile, configData, function(_er, _data) { | ||
// the data's already been written to {dir}/package.json | ||
// now you can do stuff with it | ||
(async () => { | ||
await execa("npm", ["install", "typescript", "@types/node", "--save-dev"]); | ||
await execa("tsc", ["--init"]); | ||
})(); | ||
}); | ||
const packageFile = path.resolve(dir, "package.json"); | ||
if (packageFile) { | ||
console.log("Found package.json:", packageFile); | ||
} else { | ||
console.log("Did not find package.json"); | ||
} |