@@ -13,7 +13,7 @@ import { preludeFiles } from "@devicescript/compiler"
1313const MAIN = "main.ts"
1414const GITIGNORE = ".gitignore"
1515
16- const optionalFiles : Record < string , any > = {
16+ const optionalFiles : Record < string , Object | string > = {
1717 "tsconfig.json" : {
1818 compilerOptions : {
1919 moduleResolution : "node" ,
@@ -43,6 +43,36 @@ const optionalFiles: Record<string, any> = {
4343 ".vscode/extensions.json" : {
4444 recommendations : [ "esbenp.prettier-vscode" ] ,
4545 } ,
46+ "README.md" : `# - project name -
47+
48+ This project uses [DeviceScript](https://microsoft.github.io/devicescript/).
49+
50+ ## Local/container development
51+
52+ - install node.js and dependencies
53+
54+ \`\`\`bash
55+ yarn install
56+ \`\`\`
57+
58+ - prepare TypeScript support files
59+
60+ \`\`\`bash
61+ yarn setup
62+ \`\`\`
63+
64+ - launch developer server
65+
66+ \`\`\`bash
67+ yarn watch
68+ \`\`\`
69+
70+ - navigate to devtools page (see terminal output)
71+ to use the simulators or deploy to hardware.
72+
73+ - open \`main.ts\` in your favorite TypeScript IDE and start editing.
74+
75+ ` ,
4676}
4777export interface InitOptions {
4878 force ?: boolean
@@ -59,7 +89,9 @@ export default function init(options: InitOptions & CmdOptions) {
5989 debug ( `write ${ fn } ` )
6090 const dn = dirname ( fn )
6191 if ( dn ) ensureDirSync ( dn )
62- writeJSONSync ( fn , data , { spaces } )
92+ if ( typeof data === "string" )
93+ writeFileSync ( fn , data , { encoding : "utf8" } )
94+ else writeJSONSync ( fn , data , { spaces } )
6395 } else {
6496 debug ( `skip ${ fn } , already exists` )
6597 }
0 commit comments