Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
36 lines (26 loc) · 983 Bytes

File metadata and controls

36 lines (26 loc) · 983 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { existsSync, readFile, writeFileSync } from "fs-extra"
import { fatal, log } from "./command"
import { readJSON5Sync } from "./jsonc"
import { addNpm } from "./init"
function fail(msg: string): never {
log(`
Expected usage of this command is for you to create a new GitHub repo based on template:
https://github.com/microsoft/devicescript-package-template
Then in the fresh clone of you repo run:
yarn
yarn devs init-template
`)
fatal(msg)
}
export async function initTemplate() {
if (!existsSync("package.json")) fail("expecting package.json file")
if (!existsSync(".git")) fail(`expecting to be in a git cloned folder`)
let pkg: any = readJSON5Sync("package.json")
if (pkg.name) fail(`package.json already patched?`)
await addNpm({})
pkg = readJSON5Sync("package.json")
if (pkg.author) {
const l = await readFile("LICENSE", "utf-8")
writeFileSync("LICENSE", l.replace("The Author", pkg.author))
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.