From ac448df0c7e7717679e116091a2e6cbef0fe6038 Mon Sep 17 00:00:00 2001 From: Cagatay Civici Date: Mon, 18 Jan 2021 14:20:53 +0300 Subject: [PATCH] Remove old build file --- build-lib.js | 105 --------------------------------------------------- 1 file changed, 105 deletions(-) delete mode 100644 build-lib.js diff --git a/build-lib.js b/build-lib.js deleted file mode 100644 index 031b500ea..000000000 --- a/build-lib.js +++ /dev/null @@ -1,105 +0,0 @@ -const fs = require('fs-extra'); -const path = require('path'); -const Service = require('@vue/cli-service/lib/Service'); -const service = new Service(process.env.VUE_CLI_CONTEXT || process.cwd()); -const _file = require("@babel/cli/lib/babel/file"); - -function buildComponent(folder, file, name) { - service.run('build', { - _: ['build', 'src/components/' + folder + '/' + file, 'build'], - modern: false, - report: false, - 'report-json': false, - 'inline-vue': false, - watch: false, - open: false, - copy: true, - https: false, - verbose: false, - target: 'lib', - clean: false, - name: name, - dest: 'dist/' + folder - }, - [ - 'build', - 'src/components/' + folder + '/' + file, - 'build', - '--target', - 'lib', - '--no-clean', - '--name', - name, - '--dest', - 'dist/' + folder - ]); -} - -function transpileJS(folder, file) { - var options = { - babelOptions: { - configFile: './.babelrc-lib' - }, - cliOptions: { - filename: undefined, - filenames: ['src/components/' + folder + '/' + file], - extensions: undefined, - keepFileExtension: undefined, - outFileExtension: undefined, - watch: undefined, - skipInitialBuild: undefined, - outFile: 'dist/' + folder + '/' + file, - outDir: undefined, - relative: undefined, - copyFiles: undefined, - copyIgnored: undefined, - includeDotfiles: undefined, - verbose: undefined, - quiet: undefined, - deleteDirOnStart: undefined, - sourceMapTarget: undefined - } - } - - _file.default(options).catch(err => { - console.error(err); - process.exitCode = 1; - }); -} - -function blue(str) { - return '\x1b[1m\x1b[34m' + str + '\x1b[39m\x1b[22m'; -} - -function green(str) { - return '\x1b[1m\x1b[32m' + str + '\x1b[39m\x1b[22m'; -} - -fs.readdirSync(path.resolve(__dirname, './src/components/')).forEach(folder => { - fs.readdirSync(path.resolve(__dirname, './src/components/' + folder)).forEach(file => { - if (!(/\.js$/.test(file)) || file === 'index.js') { - fs.copySync(path.resolve(__dirname, './src/components/' + folder) + '/' + file, 'dist/' + folder + '/' + file); - } - }); -}); - -fs.readdirSync(path.resolve(__dirname, './src/components/')).forEach(folder => { - fs.readdirSync(path.resolve(__dirname, './src/components/' + folder)).forEach(file => { - if (file !== 'index.js' && file !== 'index.d.ts') { - let name = file.split(/(.vue)$|(.js)$/)[0].toLowerCase(); - if (/\.js$/.test(file)) { - console.log('Transpiling ' + blue(file)); - buildComponent(folder, file, name); - transpileJS(folder, file); - } - else if (/\.vue$/.test(file)) { - console.log('Building ' + green(name)); - buildComponent(folder, file, name); - } - } - }); -}); - -fs.copySync(path.resolve(__dirname, './package-build.json'), 'dist/package.json'); -fs.copySync(path.resolve(__dirname, './README.md'), 'dist/README.md'); -fs.copySync(path.resolve(__dirname, './LICENSE.md'), 'dist/LICENSE.md'); \ No newline at end of file