diff --git a/.gitignore b/.gitignore index fbf8803..ae75905 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,6 @@ !jest.config.js node_modules dist/ +bin/ manifests/ __snapshots__/ diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b128d57 --- /dev/null +++ b/Makefile @@ -0,0 +1,39 @@ +RELEASE_VERSION = 1.0.0-alpha +TARGET_PATH = bin/target/ +BUNDLE_PATH = bin/bundle/ + +define bundleProject + ncc build bin/main.js -o $(BUNDLE_PATH) +endef + +buildWindows: + $(call bundleProject) + pkg $(BUNDLE_PATH)index.js --output $(TARGET_PATH)levis-win --targets node14-win-x64 + mv $(TARGET_PATH)levis-win.exe $(TARGET_PATH)levis.exe + cd $(TARGET_PATH) && zip levis-$(RELEASE_VERSION)-win-x64.zip levis.exe + rm -rf $(TARGET_PATH)levis.exe + +buildMacOS: + $(call bundleProject) + pkg $(BUNDLE_PATH)index.js --output $(TARGET_PATH)levis-macos --targets node14-macos-x64 + mv $(TARGET_PATH)levis-macos $(TARGET_PATH)levis + cd $(TARGET_PATH) && tar -zcvf levis-$(RELEASE_VERSION)-macos-x64.tar.gz levis + rm -rf $(TARGET_PATH)levis + +buildLinux: + $(call bundleProject) + pkg $(BUNDLE_PATH)index.js --output $(TARGET_PATH)levis-linux --targets node14-linux-x64 + mv $(TARGET_PATH)levis-linux $(TARGET_PATH)levis + cd $(TARGET_PATH) && tar -zcvf levis-$(RELEASE_VERSION)-linux-x64.tar.gz levis + rm -rf $(TARGET_PATH)levis + +compile: + yarn run build-all + +build: buildWindows buildMacOS buildLinux + +clean: + rm -rf $(BUNDLE_PATH) + rm -rf $(TARGET_PATH) + +all: clean compile buildWindows buildMacOS buildLinux \ No newline at end of file diff --git a/package.json b/package.json index 9bbd47f..8e19108 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { "name": "levis", - "version": "1.0.0", + "version": "1.0.0-alpha", "main": "main.js", "types": "main.ts", - "license": "Apache-2.0", + "license": "MIT", "private": true, "scripts": { "import": "cdk8s import", diff --git a/src/utils/fileUtils.ts b/src/utils/fileUtils.ts index 020f558..b48b636 100644 --- a/src/utils/fileUtils.ts +++ b/src/utils/fileUtils.ts @@ -10,14 +10,8 @@ export class FileUtils { Fs.rmdirSync(newPath, { recursive: true }); } Fs.mkdirSync(newPath, { recursive: true }); - Fs.rename(oldPath, newPath, (error) => { - if(error) { - log.error(error); - process.exit(1); - } - Fs.rmdirSync(oldPath, { recursive: true }); - log.info("Successfully moved %s to %s.", oldPath, newPath); - } - ); + Fs.renameSync(oldPath, newPath); + Fs.rmdirSync(oldPath, { recursive: true }); + log.info("Successfully moved %s to %s.", oldPath, newPath); } }