diff --git a/package.json b/package.json index 1fcba23..b84156c 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,8 @@ "test": "echo \"Error: no test specified\" && exit 1", "build": "scripty", "watch:build": "scripty", + "copy": "scripty", + "watch:copy": "scripty", "lint": "scripty", "run": "scripty", "watch:run": "scripty", diff --git a/script/build.sh b/script/build.sh index 0961259..5d284bc 100755 --- a/script/build.sh +++ b/script/build.sh @@ -1,4 +1,6 @@ #!/usr/bin/env bash # --delete-dir-on-start breaks nodemon -swc src -d dist --strip-leading-paths $@ +swc \ + src --strip-leading-paths -d dist \ + $@ diff --git a/script/copy.sh b/script/copy.sh new file mode 100755 index 0000000..6777086 --- /dev/null +++ b/script/copy.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +# hopefully excluding all ts files +# instead of including all node_modules +# doesn't come to bite me in the ass +# later +rsync \ + --verbose \ + -a --del src/ dist \ + --exclude "*.ts" \ + $@ diff --git a/script/watch/copy.sh b/script/watch/copy.sh new file mode 100755 index 0000000..1f72931 --- /dev/null +++ b/script/watch/copy.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +nodemon --watch src --exec "./script/copy.sh $@" diff --git a/src/m3/command/init.ts b/src/m3/command/init.ts index 8dacc9d..6699e04 100644 --- a/src/m3/command/init.ts +++ b/src/m3/command/init.ts @@ -196,6 +196,8 @@ async function init(options: InitOptions): Promise { task.output = 'validating schema...'; const safe = PackageJsonSchema.parse(unsafe); + delete safe.index; + safe.type = 'module'; safe.name = options.name; safe.author = options.author; safe.license = options.license;